Category Archives: Web Development

Setup A Hosted Git Repository With Gitolite

Git LogoGit has gotten a lot of hype recently, especially among smaller development teams and contractors, for its flexible, distributed environment, ease of use and while Subversion is the old kid on the block, there are pros and cons for each. This article assumes that you already know the intrinsics of the different version control systems and you’ve decided that Git is for you.

Gitolite is a package that allows us to host our repositories using one dedicated user that has restricted access to the host OS and provides access to the source code.

The following steps helped me successfully install and setup Git on a Ubuntu Server 11.04, install gitolite to host my Git repositories and allow secure access over SSH. I’ve not tested other Linux versions, but assume it should be very similar.

The basic steps include:

  • Create User
  • Generate SSH keys
  • Install Git
  • Install Gitolite
  • Administer Gitolite

Read more »

Facebook New Features And Changes Announced At F8

Facebook CEO Mark Zuckerberg and his crew presented the latest Facebook features at f8 today, to a crowd of developers and reporters during Facebook’s F8 keynote. There are many of new changes and features coming to Facebook and we have an outline of them for you.

News

A wide range of new social apps, such as Digg, Gizmodo, USA Today, The Guardian, Flipboard, Yahoo and many more will provide apps tailored to Facebook.

Music and Video

Like apps, music providers will think of ways to engage users on Facebook, like listening to the same music at the same time with your friends. And so will video providers, such as Hulu, Netflix, Flixster and others. Read more »

Create mobile and iPad versions of your WordPress site

WPtouch ProHaven’t you thought of creating mobile/iPad versions of your WordPress site? Is it worth the effort? If there just was an easy way to get them created and maintained. Well, there is..

WPtouch is a WordPress plugin for self-hosted WordPress websites that shows a well-designed mobile theme version of your site when visitors use their favorite touch mobile devices like the iPhone/iPod touch, Google Android phones, Motorola Droid, Palm Pre/Pixi, Samsung bada and Blackberry Storm & Torch devices. There is a free version and a paid Pro one. Read more »

Apache Prefork Vs Worker Threads

Apache Worker ThreadsWe often get questions like: What is the difference between Apache Worker Threads vs Prefork? Is it bad to have the values the same configuration? Is it bad to have them different?

In this quick article we like to shed some light between the two modules and assess in what given circumstance, certain os and application would call for which solution.
Read more »

View Progress Of MySQL Dump Restore Or Import

Ever wondered why the MySQL command line tool don’t have any sort of progress information or status update? Well, you’re not alone if you do. Especially importing a GB sized dump file can take a long time, especially if the table engine was InnoDB.

There are some clever utilities which can be used to accomplish just that, by giving the user simple, yet useful information about the progress of their process. Let’s look at them.

Bar (Command Line Progress Bar)

The Bar utility, or in full terms Command Line Progress Bar can be downloaded from Sourceforge. If you are running Ubuntu, it’s as simple as running ‘sudo apt-get install bar’ to install it. You then simply pipe your MySQL import and get a nice status bar.

shell> bar -if=mysql_db_data.sql | mysql
Bar utility screenshot

Read more »

iFrame problems in WordPress solved

There seems to be a know problem with iFrames in posts, starting with WordPress 2.2.1, which happens when editors use the internal WYSIWYG editor. A lot of users have reported this issue in frustration.

Initial saving of the content was fine, but subsequently editing and re-saving is would strip iFrame tags. A less than ideal solution was to avoid using the WYSIWYG editor and edit the post using HTML code. Now there is a Mozilla Firefox extension for those that don’t like write pure html code, called Xinha Here!.
Xinha Firefox addon
It’s a pretty cool add-on, that opens either in a new window or  in a bottom bar and let’s you use it as WYSIWYG editor until you’re done, then hit ok and save the article in WordPress. Just ensure that html editor is selected during this process, especially at saving.

I have to say, Xinha works like a charm and has more features than the built in wordpress WYSIWYG editor. For more info, check out xinha’s web site.

Firefox Extensions For Web Developers

Firefox LogoWith the release of Firefox version 4 last week, we thought it’s time for a fresh list of most powerful Firefox extensions for web developers. Even though couple of our mentions are not yet compatible with this latest release, we’re convinced they’ll be available in no time.

While release 4 also includes some HTML 5 enhancements, we like to see some new extensions to help developers with canvas, forms, local storage and other new features in the future.

In case, we mean just in case you don’t have Firefox yet, you can get it here.

FireBug

Javascript debugger, live DOM & CSS inspector and so much more. The de-facto single greatest web developer add-on for Firefox.

