Free Online Books

Thousands of e-books

Advertisements

HTML DIV Diagram every web2.0 coder should have

ScrollHeight or ClientHeight? Positioning is always tricky and it seems like there is a million different javascript variables for locations and positions. Well here is a great summary of which variables to use. This is for IE but most work identical in firefox.

read more | digg story

Ajax(XmlHttpRequest) versus IFrame

good discussion comparing XHR and IFrame implementation…
http://ajax.sys-con.com/read/188390.htm
http://www.phpclasses.org/blog/post/51-PHPClasses-20-Beta
-AJAX-XMLHttpRequest-x-IFrame.html

Tweak To Get Yahoo Mail Beta

To get Yahoo Mail Beta, just switch your content preference to Germany, France or UK. Then you will be asked if you want to join the beta when you log into your Yahoo Mail. Say yes, and join the beta. Then from the options menu, change your content preference what it was before. Then go to Yahoo Mail again. You should see Yahoo Beta. If you don’t see it, go to options and click “Try Beta” button. That’s all.

How to change your content preference:

* log in to Yahoo Mail
* click Options
* select Account information from the left panel
* go to Member Information, General Preferences, Preferred Content
* select, for example, Yahoo UK
* click Finished
* go to Yahoo Mail
* you’ll see a page that says “It’s the New Yahoo! Mail Beta… and you’re invited.”
* click on “Try Beta Now”.

A Simple CSS Image preloading technique

A Simple CSS Image preloading technique

So you need to pre-load images, but don’t want to deal with javascript or complicated workarounds. What do you do? The solution is simple. All we need to do is designate a CSS style with multiple background-images. As your browser reads the style, it will load each image you designate in succession, thus pre-loading your images. Below is an example of the CSS:

#preloadedImages {
width: 0px;
height: 0px;
display: inline;
background-image: url(path/to/image1.png);
background-image: url(path/to/image2.png);
background-image: url(path/to/image3.png);
background-image: url(path/to/image4.png);
background-image: url();
}

The next step is to load this div in your page. This is accomplished by inserting

once in the body of the page you are preloading these images. Now you can reference them anywhere on your page (rollovers, alternate image states, etc.), and the image will load instantly from cache.

Cheat sheet n tweaks for MySQL

Interesting one.–
TIP 3:

Can the order of the columns in a create statement make a difference? YES

create table t (
a int,
b int,
timeUpdate timestamp,
timeEnter timestamp );

The first timestamp will always be the “automatically generated” time. So
if the record is updated, or inserted, this time gets changed. If the
order is changed, “timeEnter” is before “timeUpdate”, then, “timeEnter”
would get updated. First timestamp column updates automatically.

Note, in the table above timeEnter will only get updated if passed a null
value.

insert into t (a,b,timeEnter) values (1,2,NULL);

Hints: Need mm-dd-yyyy hh:mm:ss format?

select a,b,DATE_FORMAT(timeUpdate,’%m-%d-%Y %T’),DATE_FORMAT(timeEnter,’%m-%d-%Y %T’) from t;
+——+——+—————————————+————————————–+
| a | b | DATE_FORMAT(timeUpdate,’%m-%d-%Y %T’) | DATE_FORMAT(timeEnter,’%m-%d-%Y %T’) |
+——+——+—————————————+————————————–+
| 3 | 2 | 04-15-2004 19:14:36 | 04-15-2004 19:15:07 |
| 3 | 2 | 04-15-2004 19:14:39 | 04-15-2004 19:15:07 |

Xtending the innerTEXT cross-browser funcationality

I had this problem… since IE browser already supports innerText property when
I add the innerText as the prototype method as mentioned in my prev. post it creates
problem.
So to get around this issue… v need to check if the browser is IE or not and then
apply the java script EVAL method on the prototype accordingly…otherwise it sux…

Herez the code:

var is_ie = (navigator.userAgent.indexOf(‘MSIE’) >= 0) ? 1 : 0;
var is_ie5 = (navigator.appVersion.indexOf(“MSIE 5.5”)!=-1) ? 1 : 0;
//alert(is_ie5 + “\n” + is_ie);

var prescript = “if(typeof HTMLElement!=’undefined’){“;
prescript += “HTMLElement.prototype.innerText getter = function(){“;
prescript += “var tmp = this.innerHTML.replace(/
/gi,\”\\n\”);”;
prescript += “return tmp.replace(/]+>/g,”);”;
prescript += “}; “;

prescript += “HTMLElement.prototype.innerText setter = function(txtStr){“;
prescript += “var parsedText = document.createTextNode(txtStr); “;
prescript += “this.innerHTML = \”\”; “;
prescript += “this.appendChild( parsedText );”;
prescript += “};”;
prescript += “}”
//alert(prescript);
if( is_ie == 0 && is_ie5 == 0)
{
eval(prescript);
}