Showing posts with label JavaScript-CSS-DOM. Show all posts
Showing posts with label JavaScript-CSS-DOM. Show all posts

Sunday, May 03, 2009

JavaScript gotcha Overloading

Gotcha đơn giản là "got ya" , nghĩa là "Tóm được rồi", như khi bạn bắt được ai đó trong 1 trò chơi. Còn trong lập trình (programming, in other words "thảo chương") thì Gotcha được dùng với nghĩa tương tự: 1 feature ngoài mong đợi (unexpected) , thậm chí đi ngoài cả specs, mặc dù thường không được coi là bug.

Thường các gotcha lập trình này cần phải có nhiều kinh nghiệm mới phát hiện được (hoặc nhờ đọc bài viết của người có kinh nghiệm, hehe) . Nếu bạn đã từng trải qua hàng đống giờ dò lỗi (debug) vì 1 gotcha nào đó, thì hẳn sẽ rủa "mấy tay nào đó" làm cái chức năng ngớ ngẩn làm mất bao nhiêu công sức của mình. Do đó nếu có thời gian cũng nên xem thử các gotcha liên quan đến công việc của mình, phòng khi gặp trường hợp như trên.


JavaScript thì theo tôi biết có khoảng 15 gotcha dễ gặp, và overloading sẽ là gotcha đầu tiên trình bày ở đây.

(to be cont)

Sunday, April 19, 2009

XPath quick notes

The most useful path expressions to select nodes:


Expression Description
nodename Selects all child nodes of the named node
/ Selects from the root node
// Selects nodes in the document from the current node that match the selection no matter where they are
. Selects the current node
.. Selects the parent of the current node
@ Selects attributes


XPath wildcards to select unknown XML elements.


Wildcard Description
* Matches any element node
@* Matches any attribute node
node() Matches any node of any kind


XPath axes defines a node-sets relative to the current node.


AxisName Result
ancestor Selects all ancestors (parent, grandparent, etc.) of the current node
ancestor-or-self Selects all ancestors (parent, grandparent, etc.) of the current node and the current node itself
attribute Selects all attributes of the current node
child Selects all children of the current node
descendant Selects all descendants (children, grandchildren, etc.) of the current node
descendant-or-self Selects all descendants (children, grandchildren, etc.) of the current node and the current node itself
following Selects everything in the document after the closing tag of the current node
following-sibling Selects all siblings after the current node
namespace Selects all namespace nodes of the current node
parent Selects the parent of the current node
preceding Selects everything in the document that is before the start tag of the current node
preceding-sibling Selects all siblings before the current node
self Selects the current node

Sunday, March 29, 2009

XMLHttpRequest quick notes


interface XMLHttpRequest {
// STATE
attribute int readyState; // readonly
attribute EventListener onreadystatechange;

const unsigned short UNSENT = 0; // innerHTML == "uninitialized"
const unsigned short OPENED = 1; // innerHTML == "loading"
const unsigned short HEADERS_RECEIVED = 2; // innerHTML == "loaded"
const unsigned short LOADING = 3; // innerHTML == "interactive"
const unsigned short DONE = 4; // innerHTML == "complete"

// REQUEST
void open(DOMString method, DOMString url, boolean async);
void open(DOMString method, DOMString url, boolean async, DOMString user, DOMString password);

void setRequestHeader(DOMString header, DOMString value);

void send(in DOMString data);
void send(in Document data);

void abort();

// RESPONSE readonly
attribute Document responseXML;
attribute DOMString responseText;
attribute int status;
attribute DOMString statusText;

DOMString getAllResponseHeaders();
DOMString getResponseHeader(in DOMString header);
};

Friday, February 06, 2009

Aptech VN books

Dưới đây là link tải bộ ACCP 7.1 , tài liệu chính mới nhất của các học viện Aptech VN, được chia thành 17 phần :

http://www.mediafire.com/?gme9tgtyttz
http://www.mediafire.com/?t1y1tzo3zcm
http://www.mediafire.com/?ugg0hmycgcf
http://www.mediafire.com/?xovz2x1n0wm
http://www.mediafire.com/?wx9mbtmfomg
http://www.mediafire.com/?2gtbheelyau
http://www.mediafire.com/?zynv4jdxyym
http://www.mediafire.com/?mw1obhzmtky
http://www.mediafire.com/?lyzbly0syrl
http://www.mediafire.com/?dnn11m2r2ke
http://www.mediafire.com/?mnkymd9pwfm
http://www.mediafire.com/?k3y240jxngn
http://www.mediafire.com/?kwdgemmx4mm
http://www.mediafire.com/?nf2fmde9zmp
http://www.mediafire.com/?m0hnmymzjrw
http://www.mediafire.com/?jm3m2y3wily
http://www.mediafire.com/?xnscysmmzbm


