My blog has moved! Redirecting...

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

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)