Posts

Showing posts from January, 2013

A pet squirrel

Image
Have you had your daily dose of cute already? If not, then look no further. The picture below is one of several . Background, quoting “ A soldier and his squirrel ”: Soldiers in Belarus found a little squirrel and brought it to the Warrant officer. The squirrel was very weak and about to die, so the officer took care of it and fed it like a baby every four hours. Three months ago, the guy left the army and now works as a taxi driver and the squirrel is always in his pocket, no matter where he goes! Squirrels really are like super-heroes, but in cute: they can climb trees and (rough) walls like Spider-Man and have ears like Batman. More questions about squirrels? Consult this FAQ , which, among others, answers how old they become and if they make good pets.

parseInt() doesn’t always correctly convert to integer

In JavaScript, all numbers are floating point. Integers are floating point numbers without a fraction. Converting a number n to an integer means finding the integer that is “closest” to n (where “closest” is a matter of definition). You might think that parseInt() performs this task, but it doesn’t. At least, not always. How parseInt() works parseInt() has the following signature: parseInt(value, radix?) It converts value to string, ignores leading whitespace and then parses as many consecutive integer digits as it can find. The radix If radix is missing then it is assumed to be 10 except if value begins with '0x' or '0X' , in which case radix is set to 16 (hexadecimal). > parseInt('0xA') 10 If radix is already 16 then the hexadecimal prefix is optional. > parseInt('0xA', 16) 10 > parseInt('A', 16) 10 So far we have described the behavior of parseInt() according to the ECMAScript specification . Add

JavaScripts 12 größte Fallgruben

Image
[Dieser Blogpost ist die Langversion eines Artikels im CHIP Web Design 2013 .] JavaScript ist eigentlich eine recht kompakte Sprache. Wenn es nur nicht all diese Fallgruben gäbe... Dieser Artikel erklärt die 12 größten und wie man am besten mit ihnen umgeht. Zur Lektüre werden grundlegende JavaScript-Kenntnisse vorausgesetzt. Wir halten uns an die aktuelle Version von JavaScript, ECMAScript 5. Anmerkung: Da Oracle, als Erbe von Sun, ein Trademark auf den Begriff „Java“ hat und dieses nur an Mozilla lizensiert, dürfen nur diese beiden Firmen offiziell den Begriff „JavaScript“ verwenden. Inoffiziell hindert das keinen, die Sprache so zu nennen, aber für den offiziellen Sprachstandard musste ein anderer Name gefunden werden. Dieser Name ist ECMAScript, nach der Organisation Ecma, die den Standard verwaltet. Die aktuelle Version von JavaScript ist ECMAScript 5 und existiert seit Dezember 2009, die nächste Version, ECMAScript 6, wird Ende 2013 fertig werden. Komplette Unterstützung wird dan

Chromebooks and netbooks

The best-selling laptop on Amazon? A Chromebook [1] ! Quoting “ Amazon's top selling laptop doesn't run Windows or Mac OS, it runs Linux ” (by Steven J. Vaughan-Nichols for ZDNet): So, what, according to Amazon, in this winter of Windows 8 discontent has been the best selling laptop? It's Samsung's ARM-powered, Linux-based Chromebook. This coincides with no more netbooks being produced. Quoting “ Sayonara, netbooks: Asus (and the rest) won't make any more in 2013 ” (by Charles Arthur for Business Insider): … Asus, which kicked off the modern netbook category with its Eee PC in 2007, has announced that it won't make its Eee PC product after today, and that Acer doesn't plan to make any more … Asustek and Acer were the only two companies still making netbooks, with everyone else who had made them (including Samsung, HP and Dell) having shifted to tablets. Asustek and Acer were principally aiming at southeast Asia and South America - but of course those are no

Web development: 2012 & forward

Functionn is a blog on open source web development. Today, they published an interview with me and several other people (including DailyJS’s Alex R. Young) covering various web-development-related topics. They asked the following questions: Tell us a little bit about yourself. How has 2012 been to you? What have you been working on lately? Now that 2012 is over, what do you think were some of the most exciting developments in the world of web development this year? What web development tool/library/framework/mindset shift has impressed you most in 2012? (You can talk about as many as you wish here). Which single tool/library/framework/mindset shift would you recommend other developers to use/put to work? What most excites, scares and disappoints you about the web today? One word to describe the web as it is today? How do you see the web change in 2013 and beyond? What do you look forward to in 2013? If you had the superpower to change something in the world, what would you change? :-

To Save Catholic Schools, All Suggestions Welcomed

Image
In the push to save Catholic schools in this country, all suggestions should be considered, from the most coherent and logical to the most far-reaching and bold.   Now comes word that the New York Archdiocese will consider closing 28 elementary schools this year in a move to consolidate and hopefully boost enrollment and financial prospects for the remaining campuses.   As explained in The New York Times , “The archdiocese is in the process of regionalizing elementary school management and financing, and is hoping that new revenue sources, including an archdiocesan tax levied on each parish to support all schools in its local region, will help reduce the persistent operational deficits that it says are forcing the closings.” This is not an illogical strategy.   Businesses that are franchised often close branches when things get tight in the hopes of boosting patronage at the remaining outlets.   However, schools are not businesses in the traditional sense, and who’s to say if studen

Categorizing values in JavaScript

This post examines four ways in which values can be categorized in JavaScript: via the hidden property [[Class]], via the typeof operator, via the instanceof operator and via the function Array.isArray() . We’ll also look at the prototype objects of built-in constructors, which produce unexpected categorization results. [This post is a copy of my Adobe Developer Connection article , I’m publishing it here for archival purposes.] Required knowledge Before we can get started with the actual topic, we have to review some required knowledge. Primitives versus objects All values in JavaScript are either primitives or objects. Primitives. The following values are primitive: undefined null Booleans Numbers Strings Primitives are immutable, you can’t add properties to them: > var str = "abc"; > str.foo = 123; // try to add property "foo" 123 > str.foo // no change undefined And primitives are compared by value , they are