The Internet

Getting Entrecard to Work with Blogger

Just the other day, I was trying to integrate Entrecard into one of my Blogger accounts and it didn’t work. The reason for this, is google’s very strict about their document validity, while Entrecard has seemingly over-looked a common HTML markup mistake. The use of an ampersand, rather than html entity:

& causes blogger to fail markup validation when saving.

Theirs:

<script src="http://entrecard.s3.amazonaws.com/widget.js?user_id=629&type=standard_200" type="text/javascript" id="ecard_widget"></script>

Valid:

<script src="http://entrecard.s3.amazonaws.com/widget.js?user_id=629&type=standard_200" type="text/javascript" id="ecard_widget"></script>

Note: don’t just copy that code and use it in your blog… unless you want to display my card!

Valid Doctypes

Doctypes and why I never really gave a crap

To me, doctypes have always been somewhat of a hassle. I know when I write good code and I know how to fix errors the validator spits out at me. Other than that, my knowledge is limited. I usually just copy the header from my older documents and hope for the best. However, yesterday I had a change of heart and thanks to a simple google search, that led me to a great article, that brought me to a not so easily found page on w3. I was able to sigh in relief. I really don’t understand why the chart below isn’t easily accessible.

Valid Doctypes
This chart is located about half way down the page.

According to my purple to blue link ratio, there are no links off the front page of w3 to this article. I find this rather inconvenient. Thankfully, the good folks at ALA know what’s up.

My Bookmarks Organized

Bookmark Organization

Bookmarks are something most of us don’t really keep up to par. Sometimes you just ctrl+d on a whim, losing that page in your lack of a hierarchy forever. Well, at least that’s how it’s been for me. However, once in a while I give myself a kick in the ass and try to shape up. Based upon the patterns I’ve learned in the past and the general direction I wish to go, I reevaluate my mess and decide the proper way forward. In this case it was the standard, “Make general categories and add sub-folders if they need more organization” route… with a little extra spice.

My Bookmarks Organized

This time around, I decided to utilize folders in the bookmarks toolbar. Maybe I’m blind to this but I feel like most people don’t utilize this helpful feature, I know I didn’t until now. After spending a few days using folders on my toolbar, I’ve come to the conclusion that it is both effective and efficient.

My Bookmarks Toolbar

I spend a lot of time developing locally and often do rounds on my live sites and rather than waste 4 seconds typing in a 32 character URL, I’d rather waste 0.4 making two clicks. Yes, that’s right, I’m shaving off seconds to increase my efficiency. It might not seem like a lot but it adds up to minutes a day and hours a year.

Now, because I’m going to be spending a lot of time on my laptop, I needed a global solution to my bookmarks. The path I chose to get is syncing them with the Firefox extension, Bookmark Sync and Sort. If you don’t have your own server, there are some hosted alternatives such as Foxmarks Bookmark Synchronizer. Those trendy bookmark sites aren’t really the solution for me for a few reasons.

1) I like to control my data.
2) Those sites are usually distracting to me
3) While the Firefox bookmarks manager isn’t the ideal solution, the GUI is far more advanced than something you’ll find on a social bookmarking site.

Admittedly, there is an advantage to these sites, and that’s the fact that I can get to my bookmarks quickly no matter what computer I’m on. But again, I can argue that I can find a link just as fast (if not faster) with SSH by greping the xml file Bookmark Sync and Sort generates.

Back on track, once you have the extension installed, click ‘Bookmarks’ > ‘Synchronize Bookmarks’ and fill in the dialog with your information as such:

Bookmarks Sync and Sort

What kind of man would I be if I didn’t take advantage of this moment to sort my bookmarks?

My Bookmarks Sorted

Mmm, alphabetical order.

Now I just need to upkeep as best I can… I’ll let you know when I come up with a better solution for that. Right now, I just force myself to take the time to find the correct folder in the hierarchy. It’s a good habit but a hard one to keep. If you have any advice, please share. Good luck and happy bookmarking.

P.S. I edited the file wp-admin/admin-functions.php, line 2126 to increase the generated thumbnail size in wordpress. Just replace ’128′ with the max you wish. Thought maybe some of you could use that information.

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.