Archive

Archive for the ‘Web Development’ Category

New: Download Essential Configuration Files for CentOS, HTTPD, IPTables, and ZenCart

July 21st, 2009
Comments Off

Yes, we have a new downloads section on our blog. In it we offer some free configuration files that simplify our daily routine work, shorten the time it takes to perform these tasks, and since we tweak them all the time it is relatively safe to use them. I certainly use these files almost every time I setup a new server.

Improved ZenCart Config Files

Improved ZenCart Config Files (352)

Improved config files only need DB information. URL related information and Folder location information are auto populated by PHP functions and server variables. Great for keeping the same file for both dev and production environment.

The default ZenCart config files lack some flexibility. In the last two years my team has developed these config files which we wanted to share with you. The main difference here is that the URL and the folders of the ZenCart website is auto-determined and there is no need to change them or edit this file if either one of these changes. One great usage is if you want to be able to copy your ZenCart files from one machine to another or from a dev environment to your production environment. These improved ZenCart config files make it easy.

Script to Configure IPTables on CentOS for WWW server

configure iptables on CentOS for WWW server (335)

In order to simplify my work I have created this simple script that automatically configures iptables on CentOS for WWW server. It blocks everything except ports 80, 443, and 22 (http, https, and ssh respectively).

Script to Configure IPTables on CentOS to block certain IP ranges

configure iptables on CentOS to block specific IP ranges (321)

Once I configure the iptables to only open the ports I need on the specific server, I use this script to block any suspicious activity like failed unauthorized ssh login attempts or spam blasters trying to abuse any contact form on the website. I usually trace the IP and if it is outside of the US I block the entire 255.255.x.x subnet. Sometimes the entire 255.x.x.x range. As long as you don’t block your own users, you should be fine.

Ron Peled Web Development

Speed Optimized Websites Rank Higher with Search Engines

July 16th, 2009
Comments Off

Website performance should not be taken lightly. Now, when I say website performance optimization in general I mean the time that it takes a webpage to fully render in the browser. Many different factors can influence that including the number of files that make your page, the size of the files, whether it renders in standard XHTML or quirks mode, etc. But, for search engines all that matters is the raw HTML output of your site. One of the ways that search engines measure a site’s validity is by measuring the speed it takes it to serve the HTML portion. Yes, raw web server power. Why?

Search engines try to guess which websites out there should gain more respect than others, one characteristics is speed. If you think of it, the speed it takes to serve a page reflects how much the owner invested in it and hence reflects on the ranking that it should get in a backwards way. In other words, a site that is served on a dedicated server with serious horse power should get higher rankings than a site that is served on the cheapest shared hosting plan. Another fact is that major search engines researched user return rate and have found that the return is higher for faster sites and even microseconds count. That is why the best search engines focus on speedier results and favor results from faster websites. Really?

google_webmaster_tools_crawl_stats2

Look at the graph above, you will see a direct correlation between the website’s speed and the number of indexed pages. There might be a delay and it is not 100% accurate because the speed is not the only factor here, but over time it seems to have an effect. These graphs are from Google Webmaster Tools, under the crawler stats. Ok, how should I increase the performance of my site?

Here are a few things to consider:

  • Invest in a good hosting package. If you are serious, get at least a VPS with your own IP address (dedicated IP is also a measure). A VPS or a dedicated server will always trump the performance of shared hosting over time. Notice that some shared hosting environments reach 500+ websites on the same piece of hardware.
  • If you use PHP make sure to use APC: Alternative PHP Caching.
  • Always turn on caching at all levels: Apache, PHP, and your application. All levels usually have some sort of a caching mechanism – use it!
  • Research your biggest bottleneck and tackle it, always repeat over time. Just like you do with SEO – it is always work in progress.
  • Look in the logs: every time that your server experiences an error or a warning it has to trigger the error handling mechanism which in most environments require additional resources. Especially unhandled exceptions in ASP.NET/IIS7 environments.

