Sep 21 2009

Setup LAMP on Ubuntu

Install Apache

To start off we will install Apache.

1. Open up the Terminal (Applications > Accessories > Terminal).

2. Copy/Paste the following line of code into Terminal and then press enter:

sudo apt-get install apache2

3. The Terminal will then ask you for you’re password, type it and then press enter.

Testing Apache

To make sure everything installed correctly we will now test Apache to ensure it is working properly.

1. Open up any web browser and then enter the following into the web address:

http://localhost/

You should see a folder entitled apache2-default/. Open it and you will see a message saying “It works!” , congrats to you!

Install PHP

In this part we will install PHP 5.

Step 1. Again open up the Terminal (Applications > Accessories > Terminal).

Step 2. Copy/Paste the following line into Terminal and press enter:

sudo apt-get install php5 libapache2-mod-php5

Step 3. In order for PHP to work and be compatible with Apache we must restart it. Type the following code in Terminal to do this:

sudo /etc/init.d/apache2 restart

Test PHP

To ensure there are no issues with PHP let’s give it a quick test run.

Step 1. In the terminal copy/paste the following line:

sudo gedit /var/www/testphp.php

This will open up a file called phptest.php.

Step 2. Copy/Paste this line into the phptest file:

<?php phpinfo(); ?>

Step 3. Save and close the file.

Step 4. Now open you’re web browser and type the following into the web address:

http://localhost/testphp.php

Congrats you have now installed both Apache and PHP!

Install MySQL

To finish this guide up we will install MySQL. (Note – Out of Apache and PHP, MySQL is the most difficult to set up. I will provide some great resources for anyone having trouble at the end of this guide.)

Step 1. Once again open up the amazing Terminal and then copy/paste this line:

sudo apt-get install mysql-server

Step 2 (optional). In order for other computers on your network to view the server you have created, you must first edit the “Bind Address”. Begin by opening up Terminal to edit the my.cnf file.

gksudo gedit /etc/mysql/my.cnf

Change the line

bind-address = 127.0.0.1

And change the 127.0.0.1 to your IP address.

Step 3. We are now going to install a program called phpMyAdmin which is an easy tool to edit your databases. Copy/paste the following line into Terminal:

sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin

Step 4. Now linking phpMyAdmin to Apache’s www folder

sudo ln -s /usr/share/phpmyadmin /var/www/phpmyadmin

After that is installed our next task is to get PHP to work with MySQL. To do this we will need to open a file entitled php.ini. To open it type the following:

gksudo gedit /etc/php5/apache2/php.ini

Now we are going to have to uncomment the following line by taking out the semicolon (;).

Change this line:

;extension=mysql.so

To look like this:

extension=mysql.so

Now just restart Apache and you are all set!

sudo /etc/init.d/apache2 restart


Aug 23 2009

Install Gimp 2.6 in Ubuntu 8.04

Remove the old version of GIMP from Synaptic or in a terminal:

sudo apt-get remove gimp

Download and save all five GIMP packages from GetDeb. Double-click on the packages to install them, in this order:

  1. libbabl-0.0-0_0.0.22-1~getdeb1_i386.deb
  2. libgegl-0.0-0_0.0.18-1~getdeb1_i386.deb
  3. libgimp2.0_2.6.1-1~getdeb1_i386.deb
  4. gimp-data_2.6.1-1~getdeb1_all.deb
  5. gimp_2.6.1-1~getdeb1_i386.deb

Now you can start GIMP normally, from Applications->Graphics->GIMP Image Editor.
gimp-splash


Aug 7 2009

CSS Image Rollover

The CSS method uses what is known as an image sprite to load all the rollover effects as a single image and we then use CSS to do the transition. To create the image sprite just create a single image containing all of the individual transitions.  Once you have your image sprite you just need the HTML and CSS code:

CSS Code:
a.grnBTN
{
display: block;
width: 200px;
height: 45px;
text-decoration: none;
background: url(“greenBTN.png”);
background-position: 200px;
}

a.grnBTN:hover {
background-position: 0 0;
}

.displace {
position: absolute;
left: -5000px;
}

HTML Code:

