Fishing some new slices of life…

Computer science

Hiren’s BootCD : rescue your system in emergency cases!

Hello geek-ish friends !

I’ve been trying to run my own server lately, to serve my Fyrtorn project (it’s not dead btw, far from it… I’m just having some trouble with it, thanks to Mr. Murphy)… And I happened to run into some hard disk drive trouble. Thankfully, I rediscovered the power of the famous Hiren’s BootCD, a multi-purpose tool I would like to tell you about.

Hiren’s BootCD is a very nice bootable CD (roughly, it starts when you switch your computer on). It has many useful computer-emergency tools that can save your OS and data. It’s particularly handy when you have to deal with corrupted HDDs : you can use it not only to retrieve data from lost partitions, but also to repair a HDD, to remove bad blocks, to manage partitions or even to perform a low-level format on it ! (the last emergency procedure to save a HDD, it tries to totally erase data on each sector of it and doesn’t only delete partitions)

It’s not the only things this bootable CD can do though : if you are having trouble with ferocious viruses, with your internet connection, your filesystem or even if you have lost your password, it will provide you some help !

To conclude, it’s definitely a very nice CD that could make your life significantly easier if you have it under hand. Get it !


Versionning systems : centralized systems VS distributed ones.

Hi devvies,

I have decided to share with you some of my experiences I lived while working on Fyrtorn, my big android project (I hope you’ll hear of it sooner or later!). So today, I’ll talk about a very important point for any organized devvie… Versioning.

So, what is Versioning? Just to remind you guys, it’s a very nice system that stores every evolution of your code in a different version, so that you can retrieve any version anytime anywhere on any computer. Cool, eh ?

There are two main branches (no pun intended…? ) in the world of versioning : centralized versioning systems and distributed ones.

In Centralized systems, there is only one repository containing your sources, and it is located on your source server. When you want to modify your code, you have to upload the code on your machine, make your modifications on it, and then send everything back to the server. The latter will then create a new version based on these modifications. CVS or Subversion (SVN) use this versionning system.

Pros and cons :

  • They were historically the first system to appear… so there are more internet servers supporting this technology than for distributed systems, although the most known ones are trying to support all of them.
  • As there is only one centralized repository, it somehow limits bad surprises while creating a new version : since you ideally have to upload (commit) your code for each atomic improvement, it limits the size of modifications, and therefore avoids too big merging operations.
  • It is less reliable than distributed versionning systems. Since it is all centralized, it is impossible to retrieve all your source history without having an access to the main server. And that makes a lot of data loss if this latter crashes.

As for Distributed systems, everything is located on the server. However, to make modifications to your project, you first have to clone the repository to create your own one locally: therefore, you can have some kind of “local versioning”, on which you can commit atomic modifications. Then, when you feel everything is ready, you can send all your commits to the main server, which takes them into account. Mercurial or Git are some common distributed versioning systems among others.

Pros and cons :

  • You can always rollback to the last commit, or you can even cancel all your modifications. It makes distributed versioning really better for working locally.
  • However, the presence of a local repository means that there will be bigger merging trouble if you ever forget to update…
  • Still, the biggest advantage in versioning is that in case of a server crash, there are still many local repos available, since each teammate has to clone it on their computer to make any modification. That’s significantly less trouble in case of a server crash, believe me.

Which system is better? Well, this is another trolling question in the computer science community. In my opinion, Distributed systems are better, because of their reliability (which is something I value a lot, and which is the main raison d’ĂȘtre of versionning after all)… but you can do what you want, really.

Oh, and last point : avoid Visual SourceSafe at any rate. Really. I mean it. This will give you nightmares otherwise. Here’s a good article about why you shouldn’t.

And you, what do you use as a versioning system ?


Need some ReST ? Get a Hammock!

Hello dear techie friends!

Lately, I’ve been working quite a lot on Windows Phone 7 C# programming, and particularly on ReST requests (if you don’t know what a ReST request is, I suggest you simply check it here, seems a nice site for me). And I’ve discovered this pretty nice ReST library, Hammock, pretty useful to simplify this protocol, and quite valuable for WP7 programming. Thing is… data is quite hard to find about it, so I thought I would write a little something to help the community. And this will be my first comp-sci post… Therefore, here I am!

  • Include everything needed :
using Hammock;
using Hammock.Authentication;
using Hammock.Authentication.Basic;
using Hammock.Web;
  • Create a RestClient instance :
RestClient client = new RestClient
{
Authority = "http://www.google.fr",
SilverlightMethodHeader = "GET",
UserAgent = "Mozilla/4.0 (Compatible; Windows NT 5.1; MSIE 6.0)" +
"(compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)"
};

If you need credentials, create a corresponding object :

IWebCredentials credentials = (IWebCredentials)new BasicAuthCredentials
{
Username = "username",
Password = "password"
};

and then add it in the RestClient declaration :

RestClient client = new RestClient
{
Authority = "http://www.google.fr",
SilverlightMethodHeader = "GET",
Credentials = credentials,
UserAgent = "Mozilla/4.0 (Compatible; Windows NT 5.1; MSIE 6.0)" +
"(compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)"
};

If you’re behind an proxy requiring authentication (at work for instance), you will need this :

string authentication = "username:password";
string encodedAuth = System.Convert.ToBase64String(Encoding.UTF8.GetBytes(authentication));
client.AddHeader("Proxy-Authorization", "Basic " + encodedAuth);
  • Create a RestRequest instance :
RestRequest request = new RestRequest();
  • Throw the request and catch it with a callback function :
client.BeginRequest(request, new RestCallback(myCallback));

The callback function would be :

public void myCallback(RestRequest request, RestResponse response, object userState)
{
// Putting the response string into the variable named "hello".
string hello = response.Content;
}

Hope it helped people with Hammock!