The list is really long and can get very technical but in general you always want to keep website performance optimization in the back of your head. It is well worth it!

What is your experience with speed optimized websites? how did it affect your SEO results?

Ron Peled Performance Optimization, Web Application Hosting, Web Development ,

Take a Look at Dell’s Fortuna Server

July 9th, 2009
Comments Off

As web traffic grows constantly and will continue to grow, I am always on the lookout for better ways to host a robust websites. Our clients always demand the best hosting solution but with an eye on the price. Currently the biggest price tags when it comes to hosting data centers is the power consumption and second is the actual space. Note that a side benefit to lower power consumption is reduction in the need of cooling, since logically increased power consumption means more generated heat.

In other words, to remain competitive hosting providers will strive to provide servers with lower power consumption and smaller form factors while assuming a certain level of processing power. This is exactly what DELL’s R&D is working on these days. Here is a video of what is in the works:

What is interesting is that the fortuna will supposedly place 12 of these mini servers in a single enclosure that fits in 2U space. This makes it a 1/6U server. 6 Servers per 1U of space. Here is a photo of a prototype:

dell_fortuna_server

Now, can you imagine each mini server hosting 2-4 VPS with CentOS serving the LAMP stack and either a Joomla, WordPress, or ZenCart on it? Nice!

Ron Peled Web Application Hosting, Web Development ,

Method Overloading Workaround in PHP5

June 25th, 2009
Comments Off

This past week I had the need to use overloaded methods in PHP 5. Overloading a method in object oriented design is especially helpful when trying to achieve the same operation while the code needs to be triggered from different states of the application or even different locations of the application. In my case, I needed an overloaded constructor to a PHP class. Yes, constructors are also a bit different in PHP 5 but still workable.

overload_cargo

To make a long story short, in PHP 5 there is no real way to overload a method like you can with Java. However, it seems like the developers of PHP 5 did have overloading methods in mind and allowed some form of it. It seems like allowing a real method overloads in PHP would be a special case of what the core developers actually allowed to do. The reason behind the current syntax is beyound me. I even tried to look for a PHP roadmap and see if proper method overloading will be introduced in the future but I could not find anything relevant.

A user with the name Noel has posted on DZone a little snippet of code that shows exactly how method overloading in PHP5 can be achieved.

Do you know of any intentions on including real method overloading in PHP6?

Ron Peled PHP/MySQL, Web Development , ,

The Case for ZenCart: Supporting the Long Tail of eCommerce

June 18th, 2009

While Zen-Cart is one of the best open source ecommerce platforms it has plenty of deficiencies, however I recently understood that it will always be able to keep its niche and therefore always have a market.  Of-course this will remain the case as long as its leaders remain true to its spirit.

the_long_tail_of_open_source_ecommerce_platforms

Zen-Cart is an unwilling offspring of the popular osCommerce. Like all offsprings, it is an improved version of its predecessor with better templating system, class oriented design, and notification systems but still maintains its characteristics of spaghetti code and somewhat convoluted and non-flexible checkout process.

Zen-Cart’s strengths are its simplicity which gives many non-programmers the opportunity to tweak and add (or remove) features to their likings with no major effort. This means that implementing a Zen-Cart ecommerce website is usually inexpensive and fast. Another great benefit of the system’s simplicity is speed. Zen-Cart is many times lighter than many other ecommerce systems even without complex caching technologies. Together, these benefits support a specific market: the market of light ecommerce. I am talking about online shops with 1 to 100 daily transactions or even less. It can obviously support more than that but the simplicity and the light weight features will attract the small business which is budget oriented.

The light ecommerce market while being small in terms of overall sales figures is relatively large and will get larger and larger with time. This is also known as the long tail of any market, in our case it is the long tail of the ecommerce market. This means that the numbers of installations will most likely be large and not insignificant. It also means that it is a valid market and will not vanish overnight with any other solution such as Magento who now charges a hefty amount for licensing its Enterprise version.

