Marius Gheorghe

On building software. And the other stuff in between.



On CSS media queries...

20 March 2014
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

25 February 2014
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

19 February 2014
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

31 January 2014
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

30 January 2014



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

08 January 2014
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

17 December 2013
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

10 December 2013
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

25 October 2013
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

11 October 2013
"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.

PocketNow

02 August 2013
Just released my first Windows 8 app in the Windows Strore. PocketNow is a client for the Pocket service. The app allows you to manage and read your articles.

Check it out here



2 way auth for Gmail

20 June 2013
Last evening I received the following SMS from Google
"Google Account xxxxx@gmail.com : Suspicious login detected. See google.com/blocked"

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

19 June 2013
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.

03 June 2013
  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

15 April 2013

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

07 April 2013

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

22 March 2013

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

27 February 2013
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

08 February 2013

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

04 December 2012
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

22 November 2012
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 :

::wu::
clipboard =
(
svn update c:\work\trunk\
)
send ^v
return
}


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

13 November 2012
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

09 November 2012
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

29 October 2012
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
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.

VistaSwitcher
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

26 October 2012
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.

Darksiders : The Abomination Vault

23 October 2012


Pretty good read. Expands the Darksiders universe in a interesting way (although the this story "happens" before the first Darksiders game) and fleshes out the characters of Death and War a bit more. Too bad Strife and Fury don't get more "screentime".

Saving a synchronization context switch with await

22 October 2012
If you're not interested in using the result of a async method on a UI thread (which happends implcitely when awaiting a method from the UI thread), you can save a synchronization context switch by using :

await DoMyStuffAsync().ConfigureAwait(false);

Passing false to ConfigureAwait will prevent the switch to UI thread.

Rumored Surface pricing

16 October 2012

So today possible Surface (the "cheap" version of Surface) prices were leaked152 directly on microsoftstore.com153

If those prices are real, that's a shame. It basically means Microsoft is not really in a position to take on Android right now. Windows 8 it's a great OS (from my point of view if the best Microsoft OS to date) but it sure will need some help to gain some traction. And the hardware pricing doesn't seem to help.

I guess we'll see more in the following days when the Surface price will be confirmed.


Update : Prices are real. Available for preorder here154


Async wrongly named

16 October 2012

I was thinking that await keyword has to be one of most "wrongly" named keyword (volatile being the other contender) from the language. I noticed that most people when learn about async + await have the impression that the current thread "stops" when encounters the await keyword (obviously not the case).

Maybe "concurrent" or even "parallel" would have been better.


Fixing the “Unable to activate Windows store app” problem

15 October 2012

I had a nasty problem today with Windows 8 dev license and packaging an app for Windows Store. Basically after i have created a package for Windows Store, my Windows dev license expired. I dutifully updated the license and then lo and behold....everytime i wanted to run/debug the solution from Visual Studio i got this :

"Unable to activate Windows Store app. The activation request failed with error 'The application cannot be started. Try reinstalling the application to fix the problem."


Looking at the Event Log i found out that the app cannot be started because it's in state "17". Brilliant.

Googled for this problem and found some stuff here150151. Unfotunately none of those stuff worked for me.
The working fix for me was to create a new Windows Store project , move the files from older one (without Package.appxmanifest, Package.StoreAssociation.xml, *.pfx ) and voila....it runs fine now.


Speeding Windows startup with Autohotkey

19 September 2012

 

It's kind of painful to watch my HDD led indicator when Windows starts. Blinks like crazy trying to launch all my startup apps. And i hate it because i have no control about the order. I want Autohotkey launched first because i use hotkeys to launch other apps and i usually have to wait until pidgin, skype etc start up (skype especially, with its 17 mb exe, starts especially slow)

So i basically decied to optiomize this by only starting Autohotkey automatically and have hot key to launch all other useful startup apps. Here's how it looks :

;run at startup
#+a::
{
   if(work_computer = true)
   {
        Run c:\dropbox\utilities\mouseemu\mousemu.exe
        Run c:\Program Files\clcl\clcl.exe
        Run c:\dropbox\utilities\virtuawin\virtuawin.exe
        Run c:\Program Files (x86)\winsplit revolution\winsplit.exe
        Run c:\Program Files (x86)\pidgin\pidgin.exe
   }   
   else
   {
        Run e:\dropbox\dropbox\utilities\mouseemu\mousemu.exe
        Run c:\Program Files (x86)\clcl\clcl.exe
        Run e:\dropbox\dropbox\utilities\virtuawin\virtuawin.exe
        Run c:\Program Files (x86)\winsplit revolution\winsplit.exe
        Run c:\Program Files (x86)\pidgin\pidgin.exe
        Run c:\Program Files (x86)\utorrent\utorrent.exe
   }

   return
}

