According to amachang, the code below accerelates JavaScript on IE 5 folds.
http://d.hatena.ne.jp/amachang/20071010/1192012056 (Japanese)
/*@cc_on _d=document;eval('var document=_d')@*/
He claims that
var doc = document;
doc; // this one is faster
document; // than this
And the trick above does just that.
This is more of a bad know-how than a hack but it is worth mentioning.
FYI I am a Firefox user, with occasional Safari so I did not verify his claim. Anyone?
Dan the J(avaScript)?er
Write m articles titled "n way to make your w not suck".
Extra Credit: find m and n for each w.
Dan the Blog Borer
I found this one easier to respond in English so I'm writing this in English first. Japanese Translation should follow eventually.
My Life Between Silicon Valley and Japan - 海外に住んでも母国語中心に生きること
「グローバリゼーションが進むと英語の必要性が増すとよく言われるけど、逆に日本語だけ使えれば、どこにいても日本人と助け合いながら、日本人とだけ付き合いながら何とか日本語だけで生きていけるという感覚が、これから強まっていくのかもしれませんね」とでも返答していたら、どう話は発展していただろう。そうふと思った。
[Rough Summery]
That had been true before the Net; I saw so many Japanese stayed out of English in the U.S. a quarter century ago. There were already phones (not mobile, though). But Mochio's got a point. The Net made it easier than ever.
So many believe the more globalization goes the more English skill is needed. But that many not be true if you are already able to speak such languages as Japanese where you can find other Japanese speakers on the Net, keep connected to them, and stay out of English.
That had been true before the Net; I saw so many Japanese stayed out of English in the U.S. a quarter century ago. There were already phones (not mobile, though). But Mochio's got a point. The Net made it easier than ever. To get a Mixi account (the most popular SNS in Japan), you need to be invited but the invitation can go wherever IP goes. Mochio said 5,000 Mixi users actually live in Silicon Valley. If they will they have no need to find NEW local friends in Japanese. Missed Japanese flicks? Just go YouTube. If YouTube does not give you your favorite Anime, you can BitTorrent them.
Yes, it is much easier to live NOT learning local languages so long as you have a mother tongue. In a way you are freer to choose where to live. But you are more strongly bound to the first language you encountered. I'm not sure if it is worth calling freedom.
Some say constraints make you free. By limiting something you get more degree of freedom in something else. Seems like that's what happened billions of years ago to us -- life. There are billions, if not trillions, of species but they are all encoded the same way; RNA-DNA-Protein logic. This lack of diversity really strikes me.
The same thing might happen to our language; If four letters -- ACTG -- suffice to spell every single life, why do we need so many languages to spell OUR life? I have no idea how many millions of years were needed for the Codon Unification but if the Tongue Unification happens, that will not take that long.
Any many people believed -- feared -- that the Net accelerate the process. But Mochio has raised the counterexample. So long as a language community is big enough to keep its members happy, they have little -- less ! -- incentive to learn foreign language. Tribal languages like Ainu has been taking hard beatings because the gene pools of these languages are too small to survive but languages like Japanese seem alive and kicking.
So I wonder the size of the critical mass of a language. How many speakers are needed to sustain a language? The figure looks like somewhere between 50 to 100 million. If your language is smaller than that, it will no longer be self-sufficient. Isn't that interesting the smaller the nation in EU is, the more fluent in English her people are? They are fluent in English because their mother tongues don't suffice. You need English to learn science and engineering, for instance.
You may not believe this but that's not true for Japanese. You can graduate from a college without being able to speak English. Well, English is compulsory but that does not mean they speak English. English is Japan is something like Quadratic formula; You learn when when you are 14 or 15 or so but you hardly ever use it when you are grown up. It helps you look more competent and your resume looks shinier if you speak English. But that's about it. Learning English seems to give them too much pain for too little gain.
But if the gain is larger, it will be worth taking the pain. That's what English advocates are saying and that's why so many Japanese are paying so much time and so many yen to learn it. Paying so much they often forget the very reason for what they are doing. Looks like so many people are learning English just for the sake of English. But if you find English does not bring you the promise your English teacher makes you believe, will you still keep on learning English?
I don't know. What I know is neither language gives me enough. I needed to both to make myself what I am. I need both of them now and I believe I will need both of them till I pass away to where I need no language at all. I'm glad I can speak both, though I am not quite fluent in either.
Dan the Nullingual.
Whoa!
miyagawa's comment on VOX vs. Javascript - 404 Web 2.0 Not Found
Vox Beta Testing: Embedding - Team VoxJust wanted to let you know in the previous release, we added new embed feature for beta testers (you can roll in your beta account in the account page) to enable 'Embed' button, to add arbitrary HTML to the content, even JavaScript. Enjoy.
Let me try!As we've mentioned before, there is a way to opt in to test new Vox features before they are released. Your testing and feedback help us make tweaks and changes before we roll out the features to the entire Vox community.
It works! Excellent!
Dan the JavaScripting Voxer
We call'em URIs, uniform resource identifiers. But those days some pages have too many identities.
Pick Amazon They all refer to the same page.
- http://www.amazon.com/exec/obidos/ASIN/0441790348
- http://www.amazon.com/exec/obidos/ASIN/0441790348/blogsofdankog-22
- http://www.amazon.com/dp/0441790348
- http://www.amazon.com/dp/0441790348?linkcode=as2&tag=blogsofdankog-22
But when you google it. This is the only URI that hits.
Wow. how does google converge potentially infinite number of URIs into one?
No forks. It's amazon that does.
You can grok by yourself if you have perl and LWP installed.
% GET -Se 'http://www.amazon.com/dp/0441790348
http://www.amazon.com/dp/0441790348' | head GET
http://www.amazon.com/dp/0441790348 --> 301 MovedPermanently
GET http://www.amazon.com/Stranger-Strange-Land-Robert-Heinlein/dp/0441790348 --> 200 OK
Connection: close
You see the redirect? That's what Amazon does. But you don't notice on your browser. Why? Because Amazon treats webbots differently from you.
% GET -Se -H'User-Agent: Mozilla/5.0' 'http://www.amazon.com/dp/0441790348' | head
GET http://www.amazon.com/dp/0441790348 --> 200 OK
Connection: close
% GET -Se -H'User-Agent: Googlebot/2.1' 'http://www.amazon.com/dp/0441790348' | head
GET http://www.amazon.com/dp/0441790348 --> 301 MovedPermanently
GET http://www.amazon.com/Stranger-Strange-Land-Robert-Heinlein/dp/0441790348 --> 200 OK
If you are a human, Amazon gives you as many URIs as you like for the same URI so long as it contains the same ASIN. If you are a webbot, Amazon takes you to the only one URI for each ASIN. Clever.
But Why http://www.amazon.com/Stranger-Strange-Land-Robert-Heinlein/dp/0441790348, not http://www.amazon.com/dp/0441790348, the shortest possible URI which is easier for both Earthlings and Martians to remember?
SEO.
This is what you'd see when you googled for Stranger in a Strange Land.
See the green letters in Wikipedia and Amazon. See how search words are shown in bold. Yes. search engines search not only its contents but also its URI. And URI's priority is high. Very high.
That explains why Wikipedia and Amazon hits so well on searches. With Wikipedia, keywords appear naturally in its URI (for wiki's sake). And you just witnessed what Amazon is doing.
Though clever and working for search engines, It's now us humans who needs URIs that really identifies the resource, not just letting us access. Take del.icio.us. You'll see my point if you check
Yes. two bookmarks for exactly the same content. Don't you think it sucks? I grokked what is going on but I don't want to keep swallowing it. Those laissez-faire links should be called URAs, Universal Resource Accessors. They'll get you to where you want but they don't quite identify themselves. If you call it URI, it should identify! In other words, permalinks.
With Web 2.0 permalink is ever more important. Giving as many URAs as you want for each URI is fine so long as it tells its permalink. And that is supposed to be trivial and easy. On HTTP layer we already have Content-Location: (but maybe not a good idea because Content-Location: is also used in conjunction with content negotiation). On HTML layer we already have the LINK tag. All we need is rough consensus on how to present the REAL URI -- or permalink -- of given URAs.
Dan the User Agent Agent
If you can read Japanese, see also:
I wrote a mail to twitter gateway. Here is how to use it
- Get the perl script below and chmod +x
- set your .forward, .qmail, .procmailrc or whatever so the mail gets redirected to the script above.
|preline /path/to/twitter-mgw
I use qmail so I set .qmail-secret as above, with dankogai-secret@ being the gateway mail address. Do not publish this e-mail address or someone else may twitter for you. Some principle as moblog applies here.
The gateway script checks SPF for sender forgery but your impersonator may be on the same domain.
- Set
~/.twitteras follows. The file is in YAML format. Make sure you chmod 0600~/.twitter
email: you@example.com # whatever address you are twittering with
pass: your_password
mgw:
valid_from: # specify your mail addresses here
- you@example.com
- you-whatever@mobile.example.com
log: /path/to/mgw.log # path to logfile
use_spf: 1 # Check SPF? -
You should be all set by now. Check the log if it is not working. If working the log should look like this:
Mon Apr 16 15:31:20 2007:
charset: US-ASCII
from: you@example.com
from_ok: 1
message: "testing mail gateway "
response:
created_at: Mon Apr 16 06:31:19 +0000 2007
id: 29590551
text: "testing mail gateway "
user:
description: ''
id: 4143991
location: ''
name: You
# ...
status_line: 200 OK
valid: 1
and like this if it is not.
Mon Apr 16 15:32:53 2007:
charset: iso-2022-jp
from: you@example.com
from_ok: 1
message: "This mail is invalid! "
spf_ok: 0
valid: 0
Enjoy!
Dan the Occasional Twitterer
404 Blog Not Found:VOX開いてみたけど:Miyagawa-kun Commented
HTMLコードを書けば、「HTMLが含まれてるけど、変換する?」というダイアログがでます。ただし、JavaScript などを書くことは出来ません。
Write HTML code and VOX will ask "Your post contains HTML. Would you like us to translate this markup?" on save. You cannot write JavaScript, however.
I see. But I am too practical a person to grok without doing. So I am doing now.
- Via script tag
Nope. VOX rejects the <script> tag as miyagawa-kun says. - Via javasript: scheme
avascript:alert(location.href)
Nope. VOX hates javascript: scheme. - Via submit button
Nope. VOX ignores the <input> tag. - Via event handler
alert(location.href)
Nope. VOX strips the onclick attribute. However, the style attribute remains intact.
Dan the Decaffeinated Man
The quick brown firefox jumps over the black lazy dog of Redmond.
漢字、カタカナ、ひらがなの入ったentry.
Konnichiwa. I think the problem of Japanese is not really the small number of English speakers itself, but the lack... read more
on A prison called Mother Tongue