| Subcribe via RSS


javascript reference

May 28th, 2008 | No Comments | Posted in anything under the moonlight, javascript by dreamluverz




Here’s a good site for javascript reference:

http://users.dickinson.edu/~braught/courses/cs131s99/jsRef.html

Tags:

prototype window

May 28th, 2008 | Comments Off | Posted in anything under the moonlight, javascript by dreamluverz

I discovered this thing from a friend and it’s a cool stuff. Haven’t tried it though but really excited to give it a shot.

Overview

This javascript class allows you to add window in a HTML page.





This class is based on Prototype. The code is inspired by the powerful script.aculo.us library. You can even use all script.aculo.us effects to show and hide windows if you include effects.js file , but it’s not mandatory.

It has been tested on Safari, Camino, Firefox and IE6, Opera looks fine.

Features

  • Valid HTML/XHTML generated code
  • Resizable windows
  • Minimize/Maximize
  • Modal dialogs
  • Visual effects
  • Skinnable
  • And more…

How to Use

It's easy to use, just include two javascripts and one css (more if you want different skins).


<script type="text/javascript" src="/javascripts/prototype.js"> </script>

<script type="text/javascript" src="/javascripts/window.js"> </script>
<link href="/stylesheets/themes/default.css" rel="stylesheet" type="text/css"/>
<!--  Add this to have a specific theme-->

<link href="themes/mac_os_x.css" rel="stylesheet" type="text/css"/>

To create a window, you just have to instanciate a Window object with some optional parameters, set innerHTML of the window main content and call show() or showCenter() function. Check out the samples tab with more sample codes

