Oct 21

By default, ‘crontab -e’ uses vi without syntax highlights or nano.
to make it use vim, execute the following command:

> export EDITOR=/usr/bin/vim
Tagged with:
May 13

Login as root

### Create a folder `installer` ###
mkdir /installer
cd /installer

### Download the installer from apachefriends usin wget ###
wget http://www.apachefriends.org/download.php?xampp-linux-1.6.8a.tar.gz

### Unpack the tar ball to folder `/opt` and install service ###
tar xvfz xampp-linux-1.6.8a.tar.gz -C /opt

lvl=`egrep :initdefault: /etc/inittab|cut -d: -f2`

cd /etc/rc.d/rc${lvl}.d

ln -s /opt/lampp/lampp S99lampp

ln -s /opt/lampp/lampp K01lampp

### Start Server ###
cd /opt/lampp
./lampp start
./lampp status

Tagged with:
Mar 24

Most of the developers nowadays prefer to rewrite URLs for (Search Engine Optimization)SEO. This code is sample on how to strip symbols from a string.

<?php
function urify($str){
  return str_replace(" ","-",trim(ereg_replace("[^A-Za-z0-9[:space:]]", "", $str)));
}
$string = "I really hate symbol on my URL - 12345 What the !£$%^& ~!@#$%^&*()_+=-[]{}";
echo urify($string);
?>

Output is:
I-really-hate-symbol-on-my-URL–12345-What-the

Tagged with:
Mar 19

Google Currency Conversion API

Well, the api is pretty straight forward.
I found it from the Curreny Conversion gadget of iGoogle.

Here is the example:

http://www.google.com/ig/calculator?hl=en&q=1USD%3D%3FPHP

Here is templage in php:

$amount = "1";
$from_Currency = "USD";
$to_Currency = "PHP";

$query_URL = "http://www.google.com/ig/calculator?hl=en&q=$amount$to_Currency.%3D%3F$to_Currency";

The resposnse looks like this:
{lhs: “1 U.S. dollar”,rhs: “45.6704421 Philippine pesos”,error: “”,icc: true}

Not sure if Google is credible to use for conversation, however, if we are just working on simple project, this will be a good help. :-D

Feb 19

If you’re looking for an easy way to extract emails from Craigslist but want to avoid tying up your computer and your connection – http://craigslist.pasukan.com web based will fit your needs perfectly.

Unlike other Craigslist email extractor software that causes Craigslist to blacklist your server or IP address and causes your computer to slow to a crawl, http://craigslist.pasukan.com collects email effortlessly through the web. Enjoy always-on access to the latest, up-to-date emails directly from Craigslist. Target your mailings more precisely by targeting on the exact city and category you want to promote to. Make your message heard by getting only the most recent emails available the email addresses based on the information you supply, so you’re assured of smart results – every time.

Forget dealing with CAPTCHA bypassing and having your account suspended. http://craigslist.pasukan.com works from anywhere to give you all the details you need – right when you need them.

Tagged with:
Feb 04

Dante’s Inferno hid passwords for their website http://hellisnigh.com in the source code of various websites. When you enter them all you get to download a zip file called “earthly_rewards_dantes_inferno.zip”. I’ll let you know what it is once it finishes (46MB and climbing) — the website is really slow right now. You can probably try to download it directly here, let me know if it doesn’t work: http://www.hellisnigh.com/files/earthly_rewards_dantes_inferno.zip

Password 1: excommunicate
Password 2: scythe
Password 3: grafter
Password 4: styx
Password 5: unbaptized
Password 6: alighieri

Password 1 is found in the source of http://digg.com, 2 on http://dailymotion.com, 3 on http://gamespot.com, 4 on http://ign.com, 5 on http://gamesradar.com, 6 on http://wwe.com

Tagged with:
Jan 22

I use Hostgator as my hosting company. I love them – great service, tons of space and no long term obligations. And the servers are fast. Now, another reason to love them – running Subversion repositories on your server with the caveat – you can only have one account to account to access that repository. If you develop by yourself, and I do for now, it’s not a problem. So how do you do it – assuming you are a Java coder using Eclipse on Windows?

1. Send Hostgator support a request to get SSH access to your server. They will ask you to send in a picture id and once that is cleared, you should be good to go. A matter of a day or two.

2. Install Subclipse SVN plugin for Eclipse. The Subversive plugin DOES NOT WORK.

3. Install the really good Tortoise SVN client

4. Set up an environment variable called SVN_SSH. To do that, go to the Windows Control Panel -> System -> Advanced -> Environment Variable -> New (under the bottom Window). For variable name enter the value SVN_SSH and for its value enter c:\\Program Files\\TortoiseSVN\\bin\\TortoisePlink.exe (assuming you installed Tortoise SVN in the default location).

