Archive for the 'Web Development' Category

PhpStorm 5 :: PHP Coding At Its Finest

Friday, September 14th, 2012


Every PHP developer hunts for the ideal IDE – and in the past there was no clear winners. I personally used Zend Studio for many years which had fantastic code awareness and auto-completion, which I view as essential when working on large PHP projects. But the reality was that Zend Studio was always far too expensive. So every 6 months I would re-evaluate the PHP IDE space hunting for alternatives. I tried Komodo, I tried NetBeans.

Then I discovered PhpStorm.

PhpStorm is not free – but it is a LOT cheaper than Zend Studio – and in my opinion a much better IDE. It is fast and the code awareness and auto-completion works flawlessly. It is also a fanstistic editor for HTML / CSS / JavaScript development. It has a lot of features under the hood that I am constantly discovering. It has quickly become my IDE of choice, and my fellow developers who have tried it have all switched.

The latest version, PhpStorm 5.0, was just released with some fantastic new features. If you have been looking for a great PHP IDE then your hunt is over. And now is a great time to get on board with the Single Developer license currently half-price.

See on www.jetbrains.com

Getting Cozy With Underscore.js

Wednesday, September 12th, 2012

A nice introduction to Underscore.js – a utility library for JavaScript that can really help streamline your code.

See on net.tutsplus.com

The Tools and Tech Behind Trello

Saturday, September 8th, 2012

Have you used Trello? It is a fantastic, easy-to-use, but deceptively powerful, task management tool – and it is free.

Trello also sports a user-interface and backend architecture that is using a number of very modern tools and technologies – which the Trello Dev team have shared with us. If you are a developer it is interesting to compare notes with this list from Trello – how many of these tools and technologies do you personally use? Are you at least familiar with them?

I decided to go through this process myself:

  • Trello – yup, use this for managing internal task lists and the roadmap of my apps
  • Kiln – familiar with it, but I use GitHub
  • Node.js – don't use it on the server, but use it along with npm on my desktop
  • MongoDB – familiar with it, but use CouchDB instead
  • CoffeeScript – familiar with it, decided to steer clear
  • Redis – yup, for data persistance and caching on several projects
  • Backbone.js – use it to underpin my JavaScript libraries
  • Underscore.js – use it to underpin my JavaScript libraries
  • jQuery.js – of course, an essential library for any web-page/app that needs JavaScript
  • LESS – love it, using it to underpin all CSS work
  • AmazonS3 – not yet
  • Vim – not for development but of course for server ops
  • Sublime Text – my favorite text editor
  • Chrome Developer Tools – for sure
  • Xcode – as a developer of iOS apps I can't avoid this one
  • IntelliJ – I use it's baby sister PhpStorm for all PHP, CSS and JavaScript development. My favorite IDE.
  • Charles Web Debugging Proxy – not yet
  • FogBugz – have used in the past, but use a combination of Zendesk and Trello instead
  • Google Docs – of course

So how did I do? I seem to be actively using most of this stack, or an equivalent, on an almost daily basis.

If you are not familiar with any of the items on the list I encourage you to do some reading – even to just be aware.

You can read more about each of these items and get links to them from the Trello blog post: http://www.bestvendor.com/lists/building-and-maintaining-trello-a-modern-single-page-web-app

Symfony 2.1.0 released

Friday, September 7th, 2012

Zend Framework 2.0 was announced earlier today, and now the Symfony team announce the release of Symfony 2.1.

Symfony 2.0 has been in use on large websites for over 2 years now, and was a major framework release in the PHP community. It was one of the first frameworks to truly take advantage of the language features available in PHP 5.3, and it has had a huge impact in shaping the next generation of PHP frameworks such as the newly announced Zend Framework 2.0. The Symfony standalone Components have also been used to replace large chunks of code in popular PHP projects such as Drupal8 and PhpBB4.

The release of Symfony 2.1 is great news, particularly with regards to the Form Component which I have been experimenting with recently. I personally have jumped ship from using the Zend Framework (ZF), to using the Symfony 2.0+ stack on newer projects. I have started implementing the Symfony Components within older ZF 1.0 web apps. And on smaller projects I will be experimenting with Silex, the Symfony-based "micro-framework".

With the community slowly adopting PHP 5.4 this is the time to ensure you are keeping pace with the newer frameworks and that you have moved into the post-5.3 era.

Symfony:
http://symfony.com

Symfony Standalone Components:
http://symfony.com/components

Silex Micro-framework:
http://silex.sensiolabs.org

See the announcement on symfony.com

Zend Framework 2.0 finally made it

Thursday, September 6th, 2012

Version 1.0 was released in July 2007 – now, 5 years later, version 2 is finally here. Announcing the official release of Zend Framework 2.0.
See on framework.zend.com

Playing with the toys… Bootstrap, from Twitter

Saturday, December 10th, 2011

BootstrapRecently I discovered Bootstrap from Twitter. As mentioned on the website "Bootstrap is a toolkit from Twitter designed to kickstart development of webapps and sites. It includes base CSS and HTML for typography, forms, buttons, tables, grids, navigation, and more." And it is very nice.

But you never truly know how good a tool will be until you try it. In the last few days I have used Bootstrap for two small projects – one internal project at SiteHost where I work, and then again today when I built a webpage for my mothers shop in a couple of hours: www.chandelle.co.nz.

I have to say I am impressed and will be using Bootstrap again for sure. It does for CSS layouts what jQuery does for JavaScript – streamlined, elegant, and so easy to use. Highly recommended.

Missing PuTTY on your Mac? Use the alias command

Wednesday, October 13th, 2010

