Random value

Nov 20th, 2011

Do you follow xkcd? It yes, then you mostly sure know the Random Number episode:

Image credits: http://xkcd.com/221/

I believe it is very funny and it actually happened, a few days ago, to me. Here is my “random” code that was caught in a code review by the eager eye of a colleague:

//Pass random language. It doesn't really matter
string assemblyPath = ProxyHelper.GenerateAssembly(ProxyLanguage.CS);

And the code review comment: “Although it is hard coded to CS.  :)”

I’ve been in the US for one month now and I’m already sick of commercials and ads. I totally understand that some services must deliver ads to control their costs and I agree with some ads but what happens here is insane.

If you are from Europe (as I am), you probably know that youtube has ads in the form of AdSense delivered as small popups at the bottom of the player. Here, in US, there are video ads delivered before the actual content. So, before being able to watch a video, one has to enjoy a 10-15 seconds commercial (luckily, longer ones get a Skip button after about 15 seconds).

Southpark Studios (the official site) delivers about 3 sessions of commercials/episode. Well… they need someone to sponsor the free videos but the same ad is delivered twice or even trice in a row. It might be a bug in their player but still this is no excuse. I know the IE9 and  Jack in a Box commercials so well now that I can predict the next frame… oh, and there is a new one with a guy that gets hit by a frisbee – very annoying.

I was very surprised when I received a call, on my cell phone, which turned out to be an ad. Basically, it was a recorded message trying to sell me something. This is unbelievable because the number was 1 day old, only the phone company had it and I am pretty sure that I unchecked any “I want to be spammed box”. I was even called once by a real person who was trying to sell something.

Television used to be made of TV show with some ads… Here is ads with some TV show. Approx. every 15 minutes, the movie gets interrupted by 5 minutes of commercials. Also, my provider has an interactive TV guide from where I can pick the show that I want to see. The guide is full of ads and today something happened, something that made me write this post: during a movie I got an interactive (!) ad at the bottom of the screen. The commercial was asking me to press some button on the remote control if I want more details. WTF?? This is hilarious, I am being flooded with commercials…

The last example of ads-world is Amazon’s Kindle. They offer a $30 discount for Kindle, but there is a catch: “You’ll receive special offers and sponsored screensavers directly on your Kindle, including AmazonLocal deals in select cities. Your offers display on your Kindle’s screensaver and on the bottom of the home screen—they don’t interrupt reading”. So, what is this actually? It means that they will give you the Kindle cheaper but it will display ads forever.

The American society has many positive and negative aspects but the quantity of delivered ads is not the former class.

A new start… again

Oct 19th, 2011

It’s been a while since my last post. I believe that this was the longest inactivity period of this blog. However, there is a good reason why there were no posts – I was in vacation and then I did a big change in my life. The vacation was great but this post is about the change.

I started a new job at Microsoft in the United States. I am now working with the X++ compiler team. In case you haven’t heard of X++, you should know that X++ is the programming language that allows developers to extend Dynamics AX so that it matches their needs and business.

Also, I now live in the Seattle area. One of the most famous attraction in the area is the Space Needle, therefore I included a picture of the top platform of the tower. I took the picture on Saturday when the weather was sunny – it was one of the two sunny days that we had in the last three since I arrived here.

Goodbye Copenhagen, goodbye Microsoft, goodbye Netherlands, goodbye Delft, goodbye University, goodbye good Danish pastries and bad food! This is where my one year (and a few days) stay in Denmark ends. Also, my journey on the fascinating pastures of academia, in the Netherlands, ended a few days ago when I defended my master thesis. Least but not last, my internship in Microsoft ended about a month ago, but as the song says, “you can check out any time you like but you can never leave”. More about this will follow in another post, hopefully soon. I am now in the Copenhagen airport waiting for a plane that will take me back to Romania. I will take advantage of the waiting time and do a short retrospective of this memorable year.

The biggest achievements come first, so as I already mentioned in the first paragraph, I managed to successfully complete a master in Computer Science at the Technical University of Delft, in the Netherlands. It was definitely harder than I expected but I managed to do it (see my project here). I learned a lot and I would like to share some of the things that I will remember from TUDelft (random thoughts that barely worth 2 cents):

  • Research requires a lot of time and a lot of study. Until getting there (in NL) I never did academic research in the true sense
  • Spending more than two years for a two years master programme is fine and students are not always supposed to be young. However, spending too much time should raise an alarm.
  • Academic research can bring real value to the world (see TUDelft’s Incubators and research)
  • Sleeping 5-6 hours/day and working the rest is not sustainable and one can only do it for a limited amount of time. Is more productive to sleep more.
  • Wikipedia is not a valid reference

Next is the Microsoft experience. Getting in Microsoft was a big dream that I wasn’t able to complete about four years ago when I tried to get an internship. However, last winter I tried again and it worked. I spent one year as a Tester or, the official title, Software Development Engineer in Test (SDET) working on Dynamics AX2012. Before Microsoft I only worked in a small company (with ~50 employees) and the MS experience was something completely different. I believe that now I can tell the difference between working in different size companies and I know which are the (dis)advantages of each. I think the biggest gain from Microsoft is not the programming/testing experience but the understanding of the process and how big projects are developed.

Moving from one place to another is not one of my favorite activities – what I hate is the process of moving, not being in a new place. However, there is an advantage when getting to new places: you meet people and make connections. I met many great individuals both in Holland and Denmark and I will miss them. However, because of different social networks, I believe that it will be quite easy to stay in touch and, at least, exchange some words from time to time.

