While creating a table a particular column / field can be made autoincrement as :
CREATE TABLE students
(
id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1),
name VARCHAR(24) NOT NULL,
address VARCHAR(1024),
CONSTRAINT primary_key PRIMARY KEY (id)
) ;
Read the rest of this entry »
Popularity: 20% [?]
July 6th, 2009 | Posted in Uncategorized | No Comments
To go back to the previous page the superglobal variable $_SERVER can be used.
$_SERVER['HTTP_REFERER'] has the link to the previous page.
So to redirect simply :
#Method to go to previous page
function goback()
{
header("Location: {$_SERVER['HTTP_REFERER']}");
exit;
}
Read the rest of this entry »
Popularity: 5% [?]
July 1st, 2009 | Posted in Uncategorized | No Comments
The numerical system used in India differs from the Western system in terms of the placement of the thousands separator.
Example :
Number -> 1000000
Indian System -> 10,00,000 (Ten Lakh)
Western System -> 1,000,000 (1 Million)
Read the rest of this entry »
Popularity: 3% [?]
July 1st, 2009 | Posted in PHP | No Comments
Opening a domain as domain.com or www.domain.com takes to the same page. From the SEO perspective , many suggest that search engines may consider the two to be different sites. So the fix is to apply a redirection to redirect domain.com to www.domain.com
Read the rest of this entry »
Popularity: 2% [?]
July 1st, 2009 | Posted in apache | No Comments
bit.ly is a simple url shortner which has an api , which can be called from within php to shorten links.
Code :
function get_short_url($url)
{
$bitly_login = "your_login_name";
$bitly_apikey = "your_api_key";
$api_call = file_get_contents("http://api.bit.ly/shorten?version=2.0.1&longUrl=".$url."&login=".$bitly_login."&apiKey=".$bitly_apikey);
$bitlyinfo=json_decode(utf8_encode($api_call),true);
if ($bitlyinfo['errorCode'] == 0)
{
return $bitlyinfo['results'][urldecode($url)]['shortUrl'];
}
else
{
return false;
}
}
Read the rest of this entry »
Popularity: 2% [?]
June 30th, 2009 | Posted in PHP | No Comments
To create a .deb package file on Ubuntu you need a utility called checkinstall.
sudo apt-get install checkinstall
1. Extract the source of the application in a folder.
2. Run : ./configure
3. Run : make
4. Now run : sudo checkinstall
Read the rest of this entry »
Popularity: 3% [?]
June 27th, 2009 | Posted in Linux, Ubuntu | No Comments
Here is the simple code to put flash animation (swf file) on a webpage.
<object width="550" height="350" data="myalbum.swf" type="application/x-shockwave-flash">
<param name="quality" value="high" />
<param name="id" value="tech" />
<param name="name" value="tech" />
<param name="src" value="myalbum.swf" />
</object>
Popularity: 8% [?]
June 15th, 2009 | Posted in Uncategorized | No Comments
Ubuntu 9.04 did not detect the native resolution of my new LCD monitor which was 1440 x 900.
Fix :
1. Get the modeline for the required resolution + refresh rate using the gtf command.
desktop:~$ gtf 1440 900 75
Read the rest of this entry »
Popularity: 24% [?]
June 8th, 2009 | Posted in Linux, Ubuntu | No Comments
Plootr is a useful library based on mootools 1.11 which can be used to plot bar graphs , line graphs and pie charts.
It is similar to Plotkit which is based on Mochikit javascript framework.
Read the rest of this entry »
Popularity: 13% [?]
June 7th, 2009 | Posted in Uncategorized | No Comments
The structure of IP Header as given by RFC 791 is :
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|Version| IHL |Type of Service| Total Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Identification |Flags| Fragment Offset |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Time to Live | Protocol | Header Checksum |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Source Address |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Destination Address |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Options | Padding |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Read the rest of this entry »
Popularity: 5% [?]
May 6th, 2009 | Posted in C | No Comments