Windows 8.1: Setting start-up parameters to a tile

Just a short one today…


I wanted to set a start-up path for one of my live tiles today (power shell prompt) and I didn’t find any properties when I right-clicked on it. However, the problem was fairly simple as you do have the option to open the tile-file location (which should be somewhere in C:\ProgramData\Microsoft\Windows\Start Menu) and there you can edit your short-cut.

In my case it was really easy as I wanted to edit the start-up path which is available as a property for the short cut. 🙂

Remember that you might have to edit the security settings for the Start Menu folder in order to edit the files.

You might ask yourself why you need to do this? I don’t know but it is my firm belief that Microsoft wants you to know that they added a feature where you are the administrator of the system but you haven’t been given right to edit the files in a particular part of the file system of which you are the administrator. However, since you have administrative rights you can give yourself that right thus showing how pointless the entire system is. It’s sort of like bitching with yourself outside your house at three a clock in the morning whether or not you should let yourself in through the door (which you have the key for) or if you should just break a window and crawl in like a burglar.

T-SQL: Generating test data quickly

Today I needed to generate a lot of test data and my SQL-fu hadn’t been fed properly lately so I wasn’t sure what approach to take. Luckily I only needed pretty basic arbitrary data, but lots of it. The easiest way was to create a easily configurable script that I could run whenever I needed to create more of my data.

Below is a stripped down example of what such a script could look like. The point of this script is to generate a whole bunch of Person data:

Person table:

CREATE TABLE [dbo].[Person](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](100) NOT NULL,
	[Age] [int] NOT NULL,
	[Email] [varchar](255) NULL,
	[Id] ASC

Script to generate X number of people:

DECLARE @PeopleCount INT 

SET @PeopleCount = 10	--The number of people to generate
SET @Name = 'TEST_'		--The name of the person (will have an incremented number as suffix)
SET @AgeMin = 18		--The minimum age of the people to generate
SET @AgeMax = 58		--The maximum age of the people to generate

SET @CurrentRow = 0
SET @CurrentAge = @AgeMin

WHILE @CurrentRow < @PeopleCount
	SET @CurrentRow = @CurrentRow + 1

	SET @CurrentAge = @CurrentAge + @CurrentRow

	IF @CurrentAge > @AgeMax
		SET @CurrentAge = @AgeMin

		@Name + CONVERT(VARCHAR, @CurrentRow),

PRINT CONVERT(VARCHAR, @PeopleCount) + ' people created!'

Android: recording a video of your application

As I am releasing a new application any day now (Kludd) I was in need to record some gameplay from the app in order to do some kind of video promo. I had no idea how to record from a telephone (I knew how to take screenshots on my Samsung Galaxy S4 which was by holding down the on/off-button and the home button simultaneously) so I googled it.
I found that you could do it using your Android SDK. These are the steps in short:

* Connect your android phone to your computer
* In a command prompt, step into your android sdk directory and then platform-tools directory
* Enter the following command: adb shell screenrecord /sdcard/FILENAME.mp4 (cancel/end the recording by pressing CTRL + C)

(don't mind the errors, the recording still works!)
(don’t mind the errors, the recording still works!)


After that either go in on the phone via your computer explorer and enter /Phone/ and you’ll find the video there or find it using whatever exploration app you want on the phone.

Javascript: Translating a page or app

Today when working a HTML5 app I realized that it would be sweet to translate it into other languages. It suited perfect for translation as it was a small app with little text and so I googled the subject and came into contact with a jQuery library called i18n which I found on github. It looked sweet and I tested it out using its small but concise guid (found here).

In short I created a structure that looked like this:

- bundle/
- js/
--- app.js
- index.htm

The translations were added into a file called which followed ISO-639 and ISO-3166 language and country code standard (such as
The process of fetching the translation was quite simple (as explained in their example):

#General stuff
general_save = Save
general_cancel = Cancel

#Home stuff
home_header = Welcome to my site!

#General stuff
general_save = Spara
general_cancel = Avbryt

#Home stuff
home_header = Välkommen till min sida!


	<h1 id="home_header"></h1>
	<button id="save_stuff" class="general_save"></button>
	<button id="cancel_stuff" class="general_cancel"></button>


//This will loop through all ID´s and classes it
//can find in its arrays and exchange their content with
//the translated content
var translationLoop = function ()
	//Translate all id´s
	var ids = ["home_header"];

	for (var i = 0; i < ids.length; i++)
		var id = ids[i];
		$("#" + id)

	//Translate all classes
	var classes = ["general_save", "general_cancel"];

	for (var i = 0; i < classes.length; i++)
		var c = classes[i];
		$("." + c)

var generalTranslation = function (language)
		name: 'resources',
		path: 'bundle/',
		mode: 'both',
		language: language,
		callback: function () {
			//Once the translation file is found and loaded,
			//run the translation for our content

	.ready(function ()

JavaScript: Using Underscore.js to handle collections

As I was having to match two collections of objects in a project I was working on I faded out for a minute or two thinking of LINQ and the simplicities of working with collections in C#. I then woke up to horrid, nested for-loops in javascript and realized I had to do something. I googled around and found Underscore.js. This was a simple and fast javascript library for working with collections.

I made an example where I had a list of people and another list with some of the people I had already saved. I wanted a new list with the non-saved people. One way is to create a new list, loop over the list with all the people and within it loop through the list with saved people and compare it and add to the new list.
Or you can do as I did with Underscore.js:

var people = [
    {name: "Magnus", "Age": 30},
    {name: "Fadangus", "Age": 29},
    {name: "Laban", "Age": 42},
    {name: "Bintje", "Age": 3}

var saved = [
   {name: "Fadangus", "Age": 29}

var result = _.filter(people, function(p)
                         return _.findWhere(saved, p) === undefined;

//result: [Object { name="Magnus", Age=30}, Object { name="Laban", Age=42}, Object { name="Bintje", Age=3}]

Development suggestions

I offer the following descriptive image to Rasmus Lerdorf, Anders Hejlsberg, Brendan Eich and all other people who might be maintaining, developing or creating new languages. Programming can be cold, logical and too intuitive (varies massively between languages). I offer a possible solution to this dilemma:
Language improvements

I hope some of you will implement these features in the future. Leave a comment if you do!