博文

目前显示的是 2013的博文

What is the difference between null and undefined in JavaScript?

http://stackoverflow.com/questions/5076944/what-is-the-difference-between-null-and-undefined-in-javascript There is one difference between undefined And null in javascript :: undefined is a data type and null is a value defined empty variable is null of datatype undefined Both of them are representing a value of a variable with no value AND null doesn't represent a string that has no value Like var a = '' ; console . log ( typeof a ); // string var a = '' ; console . log ( a == null ); //false console . log ( a == undefined ); // false Now if var a ; console . log ( a == null ); //true console . log ( a == undefined ); //true BUT var a ; console . log ( a === null ); //false console . log ( a === undefined ); // true SO each one has it own way to use undefined use it to compare the variable data type null use it to empty a value of a variable var a = 'javascript' ; a = null ...

JavaScript quiz - Scoping related

http://www.nczonline.net/blog/2010/01/26/answering-baranovskiys-javascript-quiz/ Answering Baranovskiy’s JavaScript quiz Posted at January 26, 2010 09:00 am by Nicholas C. Zakas Tags: Hoisting , JavaScript Last week, I tweeted about a JavaScript quiz I came across on Dmitry Baranovskiy’s blog entitled, So you think you know JavaScript? As with other quizzes of this type, there is only one question to answer for five different pieces of example code: what is the result? The example code tests some of the quirkier attributes of JavaScript engine behavior. I’ve seen similar quizzes in the past, sometimes by people saying that they use it as a test during job interviews. I think doing so is both disrespectful to the candidate as well as generally useless. You don’t encounter this type of quirk every day, so making that the minimum to get a job is about as useful as asking flight attendant candidate...

JavaScript Scoping

From: http://www.adequatelygood.com/JavaScript-Scoping-and-Hoisting.html Do you know what value will be alerted if the following is executed as a JavaScript program? var foo = 1; function bar() { if (!foo) { var foo = 10; } alert(foo); } bar(); If it surprises you that the answer is “10”, then this one will probably really throw you for a loop: var a = 1; function b() { a = 10; return; function a() {} } b(); alert(a); Here, of course, the browser will alert “1”. So what’s going on here? While it might seem strange, dangerous, and confusing, this is actually a powerful and expressive feature of the language. I don’t know if there is a standard name for this specific behavior, but I’ve come to like the term “hoisting”. This article will try to shed some light on this mechanism, but first lets take a necessary detour to understand JavaScript’s scoping. Scoping in JavaScript One of the sources of most confusion for JavaScript beginners is scoping. Actuall...

raspberry-qt Compile and hello world

https://gitorious.org/raspberry-qt/raspberry-qt/source/3c2ed05270137644300cde3b22829380698ff9a9:README.txt#L1     === BUILDING CROSS-COMPILED QT 5 FOR RASPBERRY PI === Based on http://qt-project.org/wiki/RaspberryPi_Beginners_guide 2/26/2013 1) Create a directory $ mkdir ~/opt $ cd ~/opt 2) Download the latest version of Raspbian (http://www.raspberrypi.org/downloads): $ wget http://files.velocix.com/c1410/images/raspbian/2013-02-09-wheezy-raspbian/2013-02-09-wheezy-raspbian.zip 3) Unzip the image and mount the root filesystem: $ unzip 2013-02-09-wheezy-raspbian.img $ sudo mkdir /mnt/rasp-pi-rootfs $ sudo mount -o loop,offset=62914560 2013-02-09-wheezy-raspbian.img /mnt/rasp-pi-rootfs 4) Download and extract Donald's toolchain: $ wget http://swap.tsmt.eu/gcc-4.7-linaro-rpi-gnueabihf.tbz $ tar -xf gcc-4.7-linaro-rpi-gnueabihf.tbz 5) Clone the cross-compile tools $ git clone git://gitorious.org/raspberry-qt/raspberry-qt.git 6) Fix absolute paths in the Raspberry Pi imag...

qtCreator + Eclipse

http://azurvii.blogspot.com/2012/11/eclipse-qmake-general-purpose-building.html ------------------------------------- Eclipse CDT: great C++ IDE QMake: simple but powerful make-based build system QMake does not work only for Qt toolkit, it could be used for other projects. How I set up CDT + QMake: get CDT and Qt configure CDT to what you like (e.g. showing line number, etc.) add 2 external tools running at project location, one runs qmake -project , and another does qmake -spec macx-g++ qmake -project is used to scan the folders, and pick out what will be c++ compile. It will generate a .pro file qmake alone (or with -spec ) will read the .pro file and generate the actual Makefile. make a qmake.conf file to be included in the .pro file (with a line of include(qmake.conf) ). This is to separate special settings from the .pro file, which would get erased when qmake -project is run. Sample qmake.conf CONFIG -= qt CONFIG += release TARGET = test2 DESTDIR = build...

Compiling on the raspberry

https://qt-project.org/forums/viewthread/30331/ Compiling on the raspberry pi is easy. Please follow my directions here: Install packages needed for compiling: sudo apt - get update sudo apt - get upgrade sudo apt - get install libfontconfig1 - dev libdbus - 1 - dev libfreetype6 - dev libudev - dev libicu - dev libsqlite3 - dev libxslt1 - dev libssl - dev libasound2 - dev libavcodec - dev libavformat - dev libswscale - dev libgstreamer0.10 - dev libgstreamer - plugins - base0.10 - dev gstreamer - tools gstreamer0.10 - plugins - good gstreamer0.10 - plugins - bad libraspberrypi - dev libpulse - dev libx11 - dev libglib2.0 - dev libcups2 - dev freetds - dev libsqlite0 - dev libpq - dev libiodbc2 - dev libmysqlclient - dev firebird - dev libpng12 - dev libjpeg62 - dev libgst - dev libxext - dev libxcb1 libxcb1 - dev libx11 - xcb1 libx11 - xcb - dev libxcb - keysyms1 libxcb - keysyms1 - dev libxcb - image0 libxcb - image0 - dev libxcb - shm0...

Running the QT5 Cinematic Experience Example on Raspberry Pi

http://ricky-tee.blogspot.com/  Running the QT5 Cinematic Experience Example on Raspberry Pi I first saw the QT5 Cinematic Experience video here:  http://www.youtube.com/watch?v=wulbR2R1GpM The video show cased Raspberry Pi running a very fancy QT5 example. I decided I wanted to give this a try on my Pi as well. Unfortunately it was not very straightforward. If you tried to google for instruction on run QT5 on the Raspberry Pi, it'll take you in circles.  http://qt-project.org/wiki/RaspberryPi_Beginners_guide This instruction assumes you have a main Linux machine that can be used for cross compiling. http://qt-project.org/forums/viewthread/21080 This instruction asks you to download the snapshot. However the location no longer exists.  I also tried to use cross-ng to compile my own cross compiler.  Before the cross compiler finishes compiling, I found an existing cross compiler for the Pi.  I then checked out the Qt5 source and...