Archive for the ‘General Tutorials’ Category

Jan 29 GIF / JPEG Posted at 6:55 pm | No Comments »

Most designers wonder about one thing about their graphics. Should you use GIF or JPEG? Well, let us help you answer that question.

First of all, Compuserve’s 8-bit GIF (Graphics Interchange Format) supports 256 colors and has good compression but still has holds excellent picture quality. However, just because a GIF is 256 colors does not mean that it conforms to the 216 Internet color pallete. That pallete can be found here. The 24-bit JPEG (Joint Picture Experts Group) supports all 16.7 million colors, and has a greater compression ratio. However, the tradeoff is that JPEG doesn’t hold its picture quality as good as GIF.

Also, it depends on what kind of graphic you want to make. For regular pictures and graphics that have long stretches of the same color, JPEG is not the format to use. Here’s an example. The graphic below was created with only 73 colors:





GIF
Colors: 73
Size: 3.54K


JPEG
Colors: 73
Size: 2.74K



See the blemishes all over the JPEG, and see how clean the GIF is? But, if you’re scanning in a lot of photographs and multicolored graphics, then JPEG might be a better choice. Here’s another example. The graphic in this example was created with 4984 unique colors.





GIF
Colors: 249
Size: 6.41K


JPEG
Colors: 4667
Size: 6.54K



As you can see, this time the blemishes aren’t as visible in the JPEG because of the constant color variations. However, when you look at the file sizes, you can see that although the JPEG has more colors, it still can keep file size down. Conclusions:

  • If you’re concerned with how your picture will look, and its under 256 colors, use GIF.
  • If the picture is more than 256 colors try GIF first, but if it still looks grainy, use JPEG.
  • If only concerned with file sizes, use JPEG.

Jan 29 Domain Name Registries (K-Z) Posted at 6:54 pm | No Comments »

K

.ke Kenya
.kg Kyrgystan
.kh Cambodia
.kz Kazakhstan

L

.lb Lebanon
.lc Saint Lucia
.li Liechtenstein
.lk Sri Lanka
.lt Lithuania
.lu Luxembourg
.lv Latvia
.ly Libyan Arab Jamahiriya

M

.mc Monaco
.md Moldova
.mg Madagascar
.mh Marshall Islands
.mk Macedonia
.mm Myanmar
.mn Mongolia
.mo Macau
.mq Martinique
.mr Mauritania
.ms Montserrat
.mt Malta
.mu Mauritius
.mw Malawi
.mx Mexico
.my Malaysia

N

.na Namibia
.nc New Caledonia
.nf Norfolk Island
.ni Nicaragua
.nl The Netherlands
.no Norway
.nu Niue
.nz New Zealand

O

.om Oman

P

.pa Panama
.pe Peru
.ph Philippines
.pk Pakistan
.pl Poland
.pm St. Pierre and Miquelon
.pn Pitcairn
.pr Puerto Rico
.pt Portugal
.py Paraguay

Q

.qa Qatar

R

.re Reunion
.ro Romania
.ru Russia
.rw Rwanda

S

.sa Saudi Arabia
.sb Solomon Islands
.sc Seychelles
.sd Sudan
.se Sweden
.sg Singapore
.sh St. Helena
.si Slovenia
.sj Svalbard and Jan Mayen Islands
.sk Slovakia
.sm San Marino
.sn Senegal
.so Somalia
.st Sao Tome and Principe
.su USSR (former)
.sv El Salvador
.sz Swaziland

T

.tc The Turks & Caicos Islands
.td Chad
.tf French Southern Territories
.th Thailand
.tj Tajikistan
.tm Turkmenistan
.tn Tunisia
.to Tonga
.tp East Timor
.tr Turkey
.tt Trinidad and Tobago
.tv Tuvalu
.tw Taiwan
.tz Tanzania

U

.ua Ukraine
.ug Uganda
.uk United Kingdom
.um United States Minor Outlying Islands
.us United States
.uy Uruguay
.uz Uzbekistan

V

.ve Venezuela
.vg Virgin Islands British
.vi Virgin Islands U.S
.vn Vietnam

W

.wf Wallis and Futuna Islands

Y

.yt Mayotte
.yu Yugoslavia

Z

.za South Africa
.zm Zambia
.zr Zaire

Jan 29 Domain Name Registries (A-J) Posted at 6:53 pm | No Comments »

