2008/05/15

This is Hilarious.

I have taken an insane addiction to ohloh, the new penis e-meter based on how much you code for opensource projects. The hilarious part is their totally skewed metrics:

No, I do not believe SCC being worth circa 120 grands (at least, while you read this post). OTOH OHLOH could be useful if integrated a bit more with LinkedIn, just to be able to showcase your calculated software talents also on that network, (project usage and commits metrics mean an awful lot inside software projects) or if you could map your OSS neighborhood to your business colleagues.

2008/05/12

Got problems with Cygwin?

Helping a colleague to install Cygwin on his own machine we came across two problems:

  1. Running Cygwin after setup a window opens and closes again rapidly. . Cause: Cygwin did not install the bash shell. Possible solution: re-install the base packages, or better reinstall cygwin altogether.
  2. Running Cygwin you find only the bash shell with bash-3.2$ as prompt. Cause: Cygwin does not install everything (running scripts to recreate the /etc/profile file) because the Cygwin dir was already there and not with the permission it expected to find. Possible solution: delete the C:/Cygwin directory, run setup again putting the install packages NOT under C:/Cygwin/THE_DIR_YOU_CHOSE_BEFORE directory.
Hope this helps.

2008/05/07

Howto: Checkout sexycodechecker in SharpDevelop 2.0

Addendum: I created and posted a new .sln file for plain Visual Studio. If you use it, this tutorial here will work as well for Visual Studio 2008, probably on the 2005 version with .NET 2.0 as well since I removed all the 3.5 dependencies from it (scc is so does not need LINQ yet ;) …) but YMMV with it.

I had to install SharpDevelop 2.0 and .NET SDK 2.0 on my computer (it is still a Windows 2000 machine, while my brand new laptop is a vista machine with Visual Studio Express 2008), and since I was checking out the project from Berlios I decided to write down these installation notes.

  1. Install NUnit, TortoiseSVN and SharpDevelop 2.0 on your machine. Open SharpDevelop.
  2. Check out the project from SVN
    • Choose the Tools > Subversion > Checkout menu option.
    • As Repository Url give:
      http://svn.berlios.de/svnroot/repos/sexycodechecker/trunk
    • As Checkout directory give:
      C:\Documents and Settings\Yourusername\Documenti\SharpDevelop Projects\cft-sexycodechecker
  3. Open the solution: the correct solution file for SharpDevelop 2.0 is cft-sexycodechecker.shdev2.sln (Other solution files will be created as soon as I can)
  4. Edit the Parameters.xml file
    • In the projects view, check the "show all files" option, then find the Tests/Resources/Parameters.xml.prototype file. Copy it as Parameters.xml and customize it putting the root-level source dir in C:/Documents and Settings/Yourusername/Documenti/SharpDevelop Projects/cft-sexycodechecker/cft-sexycodechecker/
    • Beware: Sharp Develop 2 will not allow to copy a file and paste it again in the same directory. It will not create a new copy adding "Copy of" in front of it. You have to copy, paste and rename it from outside the ide.
    • Q: Why are you using a .prototype file and you are not posting the xml file directly to svn?
      A: Because it has parameters tied to the local machine and I do not want to wake up one morning finding that my Prototype.xml has been changed because someone committed it accidentally.
  5. Now build the solution (alt+F8)
  6. Run NUnit to check that all is fine and dandy with your project
    • Open NUnit, select the File > Open Project menu option and load the cft-sexycodechecker.dll under the bin/Debug directory
    • Beware: It could happen that your NUnit test fail spectacularly with:
      Nunit Cluefultoys.Xml.LoadingTest (TestFixtureSetUp):
      System.NullReferenceException : Object reference not set to an instance of an object.
      The cause of this error might be because you have not configured Parameters.xml, or somehow it was un-embedded from the assembly resources. You have to open the Parameters.xml properties, and set it as "BuildEmbedded" action.
    • Another cause of this error might be because you have recreated the project .csproj file from scratch and you havent set the root namespace correctly: it must be Cluefultoys and not cft_sexycodechecker.

2008/05/06

Will troll for Scala.

I don't know you, but i personally find that a language that allows the use of an ascii butt is a welcome addition to Information Technology.


class Butt {
  var ass:Boolean = Array(true, false, false, true, false).reduceLeft[Boolean](_|_) 
}

object Dick {
  def main(args : Array[String]) : Unit = {
    var x = new Butt
    println("Your ass is grass (" + (x.ass) + ") and I'm the lawn-mower")
  }
}

2008/05/05