If you have moved to Mac OS X from Windows you may be like me and miss the convenience of the saved server settings in PuTTY. These settings allowed you to telnet/ssh into your servers without having to remember the IP of each one. There are numerous ways around this of course, but here is a tip that may come in handy…

Use Alias Shortcuts

The 'alias' command allows you to create an alias, or shortcut, to a longer command. For example you could create a shortcut to open TextEdit from the command line like so:

  • Open the Terminal app
  • Type  the following: 

    alias te='open /Applications/TextEdit.app/'

  • Press Enter
  • Now type "te". TextEdit should open

So how can we use the alias command to replace the convenience of PuTTY and log into servers easily?

We can create shortcuts for servers that we frequently log into. For example in the Terminal type the following:


alias myserver='ssh username@xxx.xxx.xxx.xxx'

Where:

  • myserver = the name of your alias/shortcut
  • username = a valid user on the server
  • xxx.xxx.xxx.xxx = the server IP address

Now you can ssh to that server by simply typing "myserver". This should prompt you for your password – enter that and you're in!

Use .bash_profile to save aliases

At the moment if you close your Terminal, and then re-open it, your aliases will have been forgotten. So how do we tell Terminal to remember them permanently? The trick is to create a .bash_profile file for your Mac user. This file should exist in your Mac home directory. To create this file follow these steps:

  • Open the Terminal app
  • Type the following:

    vi ~/.bash_profile

  • This will open a new blank file in the "vi" editor
  • Press "i" once – this puts the editor into "insert" mode
  • Put your alias command into the file (same as above) – paste using Ctrl+V, or type it
  • Press the Esc key once
  • Type ":wq" to finish editing the file and save it to disk
  • Now close your Terminal app, and reopen it. Your alias should now be working.

Note: If you have TextMate installed (which I highly recommend) then at the command line just type "mate ~/.bash_profile" (instead of using "vi"). This will open a blank file in TextMate. Then type in the alias command as above and save the file. Then close and reopen the Terminal app.

This was just a quick overview for those who can work out the details from the clues above. Even if you do not use aliases to shortcut logging in to servers they are handy to know about.

Happy aliasing!

Ext.air – Blurring the line between Adobe AIR and Ext JS

Wednesday, December 3rd, 2008

By now you should be very aware of Adobe AIR which allows Web Developers to use their existing skill-set to develop desktop applications for Windows, OS X and Linux. This means that anybody who knows HTML, JavaScript and CSS can easily start developing desktop applications. And if you add Ext JS to the equation then you get an impressive JavaScript library and whole set of interface widgets that work tightly with Adobe AIR out of the box. Ext JS and Adobe AIR are made for other, and it is good news to hear that Adobe and Ext are officially working together to take things to the next level.

As a result of collaberation between Ext JS and Adobe, several impressive enhancements to the Ext.air package were just released. These enhancements allow even better control of AIR and the desktop via easy to use JavaScript calls.

For example to play a music file:

var mp = new Ext.air.MusicPlayer();
mp.adjustVolume(0.5);
mp.play(url);

Or to tell your application to launch on system startup:

Ext.air.App.launchOnStartup(true);

Additional enhancements allow you to easily control desktop windowing, video, system notifications and alerts and even the clipboard.

You can learn more about Ext JS here.
You can learn more about Adobe AIR here.

Controlling the IE7 “Shrink to Fit” print setting using JavaScript

Friday, November 30th, 2007

You may have noticed that printing in Internet Explorer 7 has a new feature – "Shrink to Fit". In some situations, such as when pages are in an iFrame, "Shrink to Fit" is always applied by default. For general web pages this feature may be appreciated, but in a web application where developers want to control the layout of the page, and perhaps generate reports, we do not appreciate IE7′s changing the print layout at all.

If you have not been challenged by this behaviour yet, don't worry – you will! And when you do, here is the solution.

Instead of the typical "print()" command in JavaScript, use:


document.execCommand('print', false, null);

Or if you are wanting to print a document inside an iFrame you can use something like:


window.frames(0).focus();
window.frames(0).document.execCommand('print', false, null);

Note: This solution is for Internet Explorer 7 only – I leave it up to you to do the browser detection.

Debugging in Zend Studio without Zend Platform

Monday, June 4th, 2007

I have been using Zend Studio for quite a while now as my primary PHP IDE. To get the powerful remote debugging and profiling that comes with the tool you used to have to install Zend Studio Server as well. With the release of version 5.5 however, Zend stopped shipping Studio Server and forced developers to install the Zend Platform instead. This is a commercial tool (free to developers) available from Zend that offers PHP acceleration, caching and other features … that I don't want! I just want my debugging back, without having to bloat my local server with software I will not use elsewhere – especially when the Zend Platform does not support APC, which we run on our servers, and it also broke my web application.

It turns out that we do not need the Zend Platform at all. As part of the PDT Eclipse project Zend has made available a standalone version of their debugger. This can be downloaded from here: http://downloads.zend.com/pdt/server-debugger/

Then you just need to put the .so or .dll file in the correct location and add a few lines to your PHP.INI file and you are away. Here are the lines I had to add to my PHP.INI, which is running inside a Debian VMWare image. Note the commas separating the IP numbers – this took me a few goes to work out as the examples showed spaces or forward-slashes which didn't work for me.

zend_extension=/etc/Zend/ZendDebugger.so
zend_debugger.allow_hosts=192.168.1.3,192.168.220.1,192.168.150.1,127.0.0.1,192.168.220.10
zend_debugger.expose_remotely=always

Why did Zend make this so hard to work out? Reading on different blogs and through the Zend forums highlights that this issue has been a source of frustration for many developers. Grrrr…