Skip to main content

Posts

Coromandel Trip - Xmas 2019

Few weeks ago, my son watched a Youtube video about hot water beach and was really excited when I told him it is in New Zealand so we decided to take an impromptu trip there before Xmas.Hot water beach is actually only around 2.5 hours drive from Auckland but the wife didn't want to sit in the car for 5 hours in the same day. Fortunately we managed to find a nice holiday apartment in Whitianga despite busy holiday season, which is a nice small beach-side town only 30 minutes away from the hot water beach.Kids @ Whitianga beachDay 1Hot water beachThe best time to dig your own hot spa at the hot water beach is one hour on either side of the low tide, which was around 10:15am on the day. We decided to leave early and drove there first thing in the morning. We managed to get there by 10:45am but the beach was already packed with visitors.We tried to find an empty spot and started digging with our big garden spade (most people were using mini toy-like ones) but only cold water came out…
Recent posts

It’s been a while ...

It’s been nearly 7 years since my last blog post, during which time UK has decided to withdraw from EU, iPhone is now over $2000 NZD and Donald Trump was elected as US president and then impeached.While my personal journey of the last 7 years was nowhere near as dramatic, it was still quite a lot for me personally.I changed roles and companies few more times.Moved house twice.Run regularly again, more serious this time.Starting to get my time back as kids grow up.As I'm approaching "officially not young anymore" age, I've learnt to recognise and focus more energy on things that are truely important to me such as family and personal growth.Billy Yang's video below resonates with me even though I am happily married, have 2 lovely kids, living in our own home instead of a van and love my 9-5 job as a software developer 😅.

Concatenate lines in a file into a single line with PowerShell

Assuming you have a input file in.txt with following lines:a b cand you'd like to concatenate these 3 lines into a single line to a file out.txt i.e.abcYou can use the following PowerShell command:-join (cat in.txt) | out-file out.txtBasically, the cat in.txt is executed first and returned the content of in.txt as an array of strings. The -join cmdlet then joins the lines together into a single line, which is then piped (|) into the out-file cmdlet to produce the out.txt file.

Replace xscreensaver in CrunchBang Linux 10 "Startler"

Deep down in my heart I am a minimalist and to me CrunchBang Linux has the right balance between minimalism and usefulness. However, one thing I've always struggled with it is the choice of xscreensaver for the simple lock screen task because it also does monitor power management, which has to be turned off to avoid conflict with xfce4 power manager.Last week I finally decided to bite the bullet and replaced it with much simpler slock and here's how I did it.Step 1 - Remove xscreensaver and install the screen locker of your choiceTo remove xscreensaver simply:sudo apt-get purge xscreensaverNext, you'll need to install xautolock to lock screen automatically after certain idle time (mine's set to 1 minute):sudo apt-get install xautolockNow you have to choose a screen locker. I use slock, which is probably the simplest screen lock ever because all you get is a blank lock screen. There's also xtrlock, which is installed by apt automatically when I installed xautolock a…

Enable PowerShell Remoting

On the remote machine, start a Administrator PowerShell session and run following commands:Enable-PSRemoting cd wsman: cd localhost\client set-item trustedhosts *Just answer "Y" for any prompt.To start a remote Powershell session, on your local PowerShell session, enter:Enter-PSSession <the-remote-machine-hostname&gtFor some reason, Enter-PSSession can't seems to resolve DNS aliases (CNAME records) and you'll get the following error if you used it instead of the hostname.Enter-PSSession : Connecting to remote server failed with the following error message : WinRM cannot process the request. The following error occured while using Kerberos authentication: The network path was not found.

Running CrunchBang Linux 10 "Statler" on HP mini 1000

I was a big Ubuntu fan until they decided to use Unity in netbook remix and moved windows border icons to the left. I then switched to LinuxMint, it was alright but I'm a Chrome user and I hate the fact that they won't let you remove firefox (the package manager forces you to install "abrowser", which is still firefox but with brand removed).Now CrunchBang Linux is my new favorite Linux distro. I hesitated before puting it on my HP mini 1000 netbook because the latest version "Statler" is based on debian, which is famous for being "Pure Open Source" and hence lack of proprietary drivers. However, I was totally wrong, nearly all hardware worked out of the box for me except for the usual wireless driver, network port and bluetooth.WirelessTo be fair the b43 driver did work but it was fairly unstable and disconnects randomly. The solution turns out is pretty simple, all you have to do is to enter:options b43 pio=1 qos=0in the following file:/etc/mod…

AOP with Enterprise Library Policy Injection Block

I used to think aspect oriented programming (AOP) is not a very useful idea because quite often it only saves few keystrokes but requires a massive configuration file. I only came to realise the true value of AOP recently when we have to convert 4+ million lines of legacy COBOL code to .NET with Microfocus’ Visual COBOL compiler. Manually adding exception handling and logging code to these existing COBOL subroutines will not only take a lot of time but also makes code merging task much harder later. I started experimenting with the policy injection block in the Enterprise Library to see if it will make this job simpler. I tried to google for AOP and Enterprise Library tutorials but I found most tutorials on the web are either old (most were done using Enterprise Library 3) or over-complicated. Especially many of them use the Enterprise Library Logging Block to demonstrate the policy injection concept, which requires lots of configurations itself.The policy injection in Enterprise Libr…