.ac Ascension Island
.ad Andorra
.ae United Arab Emirates
.ag Antigua and Barbuda
.ai Anguilla
.al Albania
.am Armenia
.ao Angola
.ar Argentina
.as American Samoa
.at Austria
.au Australia
.az Azerbaijan
.ba Bosnia and Herzegowina
.be Belgium
.bf Burkina Faso
.bg Bulgaria
.bh Bahrain
.bi Burundi
.bm Bermuda
.bn Brunei Darussalam
.br Brazil
.bt Bhutan
.bv Bouvet Island
.by Belarus
.bz Belize

.ca Canada
.cc Cocos (Keeling) Islands
.cd Zaire
.cf Central African Republic
.cg Congo
.ch Switzerland
.ci Côte d’Ivoire
.cl Chile
.cm Cameroon
.cn China
.co Colombia
.cr Costa Rica
.cu Cuba
.cx Christmas Island
.cy Cyprus
.cz Czech Republic
.de Germany
.dj Djibouti
.dk Denmark
.do Dominican Republic

.ec Ecuador
.ee Estonia
.eg Egypt
.es Spain
.et Ethiopia
.fi Finland
.fj Fiji
.fk Falkland Islands
.fm Micronesia
.fo Faroe Islands
.fr France

.gb United Kingdom
.ge Georgia
.gf French Guiana
.gg Guernsey
.gh Ghana
.gi Gibraltar
.gl Greenland
.gn Guinea
.gp Guadelope
.gq Equatorial Guinea
.gr Greece
.gs South Georgia and the South Sandwich Islands
.gt Guatemala
.gu Guam
.hk Hong Kong
.hm Heard and McDonald Islands
.hn Honduras
.hr Croatia
.ht Haiti
.hu Hungary

.id Indonesia
.ie Ireland
.il Israel
.im Isle of Man
.in India
.io British Indian Ocean Territory
.ir Iran
.is Iceland
.it Italy
.je Jersey
.jo Jordan
.jp Japan

Jan 29 ASCII Chart Posted at 6:53 pm | No Comments »

The ascii chart below displays the ascii code to use on your web sites for maximum compatibility. By using the proper ascii value rather than cut and paste, you can assure that your code will properly validate and even more importantly render correctly in all browsers. Updated to include Euro Symbol - #128.

Character HTML Alternate HTML Explanation
  � -    Unused
    Horizontal tab
    Line feed
  -   Unused
    Carriage Return
   -    Unused
Space   Space
! !   Exclamation mark
Quotation mark
# #   Number sign
$ $   Dollar sign
% %   Percent sign
& & & Ampersand
  Apostrophe
( (   Left parenthesis
) )   Right parenthesis
* *   Asterisk
+ +   Plus sign
, ,   Comma
- -   Hyphen
. .   Period (fullstop)
/ /   Solidus (slash)
: :   Colon
; ;   Semi-colon
< < < Less than
= =   Equals sign
> > > Greater than
? ?   Question mark
@ @   Commercial at
[ [   Left square bracket
\ \   Reverse solidus (backslash)
] ]   Right square bracket
^ ^   Caret
_ _   Horizontal bar (underscore)
` `   Acute accent
{ {   Left curly brace
| |   Vertical bar
} }   Right curly brace
~ ~   Tilde
     Unused
  Euro Symbol
     Unused
  Low single comma quotation mark
ƒ ƒ   Function sign
  Low double comma quotation mark
  Ellipses
  Dagger
  Double dagger
ˆ ˆ   Caret
  Per mile sign
Š Š   Capital S Hacek
  Less-than sign
Œ Œ   Capital OE ligature
   -    Unused
  Single beginning quotation mark
  Single ending quotation mark
  Double beginning quotation mark
  Double ending quotation mark
  Dot, middle
  En dash
  Em dash
˜ ˜   Tilde
  Trademark symbol
š š   Small s Hacek
  Greater-than sign
œ œ   Small oe ligature
   - ž   Unused
Ÿ Ÿ   Capital Y, diæresis / umlaut
      Non-breaking Space
