Categories
iola

Django Alliance

Being small and agile has many advances, but sometimes people confuse it with being fragile. Although one could argue that betting on a single-vendors proprietary solution would be a more fragile business proposition. Anyway, to make people feel safer buying web systems developed in Django and Python based on Open Source, we have had a finger in the creation of the Django Alliance. The web site complements Django People with a focus on companies rather than on single individuals.

Categories
iola On the web

2 great links

I’ve been very happy enjoying these two pieces of distractions the last week. So happy I’ll write a small blog entry about it instead of just saving it to delicious 🙂

– Paul Graham on Disconnected Distraction

David Heinemeier Hansson on starting small

Categories
iola On the web

Yayart.net launched

I’m very please to announce that we, at iola, have launched a new site for digital artists today. For the 31 days there’s a competition where you can win lots of nice stuff including an exhibition at the center of Copenhagen. The site is coded in Python (Django) and uses varnish for caching.

Categories
iola nemo

Nemo 0.2.2 released

I made a new release of Nemo 0.2.2 today. It has some nice memory usage improvements and indexing fixes. Plus day view got pagination so that it can handle large number of files on a single day (like an svn update) gracefully. Upgrading is highly recommended.

Categories
iola nemo Programming

Nemo 0.2.1 released

Did the release of nemo 0.2.1 today. The release is the result of a large amount of massaging of the nemo code to use less cpu and memory (a garbage collector suddently makes these interlinked in a new one is not usually familiar with when coming from a language like C++). Then some profiling and massaging of GTK# which is sadly still not 100% ready for prime time. And finally some poking at mono code for which I’m not ready with a patch yet (tomorrow it will be), but I’ve improved the performance of the inotify backend of the filesystemwatcher by quite a bit especially when watching a large number of directories.

Categories
.net c# iola Programming

Iimplement brain damage

Had this annoying bug today where something that seemed perfectly resonable just didn’t work. After much investigation it appears that once again brain damage from Java has managed to over into C#. The problem is illustrated with the following code (You can ignore the Tuple for now):

public struct Tuple < TFirst,TSecond >
{
    public TFirst first;
    public TSecond second;

    public Tuple(TFirst first, TSecond second)
   {
	this.first = first;
	this.second = second;
   }
}

[...]

Tuple < int,string > t = new Tuple < int,string >(1, "1");
Tuple < int,string > t2 = new Tuple < int,string >(2, "2");

List < tuple < int,string > > lt = new List < tuple < int,string > >();
lt.Add(t);
lt.Add(t2);

List < tuple < int,string > > lt2 = new List < tuple < int,string > >();
lt2.Add(t);
lt2.Add(t2);

System.Console.WriteLine("eq {0}, == {1}", lt.Equals(lt2), lt == lt2);

Which gives the following result:

eq False, == False

Ok that was strange, in Python and C++ one doesn’t have to use Equal or anything similar and furthermore == gives the correct result since it compares elements memberwise instead of just checking the reference. I recalled that in Java one has to use Equal on strings, since == just compares references. So I googled around and found an explaination in point in the following link at 6.7. Note all the special cases. The best part is the following paragraph: “The implementation of Equals() in System.Object (the one you’ll inherit by default if you write a class) compares identity, i.e. it’s the same as operator==”. Apparently List doesn’t to that, despite their efforts to help, great… So we’ll have to do that ourselves:

public static IEnumerable < tuple < T1,T2 > > zip < T1,T2 >
(IEnumerable < T1 > l1, IEnumerable < T2 > l2)
{
   IEnumerator < T1 > i1 = l1.GetEnumerator();
   IEnumerator < T2 > i2 = l2.GetEnumerator();

   while (i1.MoveNext() && i2.MoveNext())
       yield return new Tuple < T1,T2 > (i1.Current, i2.Current);
}

public static bool sorted_lists_equal < T > (List < T > l1, List < T > l2)
where T:IEquatable < T >
{
   if (l1.Count != l2.Count)
       return false;
   foreach (Tuple < T, T > t in zip < T,T >(l1, l2)) {
        if (!t.first.Equals(t.second))
              return false;
         }
   return true;
}

IEquatable is an interface what basically says that it will compare by value. But even though our Tuple implementation is a struct and thus is a ValueType it doesn’t implement this interface (the Equals method). It instead automatically defines the == operator to work as one expects since it’s a ValueType. So we have to change Tuple:

public struct Tuple < TFirst,TSecond >
: IEquatable < Tuple < TFirst,TSecond > >
{
   public TFirst first;
   public TSecond second;

   public Tuple(TFirst first, TSecond second)
   {
	this.first = first;
	this.second = second;
   }

   public bool Equals(Tuple < TFirst,TSecond > other)
   {
      return first.Equals(other.first) && second.Equals(other.second);
   }

    public static bool operator==(Tuple < TFirst,TSecond > lhs,
    Tuple < TFirst,TSecond > rhs)
    {
	return lhs.Equals(rhs);
    }

    public static bool operator!=(Tuple < TFirst,TSecond > lhs,
    Tuple < TFirst,TSecond > rhs)
    {
	return !(lhs == rhs);
    }
}

The last two functions was added because now that we’re implementing the IEquatable interface the compiler doesn’t seem to want to implement == and !=.

So instead of the following Python code:

a = [(1,"1"), (2,"2")]
b = [(1,"1"), (2,"2")]
a == b

We have to do the big mess above :-/

Categories
iola nemo

Nemo 0.2.0 released

Long time since I’ve blogged about Nemo. Since the initial release a little over a month ago we have had two major releases, the first one a bugfix release to fix some of the defects reported and the 0.2 release which adds support for beagle through Xesam and lots of other nice enhancements like pagination on the search results popup and better indexing performance. The software is still fresh but I consider this to be the first release that I would feel comfortable recommending to a stranger 🙂

Categories
Free Software iola

Server almost Ajaxianized

Ole, friend and collegue from iola, released flot today. Flot is a Javascript plot library for jQuery released under the MIT license. The release got mentioned on Ajaxian and brought the server this blog is also hosted on to its knees. Several hours later, out server is now up and running again with lighthttp as a proxy shield in front of the dear apache server that could handle the load 🙂

Check it out if you need some client side web plotting. The graphs are quite nice since they are antialised and with shadows 🙂

Categories
iola nemo

Announce Nemo 0.1

I’m very pleased that I can now finally lift the curtain and show what I’ve been spending most of my time working at iola on.

It’s been a long ride, but now the alpha release is finally ready for public consumption 🙂

Categories
distributed iola VCS

The problem with depending on a server

So here at iola we use subversion internally. It’s ridiculus that the following use case doesn’t work:

<do stuff>

svn commit

<do stuff>

svn commit

<I forgot what I had written in last commit log>

svn log (local copy out of date, only shows revision before the first commit)

svn update

svn: Working copy ‘.’ locked
svn: run ‘svn cleanup’ to remove locks (type ‘svn help cleanup’ for details)

Owned 🙁