24 November 2011

How to change file premissions in Git on Windows

Git manages file permissions for each file in the repository. It may be appropriate to have the executable bit set for shell/bash files to make them easier to execute in Linux systems.

Windows own file permissions does not map to the Git file permissions so it may be a bit hard to change file permissions when you are on Windows. This is how you do it:

Lets assume the file script.sh needs to have the executable bit set. Use the command git ls-tree to inspect the file permissions:
C:\views\myproject>git ls-tree HEAD
100644 blob 55c0287d4ef21f15b97eb1f107451b88b479bffe    script.sh


As you can see the file has 644 permission (ignoring the 100). We would like to change it to 755:
C:\views\myproject>git update-index --chmod=+x script.sh

C:\views\myproject>git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       modified:   script.sh
#


The file is now staged. Note that the file contents is not changed, only the meta data. We must commit the file so save the change:
C:\views\myproject>git commit -m "Changing file permissions"
[master 77b171e] Changing file permissions
 0 files changed, 0 insertions(+), 0 deletions(-)
 mode change 100644 => 100755 script.sh


Running git ls-tree again to see the change:
C:\views\myproject>git ls-tree HEAD
100755 blob 55c0287d4ef21f15b97eb1f107451b88b479bffe    script.sh

05 July 2011

Steam gives away Team Fortress 2

The popular multi player first person shooter game Team Fortress 2 is now free to play on Steam. I took the "bait" and installed Steam just to play this free game (and the game is really fun). So how can Steam money on this? Well there are two things that they can make money from:

1. In-game purchases
Many free 2 play games have an in-game store. In Team Fortress 2 there is a store where you can buy visual appearances (like hats) and also weapons. I was "suckered" in to buy some kind of instrument (called Wrangler) the engineer class in the game can use. For that I spent 0,39€:


2. Buy other games in Steam
The other thing that they can make money on is other games, that cost money. Since the user already has installed Steam the effort to buy something is lower. And since I could only transfer a minimum of 5 € to my virtual "Steam Wallet" I had some over. So I bought a game call Trine for 1,99€. Once I have bought one game (although cheep) there is a high probably that I will buy more games in the future.

24 June 2011

Switch to UTF-8 charset in Mysql on Ubuntu

When installing Mysql on Ubuntu the default character set is probably latin-1. Since Ubuntu uses UTF-8 for most other things this may be little strange. But it is easy to change.

The Mysql configuration file /etc/mysql/my.cnf has a magic line:
!includedir /etc/mysql/conf.d/

This will make it include settings on the subdirectory conf.d. It's not recommended to change the my.cnf file directly since it will cause problems when upgrading Ubuntu/Mysql to a new version.

Create a new file: /etc/mysql/conf.d/utf8_charset.cnf with the following contents:
[mysqld]
default-character-set=utf8

[client]
default-character-set=utf8

Restart mysql and you will have UTF-8 as character set:
$ mysql -u root -p -e "show variables like '%character%'"
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8                       |
| character_set_connection | utf8                       |
| character_set_database   | utf8                       |
| character_set_filesystem | binary                     |
| character_set_results    | utf8                       |
| character_set_server     | utf8                       |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+ 

Update 2012-11-12: This is valid for Mysql 5.1. For Mysql 5.5 see comment below by Martijn.

22 June 2011

How to bypass Cisco VPN client LAN restriction

There are a lot of VPN client softwares. Windows has a built in client and there are a bunch of third party products. For example Cisco VPN client.

The Cisco VPN client has an annoying feature: the VPN provider can decide if local network access is allowed or not. From a VPN provider perspective this is of course a good feature since it increases security. But from my perspective it is bad.
So in other words it may not matter if the Allow Local LAN Access box is checked or not.

One good workaround: use another VPN client that is compatible with Cisco. I have tried and successfully used Shrew Soft VPN Client. It can import a Cisco VPN profile file (pcf-file). It can also be configured to override the VPN provider settings:
Just go to the Policy tab in ShrewSoft VPN client and add an exclude filter. I wanted to access my entire 10.10.XXX.XXX network so I added an exclude filter for 10.10.0.0 with netmask 255.255.0.0. Be careful so your local area network IP range don't collide with services you would like to use on the VPN.

I got the tip from this post: http://serverfault.com/questions/126458/unable-to-access-local-network-when-cisco-vpn-client-is-connected

11 June 2011

SQuirreL - a competent but low user experience SQL GUI

I have on and off used SQuirreL. It is cross-plattform cross-database SQL GUI. Well, the cross-database is limited to JDBC drivers, but it covers most databases (including H2 and Mysql). The software is written in java so it will probably execute on any plattform, although I have only used it on Windows.

The most common operation I want with a tool like this is the ability to look and edit table data. SQuirreL can do this, and this for free.

But the problem with this software is that it is hard to use. I will give three examples why it is hard to use, but there are more things so be prepared to invest a little bit of time to use it.
  1. Installer privileges
    The installer program is made with IzPack. It is easy to run the jar file just by double click on it. However a Windows user quickly realises that the installer does not run with elevated privileges so the program cannot be installed in c:\Program Files\. I have seen other IzPack installers that detects this and tried to elevate the privileges via Windows UAC feature. Why doesn't this installer doesn't do this? I had to manually start cmd with elevated privileges and run java -jar squirrel-sql-3.2.1-install.
  2. Manual installing of drivers
    JDBC driver are standardized so it is easy to implement a software to use them. But I had to manually installs my database drivers and put them in C:\Program Files (x86)\squirrel-sql-3.2.1\lib folder. Why why why? If distribution of drivers is a license issue, please add an automatic download feature in the installer that does this.
  3. How to add a new row in a table?
    I spent some time to find out how to add a row to a table. I tried to right click on a gray (blank) area in the table listing. But no luck. The solution: right click in the contents (table contents) are and a pop up menu is shown a it is possible to select "Insert Row". When you do this a hard to use row editor visualizes.

 

08 June 2011

TortoiseGit difference between Fetch and Remote Update

In the TortoiseGit application, in the "Git Sync..." dialog there is a drop down box with different options. I tried to figure out the difference between Fetch and Remote Update:
 I found this good answer on StackOverflow: http://stackoverflow.com/questions/2688251/what-is-the-difference-between-git-fetch-origin-and-git-remote-update-origin.

04 June 2011

Slow scala installer

I'm trying to install Scala using the IzPack Scala installer (a jar file). It is extremely slow. I found this post about the problem: http://www.scala-lang.org/node/9670.

Just as the post above suggests I can with Windows Sysinternals Process Monitor (Procmon.exe) see that the installer file is read many (many) times: