i'm on twitter

Sneak Peak of OKcommerce.gov’s Engineering Marketing

September 1, 2010 No comments yet

Here are 3 videos that have been developed as marketing engineering to the youngsters. It’s primarily to help bring to light that a lot of the things they may like can always one day be their job.

As it’s been pointed out to me, Nar is supposedly a dead ringer for me. What do you guys think?

View Source

Why Digg v4 Is A Fail

August 28, 2010 No comments yet

So, the new Digg has launched and there’s quite a bit of an uproar over the way stories rise to the top of the news page. This is a simple example of the Technology page without logging in to the Digg (logging in doesn’t change Top News, just My News).

I mean, I love Mashable, but come on.

Click the image to enlarge.

View Source

Inline Images With Data URLs

August 11, 2010 No comments yet

This particular trick comes in very handy for the mobile platforms. Instead of linking to your CSS and your images, you can use this method to embed the images inline within the CSS. This keeps the browser from having to make multiple calls, thus speeding up the load time of your application. You can also use this method within an IMG tag as well.

	/* ***********************************************************
	* START :::
	*	64bit encodes images for CSS embedding
        *      Alternatively, if you are not using PNGs, you can specify the Mime Type
        *      PNG is the default mime
	*********************************************************** */
	function data_url($file, $mime='') {  

		$mime = empty($mime) ? 'image/png' : $mime;

		$contents = file_get_contents($file);
		$base64   = base64_encode($contents);
		return ('data:' . $mime . ';base64,' . $base64);
	}
	/* ***********************************************************
	* END :::
	*********************************************************** */

In the CSS style sheet

You would need to either tell your server to process files with the .css extension or save your CSS files with the .php extension. It’s your call.


 body { background-image: url('<?php echo data_url('http://domain.com/images/file.png'); ?>') no-repeat; }

/* output code would be something like */
body { background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFQAAABUCAIAAACTCYeWAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAI5JREFUeNrs2sENACEIRUF1LY0mqRbb2OQPHUwexIu7qlbq3JmJxZ8VPMorr7zy8NZeeXhrrzw8vJtXHh4eHh7eU6c8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8fMj4kAQPDw8P76lTHh7ezSsPb+2Vh7f2yiv/7/mS8dHlo2d3dyz+CTAAYEXI+4xG4igAAAAASUVORK5CYII=') no-repeat; }

Within HTML img tags


<img src="<?php echo data_url('http://domain.com/images/file.png'); ?>" border=0 />

<!-- output code would be something like --> <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFQAAABUCAIAAACTCYeWAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAI5JREFUeNrs2sENACEIRUF1LY0mqRbb2OQPHUwexIu7qlbq3JmJxZ8VPMorr7zy8NZeeXhrrzw8vJtXHh4eHh7eU6c8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8fMj4kAQPDw8P76lTHh7ezSsPb+2Vh7f2yiv/7/mS8dHlo2d3dyz+CTAAYEXI+4xG4igAAAAASUVORK5CYII=" border=0 />

Make print_r() Pretty

August 11, 2010 1 comment

This is literally print_r() dressed up. I normally run this within my general $app object so to call it, I would use $app->debug($var). As with print_r(), it loops indefinitely using lists to format a readable layout in HTML. This helps the developer avoid having to view source and scroll…and scroll…and scroll to find the output of an array or object.

View Source

Error Handling

August 11, 2010 No comments yet

In the world of the Internet, as a developer, we need to protect ourselves from prying eyes. One of the easiest ways a hacker can crack your code is if you tell them what they did wrong. For that reason, it’s important to suppress errors from the public. But, this doesn’t mean we should eliminate the knowledge when an error occurs and what triggered it.  For that reason, I have written a fairly simple class that will allow for error suppression, error debugging and error reporting.

View Source

Tabs & Lists With Selectability

July 9, 2010 No comments yet

I’ve recently come up with a need to allow users to view a list of options from which to choose. Do to screen restraints and readability, I opted to use the tabbing functionality I wrote about previously. In the process, however, I wrote some javascript that allows me to add the ‘pick and choose’ functionality to any pair of lists, or single list, I choose.

Single List Mode: This is real simple. The user has a list of items to select from. When the select the item, the ‘selected’ class is added to that item. When they de-select the item, the ‘selected’ class is removed. This is tracked with a hidden input element with the id ‘ls_update_list_array’.

Dual List Mode: When the user views ‘Categories Selected’ (in this case, shown by default), they will see a list of categories currently selected. Under ‘All Available Categories’, they get a complete list of categories to selected from (in this case, minus those categories already selected). We want the user to be able to either add to the list of ‘Currently Selected’ by clicking on the ‘All Categories’ list, or remove items by clicking on them under ‘Currently Selected’. When they click on an item in either list, it is moved from list to the other. This is tracked with a hidden input element with the id ‘ls_update_list_array’.

ls_update_list_array: This is provided simply to allow for an easy form post action. Rather than having Javascript determine when the form is posted and then grabbing the list as an array and blah, blah, blah, you get the list automatically on post.

View Source

jQuery Tabs With Ease

July 3, 2010 No comments yet

As usual, I always need something special in jQuery. I’m always able to find plugins out there, but they never everything I want, the way I want it done. Each always falls short somewhere. It either limits my design flexibility, is buggy or is just flat-out bloated with way more code than is necessary.

I’ve written a tabs script for jQuery that is short and to the point while still allowing for design flexibility and ease. There’s nothing to it. Simply establish the tabs settings with your appropriate IDs and classes and you’re good to go. I’ve used on a few occasions and it has yet to fail me.

As usual, however, let me know if you have problems. I’ve supplied complete code for HTML, CSS and, of course, the jQuery/JavaScript.

View Source

Database PHP Class

June 15, 2010 1 comment

I’m back with another chunk of code. This time, it’s my database class.

I got sick of coming across classes that didn’t have everything I needed, or didn’t do it correctly. One of my biggest problems was an inability to nest query calls within another query result’s output.

View Source

jQuery Accordian without plug-ins & with a bit of design freedom

June 13, 2010 1 comment

So you have a design and you have decided you want to use a jQuery accordion. You start to layout your design and implement the accordion only to find out that your design is going to cause problems with the standard accordion plug-ins.

The problem with the standard accordion is that they require the child and header elements to be nested within a parent.

View Source

tnyb.it twitter UI

June 1, 2010 2 comments

This is a new Twitter app I am currently building for http://tnyb.it. It should be online soon. I will be making mobile browser compatible as well. I would make an iPhone version, but since I don’t have a Mac, that’s not going to happen (maybe one day).