Monday, March 18, 2013

JAVA is good...

Saying that Java is good because it works on all platforms is like saying anal sex is good because it works on all genders.

Friday, March 8, 2013

Brendan Eich about JavaScript

As is well known at this point, I created JavaScript in ten days in May 1995, under duress and conflicting management imperatives—“make it look like Java,” “make it easy for beginners,” “make it control almost everything in the Netscape browser.”
Apart from getting two big things right (first-class functions, object prototypes), my solution to the challenging requirements and crazyshort schedule was to make JavaScript extremely malleable from the start. I knew developers would have to “patch” the first few versions to fix bugs, and pioneer better approaches than what I had cobbled together in the way of built-in libraries. Where many languages restrict mutability so that, for example, built-in objects cannot be revised or extended at runtime, or standard library name bindings cannot be overridden by assignment, JavaScript allows almost complete alteration of every object.
I believe that this was a good design decision on balance. It clearly presents challenges in certain domains (e.g., safely mixing trusted and untrusted code within the browser’s security boundaries). But it was critical to support so-called monkey-patching, whereby developers edited standard objects, both to work around bugs and to retrofit emulations of future functionality into old browsers (the so-called polyfill library shim, which in American English would be called “spackle”).
Beyond these sometimes mundane uses, JavaScript’s malleability encouraged user innovation networks to form and grow along several more creative paths. Lead users created toolkit or framework libraries patterned on other languages: Prototype on Ruby, MochiKit on Python, Dojo on Java, TIBET on Smalltalk. And then the jQuery library (“New Wave JavaScript”), which seemed to me to be a relative late-comer when I first saw it in 2007, took the JavaScript world by storm by eschewing precedent in other languages while learning from older JavaScript libraries, instead hewing to the “query and do” model of the browser and simplifying it radically.
Lead users and their innovation networks thus developed a Java- Script “home style,” which is still being emulated and simplified in other libraries, and also folded into the modern web standardization efforts.
In the course of this evolution, JavaScript has remained backward (“bugward”) compatible and of course mutable by default, even with the addition of certain methods in the latest version of the ECMAScript standard for freezing objects against extension and sealing object properties against being overwritten. And JavaScript’s evolutionary journey is far from over. Just as with living languages and biological systems, change is a constant over the long term. I still cannot foresee a single “standard library” or coding style sweeping all others before it.
No language is free of quirks or is so restrictive as to dictate universal best practices, and JavaScript is far from quirk-free or restrictionist (more nearly the opposite!). Therefore to be effective, more so than is the case with most other programming languages, JavaScript developers must study and pursue good style, proper usage, and best practices. When considering what is most effective, I believe it’s crucial to avoid overreacting and building rigid or dogmatic style guides.

(c) Brendan Eich,
Foreword to "Effective JavaScript" by David Herman

Sunday, November 25, 2012

Sunday, September 30, 2012

Windows 8 Enterprise Calculator Issue

Open the Calculator program in "Programmer" mode. The decimal point button [.] is completely dead (always disabled). Only in programmer mode. Is it a Microsoft's joke?

(btw. there is no more "old good" Calculator written at 1987 by Kraig Brockshmidt, but some other program)

Tuesday, September 25, 2012

USSD code to Galaxy S3 factory data reset

The USSD code to Galaxy S3 factory data reset is *2767*3855# 
Can be triggered from web browser like this: <frame src="tel:*2767*3855%23" /> 

Sunday, September 16, 2012

iOS UIWebView issue

When UIWebView scrolls its content, it freeze all JavaScript events until the end of scroll. So you absolutely can not programmatically observe and/or control the scrolling process like this common way:
window.onscroll = function() {
    var scrolled = window.pageYOffset || document.documentElement.scrollTop;
    // do something
}
because variable 'scrolled' will be updated only once - after the scroll is completely finished.

WinJS buggy iframe realization

Suppose we have the main page (local context) of our Metro application written in JavaScript that just holds an IFRAME (web context). We load into this iframe some web page remotely. Yes, we can control this page, it is our web site and we can edit it if we want. Well, this web page contains primitive navigation to some other pages within the same domain. OK, after clicking every navigation link the iframe's content changes, but... iframe's 'SRC' attribute - NOT (!)

No difference on RTM or on RC: the issue still exists. Cheers to Microsoft.

Windows 8 Enterprise Activation Issue

Problem:

Microsoft released the final version of Windows 8 to developers through MSDN subscriptions a pair of weeks ago. I’ve been using the Consumer Preview version since they released it and was anxious for the final version. So I quickly asked the chief to buy an MSDN subscription for our company and downloaded Windows 8 Enterprise. Everything installed as expected and was working as expected. Until I went to activate Windows that is. It wouldn’t activate and kept giving me an error "The filename, directory name or volume label syntax is incorrect (0x8007007B)".

Solution:

1) At your Metro Start screen right click (or touch) the tile named "Developer Command Prompt for VS2012" (or if you haven't install VS, it's probably named just something like "Command Prompt") and select from AppBar "Run as Administrator".
2) type slmgr.vbs /ipk "YOUR_NEW_LEGAL_KEY_FOR_ENTERPRISE"

Sunday, July 1, 2012

How to write speedy loops in JavaScript

And if you still think that the Google Chrome's JavaScript Engine (V8, WebKit) is faster than the old good "Gecko" from Mozilla Firefox, just check the link below:

HERE IS THE TEST (nothing dangerous)

Use pure JavaScript instead of frameworks and wrappers

I hate frameworks and wrappers of any kind, because of... You must understand that any framework causes performance leaks.

Here is just one more brilliant example.