Arahan terminal; SSH auto login

Dalam tutorial ini ditunjukan cara yang ringkas bagaimana hendak membuat auto login ke remote server dengan menggunakan SSH. Ada beberapa faktor mengapa ada masanya anda inginkan untuk login ke SSH server tanpa perlu memasukkan password.

1) Anda mempunyai scripts yang menghantar fail dengan menggunakan sftp,scp atau rsync+ssh.
2) Anda mempunyai banyak server yang mempunyai password yang berlainan.
3) Anda malas nak taip password.

Jadi, bagaimana caranya? ayuh kita baca caranya:

1) Dari terminal anda taipkan arahan dibawah:

ssh-keygen -t dsa

- Anda boleh memilih sama ada ingin menggunakan rsa atau dsa.
- Tekan enter bagi sebarang soalan.
- Output yang diberikan lebih kurang seperti dibawah

# ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/root/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_dsa.
Your public key has been saved in /root/.ssh/id_dsa.pub.
The key fingerprint is:
87:27:7a:8d:22:13:3f:87:22:cd:ec:0e:eb:e1:29:4a root@petai.sedap.com

- Perhatian teks “/root/.ssh/id_dsa.pub”. Itu ialah fail bagi public cerificate anda.

2) Tukar permission fail tadi kepada 600

chmod 600 /root/.ssh/id_dsa.pub

3) Copy fail “id_dsa.pub” tadi ke remote server anda sebagai “authorized_keys” dengan menggunakan arahan yang dicadangkan seperti dibawah:

scp /root/.ssh/id_dsa.pub root@remoteserveradnda.com:/root/.ssh/authorized_keys

4) Cuba login ke server anda, jika masih meminta password, ada beberapa kemungkinan

- Anda salah copy fail
- Permission bagi fail “authorized_keys” masih tidak secure
- Masalah berkenaan konfigurasi SSH server anda.

Sekian. Terima kasih kerana membaca.

ipcalc using mysql function

Aku cuba menggunakan sepenuhnya function mysql yang ada. Salah satunya penggunaan ipcalc; ipcalc ini dalam fedora ada (/bin/ipcalc), gunanya untuk calculate network address.

INSTALL:
1) Copy code dekat bawah
2) Connect ke mysql atau guna phpmyadmin
3) paste

Anda boleh check ade 3 functions yang akan dicreate
1) ipcalc
2) mask2prefix = convert netmask to prefix
3) prefix2mask = convert prefix to netmask

CODE:

-- ipcalc: calculate IPv4 address
-- nawawi <mohd.nawawi(at)gmail.com>
-- http://www.ronggeg.net/

DELIMITER //

CREATE FUNCTION `mask2prefix`(mask VARCHAR(15)) RETURNS bigint(10)
    DETERMINISTIC
BEGIN

DECLARE m BIGINT(10);
DECLARE c INT;

SET m=INET_ATON(mask);
SET c=0;
WHILE(m > 0) DO
 SET m=m << 1 & 0xffffffff;
 SET c=c+1;
END WHILE;
RETURN c;
END//

CREATE FUNCTION `prefix2mask`(prefix INT(3)) RETURNS varchar(15) CHARSET utf8
    DETERMINISTIC
BEGIN
RETURN INET_NTOA(~((1 << (32 - prefix)) - 1) & 0xffffffff);
END//

CREATE FUNCTION `ipcalc`(opt CHAR(1), ip VARCHAR(15), mask VARCHAR(15)) RETURNS varchar(15) CHARSET utf8
    DETERMINISTIC
BEGIN

DECLARE i BIGINT(10);
DECLARE m BIGINT(10);
DECLARE r BIGINT(10);

SET i=(INET_ATON(ip));
SET m=(INET_ATON(mask));

CASE opt
 WHEN 'p' THEN RETURN mask2prefix(mask);
 WHEN 'n' THEN SET r=i & m;
 WHEN 'b' THEN SET r=(i & m) | ~m & 0xffffffff;
ELSE
 SET r=NULL;