5. Start Eclipse and go to the Subclipse options: Window -> Preferences -> Team -> SVN . There, for the SVN Interface select “SVNKit (Pure Java)”. Click OK to store the setting.

6. Now, using Putty or some other SSH tool, SSH to your account. You will need to set up a repository for your project. To do that, create the directory that will be used as repository, say /myrepo. Now, create an Subversion repository inside that directory: svnadmin create myrepo.

7. Create a new project by checking out the repository from SVN. To do that, in Eclipse, go to: File -> New -> Other -> SVN -> Checkout Project From SVN.

8. The ‘Checkout from SVN’ window will appear. There select to create a new repository location

9. For the URL, enter: svn+ssh://@:2222/home//. In other words, if your domain is example.com, your admin user name is joey and the path to your repository is /myrepo, then your URL will be svn+ssh://joey@example.com:2222/home/joey/myrepo

10. Another popup window will follow that will ask you for your SSH user name. Enter the details and make sure they are saved.

11. You should be good to go at that point as the rest of the process is the normal project checkout scheme used by Subclipse.

Tagged with:
Oct 22

To install yum in fedora just do these commands

1. Change directory

$ cd ~

2. Create directory called ‘yum’

$ mkdir yum

3. go into the yum directory you just created:

$ cd yum

4. download yum:

$ wget http://linux.duke.edu/projects/yum/download/2.0/yum-2.0.7.tar.gz

5. untar the file you just downloaded it:

$ tar -xvzf yum-2.0.7.tar.gz

6. go to the yum directory:

$ cd yum-2.0.7

7. run the configuration file:

$ ./configure

8. make the configuration:

$ make

9. Make install

$ make install

10. Now, its time to update your repository

$ yum update
Tagged with:
Oct 15

Lot of pagination class are available online, and we also created our own. With this class, you can set the number links that will be shown, number of entries per page, and you can also show the last and first page using a cool style.


## Populate data
foreach (range(1, 100) as $value) {
  $rs[] = array("property_id" => rand(100, 1000),
			    "title" => "Hello ".$value
			  );
}

$pagination = new paginationArray();
$pagination->getURL="myPage";
$pagination->numLinks=5;
$pagination->showFirstAndLast=true;
?>
<div stye="float:left;width:500px;">&nbsp;</div><div>
	<?php
	if (count($rs) > 0) {
	  $recordPages = $pagination->generate($rs, 5);
	  if (count($recordPages) != 0) {
	  	echo "<div style='margin-left:350px;'>";
	    foreach ($recordPages as $recordArray) {
	      echo '<p><b>'.$recordArray['property_id'].'</b> &nbsp; : '.$recordArray['title'].'</p>';
	    }
	    echo "</div>";
	    echo "<div><div style='float:left;width:350px;'>&nbsp;</div>".$pagination->links()."</div>";
	  }
	}
	?>
</div>

Download CSS: paginate CSS

Download Class:PaginationClassArray

sample paginate

sample paginate

test paginate class

test paginate class

Tagged with:
Sep 16

We’ve discussed sending both HTML and text mail from our previous post. But there are useful libraries out there to make all our coding easier like PHPmailer and Swiftmailer.

This is an example on how to send multi-part message in swiftmailer.

<?php
// include Swiftmailer Library
require_once("phplib/swiftmailer/lib/Swift.php");
require_once("phplib/swiftmailer/lib/Swift/Connection/SMTP.php");
require_once("phplib/swiftmailer/lib/Swift/Plugin/Decorator.php");  // optional, its a plugin

//define your mail server values
define("MAIL_HOST", "mail.bauson.com");
define("MAIL_USERNAME", "mailer+bauson.com");
define("MAIL_PASSWORD", "bauson.pass");

//instantiate the connection
$smtp = new Swift_Connection_SMTP(MAIL_HOST);
$smtp->setUsername(MAIL_USERNAME);
$smtp->setpassword(MAIL_PASSWORD);
$swift = new Swift($smtp);
$recipients =& new Swift_RecipientList();

// set recipients
$recipients->addTo("jbauson@gmail.com", "my gmail"); //We can give a name along with the address
$recipients->addTo("jbauson@yahoo.com"); //or we can just add the address
$recipients->addTo("jayar@bauson.com", "my private");

//formatting mail
$message =& new Swift_Message("My subject");
$message->setReplyTo(new Swift_Address("dummy@bauson.com", "Fake reply to"));
$message->attach(new Swift_Message_Part("My plain part")); // Plain text version
$message->attach(new Swift_Message_Part("<b>My HTML part</b><hr><tt>hello html</tt>", "text/html")); // HTML version

//The number of successful recipients is returned here (hopefully 3!)
$number_sent = $swift->batchsend($message, $recipients, new Swift_Address("mailer@bauson.com", "BUlk Mailer"));
?>
Tagged with:
preload preload preload
Bless CV