Archive

Author Archive

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

iNove theme from mg12: Pros and Cons

March 29th, 2009
Comments Off

As you can see I am using the iNove theme offered free by mg12. I have spent about an hour this weekend to tweak and set it up to my liking and overall it is a great theme. The look and feel of this theme is awesome, clean, and easy to read. While playing with it over the weekend I did find some room for improvement. I am going to limit  my pros/cons to max 5 for each and please remember this list is provided with constructive intentions only. So here is a short pros/cons list for the iNove theme:

inove_theme_on_activo_blog

iNove theme Pros

  • Clean look & feel.
  • Allows for custom meta tags, google search, notices, rss feed, and email feed.
  • Neat usage of icons.
  • Well balanced main content area versus sidebar.
  • Fantastic set of default hard-coded widget set for the sidebar.

iNove theme Cons

  • Not using the wordpress widgets engine, hence it is difficult to edit and tweak. In some cases will require editing theme files.
  • Scalability and performance is impacted due to the large number of css and javascript files. Using local jQuery file instead of the google hosted one.
  • Not using CSS sprites while having a classic example of one such possible usage (icons).
  • Javascript files are not minified.
  • Some external plugins are required for all the functinoality to work.

Overall, it is a thumbs up for anyone who is considering this great theme. However, like everything else, there is always room for improvement.

Ron Peled Web Development

New theme, updated wordpress – 2.7.1

March 28th, 2009
Comments Off

Yes, I am sure you have noticed. I just finished updating the blog a bit. The current theme is iNove by mg12 – I love the use of the icons. I also updated the underline wordpress to the latest 2.7.1 – yes it is about time.

Expect more positive updates soon and always let me know if you have any feedback. Enjoy.

Ron Peled Web Development

Recommended: Visual SVN Server, now with Subversion 1.6

March 27th, 2009
Comments Off

Sometimes we are so busy with our projects that we miss interesting changes, some may influence us positively. Here is a change that I wanted to share with you: new subversion version 1.6 and Visual SVN Server.

In the last three years we have used both VSS that integrates seamlessly with Microsoft’s Visual Studio, of-course and subversion which can be handled simply from the Windows Explorer window under windows or by using the simple but useful subversion client. Through our development years, it was subversion that took over all our source code repositories. It was simple to use, great to manage, and most importantly – reliable.

Just recently I needed to use the ‘merge’ feature and I discovered that it was only available in version 1.5 and on. So, I went on trying to upgrade the subversion binaries to the latest stable on an Ubuntu server. If you have been reading my blog, you already know that I do not like Ubuntu, well this is the only Ubuntu server left in our arsenal. To make a long story short, after trying to upgrade but giving up since it requires a major Ubuntu release upgrade, I decided that I should look somewhere else. This is where I turned to Visual SVN Server.

After purchasing a copy of Visual SVN – which is a great little plugin to Visual Studio that allows you to integrate with your subversion repository seamlessly and efficiently, we noticed that the same company created Visual SVN Server. Hence, I tried it. I can start by saying that it was well worth it. Yes, Linux is great but for the simple stuff that we do with SVN a windows box will do just fine. Not to mention that with Ubuntu it is a nightmare and waiting for CentOS to adopt the latest version of subversion may take some time, Visual SVN Server is very convenient. If you check their download page, the latest download-able version is already using subversion 1.6. Great!

So, if you are looking to build a subversion repository or in need of upgrading due to need of features/bug fixes – I strongly recommend upgrading to Visual SVN Server.

By the way – moving your existing repositories is a no brainer, especially with Visual SVN’s repository import feature.

Ron Peled Web Development , ,

Tightening up iptables for a dedicated DB server (MySQL and CentOS)

March 25th, 2009

