Monday, March 29, 2010

DNS issues with Netgear WGR614v5

Sooo... here's the story.

I keep getting stuck on "Resolving host" when browsing the web. I developed a simple test. Open 9 tabs at the same time and see which get through and which don't. My Godaddy sites never come through, and most of the time neither do Twitter and Blogger.

What's really going on? Since it was stuck on "Resolving host" I reverted to some manual nslookup debugging. Even nslookup showed "DNS request timed out", and "timeout was 2 seconds".

I then updated my local LAN card to use Comcast's server instead of relying on the router's ability to do lookups. No change.

Solution:
Convert UDP DNS requests to TCP!! It seems that this router gets overwhelmed by routing the DNS requests and drops them.

When this happens, the WGR614v5 loses the ability to resolve DNS for about 5 - 10 seconds. During this time, I tested a custom DNS lookup using both UDP and TCP. The UDP lookup failed, and the TCP lookup worked. This prompted me to write a simple server which listens for DNS requests, wraps the data with the customary 2 byte size header and sends it on as a TCP request. Once the response comes back, I remove the 2 byte size header from the response, and I send it back to the requester.

The router may have a general UDP problem, as opposed to a UDP DNS problem, but all I care about at the moment is my ability to get to my webpages. As HTTP is TCP and it just relies on the DNS requests to get the address, this solves my problem well enough for now.

A new router is being purchased in the next few days...

Friday, March 5, 2010

HTML stuff...

Never put a block-level element inside a paragraph :

...

! This is illegal in HTML 4.01 (http://www.w3.org/TR/html4/struct/text.html#h-9.3.1)

"The P element represents a paragraph. It cannot contain block-level elements (including P itself)."

---

IE8 - JSON works, but only if you have:

otherwise IE8's JSON object is undefined...

---

IE8 - eval function - Accepts string only, and should be enclosed in parenthesis! So if you are eval'ing an object then the object name is put in quotes. For example:

parse(jsonString) {
return eval('(' + jsonString + ')');
//return eval(jsonString); -- Illegal!
}

---

PHP - isset should be used to see if variable exists, also variable indexes and the like.
ie: isset(myObj['testExist'])); will return true if testExist exists and is non-null

---

Chrome and Safari (guessing it's a webkit issue) won't keep the text selected if you just use an onFocus callback with a text.select() call. You must cancel the mouseup event otherwise the text most of the time gets deselected. Argh