Wednesday, July 29, 2009

Using PHP from the Command Line (Terminal) in Linux with a xampp install

This is for those who are using the xampp server. If you are using the Generic Linux apache and PHP packages, use you package manager to download php-cli .

If you are using xampp, you already have the php-cli library. In the terminal, type:

/opt/lampp/bin/php {input file} {arguments}

Done! If you don't like using /opt/lampp/bin/php every time, you can set php as an environment variable for /opt/lampp/bin/php.

To do this, go to terminal and type:

php=/opt/lampp/bin/php
export php

if you are using Bash Shell (the default one in Ubuntu), you can use this shortcut:

export php=/opt/lampp/bin/php


and reboot.

now you can use

php {input file} {arguments}

Dual Booting Ubuntu Linux in Windows

It will not be wrong to say that installing Ubuntu in Windows is the easiest thing to do for anybody. All you need is Windows already installed, a CD of Ubuntu (which you can order or download from ubuntu.com) and I recommend atleast 12 GB of free space, How do we do it?

  • Boot into Windows.
  • Insert the Ubuntu CD. On autoplay, you will be given three options, select "Install inside Windows".
  • Select the appropriate drive. For installation size, go for the maximum that your free space allows.
  • Set the username and password and hit Enter.
  • Installation takes 6-7 minutes and asks you to reboot.
  • Reboot and there you go, select Ubuntu in the choice of OS that you get.

Wednesday, July 15, 2009

Drupal - Hiding post information in Acquia Marina

You decided that you don't want the author and date to be displayed below some particular node types but don't know what to do. Th standard way is this:

  • Go to Themes on your Admin page
  • Click on Configure on the top of the page
  • On the right, you have a column 'Display post information on' , uncheck the content types you don't want the post info to be displayed on and click Save Configuration.
Most probably this will remove the post information, but there are chances that it doesn't. This is because what you just changed were Global Settings and you might be using your theme's custom settings. this is specially the case in Acquia themes which are highly configurable. In this case:
  • Go to Themes on your Admin page
  • Click on Configure next to the theme you are using
  • Navigate through the fieldsets like this Theme-specific settings >> Node settings >> Author & date >> Default
  • Uncheck the Check Boxes as required and Save Configuration. This will disable Author and Date from all content types.
  • Now to make the change for select content types, navigate to the same place and you will find a CheckBox labeled "Use custom settings for each content type instead of the default above". check it and select your Custom Settings from the following Fieldsets.

Tuesday, July 14, 2009

Daemon tool pro error : -1

I just repaired my Windows XP, hoping that all minor errors will be gone but, when I opened the Daemon Tools panel all my virtual drives were gone. I tried creating one and got the error:
Daemon tool pro error : -1

Soon i was Googling to find a solution to the problem. I found none but figured out the problem. When you repair Windows, it rolls back all the drivers installed to the default ones and that is what caused the problem. to resolve, follow these steps:

  • Right click My Computer
  • Select Properties
  • Select the Hardware tab
  • Click on Device Manager
  • Look for SCSI and RAID controllers - It will already be expanded and there will be a cross on its icon (not visible in image) which indicates that its not functioning.
  • Right Click on ANNxxxxx IDE controller and select Update Driver
  • Update using default options.

I you cannot see the SCSI and RAID controllers option in you Device manager, you need to reinstall Daemon Tools.

Saturday, July 4, 2009

Linux (DSL) and GCC on Windows using VirtualBox

If you need GCC and cannot leave Windows this method is the most viable, in terms of both memory and time.
First, you need to download three things:
Install VirtualBox like any other application.

Now you have to install dsl on a virtual Hard Disk on VB (virtualbox).

This is the method that I used (source: http://blogs.sun.com/AngeloJ/entry/virtualbox_and_dsl_damn_small )

(1) Create a New VM

Click the "new" icon and follow all the defaults ( note: I did not change any of the default settings the first time around )

(2) Boot from the DSL ISO image

Click on the "CD/DVD-ROM" on the "Details" tab

Click on the ISO radion button, then select the dsl *.iso file you just downloaded

(3) Boot the DSL VM from the ISO

Click the "Start" icon

... after a few boot screens you should have a working desktop

(4) Install to Hard Drive

This is the only tedious step, since you have to create your hard drive, virtually....

click the terminal icon on the bottom left of the screen in the panel

- type "sudo -s"
- type "cfdisk"
- Select "Y" when asked Do you wish to start with a zero table
- You will now see your cfdisk applicaton. Use the arrow keys and select "NEW"
-
Select "Primary" then select the size (by default it should be 2GB, but VirtualBox will grow this on-demand )
- Select "Bootable" (you see the word "Boot" under the Flags coloumn)
- Select "Write"
- When prompted with a (Y/N) type "YES" and hit enter.
- Select "QUIT"
-
now back at the command prompt type "mkfs /dev/hda1"
- now type "dsl-hdinstall"
- you will be prompted for the target drive type "hda1" and press enter
- Select "Y" for multiuser logins
- Select "Y" for ext3 filesystwm
- Select "Y" to continue.
- Select "Y" when asked "Proceed to install a boot loader"
- Type "g" for GRUB
- Type "Y" when prompted for reboot
- You will see DSL shut down and press "Enter" when prompted
-
Important: At the VirtualBox boot screen, click "Machine->Pause" from the Menu
- Click "Devices->Unmount CD/DVD-ROM" from the Menu
-
Click "Machine->Resume" from the Menu, and continue booting from the Hard Drive
- You should be prompted to enter a password for the "root" user and the "dsl" user.
- If it starts and you see your DSL desktop you have succesfully intalled DSL to your Hard Drive!


Installing GCC on DSL

Run the web browser inside dsl and download gcc from http://mirror.internode.on.net/pub/damnsmalllinux/mydsl/system/gcc1-with-libs.dsl

Go to the terminal and run this command

sudo mydsl-load gcc1-with-libs.dsl


There you go.

Alternatively, download GCC in Windows and transfer to dsl using a pendrive and run the same command.