Marius Gheorghe

Building software : make it work, make it good, make it fast

Mozilla and DRM

Big debacle over Mozilla's decision to support DRM. FSF is not wasting any time of condemning Mozilla's decision.

 The thing is ....it's not that simple. Mozilla main source of revenue comes from Google. Google pays quite a lot of money to have Google search as the default search engine on Firefox. And they do this because Firefox has a nice marketshare. Mozilla "livehood" depends on this. If they choose NOT to implement EME ( Encrypted Media Extensions ) , their marketshare will fall down (people will ditch FF because Hulu/Netflix and any other movie streaming provider won't work on a browser without EME support) , and Google will stop paying them because Firefox marketshare will become (almost) irrelevant.

 So, the way i see it, Mozilla's decision to support EME is more of matter of survival for them rather than politics.

Neverwinter saga minireview

    More Drizzt , yay !! The good news is that the first book, Gauntlgrym, is pretty enjoyable and hearkens a bit to the old books. The bad news is that the next 3 just aren't that great. They aren't bad but they aren't good either. My main criticism is that is just not enough interesting content in there. Too much filler (and, i think, RA Salvatore releasing a new book each year doesn't help with this). Anyway....personally i wouldn't mind waiting 2-3 years for a good book with Drizzt.

So what are you ?

