Xah's Web Dev Blog Archive 2011-08

CoffeeScript or Dart, JavaScript Replacement?

CSS tutorial, now on its own page: Xah CSS Tutorial.

It's a pity. With HTML5 and all advances, it seems midi file is still not supported. Test here: HTML5 Audio Tag Midi File Test.

Steve Yegge's Google Platforms Rant

A Story of Web Tech Politics: The Evolution of JavaScript's Script Tag

Yesterday, i removed all type="text/javascript" on my site. That is:

<script type="text/javascript">

becomes

<script>

This is a story of political chaos of the web.

In the beginning of time, a time of Netscape kingdom, ≈1996, it was just <SCRIPT>. Then, with Microsoft's meddling, with JScript and VBScript, it became language="JavaScript" or language="JScript". By ≈1999, a entity called W3C emerged, over-peering correctness on earth, it declared that the attribute should be type="text/javascript", and is required. However, in practice, both the “language” and “type” are always optional, and no browser's parser actually give a flying f��� about it. Then, around ≈2007, the standard body changed its mind and thought that the type really should be type="application/javascript" or type="application/ecmascript". (See: Internet media type) Nobody in their right mind ever used that. Then, in our glorious HTML5 era, ≈2009, ruled by Google and Apple, in their HTML5 spec, it's back to <script>.

Semantic Web: Emerging Practice of Including Language Name in Embedding Computer Language Source Code on Web Pages

There's a new practice since HTML5 about embedding computer language source code on web pages.

Normally, you just use “pre”, like this:

<pre>
x = 5
print x
</pre>

However, there's no indication of what language it is. Indicating a language is desired because search engines and other tools can get that info and process it accordingly (such as syntax coloring tool). (this is the idea of semantic web.)

So, it appears, there's this practice of introducing the language info, by embedding a “code” tag with “class” set to “language-‹name›”. Like this:

<pre>
<code class="language-python">
x = 5
print x
</code>
</pre>

However, there's no standardized string for the language string.

Overall, this practice seems ad-hoc and questionable, but a mob-standard might be better than none.

What's the problem? For example, the semantic of “class” tag isn't designed to be used to encode language names. Also, having “code” nested inside “pre” is a redundant hack. A improvement might be:

<code class="language-python" style="white-space:pre;display:block">
x = 5
print x
</code>

But this throws-off intuition, because most people are much more familiar with “pre” tag. So, perhaps we can do:

<pre class="language-python">
x = 5
print x
</pre>

All of the above are hacks in using HTML Microformat as a way to embed info for semantic web. A proper solution is a dedicated tag in XML, but XML is going the ways of dinosaur. Among the HTML microformat hacks above, i can't say which one is superior.

For the politics of HTML5 and XHTML, see: Are You Intelligent Enough to Understand HTML5?HTML6: Your JSON and SXML SimplifiedHTML5 Doctype, Validation, X-UA-Compatible, and Why Do I Hate Hackers.

For practical tips on syntax coloring source code on the web, see: Emacs: Syntax Color Source Code in HTMLSyntax Coloring with Google-Code-Prettify.

Updated: JavaScript Tutorial.

some font related articles. The Chinese Fonts Comparison one is new.

Non-Javascript Web Sites Are Now History

Project Gutenberg Founder Died (Michael S Hart, 1947 〜 2011)

Michael S Hart (1947 〜 2011) died on Sept 6th. Cause of death is not mentioned.

Here's the news sources:

I benefited from Project Gutenberg. Specifically, i used it to get the original text for the following 3 annotated work:

Are Googlers the Minions of Google Marketing?

Women in Tech: Today's G+ Recommendation? You Decide.

Website Ads in 2011: JavaScript popups

Steve Jobs Presenting the Apple Circle Building

Google: “Don't Be Evil” vs “Don't Do Evil”

The Google+ Rap

“The Google+ Rap”

Added to What is Google Plus and Google+ Songs (humor).

Google Chrome Reports a Malware Infested Site

Here's a Google Chrome screenshot, reporting that a site has been hacked.

Google Chrome stuckincustoms malware warning 2011-08-18
Google Chrome warning on the site stuckincustoms.com, captured on 〔2011-08-18T15:07:21-07:00〕.

The site belongs to a popular photographer Trey Ratcliff Trey Ratcliff on g+.

If you need a invite to g+, click on this plus.google.com

If you don't know what is g+, see: What is Google Plus? (humor).

TV Has Arrived on The Web

SEO: Underscore vs Hyphen: How Google Webmaster Advices Hurt Quality Writers 📺

What is Google Plus? (humor)

Grayhat SEO Use Translation as a Method to Generate Inbound Links

Facebook Disclosing Phone Numbers

it looks like you can now see all the phone numbers of your Facebook friends in one page. Go to 〖Accounts〗 on the upper right corner. Then 〖Edit Friends〗. Then, 〖Contacts〗 on the left. I'm seeing about 40 mobile phones of my friends.

Google Shutdown its Dictionary Service

Insider Look of Google Search with 3 Top Google Engineers

A very enjoyable video that gives a insider look at Google's search engine and how the team works.

It is in a format of a interview, featuring the well-known Google search quality engineer Matt Cutts, and engineer Ben Gomes (the man behind Google Instant and UI) and Amit Singhal (the “brain” of Google search engine). Danny Sullivan, of the searchEngineLand.com fame, is the moderator, and he asked great questions.

“2011-08-03 Inside Google's Search Office: Matt Cutts, Ben Gomes, and Amit Singhal”

The video is ≈90 minutes long, but very enjoyable and informative, easygoing.

What Your Google Plus Strategy Should Be?

Adjust your Google Ad preferences, or Opt Out

blog comments powered by Disqus