Showing posts with label Internet. Show all posts
Showing posts with label Internet. Show all posts

Monday, November 17, 2008

Track the Location of an IP Address

I found two free online tools for tracking the location of an IP address, which are pretty useful.
IP2Location
and
GeoBytes IP Locator
Read more!

Monday, November 10, 2008

Another Mobile Browser - Mozilla Fennec - under Alpha Testing

After Opera, Safari, IE Mobile, Chrome Mobile, we are welcoming another mobile browsers: Mozilla Fennec. Currently, it is still under alpha testing. Anyone are welcome to alpha test it. If you don't own a N810 Internet Tablets, you can still try it out on your desktop. I am more intested when this will go to Android OS powered phones like G1 and PSP, but there is no luck in the near future, because Fennec is not written in Java and Android does not support applications that run directly on the operating system itself without the need to be written in Java. I am hoping that Google will do the right thing and make a deal with Mozilla so that we can have Fennec soon on G1.

Here is the brief feature list and working UI for Fennec.
Read more!

Monday, November 3, 2008

My New Google Android G1 Phone

I just got the Android G1 phone from EBay, and the phone looks awesome. At the beginning, I opened the back cover with caution, and now I can open the back cover very quickly.

After begging for an activated TMobile SIM from one of my collegues, I was able to set up my G1 phone. After setting up the phone, I replaced the SIM with the unactivated TMobile SIM card coming with the phone, and I was able to use the Wi-Fi connection. So far, I only experienced G1 applications using Wi-Fi connections.

The browser on G1 is really amazing, and it renders a lot of pages that can't be loaded into the browser that is built into the BlackBerry.

There are several issues that concerns me:

  • I got a Bronze one and it is a little bit difficult to see the letter once the bakc light is on. So far, this is ok for me.

  • the GPS is not working very well. It is not very acurate and sometimes, it doesn't work

  • I can't manage to install G1 applications from Android Market. This really bothers me, because I am eager to try those applications.

  • ...


UPDATE: I was able to install G1 application from Android Market using Wi-Fi. I guess during the time when I tested, the network is not quite stable.

Read more!

Tuesday, October 14, 2008

Safari Fails to Include the Successful Controls in the Form Data Set

Another bug (you might need to have a Apple ID for accessing the link) for Safari!

<form action="fake_action" method="POST">
<button name="disable" value="Deactivate Account" type="submit" onclick="click();">Deactivate Account</button>
</form>

For the above form, the name/value pair for the submit button should be included in the data set when the form is submitted (i.e., the submit button is clicked). When I run the above form in Safari, the server app doesn't get
NAME         VALUE
disable   Deactivate Account

in the form data. However, if I remove the onclick event in the submit button control, the server app get the data I expect.

UPDATE:
Here is the link to the standalone test


it is a simple form with 4 different kinds of submit buttons, and here is the source code for the html page
<html>
<head>
<title>A simple form</title>
<script type='text/javascript'>
  function test(){
    document.forms[0].submit();
  }
</script>
</head>
<body>
<form action="formsubmit.php" method="POST">
<input name="disable1" value="Deactivate Account(submit button with onclick)" type="submit" onclick="test()">
<input name="disable2" value="Deactivate Account(submit button w/o onclick)" type="submit">
<button name="enable1" value="Activate Account(submit push button with onclick)" type="submit" onclick="test();">Activate Account(submit push button with onclick)</button>
<button name="enable" value="Activate Account(submit push button w/o onclick)" type="submit">Activate Account(submit push button w/o onclick)</button>
</form>
</body>
</html>


here is the source code for formsubmit.php, which simply print out the successful control sent to the server (any one of those submit buttons)
<html>
<head>
<title>Submit Form</title>
</head>
<body>
<?php

foreach ($_POST as $item) {
print $item;
}
?>
</body>
</html>


basically, I only get successful control for those submit buttons without onclick event handler, which does nothing, but call the form submit method in this test case, while I got all submit buttons in Firefox.

Read more!

Friday, September 5, 2008

What we can do with String.replace()

Here is the spec from Mozzila for String.replace().

