What's the difference between undefined and null in javascript

Not a lot. The following statement is true:

undefined == null

So, there's no need to write:

if ( firstVar === undefined || firstVar === null)
{
  // your code
}

This works just the same:

firstVar === undefined || firstVar === null)

How to set up a ssh tunnel

First, setting up a tunnel is fairly easy. Second, for some reason I can never seem to get it right. Talking to other geek friends, even those smarter than me -- there seem to be quite a few, if you ask them -- it seems everyone has problems with it. So here's the shortcut:


Start by opening the tunnel. Specify the port locally, and the port to which you are going to connect:
ssh -L 3307:localhost:3306 dummy@www.inevergetitright.com

-L is the instruction to listen at port 3307

3307 is the port you have opened locally for the tunnel

localhost - that's you

3306 is the port opened at inevergetitgright

dummy is the user recognized on the inevergetitright server

Suppose you are doing this to set up a mysql connection on the remote server. All you do is open mysql in the normal way, but specify a port:

mysql -u asdfsd -p -P 3307 -h 127.0.0.1

Note that you have to specify 127.0.0.1. "localhost" won't work!

Why does my browser crash when I debug doctrine entities in Symfony2?

Using a var_dump of a doctrine object is a fast track to disaster in Symfony2. According to the Doctrine Website documentation:
Lazy load proxies always contain an instance of Doctrine’s EntityManager and all its dependencies. Therefore a var_dump() will possibly dump a very large recursive structure which is impossible to render and read. You have to use Doctrine\Common\Util\Debug::dump() to restrict the dumping to a human readable level. Additionally you should be aware that dumping the EntityManager to a Browser may take several minutes, and the Debug::dump() method just ignores any occurrences of it in Proxy instances.
src: http://www.doctrine-project.org/docs/orm/2.1/en/tutorials/getting-started-xml-edition.html

Should I always return a value in javascript functions?

Yes and no.

If you don't return something, you will return undefined by default (note that you can't assume this to be true in all languages. Perl, for example, returns the last vivified value).

So, not returning something from a function is the same as returning undefined. Which leads to the inference that there's no need to return anything:

function x() {                   }
function y() { return;           }
function z() { return undefined; }

x() === y(); //  is true
x() === z(); //  is true"

Why Apple should allow Jailbreaking

The Electronic Frontier Foundation has just asked the U.S. Copyright Office to exempt jailbreaking of smart phones, tablets, etc from the Digital Millennium Copyright Act. Specifically, the exemptions are with respect to section 1201 of the DMCA, prohibiting circumvention of “a technological measure that effectively controls access to a work protected under this title.”

Before you call this a pipedream, it should be noted that the EFF was successful once before, in 2009.

Personally, I'm disappointed, but not surprised that Apple, or anyone else, is pulling a Music Industry move, because they are paranoid about losing profits or market control. In effect, they are trying to protect the forest from the trees.

There are several reasons why jailbreaking is a good thing for Apple:

Jailbreaking tends to introduce changes to the architecture and software that would have been otherwise missed. This has been proven over and over again from the hacker paradigm: a security systems gets hacked and consequently improved. In the case of jailbreaking, there is also evidence of this happening. A security fix will sometimes be developed by the jailbreakers because the corporation is either too slow to fix, or not fixing it at all.

Jailbreaking has led to improved usability. Jailbreakers, for example, were first to configure keyboards to wirelessly connect with the smartphone.

In particular, when jailbreakers innovate, it's usually in areas that the manufacturer is ignoring, usually due to corporate culture, or cognitive dissonance. Without jailbreakers, these innovation, like pulldown notification or wireless syncing, might not have occurred.

Jailbreakers have also broken new ground in privacy, such as introducing apps that will hide text messages from automatically appearing on the front screen for everyone to see.

Apple has a great opportunity to tap into a vibrant and incredibly creative community. It's amazing that they think they can suppress this creativity through draconian measures.

I'm hoping that the EFF can be successful, and maybe that Apple will open its eyes. If not, it won't take long for all the goodwill generated by such remarkably innovative products to evaporate. And then, they will replace Microsoft as the new Satan for the new millenium.

In which the author demonstrates that he is getting too old to identify ...

When I was young, if you needed a Gigabyte of memory, you had to sneak into every home in North America and steal if from all of the computers. Back then, we made do with 4K. If you were extravagant, or if you were a power user, you bought the 16K expandable memory slot. That was plenty for your needs. And  when you programmed, you wrote the line numbers first. We didn't have any of this fancy pants object oriented tomfoolery. We had gosubs. If we were lucky. Otherwise, goto had to suffice.

When I wrote my first lines of code in 1983, Agile programming meant that you had to be quick enough to duck the eraser being thrown at you by the cool kids across the hall. A scrum was still something reporters did, and a class map told you how to get to History 12 in time.

Back then, a closure was something you got after breaking up with your girlfriend, and you usually found it at the bottom of a bottle of beer. An event listener was someone who pressed their ears against the door while the parents argued downstairs. A delegation pattern was the way that your older brother always made you do his chores.

Back then, if you tried to right click a mouse, it bit you. 

The Kindle is on fire. Sorta.

The rumours of the iPad's death are premature, but not too ridiculous.

It's true that the iPad is still cock of the walk, but other tablet makers have been getting a little uppity lately. And I think it's because everyone sat up and took notice when the HP tablet poured gasoline all over itself, lit the match, and discontinued itself. But not before causing near hysteria as buyers flocked to the stores to pick up massively discounted tablets.

The lesson? Everyone wants an iPad. But, if they don't have $600 burning a hole in their pocket - and how does, these days - they want a table so bad that they are willing to buy a discounted, discontinued product if it's cheap.

It didn't take long for iPad competitors to fall in line. RIM dropped the price of their Playbook to a few hundred dollars and, suddenly, vendors couldn't keep them on the shelves.

And now,  Best Buy reports that their top selling tablet is no longer an iPad, but the Kindle Fire. No doubt, this is because the Kindle is selling for half the price of the iPad.

Finally, tablet makers realise that they can't compete with the iPad, head to head. Who wants a Playbook or a Galaxy or a Kindle if they can get an iPad for the same price? (Hint: No one)

But there's a second tier of tablets, the lower priced models. My guess: we're about to see a whole new ecosystem of low cost tablets, ranging from a high of $300 down to as low as $150. This is embarrassing news for HP, who might have been able to make a go of things if they didn't so fabulously flame out. And it's great news for RIM, who might actually get some traction with a lower priced tablet.