Well, it happens when I want to feed a FullCalendar control with a definition of activities, its schedule, its property and so and so. The feed is in form of String generated from a StringBuilder for performance reason. Previously I thought it was okay to set it all as a String, to be noted, I was never program in C# before and I not really sure with the behavior of the framework. Turn out, the single quote is converted–for security reason, Microsoft said.
I found out that this is something new that single quote is converted. In the previous .NET version (.NET 2) this behavior is not exist at all.
My supervisor come to see me, I explain that everything was okay. “Whoa… you study and open so much tab what are you looking for?” then I explain my problem. I was researching how to let .NET framework pass a single quote from controller to view. My supervisor went to see my controller, understand it, and then let me show him my CalenderData() function. Then my supervisor said “Hey, don’t use StringBuilder in this case, or any other String. Try to use JSON. You create a class that handle all the required data, then call JSON to return to the ActionResult”
Okay. I will continue my coding.
A Day at the Races is a challenge project in the book “Head First C#”. The source code is not disclosed, but the application (the executable form) of it is available to download in the headlabs website.
Here is my remake of the application, some feature is added like a Reset button. Hardly remember what else, I think the Reset button is the only feature I did add. Hohoho.
- Source code
- Application installer
This is a Hit the Keys game where challenges given by computer for you to type any appearing character. You get it right, correct incremented otherwise missed incremented. The game is coded in C#.
This game is improved from the example given in the Head First C# book. The improvement is that:
- When you lose the game, any key you pressed will not be recorded.
- There is a bug in calculating the difficulty in the example given in the book, fix is done by changing to “Ease level” and use different formula to calculate the level.
- The executable
- The source code
Both are compressed in ZIP which can be opened using Windows Explorer or any zip extractor (the free one being IZarc and 7Zip).
There is no such Static Readonly in Java. Somehow, it is a cool concept in C#. The both different in how compiler treat them. If const, during compilation, the value is baked and will never change. Let say program X uses library Y, when Y’s field programVersion is a const, X will absorb the value baked. So, next time we have newer Y, the old value is still used. Different than static readonly where the program will always refer to its value, however, it limits the ability to change as if like in the const.
It is like PI (const) and programVersion (better static readonly).