Before you rush to declare this light and feature packed ecommerce platform the kind of the long tail ecommerce market, don’t underestimate the challenges that it is facing. With over a year and a half of no significant updates its market share is shrinking fast. The default template and the admin panel need some serious reworkings to get up to par in UI and design with other open source challengers and a major cleanup and reorganization of the backend configurations is way overdue. While it supports XHTML and validates correctly, the default template needs to be reworked without the tables.

In any case, Zen-Cart still serves its purpose as a free and light open source ecommerce platform. And here at Activo we have recently developed a Recurring Orders payment module that comply with PCI requirements and integrates well into the ARB module of Authorize.net. I’ll soon post links to an initial free version, a commercially licensed version should be available in about a month or so.

What do you think of ZenCart? here to stay or yet another open source project that will be lost in oblivion? somewhere in the middle perhaps?

Ron Peled Magento, Web Development, ZenCart, eCommerce , , ,

Avoid editing ‘hosts’ file by using FoxyProxy plugin for FireFox

May 15th, 2009
Comments Off

I love it when small utilities like this make web development so much easier. In my everyday development, I religiously edited the ‘hosts’ file. Yes, that file hidden away in the Windows folder that also requires special Admin security elevation in Vista. I managed to overcome all these items by locating a shortcut on my desktop that would open it in Notepad and be ready for editing. That was great for a while.

foxyproxy_patterns_screenshot

This method had a few downsides to it. When I try to switch between the localhost version of a site and a remote site many times within a short amount of time, the not so many steps that are needed all of a sadden seem a lot. More problematic is the fact that there is no indication as to which state a specific site is set at the moment: localhost or remote? and in some cases I ended up sending a completely broken site to the client who probably thinks I am a rookie with an internet connection. Don’t forget that when you change your hosts file, you also need to either restart the browser or go to the file menu, choose ‘work offline’and then ‘work online’ and refresh the site. None of that is necessary with a simple add-on to FireFox: FoxyProxy.

FoxyProxy acts as a proxy server between the Firefox and the internet. You set a ‘proxy’ which essentially allows you to direct traffic to a single point – I use one that directs traffic to ‘localhost’ – then you can add as many patterns as you want that will be associated with the Proxy. Once all is setup, you can then turn this Proxy on or off with a single right click at the bottom of the browser. For me, the setup is quite simple and it works great.

Ok, so there is one caviat here: sometimes I do need to test the websites in different browsers. In this case, this browser add-on will simply not cut it. But for most of my daily web dev needs – it is great!

Ron Peled Web Development

Cleaning an entire subversion working folder from ‘.svn’ folders

May 12th, 2009

Rarely I need to clean an entire folder from all the hidden ‘.svn’ folders which makes it a working copy of an existing repository. Unfortunately my projects tend to be large in the number of files and fairly complex. When I upgrade the project, say from Ektron 7.0.4 to Ektron 7.65 SP2, there are a lot of changes in the files. In the upgrade process, some folders loose their ‘.svn’ subfolders which makes it difficult to use the ‘SVN Update’ + ‘SVN Commit’ walk in the park method. What we need is a ‘SVN Reintegrate’ option, lets create one.

subversion_svn_reintegrate

Until now, what I end up doing is removing all the ‘.svn’ subfolders, checking out the project to another folder, removing all the files from the checked out folder (SVN Delete), copying over all the current set of files/folders, and checking the whole thing back in to the SVN repository. This works well but it requires some serious file manipulation efforts. Here are two usefull tools I just recently discovered that can help tremendously with this process:

1. Cleaning an entire subversion working folder from ‘.svn’ folders:

Ryan Christensen describes how to remove all .svn subfolders from a SVN working copy. In short, you need to create a small ‘.cmd’ file that will live in the top folder that you want to detach from SVN and write this command in it:

for /f "tokens=* delims=" %%i in ('dir /s /b /a:d *svn') do ( rd /s /q "%%i" )