The basic syntax for it is
var newString = str.replace(regexp/substr, newSubStr/function[, flags]);


It finds a match by either a regular expression or a string, and replaced it with the new string or the result of a function. For example,
var string = "hello world, user1 user";
var newString = string.replace("user", "thunder planet");
//the newString is "hello world, thunder planet1 user
var newString1 = string.replace(/user$/, "thunder planet")
//newString1 is "hello world, user1 thunder planet


The replacement string can include those special patterns
  • $$ -- a '$'
  • $& -- the matched substring
  • $` -- the portion of string that precedes the matched string
  • $' -- the portion of string that follows the matched string
  • $n -- if the matched string is specified using a regular expression, it gives the group in the regular expression


Please see the following examples:
var string = "hello world user"
var newString = string.replace("user", "$$");
//newString is "hello world $"
var newString1 = string.replace("user", "$&");
//newString1 is the same with string
var newString2 = string.replace("user", "$`");
//newString2 is "hello world hello world"
var newString3 = string.replace("user", "$'");
//newString3 is "hello world "
string = "Hello, John Smith";
var newString4 = string.replace(/(\w+)\s(\w+)$/g, "$2,$1")
//newString4 is "Hello, Smith,John"


The definition to the replacement function depends on whether you are using regular expression and how many groups are in the regular expression. Basically, the replacement function is in form of
function replacer(str, p1, ..., pn, offset, s)

The first parameter is the matched string, and the following n (n can be zero) parameters represent the groups in the regular expression, offset is the offset for the matched string, and the last parameter is the whole string.

function replacer(str, p1, p2, offset, s){
return "{" + str + "/" + p1 + "/" + p2 + "/" + offset + "/" + s + "}";
}

function replacer1(str, p1, offset, s){
return "{" + str + "/" + p1 + "/" + offset + "/" + s + "}";
}

"XXzzzz---Xz--XXzzz".replace(/(X+)(z+)/g, replacer)
//result is "{XXzzzz/XX/zzzz/0/XXzzzz---Xz--XXzzz}---{Xz/X/z/9/XXzzzz---Xz--XXzzz}--{XXzzz/XX/zzz/13/XXzzzz---Xz--XXzzz}"
"XXzzzz---Xz--XXzzz".replace(/(X+z+)/g, replacer)
//result is "{XXzzzz/XXzzzz/0/XXzzzz---Xz--XXzzz/undefined}---{Xz/Xz/9/XXzzzz---Xz--XXzzz/undefined}--{XXzzz/XXzzz/13/XXzzzz---Xz--XXzzz/undefined}
"XXzzzz---Xz--XXzzz".replace(/(X+z+)/g, replacer1)
//result is "{XXzzzz/XXzzzz/0/XXzzzz---Xz--XXzzz}---{Xz/Xz/9/XXzzzz---Xz--XXzzz}--{XXzzz/XXzzz/13/XXzzzz---Xz--XXzzz}"
"XXzzzz---Xz--XXzzz".replace("Xz", replacer1, "g")
//result is "X{Xz/1/XXzzzz---Xz--XXzzz/undefined}zzz---{Xz/9/XXzzzz---Xz--XXzzz/undefined}--X{Xz/14/XXzzzz---Xz--XXzzz/undefined}zz"
"XXzzzz---Xz--XXzzz".replace(/X+z+/g, replacer1)
//result is "{XXzzzz/0/XXzzzz---Xz--XXzzz/undefined}---{Xz/9/XXzzzz---Xz--XXzzz/undefined}--{XXzzz/13/XXzzzz---Xz--XXzzz/undefined}"

So the replacement function depends on the first argument in the String.replace function.

Read more!

Wednesday, September 3, 2008

Web on PSP

Here are several article discussing the web development for PSP
Web design for the Sony PSP
What Browser Does the SONY PSP Use?

The big issue with the browser on PSP is lacking support of DOM and AJAX. For example, it doesn't support innerHTML or document.createElement/document.appendChild. The only thing it supports is document.write. There is no support of XMLHttpRequest object either. It only supports flash 6, which is also disappointing.
Read more!