July 2008 Archives

NYC .Net Developer Groups

| | Comments (0)

US State Quarters Update 5

| | Comments (0)

I got the Arizona-P quarter in my change today. Wahoo!

I've updated my list of missing coins to reflect this.

US State Quarters Update 4

| | Comments (0)

I traded for the Arizona-D quarter.

I've updated my list of missing Denver mint coins to reflect this.

Separated shoulder

| | Comments (0)

Recently, I injured my shoulder playing in my Ultimate Frisbee league. I took a bad tumble on the field and landed on my shoulder, tearing the ligaments that join the clavicle and the scapula. The technical name is the acromioclavicular joint or a-c joint for short. The complete diagnosis is a grade III separation of the acromioclavicular joint.

It's not especially painful but the recovery time is fairly high (one to three months). Recovery is mostly passively immobilizing the shoulder in a sling and later physiotherapy to regain strength and range of motion. I'm looking for good sources of shoulder exercises, like these:

But it comes with a permanent outcome: there's going to be a bump on my left shoulder for good.

Dev102.com programming challenge #13

| | Comments (0)

Dev102.com poses this programming challenge:

Your input is a string which is composed from bracket characters. The allowed characters are:'(', ')', '['. ']', '{', '}', '<' and '>'. Your mission is to determine whether the brackets structure is legal or not.

Example of a legal expression: "([](<{}>))".

Example of an illegal expression: "({<)>}".

Provide the most efficient, elegant and simple solution for that problem.

It's pretty obvious to me that you push opening brackets on the stack and pop off closing brackets, ensuring that the correct closing bracket is encountered. Like this:

def Evaluate(str):
  stack = []
  pushChars, popChars = "<({[", ">)}]"
  for c in str :
    if c in pushChars :
      stack.append(c)
    elif c in popChars :
      if not len(stack) :
        return False
      else :
        stackTop = stack.pop()
        balancingBracket = pushChars[popChars.index(c)]
        if stackTop != balancingBracket :
          return False
    else :
      return False
  return not len(stack)

PasswordChart

| | Comments (0)

PasswordChart.com is an interesting variation on generation of strong password keys. You supply a phrase and it generates an MD5-based table of hash segments. You provide a password and it generates a strong password from the table. I take this to mean that you can have strong passwords for multiple websites by

  • remembering a single phrase and
  • supplying the names of websites you intend to use them on.

Preliminary tests I've done with strong password checkers (Microsoft, SecurityStats, Rumkins.com) indicate that the resulting passwords are highly rated.

The Earth From Above

| | Comments (0)

A website which specializes in photographs of the Earth from above. Also available as a coffee table book.

Hedgehog Launch

| | Comments (0)

I'm embarrassed to say that this game is actually fun to play. The premise: a country's space program is going to be based on launching hedgehogs (optionally equipped with jetpacks, parachutes, and radar) into the air using rubber bands and launchpads.

FlowingData

| | Comments (0)

Cool visual presentation of the spread of Walmart, year-by-year. The site has other good visuals.

Manhattanhenge

| | Comments (0)

A few nights each summer, the sunset is perfectly aligned with the street grid of Manhattan, providing excellent photo opportunities.

Hayden Planetarium on the astronomy

Flickr photos

EvanJones.ca

| | Comments (0)

A guy I play frisbee with turns out to have a cool developer's website, EvanJones.ca. Here are a couple of the cool links I found there:

Python code coverage [via EvanJones.ca]

Yahoo Zookeeper (distributed systems infrastructure) [via EvanJones.ca]

My name is Inigo Montoya

| | Comments (0)

From The Princess Bride, a t-shirt with the ultimate event name tag: "Hello, my name is Inigo Montoya. You killed my father. Prepare to die."

$18.99 from thinkgeek.com

The Princess Bride

| | Comments (0)

The Princess Bride is a favorite film of mine. Here are the IMDB and Wikipedia links plus the most well-known dialogue from the film.

Man in Black: All right. Where is the poison? The battle of wits has begun. It ends when you decide and we both drink, and find out who is right... and who is dead.

Vizzini: But it's so simple. All I have to do is divine from what I know of you: are you the sort of man who would put the poison into his own goblet or his enemy's? Now, a clever man would put the poison into his own goblet, because he would know that only a great fool would reach for what he was given. I am not a great fool, so I can clearly not choose the wine in front of you. But you must have known I was not a great fool, you would have counted on it, so I can clearly not choose the wine in front of me.

Man in Black: You've made your decision then?

Vizzini: Not remotely. Because iocane comes from Australia, as everyone knows, and Australia is entirely peopled with criminals, and criminals are used to having people not trust them, as you are not trusted by me, so I can clearly not choose the wine in front of you.

Man in Black: Truly, you have a dizzying intellect.

Vizzini: Wait til I get going! Now, where was I?

Man in Black: Australia.

Vizzini: Yes, Australia. And you must have suspected I would have known the powder's origin, so I can clearly not choose the wine in front of me.

