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.

Monday, May 21, 2012

JavaScript SUX or "Gimme more shit, please!"

Shit #1

Just try this:

console.log(0.1 + 0.2 == 0.3);

Output: false (!)
Why?
Because JavaScript sux and muzdie:

console.log(0.1 + 0.2);

Output: 0.30000000000000004 (!)

Shit #2

console.log(Number.MIN_VALUE < Number.MAX_VALUE);

Output: false (!)
Why?
Because JavaScript sux and muzdie:

console.log(Number.MIN_VALUE);
console.log(Number.MAX_VALUE);

Output: 5e-324
1.7976931348623157e+308

Shit #3 (secure scope)

Object.prototype.foo = 10; 
console.log(foo); // 10

Shit #4 (happy debugging)

var a = {};
console.log(a.b === undefined); // true because property b is not set
undefined = 42;
console.log(a.b === undefined); // false

Shit #5 (are you duck?)

"string" instanceof String; // false. 
    // 'course it isn't not a string, it may look like a string
    // but actually it's masquerading as a banana.

When is a string, not a string? When it’s a duck!!!

Gimme more shit, please!

console.log(NaN === NaN); // false
console.log(Math.min() < Math.max()); // false

Etc. etc. etc...
Do you like it? Look here for more shit.

Thursday, May 17, 2012

Do not be afraid to seem a fool

"Do not be afraid to seem a fool, be afraid to be a fool." (c)

Wednesday, May 16, 2012

Project Euler, problem 1 solution

Problem 1

Stupid brute force, not masterpiece, which is generally not suitable on really large numbers. But it is easy.

JavaScript (Spider Monkey)

var num = 1000, sum = 0, res = 0;
while(num--){
    if(!(num%3) || !(num%5))
        res += num;
}
print(res);

// time: 0.02s memory: 4984 kB