Web Development

The Future of Web Applications

Zuckerberg's Trout Was the Poke

With the evolution of communication via the internet, it’s interesting to see how websites of today are really client-side applications of yesterday. In some cases, we see applications mirroring existing applications (meebo). Advances in CSS and Javascript with the push of ‘web 2.0 technologies’ such as application frameworks and AJAX have shown programmers of other backgrounds that we web folk really aren’t that different. This in combination with the release of various APIs and the opening of platforms ensures these companies existence in this new module war. Thus initiating the next step in this game of chess, which one company has already taken a shot at.

Behold the future of web applications:

The Future of Web Applications

Businesses will ensure their place in the industry by becoming the host of niche web applications, utilizing their services as modules.

Coupon Crawl - Search coupon codes

Christmas Savings

I can’t recall a time where I was working on just one project. Sometimes bigger projects eclipse my little adventures and so I’m left with half completed mini scripts. Today my memory was jogged by a friend who asked about some Christmas deals. I like a bargain as much as the next guy but I don’t really feel compelled to waste a boat load of time to save a few bucks. My solution to this, was to create a website that does the work for me.

Coupon Crawl - Search coupon codes

Utilizing google’s CSE, I created Coupon Crawl. I’m still playing with page weights to yield the best results but it works fantastic for certain items. Before checkout at any online store, it’s a good idea to do a quick search here for a promo code. I’ve probably saved over $100 total from this thing already!

XEPIC – Facebook Application

After going to GameDev ’07 at Harvard with James Lindsay on Saturday, I got some motivation and decided to get my feet wet with the facebook api. I have created my first application which pulls pictures from the website www.xepic.net and displays them in your profile like so:

Facebook Application - XEPIC.net - Funny and interesting Pictures

If you’d like to try out my application, you can find it here.

mysql-browser.png

Creating MySQL Queries Visually

Over the past few days, I’ve been creating some rather large and confusing SQL queries, so I went on a hunt to see if maybe there was a visual aid that would make the selects, joins and sub queries easier. I was a bit disappointed to find that MySQL offered a Query Browser that wasn’t available for download… or was it?

After a little more research I came about a link to a slightly thinner client in the developer zone under the Generally Available (GA) license. I’ve played around with it a bit and while it wasn’t exactly what I was looking for, it’s helped me during those times I don’t feel like waiting on phpMyAdmin.

Check out this screencast to get a better idea of how this tool works. I’m sure I’ll grow to like this tool a lot more in the future, I just need to learn more about it’s functionality. I thought I’d pass this tip onto you.

mysql-browser.png

PHP Functions: Strip Chars From A Filename and Cloud

Someone overheard a friend and I chatting about a website and it’s tag cloud script. I mentioned that it’s pretty easy to create and that I had already created a php function. He asked me to dig it up, so I present to you a cloud script in it’s simplest form.

Cloud

<?php

$ceiling = 50;

class cloud {

	function setTop($top) {
		global $ceiling;
		$ceiling = $top;
	}

	function sizeMe($name,$times) {
		global $ceiling;
		$times = ($times / $ceiling) * 100;
		if ($times <=20)
			$size = 1;
		else if ($times>=11 && $times <=40)
			$size = 2;
		else if ($times>=21 && $times <=60)
			$size = 3;
		else if ($times>=31 && $times <=80)
			$size = 4;
		else
			$size = 5;
		// You should really replace this with a return $size, this is just for demonstration purposes
		echo "<span class=\"a$size\"><a href=\"#\">$name</a></span> ";
	}
}
?>

It’s pretty straight forward and easily modified. You setTop based on the number of entries in your database, then pass $name and the number of times it appears to the sizeMe function. If you have any questions or suggestions please let me know. I tried to keep this simple.

In this example I created classes, a1, a2, a3, a4 and a5 that I defined font-size for in a css file.

Strip Characters From A Filename

<?php

function renameStripChars($directory, $pattern, $replacement, $verbose = false) {
  if($curdir = opendir($directory)) {
   while($file = readdir($curdir)) {
     if($file != '.' && $file != '..') {

       $dstfile = $directory . '/' . preg_replace($pattern, $replacement, $file);
	   $srcfile = $directory . '/' . $file;

	   rename($srcfile, $dstfile);

       if(is_dir($srcfile) && $verbose) {
	      renameStripChars($srcfile, $pattern, $replacement, $verbose);
       }
     }
   }
   closedir($curdir);
  }
}

// An example of how I used it
renameStripChars('picsTest', '/[^\w\d\.-\s]+/', '', true);
renameStripChars('picsTest', '/[\s]+/', '_', true);
renameStripChars('picsTest', '/[-]+/', '-', true);
renameStripChars('picsTest', '/[_]+/', '_', true);

?>

I wrote this function because I had a boatload of images with ridiculous characters in them and I wanted them out before I uploaded them somewhere. Most frameworks have a similar function built in but if you’re looking for a quick fix, this is perfect for you.