<a href="#" class="grnBTN" title="Image Title">
<span class="displace">Alternative Text</span>
</a>

  • The width and height values in a.rollover are the size of the original image.
  • The value of background-position is that of the original image width since we are literally moving from one part of the image sprite to another.
  • The <span> tag was included with a text alternative to the image and displaced it off the side of the visible screen so that screen readers will read it and in the event of no CSS support a text link will be shown instead.

Working Example:

Alternative Text


Aug 5 2009

Installing Eclipse with the Palm WebOSdev SDK

Installing Eclipse and the Plug-Ins

This section describes how to install and update Eclipse.

Note: If you are using an earlier version of Eclipse, you must upgrade to Eclipse 3.4 to get the new plug-ins for Palm webOS development.

To install Eclipse

  1. Download Eclipse 3.4.2, also called Ganymede.
  2. Start Eclipse.
  3. When prompted for a workspace location, accept the default (/home/YOUR_USER_NAME/workspace).Note: The workspace location must be an absolute path with no spaces.

To find and install updates

  1. On the Help menu, select Software Updates and open the Available Software tab.
  2. Click Add Site.
  3. In the Location field, type  https://cdn.downloads.palm.com/sdkdownloads/1.1/eclipse-plugin/eclipse-3.4/site.xml  and click OK.
  4. Open the site in the list, expand the Palm Mojo SDK category and check Palm Mojo SDK.
  5. Click Install and accept the license agreements.
  6. Restart Eclipse when prompted.

Aptana

To improve the development experience, Palm recommends installing the Aptana Studio plugins. Instructions for installing Aptana are available at www.aptana.com as well.

  1. On the Help menu, select Software Updates and open the Available Software tab.
  2. Click Add Site.
  3. In the Location field, type http://update.aptana.com/update/studio/3.4/ and click OK.
  4. Open the site in the list and check Aptana Studio Installer for Eclipse 3.4.
  5. Click Install and accept the license agreements.
  6. Restart Eclipse when prompted.

Using Eclipse with the Plug-Ins

This section describes how to run Eclipse and use the debug launch configuration.

Running Eclipse

  • Mac: In the Eclipse folder (inside the Applications folder), double-click Eclipse.
  • Windows: Find and run eclipse.exe (its location depends on where you installed Eclipse).
  • Linux: At the command line, type: eclipse

Selecting the webOS Perspective

  1. Select Window > Open Perspective… > Other…
  2. Select webOS from the Open Perspective dialog.
  3. Click OK.

Generating a webOS Application

From the New Project menu:

  1. Select File > New Mojo Application.
  2. On the next screen, type a name in the Project Name field.
  3. Enter your application info:
    • Title
    • Vendor
    • ID
    • Version
  4. Click Finish.

From the New App toolbar menu:

  1. In the Eclipse toolbar, click the Mojo Wizard icon and select New App from the drop down menu.
  2. On the New Project Wizard screen, type a name in the Project Name field.
  3. Enter your application info:
    • Title
    • Vendor
    • ID
    • Version
  4. Click Finish.

Adding a scene to your webOS Application

From the New Project Menu:

  1. Select File > New > Mojo Scene.
  2. On the New Mojo Scene Screen, make sure the correct project is selected.
  3. Enter a name for your scene and click Finish.

From the New Scene toolbar menu:

  1. In the eclipse toolbar, click the Mojo Wizard icon and select New Scene from the drop down menu.
  2. On the New Mojo Scene Screen, make sure the correct project is selected.
  3. Enter a name for your scene and click Finish.

Running a webOS Application

  1. Select Run > Run Configurations…
  2. Select Palm Application and click the New Configuration icon to create a new launch configuration.
  3. Change the name.
  4. Select your project from the drop-down list.
  5. Select the Target:
    • Palm Emulator if you are using the emulator.
    • Palm Device if you are using a device (make sure your device is in Developer Mode).
  6. Click Run to install and run the application.

A launch shortcut is also available: In the Projects view, select the project and choose Run > Run As > Mojo Application. If you previously created a launch configuration, that target will be used. Otherwise, a dialog will pop up so you can select a target.