Mirror:

http://www.adrive.com/public/eebc6d67f5f41b225e22ae26cfbe14044dd2fbce9e50e62b56c86a5736eadc94.html
http://www.adrive.com/public/6a892301907e9a9604289e9dc39e304ef7932e5340e24f57f30f1670936c6b7a.html
http://www.adrive.com/public/af7c3c712b07af12581156445ee3145e3544bdf1b830c9da3e0a9d81f5d7beb7.html
http://www.adrive.com/public/f3d21fb5cfb9ca0a2f8b817a03cfd237c5a9ec49764d77a688bc496b97717e7e.html
http://www.adrive.com/public/272fc5bf56f86f758d391f5a8aff4fb756edf02cddd81db306ae2f31c4eb05c1.html
http://www.adrive.com/public/aa399b353659d62a371c2cb24239828d97b3472bbfd4e7f6ab2c4bccfbf8661a.html
http://www.adrive.com/public/7b1b91da3e2bac6f57817c380a4cd9a6000843f11964fc9fa8a2fce5ac696fb2.html
http://www.adrive.com/public/1c75d1c3ed7401789ec4b73b9e8a882e0d9ca6aa0c4e702503b7a197444eabbc.html
http://www.adrive.com/public/3ed3877ff7210661a6c6e244ad309a864154e08921b631064bc0f6961e933f09.html
http://www.adrive.com/public/69ad9df24493ecf48e8de0a69993fed072b308e289738f37be9dc2a5e70c7823.html
http://www.adrive.com/public/eafc4f6927d8e70a27d850c219bf7c56e1ccbb38928aa8e5e26c23b34a6b41e1.html
http://www.adrive.com/public/7ea9dfc164db0776ad58a7c3dae145f8629ccb435d53e52eac831f41c6d2b041.html
http://www.adrive.com/public/c12e3a1a5fa492d539eb03112ba2126d2ae740010bfcda6c3e81611d08f1246a.html
http://www.adrive.com/public/5653d968b8dc6d8c04e13ac444e14d136400bad4273465e4f87a89517050dab0.html
http://www.adrive.com/public/ce93f7afc7d9d4b414566bbe0ae30e7011191b1d338eff2e4f9b1d434029230a.html
http://www.adrive.com/public/ca2ad64261bf802a48bb30372c514759c78e01d1d0aa8931acc148b6e9f64dec.html
http://www.adrive.com/public/411be0801872549d82132ccd3bcf6332fedec4b2d65f4bf4ff8bfd5d9b850e88.html


Mirror 2:

http://www.mediafire.com/?gxzjaeggvos
http://www.mediafire.com/?1odw3omydoi
http://www.mediafire.com/?mybbnhhoncx
http://www.mediafire.com/?tvfeobyvvny
http://www.mediafire.com/?lvmwinrzwnv
http://www.mediafire.com/?kpmdutjl6nv
http://www.mediafire.com/?wwymtmhptbs
http://www.mediafire.com/?i0vlsxmzsz3
http://www.mediafire.com/?bmtxybxpim1
http://www.mediafire.com/?wrirfuhdjrd
http://www.mediafire.com/?wvrt2mynmbz
http://www.mediafire.com/?zzbbbydjocz
http://www.mediafire.com/?zerbnfubfyh
http://www.mediafire.com/?pmfrlx3ztiq
http://www.mediafire.com/?xyvgbnoyh0y
http://www.mediafire.com/?w4zr6m0eaiw
http://www.mediafire.com/?0gnwqcm5zqm


Enjoy !

Friday, December 12, 2008

Javascript Libraries Overview

Từ khi những thuật ngữ như AJAX hay RIA xuất hiện, Javascript đã được phát triển mạnh và hình thành các thư viện, hay cũng có thể gọi là các framework để hỗ trợ ứng dụng web.
Hiểu biết về JavaScript đã trở thành 1 skill không thể thiếu với những ai làm lập trình web, và cũng là 1 skill khá quan trọng của các hacker. Tuy nhiên với web-development hiện nay thì lời khuyên là bạn nên nắm vững 1 thư viện nào đó, hơn là đi tìm kiếm các đoạn script mẫu ngắn phục vụ cho 1 mục đích nào đó.

