- Iron Python in Action (Manning Publications book)
IronPython in Action offers a comprehensive, hands-on introduction to Microsoft's exciting new approach for programming the .NET framework. It approaches IronPython as a first class .NET language, fully integrated with the .NET environment, Visual Studio, and even the open-source Mono implementation. You'll learn how IronPython can be embedded as a ready-made scripting language into C# and VB.NET programs, used for writing full applications or for web development with ASP. Even better, you'll see how IronPython works in Silverlight for client-side web programming.
- Try Python in the Browser: an IronPython and Silverlight 2 Interactive Interpreter
- IronPython Cookbook
This wiki contains recipes and example code for IronPython. IronPython is a Microsoft port of the Python Programming Language to the .NET framework.
- Contents
- Useful Links
- Downloads
- IronPython in Action
Python is a dynamic language, used for a wide variety of purposes, with an emphasis on clean and expressive code. It allows the maximum flexibility for the developer, whilst maintaining readability of code.
IronPython brings Python to .NET, and allows you native access to the .NET framework and classes. It runs on Microsoft .NET and on Mono, a cross-platform Open Source implementation of the .NET runtime and framework libraries.
July 2008 Archives
Little book of travel wisdom
National Geographics recommended travel information sites.
I got the Arizona-P quarter in my change today. Wahoo!
I've updated my list of missing coins to reflect this.
I traded for the Arizona-D quarter.
I've updated my list of missing Denver mint coins to reflect this.
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 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.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.
A website which specializes in photographs of the Earth from above. Also available as a coffee table book.
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.
Cool visual presentation of the spread of Walmart, year-by-year. The site has other good visuals.
MemCached
memcached is a high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.
Danga Interactive developed memcached to enhance the speed of LiveJournal.com, a site which was already doing 20 million+ dynamic page views per day for 1 million users with a bunch of webservers and a bunch of database servers. memcached dropped the database load to almost nothing, yielding faster page load times for users, better resource utilization, and faster access to the databases on a memcache miss.
.NET memcached client library
C#/.NET memcached client library. This library can be used by .NET projects to access memcached servers. Ported from the Java memcached library located at http://www.whalin.com/memcached/.
A few nights each summer, the sunset is perfectly aligned with the street grid of Manhattan, providing excellent photo opportunities.
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]
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 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.
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.
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
I traded for two Denver coins:
Michigan and
Wisconsin.
I've updated my list of missing Denver mint coins to reflect this.