Debugging a webOS Application

  1. Select Run > Debug Configurations…
  2. Select Palm Application and click the New Configuration icon to create a new launch configuration.
  3. Change the name.
  4. Select your project from the drop-down list.
  5. Select the Target:
    • Palm Emulator if you are using the emulator.
    • Palm Device if you are using a device.
    • Under “Debug Options”, choose debugging options as follows:
    • Inspectable: Makes the application’s DOM available to the Palm Inspector. Equivalent to the following command:
      palm-launch -i <appid>
    • Mojo debugging: Enables debug logging in the mojo framework. Equivalent to the following command:
      palm-launch -p "{mojoConfig:true, debuggingEnabled:true}" <appid>
  6. Click Debug to install and run the application.

A launch shortcut is also available: In the Projects view, select the project and choose Run > Debug As > Mojo Application. If you previously created a launch configuration, that target will be used. Otherwise, a dialog will pop up so you can select a target.

Stay Updated

When new Eclipse plugins are available (currently you are notified through email), you can install them through the Eclipse Update Manager.

  1. On the Help menu, select Software Updates and open the Installed Software tab.
  2. Select Palm Development Tools and click Update.
  3. Click Install and accept the license agreements.
  4. Restart Eclipse when prompted.

Enabling Developer Mode

To install and test applications on a webOS device, you’ll need to enable

Developer Mode on the device.

  1. In card view or in the Launcher application, type the following:
  2. upupdowndownleftrightleftrightbastart
    
     
    
  3. Tap the resulting Developer Mode Enabler icon to launch the application.
  4. In the application, move the Developer Mode slider to the On position.
  5. Tap Reset the Device. When reset is complete, Developer Mode is enabled.

Jul 27 2009

ColdFusion Try and Catch

In order for your code to directly handle an exception, the tags in question must appear within a cftry block. It is a good idea to enclose an entire application page in a cftry block. You then follow the cftry block with cfcatch blocks, which respond to potential errors. When an exception occurs within the cftry block, processing is thrown to the cfcatch block for that type of exception.

Here is an outline for using cftry and cfcatch to handle errors:

<cftry>
   Put your application code here ...
   <cfcatch type="exception type1">

      Add exception processing code here ...
   </cfcatch>
   <cfcatch type="exception type2">
      Add exception processing code here ...
   </cfcatch>

   ...
   <cfcatch type="Any">
      Add exception processing code appropriate for all other exceptions
here ...
   </cfcatch>
</cftry>

Jul 17 2009

IE on Ubuntu

Are you a web developer like myself needing to test crossplatform and would really prefer do it all on 1 OS (not Windows) well I have the solution IEs4Linux

Type this in a Linux command terminal:
===================================================================
wget http://www.tatanka.com.br/ies4linux/downloads/ies4linux-latest.tar.gz
tar zxvf ies4linux-latest.tar.gz
cd ies4linux-*
./ies4linux

===================================================================

ie6


May 23 2009

How to prepare an USB device to boot and install Windows 7

Prerequisites:

· Your BIOS must support booting to an USB device, and that functionality has to been enabled

        · An empty 4GB (or greater) USB device, and you’ve removed all other important files from the device. This process will WIPE IT CLEAN. You have been warned.

        · You must be using Windows Vista (or newer) DISKPART

Note: Don’t insert the USB device just yet. I’ll will tell you when.

Open a command prompt as administrator. From the C:> prompt, type:

diskpart

From the DISKPART> prompt, type:

list disk

Make mental note of the disks you have. Then, insert your USB device, and

list disk

again. You should see a new disk with a new number. That’s the number you’ll use in the next command:

select disk x

(x = the number for your USB device)

To make sure that there’s nothing on the USB device that will interfere with our booting; we will wipe out any and all partition information on the device. WARNING! This will wipe the USB device clean! It will delete and destroy any and all data on the device.

From the DISKPART> prompt, type:

clean

Now we want to create our primary partition for booting. From the DISKPART> prompt type:

create partition primary

Now we want to change to that partition and make it an active or bootable partition. From the DISKPART> prompt type:

select partition 1

When that step completes, type:

active

Next we need to format our active partition and assign a drive letter to the boot partition.

From the DISKPART> prompt type:

format fs=fat32 quick

When the format completes, type:

assign

You can now exit DISKPART and close the command prompt.

The USB device is now ready to boot. Next, just copy the files from the ISO (if you’ve mounted it using a tool which does this) or from the Windows 7 DVD onto the USB device.

Click here to download the Word DOCX