win = new Window({className: “mac_os_x”, title: “Sample”, width:200, height:150, destroyOnClose: true, recenterAuto:false});
win.getContent().update("Hello world !!”);
win.showCenter();


source: http://prototype-window.xilinus.com/index.html

Tags: , ,

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: , ,

twitter

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

I’m on twitter. https://twitter.com/dreamluverz.

I actually don’t have any idea about this thing. I just got it from a friend. But anyways I’m trying this out.

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: ,

cancer

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

I just got this from my email and just wanted to share it to you all.

AFTER YEARS OF TELLING PEOPLE CHEMOTHERAPY
IS THE ONLY WAY TO TRY AND ELIMINATE CANCER, JOHNS HOPKINS IS FINALLY STARTING
TO TELL YOU THERE IS AN ALTERNATIVE WAY .

Cancer Update from Johns Hopkins

1. Every person has cancer cells in the body. These cancer cells do not show up in the standard tests until they have multiplied to a few billion. When doctors tell cancer patients that there are no more cancer cells in their bodies after treatment, it just means the tests are unable to detect the
cancer cells because they have not reached the detectable size.

2. Cancer cells occur between 6 to more than 10 times in a person’s lifetime.

3. When the person’s immune system is strong the cancer cells will be destroyed and prevented from multiplying and forming tumours.

4. When a person has cancer it indicates the person has multiple nutritional deficiencies. These could be due to genetic, environmental, food and lifestyle factors.

5. To overcome the multiple nutritional deficiencies, changing diet and including supplements will strengthen the immune system.

6. Chemotherapy involves poisoning the rapidly-growing cancer cells and also destroys rapidly-growing healthy cells in the bone marrow, gastro-intestinal tract etc, and can cause organ damage, like liver, kidneys, heart, lungs
etc.

7. Radiation while destroying cancer cells also burns, scars and damages healthy cells, tissues and organs.

8. Initial treatment with chemotherapy and radiation will often reduce tumor size. However prolonged use of chemotherapy and radiation do not result in more tumor destruction.

9. When the body has too much toxic burden from chemotherapy and radiation the immune system is either compromised or destroyed, hence the person can
succumb to various kinds of infections and complications.

10. Chemotherapy and radiation can cause cancer cells to mutate and become resistant and difficult to destroy. Surgery can also cause cancer cells to spread to other sites.

11. An effective way to battle cancer is to starve the cancer cells by not feeding it with the foods it needs to multiply.

WHAT CANCER CELLS FEED ON:

a.Sugar is a cancer-feeder. By cutting off sugar it cuts off one important food supply to the cancer cells. Sugar substitutes like NutraSweet, Equal,Spoonful, etc are made with Aspartame and it is harmful. A better natural substitute would be Manuka honey or molasses but only in very
small amounts. Table salt has a chemical added to make it white in colour. Better alternative is Bragg’s aminos or sea salt.

b. Milk causes the body to produce mucus, especially in the
gastro-intestinal tract. Cancer feeds on mucus. By cutting off milk and substituting with unsweetened soy milk, cancer cells are being starved.

c. Cancer cells thrive in an acid environment. A meat-based diet is acidic and it is best to eat fish, and a little chicken rather than beef or pork. Meat also contains livestock antibiotics, growth hormones and parasites, which are all harmful, especially to people with cancer.

d. A diet made of 80% fresh vegetables and juice, whole grains, seeds, nuts and a little fruits help put the body into an alkaline environment. About 20% can be from cooked food including beans. Fresh vegetable juices provide live enzymes that are easily absorbed and reach down to cellular levels within 15 minutes to nourish and enhance growth of healthy cells. To obtain live enzymes for building healthy cells try and drink fresh vegetable juice (most vegetables including bean sprouts) and eat some raw vegetables 2 or 3 times a day. Enzymes are destroyed at temperatures of 104 degrees F (40 degrees C).

e. Avoid coffee, tea, and chocolate, which have high caffeine. Green tea is a better alternative and has cancer-fighting properties. Water-best to drink purified water, or filtered, to avoid known toxins and heavy metals in tap water. Distilled water is acidic, avoid it.

12. Meat protein is difficult to digest and requires a lot of digestive enzymes. Undigested meat remaining in the intestines become putrified and leads to more toxic buildup.

13. Cancer cell walls have a tough protein covering. By refraining from or eating less meat it frees more enzymes to attack the protein walls of cancer cells and allows the body’s killer cells to destroy the cancer cells.

14. Some supplements build up the immune system (IP6, Flor-ssence, Essiac, anti-oxidants, vitamins, minerals, EFAs etc.) to enable the body’s own killer cells to destroy cancer cells. Other supplements like vitamin E are known to cause apoptosis, or programmed cell death, the body’s normal method of disposing of damaged, unwanted, or unneeded cells.

15. Cancer is a disease of the mind, body, and spirit. A proactive and positive spirit will help the cancer warrior be a survivor. Anger, unforgiveness and bitterness put the body into a stressful and acidic environment. Learn to have a loving and forgiving spirit. Learn to relax and enjoy life.

16. Cancer cells cannot thrive in an oxygenated environment. Exercising daily, and deep breathing help to get more oxygen down to the cellular level. Oxygen therapy is another means employed to destroy cancer cells.

trillian: superb messenger

May 26th, 2008 | No Comments | Posted in trillian by dreamluverz

My favorite messenger is currently developing it’s Astra version. I first heard about this ultimate messenger from my lover way back 2002 and from then on I fell inlove with trillian. As far as I know they’re the first one who had this kind of multi platform messenger. During those times there’s no meebo, pigdgin, miranda etc yet :P

This messenger is superb! The best! Yeah I know there are differences though with the original messenger like for instance on yahoo you can use this audible, photo sharing unlike on yahoo version of trillian but I don’t care the most important is I can use as many messenger I want in just one messenger(trillian). But comparing with other multi-platform messenger, nothing compares with trillian, I’ve tried most of them :P. I know time will come that they’ll be able to include those features on trillian :)

I’m really excited about this new version Astra. It’s on alpha testing yet. I’ll give you some glimpse about it. You can also checkout their site for more info http://blog.ceruleanstudios.com/

Build 79 is now available. This build fixes a large number of issues with the Jabber/Google Talk plugins and introduces MUC and file transfer support for Jabber. As a side effect of supporting these features, we’ve freshened up our support for x:data forms and exposed generic interface building routines within the Trillian Plugin API. We’ve also finalized our chat room browser API, as extensions to it were necessary in order to properly support MUC. Lastly, the Astra Contact editing tool has been cleaned up and finalized to fit better within the general profile editing experience. - trillian

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: ,