END CASE;
RETURN INET_NTOA(r);

END//

DELIMITER ;

CARA GUNA:
ipcalc(option,ip,netmask);
option: n = network, b = broadcast, p = prefix

mysql> select ipcalc('n','192.168.0.1','255.255.255.0') as network;
+-------------+
| network     |
+-------------+
| 192.168.0.0 |
+-------------+
1 row in set (0.00 sec)

mysql> select ipcalc('b','192.168.0.1','255.255.255.0') as broadcast;
+---------------+
| broadcast     |
+---------------+
| 192.168.0.255 |
+---------------+
1 row in set (0.00 sec)

mysql> select ipcalc('p','192.168.0.1','255.255.255.0') as prefix;
+--------+
| prefix |
+--------+
| 24     |
+--------+
1 row in set (0.00 sec)

mysql> select ipcalc('n','192.168.0.1',prefix2mask(24)) as network;
+-------------+
| network     |
+-------------+
| 192.168.0.0 |
+-------------+
1 row in set (0.00 sec)

mysql> select ipcalc('b','192.168.0.1',prefix2mask(24)) as broadcast;
+---------------+
| broadcast     |
+---------------+
| 192.168.0.255 |
+---------------+
1 row in set (0.00 sec)

mysql> CREATE DATABASE  `kejap` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
Query OK, 1 row affected (0.00 sec)

mysql> use kejap;
Database changed
mysql> CREATE TABLE  kejap.ip (ip VARCHAR( 15 ) NOT NULL ,mask VARCHAR( 15 ) NOT NULL) ENGINE = INNODB;
Query OK, 0 rows affected (0.05 sec)

mysql> INSERT INTO  kejap.ip (ip,mask) VALUES ('192.168.0.1',  '255.255.255.0'), ('192.168.2.1',  '255.255.255.0');
Query OK, 2 rows affected (0.00 sec)
Records: 2  Duplicates: 0  Warnings: 0

mysql> select ip,mask,ipcalc('n',ip,mask) as network from ip;
+-------------+---------------+-------------+
| ip          | mask          | network     |
+-------------+---------------+-------------+
| 192.168.0.1 | 255.255.255.0 | 192.168.0.0 |
| 192.168.2.1 | 255.255.0.0   | 192.168.0.0 |
+-------------+---------------+-------------+
2 rows in set (0.00 sec)

mysql> select ip,mask,ipcalc('n',ip,mask) as network,mask2prefix(mask) as prefix from ip;
+-------------+---------------+-------------+--------+
| ip          | mask          | network     | prefix |
+-------------+---------------+-------------+--------+
| 192.168.0.1 | 255.255.255.0 | 192.168.0.0 |     24 |
| 192.168.2.1 | 255.255.0.0   | 192.168.0.0 |     16 |
+-------------+---------------+-------------+--------+
2 rows in set (0.00 sec)

mysql> ALTER TABLE `ip` CHANGE `ip` `ip` VARCHAR(15) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, CHANGE `mask` `mask` VARCHAR(15) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL
    -> ;
