Archive for the ‘Programming’ Category

Writing Website Scrapers in PHP

February 26th, 2008 24 comments

This article discusses about how to write a website scraper using PHP for web site data extraction. The concepts taught can be applied and programmed in Java, C#, etc. Basically any language that has a powerful string processing capability. This article will teach you the basics of website scraping. The article will further cover a tutorial to find web ranking from search engine.

Read more…

7 habits of highly effective freelance programmers

February 18th, 2008 11 comments

I have developed these based on my freelancing experience. Though I have discontinued freelancing, but would like to share my practices with you. These are basic practices and have been developed over time with experience (good and bad). Please feel free to leave your experiences and comment on this article.

Read more…

12 common programming mistakes to avoid

November 16th, 2007 13 comments

Programming is an art and science and like all art and science the only way to learn is from mistakes. I have made many… and I would like to share with you the mistakes that I have made over my journey with development.

Read more…

Categories: Programming Tags:

PHP Script to Extract Email Address from any text

November 14th, 2007 6 comments

I have developed a function that you can embed in your PHP applications that will help you extract email addresses from a given piece of text.

I have tested this on a string of (actually 4 – 5 paragraphs) text and this has performed very well.

Please feel free to use this code in your applications and let me know if you face any issues.

Read more…

Categories: PHP, PHP Code Examples, Programming Tags:

Recharge your programming batteries – Tips

October 31st, 2007 15 comments

Many of us in the field of programming and development go through a phase where we completely blank out. Our minds don’t work, our logic seems to have lost its track and we are not able to make any progress with projects. If this has happened to you and continues to happen to you… then you are not alone.

A lot of programmers and developers go through this phase on a continuous basis. I go through it at times. You could blame it on the module, your stress levels, family & personal issues, etc. But, no matter what; we still need to deliver projects on time. Clients are least interested to know what your personal problems are. They want their deliveries on time. Wouldn’t you?

Read more…

Categories: Programming Tags:

PHP5 Tutorial – Magic Methods – __toString() method

October 25th, 2007 2 comments

PHP5 provides a magic method by the name of __toString() (double underscore followed by toString()) which is useful for debugging purposes.

The __toString() method is automatically called when an object in PHP5 is converted into a string for the purpose of display or concatenation.

Read more…

How to swap 2 variables without temp variable

October 23rd, 2007 5 comments

Swapping 2 variables requires a third temp variable, this is how it is implemented with 3 variables (I have implemented this in PHP, the same logic can be used in any language):


$a = 5;
$b = 7;
$temp = $a;
$a = $b;
$b = $temp;

echo “$a : $b”;


Read more…

Categories: Programming Tags:

Ideas on debugging your live website

October 16th, 2007 2 comments

I write this article to share my experience that I had in fixing bugs on live site. With users live on your site and transactions worth 100s of dollars ready to be executed, you cannot risk down time to fix the bug and get live again. So what do you do? You definitely cannot keep that bug there; you cannot down the site; you cannot disable the feature that has the bug? What would you do?

Read more…

Categories: Programming Tags:

5 Tips on improving Programming Logic

October 2nd, 2007 70 comments

A lot of colleagues, friends and strangers (that I meet in meetups, etc) have asked me to explain how can they improve their programming logic.

Though programming is mainly associated with the field of Computer Science, but writing good and optimized code is mainly an art. Like all art forms requires tremendous patience and rigorous practice, building gray cells for programming logic is not much different.

I present this post/article to you on how you could too improve your programming logic.

Tip 1: Learn the language ‘C’

You might be an expert .NET, Java or PHP developer, but I would recommend that you MUST learn ‘C. We all know why ‘C’ is the most powerful programming language, but I am not recommending learning ‘C’ to you because of its power in programming.

‘C’ offers you a structured style of programming. You have one file with the main() method and the execution begins from there and the execution flow proceeds as you have directed it to.

The main advantage in ‘C’ is that it allows you to play around with memory directly. This I believe is very important if you need to understand how data is passed from one memory block to another. The reason is that you start to visualize in your mind’s eye how data moves in your program.

The next step is to develop programs that will help you improve your logic.
Read more…

Categories: Programming Tags: