Archive

Archive for the ‘Web Development’ Category

NetBeans – a PHP IDE for the VS crowd

July 30th, 2009

I know I’m not the only PHP developer on the planet who despises Eclipse, refuses to pay for Zend and thus does most of their development in some text editor devoid of the basic conveniences of an IDE. At the same time, I’m not the only PHP developer who spends quite a bit of time in the .NET world being spoiled by VisualStudio and ReSharper’s conveniences.

I’m sure this makes me a Microsoft sellout on many levels, but I’m not ashamed to admit it. Visual Studio (despite its many flaws) is the best IDE I’ve ever used. No it is not perfect. Yes I curse at it daily (no different than the mechanic cursing a wrench he’s used for years). But I get my job done. I don’t have to jump through too many hoops to do it. I just need an average machine with Windows.  The combination of Visual Studio with ReSharper is what allows me to stop worrying about using software and focus on writing good clean code. Yet for my PHP work, I’ve been stuck to Notepad++ and vi for too long.

Since I paid quite a bit for VisualStudio, I’m not too interested in dropping a lot of money on another IDE, so for the purposes of this comparison, I looked at free products.  Until recently, my choices came down to decent but not user-friendly IDEs in the Aptana/Eclipse vein, half-baked free IDE versions of a paid product (Komodo) or a simple text editor.

For small things, Notepad++ and vi are still my go-to tools.  But for the big stuff, the glamor (or lack thereof) of being known as the guy who codes in Notepad++ is finally gone. Good riddance. Since picking up NetBeans 6.5 in RC mode I haven’t looked back. Bottom line: NetBeans gives me an IDE where I can focus on my code rather than on learning how to use some oddly designed beast (Eclipse).  Yet, being an IDE, I have the conveniences I’m used to from my .NET development.

Here are a few of my favorite things:

  1. Code completion – all IDEs have this, but NetBeans is better for someone used to VS.  Full documentation for standard functions and linked files is made available with a simple keyboard shortcut.  Aptana’s and Eclipse’s default code completion is laughable. Just listing the name of the function?
  2. File browsing - just like in ReSharper, hitting a simple keyboard shortcut (Ctrl-O) to browse by type (and it takes CamelCase, whoohoo!) makes moving around in a large project incredibly easy.  The completion also takes into account linked code (i.e. PEAR, CakePHP, CodeIgniter) types.  Ctrl-Shift-O lets me browse by filename.  No more hunting for files across library directories. Ctrl-Alt-Shift-O browses by method.
  3. Search usages – surprisingly, even the shortcut is the same as my ReSharpered VS installation, Alt-F7.  I get a list of every instance of the variables usage across the project.  No more grepping and checking context to see if it’s really a different variable by the same name.
  4. Code walking – Ever since my Delphi (Borland studio) days, I’ve found Ctrl-clicking a variable or type to go to declaration indispensible.  VS doesn’t do this by default, but thankfully the guys behind ReSharper thought of this.  To my surprise (or are they reading my mind?), the guys at NetBeans did too.  Clicking a function’s usage takes me straight to its declaration.  What could be simpler? Aptana, take note, when I accidentally click on “require_once”, don’t take me to the file that’s being included.
  5. Decent javascript and CSS support.  I don’t spend a lot of time on them since I mostly do backend work, but it’s nice to know code completion, documentation and even CSS preview are available.  These are not my strong suit and it’s nice that NetBeans gives me a crutch with them.

To be fair, NetBeans isn’t perfect.  The CamelCase support for type browsing, CakePHP support and the SVN plugins could be improved.  Still, it’s the best free tool I’ve seen.  It fits my needs, as a guy who spends at least 40 hours a week staring at Visual Studio and wondering why PHP IDE’s are so far behind.

lutskovp Uncategorized, Web Development , , , , ,

toad for mysql

February 17th, 2009

In my recent quest to migrate a shopping cart from osCommerce to ZenCart, I realized that I missed the SQL comparison tools I used in my Delphi programming days — namely redgate SQL Compare.  But like most that only freelance occasionally, I simply cannot justify spending several hundred dollars on a tool I’ll only use some of the time.  

I needed something cheap (free) to compare both the schema and the data and spit out a difference between tables on different databases.  Hand-comparing would be a waste of time for a low-paying project and I was fairly certain from a quick once-over that there would be few differences in structure since Zen Cart started as a branch of osCommerce. 

I’ve used MySQL GUI Tools issued by MySQL for the last few years on PC and Mac and found their performance to be generally good on PC and less than adequate on a Mac.  There was always phpMyAdmin — old, clunky, definitely a tool of the last resort when remote logins aren’t allowed.  Additionally, SQLyog’s free edition has been quite useful.  Sadly, none of them offered any sort of data/schema comparison tools.  

  • MySQL’s Migration Toolkit (part of MySQL GUI Tools) offered a very cool interface for moving one db to another.  I will likely have to review that separately for its ease of use, speed and flexibility in doing that one task. But there wasn’t a way to take one database’s objects and compare them to another database’s objects for the purposes of moving data.
  • SQLyog was another excellent GUI for DB work.  Free was a good price.  But still no comparison features.
  • phpMyAdmin is a tool of last resort for me.  It offers backup and restore but little else. I despise the GUI and the features are lacking quite a bit.

With my hopes down and settling in for a tedious hand-compare process I ran across Toad for MySQL which promised “utilities to compare, extract and search for objects.”

I’m impressed.  Within minutes, I had two schemas compared on the tables I needed and scripts generated to move data from one to the other.   The usability of this software was excellent and incredibly intuitive, without nags, useless prompts, unclear instructions, etc.  

Reasons why Toad is my new MySQL GUI: 

  1. Powerful schema and data comparison. Free.
  2. SQL debugging, query planning, query builder for when you’re lazy, auto-generation of statements.
  3. Decent, intuitive GUI.  Even the ability to use whatever style you’re used to, like SQL Query Analyzer or Management Studio.
  4. It didn’t attempt to take over the .sql file extension.  I can still use anything else I want.  It doesn’t pretend to run my life and I’m quite happy with that.
  5. Did I mention it’s free?

lutskovp Freelance, Web Development, sql , ,

Goodbye osCommerce, hello Zen Cart

February 7th, 2009

After several months battling osCommerce for a client of mine, I’ve thrown up my hands and embraced ZenCart.  The only pain in the process is knowing that had I done this sooner, I could’ve finished this project last month.  To compare the two is to compare a paraplegic to Michael Phelps.

OK… Maybe that’s a gross exaggeration.  I’m sure there are plenty osCommerce users in the world for whom it works well.  The problem is it didn’t work for me without having to debug payment modules.  Out of the box, the latest version was clunky, required register_globals to be on (deal-breaker), used a non-W3C compliant layout, had zero skin previews on its site and refused to work with PayPal Advanced Web Payments. This makes it a poor solution for my client — small business, no merchant account with a large bank, limited budget, limited time.  Something had to be done and after going through seven circles of hell with osC,  on a whim I tried Zen Cart.  I was hooked.  Not only did it work out of the box, but there was actual documentation, W3C compliance, much more flexibility, AND it worked with PayPal immediately.

So, if you’re stuck with an e-commerce package that requires you have register_globals set to on, doesn’t quite work with paypal and isn’t W3C compliant out of the box, this is for you.

It’s time to lose osCommerce and use a more modern solution.  The process is quite simple because Zen Cart’s schema is very similar in all key places to the osCommerce schema.  This is because ZenCart was branched from osCommerce a while ago. While the PHP changed, the schema remained very close to the original. The upgrade is simply a matter of installing ZenCart where you need it, running some DB scripts, and moving a few image files.  I went from osC 2.2 to Zen Cart 1.3.8.  I’m not sure if the below instructions will work for other versions, so you should check the schema before proceeding.

First, install ZenCart.  I put mine at /[site directory]/zen.  Create a DB for it and then just follow the instructions.  If you’re on DreamHost, there’s a one-click installer available.

Next, you’ll need to run some db scripts to move your data over.  If you don’t want to mess around with manually reviewing each table, a data compare tool is imperative.  If you have a Windows machine available, Toad for MySQL is a free tool which has a data compare function. There are alternatives that cost over $200.  You can also use phpMyAdmin to export the necessary data and import it into Zen Cart.  The bare minimum tables you’ll need are below.  When preparing this, note how many tables you selected. This will help debug the import if things go wrong.

address_book
banners
categories*
customers*
manufacturers*
orders*
products*

You may have other content in tables like newsletters, specials, etc.  As long as you understand the general idea of comparing the tables before moving data, you can move those too.  In phpMyAdmin, select your osC database and click on the “Export” tab at the top.  Select the tables you want and use the following options:

