Marius Gheorghe

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

2 way auth for Gmail

Last evening I received the following SMS from Google
"Google Account : Suspicious login detected. See"

Obviously, i went immediatly and changed my Gmail account password and then i enabled 2 way auth. The 2 steps authentication is great because if offers the greatest protection while still beeing very easy to use. Basically the 2 steps auth only applies when loging in the browser, for the rest you can still generate passwords for other clients (phone/tablet email client, desktop etc).

So yeah, basically use 2 way authentification . It's dafer, works great and the usability is pretty good.

Free ebooks on FeedBooks

FeedBooks is a treasure grove for free ebooks (books to which the copyright expired). I mentioned a while ago i started reading more on a Windows Phone device using Bookviser (which has excelent Feedbooks integration btw). Since then i read all Sherlock Holmes novels (i've found "The Hound of Baskervilles" to be by far the best one ) and also decided to (re)read Dracula (which i found it to be pretty bad .....great intro followed by descent into boredom and a anticlimactic finale).

Now i'm slowly making my way through the 5th Tarzan ebook.

Activation of app failed with error: The app didn't start. See the Microsoft-Windows-TWinUI/Operational log for additional information.

  Stumbled upon a really dumb thing today. I was working on a Metro app and i opended the Visual Studio solution from a usb stick. When i tried to run it, i got the above message. Copying the files to hdd and opening the solution from there did the trick. I've run the app with no problems. I've also try to run the app from a TrueCrypt drive and got the same thing (didn't have a usb HDD around so i couldn't test that).
So if you get the above message when running a Metro app from Visual Studio, make sure you're opening the solution from a hdd.

Tracing code execution at runtime

Basically there are 2 ways to do this :

- using the new CallerInfo attributes in .NET 4.5 . This is mostly useful for debugging bindings in WPF/WinRT.
- dumping the call stack at runtime (unfortunately without parameter values) using the StackFrame.

I've just added support for this to Microruntime.

Playing lately

Mini reviews of stuff i've finished lately (and i use the term "lately" very loosely...basically since the beginning of the year) :

Ni No Kuni - Wrath of the white witch (PS3)

ninokuni logo
Ni No Kuni is by far the best JRPGS released in a while. It's a charming game with interesting characters and is the only game that looks like you're playing a cartoon (there a a few cel shaded games out there but Ni No Kuni looks better than any of them).

DmC Devil May Cry (X360)

dmc logo
I really enjoy this "reboot". The fighting, story, cheesiness, graphics ....all of them pretty good. I hope Ninja Theory does a sequel.

Crysis 3 (PC)

crysis 3 logo
On PC (1900x1200 and high settings) there are a few areas where Crysis 3 looks absolutely incredible. Unfortunately the rest (story, scripting, AI etc) are not that great.

God of War Ascension (PS3)

GOWA logo
I was hoping for a game as great as God of War 3 but , unfortunately, this prequel doesn't deliver the goods. The single player campaign is not as impressive as GOW3,the game is buggy and the story is just plain uninteresting. Also what's the idea on doing a multiplayer focus game in a franchise known for its single player ?! Anyway, hopefully this is the last game about Kratos and they move on to more interesting stuff on the PS4.

Tomb Raider (PC)

tomb raider logo
The Tomb Raider reboot is pretty good. The game is VERY different from the older ones (the reboot is very similar with the Uncharted serie) so don't expect the puzzles and the same feeling of exploration from the old games. The new game is much more action orientated with a heavy dose of QTEs and some simplistic puzzles. Despite the differences i still liked the game.

Dead Space 3 (PC)

dead space 3 logo
It's almost ok overall. Too bad the game become all action and no horror. The first game was absolutely great....but the sequels become increasingly action based and the quality of the story goes down the drain.

Gears of War Judgement (X360)

gow judgement logo
It's surprising to me how good the Gears gameplay formula still "holds up" after all these years. Gears is still the best 3rd person shooter on the market and Judgement simply reinforces that.

Tiling window manager for Windows

Unfortunately on Windows we don't have too much choices when it comes to tiling windows managers. Actually we don't really have a choice at all. The only one which supports multiple monitors, multiple spaces and can be reasonably tweaked is bug.n I've been using dwm on Linux and bug.n comes pretty close functionality wise. Few advices if you want to try it :

- although the compiled version is available run the source directly (it's written in Authotkey). This is better because you can tweak it more and also because the compiled version is registering some hotkeys which interfere with the Windows 8 system hotkeys.Also if you're running a x64 OS make sure you install the 32bit version of Autohotkey otherwise bug.n won't run properly.

-  edit config.ahk to configure it properly.

On PS4 and x86

Just wanted to comment about Sony going with a x86 machine (and especially with what AMD calls "APU"). The reality is that they didn't really a choice but go with x86 because :

1. ARM . It's missing basic things such as branch prediction. Totally unsuitable for a game console.

2. PowerPC. Either wait for POWER8 or something like Cell2 (eg Cell with higher clock rate and more SPUs). POWER8 could have been a interesting choice (but apparently will be out in 2014 so that means Microsoft could have launched first again).

3.x86. Intel or AMD. Something like a high clocked dual core i5 in a game console would have been interesting but there are 2 large disadvantages : - power consumption. High power consumption means heat and heat is very bad for a compact design like a game console. After the YLOD/RROD fiasco i'm sure both MS and Sony are thinking a lot more about hardware reliability. - expensive and not being able to "own" the IP. Intel is (very) expensive and Sony could have never been able to produce the CPU themselves or by a 3rd party.

So basically that left them with AMD. What's interesting is why both MS and Sony went with a APU design (Jaguar) instead of a Phenom (for instance). Compared to a regular desktop CPU (like i7/Phenom) a APU has 2 distinctive advantages :
- it has low power consumption with a very interesting power consumption mode (apparently the Jaguar can tun off unused cores when idle).
- the GPU is on the same die as the CPU. This has a lot of advantages for a "compact" design of a game console. Share the RAM between CPU and GPU, smaller latency, better cooling and higher yields (since it's only 1 chip).

Overall the PS4 seems very interesting. Let's see what Microsoft does...

Reading on a WP7 device

So i started reading again on a WP7 device (a HTC HD7 to be exact.... that 4.3' screen really make a difference compared to my older 3.6' phone). I ditched Freda (which was actually the first decent ebook reader for WP7) and went with Bookviser , which is hands down the best reader for WP7 right now.

What i really liked about Bookviser is the awesome Feedbooks integration. You can find quite a few high quality free books there (i read about 5 Sherlock Holmes books until now on my daily commute). Also having the option to tweak the reading environment really helps.

So yeah, try Bookviser if you're reading on WP7 device.

Powershell aliases are worthless

Powershell aliases are mostly a waste of time. They have 2 big problems :
- you can't alias a command with multiple parameters. Basically you can't have

Set-Alias scxc "svn update c:\work\trunk"

Actually you can set that alias. But it fails when you run it. So as a workaround you'll have to use a function

function scxc()
   svn update c:\work\trunk

Which brings me to the second problem.
- aliases aren't persisted by default. You have to use Export-Alias and Import-Alias between sessions. And here's the kicker : aliases with functions can't be exported and imported correctly.

A much better solution is to skip aliases and add all this stuff directly to your powershell profile (by default you can find it in %userprofile%/MyDocuments/WindowsPowerShell/Microsoft.PowerShell_profile.ps1).
Just edit it and add functions there that act as aliases.

Autohotkey macros

One of the nicest and most underused features of Autohotkey is the keyboard macros. Basically the ability to define text "shortcuts" that will be expanded in a command/text etc.
Here is a example i use everyday :

clipboard =
svn update c:\work\trunk\
send ^v

I'm defining the "wu" macro which will be expanded to "svn update c:\work\trunk" (to expand type the macro name and press TAB).
I'm using this macro to run the svn update command on my "work" project (funny side note...i noticed that updating a svn repo from CLI is at least 3-4 times faster compared to using TortoiseSVN. The power of CLI, huh ?).

Some thoughts on WinRT 1.0

Overall i'm kind of dissapointed with WinRT. In v1.0 the scope of the API is very limited. When you came to WinRT from the .NET world , you'll be shocked to see how many things are missing. Things that we took for granted in WPF a few years ago. The XAML situation is pretty sad : new XAML parser (whose "error reporting" sucks....everything gets spitted at runtime as XamlParseException with a generic description), no multivalue binding, no UpdateSourceTrigger,no a lot of nice little stuff from WPF etc. Other notable stuff that are missing : sockets, local database (where are you Sql Server CE ?), full reflection etc.

I'm guessing that 3-4 years ago when they started working on this they had to decide between a limited API available for multiple environments (C++, JS and .NET) and a proper API consumed only from .NET .I guess the recently fired Sinofsky had a say in choosing of the first version and now honestly it doesn't seem to me such a great choice. Trying to build the Win32 "follower" in a few years for multiple environments it's a futile attempt. Also it's worth mentioning the ARM support...maybe a few years ago it sounded very nice but today (with Haswell releasing in a few month, ARM support doesn't seems at all that great (and let's face it the ARM devices are not that cheap).

It's interesting to see what will happen next. I guess the Windows 8 rumored "Blue" update (which should be released next summer) will "fix" and expand the API a bit (and the update itself will be pushed by Microsoft asap on existing devices) but i'm quite curios what will happen after that. Will Win 9 continue to "expand" WinRT or they'll start over ?

Hacking a standing desk

A few months ago i had a surgery which, temporarily, prevented me from sitting down for long(er) periods. So i had to sit up while working. I looked around for transforming a regular desk to something that can be used while standing up and here's what i have come up with :
standing desk
Basically 2 simple desk "extensions" that can be placed directly on the desk. I didn't opted for a single "piece" because, while standing up, i have found out that i'm sitting more comfortably if the keyboard is slightly lower than the monitor desk (this actually depends on the degree to which the monitor(s) can be adjusted. Mine are not really that adjustable).
The obvious downside is that, if you'd like to sit down for a short period is pretty inconvenient to remove the "extensions" and added them back again. A vertically adjustable desk would work much better here (but it way more expensive).

Ditching the mouse and going keyboard only

A few months ago i have decided to ditch the mouse. As a developer my hands are one the keyboard all the time so the occasional "context switch" to the mouse was getting even more annoying (and i felt that it takes way to much time to reach for the mouse and resize a window or whatever). Plus the hands position when you're using both the mouse and keyboard is not that good. 104 keys (btw a real keyboard has 104 keys. Never less.) should be enough for doing things and there shoudn't be any need for the mouse. And with the right tools there isn't.

So i'm happy to report that going keyboard only works great (as a side note, i've been using Windows 8 as my main OS for 6-7 months now and reading impressions about the OS and being only for touch devices when i was using only with the keyboard.....that always made me chuckle out loud).
So here are some (mostly free) tools you'll need if you want to throw away the mouse :

Conemu is a console emulator for Windows which has (almost) the same features (including path autocomplete !!!) as the terminal for Linux. Personally i found CLI invaluable so Conemu does a pretty good job of making CLI enjoyable for Windows.

Mouse Emulator
The irony is that i don't need a mouse anymore but i still need an app which emulates the mouse when using certain apps (apps ported using QT/Gtk/Swing etc especially misbehave and you can't even "click" a button using the keyboard even if it has the focus).
Windows does come with a built in mouse emulator but is not that good (look for it under Accesibility) so Mouse Emulator is the only viabile option (hint : you can tweak the cursor speed, event the "high speed" is too slow for me). Also make sure you run this as a admin.

Winsplit Revolution
For resizing/moving windows with the keyboard. Invaluable tool.

Proper task management for Windows (the build in task manager is pretty bad). Don't let the name foll you it works equally great on Vista/7/8 . Switching between apps with the keyboard can be done in 2 ways :
- using the builtin Windows shortcuts (Win + numeric keys).
- using the task manager ( i find this to be a better alternative using VistaSwitcher).

Mouseless browsing
A Firefox addon which allows you to browse the web using the keyboard. I looked at something similar for Chrome but couldn't find anything even remotely useful.

Total Commander (not free)
For file management grab a proper app which support dual list view panes. Explorer was never good at file management and the treeview is not very fit for keyboard navigation. Heck, ditching Explorer as file manager is a good advice event if you still use the mouse.

Visual Studio
Useful keyboard shortcuts for using it without the mouse:
- Alt + F6 is switching between VS dockable windows. Shift + Esc will close the the current highlated window.
- when a breakpoint is hit you can navigate to the variable and pres Shift + F9 to see its value.
- Cltr + Shift + L to locate the current file in solution explorer.
- Alt + Enter for full screen.
- Cltr + , to search or if you're using R# like me use Cltr + Shift + N (search in files) or Cltr + N (search in types). Basically that's how you should "get around" in the solution.

Beware of deploying VCLibs in a package build on Debug

The other day i found a deployment problem with a WinRT apps that left me (almost) speechless. Basically deploying VCLibs (dependency required by Bing Maps) in a app package build on Debug makes the app crash on startup with a XamlParserException. On Release it works fine (of course i was doing a QA build and did in debug to get proper stacktraces).
So, there you go. Always build on Release (even for QA builds) if you plan to deploy that package on a machine without Visual Studio installed.