Các thư viện JS mã mở và hữu ích hiện nay có thể kể: jQuery, mooTools, Prototype + Scriptaculous, YUI + ExtJS , Dojo, ...

(ngoài ra còn 1 số công nghệ JS có cả phần server side như : qooxdoo, echo2, GWT, DWR, jMaki, Qcodo, AjaxCFC, ... )



Dưới đây là 1 slideshow so sánh cơ bản các thư viện JS trên để bạn có thể chọn cho mình 1 cái phù hợp :



Have fun :D !

Wednesday, October 08, 2008

Vietnamese Typing

Vấn đề về gõ tiếng Việt, mã hóa Vietnamese Unicode, đối với tôi vẫn là đề tài khá thú vị. Nếu có điều kiện tôi sẽ viết nhiều hơn về đề tài này. Còn trong bài này chỉ xin giới thiệu sơ lược về các bộ gõ tiếng Việt .


Ở đây chỉ xét các ứng dụng trên máy vi tính phổ biến, còn trên các nền mobile hoặc chuyên biệt thì tạm thời chưa xét vì... chưa phát triển mấy :-) .


* Bộ gõ độc lập (standalone application) trên Linux và *BSD:
+ xvnkb của Đào Hải Lâm
+ x-unikey của Phạm Kim Long


* Bộ gõ độc lập (standalone application) trên MacOS:
+ VietPad của Nguyễn Quân (actually this is a text editor written in Java/.NET, so it can also be used in other platforms)
+ Vietnamese Keyboard Set của Gero Herrmann
+ MacVnKey của Ngô Đình Học


* Bộ gõ độc lập (standalone application) trên Windows: có khá nhiều lựa chọn
+ UniKey của Phạm Kim Long
+ WinVnKey của Nguyễn Tấn Cường, Nguyễn Thư, Ngô Đình Học et al
+ DotNetKey của Bùi Đức Tiến
+ Key4U của Nguyễn Anh Tuyên
+ VPSKeys của Ngô Đình Học et al

Ngoài top 5 kể trên còn có VietKey của Đặng Minh Tuấn, VietSpell của Lưu Hà Xuyên, mVietX của Phạm Sơn, VNCode của Nguyễn Thư, ...


* Bộ gõ JavaScript (web-based application) trên các trình duyệt: cũng khá phong phú
+ Mudim của Nguyễn Hoài Anh
+ A.V.I.M (tên cũ: H.I.M) của Đặng Trần Hiếu
+ mViet của Phạm Sơn
+ vietUni của Trần Anh Tuấn
+ vietTyping của Nguyễn Thắng

Ngoài top 5 kể trên còn có CH.I.M của Đào Hải Lâm, B.I.M của Sơn, VietJIE của Âu Địch Xương, VoviUnicode của Lý Phúc Hiếu, ... và vài bộ gõ tự viết dùng cho cá nhân
( các bộ gõ JS này hoàn toàn có thể làm thành 1 extension cho FireFox hoặc ThunderBird )


Bài đã khá dài nên phần về các kiểu gõ tiếng Việt (VNI, Telex, VIQR, TuBinhTran) sẽ được tách ra thành 1 entry khác .

Saturday, October 04, 2008

Blogspot CSS customization

Some important meta-tags and CSS selectors in Blogspot template:


.
.
.
include data='blog' name='all-head-content'
. . .
#header-wrapper {
text-align: $startSide;
. . .
#main-wrapper {
margin-$startSide: 1%;
width: 64%;
. . .
#sidebar-wrapper {
margin-$endSide: 1%;
width: 29%;
. . .
.date-header {
font-size: 100%
font-weight:
font-family:
. . .
.post {
margin: 0 0 1.5em;
. . .
.post-title {
font-size: 125%;
line-height: 1.1em;
. . .
.post-title a, .post-title a:visited, .post-title strong {
color: $textColor;
. . .
.post div {
font-size:
margin: 0 0 .75em;
. . .
#comments-block dd p {
background-color:
padding:
.
.
.


Well, good enough ? Looks like I have a neat Web 2.0 blog now !

Tạm thời nhiêu đó đã, còn một số cách để tăng views và PageRank sẽ trình bày sau ^o^ .
.
.