Web Developer Toolbar

Another great developer tool and addition to FireBug, adds a toolbar with powerful web developer tools at your fingertips.

Live HTTP Headers

As you browse, view live HTTP headers of any page loading in real time.

ColorZilla

An advanced eyedropper, color picker, page zoomer and various colorful goodies.
Read more »

Enable Digest Authentication In Apache

Auth Digest

Digest Authentication

Basic http authentication in Apache (mod_auith) has been available for a while, but one major downside still exists, which is the exchange of plain text user name and password information over a possibly unsecured network.
That is where Apache Digest Authentication takes over and provides us with MD5 encrypted values, using the mod_digest apache module.

Here are the steps to create a password file to store all account information, install the apache module mod_auth_digest and the necessary configuration parameters to enable security of our restricted area.

Create Account file

For digest authentication we need to use a utility called htdigest, unlike with basic authentication where we used htpasswd. The application takes the file name, realm and username as arguments, then prompts twice for the user’s password. The flag -c creates a new file, it overrides the existing one if exists. Read more »

Move a SVN Subversion Repository

Subversion SVNAt some point in a developers life, we have to upgrade, switch hosting providers or replace broken hardware and with that comes the inevitable. Moving al lof our apps, data and configuration settings, and eventually our holy repository.

Moving an SVN repository from one Subversion server to another, while carrying over the entire version history information may seem like a daunting task, but fortunately it’s rather quite easy and straight forward.

Backup your old Repository

Step one is the generate a dump file of the existing repository which we can later move to our new server.
We create this dump with the following command:

# svnadmin dump /path/to/old/repository > repository.svn_dump

This dump file contains now all the revisions that have ever been made and committed to our SVN repository, and therefore this file may get rather large, depending on how active and old the repository is. Read more »

Install ffmpeg on Mac Snow Leopard

WebmFfmpeg is the de-facto open source standard for encoding audio and video. Especially with the arrival of html5 which uses codecs like Ogg, Theora, Vorbis, h264, webm among others, and the increasing popularity of devices from Apple, such as iPod, iPad and the iPhone, all of which require a different standard from flv, the version so widely in use by Adobe Flash.

Another positive aspect is that ffmpeg has a much revived developer group, posed to enhance the application on a much faster pace than it has been in recent years.

Installation on Linux systems is really straight forward, especially on common distro’s like Ubunty and Fedora. On a Mac, we will have to build it from source (if you’re not a fan of ports like me), including encoder/decoders we plan to use. Here is the breakdown to get ffmpeg installed on a Mac running Snow Leopard.

Install Git

If you don’t have Git installed, download the Git installer here, install the package and run the script in the source of the mounted image. CVS is included in XCode and that is located on the snow leopard installation disc.

Install LAME (latest version from cvs)

cd ~
cvs -d:pserver:anonymous@lame.cvs.sourceforge.net:/cvsroot/lame login
(at the password prompt, press Enter)
cvs -z3 -d:pserver:anonymous@lame.cvs.sourceforge.net:/cvsroot/lame co -P lame
cd lame
./configure
make
sudo make install

Read more »

Access Dropbox From Linux Server Command Line

DropboxSharing files between VM’s can be a pain, especially if your VM is running on a text based server without UI. For example, I start up a new VM for almost anything and I deal with up to 20 different sites and application and every one has it’s own VM.

VMWare provides it’s “Guest Additions” and that includes folder sharing. It works fine on desktop os’s, but on the command line we have to mount it using VMWare’s file system, which can be a bit cumbersome. A much simpler and easier way to share files is via USB or DropBox. Getting the DropBox sync daemon to run is really easy and once running, anything you add to DropBox will be synced to your VM transparently and at network speed.

If you don’t already have a DropBox account setup, get a free one here. Now on to the steps to get the sync daemon up and running.

Steps:

SSH to your Linux server and change to your home directory.
cd ~
for 32-bit os:
wget -O dropbox.tar.gz “http://www.dropbox.com/download/?plat=lnx.x86″
for 64-bit os:
wget -O dropbox.tar.gz “http://www.dropbox.com/download/?plat=lnx.x86_64″
After the file “dropbox.tar.gz” downloaded properly, then extract it
tar -xvzf dropbox.tar.gz Read more »

How To Clone A Virtual Machine In VirtualBox

Moving, cloning and modifying Virtual Machines and their associated Virtual Hard Disks in VirtualBox has been no easy task and to make matters worse, are poorly documented at best. In this guide, we’re using VirtualBox 3.2.10 r66523 running on Ubuntu 10.10 64bit host operation system.