Query OK, 0 rows affected (0.00 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> select ip,mask,CONCAT(ipcalc('n',ip,mask),'/',mask) as network,mask2prefix(mask) as prefix from ip;
+-------------+---------------+---------------------------+--------+
| ip          | mask          | network                   | prefix |
+-------------+---------------+---------------------------+--------+
| 192.168.0.1 | 255.255.255.0 | 192.168.0.0/255.255.255.0 |     24 |
| 192.168.2.1 | 255.255.0.0   | 192.168.0.0/255.255.0.0   |     16 |
+-------------+---------------+---------------------------+--------+
2 rows in set (0.00 sec)

Selamat mencuba!

What’s Your Business Model?

You can read original article: “What’s Your Business Model?” By C.J. Hayden, MCC

If you have enough clients to keep you busy, you must be making a good living, right? Well, not necessarily. Some of the busiest professionals around aren’t earning enough to pay their bills. On the other hand, there are some consultants, coaches and other service providers who have plenty of time on their hands but also earn quite a bit of money.

The difference between the income levels of these two groups isn’t just because one group is better at marketing than the other. The difference is in their business models.

Simply put, your business model is the answer to the question “How do you intend to make money?” It’s your plan for how you will generate sufficient revenue to meet your expenses and earn a profit. Unfortunately, many independent professionals don’t actually have a profit-making plan. And some of those who think they have one are relying a bit more on magic than they are on statistics.

For example, when you first hang out your professional shingle, charging RM100 per hour may seem like quite a lot. After all, if you earned as much as RM100,000 per year at your last job working a 40-hour week, you were still only making RM48 per hour. So perhaps you think that doubling your former hourly rate should be more than adequate to keep your net earnings at their former level.

Let’s do some quick math. If your business model is based on working intensively for one major client for weeks or months at a time, such as many corporate consultants do, an hourly rate of RM100 could indeed generate RM100,000 per year. All you would have to do is keep busy approximately half of the time. RM100 per hour times 20 billable hours per week times 50 weeks per year equals RM100,000.

But what if your business model is based on working only two to four hours per month for each client, like many coaches, therapists, or healing professionals? Now if you want to earn RM100,000 per year, in order to bill those same 20 hours per week, you’ll need 20 clients at once if you see them for an hour per week and 40 or more if you see them for less time or meet less often.

In the first example above, you only need a handful of clients each year and have large blocks of time left over to market yourself. That’s a sensible and realistic business model. In the second example, you need a constant stream of new clients coming in and the time you have available for marketing is likely to be broken into small chunks between appointments. That sort of model is more likely to lead to stress and struggle than it is to success.

The first place you might look in order to fix model number two is raising your hourly rate. You could charge RM150 per hour, RM200 per hour, or more, if your target market will pay it. But rates like these may be out of reach for many potential clients, and difficult for you to justify.

But rate increases aren’t the only way to fix a broken business model. Both of the models we’ve been examining are fee-for-service models, based on an hourly rate. Instead, you could choose a different type of model altogether. Here are some examples:

Fee for Service Models

Day Rate – Instead of charging by the hour, you can charge by the day or half-day. This imposes a minimum on your clients, avoiding short appointments that fragment your work schedule. Examples:

  1. An on-site massage therapist calling on corporate clients
  2. A professional organizer serving home-based businesses.

Project Fee – Charging a flat fee for each project allows you to bill for time you spend planning, researching, or just thinking about your client’s issues. Clients often prefer flat fees because they can budget their funds more accurately. Examples:

  1. A graphic designer creating a logo.
  2. A communications consultant writing a company newsletter.

Monthly Retainer - When you ask clients to pay by the month in advance, you can charge for your availability, not just service delivered. Your retainer can guarantee you a fixed number of hours. If the client uses less, you still get paid. If they use more, you can charge extra. Examples:

  1. A career coach offering as-needed calls and e-mails in between sessions.
  2. A virtual assistant providing on-call customer service for a small business.

Product-Based Models

Flat Fee – A wide variety of items can be sold for a flat fee to increase revenue to your business. “Products” can also include services delivered in a defined package. Your buyers may be either existing clients, or others who can’t afford to hire you individually. Examples:

  1. A conflict resolution consultant offering public seminars.
  2. An executive coach providing personality assessments; an image consultant selling a wardrobe design kit.

Subscription – Providing products or services by subscription can provide a steady source of income and reduce marketing time. A sale made only once can continue to provide revenue. Examples:

  1. A sales trainer selling an educational CD series by monthly subscription.
  2. A life coach hosting a membership-based online community.

Bait and Hook - Also called the “razor and blades” model, Examples:

  1. A time management consultant offering a training program including day planners that must be re-ordered.
  2. A web designer providing proprietary modules under a license that must be renewed annually.

Any one of these models can be used to build an entire business, or you can combine different models together. For example,

  1. A consultant could charge a flat fee for assessments, then a day rate to deliver services.
  2. A coach could charge a subscription fee for group clients and a monthly retainer for clients worked with individually.

If your business isn’t earning as much as you would like, look beyond your marketing or the rate you’re charging. The real solution may be to choose a new business model.

How to calculate the table size in mysql

If you’re looking how to calculate table size in mysql like phpmyadmin does. You can try like below:

1) If you’re using root access. Replace ‘mysql’ with your database name.

