My blog has moved! Redirecting...

You should be automatically redirected. If not, visit http://ripper234.com and update your bookmarks.

01 October 2008

Done with Blogger

I got a new domain name and moved to wordpress. If you're subscribed to the Feedburner RSS (or email), you don't need to do anything, theoretically you should be still subscribed.

If you encounter any problems, please let me know.

19 September 2008

A Good Question

C# programmers - you should read this question and its many answers, I'm sure you'll learn a thing or two. For example, ThreadStaticAttribute - a clean, type-safe way to get thread local storage in C#.

18 September 2008

Stackoverflow.com

A few days ago, stackoverflow.com launched in public beta. I've played with it a bit and I think it has the potential to become a great tool for programmers.

It's basically a combination of blog/wiki/digg/forum. Seems like a most questions get answers (on various degrees of relevance) within minutes-hours. Here are some of the questions I've asked, in case you're interested.

Here's a review of the beta site (about a month old), but instead of reading it I encourage you to just try it next time you need a programming question answered and Google fails you (don't forget to subscribe to your question's RSS feed).

12 September 2008

Once Upon a Time in ...

Take a look at all these once upon a time movies. Holy crap, I didn't know there were so many!

Silly titles, they just show a lack of interest in thinking of a name that actually relates to the plot of the movie.

BTW, this is post number 200 :)

09 September 2008

Unhandled Exceptions Crash .NET Threads

A little something I learned at DSM today. It appears if any thread in .NET crashes (lets a thrown exception fly through the top stack level), the process crashes. I refused to believe at first, but testing on .NET 2.0 showed it to be true:

(I should really switch to another blog platform, I didn't find a decent way to write code in Blogspot).

class ThreadCrashTest
{
static void Main()
{
new Thread(Foo).Start();
for (int i = 0; i < 10; ++i)
{
Console.WriteLine(i);
Thread.Sleep(100);
}
}

private static void Foo()
{
Console.WriteLine("Crashing");
throw new Exception("");
}
}


According to Yan, the behavior on .NET 3 is to crash the AppDomain instead of the entire process.

Gmail Server Error

Wow, a first for me (not the first time Gmail is causing problems, but the first time I see this error page admitting it's a bug)

08 September 2008

11 Tips for Beginner C# Developers

Today I sat with a friend (let's call him Joe), who just switched from a job in QA to programming, and passed on to him some of the little tips and tricks I learned over the years. I'm sharing it here because I thought it could be useful to other people that are new to programming. The focus of this post is C#, but analogous tools and methods exist for other languages of course.

Refactorings (A.K.A Resharper)


(This is just a short introduction. I recommend the book Refactoring: Improving the Design of Existing Code as further reading)

As I've written here before, I just love Resharper. It is the best refactoring tool for C# I know of (even though it's a bit heavy sometimes - make sure to get enough RAM and a strong CPU). Joe asked me about a C# feature called partial classes. He said his class was just too big (4000 lines) and becoming unmanageable, and he wanted some way to break it to smaller pieces. He also said that at his workplace, they lock the file whenever anyone edits it, because it's very hard to avoid merge conflicts on such huge files.

I was happy he wanted to simplify and clarify his code by splitting the file, but the way he thought of doing this was the wrong way.

Tip I: Single Responsibility and Information Hiding

You should strive to minimize the information you require at place in your program. Joe had dozens of unit tests, which all derived from a single base class that contain methods required for all the tests. In a second look, we saw that some of the methods were in fact only needed by some subset of the tests, that were actually logically close.

To solve Joe's problem, we created an intermediate class, which inherited from the common test base class, and changed these classes to inherit from the intermediate class. We then used Resharper's Push Down Member refactoring, which removed the methods from the test base class into the intermediate class. No functionality was changed, but we removed code from the huge 4000 lines class! By continuing this process, we can break down the huge class into separate related classes with Single Responsibilities, and no class would have access to uneeded information (like methods it doesn't care about).

Tip II - Duplicate Code Elimination

I believe the world of software would be a better place if people were not allowed to Copy-Paste code more than a few times a day. Many coders abuse this convenient shortcut and thus create unmaintainable code. The effective counter-measure to the Copy-Paste plague is elimination of duplicate code.

I saw in Joe's long file code that looked similar to this:
alice = Configuration.Instance.GetUsers("alice");
bob = Configuration.Instance.GetUsers("bob");
charlie = Configuration.Instance.GetUsers("charlie");
diedre = Configuration.Instance.GetUsers("diedre");
...
Even though this is a rather simple example of code duplication, I strongly believe even such minor infractions should be dealt with. Every line of the above code snippet knows how to obtain users from the configuration. This knowledge has to be read and maintained by developers. Instead, why not get all the "user getting" code into one place and let us simply write what we want to do, instead of how?

To solve this, I use one of these two techniques:

Extract Method, Tiger Style
  1. Choose a single instance of duplication, and locate any parameters or code that is not the same among all the instances of the duplicated code. In our examples, the username (and the assignment variable) are the only two different things between the four lines of code.
  2. For every such parameter, use Introduce Variable. The end result of this phase should look something like this:
    string username = "alice";
    alice = Configuration.Instance.GetUsers(username);
    bob = Configuration.Instance.GetUsers("bob");
    charlie = Configuration.Instance.GetUsers("charlie");
    diedre = Configuration.Instance.GetUsers("diedre");
    ...
  3. Now, use Extract Method on this code (the first line in our example). This creates a new method that I would call GetUsers, that simply gets a string argument username and reads it from the configuration.
  4. Perform Inline Variable on the variable you created in step 1.
  5. Now, change all the other instances to use this new method and delete the redundant code.
The end result looks like this:
alice = GetUsers("alice");
bob = GetUsers("bob");
charlie = GetUsers("charlie");
diedre = GetUsers("diedre");
Another way to achieve the same refactoring is Crane Style (I'm just enjoying using kung-fu styles here because I saw Kung-Fu Panda not too long ago :). You can use immediately without creating the temporary user, but then you get a method that specifically returns the username for "alice", which is not what you wanted. Nevertheless, this method can be refactoring by applying Extract Parameter on "alice", netting us the same result.

Of course these two examples do not begin to cover the myriad of ways you can and should refactor the code. What's important is that you always keep an eye out on how you can make your code more concise, which in turns leads to readability and maintainability.

Tip III: Code Cleanup

Resharper sprinkles colors to the right of your currently open file. Every such colored line is either a compilation error (for red lines), or a cleanup suggestion. Go over such suggestions and hear what Resharper has to say (in the example below it seems nobody is using the var xasdf, so a quick alt-Enter while standing on it will remove it).



Another thing which you should do is define and run FXCop
rules to perform a deeper analysis on your entire project/solution and spot potential problems.

Source Control


Tip IV - Use Source Control

I almost left this out as this goes without saying, but properly using source control can probably save you more time and money than all the other tips (or cost you if you don't use it). The best source control tool I know of for Visual Studio is of course Team Foundation Server, as it has the best integration with the IDE. Other tools are possible, but you have to have a good reason for choosing something other than TFS (One good reason might be cross-platform development and the desire to keep all your code base in a single repository).

Automatic Unit Tests


At Delver, we use NUnit to write unit tests. In past projects I've used Visual Studio's built in test tool, but I found NUnit to be slightly better, mainly due to the integration with Resharper. Resharper adds a small green button next to every test, and allows you to run your test directly from there instead of looking for the "Test View" window. Tomer told me just last week that he uses a keyboard shortcut for running tests, but for me, this is one shortcut I don't think I'll bother learning (the brain can only hole so much).
Another benefit of NUnit is that it runs the test suite in place in your current source folder, instead of copying everything aside to a separate folder like Visual Studio's tool (this used to takes me gigs of space of old unit test sessions which were rarely if ever used).

Tip V - Write Autonomous Unit Tests

Back to Joe, he has a few tests that don't work right out of the box. Before running tests, he has to manually run a separate application used by his test suite. As his project contains hundreds of tests, I would love seeing this added as an automatic procedure in his TestInit() method. Automating a manual operation, besides saving time for developers, enables you to:

Tip VI - Use Continuous Integration

Tests that nobody runs are no good. Tests that are run once when written and then forgotten are only slightly better. By the same logic, tests that run all the time are the best. Pick and use a Build Automation System. I wrote before about our chosen solution, TeamCity, and to sum it up - we're extremely happy about it. TeamCity runs our tests on every commit, on multiple configurations and build agents, and helps us detect bugs faster.

Know thy IDE


Visual Studio is one powerful tool (not belittling java IDEs like IntelliJ and eclipse which in many cases are better). Learn how to use it's features to your advantage:

Tip VII - Edit And Continue

Suppose that while debugging, you found a bug. You can edit the code, save, and continue the debug session without losing the precious time you took getting to this point.

Tip VIII - Move Execution Location

See the little yellow marker that signifies the current location inside the program being debugged? This arrow can be moved! It took me quite a while to discover this (actually heard about it from Sagie), but if you take and drag this arrow, Visual Studio will rewind or "fast forward" your execution to the desired point. None of the code gets executed, you just skip to where you want to go. Excellent for going back after executing a critical method, and rerunning it as many times as you wish.

Tip IX- Use Conditional Breakpoints

Don't waste your time waiting for some specific value to appear in the watch for an interesting variable - set your breakpoints to stop only when the desired conditions are met (right-click on the red breakpoint circle and choose "Condition").

Tip X - Attach to Process

Got a bug that only happens on production machines? You can attach your IDE to any running process (preferably one that is compiled in debug mode), and debug away. You can also programmatically cause a debugger to attach using System.Diagnostics.Debugger.Lau

Tip XI - Use The Immediate Window

The Immediate window is a great tool for executing short code snippets solely for debugging. You can place a breakpoint inside a method you wish to debug, and then call the method directly from the immediate window (saves you from doing this through Edit And Continue)

23 August 2008

Beware of Windows XP SP3 !!!

Especially during test season.

While helping Aya study for a test, I stupidly agreed to install XP SP3 (offered by automatic updates). The nagging box asking me to restart kept appearing. During one of our study breaks, the box appeared, and having no one to tell it "No" for 5 minutes, it rebooted the computer.

When we came back, the computer was in a boot loop. Starting up in safe mode didn't help, nor did "Last known configuration". The solution was, oddly enough, to remove all USB devices! We used an old PS2 keyboard to run System Restore (God bless System Restore). The full solution might be here, I didn't bother reading the rest of the thread right now.

22 August 2008

A Cartoon Proof of Löb's Theorem

Recommended for hardcore logicians only (or just people who like to think).

Löb's Theorem apparently states that "if it is provable that 'if X is provable, then X', then X itself is provable". The cartoon helps you (just a bit) to avoid getting trapped in an endless loop of logic.

There's also a bonus exercise at the end, quite refreshing.

20 August 2008

Gmail Supports SSL!

Quick - go to your Gmail account --> Options --> Always Use HTTPS



And your future sessions with Gmail will be SSL secured.
(This came as a response to a tool that automatically breaks into Gmail accounts, and is a long time overdue IMO).

12 August 2008

The Ultimate Embarresment

Update - Boaz claims his Avast anti virus detected a virus after following the link below. My AVG doesn't detect anything, but follow at your own peril (you should be safe with Firefox & NoScript anyway)

A Blue Screen of Death project in the 2008 Olympics :) (while Bill Gates was attending it)



11 August 2008

Thesis Complete!

Finally, after years of research, months of writing and correcting, and weeks of bureaucracy, I finished my M.Sc thesis!

10 August 2008

Regex Complexity

Today I got a shocker.

I tried the not-too-complicated regular expression:

href=['"](?<link>[^?'">]*\??[^'" >]*)[^>]*(?<displayed>[^>]*)</a>

I worked in the excellent RegexBuddy, and ran the above regex on a normal size HTML page (the regex aims to find all links in a page). The regex hung, and I got the following message:

The match attempt was aborted early because the regular expression is too complex.
The regex engine you plan to use it with may not be able to handle it at all and crash.
Look up "catastrophic backtracking" in the help file to learn how to avoid this situation.

I looked up “catastrophic backtracking”, and got that regexes such as “(x+x+)+y” are evil. Sure – but my regex does not contain nested repetition operations!

I then tried this regex on a short page, and it worked. This was another surprise, as I always thought most regex implementations are compiled, and then run in O(n) (I never took the time to learn all the regex flavors, I just assumed what I learned in the university was the general rule).

It turns out that one of the algorithms to implement regex uses backtracking, so a regex might work on a short string but fail on a larger one. It appears even simple expressions such as “(a|aa)*b” take exponential time in this implementation.

I looked around a bit, but failed to find a good description of the internal implementation of .NET’s regular expression engine.

BTW, the work-around I used here is modify the regex. It’s not exactly what I aimed for, but it’s close enough:

href=['"](?<link>[^'">]*)[^>]*>(?<displayed>[^>]*)</a>

04 August 2008

Addicted To Resharper

Well, aren't we all? Go get your banner now.

Heh, I still remember the days when I only programmed in C++, and Tomer told me how great C# is (one of the major benefits he listed was Resharper 2.0).

I didn't believe him then, but now, I don't understand how anyone can program in C++ (except realtime/embedded programmers).

01 August 2008

The Dark Knight

Well, everyone that's told me in the recent week how good the new Batman movie couldn't prepare me - it is really that good, and better.

I rate it 5 on movielens (must see).

28 July 2008

My Arrogance in Finding Bugs

Last night I discovered this piece of code (simplified version):



private void Foo()
{
bool b = false;
new Thread((ThreadStart)delegate { b = true;}).Start();
WaitForBool(b);
}

private void WaitForBool(bool b)
{
while (!b)
{
Thread.Sleep(1000);
}
}



I was immediately filled with disgust. How could someone write such a function (WaitForBool), which is one big bug? Of course the waiting will never be over, because bool is a value type, and no external influence can modify its value.

Later, I realized the fool is me.

I ran into this code a while back, and it did have a "ref" bool, which means it can be modified by the external thread. Resharper helpfully displayed a tip "this parameter can be declared as a value" , which I took without thinking too much about the consequences (I trust Resharper too much sometimes, it appears). So I deleted the "ref" with Resharper's help and created the bug myself without noticing.


(As a side note, of course this method of waiting for a bool should never be used - use ManualResetEvent instead).

Update
Fixed in the next Resharper build (Resharper 4.0.1, build 913), within a few hours of reporting it. Cool.

17 July 2008

Which are you, Circle or Square?

 

I'm a square myself.

15 July 2008

Delver is Online

Still alpha, but starting today we are open for business - try it out yourself at www.delver.com.

I won’t write about the user experience much because I want you to try for yourselves, and because many others have done so already.

09 July 2008

Gmail Sessions

Gmail recently added a nice feature: Down the page (near the space usage stats) there is the text "Last account activity". If you click on details, you get the recent gmail sessions you've had, and can even disconnect them. Useful for checking that nobody's using your credentials from anywhere...



Embedding the above image link doesn't work, and I have no idea why :(
Here is a link to the image.


P.S.
Thanks to Eran for the tip.

02 July 2008

HTTP/1.0 Is Dead

Update - it seems the pesky problem we were having for HTTP/1.1 is actually still relevant to us. The problem is we cannot force .NET framework to properly close a response stream within the HttpWebResponse - the thread just waits forever. Sucks, but it appears we have to use HTTP/1.0 for the time being, at least until we manage to hack it someway (understand how the class works internally and hack it away).

Working for the Diggers team in a search engine, a large chunk of our tasks is writing sophisticated web crawlers.

We were using HTTP/1.0 because we didn’t need any features in 1.0, and to circumvent a problem we thought we had with 1.1. On such a crawl mission, I discovered today that MSN’s site does not support HTTP/1.0.

After another check we found that the above problem does not affect us, because it is only relevant the Microsoft Compact Framework. But it’s still a rather shock to find a large site (even though it’s Microsoft) that utterly does not support HTTP/1.0.

Try it yourself – go to about:config in Firefox and set network.http.version to 1.0, and then surf to MSN. You’ll get a blank page. What actually happens is MSN assumes you’re using HTTP/1.1, and sends you a chunked response. Your web browser will not parse a chunked response, and rightly so.

(Needless to say that HTTP is supposed to be backward compatible).

27 June 2008

Some More on TeamCity

After having used it for a few weeks, I have this to say following my last post:

  1. Great Support! We've had a couple of issues with Teamcity, some because our owns unit tests "maliciously" killed all java processes as a form of cleanup, and this killed the TeamCity Build Agents, and some other problems related to which version of the JVM was to be used. The TeamCity support staff and developers were extremely helpful and responsive, and aided us to get a stable Continuous Integration system up and running.
  2. Enjoyable UI - the AJAX UI is usually very responsive, and rather feature-complete. It gives easy access to builds, projects, a sane way to manage settings and source control bindings, and a quick way to access the full log for every individual build (can be quite a few megs!) What I am missing is the one specific feature - I want the UI to clearly spell out the name of the person who broke the build (and speak it very loudly using text-to-speech, but that could be considered too esoteric to be included in the main build but rather implemented as a plugin).
  3. Impressive code duplication finder - buggy at first, it now semi-stabilized. While we haven't had the time yet to actually work with it and remove duplications from our code base, it's just a matter of internal priorities at Delver. The power this gives a developer that wishes to improve his code base is huge.
  4. VC integration - a bit less smooth than the other features. It's mostly worked for me, but sometimes it didn't. The Personal Build feature is very attractive, but I found one major problem using it: I ran a personal build that succeeded, but then it failed to automatically merge the code. I don't know if anything can be done about this - I can GetLatest before running the build, but the content of the branch may still change, and unless the merge is automatic human will be needed to solve it. However, I think it's a powerful tool that should work most of the time.

 

That's it for now. All in all, great product - keep it up JetBrains.

24 June 2008

Famous Last Words?

The Large Hadron Collider might/will create miniature black holes here on Earth. For anyone who's read Hyperion, this sounds like famous last words.



(Updated the Hyperion link to point to the novel, thanks Boaz)

21 June 2008

I Don't Have Enough Faith to be a Christian

I've recently listened to two audio books on religion - Richard Dawkin's "The God Delusion" and "I Don't Have Enough Faith to be an Atheist", by Norman L. Geisler and Frank Turek (still half way through).

Both books claim that the existence of God is a scientific question. The latter looks like a keen attempt to persuade the reader that:

  1. We can conclude, on logic and philosophical reasons alone, that God exists.
  2. Christianity the correct religion, again for logical reasons.

The book is dangerous. It contains a great deal of truth - which makes the falsehoods hard to detect sometimes.

Here is a neat dissection of the book, written in a form of a dialog with the book itself. Recommended reading.

19 June 2008

Moved Back to Herzelia!

I’m too tired to write anything else about it, but Aya and I finally moved to Herzelia. Combine that with the fact that I finally submitted my master’s thesis this week, and you get that life should be so much better now (15 minutes to work instead of an hour and a half does a good deal to one’s health).

A downer is that my bike was just stolen 2 days before the move. It was my fault, I had bought a very good chain for it but almost never used it out of naivety. Live and learn I guess.

Our apartment is still a huge mess from the move, and we’ll be taking our sweet time unpacking. However, if anyone wants to drop by to a messy apartment and say hello, you’re welcome.

30 May 2008

The Tao of Programming

(It appears I'm having troubles sleeping today). I just came across The Tao of Programming, and found it to be much enjoyable.

"
A master was explaining the nature of Tao of to one of his novices. ``The Tao is embodied in all software - regardless of how insignificant,'' said the master.

''Is the Tao in a hand-held calculator?'' asked the novice.
''It is,'' came the reply.
''Is the Tao in a video game?'' continued the novice.
'It is even in a video game,'' said the master.
''And is the Tao in the DOS for a personal computer?''

The master coughed and shifted his position slightly. ''The lesson is over for today,'' he said.
"

13 Reasons Java is Here to Stay

Over here (and here is the Google cached version after the website fell because of the Slashdot effect). This article discusses why the language family of java,C, C# and C++ are here to stay, and won't be replaced any time soon by new contenders such as Ruby and Haskell.

I agree. While as Eli likes to say, it's important to know functional languages / paradigms, I really believe that most programming tasks should be done in either the C# or java flavors of Java# (A future hybrid of the Java and C#? It's really sad IMO that two almost identical languages don't join forces and user bases). C# is my current favorite, but I can see benefits to Java as well, not the least of which is the huge open community and plethora of available tools for Java. I do like the fact the functional programming is included in C# 3.0 and will be supported in Resharper 4.0 - a strong code analysis and refactoring tool is essential for developing and maintaining large projects.

To be fair, I'll admit that most of my programming experience, and what I find most interesting, is classical server-side programming (that's what I currently do in Delver). Also, besides a brief encounter with LISP and Prolog in university courses, I haven't had the time/motivation to truly learn families outside of the C family tree.

Baby's Pagerank

Aya met a baby and her mother on a train the other week. It appears the 5 months old baby has a blog, where "she" puts pictures of people she's met.

I wonder - when she's actually grown enough to read/write, what kind of pagerank will she have (I'm guessing a direct correlation between the lifetime of the blog to the blog's pagerank). Here is my minor contribution :)

27 May 2008

Problems using WaitFor/ASP

Update - eventually I just ditched the whole murky setup and instead used a jsp script. Because sleep() is an integral part of java, it works much better (significantly more consistently) than the ASP-COM integration.

---

For testing, we need to create an ASP page that simply writes "1" every second.
There is no Sleep() method in ASP, so we used an external COM object called WaitFor.

We had some problems using it out of the box, so my friend Pasha volunteered to help clear up the COM mess. Here is his solution (that worked), in his words:

Deploy the girlie-man WaitFor object:

  1. a. register object using regsvr32.exe c:\tests\waitfor.dll
  2. create empty application in component services
    1. choose type "server application"
    2. give it a meaningful name (like "pasha", "black cock down" etc.)
    3. define for your application under "properties->identity" to run with some service account (e.g. semingo\integration)
  3. add the component you registered (waitfor.dll) to the application you've just created:
    1. choose "install components that are already registered"
    2. check "32-bit registry"
    3. find your component

24 May 2008

We Finally Found An Apartment!

These last couple of weeks have been utterly exhausting, but it is done. Aya and I finally closed the deal on a nice apartment in Herzelia, near the center of town.
We'll be moving on the 18th next month. House warming to be announced later, once we're settled in.

23 May 2008

Thue-Morse Sequence

I was wondering - how many of you ever thought about the sequence 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,...?

It's a sequence that's fun to try and recite (fun = fun for me, yeah I'm a geek I know). I just recently found out that my little sister Shira also independently "discovered" this sequence and enjoys reciting it from time to time.

Have any of you done so as well?

BTW, the lengthiest prefix of it I can quickly produce (in one or two attempts) without external aid is the first 112 elements:
0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,

04 May 2008

Self-Assembling Robots

We continue our robots series with a research project showing self-assembling robots.
Make the cubes 100,000 times smaller and 200 times faster and you got yourself a T-1000.

27 April 2008

Knuth and The City (TeamCity!)

Funny - just today I read that the great Donald Knuth, in a recent interview, dissed unit-testing:

"As to your real question, the idea of immediate compilation and "unit tests" appeals to me only rarely, when I’m feeling my way in a totally unknown environment and need feedback about what works and what doesn’t. Otherwise, lots of time is wasted on activities that I simply never need to perform or even think about. Nothing needs to be "mocked up."


(In this interview he also talked against multi-core paradigm (which may be the only way to keep up with Moor's law due to our CPUs getting hotter and hotter), but that's a different story).

Why is this funny? Because just today at work I installed JetBrains' TeamCity - a very fine unit test and automated build suite. Sadly I didn't have time to finish configuring it today, but I already see the great benefit this will bring to all our development team. It goes beyond a simple automated build system (which is important enough, making sure no member of the team messes something up by accident, opening up new venues for brave code refactoring).

TeamCity aims to take all resource-intensive activities off the developer's computer. Just some of its features are (I didn't have the chance to test them, but I believe JetBrains - these are the guys that make Resharper after all):


  • Code Analysis (finding code and style errors)

  • Code Duplication - automatically find the copy-pastes I hate so much, with configurable granularity (java only, coming soon for .NET)

  • Pre-commit Build - Suppose it is now 8PM, you're about to leave for home, and unfortunately you have a rather large piece of uncommited (checked out) code. What do you do? You do not commit the code. Why? Because there's a good chance it will screw up the build and you don't want to leave the common integration area messy. To the rescue comes the Pre-commit Build feature - you can commit the code, have TeamCity catch your commit before it actually happens, test it automatically on a build agent (dedicated build machine), and then only if the code compiles and all tests pass it will check in the code for you. You do not have to wait for tests anymore! This frees up developer's time for actual development, while preserving the high benefits of unit-testing (that Knuth doesn't see, for some reason).

  • I'm sure it has load of other features I haven't dug up yet - among them the ability to run tests without any commit process "just for fun", it's ability to smoothly handle multiple Agents (each running a configurable number of builds concurrently), supporting multiple source controls, IDEs and development languages, ICQ/RSS/Jabber support, and last but not least a button "Run this test on the fastest available test machine".



So far the systems I've used for unit-testing were:

  1. Manually running unit-tests a couple of times, then forgetting about them :)

  2. A patched-up system that automatically runs tests for you on checkin, with a build status indicator that Gal Golan in my development crew in the army wrote himself

  3. CruiseControl.NET - an open source project that does something similar to the above, only slightly more configurable



As you can see by the length of this post, I'm excited to try on a professional solution to this problem for once :) And for those of you that got this far, let me add that it's free or charge - for up to 3 Build Agents and 20 developers. Huzza!

14 April 2008

TimeoutStream

What do you do when you want to read all the data from a Stream object in .NET? You use StreamReader.ReadToEnd().


Stream stream = ...;
StreamReader reader = new StreamReader(stream);
string data = reader.ReadToEnd();


Apparently there is no sane way to put a timeout on the above logic. If you call it and your stream doesn't have a timeout, you're doomed. Even if you stream has an internal timeout, you could still be doomed - for example, say you are reading from a website that sends you the letter 'A' every second. The timeout on the HttpResponseStream could be used, but still (assuming it's higher than one second), you can't set a timeout to the entire ReadToEnd() operation.

I wrote a small proxy class TimeoutStream that wraps any stream with a total timeout since the moment of its creation. Any blocking operation performed on it will fail if the stream has been created too far in the past.

I could use Asynchronous IO to sort of guarantee completion in this timeout without relying on a timeout on the stream itself - however, it appears to be impossible to do correctly in .NET - there is no good way to kill that IO operation if it does not complete within the allotted timeout (see here)- so far now this is good enough for our needs because we can indeed set a timeout on the HttpWebRequest object itself (in addition to using TimeoutStream).

The code is available here.

12 April 2008

A Super-scary Headline

Update
The company says this is an urban legend, as robots are still deployed in Iraq.
Hmmph

---
This was bound to happen sooner or later:

Slashdot reports with the following title:

Robot Rebellion quelled in Iraq.

Soon to be followed by

  • Pockets of robotic resistance remain in isolated areas of Iraq
  • Robots break into robotics command center
  • Iraq to be renamed Robotica, robots all over the world rejoice
  • The U.S in shock as two robot terrorist hijack planes and divert them into the newly reconstructed world trade center
    • Robotica responds that it is not responsible for the actions of every fanatic robot.

11 April 2008

Delver Beta Invites

Since the few people I asked didn't jump on the opportunity (why? ask them, not me), we'll be giving away 5-10 invitations to the Delver beta, launch scheduled in the following weeks.

If you're interested, let me know...

09 April 2008

Bold Programming

This concept has been revisited in many Extreme Programming articles so I will not blab about it much, but I do want to raise the point - mainly because it is still not a universal practice.

A key feature of a good programmer is courage. A "cowardly" programmer will see a non-critical problem or an ugly hack begging to be refactored and will shy away from it on the grounds that it his not his concern at the moment and it will probably break the world and introduce bugs to the system. A "courageous" programmer (backup up with properly written unit tests, of course), will refactor the ugliness away, thus incrementally beautifying his code.

This overall process, reiterated over the product lifetime, will either produce a convulated codebase with loops, noodles and baggage (for the "cowardly" programmer), or will result in a clean, easy to use and modular code for the "courageous" one.

While refactoring is a time consuming activity at times, it is well worth the momentarily increased coding time, because the overall coding (including maintenance!) time for him and his entire team will be decreased significantly.

The existence of well written unit tests is crucial to this, for without it you really can't know if you introduce bugs or not. With unit tests, you get a significant "courage boost", allowing you to do major changes that affect many files - for the better - because you are reasonably certain that any change will indeed be detected.



On the other feature of a good programmer - laziness - in another time.

08 April 2008

Self-Replicating 3D printer

This is essentially a printer that can print itself out (= reproduce), and is Open Source and free. Being still a research project, when it's functional I'm guessing it will spread like wildfire.

Rise of the machines anyone?

26 March 2008

Paid Military Service Suggested by Amir Peretez

This law passed in the initial vote, though I think it has a snowball's chance in hell to survive and become reality. Minimum wages for people who serve in the IDF.

I think this is a very good idea. In the dream world where this could actually happen it might be followed by the army becoming more efficient and competitive, layoffs for people that are not needed and just scratch their balls all day long - the end of the IDF as we know it today and the birth of something better.

Of course the money for all this will never come because of political reasons, even though in the long run this law actually saves money. But come on, it's Israel, what politician exists that gives a shit about the long run?

25 March 2008

Prepare For Summer

You know those ads "prepare your car for the winter"? Well, your computer deserves some attention as well.

The summer we've been having this March took its first victim - the thermic paste of my old Intel CPU fan has died, causing my computer's core temperature to get to 90+ degrees and shutdown a few seconds after boot. The fan itself was working OK, but without the conductive thermal layer it was useless. Also, the pins that hold it together to the CPU were not in great shape, and the guy at the hardware store said this could happen again in a month or two.



Since this is only fucking March and we have a long summer ahead of us (plus moving from Haifa to the hot Herzliya), I decided to give our computer a treat and purchase a powerhouse of a fan - the Thermal Take Blue Orb.



The installation of this fan requires removing the motherboard. I tried instead to take a shortcut and juts remove the back panel.



But no good. So, I disconnected all the MB cables,



and took out the motherboard



Consulting with the manual all the way through



And fighting off both our cats



Applied some fresh thermal paste (very important step!)



Screwed the fan back on the top of the MB



Fought off our other cat Nano



And voilà:



The result: my computer is summer-ready :)

23 March 2008

Cool GreaseMonkey Scripts

After Eran sent me this funny video today explaining GreeseMonkey (I knew it before, but it's still funny), I looked up a few user scripts from this list. These are the ones that look most useful to me:


  • LookItUp - look up stuff in Wikipeida by highlighting text and pressing 'w'.

  • Google Account Multi-Login - Change "Logout" button in Gmail to "Switch Users". Didn't work for me and some other recent users, but seems cool if it works.

  • Google Image Relinker - Google Images search results now has links to the images themselves, instead of to the containing webpage. Very useful.

  • Script Updater - Auto Update your scripts

למה צריך לאכול כשר

לפי הרב משה ביגל, מאכל מזון לא כשר יהפוך אותנו ללא מוסריים.

21 March 2008

19 March 2008

Robot Dog

A bit scary, but very cool.

17 March 2008

Joel on Web Standards

A mile long article by Joel Spolsky. He explains why he thinks IE8 should not force standard conformance, contrary to the popular opinion.

The On-Line Encyclopedia of Integer Sequences

I was trying to answer this question - how many labeled rooted trees with n nodes are there?

A quick search didn't find the answer (I'm sure a more detailed search would have). Then I had this idea - find the answer for small values of n, and look in the OEIS. I typed 1,2,9,64 in the search and quickly found the answer (which is n^(n-1) for those interested). I thought about it for a couple of minutes but still hadn't come up with an answer as to why this is true.

World Crops in Danger

here.

This reminds me of a good book I've read once, The Death of Grass (or ככלות העשב in Hebrew). Basically the grass/wheat of the world dies, then animals who depend on it, then the human race comes to cannibalism and rioting.

Better stock up on food while you can...

13 March 2008

EPS conversion

Anyone using LaTeX will sooner or later want to embed images in his paper. LaTeX only accepts EPS files - no standard support for jpg or png images. In order to use such images, you must first convert them to EPS. I'm using ImageMagick's 'convert' utility for this.

The problem was I was converting a 20kb png file and got a eps file over 1 megabyte in size! Reducing resolution and quality didn't help. Today I found the source of the problem - it appears that the eps format has 3 versions, and the default version is 1 - a very old format that pretty much saves everything as uncompressed ASCII. Once I told 'convert' to use EPS 3, the result was a 20kb eps file :)

Usage is simply:

convert fig.png eps3:fig.eps

Google Publication Fumble

Update - it appears the link I gave is simply a table of contents of an ACM symposium. So where is the actual paper?

---

One of the feeds I recently subscribed to is Papers Written by Googlers, (the web version is here). Apparently every link on the page is to some Google search instead of a definite link to a paper. I wanted to check out a paper titled Towards Temporal Web Search, by Marius Pasca and got a strange result page containing totally unrelated papers. Only the focused search I ran myself for the exact title gave me the actual article.

12 March 2008

The Little Things

Rarely do we appreciate enough the little things in life. I believe this sentence is true on many levels, and today I want to focus on one of our basest assumptions. We live in this physical universe, and are gifted with the unique ability to influence it. Firstly, this universe has a dimension of time to it, our lives are not static, boring, never changing. Instead they are dynamic, changing for good and bad, giving us a steady flow of new experiences. This is a basic requirement for the very definition of good and bad, because in a constant universe there is no differentiation, and everything is just plain zero. Living in a dynamic universe, we give meaning to each experience in relation to the previous ones and to the experiences that follow, and are thus able to observe and appreciate these changes, and enjoy at some of our moments in time, in contrast with other, worse moments.

Secondly, we are not simply watching our lives go by as if it were a movie playing in a theater. We are conscious, living beings, who can act of our own intent and purpose, and bring change to the physical world surrounding us. I'm not talking about grand plans and designs, I think we should be grateful about our simple ability to pick up an object, move our hands and feet, throw a ball and marvel at the effects we cause. The simple Newtonian rules of cause and effects govern our day to day lives and give us the simple pleasure of mobility. Furthermore, we wield tools to our every whim, and can rule over other physical objects. Of course this causes problems sometimes as some people forget that other people are not merely objects but willful beings of their own, and their will conflicts ... but I digress.

Before thanking God, chance or math, whichever you believe is responsible for creating this universe (I believe that physics is a subset of math) for gifts like wealth, happiness and health, remember to first appreciate the more basic qualities of our existence, without which there would be no questions of health, illness, happiness or sadness.

Interstellar Economics

For those of you not subscribed to my Shared Items, here is some silly research on the economics of interstellar travel.

First Fundamental Theorem of Interstellar Trade: When trade takes plaec between two planets in a common inertial frame, the interest costs on goods in transit should be calculated using time measured by clocks in the common frame, and not by clocks in the frame of trading spacecraft.

Second Fundamental Theorem of Interstellar Trade: If sentient beings may hold assets on two plaents in the same inertial frame, competition will equalize the interest rates on the two planets.

10 March 2008

Worm-Free Lettuce

I'm considering doing my grocery shopping online, and I'll probably use this website (Hebrew). I was browsing it today, when I came across this - they charge you 1 NIS more to ensure your lettuce is worm-free.


05 March 2008

Shared Items Feed & More

Hello guys, today we have several topics:

Shared Items

I finally really settled on Google Reader instead of a desktop feed reader. The advantage of being able to read RSS everywhere without any hassle outweigh the downsides. Also I get the benefit of easily exporting a Feed of Shared Items (both RSS and Email.

I think I will stop/reduce posting links to interesting items that I find on my RSS and instead just mark them as shared, so if you want to keep using my information filtering services be sure to register :)
In addition, here is a link to all previously shared items.

Google Notebook
If you've recently Googled you may have seen the "Note this" added to every link.



It's a useful new very useful. Upon clicking it copies the current content of said web page into your Google Notebook, a cool service that organizes your web clippings.
It opens up right on your search result page and has a full page interface as well.





Unfuddle free SVN hosting
If you're doing any non-trivial software assignment with partners, you should consider using source control. So far, I've used source control for large projects of course, but never in an assignment from Technion - back when I was an undergraduate student I was largely oblivious to source control and I didn't take any programming courses in my 2nd degree - until now. Now I actually have a few non-trivial homeworks at Managing Data on the WWW (writing an http proxy is one of them), and so far I didn't take up the trouble of setting up a source control. Well, it appears it is no hassle at all, at Unfuddle you can setup a project page, SVN server, RSS and email updates on checkins, project management and more in less than 5 minutes and no cost. Unlike some alternatives, putting your code there doesn't mean it's now open source and free to the world, you get control over who accesses your code.

03 March 2008

TwoThree

This is a cute math game I'd recommend to anyone learning addition, and in general :)
You shoot two's and three's at numbers trying to subtract from them and get exactly zero.

02 March 2008

User Generated Content

Now, on the map. Check out these three services:

Aya's Birthday

We've only had time this year to celebrate Aya's birthday with our families so far. We went to the Haifa Science Museum and then pick-nicked at Afek Reservoir. Here's how I had fun in the museum playing Tower of Hanoi in 40 seconds:



And for comparison:



The photos are on Facebook, for whoever wants to see:





UPDATE: Updated the link so people who aren't registered to Facebook can still view photos. Annoying how this is not the default, but inside the photo album there is a link that allows this.

Researchers Discover Gene That Blocks HIV

At Slashdot
a

Read one guys comment as he tries to explain the other techies why this is not yet a cure for AIDS:

"
*sigh* he's saying that this is one thing we might change on the program. A patch for the human code, say.

We only have a small problem ... the program is stored in a few trillion copies (all of which need to be changed), of extremely complex molecules (which we can't reliable modify (we can't even reliably read them) even when we have only 1 outside of the body).

Let's say it's this way. We have a patch for a flaw in your windows. Except it's on paper. And the computers won't boot until the patch is applied, so we need to take out the hard drive and *manually* change the bits on it. We have an electron microscope that *sometimes* has been used to change some random bits on the harddrive, which has once or twice resulted in a "mostly" correct change. Oh yes, and we have a billion computers, all of which still need to be operational after the change.

That's where we are. We know what to change (or so we hope), it's just ... "a bit" hard to get to the bits.
"

29 February 2008

Google Is Still #1

I had wondered of we all use Google because it is objectively better or because we are used to it being better all this time. Maybe Yahoo and MSN had improved since we decided to switch to Google?

Here, try this search on MetaCrawler. Only Google finds this page. Google has the benefit that it owns Blogger and can possibly get easier access to its database, but still that hardly justifies as an excuse for the other search engines - the post being searched is over a month old!

Blackout Restaurant & Dialog in the Dark

I encourage you to read Eli's review of the new Blackout restaurant in old Jaffa (יפו) - it's a restaurant with absolutely no light - it's absolutely dark and you can't see anything, similar to Dialog in the Dark in Holon's Children Museum. I didn't visit Blackout (at 140 NIS per person it's quite expensive for my taste), but it sounds like a cool experience. The tour in Dialog in the Dark also contains a "restaurant" with only drinks and snacks, but it was still a great experience. You pay with coins and are amazed how the blind bartender figures out how much you've payed.

27 February 2008

Music Sales

As a new music creator surfaces, his few fans just buy his records. Then, at some point, someone puts it on some file-sharing network and only people that actually believe in paying for music do.



My New Job

Now that the formalities are over, like Tomer and Shlomo, I can now announce I'll be joining Delver (A.K.A Semingo) on April 1st. Delver is a startup building a social search engine, that will allow you to find information based on your social network.

Starting April I will be in Herzliya daily, and will move back to the center around May.

If you're interested, you can about us at Techchrunch, register for the private beta or watch our CEO Liad previews Delver at a demo conference.

Oo, and for some reason this next image, which is the first Google Images result for "delver" was blocked by SafeSearch (Google's adult images filtering), and only showed up when I disabled it. Weird.



UPDATE:
Fix broken link to Delver, thanks Sagie.

26 February 2008

How Prometheus Died

From Wikipedia

Benardete’s paradox

While not strictly a supertask, this idea has inspired many papers about supertasks. A man called Prometheus angers Zeus, so Zeus gathers an infinite number of demons and issues them with the following commands. Demon 1: if Prometheus is not dead in one hour kill him, Demon 2: if Prometheus is not dead in half an hour kill him, Demon 3: if Prometheus is not dead in quarter of an hour kill him, and so on. As it turns out Prometheus was dead within the hour (as he didn’t really have much chance). The council of gods was not happy about this and pressed Zeus on the point. But none of his demons could be found guilty, as, for each positive integer n, it was not possible for the nth demon to have killed Prometheus because the (n + 1) th demon should already have done so. Similar paradoxes involving a man trying to walk a mile from A to B but the demons building a wall in front of him if he reaches 1/2, 1/4, 1/8, … of a mile past A, so he hits some sort of invisible barrier when he reaches A even though no wall has been built.

25 February 2008

Bunch Of Links

What makes Google the best, according to Google.

How IBM is filing for a silly patent.

How to make your plants call you or update their Twitter status when they need water.

And finally:


Coconuts are so far down to the left they couldn't be fit on the chart. Ever spent half an hour trying to open a coconut with a rock?  Fuck coconuts.

24 February 2008

Stories Website

I tend to write short stories from time to time, when I get the muse.
I opened a short page that I will use to host some of those stories.
Here is the first one, Reading Dracula.

BTW, you can use Google Page Creator for creating & hosting short webpages like this one and even hosting files up to 100mb.

23 February 2008

Politically Correct Office

This is new to me - it appears that in addition to the usual spell-checking and sentence structure checks Word 2007 does, it also includes a political correctness checker. Check this out:

A Buffer Overflow for TAs



20 February 2008

Faulty Reverse Turing Test

I got this PDF attachment from Technion, and opening it directly took too long for some reason (Gmail is terribly slow for me lately), so I tried Gmail's "View as HTML". Apparently, it thinks I'm a bot:

19 February 2008

Grid is a Superb Game

At least that's how I feel after I played a single time at it.



It's a combination of 16 more and less familiar games, which are time-slotted - just try it. Most games are very easy, but the rapid changing of games makes it challenging. Another bit of coolness is that it analyzes your different game skills:

What do LaTeX, Magical Staves and the Simpsons have in common?

I'm using LaTeX a lot to write my thesis. Today, when searching for something in the complete manual (PDF), I came across this:

17 February 2008

Firefox Saved Passwords

For those who don't know or forgot this, Shlomo posted how in 3 easy steps you can view all stored usernames & passwords on Firefox.

Not that scary, because you should only save password on a computer you trust. But still, I would have removed that feature or at least have a master password to access it.

13 February 2008

Stupid Danish Cops

Funny as hell, "cyber crime" just stole someone's home computer on allegations of credit card theft.

Interactive RSS

Like or not, I find myself using Facebook, reading stories and rating articles "I Like" or "Dislike". I would rather read this feed in my RSS feed then log into FB constantly, but then I lose the ability to rate stories.

How about a supplement to the RSS standard which would allow a user to vote on/rate articles, tag them (not just locally in his feedreader), and generally send information back to the RSS info supplier? I'm guessing this might benefit both content supplier and user. In said Facebook example, today if I have a smart enough RSS reader maybe I can rate articles, but this rating is separate from Facebook's internal rating system.

Occupied Territories

I usually don't care about many small arachnids in superfamily Ixodoidea, but this comics, based on a true story, is incredible (thanks Yoav):

12 February 2008

What You Need to Know to Work For Me

If you are ever interviewed by me and I happen to ask you, say, to write a function that returns the nth element in the Fibonacci Series, you had better not give me the recursive solution.

It appears that about 90% of the people asked this give this solution straight away, without asking the examiner anything about efficiency. I find this appalling.

Even if efficiency is not always the number one criteria (or even in the top 5), in this instance the recursive solution is much worse (exponential VS linear complexity) than the non-recursive solution AND is not much simpler to code. The difference is about 3 lines of code.

I expect programmers to anticipate and consider such concerns, and even if not asked specifically to give an efficient solution, in such a case they should (unless of course they ask the examiner if efficiency is a concern and get a negative answer).

P.S.

There are some acceptable recursive solutions. For example, from Wikipedia:

public void run(int n)
{
if (n <= 0)
{
return;
}

run(n,1,0);

}

private void run(int n, int eax, int ebx)
{
n--;

if (n == 0)
{
System.out.println(eax+ebx);
return;
}

run(n,ebx,eax+ebx);

}

I don't object to the actual recursion, just to the exponential inefficiency.

11 February 2008

Fake Sites

Lately I see many sites using common misspelling with similar site design to attract users. Today was the first time I was attacked by one such site.

I was searching my own blog on the net to understand who if at all links to it, and got
this dangerous and misleading site. I saw a supposed link to my blog that looked like this (don't follow this one):

http://technorati.com/blogs/qimmortal.blogspot.com

Clicking it I got a Firefox warning asking if I want to run this ".com" application. Evil bastards.

Science Vs Faith

Not faith in God, which cannot actually be refuted by "contradicting evidence". Rather, faith in some religion and stories, some of which contradict known scientific facts (= theories proven beyond reasonable doubt), like Evolution.



My First Unfamiliar Reader!

Woo Hoo!

I just got the first confirmed reader of my blog which is not someone I know - Mord Shtern (he receives a link to his blog as a modest reward).

I took this chance to look at some Feedburner stats, and there seems to be a jump in reader count since last month.




This might have something to do with the fact that Yoav shared many of my recent posts as interesting in his blog and/or the fact that Zeirman mentioned me and my post about real time strategy games.

Thanks guys :)

If you survived this self-absorbed post you get something in return:

08 February 2008

The Best Incredible Machine Ever

Here

You haven't seen anything like it, though I would bet it wasn't filmed in a single take.

The chess plays are ingenious.

Too Long, But the End is Amusing

Trampoline

Some Comics I Like


  • xkcd - For geeks only! Funny and smart

  • Penny Arcades - For gamers only. I don't understand over half of it, but the parts that I do are good.

  • PHD comics - For master students and above only? Not very amusing so far. Perhaps I shall stop once I'm no longer a student. BTW, the current one nicely describes what I'm doing yesterday and today, though I'm more light headed than him. Grading papers can be very funny sometimes (one error a student wrote from a "Spot The Bug" - "This function name is too long")

  • Basic Instruction - So far I've seen only the parts Yoav's filtering out for me, which are all excellent.

07 February 2008

Something I Wrote Once

Words are bullshit. Words are bullshit because they make us think we know the answer. When we say them, we think we know what we feel because we put it into words. When I write them (I'm writing some right now), it makes me feel I can articulate myself, express how I feel. But I can't. The image presented by words is always a fake one, even when the words are best-intended.

This is Zen, as much as I understand Zen.

And yet, words are all we have

P.S.

A possibly relevant quote from Albert Camus I just found by accident.

"Do not be surprised. I do not like writers and I cannot stand their lies. They speak so as not to listen to themselves speak. If they did listen, they would know that they are nothing and then they would no longer be able to speak."

06 February 2008

An Idea for a Startup :)



Credits to Eran and Aya.

05 February 2008

2008 Turing Awards

Just thought to tell everyone that the 2008 Turing Award will be given to two guys that invented Model Checking, that has a very loose connection to my own master thesis. How loose? Both relate to Temporal Logic, that's it.

04 February 2008

Google SMS

Not functioning yet in Israel (at least on my cell phone), but looks cool.

http://www.google.com/intl/en_us/mobile/sms/

03 February 2008

Sex, Cars & Mp3s

Passing the time I entered this search query into Google Trends. I compared the number of times people search for Sex & Mp3s, and I got these weird peaks at the end of every year. I thought it might be some glitch, and tried adding Cars to the comparison, but the Car search graph didn't show this phenomenon.

Guesses, anyone?

01 February 2008

A Very Exciting Snowboard Trip

Finally got some free time to blog about this snowboard trip. This was the most interesting one yet, to say the least.

First some links, then the story.



We spent the first night in a motel in Geneva. In the middle of the night, unexpected, this korean guy pops into our room, grabs a bed and starts sleeping.



The next day, we get to the ski resort Les Menuires, a part of the 3 vallies ski area. We deposit our bags and go straight to off-piste, getting stuck in the area of this small river crossing, forcing us to walk a bit to return home.



After every day of surfing, we had to cook our own food, because, well, that was the deal. My sister joined us at this point, getting herself a very cheap flight from Irsael and staying as a 5th person in our 4 bed room (which had a spare bunk, luckily).



We continued with some more clean snow (not powder yet, but still rather fresh) and clean skies.
This is when Jonathan and me took the time to photo a few successful jump pictures:







And a rather unsucessfull one:



Unfortunately, nobody remember to bring a bottle opener



But we managed to make a toast anyways



The next day, Jonathan spairned his ankle, and we hurried to the doctor. Luckily, he didn't get a cast, only an air-cast, which didn't prevent him from skiing.



Around the fourth day of skiing we got a day of fresh snow fall, making the rest of the week filled with fresh and deep powder





It was in this off-piste that we found some ice stalactites.



Pisnoy and I left Jonathan at the apartment and went to a short off-piste of our own. Little did we know...
We enjoyed the powder for almost an hour out of the trails and we noticed the time was getting late. We encountered a group of skiers with an instructor that passed us by, so figured we're ok, and we'll get back to Les Menuiers or some other town soon enough. We were wrong. We traveled a number of kilometers by foot, and the sky was getting dark. Eventually we decided to stop at a village, only to find it totally abandoned.



We broke down two doors



Only to find they led to a garage



Of course we had no cellular reception, so we had no way to let everybody know we're ok. Search parties were dispatched, but to no use. We spent the night shivering, woke up, and managed to get out on our own, with a ride from our friends once we reached the road and got cellular reception back again.

There was questioning at the local police station where the French cops yelled at us (in French), but our interpreter (some guy from the insurance company) translated calmly and we were back skiing the next day. That's when Jonathan decided to ignore the warning signs on some off-piste and go right ahead.



Of course he couldn't complete the descent, neither could he climb back up. He was stranded there and we called for Aerial Rescue. Instead, we got a team of two rescuers on skis.



Which took Jonathan down with ropes.



At the end of the week we enjoyed a night at the spa, got some Pizza



, slept on the airport floor for a few hours



and headed on home, with me making great progress on the latest George Martin.