Marius Gheorghe

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

Powershell help quick tips

The first tip is about upgrading your powershell help files so it will be up to date. For this just run :
update-help
Second tip is about searching for useful cmdlets when trying to achieve something with powershell. For instance if you are interesting in looking at the event viewer entries (for instance), you can run :
get-help *event*
and get back all the cmdlets that let you interact with the event viewer.

Firefox 64 bit version is out

Finally the 64 bit version of Firefox is out. It works side by side with the 32 bit version (by default 64 bit version is installed in \Program Files instead of Program Files (x86)) but i really recommend everyone to just install the 64 bit version and ditch the 32 bit version (just make sure you back up your profile before doing this).


Run Edge browser from command line / keyboard shortcut

I run all of my apps from keyboard shortcuts with AutoHotkey (great utility, i highly recommended), so i wanted to do the same thing with Edge.
But with Edge it's a bit tricky because it's a "modern/univeral app" and those types of apps require a certain unique server parameter when you invoke them, directly from command line.
But i've figured out that Edge registers it's own shell extension and we can use that to launch it. So directly it can be done like this :
powershell.exe "start microsoft-edge:http://google.com"

Obviously feel free to either replace or delete the http://google.com part.

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.

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.

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 :

::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 ?).

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
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.

Speeding Windows startup with Autohotkey

 

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.

 

 

ExeLauncher - fix PATH var on Windows

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

 

 

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

 

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.