SELECT table_schema,table_name,ROUND((data_length+index_length)/1024,1) as total_size_in_kb
FROM information_schema.tables
WHERE table_schema = ‘mysql’;

This will return size in Kilobytes.

2) If you have limited access to mysql database, you can use php code below:

<?php

$link = mysql_connect('host', 'username', 'password');

$db_name = "mysql";
$tables = array();

mysql_select_db($db_name, $link);
$result = mysql_query("SHOW TABLE STATUS");
while($row = mysql_fetch_array($result)) {
    $total_size = ($row[ "Data_length" ] +
                   $row[ "Index_length" ]) / 1024;
    $tables[$row['Name']] = sprintf("%.2f", $total_size);
}
print_r($tables);
?>

Freelance Ethics

You can read original article: “How Trustworthy Are You? – Freelance Ethics” By Chris King

How Trustworthy Are You?
Both weekly and monthly, I receive a large number of publications that deal with business and technology. Ever since the whole Enron scandal became news, these magazines have and are featuring more and more articles dealing with business ethics, honesty and trust. In every profession, business and career, attention to ethics, integrity, honesty and trust are paramount to ultimate success. I suggest that there are ethics and principles that we, as free agents, independent professionals and freelancers should embrace and follow. I am going to highlight and explain the freelance lifer’s ethics and principles in which I believe. I will warn you that in this article I am more opinionated than ever, but these are the beliefs that have worked for me over the years and have worked for those free agents, independent professionals and freelancers who are at the top of their professions and are still and ever earning a hearty income today.

A professional is up front and honest about what he or she does for a living and is willing to do for a client.
First of all, we must be honest with ourselves. We must know our own strengths and weaknesses, our likes and dislikes. When meeting with potential clients, I feel that it is of utmost importance to be genuine and sincere. It is also important to work ethically and with integrity – never performing a task that challenges our principles, no matter how much money we are offered. Even bending the rules a “tiny bit” will eat away at us and undermine our attitude and career. Being a fitness instructor, I was involved in an all day Yoga workshop given by a Yoga Master. She told us that Yoga was not only a physical discipline but also a whole way of life. She shared an example of what she as a Yoga Master did when driving up to an ATM machine and finding cash left accidentally by the previous user. She said that she knew right away to get out of her car and to take the money into the bank to be returned to its rightful owner. I have the sinking feeling that a good number of people might grab that money and drive away.

A professional honestly and accurately communicates his or her qualifications.
This follows directly from the previous paragraph. We must never create qualifications – like college degrees we didn’t earn or clients we never had or work we’ve never performed – to make ourselves look more experienced than we are. I know successful freelancers who are in demand, yet don’t have that coveted degree, wealthy backgrounds or clients from Fortune 500 companies. It is more important to be able to professionally fill people’s wants and needs – to discover and solve their problems. It boggles my mind when I read about all of the falsification in resumes, let alone small businesses’ brochures and websites. Who would ever hire you for a job if they found out that you were lying in your written communications?

A professional can be trusted completely by his or her clients to do the best job possible.
When we are hired for a job no matter how big or small, we must be willing “to give it our all.” That means proper preparation (the unethical freelancer just “wings it”), excellent research, hours of getting it “right” and sufficient contact and communication with the client. This also includes minute attention to details, never assuming, always confirming. It means always “going the extra mile” to please one’s client. This effort to please, however, leads to my next opinion.

The trustworthy professional doesn’t agree to take on a job or project outside of his or her expertise or interests.
Just because you would like to receive the fee, don’t agree to tackle work that you are unprepared to do properly and easily or a project that won’t be to your liking. I know that when times are tough, it is hard to turn down work. But working on a task that we are not prepared to do well or with at least a modicum of passion is the surest way to “turn off” a client and word does travel. A much better approach that will pay off in the long run is to recommend a colleague well-versed and well-prepared in that area. Both the client and your colleague will always remember you for your honesty and help. I also believe that “what goes around, comes around” so your good deed will eventually multiply in your favor.