#5 make your stuff identifiable

  • Identifiers, including iteration variables, will be spelled with names of at least three characters.
A coding rule I read in my previous job, probably one of the few rules that had sense inside the whole "The Evil Company" software coding standard, asked us to use two-characters iteration variables like "ii" or "jj" instead of the classic CS-style "i" and "j". It had sense because, I think, it helped our unix-and-j2ee department to check if there were problems in the java source code files using command line tools (looking for the "i" variable will also give you the "validate()" method, the int keyword, the if keyword…).

This made me reflect: Why are we still using one-letter iteration variables?. If the i variable is an index, why can't we call it index? Eclipse or Visual Studio will gladly help us to call it index in a speedy way (ctrl+space iirc). We are not anymore on teletypes, and you could also do a little sacrifice and back up that porn on a dvd and then delete it from C:\ to make space for wider source files.

What is true for an admin ruining his eyes on a linux console, is also true for you ruining your eyes on the eclipse debugger: it is better at least that you understand what you are reading. Three characters is the minimum number of letter for having a meaningful name, at least in the vast majority of cases and talking about modern english, not logographic languages, and of course this rule has an implied part that asks the programmer to use names that are good enough for the job. Unfortunately finding properly named code is not a job for an automated tool, but it is a suitable job for a mace-wielding technical architect.

#4 do not put too many eggs in a basket

This is the only rule that remained true to its own original version… like it was originally conceived while I was cleaning up my room before moving back to my hometown.

  • Every method will be of 20 lines max.

While a 400 lines long program can stay into a single method, a program longer than that must be modularized. When you vote for modularity, expecially in an object oriented environment, you are going to work for a division based on the data over which you must act: you keep the code that acts on a certain kind of data local to that data. Therefore it becomes useless to keep information on the way you act over, for example, end-of-the-year dates in the same method where you act over usernames or files on a remote filesystem. The remote filesystem files are not interested by how you well can handle the dates or username. And at 2.00 in the morning you wouldn't be interested by those relations as well if you are only trying to understand why you cannot suddenly access the remote filesystem.

So, in order to avoid this dispersion of concepts you need to factor your code into small, compact methods. 20 lines is actually a number large enough to allow some fragmentation and repetition, but it still allows a version of a CS algorithm like Merge-Sort (at least, a version I spiked out some time ago) without it being split further.

I think essentially the whole concept behind 700x128 boils down to "do not make methods that are long too much"... and remembering how was my Java life before changing job I think it is probably a strongly motivated rule. :)

2008/05/03

Ceci n'est pas un fanboy post.

Quoting from Gamefunk...

That being said, there is something seriously wrong with the Nintendo Wii. No, its not that it doesn’t have the graphical capabilities of the 360/PS3. Nor is it the lackluster online service Nintendo provides either. It isn’t the paltry amount of hard drive space, sometimes unresponsive accelerometers of the nunchuck, or even the chuckle-inspiring name of the console. Its the software library.

BY COMPARISON
Since its release in 2005, there have been some 374 games released for the XBox 360. Of the 374, 86 titles have received a ‘good’ rating(an average ranking of 80% or higher, as per GameRankings). 92 have received ‘poor’ ratings(an average of lower than 60%). That means about 26% of the games for the 360 are ‘good’, and about 24% are considered trash. The PS3 has seen 122 games released, with 40(33%) good games and 20(17%) poor games(ironic considering the most common argument against the PS3 is a lack of good games).

2008/04/30

Scratch the thin patina.

Scratch the thin patina that covers people on the surface, the crust of words and high hopes that they surround themselves with, and they will always show you their real colours. The only stupid is only me that always fall for the same old trick.

2008/04/27

My take on second life.

From the pictures I see around, if you produce content for second life you are just wasting your talent. The engine still has the quality of a pre-quake2 3d graphics engine, and no matter how much time you spend to make your models and clothes better, the "in client screenshots" will still look awful. Heh, Linden Dollars, what have you done to people? I hope that at least SL content creators makers still keep high res tiffs of those textures stored somewhere, just in case Lidnen releases a less crappy engine.

This post was brougtht to you by: a search for the packages of Electronic Arts "Whatever Construction Set" videogames series, and a big dose of ADHD, oooh, shiny!

2008/04/26

Seen it live...

[your application is] having scalability problems because you coded a ton of N^2 loops into it and you're too self-important to get peer reviews on your commits.

Ted Dziuba's word on scalability. That resonates with me as I have seen an application having exactly that problem, and the only solution being allowed was to "rewrite all the sql queries".