Tuesday, May 24, 2011

WebP: A new image format for the Web

WebP is a new image format that provides lossy compression for photographic images. In a large scale study of 900,000 web images, WebP images were 39.8% smaller than jpeg images of similar quality. A WebP file consists of VP8 image data, and a container based on RIFF. The standalone libwebp library serves as a reference implementation for the WebP specification and is available at this git repository and as a tarball. Webmasters and web developers can use the WebP image format to create smaller and better looking images that can help make the web faster.
Did you know? WebP is pronounced "weppy".

 How WebP works 

WebP uses predictive coding to encode an image, the same methodology used by the VP8 video codec to compress keyframes in videos. Predictive coding uses the values in neighboring blocks of pixels to predict the values in a block, and then encodes only the difference (residual) between the actual values and the prediction.
The residuals typically contain many zero values, which can be compressed much more effectively. The residuals are then transformed, quantized and entropy-coded as usual. WebP also uses variable block sizes.
WebP support
WebP is supported by a variety of tools. In addition, it is now natively supported in Google Chrome, the Google Chrome Frame plug-in for Internet Explorer and Opera 11.10.
Developers have also added support to a variety of image editing tools. This release also provides a lightweight encoding and decoding library, libwebp and command line tools cwebp and dwebp for converting images to and from the WebP format. The full source code is available on the download page.

WebP converter download 
Convert your favorite collection from PNG and JPEG to WebP by downloading the precompiled cwebp conversion tool for Linux, Windows or Mac OS X.

Friday, May 20, 2011

Google’s WebP Image Format Takes On JPEGs With Sharper Pictures (Google is on a mission to make the Web faster)


Google is on a mission to make the Web faster. One thing that slows down pageload times are fat image files. Even JPEG and PNG files can get pretty big. So Google is developing a new image format called WebP (which is a sister format to its WebM project for videos).
The key to making image files on the Web smaller without losing sharpness is better compression of the original file. Today, Google announced via the Chromium blog that the compression algorithms for WebP just got better and that they can even handle different parts of an image separately so that parts of it can be displayed without waiting for the entire image to be compressed and decompressed.
The images above, for instance, are from this gallery comparing JPEG to WebP. The WebP images are significantly smaller, but look just as sharp. Can you tell the difference? Unfortunately, WebP is only supported in Chrome and Opera browsers. Google products such as Gmail, Picassa Web albums, and Google Instant Previews also support WebP. But other than Opera, it’s pretty much an all-Google affair.
Websites aren’t going to start using WebP images just for Google Chrome visitors. But if it does speed things up without reducing the quality of images, other browsers will start supporting it as well or else be left behind.

Wednesday, May 18, 2011

Create SEO friendly URL`s using mod rewrite in PHP (.htaccess)

In this tutorial I will show you how to transform this:
http://www.mywebsite.com/tutorials.php?id=123&title=mod_rewrite&category=php
into this
http://www.mywebsite.com/tutorials/php/mod_rewrite-123

Why to rewrite your URL`s ?
The main reason is because static URL`s (the second URL is static) are indexed more faster than dynamic URL`s (like the first one), because from a static URL is easier to understand what the page is about both for search engines and your visitors. When using dynamic URL`s there is an another problem: search engines are reading only the beginning of the long URL`s, so if your addresses are different only at the end, than search engines will see the same URL for all of your pages and from this reason none will be indexed.

How this works ?
We will use Apache mod_rewrite. The mod_rewrite transforms back the second URL into the first URL, so the server will access the "ugly" address, but the visitors and the search engines will see the "clear" one. mod_rewrite simply rewrites the URL`s what meets specific conditions into addresses what are understood by the server.

Let`s rewrite it!
The code what rewrites the website address needs to be placed in your .htaccess file (if you don`t have it in your root folder, create it), the code is very short:

RewriteEngine on
RewriteRule ^tutorials/(.*)/(.*)-([0-9]+)/?$ /tutorials.php?id=$3&title=$2&category=$1





Take it apart!
The first line: RewriteEngine on simply does what it says, it starts the rewrite engine.
Now let`s take apart the second line:

RewriteRule - this tells the server about the rule to follow when rewriting the URL^ - this exponential sign means the start of the URL: http://www.mywebsite.com/tutorials - this word is simply added to the website adress/ - this character separates the directories (.*) - this tells the server that here will be placed some data (any kind of characters) (e.g.: php)- - this character will be simply added to the website adress([0-9]) - this tells the server that here will be placed a digit (e.g: 1)+ - the plus sign tells the server that here can be more digits (e.g.: 123)? - this sign tell the server that the character in it`s front it`s not required (so the URL will work with and without the last "/")$ - the dollar sign tells the server that here is the end of the rule


The last part of the line is the old address, the value of each variable (id, title and category) are changed to $3, $2 and $1. mod_rewrite takes these variables and places them in their new position in the new URL. In the first place for data (the first (.*)) it places the $1`s value (the category value), in the second place the value of $2 and so on. If you want to change the order just change the $1, $2 and $3 order, but be careful to set the right data type in the new URL. 

Benefits of Programming in Ruby on Rails


There are several programming languages that to-be programmers (or current programmers) can choose from. For first-time programmers, choosing a programming language can be difficult. There are many programming languages that are dying out, just aren’t popular, or are just generally hard to learn. It would be a shame for any first-time programmer to purchase books to learn a language to find that it is too difficult. It would also be a shame to learn a programming language that has no application at work. Ruby is a great programming language because it offers a great feature called Ruby on Rails. Rails is a web framework that can be used by programmers to speed up development.
The programming language, Ruby, was created in the mid 1990’s in Japan, by Yukihiro “Matz” Matsumoto. Ruby is based on Perl, Smalltalk, Eiffel, Ada, and Lisp and was written to create a programming language that, according to Matsumoto, “was more powerful than Perl, and more object-oriented than Python.”
One of the goals of Ruby is to allow the simple and fast creation of web applications. The language itself satisfies this goal. Because of this, there is much less tedious work with this language than many other programming languages. Ruby is also free of charge. It is also free to copy, use, modify, and distribute. Since Ruby can be modified, programmers can make necessary changes and can code without feeling restricted. Another feature of Ruby is its mark-and-sweep garbage collection which allows programmers the ability to code without having to worry about the need to maintain reference counts in extension libraries. Also, if an operating system allows for it, Ruby can dynamically load extension libraries. Ruby currently ranks as the 9th most popular programming language in the world. There are many online guides where Ruby programmers to-be can learn how to program in Ruby.
Ruby on Rails, often simply called Rails, is an open source web application framework that was designed for Ruby by David Heinemeier Hansson and was released in July 2004. Ruby on Rails makes use of an object relational mapping layer known as the ActiveRecord. Because of this, programmers do not have to specify database column names in class definitions. Rails will retrieve this information on its own from the database based on the class name. Rails also has a testing framework built in which allows programmers to write test cases which helps them create more reliable, robust code.