The ethical professional treats all clients and other freelancers with respect and fairness.
In my opinion this means never divulging confidentialities, charging different clients different fees according to what the “traffic will bear” or speaking badly of or spreading rumors about another freelancer or client. If, for example, someone asks what you think about another person’s abilities and you are not impressed by that person’s work or approach, it is better to say nothing or make a suggestion of someone “I am more familiar with.”

A true professional asks, “What can I do to help others achieve their goals?”
Even though time is one of our most valuable assets, I feel that we must take the time to help others when they ask us for assistance. I am not saying that we need to always be available for the “free loaders.” You know who they are. But I am suggesting that when someone calls for information or tips on how to solve a problem, we are gracious and giving. The business people I know who are open and willing to share what they have learned from their mistakes and victories are those business people who are succeeding in today’s shaky economy. They are sincere and genuine mentors. You will find that the more people we help, the more people who want to and can help us will appear.

coder vs programmer

Coders are like smart assembly line workers who follow instructions of the large program. Programmers are the brains, the glorious visionaries who create things. Large software programmers that often run into billions of lines are designed and developed by a handful of programmers.

Read original article at http://brajeshwar.com/2007/are-you-a-programmer-or-a-coder/

Programmer/Coder: Are you a Programmer or a Coder?

Are programmers and Coders the most neglected link in the Software Development Chain? Coders are like smart assembly line workers as opposed to programmers who are plant engineers. Programmers are the brains, the glorious visionaries who create things. Large software programmers that often run into billions of lines are designed and developed by a handful of programmers. Coders follow instructions of the large program.

Some industry experts have put in that — if programming requires a post graduate level of knowledge of complex algorithms and programming methods, coding requires only high school knowledge of the subject. Coding is deemed repetitive and monotonous.

During many events, like the one last week in India at the annual fair of the software industry’s apex body Nasscom, no one mentioned anything about Programmer or aptly the coders. The event, which brought together software professionals from around the world, used up all its 29 sessions to discuss prospects to improve the performance of software companies. Panels chose to debate extensively on subjects like managing innovation, business growth and multiple geographies. But there was nothing on programmers/coders, whom we all believed are the driving force behind the success of any software company.

It has been an eternal battle between the business cubicles and the programmers box if technology drives the business or vice versa. Well, one compliments the other.

In the Indian context, the software professionals aka the programmers aka the coders are the poster boy of Matrimonial classifieds. They are well paid, perceived to be intelligent and travel abroad frequently on software assignments. Or, are they really? Are they paid appropriately for the slogging they do? Are they really intelligent or they follow the directions of the business directives? They travel but do they have a choice, or are they flown and placed like pawns at strategic location by the kings (business tycoons)? Yes, it is an open secret fact which Software Companies won’t say/accept — that Software Professionals specially in India are not programmers but mere coders, they are the assembly line workers.

A Microsoft analyst have rightly said, “Like our manufacturing Industry, the Indian software industry is largely a process driven one. That should speak for the fact that we still don’t have a domestic software product like Yahoo or Google to use in our daily lives.” Is this also another reason that, IIT graduates have consciously shunned India’s best known companies like Infosys and TCS, though they are offered very attractive salaries?

American companies still feel that most of the so called engineers in Indian companies are mere coders. They are almost identical workers who sat along hours to write lines after lines of codes, or test a fraction of a program. They did not complain because their pay and perks were good. Another fuel to this fire is that of the Indian social fabric. Parents, families and spouses do not know or care about the type of works programmers or coders do, they are more interested in the Name of the Company they work for, their monthly paycheck and the ability to include terms like Software Professionals, BPO Team Lead, working in MNC, in their matrimonial classifieds.

