Monday, May 26, 2008

Running Windows XP in Ubuntu using Virtual Box

Today I have Installed Virtual Box in my Ubuntu 7.10. It has two advantages:
1) I can now run Windows Xp without rebooting the system.
2) Can run some windows applications that seems necessary.
For example, while checking cross browser compatibility of web pages with different browser it reduces a lot of pain.
Running ASP.NET here from Ubuntu !


Installation:


I have followed the exact instruction given in http://taufanlubis.wordpress.com/2008/03/24/virtual-box-in-ubuntu-%E2%80%93-install-windows-xp/
It is an excellent tutorial for installing Windows Xp in Ubuntu Box

Sharing Folders:


Here I am describing how to share/access a file or folder of Ubuntu in Virtual Machin (XP).

1) before running the Virtual machine(XP in this case) select your virtual drive and click ‘Settings‘ and then goto to ‘Shared Folders' and add a folder from your Ubuntu. For example if you want to get access of your /home/user_name/Download/WinProgram directory, just add this folder in shared folders. This will give your folder a name (usually 'WinProgram').
2) Start your VM, wait for XP to be fully loaded
3) The newly loaded window( Windows Xp) has a top menu 'devices'. From here install the Virtual Box Guest Additions. You may need to download the .iso in this case
3) Now from Windows command prompt run the following command net use x: \\vboxsrv\WinProgram. This will create a drive x in windows and will mount the shared folder named WinProgram of Virtual box in Xp.
In this way you can access as much directories of Ubuntu as you need from XP.

Installing Program for XP:


Yet to come...

Thursday, April 03, 2008

Putting css, js, image in CodeIgniter

I have the structure like :
+system
- application
- resources
+ css
- image
+ test.jpg
- javascript
+ test.js

+index.php

Now in
========config.php=======

$config['resource_url'] = 'system/application/resources/'; // relative to base_url
// all the resource related folder will be kept in resource folder
$config['image_folder'] = 'image';
$config['js_folder'] = 'javascript';
$config['css_folder'] = 'css';

==============
helper/my_helper.php ==============

config -> item('base_url'). $CI -> config -> item('resource_url');
$img_folder = $CI -> config -> item('image_folder') . '/';
$js_folder = $CI -> config -> item('js_folder') . '/';
$css_folder = $CI -> config -> item('css_folder') . '/';

switch ($resrcType) {
case 'css':
case 'CSS':
return $resource_url . $css_folder. $resrcName;
case 'js':
case 'JS':
case 'javascript':
case 'Javascript':
return $resource_url . $js_folder. $resrcName;
case 'image':
case 'Image':
case 'img':
case 'Img':
return $resource_url . $img_folder. $resrcName;
}
}
}

if (! function_exists('base_tag'))
{
// the url is a relative url w.r.to base_url
// if url != empty then make sure ist has trailing slash
function base_tag($url = '') {
$CI =& get_instance();
return '<base href=""> config -> item('base_url').$url. '" /><xmp>';<br> }<br>}<br><br>?><br><br>================ </b>viewpage.php ===============<br><xmp><br><b><?php echo base_tag(); ?><br><script type="text/javascript" src="">" /><br><br>Click <a href="javascript:luck();">here dude</a><br><br>Here is my logo <img src="" />" alt="ci_logo" /><br>










Sunday, January 06, 2008

Case sensitivity of MySQL

Whenever I develop projects with MySQL I don't get errors with my code in localhost(in windows XP - MySQL 5.1 ) But get errors in hosting server (MySQL 4.1.22) when I upload files. After some researching I get the following information from the online manual of MySQL - "The case sensitivity of the underlying operating system plays a part in the case sensitivity of database and table names. This means database and table names are not case sensitive in Windows, and case sensitive in most varieties of Unix."

So best way to use same case while developing . Instead of using 'myTable' we may use 'mytable' or 'my_table'. (I prefer 2nd one). Thus code will be portable for any operating system. For more details follow the link below :

http://dev.mysql.com/doc/refman/5.1/en/identifier-case-sensitivity.html


Saturday, January 05, 2008

My favourite Firefox add-ons and extenstions

Browsing Purpose:
1) Adblock Plus - Blocks unsafe contents of a site while browsing
2) NoScript - Prevent unsafe script execution
3) Cooliris - Preview page without loading the page
and may also have
4) ScribeFire - Helpful for blogger writer.

Web Development:
1) Firebug
2) HTML validator
3) Web Developer
4) YSlow
and may also have
5) FirePHP
6) FireFTP

Create different profile in Firefox

Firefox has many extensions and add-on which are very much helpful for web development. But browsing and developing in the same browser will slow down Firefox. Because for web developing we need to install many extensions which are actually not necessary for browsing and again for safe browsing we may need some add-on and extensions which are not required for web development. So my suggestion is to create different profile - one for browsing(default profile) and another for web development(let it's name WebDev). Here I am describing steps to create new profile for Firefox.

Windows XP:
1) From the start menu Run -> firefox -ProfileManager. As with parameter ProfileManager a new window will appear.
2) click 'Create Profile' and following the instruction enter a name for the new profile. Let it's name 'WebDev'. And click finish button to successfully create the profile. The newly created profile will be saved in 'C:\Documents and Settings\[username]\Application Data\Mozilla\Firefox\Profiles\'
3) But now you can not run both profile (default, WebDev) in different Firefox instance. To make sure you can run Firefox with different profile in different ff browser we need to create two shortcuts of Firefox for two profiles. Now right click on shortcut for 'default' profile and edit the target from "C:\Program Files\Mozilla Firefox\firefox.exe" to "C:\Program Files\Mozilla Firefox\firefox.exe" -no-remote -P default.
Similarly for WebDev profile edit the target from "C:\Program Files\Mozilla Firefox\firefox.exe" to
"C:\Program Files\Mozilla Firefox\firefox.exe" -no-remote -P WebDev.

Now click on both shortcut and enjoy Firefox with different settings, add-ons, extensions.

Linux:
Yet to come....


Speed up Firefox

We can change our default firefox settings and thus speed up the performance.
Type “about:config” into the address bar and hit return and edit the following entries :

1) Set “network.http.pipelining” to “true”.
2) Set “network.http.proxy.pipelining” to “true”.
Normally the browser will make one request to a web page at a time.
When you enable pipelining it will make several at once, which really
speeds up page loading.
3) Set “network.http.pipelining.maxrequests” to some number like 30. This means it will make 30 requests at once.
4) right-click anywhere and select New-> Integer. Name it “nglayout.initialpaint.delay” and set its
value to “0″. This value is the amount of time the browser waits before
it acts on information it receives.
5) right-click anywhere and select New->Boolean. Name it “ content.interrupt.parsing” and set its
value to “true″. This preference controls whether the application will interrupt parsing
a page to respond to UI events. It does not exist by default.
6) and many more ..... see the following links for more details.

http://howto.helpero.com/howto/Speed-Up-Firefox_31.html
http://www.tweakfactor.com/articles/tweaks/firefoxtweak/4.html