In a typical high performing web servers environment I have a few web servers running apache/php and a separate DB server to support them. If the need ever comes to increase the capacity of the DB server it can easily be done via the MySQL clustering configuration. In any case, one of the most redundant tasks before setting up all servers is to tighten the security. In particular, setting the firewall is a repetitive task. Hence I am setting this page as a guide to myself and anyone who cares, Enjoy!

  1. SSH to the server, login as root
  2. type vi myiptables-mysql
  3. Insert the following commands:
    NOTE: you will need to insert the web server’s ip addresses where I placed <ip address#>. These are the ip addresses that MySQL queries will originate from.

    #!/bin/bash
    #
    # iptables example configuration script
    #
    # Flush all current rules from iptables
    #
    iptables -F
    #
    # Allow SSH connections on tcp port 22
    # This is essential when working on remote servers via SSH to prevent locking yourself out of the system
    #
    iptables -A INPUT -p tcp --dport 22 -j ACCEPT
    
    iptables -I INPUT 1 -i lo -p tcp --dport mysql -j ACCEPT
    iptables -I INPUT 2 -i lo -p udp --dport mysql -j ACCEPT
    iptables -I INPUT 3 -i eth0 -p tcp --dport mysql -s <ip address1> -j ACCEPT
    iptables -I INPUT 3 -i eth0 -p tcp --dport mysql -s <ip address2> -j ACCEPT
    
    #
    # Set default policies for INPUT, FORWARD and OUTPUT chains
    #
    iptables -P INPUT DROP
    iptables -P FORWARD DROP
    iptables -P OUTPUT ACCEPT
    #
    # Set access for localhost
    #
    iptables -A INPUT -i lo -j ACCEPT
    #
    # Accept packets belonging to established and related connections
    #
    iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
    #
    # Save settings
    #
    /sbin/service iptables save
    #
    # List rules
    #
    iptables -L -v
  4. save and exit
  5. Allow the file to execute by typing this command: chmod +x myiptables-mysql
  6. Run the file by tying this command: ./myiptables-mysql
  7. Test it and Enjoy!

Security notice: yes, for an even tighter security it is possible to change the ports.

Ron Peled LAMP: Linux Apache MySQL PHP, Web Development ,

Zend Studio 6.1: Wrong Way to Enhance a PHP IDE!

February 16th, 2009

In the past two weeks I have been doing some serious PHP development. Unlike .NET development where Microsoft’s Visual Studio is second to none, in PHP there was never a clear winner. So, I have decided to take the latest Zend Studio, version 6.1 on eclipse, for a spin.

As always, I give Zend, the company who created PHP a lot of respect. But with my usage of the Zend Studio IDE I have found more annoyances than features that helped me gain productivity. Here are some of the bad items I could not resist but rant about:

1. The entire solution now seems ‘gummy’. Where are the days when we can go through multiple PHP projects, and multiple PHP files in a few clicks and the IDE still feels ‘light’? Well, it doesn’t. In fact the more I use it the more this new IDE feels ‘yuck’.

2. My experience with the file/project manager on the left hand side was poor at best. If you have some scripts that update a file with fopen(), fwrite() – I had to force refresh on the parent folder of the updated file otherwise the IDE shows an error message when I try to open the updated file. What?

3. Auto complete is a little wierd. Ok, maybe a lot wierd. I really miss the auto complete that Zend Studio 5.5 used to have. While it is evident that the algorithms are trying their best to be smart, the whole user experience with the location of the auto complete windows, tabs vs enter keys to confirm the selection, and some inconsitencies in UI brings my frustration to uncharted levels. Dear Zend Develop team, can you please download and try Visual Studio and copy the ease of use? not hard to do.

4. Do I really need to create a new project, give it a name, choose a folder if all I want is a new PHP file? really? Do you ask your online users to fill out a 20 field form for a simple contact inquery? I DONT THINK SO.

5. Two files that I need my IDE to handle well: XML and SQL. All I ask for is to show me the text, dress it up with color, and handle nice any auto completion in a smart way. In this new versin of Zend Studio I was simply not able to open some XML files or the rigid editing of it made it impossible to work within the IDE, Notepad served nice in those cases. But this means failure to the IDE’s interface.

Conclusion
I do not know what made Zend decide on choosing a wrong turn with the latest version of Zend Studio (6.1). But it seems like the Zend team have decided to sacrifice a lot of functionality in order to cut on development efforts that the eclipse IDE supposedly provides. The only problem here is that eclipse’s features are weak and not good enough to be considered a good starting point for any PHP IDE who wishes to be claimed the best.

Time to try something new, the buzz seems to favor the latest PHP IDE by NuSphere: PHPEd.

Ron Peled PHP/MySQL, Web Development , , , ,