I use the work_computer var because im using this script on multiple computers and paths are different. And, yeah, i keep some portable apps in dropbox.....easiest way to keep app settings in sync.

 

 


Resharper 7 XAML member navigation

19 September 2012

 

Resharper 7 member navigation (Cltr + F12 for old school R# users) breaks in XAML if you have a resource dictionary which doesn't inherit directly from ResourceDictionary. The inheritance chain is something like MyDictionary  : DictionaryBase : ResourceDictionary.

 


ExeLauncher - fix PATH var on Windows

11 September 2012

For me one of the most annoying thing under Windows is that the PATH entries are not recursive. Install and app and you can't launch from command line because the PATH var hasn't been updated with new path. This quickly becomes annoying. My attempt to fix this is building a command line app which scans a few predefined folders and launches the app.

Here's how it is in action

 

Grab it from Codeplex153


Setting up SublimeText 2 with Mingw

19 June 2012

 

 

Here's how you can set up ST2 to work with Mingw:

- add the Mingw bin path to system Path env variable;

- rename ming's mingw32-make.exe to make.exe

- create a file called "makefile" (no extension) in the project's folder and update it accordingly to your project.

- in ST2 make sure the build system is "Automatic"

- press Cltr +B and it should work

 

 

Later edit : the final version of Sublime Text 2 changed some stuff to the build process, so it's easier to create a new build (tools/Buil System/Create New Build) and just paste

{
    "cmd": ["mingw32-make.exe"]
}

This is basically inovke mingw32-make in the same folder as the currently opened file. If you have a valid makefile there it should work fine.


TortoiseSVN and SSH

08 June 2012

 

This is basically the easiest way to enable SSH with TortoiseSVN (and most importantly WITHOUT using putty)

- open the TrortoiseSVN settings and click Edit for SVN config file.

- find the ssh line under [tunnels] section

- edit the line to include the path to tortoiseplink.exe. Here is a sample :

"ssh = C:\\Program Files\\TortoiseSVN\\bin\\tortoiseplink.exe -i c:\\private.ppk -l marius"

The first path is to tortoiseplink, the second is the path to your private key and the l parameter is for your user name (if your private key is protected with a password you must also inlcude this). Save and exit.

 


Async brainteaser

09 May 2012

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1 {
class Program
{
    static void Main(string[] args)
   {
      (new A()).Run();
      Console.WriteLine("end main");
      Console.ReadLine();
   }

}

public class A
{
    public async void Run()
    {
      await Task.Run(() =>
     {
       X();
       Console.WriteLine("end x ");
     });

        Console.WriteLine("end run"); }

     public void X()
     {
       for (int i = 0; i < 500; i++)
       {
         long f = 12345 * 12;
       }
     }
  
  }

}

 


Run this code (requires async ctp or vs 11 ) and try to guess the order of items written at console. Also run it multiple times and study the results...


Reminescing about the past. Part I

28 March 2012

Don't know exactly why but i thought i should write about some of my "computing" experiences from my childhood. My first "computer" was a CIP 03.


cip03

This bad boy was produced by the romanian company Electonica and it was basically a ZX Spectrum156 clone (not sure if legal or not).

I have to say that unlike other people i basically become interested in computers because of games (a passion/hobby which i still have +25 years later). To get my parents to buy me a CIP 03, i kind of tricked them into thinking that one would help me a lot in school (for math) and that i would learn programming (not really interested in that back then).


And what fun times i had with this little machine. Playing the entire Dizzy collection157 (Spellbound was the best), Midnight Resistance, Operation Wolf, River Raid and all the other great games were one of the happiest moments of my childhood. Heck i remember even now the sound the game was doing when it was loading off the cassette tape (beep, beeep, beeeeep, brrrrrrr :)
Incidentally, my first contact with reading/writing code was because, sometimes, i wanted to cheat in games (infinite lives FTW). On same games, after loading for 7-8 seconds, you could temporarely stop the loading process and modify the values of some variables by writing a few lines of BASIC code.


That was basically it....writing a few lines of code to cheat in a game was the spark that ignited the passion for programming and discovering how that machine works.


My Visual Studio

26 March 2012

Here are my Visual Studio 2010 settings & customizations. I'm using a black theme made by me (i call it MoonSorrow) . Here is how it looks in action :

If you want to try it here are the files :


- This is the VS Color Theme Editor156. Make sure you have the VS Color Theme editor installed to use it.

- my complete Vs settings file157 (be very careful with this and make a backup of your settings before importing this one).

- and finally my Resharper settings file 158 which includes the custom code formatter. Obviously back up your R# settings before trying out this one.

 

That' all. Happy Visual Studio customization :)


Versioning often deployed web apps

25 March 2012

1

 

 

Sometimes i deploy Shopkeeper 2-3 times a day. Bringing value to the customer one little step at the time. In this case, obvioulsy, the classic versioning scheme doesn't really works. So, for a deployed version of Shopkeeper, the version is the Mercurial revision id from which it was built.
Here is how this works in practice :


- when i do a deployment build i also generate a file with data about the current revision

- the output is

- and finally displaying the version in the actual customer website:


My trip to London

12 March 2012

So, i've been to London last week. Very interesting trip. I've been away on a business related problem but still managed to have some fun. London, as a city is very interesting and, obviously, there's a lot to see there (my favorite was the British Museum. Holy crap there are A LOT of interesting stuff to see there). One thing i wasn't such a big fan of was the brits pronunciation. I remember that in the first day there i, basically, was asking everyone to repeat what they were saying because i just couldn't understand what the heck they were saying. Awkward.

Been staying at a old friend (hi Gary) and had a lot of fun. Went to a few pubs (beer is great by the way,seems to me is a bit stronger than the stuff back home) with Gary. Also i played around with a Zenbook (liked the machine itself but hated the keyboard). One thing that almost blew me away was the speed of the internet connection. Gary had O2 broadband and the speed was incredible for me (i guess it's not really a secret that internet connections in eastern europe kind of suck. The speed is just "good enough" i guess). One test i have done was the Gmail test (back home while Gmail is loading i can see while that progress bar is loading). On Gary's connection the progress bar was at 100% percent and then the page just appeared. Good stuff.

Also attended (along with Gary obviously) to a local web design meeting group. Has a few interesting discussions with a few people about CSS3 and how the media queries will take over the world :)

Overall it was a great trip and i had a few , well deserved i might add, free days.


Steve Jobs biography

06 March 2012

157

Just for the record i just want to say i REALLY don't care about Apple. (so don't expect this minireview being written from the point of view of a Apple fanboy).


