/* PHP & MySQL Journal */
Posted in: data | ( 2 ) Comments
25 Apr 2009phpguru.org offers a small and useful class to convert numbers to their textual equivalent. If you are building a accounting or invoicing application it may come in handy. The class can be downloaded form here. A sample code using the class is shown below.
Whether desktop or web based, there has recently been a proliferation of SQL design tools on the net. SchemaBank may look like one more in the box. But a detailed look at the features will show you more on offer. SchemaBank is a visual data modelling tool which can help you create ERD diagrams within all modern browsers. It supports MySQL and PostgreSQL.
Posted in: algorithms, php | ( 7 ) Comments
20 Apr 2009In this post we will see how to use a Stemming algorithm for search purposes.
A stemming algorithm lets you reduce each English input word to its basic root or stem (e.g. ‘walking’ to ‘walk’) so that variations on a word (‘walks’, ‘walked’, ‘walking’) are considered equivalent when searching. This stems can than be used in a search query rather than the original words, which generally (but not always) results in more relevant search results. The main use of stemming is in keyword indexing for search. For example if you have a article or document titled ‘blogging tips for late workers‘ and you run it through the algorithm you will get a list of stems for the title – blog, tip, late, worker; under which you can than index the article or document.
Posted in: tools | ( 14 ) Comments
12 Apr 2009NOTE: http://www.ip2location.com have done away with the free api access from their site. So the following sample code will no longer work. They now provide a free sample database on their site and also a complete paid version.
iplocationtools.com offers a free geolocation API that lets you query with an ip address and get the location details such as city, country, zip, latitude, longitude etc. The site also offers a free MySQL database for the same if you would like to install it on your server. I’ve used CURL to wrap the API access. The complete function with a sample query and the response is shown below.
Posted in: testing, tools | ( 8 ) Comments
6 Apr 2009Duplicated code in projects is a frequent thing and also the one ripe for factoring out in a new class or function. Cut/Paste coding is a common development practice among programmers, a lot of which can lead to code size increase and maintenance nightmares. PHPCPD (php copy paste detector) is a PEAR tool that makes it easier to detect duplicate code in php projects. Below is a short tutorial on the PHPCPD package.
Posted in: tools | ( 2 ) Comments
30 Mar 2009One of the important factors in developing a successful software product is the application of coding standards. And by successful I mean a product that is easy to develop, modify and maintain. Every developer likes to code in a particular style: in the way he declares variables or function blocks, the number of indentation spaces, commenting style etc. Giving every developer in a team complete freedom to use whatever style he likes will very likely result in a code that is hard to understand, modify and maintain. Even though every coding standard has its good points and bad; the important thing is to try to adhere to a particular one.
Posted in: mysql | ( 3 ) Comments
25 Mar 2009The most common type of web application a developer encounters are database related. But rarely is the case when you have the required data in your database during testing, making it a frequent source of frustration for programmers, who than have to manually populate the database. Having a dummy set of data is always a good thing.
Posted in: tools | ( 4 ) Comments
24 Mar 2009cURL is a command line tool for doing all sorts of interesting and essential URL manipulations and data transfers. The original goal of the program was to transfer files programmatically via protocols such as http, ftp, gopher, sftp, ftps, scp, tftp, and many others, via a command line interface. The main benefit of using the command line interface is that you can use the program in your Windows batch file or Linux shell scripts to automate many URL related processes. In this post you will see some essential things you can do using cURL.
Posted in: browser | ( 5 ) Comments
22 Mar 2009
With the release of Internet Explorer 8, the issue of compatibility has again become a concern for web developers. If your website does not display correctly in IE8, you have a choice of either updating your website to support the latest Web standards or you can force IE8 to display your content as if it were being rendered in an older version of the browser. Luckily IE8 has a compatibility mode which tells IE what browser version it should use to render a page. This will give developers time to update their site for IE8.
Posted in: tools | ( 1 ) Comment
18 Mar 2009
Recently for a small design work a creation of a Photoshop PSD document was required. Being a high resolution image the file size went up to something around 85MB. Zipping the document brought down the size to a manageable 35MB (but still quite large for my net connection) . As all designers know, frequent modifications are a part of the process, and I surely needed to do one on the original PSD; which meant I had to send the whole modified PSD file again to the client, even though the actual modifications were quite minor. As I use a 384Kbps broadband line, it takes quite a while to upload the file. Make a couple of more revisions and you can see how much precious time is wasted in transferring the document. As I’m not a designer by profession, I’m unaware of any tools that might ease this process. So I thought if using a binary diff and patch utility would help me make my job easier.