WordPress vs Custom Code
June 15th, 2010 § 2 Comments
I run a heavy metal music news aggregator website called Sonic Assault. The site has been running since 2003 and displays latest headlines from major news sites like Blabbermouth etc. The site uses screen scrapping technology to gather the headlines and links back to them. A cron job is setup to go out to the sites and grab the headlines and dump them into the database which are then displayed. The code works fine as long as the headlines are published in the proper pattern. However, it is a nightmare to manage if things start to break. I have been considering moving from the screen scapping to parsing RSS feeds. With RSS feeds becoming mainstream with mass adoption and more and more sites providing RSS feeds, it would be a much easier and structured way to get headlines from these sites. I have been contemplating whether to build the site using WordPress or using custom coding using PHP.
WordPress is an excellent CMS tool and has a multitude of plugins which can add functionality and extend it usability. Various plugins like Wp-O-Matic can make fetching RSS feeds easier which is required by my website. So, it is just a matter of developing a theme and using the plugins, we are on our way. On the other hand, building a site from scratch using custom coding can take time as we need to think right from building the database tables, coding the logic, displaying data etc. But with custom code, we have the flexibility to build the site without having to learn about the intricacies of WordPress. In case of future enhancements, coding it in WordPress would have a learning curve whereas with custom code it is much more flexible. In this scenario, WordPress looks like a tactile (short term) solution while custom code is more strategic (long term).
I am still not able to decide which way to go for with the new website. If someone has been in similar situation would appreciate if you could give your inputs. Are there any other alternatives which I should consider like Joomla or Drupal ?
Change GRUB command line
January 14th, 2010 § Leave a Comment
While installing Ubuntu on my old laptop, I had to manually enter the pci=noacpi to the boot parameters so that it would boot. I searched how to add it permanently but the GRUB settings were not the same as I searched. So, I tried to search and change it myself. Here are the steps I performed to add the extra parameters at the end of the boot command.
Open the /etc/default/grub in your favourite editor.
vi /etc/default/grub
Locate the GRUB_CMDLINE_LINUX in the file and add the commands you need between the quotes.
Once this is done, we need to regenerate the grub.cfg file. To do run the following command
sudo update-grub
This updates the
/boot/grub/grub.cfg
file
You are all set. Just reboot and press “e” to check if the new parameters are present and from next boot onwards it should work fine.
OpenSUSE 11.2 Released
November 13th, 2009 § Leave a Comment
OpenSUSE announced the release of their latest release 11.2 yesterday. The new release has a bucket load of updates and features included. The new release includes KDE 4.3 which is much more stable than before along with new versions of Mozilla Firefox and Openoffice 3.1. The release also includes a new theme designed specially for 11.2 release. Along with KDE, 11.2 release has also got an upgraded version of Gnome, version 2.28. This release includes a brand new theme, Sonar, improved software update application, improvements in GNOME’s Webcam and video application, Cheese, and many other enhancements and improvements to prepare the GNOME platform for GNOME 3.0 in 2010. For the social networking fans, the 11.2 release includes Gnome and KDE microblogging clients like Choqok and Gwibber by default. Nautilus now has a plugin to allow quick and easy file sharing. Just right-click on the folder you’d like to share and select “Sharing Options.” This makes use of Samba, so you need to enable directory sharing under the Samba Server module in YaST.
Under the hood, the release includes the latest Linux kernel 2.6.31 and next generation Ext4 or btrfs file system. Another addition to the features is a tool to remotely manage application installation from the web, WebYaST: a web based remote managment tool. Upgrades would become easier using Zypper and users are recommended to do so.
So, if you are interested in trying out the latest OpenSUSE release, head to the software to download and take it for a spin. Download OpenSUSE 11.2 here
Working with Eclipse and Code Igniter
September 4th, 2009 § 32 Comments
Till recently I had been using my trusted editor, Notepad++, for doing all my development work. Not that I am not using it anymore, but I was looking for something more powerful and integrated, something like an IDE. I had tried few IDEs including Eclipse before but did not get much into it and hence left it there. I picked up Eclipse again and tried to give it one more try. I also tried out Aptana which is another awesome IDE built on Eclipse with all the web development tools you need built into it out-of-box (PHP, Ruby, jQuery, Python).
So, I started with downloading PHP Development Tools Project version of Eclipse (Eclipse PDT) as I was primarily going to use it for PHP development. Its a huge zip file but good thing is no need to install it, just unzip and run the exe. After setting up the initial workspace, PHP settings etc., we can start adding our projects and get onto development work.
Currently, the project I am working on is built using Code Igniter and was looking to develop using Eclipse. Adding a project was pretty straight forward but getting the auto completion to work was an issue. However, there is a workaround to get it all working.
First, we need to move the application folder out of the system folder and bring it up one level next to the system folder. So, it looks something like this :
application/ config/ controller/ errors/ .... system/ codeigniter/ database/ fonts/ ..... index.php .htaccess
Now, edit the index.php file in the root folder and change the following line :
$application_folder = "application"; to $application_folder = "../application";
Now, we can add the system and application folders as Eclipse project. First create a new project and name it something like “CI_CORE” which points to the system folder. Similarly, add another project “CI_APP” which points to the application folder. It should look something like the following image. Once, CI_APP is added, right click and modify the properties. Select PHP Include Path and add “CI_CORE” under Projects. And it’s done.
Now, to test out whether the auto completion feature works or not, create a new controller (news.php in my example) and add constructor method. Add any method and press Ctrl + Space to bring the auto completion window like the following image.
Happy Coding!!!
Magic Mime Database Workaround
August 27th, 2009 § 2 Comments
Timthumb is a very useful PHP script used heavily to resize images on the fly in many WordPress themes. Timthumb uses a PHP function FINFO_OPEN to get info regarding the image. The function FINFO_OPEN uses a magic.mime database, which is basically a text file, to get information regarding the type of image. Many hosts (like mine) do not provide the magic.mime extension and hence the script cannot resize the image on the fly. The magic.mime file if present is present at /usr/share/magic.mime. However, if the host does not provide it, there is a workaround to get the magic.mime file working with the Timthumb script.
The FINFO_OPEN function takes the path to the magic.mime file as a parameter. You could download the file and put it in the same directory as the Timthumb script and test out if the images are being resized. The code which needs to be changed should look like this :
$finfo = finfo_open(FILEINFO_MIME, "./magic.mime");
You could get the magic.mime file from any Apache installation. WP.com does not allow me to upload a .mime extension file or else I would have upload it here directly. Let me know if you need the magic.mime file.
Job Trends: Ruby shows 1200% growth
August 25th, 2009 § 2 Comments
In my previous post, I mentioned about the trends in PHP frameworks and was curious to know if there is anyway to know the job market for those frameworks. I did not find any such trends, but what I came across was trends or popularity of programming languages.
Indeed.com is a job search engine site which searches various job sites and shows results. They have an interesting utility to see trends using search terms. I did a comparison of popular programming languages namely PHP, Ruby, Python, Perl, C# and the result is clearly showing Ruby has gained 1200% in the past 4 years. The graph shows “relative” trend (as compared to “absolute” trend) comparing the number of jobs being advertised for Ruby as compared to other languages. The runner ups were Python and PHP. Ruby has gained a lot of popularity in the past 4 years and it is good to see that programming languages are getting popular again specially the open source ones in this struggling economy. Is it time to learn Ruby and Python?
Google Trends: PHP Frameworks
August 18th, 2009 § 1 Comment
Google Trends is a useful tool to compare the trends in what is being searched on Google. I was curious to see what PHP frameworks are being searched ( and used) on Google. The image above shows that Cakephp is the most popular framework while Code Igniter/Kohana are trailing behind. But Code Igniter started relatively late (late 2006) as compared to other frameworks (mid to late 2005) but has been picked up quickly.
Another interesting observation from the above trend is, Code Igniter is most popular in Bangladesh, Indonesia and Philippines. I wonder if there is a way to get trends of jobs for these frameworks.
Displaying resized images as links in WordPress
August 10th, 2009 § 1 Comment
While working on a WordPress theme for a friend, I was looking for a way to display links as images rather than text. WordPress provides wp_list_bookmarks function to display links. The parameter show_images controls whether to display images or not. But my requirement was to display just the images and no text. And I wanted to resize the images rather than showing the entire picture.
WordPress provides another function get_bookmarks which can be used to controls what links we need to fetch. Together with parameters, the function can provide the solution to my problem.
The function was called in the following way:
$bookmarks = get_bookmarks('category_name=bands&limit=3&orderby=id&order=DESC');
I have a links category called “bands” and wanted to get the latest 3 links in descending order using the “id” column.
The function returns an array $bookmark which needs to be looped through to get the results.
foreach($bookmarks as $bookmark) {
echo $bookmark->link_name;
echo $bookmark->link_image;
echo clean_url($bookmark->link_url);
The final code block with the resize script (timthumb) looked like this:
<?php
$bookmarks = get_bookmarks('category_name=bands&limit=3&orderby=id&order=DESC');
foreach($bookmarks as $bookmark) {
?>
<li><a title="<?php echo $bookmark->link_name; ?>" href="<?php echo clean_url($bookmark->link_url); ?>" target="_blank"><img src="<?php bloginfo('template_directory'); ?>/timthumb.php?src=<?php echo $bookmark->link_image; ?>&h=100&w=300&zc=1" alt="<? echo $bookmark->link_name; ?>" id=""/></a></li>
<?
}
?>