This book has been a very pleasant suprise. I think the author manage to perfectly capture and describe Steve Jobs as a person (which obviously any good biography should do). I particulary liked the depiction of the 70s with the start of the IT industry and the partnership between Jobs & Wozniak (which seems like a great guy) and the description of Jobs "relation" with Bill Gates  (there's a faboulous quote in there "Bill was actually looking down on Steve because he couldn't actually program").

Recommanded.


Slapping Metro on everything is wrong

08 February 2012

Just read this article Why Metro now rules at Microsoft157158 and it seems to me that MS will just blindly slap Metro on everything. They already screwed up the Xbox 360 UI with Metro (the "old" NXE had much higher usability) and it seems they won't stop here. The "problem" with Metro is that it really works only with touch input. On the 360 navigation on the Metro enabled UI with the left analog stick is painful inadequate (you're basically navigating in sub tiles all part of a larger tile) and you also have to use the "shoulder" buttons for navigating the top tabs. Compare this with NXE where you just flip left/right with the analog stick

So Microsoft please stop slapping Metro on everything. It only works fine with touch input .


The road

27 January 2012

158158

Such a great book. It’s worth a read even if you saw the movie.  A book about a parent’s love for his child. The scare, minimalist writing style is also very interesting.


A song of ice and fire (first 5 published books) minireview

30 November 2011

   This post was long time coming. So i finally read all 5 published books for "A song of ice and fire". I manage to break my own "don't read a series until is published entirely" mantra because i obviously watched the show, read the first book (just to see how faithful the show is to the book) and then, lo and behold, i basically read them all :)
    The series is very good. From my point of view the only "different" thing GRR Martin does (compared to other fantasy authors) is how he juggles with a huge cast of characters. Impressive. The biggest downside i'd say is the variable quality of the volumes (the first and third are top notch, the rest not so much).

So, as a conclusion, ASIOF is definitely worth a read.


Few general tips for Windows Phone development

13 October 2011

- don't use ZUNE for deployment. Use WPConnect (a tool which comes with the SDK. You'll find it in \Windows Phone\v7.1\tools\wpconnect). It's much lighter than Zune and it also allows you to debug launchers/choosers.

- don't close the emulator. Never.

- learn the difference between pivot/panorama and use them accordingly (if it helps think of the pivot as a tab control).

- it's a good idea to not hardcode colors and use the accent color (for instance where you want to "highlight" a specific text).

- make sure you test your app in both themes.