Man in Black: You're just stalling now.

Vizzini: You'd like to think that, wouldn't you? You've beaten my giant, which means you're exceptionally strong, so you could've put the poison in your own goblet, trusting on your strength to save you, so I can clearly not choose the wine in front of you. But, you've also bested my Spaniard, which means you must have studied, and in studying you must have learned that man is mortal, so you would have put the poison as far from yourself as possible, so I can clearly not choose the wine in front of me.

Man in Black: You're trying to trick me into giving away something. It won't work.

Vizzini: IT HAS WORKED! YOU'VE GIVEN EVERYTHING AWAY! I KNOW WHERE THE POISON IS!

Man in Black: Then make your choice.

Vizzini: I will, and I choose - What in the world can that be?

Vizzini: [Vizzini gestures up and away from the table. Roberts looks. Vizzini swaps the goblets]

Man in Black: What? Where? I don't see anything.

Vizzini: Well, I- I could have sworn I saw something. No matter.First, let's drink. Me from my glass, and you from yours.

Man in Black, Vizzini: [they drink]

Man in Black: You guessed wrong.

Vizzini: You only think I guessed wrong! That's what's so funny! I switched glasses when your back was turned! Ha ha! You fool! You fell victim to one of the classic blunders! The most famous is never get involved in a land war in Asia, but only slightly less well-known is this: never go in against a Sicilian when death is on the line! Ha ha ha ha ha ha ha! Ha ha ha ha ha ha ha! Ha ha ha...

Vizzini: [Vizzini stops suddenly, and falls dead to the right]

Buttercup: And to think, all that time it was your cup that was poisoned.

Man in Black: They were both poisoned. I spent the last few years building up an immunity to iocane powder.

Jet ski: power and safety

| | Comments (0)

Do you have any idea of how many horsepower a typical jet ski has? On this page, it appears to be 110 to 155 hp, topping out at about 215 hp.

For that matter, I did not know about this safety problem:

In 1998 the National Transportation Safety Board criticized the basic design of all personal watercraft: "Personal watercraft have no braking mechanism. They coast to a stop, and while coasting, there is no turning ability." Tom Ebro, president of Aquatic Risk Management in Florida, concurs. "What makes personal watercraft so ultra-dangerous is the fact that it will not steer when you suddenly have a surprise and let off the throttle." Unlike traditional boats "jet skis' are rudderless. And when the throttle is off, a speeding jet ski is like a car on ice. It can't stop. It can't turn, and the driver has no control.

[...]

Engineer-inventor Charles Willis explains the difference between safe, traditional boats and personal watercraft. "Boats have propellers, something down in the water, and the drag slows down the boat when the motor is off. The hull creates water resistance and so motorboats stop much faster than jet skis. PWCs are very different than boats. There is nothing underneath the hull. There's no drag. The product has a big flaw: it can't stop." A Yamaha diagram puts stopping distance between 260 to 470 feet. The owner's manual for Willis' Kawasaki Ultra-150 says: "Leave 348 feet to come to a stop." That's longer than a football field -- without steering, without control. [Emphasis added]

I'll have to remember to give them a very wide margin in the future when I'm driving a boat.

Controls, components, and containers

| | Comments (0)
A control on the other hand is a component that provides a UI. To do this you need to implement System.Windows.Forms.Control OR System.Web.UI.Control. So a control is basically a component that has visual properties. component is a class that implements the System.ComponentModel.IComponent interface or derives from a class that does You need a place to hold your components and controls. This is done in a Container. A Container is a class that implements the System.ComponentModel.IContainer interface

.NET interview questions and answers

| | Comments (0)

Interview questions

.NET interview

Dev102.com programming challenge #10

| | Comments (0)

Programming challenge #10 has been posted at dev102.com.

If all the numbers 1..n were present, then they would sum to n(n+1)/2. If some x is absent, then they will sum to n(n+1)/2 - x. So to determine which number is missing, subtract the sum of the series from the expected sum.

This python code finds the missing number in the series named values:

def test(values) :
	max_val = len(values) + 1
	expected_sum = max_val*(max_val + 1) / 2
	return expected_sum - sum(values)

Here is a complete test:

import random
def test(values) :
	max_val = len(values) + 1
	expected_sum = max_val*(max_val + 1) / 2
	return expected_sum - sum(values)

test_range = 200
for i in range(1,test_range) :
	a = range(1, i) + range(i+1, test_range+1)
	random.shuffle(a)
	x = test(a)
	if x != i :
		print "Failed at ", i
		print a
		print sum(a)
		break

US State Quarters Update 3

| | Comments (0)

I traded for two Denver coins: Michigan and Wisconsin.

I've updated my list of missing Denver mint coins to reflect this.

About this Archive

This page is an archive of entries from July 2008 listed from newest to oldest.

June 2008 is the previous archive.

August 2008 is the next archive.

Find recent content on the main index or look in the archives to find all content.