Merge Snapshots

Merge all snapshots that we want to be included, delete the ones we don’t want. Unless we do this, we only get the base version and loose all changes contained in those snapshots.

Run VBoxManage

Using VBoxManage clonevdi to copy the virtual hard disk to a new VDI file. The basic syntax is: VBoxManage fullPathTooldVdiFile fullPathTonewVdiFile. We need to ensure that a hard disk with that name does not already exist, otherwise we’ll get errors.
VBoxManage clonevdi /data/VirtualMachines/Windows7.vdi /data/VirtualMachines/Windows7_clone.vdi

Add Disk To Virtual Media Manager

We’ll add the new created hard disk to the Virtual Media Manager. This step ensures that the hard disk has been properly cloned, has the proper permissions and that there are no conflicts with other disks and virtual machines. In VirtualBox, select File -> Virtual Media Manager -> Add and select the cloned file, in our case Windows7_clone.vdi. If there are no errors, we should now see the hard disk listed among the others and are ready to proceed with the new Virtual Machine.

Create new Virtual Machine

In VirtualBox, select Machine -> New  and proceed with the steps to create a new Virtual Machine. At the point we we select a hard disk, click existing and select our new disk.
Start up the new Virtual Machine and change hostname in /etc/hostname and eventually the network configuration in /etc/network/interfaces.

HTML5 Open Source Framework for iPad E-books

Baker FrameworkThe Baker E-book Framework is a free, open-source platform to create e-books for the iPad. The framework was developed by a team of Italian software geeks, allowing designers and web developers to transform fixed-width HTML5 pages into an e-book format and subsequently publish the finished product. All publishers have to do is follow the Apple App Store submission guidelines.

The first step involves creating a HTML5 version of your book with fixed width of 768 pixels that works and looks fine using Safari in iPad or via downloadable support CSS at Baker’s site. Keep all files in a flat directory called book and name the html files according to their page number (eg. 1.html, 2.html ….) which is the HPub format. The naming convention is still somewhat strict, but that will change over the next few releases.

Finally download the Baker Framework and follow the simple instructions contained in the readme.txt file:

  • Rename the Xcode project
  • Include your book
  • Include your icon
  • Follow the App Store submission instructions

You can check out a sample book created by the Baker folks, 5×15 Tokyo.

Casali and his team hope their creation will lead to more beautiful e-books and digital magazines on the iPad, and for other WebKit-enabled devices later.

You can download the Baker Framework files at the official site, and you can also join the project itself on GitHub.

Install Redmine using Passenger via Apache on Ubuntu 10.04

Installing Redmine on any system has been a daunting task for many, especially work thru countless dependencies and linking apps to make the application available via Apache. Since Ubuntu 10.04, Redmine can now be installed via apt or aptitude, and no doubt the process is much easier, but by no means just as straight forward as we’re used to.

To get Redmine up and running over Apache on Ubuntu 10.04, these basic steps are required:

  1. Install Apache2, Mysql Server, Subversion, extensions and utilities
  2. Install Redmine via apt
  3. Test Redmine using Webrick
  4. Install Passenger

1. Install Apache, Mysql Server and necessary extensions and utilities

$ sudo apt-get install build-essential apache2 apache2-threaded-dev apache2-suexec-common libapache2-svn libmysqlclient15-dev

2. Install and configure Redmine

$ sudo apt-get install redmine redmine-mysql subversion

Read more »

Using Regular Expression In PHP – The Basics

regular expressions cookbookRegular expressions are a powerful tool for finding, examining and/or modifying text. Regular expressions themselves are, with a general pattern notation almost like a mini programming language, allowing you to define and parse text. They enable you to search for patterns within a string, extracting matches flexible and precise. However, you should note that because regular expressions are more powerful, they also suffer from added overhead and are slower than the more basic string functions. You should make careful consideration and only use regular expressions if you have a particular need.

PHP supports two different types of regular expressions: POSIX-extended and Perl-Compatible Regular Expressions (PCRE). The PCRE functions are more commonly used, are more powerful than the POSIX ones and faster as well

In a regular expression, most characters match only themselves. For instance, if you search for the regular expression “foo” in the string “only a fool does not use regular expressions” you get a match because “foo” occurs in that string. Some characters have a special meaning. For instance, the dollar sign ($) is used to match strings that end with the given pattern. Similarly, a caret (^) character at the beginning of a regular expression indicates that it must match the beginning of the string. Characters that match themselves are called literals while characters that have special meanings are called metacharacters. Read more »

Page 1 of 3123