- think of the navigation flow of the app. Remove pages from the navigation stack when it doesn't make sense for the user to "get back" with the back key.

- fast, Fast, FAST. I can't stress so important is to have a app which feels fast.

- the JPG decoder is faster than PNG. Consider this when choosing the format of images for splash screen, backgrounds etc.

- make sure you understand the difference between "content" and "resource" when dealing with app resources.


Some thoughts on Windows 8

17 September 2011

So i installed the developer preview of Windows 8 (i was actually more interested in Visual Studio 11 rather than Win8) and i decided to share some opinions. To be honest since Win8 has been unveiled for the first time, i've been a bit puzzled about the decision to have the same OS for both tablets and desktop and combine those 2. (i mean touch is so different from mouse & keyboard that it makes no sense to mix them together).
 
Tablet : as a tables OS , Win8 looks fine. But to be honest, i don't really think it matters. Apps matter. Sure it won't be a problem from MS to get good apps for the tablet (i actually think by the time it alunches next year, MS will more apps than Google's honeycomb). But the way it see it, there's no market for tablets. I simply don't think there's going to be a "post PC" era. PCs (desktops and laptops) are here to stay. The keyboard (which is basically the best way to interact with a machine) is here to stay. Sure, MS can't affort not to sell a tables OS. But it looks like they spent too much time working on the "tablet side" of the OS in detriment of theit bread & butter : the desktop.

Desktop : well there are improvments of the desktop OS (it took what....5 years to finally get proper multimonitor support ?) but they certainly didn't improved the OS as much as i would have liked for the desktop use. Worse still they started to change things that only make sense for the tablet :

- replacing the start menu with the table specific start screen. This doesn't make any sense (even if you can tehnically "use" that screen with mouse&kb). Nobody is going to launch apps by scrolling horizontally and looking for a tile with the app name. If you want to improve the OS just add a freaking keyboard launcher not the tiles screen.

- they started replacing "default" controls with their "touch" equivalent (for instance in Control Panel the checkboxes have been replaced with the new Toogle Control). Using the toogle with the keyboard is bad (not to mention that toogle takes way more screen space than the checkbox).

So, in conclusion, i have the feeling Win7 will be the new XP. We're going to use it for a while....


RewritePath issue on ASP.NET 4

24 June 2011

  Ported a app from ASP.NET 2 and 4 and had a interesting issue with HttpContext.RewritePath.  Basically I was doing url rewriting using to ashx handler to get nice urls on asp.net 2. When I moved the app to 4 all postbacks on pages with rewritten url were broken (even if I was running the app with the backward compatible settings).

Found a workaround (not perfect but it gets he job done). Basically RewritePath has a parameter called “rebaseClientPath” which “updates” the path after url change. This rebase doesn’t seem to work anymore on ASP.NET 4 so make sure it set the param value to false.

Hope this helps someone.


Waiting for async

04 May 2011

The C# 5 async/await look so promising for multithreaded apps. I think anyone who writes SL code and does async requests with callbacks in which we have other calls with their own callback etc await async. I mean…the code written with async looks so clean. Frankly I regret they spend all that time working on “dynamic” (which is mostly useless unless you’re doing COM/DLR interop. And who does DLR inteop ?!) instead of doing async.


Ribbon is bad UI

03 May 2011

Just updated Windows Live Writer and the latest version has the useless Ribbon UI. Don’t get me wrong Ribbon might be useful for beginners but it’s useless for advanced users. The problem is that the UI is mouse “oriented” and  most “actions” don’t have keyboard shortcuts. Also on some apps that use Ribbon  the toolbar buttons tooltips don’t have the keyboard shortcuts.

Live Writer is the kind of app that really didn’t need Ribbon. I see it’s becoming a trend at Microsoft and I don’t really like it.


The crimson shadow review

29 March 2011

front cover159

It was ok. "A fine adventure" to quote the front cover but nothing really to write home about. This was the first trilogy i read entirely on a Windows Phone 7 device (using Freda which is basically the best ebook reader on the platform now). Reading on a WP7 phone was a ok experience but unfortunately not better than reading on my ancient HP pocket pc.


Moved to CodePlex

02 March 2011

Moved all my OSS projects from BitBucket to CodePlex. Here's the profile page159 with links to all projects. Source control is Mercurial for everyting. And speaking of Mercurial, TortoiseHG 2.0 was released todays and looks very nice.

 



I'm Marius Gheorghe, a software craftsman. This is my personal blog, opinions are entirely mine, blah blah.


Contact me :
Mail : gmarius@gmail.com

Twitter : @mariusgheorghe

LinkedIn