Technical Interview Question #2

Interview Series

I have an array. I need the array’s element order randomized.

So, if I have an array like this:

a[0] = "abc"

a[1] = "def"

a[2] = "ghi"

a[3] = "jkl"

 

It might be randomized like this:

a[0] = "jkl"

a[1] = "def"

a[2] = "abc"

a[3] = "ghi"

 

You’re provided with a function which returns a random number between 0 and N, where N is the number you provide as a parameter.

As always, your solution should execute quickly and be efficient.

Silverlight 2.0’s Resources … not the same as WPF… :(

I’ve been wanting to post something about the differences between WPF and Silverlight’s handling of Resources, but this was just posted at LearnWPF. A nice summary worthy of a quick read if you’re not already familiar with the differences.

It’s too bad that there isn’t better feature/behavior parity between WPF and Silverlight 2.0 — if for no other reason than making it easier to learn both platforms. The things that make WPF powerful are often absent, so you need to create your own techniques. If you’re trying to share UI or code — that means a watered-down version of your code is being used in WPF. So much is missing right now, only the code-behind might be portable. Even that may require some refactoring.

I find this chain on the Silverlight forums interesting — at least to see what others find important.

Silverlight 3.0 will hopefully be the sweet spot for most developers. 2.0 — it’s a great start, especially if you’re starting from scratch — but requires some rethinking if you know WPF.

Is there anything you would have left out of Silverlight 2.0 to get your "favorite" feature added?

My #1: I would have ditched any support for dynamic languages. Learning a new language isn’t that hard — and it’s clear that learning Javascript hasn’t prevented millions of developers/hackers/hobbyists from creating interactive web pages.

Wireless Shutter Release for the D300

imageI just bought a wireless shutter release for my D300, purchased from Gadget Infinity for $30 US. There are models for a few different cameras and manufacturers.  It’s nice for a few reasons: it’s radio based rather than IR based (ALTHOUGH it’s my understanding that in some countries, it’s illegal to use certain radio transmitters that aren’t licensed, so BEWARE), it’s SIGNFICANTLY cheaper than the equivalent IR based system from Nikon, and finally it’s cheaper than the same product, relabeled as another manufacturer that is available in many camera stores. I saw a similar product in a local camera store for $100 US. It was the exact same product, yet it was $70 more expensive!

It claims 30m distance for use, but I’ve only tested it at about 30 ft — and it worked fine. If I ever test it at greater distances, I’ll post an update here.

Gadget Infinity which is based in Hong Kong, shipped the product the next business day after I placed the order airmail, and it came in about 10 days.

Apple fails to listen to Safari "Update" on Windows issue…

According to this post on MacRumors, Apple listened to Windows users and changed the way Apple’s Auto update works so that it’s more clear that Safari isn’t an update — it’s a new application.

You’ll recall my complaint though included the fact that Apple was "pre-selecting" Safari for download, rather than requiring me to make that decision.

They may have changed the UI to better indicate that Safari wasn’t an update, but Safari remains checked for automatic download. Lame, lame, lame Apple. Try try again.

Oh, and one more rant — Apple: We don’t need another web browser for Windows.