Of late, there are uprisings everywhere, emotionally among Programmers in many software companies. They are yearning to do something on their own, something out of the ordinary due to the increasing feeling of dejection. Many programmers want to get out of their routine monotonous coding which no longer excite them. Programmers are toying with ideas of moving out of some of th reputed companies, where they are like caterpillars climbing a wall without knowing how high the wall is.

This is perhaps just the beginning.

Do you want to be a programmer or a coder?

Bagaimana install firefox 3.6 stabil dari ubuntu PPA

Tutorial ini akan menjelaskan cara memasang firefox 3.6 stabil dari ubuntu PPA.Jika anda ingin tahu tentang ciri-ciri kelebihan 3.6 sila klik pada link ini .
Tutorial ini kami ambil dari website ubuntugeek.net
Untuk Pengguna ubuntu Karmic/Lucid

Buka command prompt dan jalankan langkah-langkah berikut :

sudo add-apt-repository ppa:mozillateam/firefox-stable

sudo apt-get update

sudo apt-get install firefox-3.6

Untuk Pengguna ubuntu 9.04 (Jaunty)

Pertama anda perlu mengedit / etc / apt / sources.list

gksudo gedit /etc/apt/sources.list

tambahkan baris berikut
deb http://ppa.launchpad.net/mozillateam/firefox-stable/ubuntu jaunty main
deb-src http://ppa.launchpad.net/mozillateam/firefox-stable/ubuntu jaunty main
Save dan exit

sudo apt-get update

Install firefox 3.6 stable

sudo apt-get install firefox-3.6

Untuk Pengguna ubuntu 8.10 (Intrepid)
Pertama anda perlu mengedit / etc / apt / sources.list

gksudo gedit /etc/apt/sources.list

deb http://ppa.launchpad.net/mozillateam/firefox-stable/ubuntu intrepid main
deb-src http://ppa.launchpad.net/mozillateam/firefox-stable/ubuntu intrepid main
Save dan exit
Mengemaskini source list

sudo apt-get update

Install firefox 3.6 stable

sudo apt-get install firefox-3.6

Untuk Pengguna ubuntu 8.04 (Hardy)
Pertama anda perlu mengedit / etc / apt / sources.list

gksudo gedit /etc/apt/sources.list

tambahkan baris berikut
deb http://ppa.launchpad.net/mozillateam/firefox-stable/ubuntu hardy main
deb-src http://ppa.launchpad.net/mozillateam/firefox-stable/ubuntu hardy main
Save dan exit
Mengemaskini source list

sudo apt-get update

Install firefox 3.6 stable

sudo apt-get install firefox-3.6


Happy Birthday To You…

Create your own ubuntu server

I started using ubuntu server last year, when fedora become too bloated for me. I’m always like to install minimal and remove any package i don’t like. So.. i wrote this script for rebranding ubuntu server. Called as OptCepat :D , i don’t have idea what name need to put since this just a simple bash script. Btw, here the instruction:

Requirement:

  1. Ubuntu Server (karmic)
  2. Ubuntu Server (karmic) iso file.

Step to install:

  1. Install Ubuntu Server Karmic (this script developed on karmic)
  2. On your new installation server, download this tarball OptCepat:
    # wget http://dl.ronggeng.net/pub/optcepat.tgz
    
  3. Extract to /opt path:
     # tar -C /opt -zxvf optcepat.tgz
  4. Change directory to /opt/optcepat: # cd /opt/optcepat
  5. Create /opt/cd-image directory:
     # mkdir -p /opt/cd-image
  6. Mount or copy ubuntu server iso files to /opt/cd-image.
  7. Edit build.sh, change _NAME.
  8. Execute build.sh:
     # ./build.sh
  9. New iso will create under iso directory.

The tarball included with some package list, extra debian package and sample tarball package. You can play around and modified if you like. You can change some default setting under src/preseed/optcepat.seed.

If you found any bugs, just fix it :D .

New Malaysian Linux Distro

I found a post at some website pointed to http://1simplelinux.blogspot.com. If you’re curious about what it is. Please browse, and perhaps you guys can give some idea and support to them.