I ask this question pretty often to my fellow colleague developers. I'm actually very interesting to see how exactly they perceive the work they do. Most of the time i get back the boring (and untrue) "engineer". Most of the people "doing software" seem to think they are engineers. This can't really be further from the true (if you don't believe me, you should speak with a "regular" engineer from other areas and compare your work with his/her).

Another category of people think of themselves in more abstract terms : poets (because writing code is exactly like writing poetry, right ?) or even philosophers. Obviously, this is bullshit....

Other people think of themselves as craftsmen (personally i think this is a lot closer to the truth). At the end of the day, personally, i think building software is a lot like regular craftsmanship.We use tools just like other craftsmen (instead nails and hammers we use IDEs and debuggers) to "craft" something. The result of our work is , hopefully, something that other people enjoy to use.

What i don't understand is why do people get upset when i told them there isn't much of a difference between what they do and people who build chairs...

REST services and documentation

In theory REST is the pinnacle of simplicity. Just a HTTP request (GET or POST) along with the data and that's it. In practice things get a little bit more complicated. The biggest problem i noticed with REST services (apart from having crap documentation most of the time) is that some people writing services expect the passed parameters in certain place but they usually fail to document this. Basically you can pass datato the service "stored" in 3 locations :

  1. as parameters in query string
  2. as custom http headers
  3. in body (either url encoded or a json object for more complex stuff)

Like i said sometime people expect a certain parameter in a certain place but forget to document this. When writing services you'll make the life simpler for all people consuming the services if you check in all 3 places. Overall it just makes things simple.

Another interesting thing i noticed is that , instead of actually writing some docs about how to consume the service, some companies started to offer libraries for this. A few days ago i was looking to do a integration with a SMS provider and frustrated about their docs i've decided to look at their library. Lo and behold it was a 9 (!!!) Mb assembly !!? Curiosity got the best of me and i cracked it open with dotPeek to see what's inside . The service code were fairly small but it had 2 (!!) 3rd party "REST frameworks" bundled up along with their code. Why the heck you i use a bloated library like this ? Just because they can't properly document a web service with 5 frigging parameters ?

Usually people bitch about SOAP (when compared with REST anyway...) but the Microsoft tooling for SOAP was unmatched. Just paste a url in VisualStudio and 30 seconds later you wrote code against that web service without needing to actually look at any kind of documentation. It just worked.

On CSS media queries...

Media queries are a nice (and long overdue i might add) addition to CSS. They allow you to write CSS based on a few simple criteria (there are more but these 2 are the most important) :
- the device orientation (portrait or landscape);
- the device width and height.

The problem is that usually you want to write your CSS a bit more "high level". Writing styles for the device width/height is no good.....usually you want to have different layouts based on the type of device : phone, tablet and desktop. And unfortunately even if you know the type of device your code runs on (by chopping the user agent ) there is no way to write a media query based on that information. Would be really nice to be able to write something like :

@media screen phone
{
}

@media screen tablet
{
}

Maybe we can write code like this in CSS4. But i won't hold my breath.....

Equivalent of tmux for Windows

One of nicest way to improve the terminal in Linux is tmux. It allows you to run multiple apps inside the same terminal window.
Fortunately, for Windows, ConEmu allows you to do basically the same thing and it even allows you to run GUI apps inside the terminal .

Here is how it looks in action (here i'm running SublimeText inside the terminal window) :

Chocolatey - the must have tool for Windows

Chocolatey is one of the must have tools for Windows. It's basically the equivalent of a package manager in Linux. It makes it very simple and fast to install, update and uninstall apps directly from command line.

So here's a short tutorial on how to use Chocolatey. First of all install it from chocolatey.org (it's very interesting that chocolatey is implemented as a bunch of powershell scripts, "backed" by nuget ).

Here's how to use it (i wrote the examples using "git" as the app name...obviously replace git you the name of the app you want to install/update/uninstall).
- to install something we have to find out first if that particular piece of software is in Chocolatey repos (eg search for it). Let's use "git" as a example . To search for git just run
clist git
The output will list all the apps who have "git" in their names along with their version number. To install the app just run
cinst git
To see all software installed on your machine with chocolatey run
clist -lo (where lo stands for "local only")
To update a particular app to the latest version run :
cup git
To update ALL installed apps run
cup all
And finally to uninstall a app just run
cuninst git

That's it. App management that's imple, flexibile and directly from the command line.

Decrapify your Android phone without installing a rom

Here's a short tutorial on how to remove all the junk that comes preinstalled  with a Android phone/tablet.

- root it. The easiest way to do it is with Framaroot. If Framaroot doesn't work for you look around for other methods that work with your phone/tablet model.

- install FDroid (basically a store app for OSS tools and tools that can't be accepted on Google Play).

- install /system/app mover . It's a tool which allows you to "convert" system apps to user apps. Change the type of all system apps you want to get rid of and reboot the phone. Important thing to note here is that you can also "convert" system services ...so basically you can increase the battery life by removing those.

- now simply uninstall those apps just like you uninstall regualr apps.

Transitions trilogy minireview




The Transitions trilogy is basically the last trilogy of Drizzt's saga with his Mithrill Hall companions. Compared with the earlier stuff the quality of writing has certainly decreased (after all Ghost King is the 19th book in the series) but it's still ok.

The first books "The Orc King" basically wraps up the storyline from the previous trilogy, The Pirate King is basically a standalone novel, who isn't that great. The last one (Ghost King) is by far the most interesting one and features some "old" returning characters. The story is just ok but i was very pleasently suprised by the ending of the book. Instead of the regular "Hollywood" ending , we get something ......else.

So, there you go. It's just ok, certainly not comparable with the older stuff.



The House Of Silk minireview

house of silk cover

I mentioned a while ago that i enjoyed reading all the Sherlock Holmes novels. So i've become very interested in "The House of Silk" when i've found out that it's actually an "official" Sherlock Holmes novel endorsed by the Doyle estate and written by Anthony Horowitz.

At first the idea of reading a Sherlock Holmes novel not written by Conan Doyle seemed stupid to me but i'm glad i gave this book a chance. Because it's a great book.Like really really great.The way those cases are linked together and the narrative itself are very good. And i was surprised to see that the writing style itself was pretty close to Doyle's.

So yeah...totally recommended if you like Sherlock Holmes novels.

On EntityFramework Code First approach

I'm not a big fan of code first approach. The "code" part is fine (and it was great was the EntityFramework designer still used ObjectContext and generated all the code in a single file), but i think migrations are not such a great idea. Writing C# code that is equivalent of SQL DDL feels wrong. It means ignoring great tools such as RedGate SQLCompare (which handles very nicely schema changes) and just writing a bunch of code.

So i basically i use :
- "code first" for mapping
- use Database.SetInitializer(null) for initialization.
- mostly use SQLCompare to handle schema changes.

SoulDrinker trilogy minireview

Ever since i've played the games (Space Marine, Dawn of War 2 ) i've wanted so read something from the Warhammer universe.So my first "foray" into the Warhammer 4K universe was the Soul Drinkers trilogy.



Overall the books are exactly what i have expected. Adrenaline action packed space marines kickassery with just the hint of story to keep everything nicely toghether. So if you're interested in the Warhammer universe i'd say these are a good start.

Few tips for writing better CSS

So here's few tips for writing better/cleaner CSS :


- the most important is to start using LessCSS . LessCSS has support for variables and mixins (among other things) which really help with reducing the amount of code you need to read/write while making things a lot "cleaner".

- start with a simple reset (and sensible defaults) style to make sure the markup looks the same on all browsers.

- for deployment split the styles in multiple files (organized by a criteria that make sense in the context of the project. For instance the styles related to entity X go to the file x.less ). There's no point in working on a single giant file. At deployment you can merge all less file in a single one.

- style by element id or class name ? It there's a chance to apply that style to more than 1 element make it a class. Otherwise use the id.

- it kind of goes without saying but use the same indentation everywhere, stay consistent with the naming, use long descriptive names for classes/elements ids (no dumb abbreviations) and generally make the code as easy to follow as possible.


Happy CSSing !

Trunk based development

"Trunk based development" is the style of dev in which you never create branches. Basically there's only the code in the trunk and toogle switches that enable/disable the "features" at runtime. If a feature is not ready, on deployment is configured as disabled and all "UI references" to that feature are disabled/hidden.

Obviously, the biggest advantage (or should i say the only advantage) of this style is that you avoid long running branches and the code merging problems that appear because of them (good luck merging a 2 month branch when there was a big refactoring on trunk. Merging often doesn't really help either). But there are also a lot of disadvantages :
  • PITA to work on a feature that depends on another feature in development which is not deployed yet
  • Old codebases get full of unused toggle switches
  • Testing becomes a lot harder because the permutations of all features in on/off state needs to be tested
  • dependency management gets harder. For producation you may need ver A of a dependency while a new feature in development might depend on ver B of the same dependency. And there's no backwards compatibility guaranteed.

Overall this style of development is interesting but in reality is only feasible when the app is comprised of a few features without dependencies between them. And that is very rare, so most of the time branches are the superior solution.