The people that I met Denmark and in the Netherlands were great and crazy (in a positive way). We had a lot of fun, went to a lot of parties (unfortunately not so many in Holland because of the study load) and spent memorable moments – I just checked and I have 2000+ pictures just from Denmark and I know that there are many others that I haven’t got because of various reasons. Did you know that people in Microsoft love parties? Being a geek doesn’t mean only going to LAN parties :-)

The last two years were amazing but, in the same time, extremely exhausting. For the first time in the last 4-5 years, I have nothing to do. There are no school assignments, no projects, no meetings, nothing. Even though is a weird feeling, I guess I should enjoy it and take advantage of the situation. Therefore, I hereby declare the beginning of my extended vacation.

I was looking for an SVN provider for a personal project. One of the providers that I found (will not disclose the name) had a very nice offer and some extra features compared to the others. So, I started playing with their website and SVN. By mistake, I found that only the first 8 characters of the password are validated when logging in to the SVN repository. What does that mean? It means that if my password is “MySuperStrongPassword” then I can login with any of the following:

  • MySuperS“,
  • MySuperSXX”,
  • MySuperSUselsessCharacters”

because only the bold part gets validated making 8+ characters passwords as strong as those with 8 characters.

Immediately, I sent a message to customer service:

Dear sir/madam,

[...]If I set a password with more than 8 characters then only the first 8 are validated at SVN login, making possible to access the repository by just using the first 8 characters of my password.

[... the rest of the message with details and repro steps]

They have a good (but useless, as will be seen soon) customer services. I got the response after 3 hours:

Read the rest of this post »

Today is a big day. Except the fact that we have a day off in Denmark because of some national holiday, Microsoft revealed the first video of the next generation of Windows.

The video includes (quote from the press release):

  • Fast launching of apps from a tile-based Start screen, which replaces the Windows Start menu with a customizable, scalable full-screen view of apps.
  • Live tiles with notifications, showing always up-to-date information from your apps.
  • Fluid, natural switching between running apps.
  • Convenient ability to snap and resize an app to the side of the screen, so you can really multitask using the capabilities of Windows.
  • Web-connected and Web-powered apps built using HTML5 and JavaScript that have access to the full power of the PC.
  • Fully touch-optimized browsing, with all the power of hardware-accelerated Internet Explorer 10.

I don’t think any more details are necessary. Just enjoy the video:

The read the press release.

Suppose there is an automated test case for a report:

1. Generate a report for today
2. Check if the date printed on the report is today's date

The question is: how can this test case fail?

Read the rest of this post »

I have the feeling that I’m getting old :) Last week I went to the supermarket to buy groceries. I was in front of the cashier when I took my credit card out from the wallet, put it in the POS and typed the PIN code. Surprisingly, I got an “Invalid PIN code” message. At that point I realized that the code I typed is actually the security code of something else, not of my card.

“Well… That’s not a big issue. I use that PIN everyday and shouldn’t be hard to type the correct one on the second attempt”, I told to myself. The second attempt ended with another “Invalid PIN code”. So did the third and my card got blocked.

The PIN code just vanished from my head. I tried to recall it, I know that it must be somewhere there, but I can’t.There are a lot of numbers in my head, some are of other cards and some I don’t know what they are. I even unblocked my card, tried 3 more codes that I thought might work and got the card blocked again.

Why can’t I remember the code? Meanwhile I ordered a new PIN…

Tool: f.lux

Apr 29th, 2011

Like many of you, I spend a lot of hours per day in front of the computer’ screen. Especially in the night, you might have noticed that the screen is really bright and you have problems looking at it. I had the same problem until I discovered f.lux (yes, the dot is part of the name). I’ve been using in the last 9-10 months and I really feel an improvement, is much easier to look at the screen during the night.

Basically, f.lux is a free, lightweight application that adjust the temperature the colors on the display in order to match the natural lighting conditions. While the sun is up on the sky, the screen displays normal colors. During sunset, a slow transition to night colors is made. After this, the colors are colder and, for example, white becomes brownish. It might sound strange but it really helps.

f.lux can br download it from the official website and it is available for Windows, Mac and Linux. On the same page, is a research on sleep and more details about how f.lux helps.

I was writing some C# unit tests that had to use Reflection in order to set properties on objects, when I got into an interesting problem. I will provide a simplified version of the code I wrote, first the version without reflection, then my reflection version that had an issue and, in the end, the correct version.

TestClass is a class that has a property of type List<int>:

class TestClass
    public List<int> Value { get; set; }

Goal: create an instance of this class, set the property and print the second element in the list. Simple, huh? The code without reflection is:

TestClass c = new TestClass();
c.Value = new List<int>() { 4, 5, 6 };

Seems straight forward to use reflection for this, right? Here is my attempt:

//TestClass c = new TestClass();
object c = new TestClass();
//c.Value = new List<int>() { 4, 5, 6 };
Type t = c.GetType();
PropertyInfo prop = t.GetProperty("Value", BindingFlags.Public | BindingFlags.Instance);
prop.SetValue(c, new List<int>() { 4, 5, 6 }, null);
int valueToOutput = (int)prop.GetValue(c, new object[] { 1 });

Can you see the glitch? I can tell you that line 10 throws TargetParameterCountException. You know why?

Read the rest of this post »

« Older Posts Newer Posts »