I saved it as cleansvn.cmd and run it from a command line window after changing the current directory to the project folder. You will need to wait until the TortoiseSVN checks all the subfolders because it keeps a bunch of info in cache and with this util – it doesn’t refresh veru quickly. But it works great.

2. The new Rsync for Windows, called RichCopy:

Apparently, Microsoft has recently (April 2009) published this free utility called RichCopy which comes to replace the RoboCopy GUI tool from 2006. According to the article, this utility is also many times more efficient and handles multi threading, network connections, etc. I tried it and it worked great for me.

Here are the new steps for my ‘SVN Reintegrate’ procedure:

  1. Backup all working copies before proceeding
  2. Clean working copy from all ‘.svn’ folders
  3. Checkout latest project from SVN repository to another folder (not a subfolder)
  4. Use RichCopy to copy over all the files, these are the settings:
    1. Source: the new clean working folder
    2. Destination: the latest SVN checked out folder
    3. Use the ‘Purge’ option
    4. Exclude all ‘.svn’ folders from this process
  5. SVN Commit the SVN folder that was overwritten by the working folder

A bit confusing but if you know what you are doing it can save you a few white hairs. Enjoy!

Ron Peled Ektron, Web Development , ,

Browser Wars: IE Share Dropping while User Base Still Growing

May 5th, 2009
Comments Off

What am I talking about? First you need to look at this graph of browser usage over time since 1996 by Asa Dotzler. Please note that the sources for this graph are not clearly identified but still this makes a strong point of paying attention to the entire picture, not only market share.

Basically, while Internet Explorer’s market share continues to drop drastically and FireFox’s market share continues to increase the rate of new internet users is so vast that the total number of IE users is still increasing. In addition, it is obvious that Microsoft is paying a lot of attention to its browser and packs it with features. Furthermore, it will be the default browser in the highly anticipated Windows 7 new operating system, which is expected to gain significant higher adoption rate than Vista. In short, it is wise not to write IE off and keep the Virtual Machines with the various IE versions handy.

Another observation is the market share that FireFox has commanded and the short amount of time it did so. Remember that users who download FireFox and use it do so because they truley believe it is a superior browser. Unlike other browsers that come bundled with the OS (IE, Safari), or have a deep-pockets corporation behind it (Chrome).

Ron Peled Web Development , ,

Visual Studio 2008, Run as Administrator, Application Cannot Start

April 30th, 2009

If you ever wondered why is this happening there is a nice blog post written by Alex Riley. Alex explains and shows how to copy two DLL files that are needed and expected in a certain folder. This description helped tremendously, however I wanted to make things clearer and distinguish between 32bit and 64bit environments:

If you get the error “Application Cannot Start” when you try to ‘Run as Administrator’ VS2008, this is what you need to do:

For 32bit environments (follow Alex’s steps):
Copy dte80.dll and dte80a.dll from “C:\Program Files\Common Files\Microsoft Shared\MSEnv” to “C:\Program Files\Microsoft Visual Studio 8\Common7\IDE”

For 64bit environments:
Copy dte80.dll and dte80a.dll from “C:\Program Files (x86)\Common Files\microsoft shared\MSEnv” to “C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE”

You should be good to go now!

Ron Peled Web Development

Will Visual SVN Server remain a for-Free product?

March 30th, 2009
Comments Off

After writing about Visual SVN Server, I was wondering will the software remain free… Since I was thinking to myself, what is the logic behind giving it away like this. I already though of some reasons but I wasn’t sure and their website did not indicate any future plans but niether it indicated that the product will remain free. Hence I emailed the sales team and got this response back:

we’ll always keep VisualSVN Server free with the current set of functionality. We’re not going to take money in future for the functionality that we distribute free of charge now.

This means that we should expect another version that is a paid version of this product. It also means that we can certainly enjoy using this version without getting blocked from future upgrades or locked in to this solution with no way out.

Ron Peled Web Development