One day, I'll need these websites badly.
Thursday, January 28, 2010
Jobless, need money, why not freelance from home?
You can start freelancing effectively using these websites:
Wednesday, June 13, 2007
A Useful Command Prompt Tip
netstat -an |find ":80"
The above command I use so frequently. It really helps me out figure if there is a webserver running on the machine (ie. listening on port 80).
Actually, this command is a combination of two commands. The first is netstat which displays a boring long table.
The second is find "XX" which ignores all strings that dont contain "XX".
The '|' is the pipe operator. Now the command simply pipes the output of 'netstat' into 'find', the result is the line that contains the string "80".
If you're from a linux background, you'll find this post a bit too obvious. Since we're used to using the 'grep' command (which is similar to 'find' on windows).
The above command I use so frequently. It really helps me out figure if there is a webserver running on the machine (ie. listening on port 80).
Actually, this command is a combination of two commands. The first is netstat which displays a boring long table.
The second is find "XX" which ignores all strings that dont contain "XX".
The '|' is the pipe operator. Now the command simply pipes the output of 'netstat' into 'find', the result is the line that contains the string "80".
If you're from a linux background, you'll find this post a bit too obvious. Since we're used to using the 'grep' command (which is similar to 'find' on windows).
Sunday, June 03, 2007
Microsoft PowerToys
Add convenience to your life ...
Try these free tools:
1. Alt-Tab Replacement
When using Alt-Tab, this will show you a small thumbnail of the program you are switching too. Very helpful when switching to multiple instances of the same application.
2. Power Calculator
Enhanced calculator for your OS.
3. Open Command Window Here
Allows you to open the command window for any folder you are currently in.
4. Image Resizer
Resize images on the spot.
5. ClearType Tuner
This PowerToy lets you use ClearType technology to make it easier to read text on your screen, and installs in the Control Panel for easy access.
Download any or all at:
http://www.microsoft.com/windowsxp/downloads/powertoys/xppowertoys.mspx
Try these free tools:
1. Alt-Tab Replacement
When using Alt-Tab, this will show you a small thumbnail of the program you are switching too. Very helpful when switching to multiple instances of the same application.
2. Power Calculator
Enhanced calculator for your OS.
3. Open Command Window Here
Allows you to open the command window for any folder you are currently in.
4. Image Resizer
Resize images on the spot.
5. ClearType Tuner
This PowerToy lets you use ClearType technology to make it easier to read text on your screen, and installs in the Control Panel for easy access.
Download any or all at:
http://www.microsoft.com/windowsxp/downloads/powertoys/xppowertoys.mspx
Saturday, June 02, 2007
Who Said You Cant Learn Karate From A Book?
You can learn anything from books. A good book with good illustrations and a comprehendable language style can teach you anything.
The only extra large step you need is to continually practice. If you dont, then most probably you're dropping everything you've read.
Now wait a second, I know what you're thinking... but watch out for what I said; I said 'you can learn', but I didn't say 'its the best way!'. So lets face it, someone whom read a book about Karate will definitely know more than someone who haven't read (assuming both initially start in the same state).
Here's my evaluation of the different ways to learn ordered from best to worst:
1. Let an expert teach you, practice well, see what other experts teach, read about it, apply, understand the different schools on the same subject.
2. Let an expert teach you and practice well.
3. Read a book, and practice.
4. Read a book.
5. Do nothing.
Please note that I'm writing this post without any pre-research or good analysis on the subject. Therefore, please forgive my 'hardly scratching the surface analysis' (abbreviated HSTSA) on this subject.
The only extra large step you need is to continually practice. If you dont, then most probably you're dropping everything you've read.
Now wait a second, I know what you're thinking... but watch out for what I said; I said 'you can learn', but I didn't say 'its the best way!'. So lets face it, someone whom read a book about Karate will definitely know more than someone who haven't read (assuming both initially start in the same state).
Here's my evaluation of the different ways to learn ordered from best to worst:
1. Let an expert teach you, practice well, see what other experts teach, read about it, apply, understand the different schools on the same subject.
2. Let an expert teach you and practice well.
3. Read a book, and practice.
4. Read a book.
5. Do nothing.
Please note that I'm writing this post without any pre-research or good analysis on the subject. Therefore, please forgive my 'hardly scratching the surface analysis' (abbreviated HSTSA) on this subject.
Tuesday, May 29, 2007
File System Storage Versus BLOB Objects
Document Management Systems nowadays are heading towards storing all documents as BLOB objects in the database. You rarely find any server side applications that deal with documents as files.
Whether its a... Document, Content, Bug, Project, Knowledge Management System, they're all implementing document storage using BLOB objects.
Why it that then?
Well...
1. The first advantage of having everything stored in the database is the ease of backups and restorations. You no longer need to backup the database then backup your document's directory, then make sure they are synchronized.
2. The second advantage is that the documents are stored the same way on all platforms and partitions. Whether its FAT32, NTFS, or any other filesystem, you can store them all in the same way.
3. The third advantage is, you have full control of versioning documents, storing interesting information like diffs, dates, users performing on them.
4. The fourth advantage is that third party applications that connect to the database need only to have the database port available. No need to provide extra ftp access to acess the documents.
Thats it. Bottom line...
If you're building some kind of server application, consider a Database File System.
Whether its a... Document, Content, Bug, Project, Knowledge Management System, they're all implementing document storage using BLOB objects.
Why it that then?
Well...
1. The first advantage of having everything stored in the database is the ease of backups and restorations. You no longer need to backup the database then backup your document's directory, then make sure they are synchronized.
2. The second advantage is that the documents are stored the same way on all platforms and partitions. Whether its FAT32, NTFS, or any other filesystem, you can store them all in the same way.
3. The third advantage is, you have full control of versioning documents, storing interesting information like diffs, dates, users performing on them.
4. The fourth advantage is that third party applications that connect to the database need only to have the database port available. No need to provide extra ftp access to acess the documents.
Thats it. Bottom line...
If you're building some kind of server application, consider a Database File System.
Wednesday, May 23, 2007
The 3arabeezy Habit
In the old university days, whenever I met someone speaking half english half arabic, I usually felt so intimidated of such personalities. I used to think of them as people whom try their best to show off by mixing sophisticated english terminology with verbal mingled arabic pronounced english sounding words. At those days, 3arabeezy for me was a 100% Yukk.
Today, I became one of them (A 3arabeezist). I just cant stop it, I keep mixing english and arabic whenever I speak, I dont know how it came up to be, it just happened. Gradually, I started substituting english words for words that I cant find an arabic alternative for, and vice versa.
It seems that mixing two languages makes me feel smoother. Its not only in verbal languages. Its also in computer languages. You need to write Embedded C in Java code for certain functionalities, and to write PHP extensions using C in others, or even assembly in some C code, mixing languages could be an advantage.
However, mixing arabic and english proves that you are proficient in using both simultaneaously, but very weak in utilizing one at at time.
Even when trying to talk completely in English... one or more 'ya3neeez' have to slip through the conversation. And when I talk in complete Arabic, one or more 'simply', 'basically', 'soon enough', 'I think' have to slip in between.
In funny cases, I'm also starting to use the plural form of arabic words in english form... examples are 'Raheeebz', 'Raw3az', '7abaaaybax' and 'Jee3aanz'.
Lets jump to the lessons learned of this post. I guess there's one really serious lesson to mention. 3arabeezy aint that bad, but could make you look REALLY bad in first impressions. So here's my advice:
1. When introduced to new people, dont use 3arabeezy whatsoever. Stick to one language. Talk professionaly. Dont mix. It will only leave an impression of either a show-off or an improficient talker.
2. In public speech, dont use 3arabeezy unless the audience are people you've worked with before.
3. When dreaming, feel free to use 3arabeezy. Totally acceptable.
4. Sometimes you need to use 3arabeezy when talking to people who know neither arabic or english. This raises the chances that there could be an arabic or english word that sound something similar to their native language.
5. Only use 3arabeezy if you feel that a certain word has a better alternative in the other language that will ease up understanding. Again, this proves weakness in the former language.
Till then, we'll meet again in a next epi-post of 'Lost in the Code Carribeans'.
Today, I became one of them (A 3arabeezist). I just cant stop it, I keep mixing english and arabic whenever I speak, I dont know how it came up to be, it just happened. Gradually, I started substituting english words for words that I cant find an arabic alternative for, and vice versa.
It seems that mixing two languages makes me feel smoother. Its not only in verbal languages. Its also in computer languages. You need to write Embedded C in Java code for certain functionalities, and to write PHP extensions using C in others, or even assembly in some C code, mixing languages could be an advantage.
However, mixing arabic and english proves that you are proficient in using both simultaneaously, but very weak in utilizing one at at time.
Even when trying to talk completely in English... one or more 'ya3neeez' have to slip through the conversation. And when I talk in complete Arabic, one or more 'simply', 'basically', 'soon enough', 'I think' have to slip in between.
In funny cases, I'm also starting to use the plural form of arabic words in english form... examples are 'Raheeebz', 'Raw3az', '7abaaaybax' and 'Jee3aanz'.
Lets jump to the lessons learned of this post. I guess there's one really serious lesson to mention. 3arabeezy aint that bad, but could make you look REALLY bad in first impressions. So here's my advice:
1. When introduced to new people, dont use 3arabeezy whatsoever. Stick to one language. Talk professionaly. Dont mix. It will only leave an impression of either a show-off or an improficient talker.
2. In public speech, dont use 3arabeezy unless the audience are people you've worked with before.
3. When dreaming, feel free to use 3arabeezy. Totally acceptable.
4. Sometimes you need to use 3arabeezy when talking to people who know neither arabic or english. This raises the chances that there could be an arabic or english word that sound something similar to their native language.
5. Only use 3arabeezy if you feel that a certain word has a better alternative in the other language that will ease up understanding. Again, this proves weakness in the former language.
Till then, we'll meet again in a next epi-post of 'Lost in the Code Carribeans'.
Tuesday, May 15, 2007
The Long Easy Way Versus the Short Hard Way
Today I had a small discussion with a good technical friend of mine ;) The discussion started with trying to handle an SQL Query with one shot.
The SQL Query got a bit too complicated to handle and needed some extra research, reading and thinking to figure out the correct way to do it. It took two technical brains, good MySQL experience, about forty minutes of work, and at the end some testing. It resulted with a long SQL statement.
Through our work we had another solution, its a very easy solution, get the data you need through multiple SQL statements. Thus, a long but easier way to do it.
We felt so proud that we were able to tackle the short difficult path, but at the end, considering the long easy path we missed, I felt a bit unrelaxed, but as soon as that happened, I was reminded with an important wisdom (by my amigo):
"If you keep choosing the easy and long path, you'll hardly learn anything. It's the difficult short path that provides you with extra skill and power."
Now imagine the amount of skill and power you can gain by choosing the long difficult path. Hmmmm, cool as long as no fatal mistakes takes place.
There's always alternate wisdom supplements when twisting different stories around.
The SQL Query got a bit too complicated to handle and needed some extra research, reading and thinking to figure out the correct way to do it. It took two technical brains, good MySQL experience, about forty minutes of work, and at the end some testing. It resulted with a long SQL statement.
Through our work we had another solution, its a very easy solution, get the data you need through multiple SQL statements. Thus, a long but easier way to do it.
We felt so proud that we were able to tackle the short difficult path, but at the end, considering the long easy path we missed, I felt a bit unrelaxed, but as soon as that happened, I was reminded with an important wisdom (by my amigo):
"If you keep choosing the easy and long path, you'll hardly learn anything. It's the difficult short path that provides you with extra skill and power."
Now imagine the amount of skill and power you can gain by choosing the long difficult path. Hmmmm, cool as long as no fatal mistakes takes place.
There's always alternate wisdom supplements when twisting different stories around.
Monday, May 14, 2007
The 'Call Super' Antipattern
A common design problem that is usually solved using the 'Call Super' antipattern (also referred to as code-smell). Simply stated, the problem occurs when the subclass needs to share the implementation of the super classes over-ridable methods.
In such case, 'Call Super' anti-patten is usually used by calling the over-ridden methods from within the subclass's over-riding methods.
I'll show a 'Call Super' code sample, then show a much better and neater solution (proposed by Martin Fowler).
The Bad Solution (Using the 'Call Super' AntiPattern):
A much better solution is to have an abstract method in the super class for the extra actions the subclasses will perform. And thus, the subclass only needs to implement that abstract method:
Thats it. A neat alternative solution that I love to use.
In such case, 'Call Super' anti-patten is usually used by calling the over-ridden methods from within the subclass's over-riding methods.
I'll show a 'Call Super' code sample, then show a much better and neater solution (proposed by Martin Fowler).
The Bad Solution (Using the 'Call Super' AntiPattern):
class Penguin {
public void intoduceYourSelf() {
System.out.println("Hi, I'm classified as a penguin.");
}
}
class EmperorPenguin Extended Penguin {
public void introduceYourSelf() {
super.introduceYourSelf();
System.out.println("My real name is Emperor Penguin");
}
}
A Better SolutionA much better solution is to have an abstract method in the super class for the extra actions the subclasses will perform. And thus, the subclass only needs to implement that abstract method:
class Penguin {
public void introduceYourSelf() {
System.out.println("Hi, I'm classified as a penguin.");
talkAboutYourselfMore();
}
abstract public talkAboutYourselfMore();
}
class EmperorPenguin extends Penguin {
public void talkAboutYourselfMore() {
System.out.println("My real name is Emperor Penguin");
}
}
Thats it. A neat alternative solution that I love to use.
Wednesday, May 09, 2007
Curiosity Never Killed The Cat...
... it was Boredom which did.
The amount of boredom I've been through in the past three days has been killing me softly.
Unfortunately, this time it's the result of practicing a boring repititive task; writing code that tests code. You just keep on writing code and checking the result, then writing another line and checking the result, then another line, and checking the result.
Trying my best to be creative with this task, I only modified the code a bit to show errors in red color and success in green color. Thats about it.
Wisdom of the day:
Ok, curiosity might have killed the cat. But boredom will kill anything!
The amount of boredom I've been through in the past three days has been killing me softly.
Unfortunately, this time it's the result of practicing a boring repititive task; writing code that tests code. You just keep on writing code and checking the result, then writing another line and checking the result, then another line, and checking the result.
Trying my best to be creative with this task, I only modified the code a bit to show errors in red color and success in green color. Thats about it.
Wisdom of the day:
Ok, curiosity might have killed the cat. But boredom will kill anything!
Monday, May 07, 2007
The Best Free Utilities
Check them out at:
http://www.techsupportalert.com/best_46_free_utilities.htm
Enjoy. I liked the sticky notes utility ;)
http://www.techsupportalert.com/best_46_free_utilities.htm
Enjoy. I liked the sticky notes utility ;)
Saturday, May 05, 2007
Swapping Two Integer Variables Without Using a Temp Variable
The first time I heard this question, I thought it was a joke of some kind. I never thought such was possible.
Turned out to be possible and even faster than the normal technique, here you go:
Let X be an integer variable.
Let Y be another integer variable.
X = X xor Y
Y = X xor Y
X = X xor Y
Wont buy it? Then try it out for yourself.
One more technique, you can use the - (minus) operator instead, but be careful not to step over the integer max and min limits. Here you go:
(eg. X = 12, Y = 7)
X = X - Y ( X is now 5)
Y = X + Y ( Y is now 12)
X = Y - X ( X is now 7)
(result: X = 7, Y = 12, Voila! Swapped)
Hmmmm. Coming to think of a practical use. The only way such would be useful is to swap two large memory binary buffers.
This swapping enhancement breaks the common myth of 'its either memory or speed, but not both'. The swapping algorithm you just saw proves better in both memory consumption and performance gain.
Turned out to be possible and even faster than the normal technique, here you go:
Let X be an integer variable.
Let Y be another integer variable.
X = X xor Y
Y = X xor Y
X = X xor Y
Wont buy it? Then try it out for yourself.
One more technique, you can use the - (minus) operator instead, but be careful not to step over the integer max and min limits. Here you go:
(eg. X = 12, Y = 7)
X = X - Y ( X is now 5)
Y = X + Y ( Y is now 12)
X = Y - X ( X is now 7)
(result: X = 7, Y = 12, Voila! Swapped)
Hmmmm. Coming to think of a practical use. The only way such would be useful is to swap two large memory binary buffers.
This swapping enhancement breaks the common myth of 'its either memory or speed, but not both'. The swapping algorithm you just saw proves better in both memory consumption and performance gain.
Wednesday, May 02, 2007
Sticky Notes No Longer Stick
Ok, we all use pieces of paper for jotting notes and todos from time to time.
Some use white paper, lined paper or 3M sticky notes. When no physical resources are available I'll usually use notepad for quick note jotting.
This usually happens when I'm jotting down a quick description of a street address of phone number.
The problem with the notepad approach is the extra steps you have to walk through to actually open notepad and save the file. Which turns out to be so inconvenient when urgency is required.
I mean you need to go to Start > All Programs > Accessories > Notepad, oooft! or even Start >Run then 'notepad' and enter. I also use the quick launch, but at the end, notepad for note taking creates an intimidating experience. Not to mention having to remember the filename you saved on the desktop.
So long for notepad, what about the paper and pen approach? Well...
First, you need them to be around your desk somewhere and you need them to be around instantly. Pen and paper are easily un-noticed on your desk until you discover that you need them (comparing them to a laptop).
Second, paper and ink are limited resource, ie. They will run out. And you'll have to purchase them again.
Third, ok, anyone can afford paper and ink, but what about the environment.
The amount of paper waste caused from temp note storage is unjustified with the alternative tools available. Consider the amount of trees wasted for the sake of disposable paper notes and todo items.
Ok, I'm sure you're thinking now. What point is this post building up to?
Well, its all about a small and cute sticky notes tool (that mimics 3M sticky notes) named "ATNotes".
You can download it for free from:
http://atnotes.free.fr/download.html
Yep. Yep. No more notepad files on your desktop, no more scattered paper, no more ink, and guess what? You're now an environment friendly person.
A Big Thanks goes to its developer & author - "Thomas Ascher".
Hope you like it.
Some use white paper, lined paper or 3M sticky notes. When no physical resources are available I'll usually use notepad for quick note jotting.
This usually happens when I'm jotting down a quick description of a street address of phone number.
The problem with the notepad approach is the extra steps you have to walk through to actually open notepad and save the file. Which turns out to be so inconvenient when urgency is required.
I mean you need to go to Start > All Programs > Accessories > Notepad, oooft! or even Start >Run then 'notepad' and enter. I also use the quick launch, but at the end, notepad for note taking creates an intimidating experience. Not to mention having to remember the filename you saved on the desktop.
So long for notepad, what about the paper and pen approach? Well...
First, you need them to be around your desk somewhere and you need them to be around instantly. Pen and paper are easily un-noticed on your desk until you discover that you need them (comparing them to a laptop).
Second, paper and ink are limited resource, ie. They will run out. And you'll have to purchase them again.
Third, ok, anyone can afford paper and ink, but what about the environment.
The amount of paper waste caused from temp note storage is unjustified with the alternative tools available. Consider the amount of trees wasted for the sake of disposable paper notes and todo items.
Ok, I'm sure you're thinking now. What point is this post building up to?
Well, its all about a small and cute sticky notes tool (that mimics 3M sticky notes) named "ATNotes".
You can download it for free from:
http://atnotes.free.fr/download.html
Yep. Yep. No more notepad files on your desktop, no more scattered paper, no more ink, and guess what? You're now an environment friendly person.
A Big Thanks goes to its developer & author - "Thomas Ascher".
Hope you like it.
Tuesday, May 01, 2007
The Programmers Notepad
If you're one of those people whom dislike thick fat development IDE's, and at the same time you miss many of those rich highlighting and search/replace features in your simples editors.
Then go no further...
Try "The Programmers Notepad".
1.3 MB in size, free, wonderful, and very light-weight.
I loved it from first 'site' : /
at http://www.pnotepad.org/
I think I'll let go of EditPlus. My X-Favorite Editor.
Then go no further...
Try "The Programmers Notepad".
1.3 MB in size, free, wonderful, and very light-weight.
I loved it from first 'site' : /
at http://www.pnotepad.org/
I think I'll let go of EditPlus. My X-Favorite Editor.
Sunday, April 29, 2007
Lazy Evaluation and Caching...
... are the most widely used techniques for improving your software's implementation performance.
Then what are they and how can I use them?
Lazy Evaluation is exactly just like a Lazy Employee; he wont do the job unless some one directly requests it from him. Infact, he'll postpone it forever until the request is made official.
Caching on the other hand is simply storing frequently used data in some quick array or memory for fast retreival, although the same data is stored in a database or in a file, the programmer usually chooses to cache it in its accessible form for fast retreival. This memory could be an Array, a Berkley DB file, a tmp file or any other suitable media.
Google - a well known search engine - caches search results for most frequently used queries. FileNET (a really good CMS server) renders all content objects inside one single HTML page ready for access (instead of querying it from a database everytime). The HTTP protocol itself caches different requested pages on the internet on local internet proxies and implements the HTTP headers to do so. And even does your browser cache some html pages from time to time.
Thats why you usually need to press Ctrl+F5 to force requesting to refresh the page from the server.
As a programming example, lets say you have a small class named UserAccountManager and this class contains a single method:
public static String UserAccountsManager.getUsername(int UserId);
And a single private array which is simply a HashMap mapping a UserID to the Username which is used by getUsername(int UserId).
The method is implemented simply to execute a query on the database:
"SELECT USERNAME FROM USERS WHERE ID=" + UserId
Here is a simple way to see how caching and lazy evaluation can be applied.
The program can implement caching using a private array map that maps the user id to the username string. This array is filled only once from the database when the program first loads.
The tricky part when implementing caching is knowing when to re-generate the cache, or more accurately, how to identify that the original data store has changed or not? If changed, then the cache needs to be regenerated or else your program is using out-of-date data.
Any calls to getUsername will simply access the array instead of accessing the database. This is whats Caching all about.
Now, lazy evaluation simply changes the implementation so that the array AINT FILLED AT ALL until someone actually calls the getUsername() method.
The advantage here is that you dont waste memory or connect to the database until someone actually calls the function. (ps. It might need not be called at all).
After all this explanation, there is a very annoying advice that you have to stick to:
"Never implement optimization techniques such as caching or lazy evaluation until a bottle neck is identified in the system using benchmarking and testing procedures that shows that need. This simply means, avoid Premature Optimization as much as you can."
Then what are they and how can I use them?
Lazy Evaluation is exactly just like a Lazy Employee; he wont do the job unless some one directly requests it from him. Infact, he'll postpone it forever until the request is made official.
Caching on the other hand is simply storing frequently used data in some quick array or memory for fast retreival, although the same data is stored in a database or in a file, the programmer usually chooses to cache it in its accessible form for fast retreival. This memory could be an Array, a Berkley DB file, a tmp file or any other suitable media.
Google - a well known search engine - caches search results for most frequently used queries. FileNET (a really good CMS server) renders all content objects inside one single HTML page ready for access (instead of querying it from a database everytime). The HTTP protocol itself caches different requested pages on the internet on local internet proxies and implements the HTTP headers to do so. And even does your browser cache some html pages from time to time.
Thats why you usually need to press Ctrl+F5 to force requesting to refresh the page from the server.
As a programming example, lets say you have a small class named UserAccountManager and this class contains a single method:
public static String UserAccountsManager.getUsername(int UserId);
And a single private array which is simply a HashMap mapping a UserID to the Username which is used by getUsername(int UserId).
The method is implemented simply to execute a query on the database:
"SELECT USERNAME FROM USERS WHERE ID=" + UserId
Here is a simple way to see how caching and lazy evaluation can be applied.
The program can implement caching using a private array map that maps the user id to the username string. This array is filled only once from the database when the program first loads.
The tricky part when implementing caching is knowing when to re-generate the cache, or more accurately, how to identify that the original data store has changed or not? If changed, then the cache needs to be regenerated or else your program is using out-of-date data.
Any calls to getUsername will simply access the array instead of accessing the database. This is whats Caching all about.
Now, lazy evaluation simply changes the implementation so that the array AINT FILLED AT ALL until someone actually calls the getUsername() method.
The advantage here is that you dont waste memory or connect to the database until someone actually calls the function. (ps. It might need not be called at all).
After all this explanation, there is a very annoying advice that you have to stick to:
"Never implement optimization techniques such as caching or lazy evaluation until a bottle neck is identified in the system using benchmarking and testing procedures that shows that need. This simply means, avoid Premature Optimization as much as you can."
Friday, April 27, 2007
SQL Statement Shortcuts
What always bothered me when writing SQL SELECT Statements is handling long table names, and having to reference a field by its table's name to avoid ambiguous errors.
Take this for example, three tables: infobase, infobase_labels, and infobase_users. And let's imagine that those three tables each have a field named 'ID'.
So a simple select statement will go like that:
SELECT infobase.ID, infobase.NAME AS INFO_NAME, infobase_labels.NAME AS LABEL_NAME, PHONE FROM infobase_labels, infobase_users, infobase WHERE infobase_labels.ID=infobase.LABEL_ID and infobase_users.ID=infobase.USER_ID AND infobase.ID=5;
Okay, 238 characters of unreadable sql code.
Whats next? Okay, till here you have two options:
1. Live with it.
2. Find a simpler way.
I have been using option 1 for the last 7 years. Until, option two showed up ...
... the usage of name aliasing for table names to make a query simpler, now this I love, simple alias each table with a 2 letter name, and use it instead of the table name:
SELECT _IB.ID, _IB.NAME AS INFO_NAME, _IBL.NAME AS LABEL_NAME, PHONE FROM infobase_labels AS _IBL, infobase_users AS _IBU, infobase AS _IB WHERE _IBL.ID=_IB.LABEL_ID and _IBU.ID=_IB.USER_ID AND _IB.ID=5;
Okay, this makes them 205 characters long.
For me the latter is much more readable, shorted and easier to write.
Tidying the SQL statement a bit:
SELECT
_IB.ID,
_IB.NAME AS INFO_NAME,
_IBL.NAME AS LABEL_NAME,
PHONE
FROM
infobase_labels AS _IBL,
infobase_users AS _IBU,
infobase AS _IB
WHERE
_IBL.ID=_IB.LABEL_ID
AND _IBU.ID=_IB.USER_ID
AND _IB.ID=5;
Okay thats it for today. Quite a long post, but I like it ; )
Take this for example, three tables: infobase, infobase_labels, and infobase_users. And let's imagine that those three tables each have a field named 'ID'.
So a simple select statement will go like that:
SELECT infobase.ID, infobase.NAME AS INFO_NAME, infobase_labels.NAME AS LABEL_NAME, PHONE FROM infobase_labels, infobase_users, infobase WHERE infobase_labels.ID=infobase.LABEL_ID and infobase_users.ID=infobase.USER_ID AND infobase.ID=5;
Okay, 238 characters of unreadable sql code.
Whats next? Okay, till here you have two options:
1. Live with it.
2. Find a simpler way.
I have been using option 1 for the last 7 years. Until, option two showed up ...
... the usage of name aliasing for table names to make a query simpler, now this I love, simple alias each table with a 2 letter name, and use it instead of the table name:
SELECT _IB.ID, _IB.NAME AS INFO_NAME, _IBL.NAME AS LABEL_NAME, PHONE FROM infobase_labels AS _IBL, infobase_users AS _IBU, infobase AS _IB WHERE _IBL.ID=_IB.LABEL_ID and _IBU.ID=_IB.USER_ID AND _IB.ID=5;
Okay, this makes them 205 characters long.
For me the latter is much more readable, shorted and easier to write.
Tidying the SQL statement a bit:
SELECT
_IB.ID,
_IB.NAME AS INFO_NAME,
_IBL.NAME AS LABEL_NAME,
PHONE
FROM
infobase_labels AS _IBL,
infobase_users AS _IBU,
infobase AS _IB
WHERE
_IBL.ID=_IB.LABEL_ID
AND _IBU.ID=_IB.USER_ID
AND _IB.ID=5;
Okay thats it for today. Quite a long post, but I like it ; )
Sunday, April 22, 2007
Master the Techniques Before Chasing the Goals
Miyagi told Daniel Son while holding the chop sticks:
"You have to catch fly first."
And this applies to any career. Ok, Miyagi was a bit over-reacting here, I mean, if it was not for the 'beginners luck' of Daniel Son, I dont think this movie would have ever ended.
The lesson here is that a career person SHOULD master the techniques of her or his profession. Know it well, do it right, know when to use a technique, know when to drop it, know the pros and cons of different techniques, but most importantly, Master it!
That could be the boring part for some, to master the technique, to know the details, to understand the bits and pieces.
A professional football player knows that mastering a 'pass' weighs much more than scoring a goal. Mediocre players - on the other hand - only care about scoring, this arises from a mentality of greed ... "Need to score, makes me feel good.".
Most low quality environments overlook developing good techniques, and favor jumping directly to goals. Ok, fair enough, the time and budget constraints of 'the start' could force such conditions. But, this symptom easily grows to a disorder when this methodology becomes a continuous habit.
Wisdom of today's post:
"Master the techniques, and make them the solid path to your goals."
"You have to catch fly first."
And this applies to any career. Ok, Miyagi was a bit over-reacting here, I mean, if it was not for the 'beginners luck' of Daniel Son, I dont think this movie would have ever ended.
The lesson here is that a career person SHOULD master the techniques of her or his profession. Know it well, do it right, know when to use a technique, know when to drop it, know the pros and cons of different techniques, but most importantly, Master it!
That could be the boring part for some, to master the technique, to know the details, to understand the bits and pieces.
A professional football player knows that mastering a 'pass' weighs much more than scoring a goal. Mediocre players - on the other hand - only care about scoring, this arises from a mentality of greed ... "Need to score, makes me feel good.".
Most low quality environments overlook developing good techniques, and favor jumping directly to goals. Ok, fair enough, the time and budget constraints of 'the start' could force such conditions. But, this symptom easily grows to a disorder when this methodology becomes a continuous habit.
Wisdom of today's post:
"Master the techniques, and make them the solid path to your goals."
Tuesday, April 17, 2007
Toggle The Toggler
We all use them, different places in our code, toggling variables.
And there are many ways to achieve the same results.
My first toggle looked like that. This toggles between 1 and -1.
a *= -1;
It then evolved to:
a = a XOR 1; // or a = a ^ 1 in Java
I also started using the modulus operator:
a = (a + 1) % 2;
Then I liked the modulus operator so much, that I started using it to toggle between three, four or N values:
a = (a + 1) % 4;
And there are many ways to achieve the same results.
My first toggle looked like that. This toggles between 1 and -1.
a *= -1;
It then evolved to:
a = a XOR 1; // or a = a ^ 1 in Java
I also started using the modulus operator:
a = (a + 1) % 2;
Then I liked the modulus operator so much, that I started using it to toggle between three, four or N values:
a = (a + 1) % 4;
Sunday, April 15, 2007
Teach Yourself Programming in Ten Years
Very nice article discussing the programmers' learning curve:
http://norvig.com/21-days.html
This article is so popular it has been translated to many different languages including chinese, arabic, german, french, polish, japanese, korean, russian, spanish and turkish.
ref: Khaled J. Simtix Software.
http://norvig.com/21-days.html
This article is so popular it has been translated to many different languages including chinese, arabic, german, french, polish, japanese, korean, russian, spanish and turkish.
ref: Khaled J. Simtix Software.
Friday, April 13, 2007
Book Quote
"Some people play tennis all their lives, but never get better. Those people are not willing to take a fresh look at what they do or to consider changing it. Good players recognize that getting better often means making an investment in new approaches. For a while, they may get worse, as they wrestle with new and unfamiliar techniques, but eventually they surpass their old plateau."
-Fisher, Ury and Patton
In Getting To Yes
-Fisher, Ury and Patton
In Getting To Yes
Wednesday, April 11, 2007
Getting Organized
I've seen different people do different stuff when it comes to getting organized.
Whether its organizng your images, favorites, invoices, note taking, meetings, budgeting.
Frankly, what works with some turns up to be impractical for others, and vice versa.
1. Some use the browser's favorites toolbar; others see it as non-sense.
2. Some use small notepad files to collect different websites, todo items, readings, passwords.
Others use excel sheets for the same task.
3. Some people even use stange but effective tools. An example is a tool that applies different colors to the different folders on a machine. Even others use tools that automate your environment through pre-configured shortcut keys and mouse clicks.
4. Some use information tools - called outliners - for collecting important pieces of information. Others see it as overly organized.
5. Some use outlook calendar for different reminders, others use their mobile, or even pen and paper.
Best general tips when adopting an organizing procedure is:
1. Make sure the maintenance cost is to the minimum when organizing an item. You dont want to spend an hour trying to figure out where to place your favorite site.
2. Make sure there is some temp storage for your information items that need to be organized. Since sometimes you're too lazy to organize even when you have the infrastructure.
3. Make sure that retrieval of the organized item is to the minimum (example, should be easily located, easily searchable by different fields, dates, text).
4. Make sure that it is available from different places.
5. Take time investigating organization tools at downloads.net, and tucows.com, see what fits your case, use what you find practical, make your life easier.
You never know, a fifteen minute deep thought of how to efficiently organize yourself, or even a small research in finding the right practical tool is your way for a much efficient and easier life.
The main hurdle that lets people postpone organizing themselves is their false feeling of 'I can manage' my reminders, my todos, my schedules, my information, and my budget. Trust me on this one, when it comes to organizing yourself, your brain alone is very limited.
Whether its organizng your images, favorites, invoices, note taking, meetings, budgeting.
Frankly, what works with some turns up to be impractical for others, and vice versa.
1. Some use the browser's favorites toolbar; others see it as non-sense.
2. Some use small notepad files to collect different websites, todo items, readings, passwords.
Others use excel sheets for the same task.
3. Some people even use stange but effective tools. An example is a tool that applies different colors to the different folders on a machine. Even others use tools that automate your environment through pre-configured shortcut keys and mouse clicks.
4. Some use information tools - called outliners - for collecting important pieces of information. Others see it as overly organized.
5. Some use outlook calendar for different reminders, others use their mobile, or even pen and paper.
Best general tips when adopting an organizing procedure is:
1. Make sure the maintenance cost is to the minimum when organizing an item. You dont want to spend an hour trying to figure out where to place your favorite site.
2. Make sure there is some temp storage for your information items that need to be organized. Since sometimes you're too lazy to organize even when you have the infrastructure.
3. Make sure that retrieval of the organized item is to the minimum (example, should be easily located, easily searchable by different fields, dates, text).
4. Make sure that it is available from different places.
5. Take time investigating organization tools at downloads.net, and tucows.com, see what fits your case, use what you find practical, make your life easier.
You never know, a fifteen minute deep thought of how to efficiently organize yourself, or even a small research in finding the right practical tool is your way for a much efficient and easier life.
The main hurdle that lets people postpone organizing themselves is their false feeling of 'I can manage' my reminders, my todos, my schedules, my information, and my budget. Trust me on this one, when it comes to organizing yourself, your brain alone is very limited.
Subscribe to:
Posts (Atom)