MongoDB (Sorta Quickstart Guide)

There has been a lot of traction in general about the entire NoSQL movement. You’ll hear a lot about Cassandra, MapReduce (MapR), and MongoDB when it comes to this realm. At work I’ve been tasked and have had the pleasure of playing with MongoDB. Today, I spent most of the time playing with it, mainly tried to get it up and running.

I was having trouble at the beginning trying to get everything. It was mainly due to some server configuration ignorance on my end but now it’s up and running. The server I have it on is our dev server. Currently, the server is running a Centos 6, PHP and now Mongo locally. Mind you, this is purely for development purposes.

I’d like to share some information for those of you starting MongoDB to help save you some time. Read this blog post to get yourself up and running. Make a /data/db directory and the command below gets Mongo daemon running:

 [code lang="lang"]
$ mongod --bind_ip <IP ADDR> --rest --fork --logpath /var/log/mongodb.log --logappend
[/code]

Cast Iron Grill Pan

I seriously miss being able to BBQ. I remember I could just go out on my deck and throw some steaks or chicken on the grill. Living in the city and having to downsize a lot of our things, most of important of them all is my kitchen. My kitchen was small back in LA but now it’s even smaller. I use my kitchen table and oven as storage areas. Anyhoo, I bought a grill pan to offset not having a BBQ grill. I know it’s not the same it’s just going to have to do.

SWTOR

I am officially addicted to this game. The gameplay brings me back to all the RPGs I’ve played early on and loved. It’s nice to finally see a game contend against WoW. At level 17 I was given a space ship in the game for travel and SPACE COMBAT. MOTHER EFFING SPACE COMBAT!

Bulk Script for Store Locator

Currently, I am working on a website for a client who purchased a zip code locator for their website. The product itself did not come with functionality to bulk import stores from a CSV file so I had to do it myself. After using the MySQL load functionality I noticed that the app didn’t return any stores without longitude and latitude. I was looking through their functions and something was off. It wouldn’t let me do it. I contacted the vendor and they responded with “We could do it for more money.” PFFFT! Fark that!

So below is the script I used to grab the longitude and latitude from the Google Maps API and plop it back into the app’s table. After I ran this script the store locator started working. So for those of you that use PHP Store Locator from PHPJabbers, enjoy.

require_once("options.php");
require_once("include.php");
require_once("include/functions.php");

	$qry = mysql_query("SELECT store_id,address_1,address_city,address_state,address_zip FROM storelocatorstores") or die(mysql_error());

	while ($r = mysql_fetch_array($qry))
	{
		$address = array ( );
		$address[] = $r[1];
		$address[] = $r[2];
		$address[] = $r[3];
		$address[] = $r[4];

		$_address = implode("+,",$address);
		$file = 'http://maps.google.com/maps/api/geocode/json?address=' . urlencode($_address) . '&sensor=false';

		$geocode=file_get_contents($file);

		$output= json_decode($geocode);

		var_dump($output);
		echo "---";
		var_dump($r[0]);

		$lat = $output->results[0]->geometry->location->lat;
		$long = $output->results[0]->geometry->location->lng;

		mysql_query("UPDATE storelocatorstores SET lat='" . $lat . "',lng='" . $long . "' WHERE store_id=" . $r[0]) or die("update err: " . mysql_error());
		sleep(2);

	}

Upgraded to PHP 5.3

Finally! Upgraded my server to run PHP 5.3.

Been busy with work and such. We just underwent a big DC migration, let me tell you working seventy hour weeks is not fun. I am still exhausted from it. Anyhoo, it’s done for the most part even though I have to get our stage environment up and some push scripts need to be created.

Side Project

I plan on starting my side project back up again soon. By soon I mean this weekend. At first I was going to go with Django/Python for it but I decided to give CodeIgniter another whirl. Seems like an easy enough transition from CFWhels.

Goodbye HostGator, Hello Linode

I figure it was time to grow up and have my own server. Maybe not server but VPS. Close enough, right? I moved all my sites to Linode. Running beautifully on my LAMP box. I have Django going on Cookie Loves Fortune so that’s the next big step for me to learn more Python. Anyhoo, I am enjoying the new virtual digs.

My Christmas

Last night my parents met my GF’s parents. It went well. Both of us were weirded out but whatever it worked. We had good food and a had good time at dinner last night.

Today my body probably spoke a lot to me and that being the insomniac I am needs to end. I went to bed last night around 11:30pm woke up at 10am, took a nap at four and just woke up. In between the naps all I did was eat. I feel all sluggish now but refreshed.