Select SQL radio button under tables selection
un-check "Structure"
check "Data"
    x Complete inserts
    x Extended inserts
check "Save as file"

Next, just click “Go”. You can save or open the file.  You should have a SQL script containing all your really important product and customer data to move into your Zen Cart database.  So, select your Zen Cart database in phpMyAdmin and click on the Import tab. It’s time to move data.

Click “Browse” and select the file you just downloaded. Make sure the format of import file is set to SQL and click Go. You’ll get a status message telling you how many queries were successfully executed.  The number should be equal to the number of tables you selected.

Next, it’s time to move your product images.  The images directory in osC is /[installation dir]/images.  This is the same in Zen Cart.  You can use FTP, command line, a file manager, whatever you want to do this.  I just ran “cp -i * [zencart images dir]“. The “-i” flag will make sure you get prompted if there’s a conflict.

That’s it! You’re done.  Configure your store and start selling.

lutskovp Freelance, Web Development ,

Host review

February 5th, 2009

Having freelanced for some time, I’ve run into my share of good and bad hosts.  So far, my initial impressions of DreamHost are quite good.  

Yes, this is partially shameless self-promotion.  DreamHost will pay me to refer people to them.  They’ll pay you too.  This is standard practice among hosts and all legitimate businesses looking to maximize their ad dollars.  Word-of-mouth is the cheapest and most effective form of advertising.   Here’s my shameless self-promotion link: click it!. If you click it and sign up with them, I get $$$. If you want me to share, let me know, we could work something out. This isn’t about DreamHost’s referral program. This is about why they were the right host for me this time:

1. Cost – They ran an incredible promotion immediately after New Year’s – 95% off a two year hosting agreement.  Alas, I signed up too late to take advantage of that exact promotion, but I still received 80% off my two-year cost.  Yes, I’m 100% sure I will pay more to renew than I paid initially.  Still, I treat this as an investment and couldn’t find anyone cheaper, even the fly-by-night outfits.    

2. Value – the difference between actual cost and the cost one is willing to pay.   I’ve hosted with LunarPages, iPowerWeb, H-Sphere and even Rackspace. None of them come close to the features I get with DreamHost even if I did pay the full price (about $220 for two years, roughly $9/month).  Rackspace lost me with extra charges for EVERYTHING.  Truth be told, they have amazing customer service, but in today’s economic climate, it doesn’t justify the cost for me.  I’ll wait on hold a couple minutes extra.  Also, with DreamHost, out of the gate, I had PHP5, mySQL5 (Lunarpages, H-SPHERE and iPowerWeb have it available, but it’s a hassle), shell access, unlimited accounts, Google Apps, one-click installs (more on that later),  Jabber, SVN.  These were either extra at the other hosts, unavailable, or a hassle to set up.

3. Ease of use.  I spent a week on a private server with Lunarpages setting up a current version of SVN.  That’s a week in spurts of activity, so not a solid 168 hours, probably closer to 10.  At the end, I had no externally accessible repository.  mod_dav_svn could not be installed on the server and svnserve wouldn’t hook into inetd due to an old version of apache and inetd that I wasn’t able to upgrade on a private server.  I now have two repositories running on DreamHost.  It took all of 5 min per repository.   It seems they thought this through and created a product for people who are too busy to play system administrator.  Good for them; very good for me.  

4. One-click installs. Yes, setting up WP is easy.  But I don’t want to do it. After installing it for others and customizing it, I don’t want to have to do it for myself too.  It’s nice to click a button and have them run a script with the latest stable version to be installed into my domain.  Same for ZenCart, dotProject and a few other goodies (hopefully more to come)

5. Control.  I know, I mentioned this before.  But it actually means a lot to me to have shell access to my account and be able to manage my sites through a shell.  It’s significantly faster than using FTP to edit and sync files. I’m surprised more hosts don’t offer this feature at no cost since it’s already on the shared server.  Additionally, their Panel is much easier to use than others I’ve worked with — consistent organization, no weird redirects to other domains to manage mysql, no attempt to get me to use some bogus file manager from the web (seriously, isn’t that why there’s FTP and shell?), no separate support site, just clean and functional.

It wouldn’t be fair to mention something I don’t like about DreamHost.  I tried installing Trac.  It took a couple days.  There’s no one-click installer available, but Petar Marić had a very decent set of scripts to make this easier.  Had I followed his instructions to begin with, I would’ve been done much sooner.

lutskovp Web Development