Tuesday, December 28, 2010

Image Sprites and CSS Classes creator


Download Code Here
Example:
Source Images
Generated Sprite
Generated CSS Classes

Image Sprites are a very good way to feed your application some images.
Basically it consists of combining a set of images in a larger one and then just cache it.
When you need one of the small images all you have to know are the coodenates of it on the large one.
With this technique, you just need to load one image for the entire application and reuse it, instead loading each image at a time.

Here I'll be covering the implementation with CSS used on WebSites but you can use this technique wherever you want.

Why this?

Sure you can Google it and find a lot of matches telling you how to use sprites and CSS but where's the "no pain" way of building them and their CSS?
All of them will tell you to use Photoshop of any other photo editing tool but this will always take a lot of time.
That's when this cute little application comes in.
It will generate the sprite image and its css in no time, and you can add images later and regenerate it without having to worry about breaking your code!

Using the code

On the package you'll find a compiled version and its source code.

Just drop the SpriteCreator.exe file on the folder that have the images to be inclided on the sprite and run it. DONE!


Assumptions and Limitations

  1. All images on the folder have the same size, ex: 16x16, 32x32, ...
  2. The size of the images will be the size of the first image loaded into the sprite.
  3. The big srite image will be always square, having the minimum size needed to fit all images inside.
  4. All the images on the folder will be included on the sprite.
  5. Only jpg, jpeg, png & bmp extensions are supported.
  6. The name of the images is used on the CSS class name.
  7. The spaces on images file name will be replaced with -
  8. The result 2 files, one *.png and *.css where * is a generated GUID

Options

This is a console application so you can pass some customization arguments.
  1. /h :: Help.
  2. /source :: Specify the images source directory path.
  3. /destination :: Destination dir path.
  4. /classprefix :: CSS class name prefix.
Ex: SpriteCreator.exe /source shadow /classprefix app-ui-

Sunday, December 19, 2010

Undelete Tool... precious!

While I was moving the files from my camera to the PC, a sequence of unfortunate events occurred and I ended up deleting all the video files. I must say that I always use shift+delete to delete files and so I did this time too.

On my quest for a good + free + easy software that would bring back my files I found this:
TOKIWA DataRecovery

The tool is plain simple and it doesn't even need to be installed, just run it and you're ready to go.

Hope you'll never need it but if you do... Enjoy!

Thursday, December 09, 2010

Optimus Tactus Keyboard

About a year ago I made a post here about a $2400 keyboard that had a screen under each key.
Ok, those guys didn't let it go and have a new project yet in concept mode, that is a keyboard that itself is a programmable screen :)



I wonder how it feels on the tip of our fingers... I wouldn't like to type on something that feels like a table!
Despite the feel, it would add a lot more stress to the fingers joints.

Check it out at:
http://www.artlebedev.com/everything/optimus-tactus/

Disable Google Chrome PDF Viewer

Recently Google added a new feature to its web browser application that enable users to view PDF file without the ADOBE's plugin. This viewer is installed on a normal and automatic Google Chrome update and sets it self as the default viewer disabling the eventually installed Adobe's Reader plugin.
It looks nice at first dispite the problem that it sucks.
It lacks functionality and worst than that, have a bug that in some cases zooms out your entire webpage to unreadable values.

To avoid troubles and get back to what works you must:

  1. write the following on you address bar: about:plugins
  2. On the top-right corner of the page click "Details".
  3. Now scroll down until you find the "Chrome PDF Viewer" and click Disable.
  4. Now search for the Adobe Reader plugin "Adobe Reader X" and Enable it (if not already).

If you don't have Adobe Reader installed go to www.adobe.com and download it.
I also recommend that you have the latest stable version of Google Chrome and Adobe Reader installed.