onsdag 7 november 2018

Fun fact: Origin of "upper-case" and "lower-case"

UPPER-CASE and lower-case

These terms originated from the common layouts of the shallow drawers called type cases used to hold the movable type for letterpress printing. Traditionally, the capital letters were stored in a separate shallow tray or "case" that was located above the case that held the small letters.



Info from https://en.wikipedia.org/wiki/Letter_case

Original image from https://upload.wikimedia.org/wikipedia/commons/1/1a/Upper_case_and_lower_case_types.jpg

söndag 4 november 2018

Just finished Fran Bow, a game from Killmonday Games in Hedemora

After reading in the local paper that there is a computer game studio, Killmonday Games, in Hedemora now, (probably the very first, with a released game anyway), I felt that I had to try the game they'd produced. I found their game Fran Bow on Steam, it is a point and click adventure game with a really dark, bloody and insane feeling to it. I think you understand by looking at the trailer.


Luckily I like point and click games, so now, after a total of 10 hours of playing according to Steam I've finished it.

I liked the varied puzzles and that you only got a handful of items in the inventory and that the different places visited were pretty restricted. During the last year I've been replaying the first episodes of Monkey Island with my daughter and many times got rather frustrated over how many things Guybrush carries around and how many places he can go to. It leads to too much trial and error and that's avoided in Fran Bow!

I also liked that you could double click when walking to the next scene, which instantly takes you there.
What I disliked though, was the sluggish conversations, which also could be sped up some by well-timed double clicks though, but led to lots of clicking during conversations and it was hard to get the timing right and you still have to wait a while before the next text showed up.

I've got the impression that the game has a big fan base. I didn't become a fan, but found it playable and wish Killmonday Games good luck with their upcoming games!


Are the line numbers missing in the call stack of your logged exceptions?

Sometimes when being on a bug hunt it can be a great help to read the call stack of a logged exception and to be able to see which line the exception was thrown from.

So, if your logs lacks line numbers like this one below, you don't get that extra help...

System.NullReferenceException: Object reference not set to an instance of an object.
   at LineNumberDemo.Program.ThirdMethod(Int32 value)
   at LineNumberDemo.Program.SecondMethod(Int32 value)
   at LineNumberDemo.Program.FirstMethod(Int32 value)
   at LineNumberDemo.Program.Main(String[] args)


To fix that you have to change the Debugging information setting in the project's build settings. 
- Open the Properties for your project. 
- Click Build > Advanced and change "Debugging information" from "None" to "Pdb-only".




The pdb (Program database) files contains the infomation needed to map an instruction in your program to the original line in the source file. After changing that setting the log now looks like this:

System.NullReferenceException: Object reference not set to an instance of an object.
   at LineNumberDemo.Program.ThirdMethod(Int32 value) in C:\Code\LineNumberDemo\LineNumberDemo\Program.cs:line 42
   at LineNumberDemo.Program.SecondMethod(Int32 value) in C:\Code\LineNumberDemo\LineNumberDemo\Program.cs:line 35
   at LineNumberDemo.Program.FirstMethod(Int32 value) in C:\Code\LineNumberDemo\LineNumberDemo\Program.cs:line 29
   at LineNumberDemo.Program.Main(String[] args) in C:\Code\LineNumberDemo\LineNumberDemo\Program.cs:line 16


In Visual Studio 2017, "Pdb-only" is the default setting for the Release configuration, but I'm not sure it always has been, because I've seen lots of projects that did not include the pdb-files. They make the release bigger, but as long as that isn't a problem, I don't see any reason to not include them.



Good bug hunting!

lördag 27 oktober 2018

Kul respons på min kommentar till mjukvaruutvecklar-podcasten Väg 74


Efter att ha lyssnat på några avsnitt av podcasten Väg 74 och det i mina öron många gånger låtit som att jag lyssnat på en skiva med Trazan och Banarne så skrev jag nedanstående tweet.



Nästan ett halvår senare lyssnar jag på avsnitt 83 "Undvik projekt", som har ett intro (lyssna här) baserat på tweeten, kul! :)

Just det avsnittet tyckte jag inte var så givande för mig annars, men är du sugen på att börja lyssna så kan jag rekommendera t ex avsnitt 17 "Vrid upp samarbetet till max med Mobprogrammering" eller avsnitt 15. "Tänk på test".

Och för er som växt upp utan Trazan och Banarne så finns de tydligen både på SVT:s Öppet Arkiv och Youtube såklart!




torsdag 25 oktober 2018

Open PowerShell (or Command Prompt) in Admin mode in the current folder from File Explorer

Sometimes it can be handy to open a PowerShell (or Command Prompt) from File Explorer and directly end up in the same folder that you had open in File Explorer.

These two instructions might be exclusive for Windows 10 only, I'm not sure.

Non-admin mode
Go to the address bar, type cmd and press enter.


Admin mode
For PowerShell, press alt, then f, then s then a. Alt, f, s, a
For Command Prompt, alt, f, m, a

1. Pressing Alt will bring up this menu with hotkeys



2. Pressing f will present the next menu with a new set of hotkeys




3. And pressing opens the last menu



4. Tada: PowerShell i admin mode in the correct folder



torsdag 4 oktober 2018

Do you use big enough color distance?

Read the texts in the image below.

Which text do you find easiest to read?


Probably the one with the largest color distance between the text and the background color. That is the one to the right.

How can you make sure you use big enough color distance so that even the audience in the far back can read the text in your presentation?

One way is to use Mark Millers Highlight Explorer app where you can experiment with different colors for backgorund, foreground and highlighted text.

https://github.com/MillerMark/HighlightExplorer (it's just the source code so you need Visual Studio to run it though...)


If you got money to spend and want to know more about it you can take his course The Science of Great UI

måndag 9 april 2018

Do your ajax calls block each other so they don't run in parallell? Setting the right SessionStateBehavior might fix it!

Today I tried to optimize an asp.net mvc page. The page did three ajax calls, two of them were fast and one was slow. The slow one executed first and blocked the other two so they couldn't execute and return with their data until the slow one had finished.

I was surprised by this since the ajax calls really should be asynchronous. The problem turned out to be the use of session. When session is passed with the ajax call, the call blocks other calls that passes the same session. Because if the first call alters the session it should have an impact on the other calls so they have to wait.

The solution to this was to add this attribute on the controller.
[SessionState(SessionStateBehavior.ReadOnly)]

When the controller is marked with that attribute asp.net knows that the code in the controller can't alter the session state so the other calls don't have to wait for it.

Here's the blog post that got us on the right track.