¡ ¡   Inverted exclamation
¢ ¢   Cent sign
£ £   Pound sterling
¤ ¤   General currency sign
¥ ¥   Yen sign
¦ ¦   Broken vertical bar
§ §   Section sign
¨ ¨   Diæresis / Umlaut
© ©   Copyright
ª ª   Feminine ordinal
« «   Left angle quote, guillemot left
¬ ¬   Not sign
­ ­ ­ Soft hyphen
® ®   Registered trademark
¯ ¯   Macron accent
° °   Degree sign
± ±   Plus or minus
² ²   Superscript two
³ ³   Superscript three
´ ´   Acute accent
µ µ   Micro sign
  Paragraph sign
· ·   Middle dot
¸ ¸   Cedilla
¹ ¹   Superscript one
º º   Masculine ordinal
» »   Right angle quote, guillemot right
¼ ¼   Fraction one-fourth
½ ½   Fraction one-half
¾ ¾   Fraction three-fourths
¿ ¿   Inverted question mark
À À À Capital A, grave accent

Jan 29 Apache Custom Error Messages Posted at 6:51 pm | No Comments »

Most of the users that come to your site, will not know what a “Internal Server Error” or “404″ error is. They will not bother to check out the Apache manual either.

Custom error messages are not something to (just) show off with. In terms of (web-)usability, you are able to display a more friendlier or meaningful message to your users, and everyone will live happier ever after.

A lot of people still ask me how to add custom error pages to their website. Since some ISPs charge an arm and a leg to add them, here is how it is done - for free!

You log onto your shell and create a file called .htaccess in your document root. This can be achieved if you type “pico .htaccess”, “ee .htaccess” or “joe .htaccess” on the shell prompt. Let’s assume that you want to display a custom error page for “File not found”-errors (code: 404).

Put the following code inside the .htaccess:


ErrorDocument 404 /path/to/error/document.html


Save it. Viola! It’s all done.

You may also refer to a remote document:


ErrorDocument 404 http://errors.domain.com/404.php


The syntax is as follows:


ErrorDocument <3-digit-code> action


Can’t get enough of them?

Successful Client Requests
200 OK
201 Created
202 Accepted
203 Non-Authorative Information
204 No Content
205 Reset Content
206 Partial Content
Client Request Redirected
300 Multiple Choices
301 Moved Permanently
302 Moved Temporarily
303 See Other
304 Not Modified
305 Use Proxy
Client Request Errors
400 Bad Request
401 Authorization Required
402 Payment Required (not used yet)
403 Forbidden
404 Not Found
405 Method Not Allowed
406 Not Acceptable (encoding)
407 Proxy Authentication Required
408 Request Timed Out
409 Conflicting Request
410 Gone
411 Content Length Required
412 Precondition Failed
413 Request Entity Too Long
414 Request URI Too Long
415 Unsupported Media Type
Server Errors
500 Internal Server Error
501 Not Implemented
502 Bad Gateway
503 Service Unavailable
504 Gateway Timeout
505 HTTP Version Not Supported

Have fun!

Jan 29 Sorting database results Posted at 6:50 pm | No Comments »

Databases offer a lot of flexibility when dealing with data. By spending some time upfront on the database design, it will save you plenty of headaches later on. Since the object of this to tutorial is not to elaborate on the advantages of using a database, I will skip to its limits.

The operations you can run on a database are always based on logic and numbers. So for example, when you run a store and sell T-Shirts, and you sort by size, “M” will always be sorted before “S”, even though it is not correct from a humanistic point of view.

Assuming we have a table called “Products” in the database, here is a set of data that you would typically deal with and a solution for sorting the data in a more useful way using the MySQL database.

Name    | Size

T-Shirt | L

T-Shirt | M

T-Shirt | S

T-Shirt | XL

T-Shirt | XS

And here is how you typically retrieve records:

SELECT Name, Size FROM Products ORDER BY Size

This query returns all products, however, not sorted “XS, S, M, L, XL” but in “L, M, S, XL, XS”.

The solution to this problem is a simple CASE (see: Control Flow Functions):

SELECT Name, Size,

CASE Size

WHEN XS THEN 1

WHEN S THEN 2

WHEN M THEN 3

WHEN L THEN 4

WHEN XL THEN 5

END

AS Sort_Order

FROM Products

ORDER BY Sort_Order ASC

This returns the products in order of their sizes. Use ASC (ascending) or DESC (descening) to change the order from smallest size to largest size or vice-versa.

That’s it, enjoy.

KickApps
Clicky Web Analytics

community discussion