JSON! Don’t use StringBuilder

I almost raged by the not-ability of the new .NET 4.0 to accept a single-quote (‘) character, instead, they automatically convert it to its escaping character, makes my JavaScript won’t work.

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”

Oh. Nice. Now I know about it. JSON. I also did a little research about it, found that XML is equivalent to JSON. However, ‘they’ should be use in their own respective proper place. Of course it is not preferable to use XML to feed data to a JavaScript array, right?

Okay. I will continue my coding.

Vs Supervisor

  1. 18.31, left me, my supervisor, and other guy.
  2. I came to my supervisor room.
  3. “Mr. Davis, Can I ask you something?”, he said “Sure”.
  4. So I explaining about my curiosity about the application.
  5. “Why did the Website need a CGI connection to the main executable application?”
  6. It reveals that there are 2 databases: ProLine database and ProTracker databases, a two, a two separated databases.
  7. That’s one of the answer I learn.
  8. I ask again “How come a VB6 application return a string”. I know if the application is made from VB6, I mean, obviously.
  9. “Oh. Not only VB, C++ also can return a String”, said my supervisor.
  10. I smell something strange here like something is hidden.
  11. “If C++ I know, because we can specify the return type of a main() method. But how about VB6?”
  12. He said: “Oh… it needs an advanced technique”.
  13. Finish. Discussion stop.

Gileerrr

Status

Banyak banget ternyata yang harus aku pelajari. Ternyata oh ternyata, tidak hanya C#. Hari ini aku temukan hal tentang IIS, .NET Framework 4.5 dan kawan-kawannya. Aku juga barusan tahu ada sesuatu namanya Bootstrap. So scaffolding. So scaffolding! Hell… IT world expands so fast.

A Day at the Races (and Source Code)

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.

Download:

  1. Source code
  2. Application installer

Hit The Keys Game in C#

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:

  1. When you lose the game, any key you pressed will not be recorded.
  2. 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.

To download:

  1. The executable
  2. 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).

Static Readonly vs Const

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.

Confusing?

It is like PI (const) and programVersion (better static readonly).

Knowledge Management

This is from my supervisor, Davis Tan.

So, today I came to work. Today only work from 10-12 because actually we were not working, we were doing chit chat. It starts with us (the new comers) to explain our background, hence my time comes and I explain several info but not all about me. Everyone actually did introduce themselves. Today is my first laugh in this company. Then it comes for session for knowledge-sharing.

The knowledge-sharing session was great, we were exchanging information. So, my boss, which is my supervisor, giving a sharing about Knowledge Management. He said that “it is not knowledge management that is applied to a company, but rather, it applied to you as individual”.

So, what is knowledge management? Continue reading