| Subcribe via RSS


why utf8 is important

May 28th, 2008 | 1 Comment | Posted in anything under the moonlight, developer's tools by dreamluverz

Advantages

Here are several advantages of UTF-8:

  • UTF-8 can be read and written quickly just with bit-mask and bit-shift operations.
  • Comparing two char strings in C/C++ with strcmp() gives the same result as wcscmp(), so that legicographic sorting and tree-search order are preserved.
  • Bytes FF and FE never appear in an UTF-8 output, so they can be used to indicate an UTF-16 or UTF-32 text (see BOM).
  • UTF-8 is byte order independent. The bytes order is the same on all systems, so that it doesn’t actually require a BOM.

Disadvantages





UTF-8 has several disadvantages:

  • You cannot determine the number of bytes of the UTF-8 text from the number of UNICODE characters because UTF-8 uses a variable length encoding.
  • It needs 2 bytes for those non-Latin characters that are encoded in just 1 byte with extended ASCII char sets.
  • ISO Latin-1, a subset of UNICODE, is not a subset of UTF-8.
  • The 8-bit chars of UTF-8 are stripped by many mail gateways because Internet messages were originally designed as 7-bit ASCII. The problem led to the creation of UTF-7.
  • UTF-8 uses the values 100xxxxx in more than 50% of its representation, but existing implementation of ISO 2022, 4873, 6429, and 8859 systems mistake these as C1 control codes. The problem led to the creation of UTF-7,5.

source:http://www.codeguru.com/cpp/misc/misc/multi-lingualsupport/article.php/c10451/

Why is it Important?

UTF-8 is an important encoding because of the following reasons:

  • ASCII compatible
  • easily supported
  • compact and efficient for most scripts
  • easily processed, unlike other multibyte encodings

source: http://developers.sun.com/dev/gadc/technicalpublications/articles/utf8.html

Tags: , ,

What is utf8

May 27th, 2008 | No Comments | Posted in anything under the moonlight, mysql, php by dreamluverz

What Is UTF-8 And Why Is It Important?





Unicode is a character set supported across many commonly used software applications and operating systems. For example, many popular web browser, e-mail, and word processing applications support Unicode. Operating systems that support Unicode include Solaris Operating Environment, Linux, Microsoft Windows 2000, and Apple’s Mac OS X. Applications that support Unicode are often capable of displaying multiple languages and scripts within the same document. In a multilingual office or business setting, Unicode’s importance as a universal character set cannot be overlooked.

source: http://developers.sun.com/dev/gadc/technicalpublications/articles/utf8.html

Tags:

INSERT SELECT

May 27th, 2008 | No Comments | Posted in mysql by dreamluverz

I was trying to duplicate a record and the best solution I can find is to do it like this.

INSERT INTO table SELECT * FROM table WHERE {CONDITION}

But this is not a good idea if you have auto increment for your primary key so you can do it like this instead

INSERT INTO table (field1, field2, field3) SELECT field1, field2, field3 FROM table WHERE {CONDITION}

Take a closer look of the statement. At first I was trying to do it like the one shown below and I got an error column count doesn’t match. As you notice I specify the fields on SELECT and not on INSERT INTO.

INSERT INTO table SELECT field1, field2, field3 FROM table

Tags: , ,

CONCAT_WS

May 27th, 2008 | No Comments | Posted in anything under the moonlight, mysql by dreamluverz

CONCAT_WS(separator,str1,str2,…)

CONCAT_WS() stands for Concatenate With Separator and is a special form of CONCAT(). The first argument is the separator for the rest of the arguments. The separator is added between the strings to be concatenated. The separator can be a string, as can the rest of the arguments. If the separator is NULL, the result is NULL.

mysql> SELECT CONCAT_WS(',','First name','Second name','Last Name');
-> 'First name,Second name,Last Name'
mysql> SELECT CONCAT_WS(',','First name',NULL,'Last Name');
-> 'First name,Last Name'

CONCAT_WS() does not skip empty strings. However, it does skip any NULL values after the separator argument.

source: http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_concat-ws

Tags: ,

www redirect

May 22nd, 2008 | No Comments | Posted in htaccess by dreamluverz

If you want to redirect your domain from http://domain.com to www.domain.com you must put this rule at the very top and before all other rules you have on your htaccess file.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^mydomain\.com
RewriteRule ^(.*) http://www.mydomain.com/$1 [L,R=301]

Tags: ,

mod_rewrite domain

May 21st, 2008 | No Comments | Posted in anything under the moonlight, apache, htaccess by dreamluverz

RewriteCond %{HTTP_HOST} ^(www\.)?yourdomain\.com [NC]
RewriteRule ^(.*)$ http://newdomain.com/$1 [R=301,L]

Introduction to mod_rewrite

Tags: ,

domain redirection

May 20th, 2008 | No Comments | Posted in SEO, apache, server by dreamluverz

As far as SEO is concerned 301 redirect is the most effecient way of domain redirection.

Some ways of doing it:

PHP Redirect

<?
Header( “HTTP/1.1 301 Moved Permanently” );
Header( “Location: http://www.new-url.com” );
?>

.htaccess

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]

Check out here for other languages

other reference : http://www.somacon.com/p145.php

Tags: ,

reciprocal link checker script

May 20th, 2008 | No Comments | Posted in php by dreamluverz

I found this code for reciprocal link checker on http://forums.digitalpoint.com/showthread.php?t=111

maybe you want to give it a shot. gudluck :)

<?php $mydomain = "www.domain.com"; // Set this to your domain $list = file_get_contents("sites.txt"); $urls = explode ("\n", $list); ini_set (default_socket_timeout, "5"); echo "<B>Checking back links to $mydomain....</B><P><FONT SIZE=-1>"; foreach ($urls as $url) { if (strlen ($url) && $url{0} != "#") { echo $url . "<B><FONT COLOR="; if (strpos (file_get_contents($url), $mydomain) != FALSE) { echo "GREEN> Found"; } else { echo "RED> Missing"; } echo "</FONT></B><BR>"; } } echo "</FONT>"; ?>
Tags: , , ,

linux cheat sheet

May 14th, 2008 | No Comments | Posted in linux by dreamluverz

Click on the image below to view the linux cheat sheet

Tags: ,

stopPropagation() and cancelBubble

May 14th, 2008 | No Comments | Posted in javascript by dreamluverz

Another way of doing the cancelBubble:

function dropButtonClick(e) { if( typeof( e ) == "undefined" && typeof( window.event ) != "undefined" ) e = window.event; // do things.... if (typeof( window.event ) != "undefined" ) { // IE e.cancelBubble=true; } else { // Firefox e.stopPropagation(); } }

source: http://blogs.charteris.com/blogs/edwardw/default.aspx

Tags: , ,