Thursday, February 24, 2011
Get the details of the extensions loaded
print_r(get_loaded_extensions());
Wednesday, February 23, 2011
Broadcom Wireless Setup for Ubuntu 8.04
I used the following steps to enable my Broadcom Wireless
Step 1 (run in terminal)
echo 'blacklist bcm43xx' | sudo tee -a /etc/modprobe.d/blacklist
sudo apt-get install ndiswrapper-utils-1.9
mkdir ~/bcm43xx; cd ~/bcm43xx
For Step 2, You can check your Broadcom wireless version with this command in terminal : "lspci | grep Broadcom\ Corporation",if your wireless device is different from BCM4312 (rev 02), please refer to the following link for this step and you can continue again with step 3 onwards:
https://help.ubuntu.com/community/Wi...f971ca757b2851
Step 2 (run in terminal)
sudo apt-get install cabextract
wget ftp://ftp.compaq.com/pub/softpaq/sp3...00/sp34152.exe
cabextract sp34152.exe
Step 3 (run in terminal)
sudo ndiswrapper -i bcmwl5.inf
ndiswrapper -l
sudo depmod -a
sudo modprobe ndiswrapper
sudo cp /etc/network/interfaces /etc/network/interfaces.orig
echo -e 'auto lo\niface lo inet loopback\n' | sudo tee /etc/network/interfaces
sudo ndiswrapper -m
echo 'ndiswrapper' | sudo tee -a /etc/modules
echo 'ENABLED=0' | sudo tee -a /etc/default/wpasupplicant
Step 4 (run in terminal)
sudo aptitude remove b43-fwcutter
Step 5 (run in terminal)
sudo gedit /etc/init.d/wirelessfix.sh
Step 6
Paste the followings in the opened file(wirelessfix.sh)and make sure you save it before continuing Step 7
#!/bin/bash
modprobe -r b44
modprobe -r b43
modprobe -r b43legacy
modprobe -r ssb
modprobe -r ndiswrapper
modprobe ndiswrapper
modprobe b44
Step 7 (run in terminal)
Run this :
cd /etc/init.d/ && sudo chmod 755 wirelessfix.sh
Step 8 (run in terminal)
finally run this:
sudo update-rc.d wirelessfix.sh defaults
Step 9
Restart your machine and enjoy the freedom from those wires....
Step 1 (run in terminal)
echo 'blacklist bcm43xx' | sudo tee -a /etc/modprobe.d/blacklist
sudo apt-get install ndiswrapper-utils-1.9
mkdir ~/bcm43xx; cd ~/bcm43xx
For Step 2, You can check your Broadcom wireless version with this command in terminal : "lspci | grep Broadcom\ Corporation",if your wireless device is different from BCM4312 (rev 02), please refer to the following link for this step and you can continue again with step 3 onwards:
https://help.ubuntu.com/community/Wi...f971ca757b2851
Step 2 (run in terminal)
sudo apt-get install cabextract
wget ftp://ftp.compaq.com/pub/softpaq/sp3...00/sp34152.exe
cabextract sp34152.exe
Step 3 (run in terminal)
sudo ndiswrapper -i bcmwl5.inf
ndiswrapper -l
sudo depmod -a
sudo modprobe ndiswrapper
sudo cp /etc/network/interfaces /etc/network/interfaces.orig
echo -e 'auto lo\niface lo inet loopback\n' | sudo tee /etc/network/interfaces
sudo ndiswrapper -m
echo 'ndiswrapper' | sudo tee -a /etc/modules
echo 'ENABLED=0' | sudo tee -a /etc/default/wpasupplicant
Step 4 (run in terminal)
sudo aptitude remove b43-fwcutter
Step 5 (run in terminal)
sudo gedit /etc/init.d/wirelessfix.sh
Step 6
Paste the followings in the opened file(wirelessfix.sh)and make sure you save it before continuing Step 7
#!/bin/bash
modprobe -r b44
modprobe -r b43
modprobe -r b43legacy
modprobe -r ssb
modprobe -r ndiswrapper
modprobe ndiswrapper
modprobe b44
Step 7 (run in terminal)
Run this :
cd /etc/init.d/ && sudo chmod 755 wirelessfix.sh
Step 8 (run in terminal)
finally run this:
sudo update-rc.d wirelessfix.sh defaults
Step 9
Restart your machine and enjoy the freedom from those wires....
Friday, February 18, 2011
phpMyAdmin: No activity within 1440 seconds; please log in again
phpMyAdmin’s “No activity within 1440 seconds; please log in again” message is slowly but definitely driving you crazy. How to remain sane?
Solution
Increase the time limit. Open the file /etc/phpmyadmin/config.inc.php and add the following line to its end:
$cfg['LoginCookieValidity'] = 60 * 60 * 8; // in seconds (8 hours)
Here I set 8 hours, but you can change that.
When you log in again in phpMyAdmin, this new value will be taken into account.
Please make sure that gc_maxlifetime in php.ini is set greater than the given value
Solution
Increase the time limit. Open the file /etc/phpmyadmin/config.inc.php and add the following line to its end:
$cfg['LoginCookieValidity'] = 60 * 60 * 8; // in seconds (8 hours)
Here I set 8 hours, but you can change that.
When you log in again in phpMyAdmin, this new value will be taken into account.
Please make sure that gc_maxlifetime in php.ini is set greater than the given value
Thursday, February 10, 2011
Time Difference
We can find the days, hours, minutes, year difference
SELECT TIMESTAMPDIFF( HOUR , '2011-02-10 11:14:36' , NOW( )) ;
Also this,
SELECT TIMEDIFF( NOW( ) , '2011-02-10 14:06:36' ) ;
There is also a way to add values to date using
SELECT TIMESTAMPADD( HOUR , '2011-02-10 11:14:36' , NOW( )) ;
SELECT TIMESTAMPDIFF( HOUR , '2011-02-10 11:14:36' , NOW( )) ;
Also this,
SELECT TIMEDIFF( NOW( ) , '2011-02-10 14:06:36' ) ;
There is also a way to add values to date using
SELECT TIMESTAMPADD( HOUR , '2011-02-10 11:14:36' , NOW( )) ;
Wednesday, February 9, 2011
Fix : Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName
Many of us face the same following error we restarting the Apache server on Ubuntu.
sudo /etc/init.d/apache2 restart
* Restarting web server apache2 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
To fix that problem, you need to edit the httpd.conf file. Open the terminal and type
sudo gedit /etc/apache2/httpd.conf
By default httpd.conf file will be blank. Now, simply add the following line to the file
ServerName localhost
Save the file and exit from gEdit.
Finally restart the server.
sudo /etc/init.d/apache2 restart
sudo /etc/init.d/apache2 restart
* Restarting web server apache2 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
To fix that problem, you need to edit the httpd.conf file. Open the terminal and type
sudo gedit /etc/apache2/httpd.conf
By default httpd.conf file will be blank. Now, simply add the following line to the file
ServerName localhost
Save the file and exit from gEdit.
Finally restart the server.
sudo /etc/init.d/apache2 restart
Friday, February 4, 2011
xml output using DOM
//http://codeigniter.com/wiki/Amfphp_and_CI/
$dom=new DomDocument("1.0",'utf-8');
$themes = $dom->createElement('zoggin');
$dom->appendChild($themes);
$theme = $dom->createElement('theme');
$themes->appendChild($theme);
//blog template Id
$template = $dom->createAttribute('themeId');
$theme->appendChild($template);
$idValue = $dom->createTextNode($themeId);
$template->appendChild($idValue);
//height of image snapshot
$imageHeight = $dom->createAttribute('height');
$theme->appendChild($imageHeight);
$heightValue = $dom->createTextNode($height);
$imageHeight->appendChild($heightValue);
//width of image snapshot
$imageWidth = $dom->createAttribute('width');
$theme->appendChild($imageWidth);
$widthValue = $dom->createTextNode($width);
$imageWidth->appendChild($widthValue);
//open Path
$path = $dom->createAttribute('path');
$theme->appendChild($path);
$pathValue = $dom->createTextNode($openPath);
$path->appendChild($pathValue);
$dom->formatOutput = true;
header("content-Type: text/xml");
$service = $dom->saveXML();
//Image Snapshot
/*$snapshot = $dom->createAttribute('snapshot');
$theme->appendChild($snapshot);
$snapValue = $dom->createTextNode($snapShot);
$snapshot->appendChild($snapValue);*/
//thumbnail Path
$path = $dom->createAttribute('thumbnailPath');
$theme->appendChild($path);
$pathValue = $dom->createTextNode($imagePath);
$path->appendChild($pathValue);
$dom->formatOutput = true;
header("content-Type: text/xml");
$service = $dom->saveXML();
echo $service;
?>
$dom=new DomDocument("1.0",'utf-8');
$themes = $dom->createElement('zoggin');
$dom->appendChild($themes);
$theme = $dom->createElement('theme');
$themes->appendChild($theme);
//blog template Id
$template = $dom->createAttribute('themeId');
$theme->appendChild($template);
$idValue = $dom->createTextNode($themeId);
$template->appendChild($idValue);
//height of image snapshot
$imageHeight = $dom->createAttribute('height');
$theme->appendChild($imageHeight);
$heightValue = $dom->createTextNode($height);
$imageHeight->appendChild($heightValue);
//width of image snapshot
$imageWidth = $dom->createAttribute('width');
$theme->appendChild($imageWidth);
$widthValue = $dom->createTextNode($width);
$imageWidth->appendChild($widthValue);
//open Path
$path = $dom->createAttribute('path');
$theme->appendChild($path);
$pathValue = $dom->createTextNode($openPath);
$path->appendChild($pathValue);
$dom->formatOutput = true;
header("content-Type: text/xml");
$service = $dom->saveXML();
//Image Snapshot
/*$snapshot = $dom->createAttribute('snapshot');
$theme->appendChild($snapshot);
$snapValue = $dom->createTextNode($snapShot);
$snapshot->appendChild($snapValue);*/
//thumbnail Path
$path = $dom->createAttribute('thumbnailPath');
$theme->appendChild($path);
$pathValue = $dom->createTextNode($imagePath);
$path->appendChild($pathValue);
$dom->formatOutput = true;
header("content-Type: text/xml");
$service = $dom->saveXML();
echo $service;
?>
creating json or xml based services
/* require the user as the parameter */
if(isset($_GET['user']) && intval($_GET['user'])) {
/* soak in the passed variable or set our own */
$number_of_posts = isset($_GET['num']) ? intval($_GET['num']) : 10; //10 is the default
$format = strtolower($_GET['format']) == 'json' ? 'json' : 'xml'; //xml is the default
$user_id = intval($_GET['user']); //no default
/* connect to the db */
$link = mysql_connect('localhost','username','password') or die('Cannot connect to the DB');
mysql_select_db('db_name',$link) or die('Cannot select the DB');
/* grab the posts from the db */
$query = "SELECT post_title, guid FROM wp_posts WHERE post_author = $user_id AND post_status = 'publish' ORDER BY ID DESC LIMIT $number_of_posts";
$result = mysql_query($query,$link) or die('Errant query: '.$query);
/* create one master array of the records */
$posts = array();
if(mysql_num_rows($result)) {
while($post = mysql_fetch_assoc($result)) {
$posts[] = array('post'=>$post);
}
}
/* output in necessary format */
if($format == 'json') {
header('Content-type: application/json');
echo json_encode(array('posts'=>$posts));
}
else {
header('Content-type: text/xml');
echo '';
foreach($posts as $index => $post) {
if(is_array($post)) {
foreach($post as $key => $value) {
echo '<',$key,'>';
if(is_array($value)) {
foreach($value as $tag => $val) {
echo '<',$tag,'>',htmlentities($val),'',$tag,'>';
}
}
echo '',$key,'>';
}
}
}
echo ' ';
}
/* disconnect from the db */
@mysql_close($link);
}
if(isset($_GET['user']) && intval($_GET['user'])) {
/* soak in the passed variable or set our own */
$number_of_posts = isset($_GET['num']) ? intval($_GET['num']) : 10; //10 is the default
$format = strtolower($_GET['format']) == 'json' ? 'json' : 'xml'; //xml is the default
$user_id = intval($_GET['user']); //no default
/* connect to the db */
$link = mysql_connect('localhost','username','password') or die('Cannot connect to the DB');
mysql_select_db('db_name',$link) or die('Cannot select the DB');
/* grab the posts from the db */
$query = "SELECT post_title, guid FROM wp_posts WHERE post_author = $user_id AND post_status = 'publish' ORDER BY ID DESC LIMIT $number_of_posts";
$result = mysql_query($query,$link) or die('Errant query: '.$query);
/* create one master array of the records */
$posts = array();
if(mysql_num_rows($result)) {
while($post = mysql_fetch_assoc($result)) {
$posts[] = array('post'=>$post);
}
}
/* output in necessary format */
if($format == 'json') {
header('Content-type: application/json');
echo json_encode(array('posts'=>$posts));
}
else {
header('Content-type: text/xml');
echo '
foreach($posts as $index => $post) {
if(is_array($post)) {
foreach($post as $key => $value) {
echo '<',$key,'>';
if(is_array($value)) {
foreach($value as $tag => $val) {
echo '<',$tag,'>',htmlentities($val),'',$tag,'>';
}
}
echo '',$key,'>';
}
}
}
echo '
}
/* disconnect from the db */
@mysql_close($link);
}
Subscribe to:
Comments (Atom)