simple singularities

jquery problem: click event not fired in ff3, ubuntu

Filed under: firefox, javascript, programming — fri13th September 11, 2008 @ 12:26 pm

i turned off cookie and test as if ff is mobile browser.
and at the same mode, i develop some web page.

then jquery’s click event doesn’t work. i don’t know why it does..
so i turned on cookie and my js program works fine.
and that’s all.. there are too many mysteries in the browser.

jQuery work around

Filed under: javascript, programming — fri13th September 6, 2008 @ 1:32 pm

i developed some code using jQuery. and sometimes fadeIn doesn’t work and i don’t know why. so i google it and find some answer..

http://www.nabble.com/Odd-JQuery-behavior-in-FF-td17735413s27240.html

1
body { -moz-opacity: 0.9999; }

looks wierd. is it a ff3 bug or jQuery bug? i can’t say..

ok, this is my first obstacle, but i think i will use jQuery as my primary javascript framework. this is simple and has a lot of functions i want. i have to rewrite all my prototypejs code to jQuery. it will take some time but worth it.

my plan to make another javascript framework will not be fulfilled in this year. i feel sad about that. but to develop jquery, it’s another chance to promote my will. and maybe i can release mine in next year or so, hopefully..

javascript multiline match

Filed under: javascript, programming — fri13th July 24, 2007 @ 12:04 pm

javascripts’s . (dot) doesn’t match line boundary. so if you want match all strings in a multiline string, you should use [^]* instead normal .*  multiline flag ‘m’ is useless in this case.

it’s a small tip, but perl programmer like me doesn’t understand this behavior.. gee..

below is regex test page, i found today from ajaxian. cool,  but you have to be be cautious. it easily sutdowns the browser, when you testing this syntax /.*/g or so.
http://erik.eae.net/playground/regexp/regexp.html

P.S. unfortunately [^] doesn’t work in IE.. use [\s\S] instead, it works very fine..

fabtabulous

Filed under: javascript, programming — fri13th July 3, 2007 @ 2:31 pm

a cool tab solution using prototype.. i customize it for my personal project..

http://tetlaw.id.au/view/blog/fabtabulous-simple-tabs-using-prototype/
there are a lot of obscure things in javascript, so actual working-source is very helpful to newbies.. (I can’t understand the exact difference of Enumerable and Array)

building scalable web sites

Filed under: flickr, java, javascript, web2.0 — fri13th January 16, 2007 @ 3:22 pm

Building Scalable Web Sites: Building, Scaling, and Optimizing the Next Generation of Web Applications

the author of this books is the main developer of flickr, the most famous site in the world. i’m very fond of flickring way, i also love this book. the main topic is creating large scale service with php, mysql, apache, etc.. everybody want to know about it, but there’s so few book for that.

there’re full of great topics i’ve wanted to know. from i18n, security to network, db tuning.. i learned much and i’ll apply those to my next projects. thanx, handerson!

iphone & unobstrusive html

Filed under: apple, javascript, web2.0 — fri13th January 10, 2007 @ 11:12 am

as a mac user i see the anticipated iphone today. it’s a fantastic machine though somewhat expensive. it has an embedded safari browser, so i can see every normal site for pc through it. but it’s no surprise, in japan.  full browser support phone was sold since 2005 in this country.

my main job was related to the japan mobile market. so i aware the importance of unobstrusive web technique very early. where the mobile  technology  goes  advance, also old-fashioned html technique needed more. like bitmap graphic technique is needed in mobile game in this 3D Game age.

so, iphone will be prevailed in america and world-wide sooner or later. many competitive phones embedded brower will be available everywhere. and you know there’re more and more phones than pcs in the world. and that time, browser market share will be changed drastically. especially big fat ie will not be the major browser any more. i can’t even assure the position of firefox. safari or opera or customed browser(i.e. vodafone browser, docomo browser, qualcomm browser) who targeted mobile market from early days will be the champion of next browser war.

i thinks  it takes not so long time. as a web developer, we have to prepare sites for the limited resources. well-tuned tags & unobstrusive javascript and css support for small window and slow traffics. cookie may be unavailable, also. we have to focus on every html component, check every componenet is unobstrusive, not only javascript.

javascript the definitive guide

Filed under: book, javascript — fri13th December 28, 2006 @ 9:38 am

JavaScript: The Definitive Guide

totally great! full of insights, but not for novice programmers. i knew the 4th edition published in 2001 was too out-of-dated in this ajax age,  so it didn’t attract me a little bit. but i heard the 5th published in this August, 2006, and its reviews were great. so i decide to buy it.

i give 5 stars to this lovely book!

about firebug debug mode

Filed under: javascript, programming — fri13th December 27, 2006 @ 12:52 pm

debug codes in firebug cause some critical error in other browsers like ie. and you know  debug codes in a published product aren’t desirable at all. so i think you need this peice of code. so even if you forget to remove all debug codes, no serious error occurs!

__DEBUG__ = true;
__DEBUG_FORCE__ = false;

if (__DEBUG_FORCE__ && typeof console == ‘undefined’) {
    console = {
        log : alert,
        debug : alert,
        info : alert,
        warn : alert,
        error : alert
    };
}
else if (!__DEBUG__ || typeof console == ‘undefined’) {
    console = {
        log : function () {},
        debug : function () {},
        info : function () {},
        warn : function () {},
        error : function () {}
    };
}

so you feel somewhat safe, just like me :-) anyway firebug is great tool! it’s a mandatory not recommend!

ajax cache problem

Filed under: javascript, programming — fri13th December 25, 2006 @ 10:50 am

if cache is on, you always get a same result on a same url request. it’s somewhat  undesirable. there exist some strategies for this.

1. use ‘post’ instead ‘get’
browsers usually cache get request, especially IE. but sometimes post will be cached too. you must be careful when you think about supporting as many browsers as you can.

2. add unique parameters that make url unique.

url += ((url.indexOf("?") +1) ?  "&" :  "?" )+ "_d=" + new Date().getTime();

or

url += ((url.indexOf("?")+1) ?  "&" :  "?") + "_r=" + Math.random();

3. add cache-control to http request header
this code is different by the type of cgi language you use
below is a php sample code

header(’Content-Type: text/html; charset=iso-8859-2′);
header(’Last-Modified: ‘.gmdate(’D, d M Y H:i:s’).’ GMT’);
header(’Expires: Thu, 19 Nov 1981 08:52:00 GMT’);
header(’Cache-Control: no-store, no-cache, must-revalidate’);
header(’Cache-Control: post-check=0, pre-check=0′, false);
header(’Pragma: no-cache’);

4. add cache-control to meta tag
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
<META HTTP-EQUIV="EXPIRES" CONTENT="0">

1 & 2 are surely enough for my purpose till now :-)
is there any more? please notify me~

firebug 1.0 beta

Filed under: firefox, javascript, programming — fri13th December 21, 2006 @ 9:33 am

actually, i’m not willing to recommend it, because it’s in beta state, somewhat unstable.. but i found it very useful or maybe i can say powerful than ever, so i post this article.

you can get it from http://www.getfirebug.com/

i could hardly image the web development without firebug, it’s only few weeks ago..

P.S. i got an lesson(you know my last post), even most great tools can’t make people smarter. if you’re fool, debugging time spent will be same whatever your tool is.. so in any case, don’t blame this splendid tool..

Next Page >>>