Skip to content

MartijnBrant.net Posts

Hosting your static site on Azure and make it superfast!

As of September the 20th, my site is hosted on Microsoft Azure, more specifically an Azure Storage account, using the Static Website feature! By making my site have a static front-end, the need to run it on script-enabled web-servers is gone and it can run on pretty much any host you can think of. Also by removing access to the dynamic scripts (WordPress back-end), the site’s attack surface decreased to 1/10 on an imaginary scale.

Previously my site was hosted on a donated cPanel web-host and for the small traffic my site gets, it was mostly fine. The donor however indicated they could no long provide the service and thus my hunt for a replacement host started. I wanted something new and a solution that would give me more peace-of-mind when it comes to maintaining the site. Having an unpatched WordPress install is a bad idea and the number of exploits of the worlds most popular blogging solution has skyrocketed lately.

So I could just get another PHP webhost or an Azure Web App to run my site, done deal but that still means I have to look after the software versions, plugin updates et cetera. I briefly considered using a managed WordPress host but they end up costing your a fair buck, especially if you want to host plugins or run big themes. A big trend in the open-source community is to export/generate a static-only version of their content and host it on GitHub Pages or ReadTheDocs.

Reading / parsing / writing .ini files in Powershell using XML

Last weekend I decided I needed to improve my Powershell scripting skills for a technical training I’m attending this week and started working on a script that could download, install and configure several applications unattended on demand. More on that script in a later blog post, for now I will focus on a specific feature I needed to script in order to make it all work.

One of the applications was still using a .ini file to configure some parameters of the tool and by nature of the script, I wanted to modify these values. One could use a search & replace method to change values in a .ini file (which is of course a simple text based file). In my search to easily parse a .ini file, I found several functions that could read the file and insert the values into hashtables. This makes values usable in a variable like $inihash[sectionname][keyname] = “value” however due to the nature of hashtables, it will sort the values in it’s hashtable by the hashvalue of it’s content. As most of us know, a hash value is different per object, per runtime, per system and will generate a unsorted mess. Inserting a .ini file with key1, key2, key3 might end up as key2, key1, key3 and there is no real way to circumvent this.

I was trying to work out the solution by working with hashtables, arrays and more .net objects in order to store the .ini values in a neat and sorted way. One could make a array with a hashtable with another nested array and hashtable but this would greatly increase complexity and reduce code friendliness as the $ini[section][key] notation would no longer function.

The other day I was casually discussing the problem with a fellow trainee and he suggested to (ab)use a XML object as a “storage box” as it would neatly allow nested constructions (section.key = value) and will remain sorted as it was imported (1,2,3 –> 1,2,3). First we would have to import a .ini file in to a XML object, later modify values and finally export the XML to a .ini file (sorted like the input .ini file).

Enabling Wake On WAN/power savings for your home network / server

The following post describes my personal setup in my home network to conserve power and how you can possibly do the same in your own home or small business setup. By implementing advanced standby / hibernation setups, you can have significant savings on power bills and reduce your carbon footprint. I will show how you can use power saving techniques without it becoming impractical. I should warn you this post can get quite technical in the end and may not work in your setup (totally depends on your network router).

Power saving techniques

There are several ways to save energy when it comes to working in a (Windows based) home network. You can for instance lower the total power consumption of your PC by switching the Power Plan in Windows 7. By doing so, your PC will turn off unused hard disks, use less power for wireless radios and go to standby sooner when your user session is idling.As we all know, you can put a PC in standby or hibernation instead of shutting it down. Even though shutting a computer completely down will save more energy than putting it in standby, it can be very useful to have the computer resume its duties quicker. I don’t put my workstations in standby or hibernation as an SSD as a boot drive makes cold boot a snappy 20 seconds wait.

Windows 7: Looking ahead at PDC

What can we expect to see of Windows 7 at the upcoming Microsoft Professional Developers Conference (or PDC) next week? I take a sneak peak at some of the features or improvements leaked, discussed or presented the last couple of weeks. This list isn’t accurate as Microsoft has deliberately been quiet about Windows 7 and its main features. Expect to hear about most of the following article next week when Windows 7 is officially uncovered to developers, IT pros, the press and the rest of the public at Microsoft PDC 2008!

Note: This article was written just before the official unveiling of Windows 7. The following notes and features are based on speculations, rumors, leaked information and screenshots. This article is made in partnership with Microsoft oriented weblog Bink.nu. Credit given where credit is due.
 
 

Will Windows 7 get a cool new user-interface in terms of graphical overhaul?

Nope. Microsoft did officially state they won’t be changing the UI a lot (like they did when moving from Windows XP to Windows Vista) as, although very cool, most people get scared when seeing a new UI. The average user or users with less computer experience had some trouble adapting to the (rather minor, in my opinion) changes Windows Vista brought. So be prepared to be let down when it comes to the graphical appearance of the system itself if you were expected something better / newer / nicer. They are however putting some effort into making the experience more uniform across the system.


[http://screenshots.winfuture.de/1223485042.jpg, credit: WinFuture.de]

I hate User Account Control (UAC) in Vista! Are they going to change that at all?

Nope. UAC as designed is a basic security and permissions/access design that should be implemented in every modern day operating system. Linux and Mac OS X have had this design for ages now, separating users from admins and raising privileges on the spot when needed. In some of the latest leaked screenshots, it showed Microsoft is however working on refining the user experience when using User Account Control. It showed a configuration panel allowing the user to set when and how the user should be notified of UAC notifications. Also note that Microsoft is very much paying attention to the general public on this issue. Based upon user input when Vista launched, Microsoft refined UAC in the Windows Vista Service Pack 1 release.

Will Windows 7 have a completely new and rewritten kernel powering the OS giving us more power?

Nope. Microsoft stated on their official Windows 7 blog they won’t be bringing a brand new kernel to the system as it’s simply not needed. The current NT kernel is just fine and, although people like to think otherwise, is fairly fast. They (Microsoft) did say they are brining improvements to the kernel as always. One should also consider the compatibility issues created when changing some as fundamental as the Windows kernel itself.
[http://windowsvistablog.com/blogs/windowsvista/archive/2008/05/27/communicating-windows-7.aspx]

(Story continues after the break! Please read on for more information)