Archive for 2007

Ronua Event - follow up

Tuesday, December 11th, 2007

Me and my colleague Florin had the privilege to present Windows Communication Foundation and Windows Presentation Foundation + Silverlight to the Ronua community in Timisoara, during the 12/08 meeting. At this link you can find the presentations and source code. We hope the presentations were fine and helpfull even if yesterday the same subjects were presented to the MSDN Briefing in Timisoara.

Also, we hope we can find some time in January to get together again and talk about technology.

HPC Techical Event - follow up

Monday, September 17th, 2007

So, the first technical event organized by us has taken place! We are very pleased that the meeting room was full, and though it took approximately 4 hours, everybody stayed until the end.

We have posted some photos here and the presentations including the sample code here (some of the presentations are in RO). If you have attended this event, please take some time to share your opinions about it by leaving comments to this post, and most importantly let us know what would you be interested in finding out during our next events.

As we've already said, we will organize another event like this, hopefully in a bigger room and with more attendees. Please stay in touch with this blog to find out more about it.

Response.Redirect and ThreadAbortException

Sunday, September 16th, 2007

Maybe you have noticed that using the Response.Redirect("RedirectDestination.aspx"); method causes ThreadAbortExceptions to be thrown. A simple explanation and a workaround is given on the Microsoft's support website. Unfortunately, the explanation found there is not fully satisfactory, at least not for me.

 First, if ThreadAbortExceptions are thrown, how come they are not caught in the page OnError overload? Here is the code:

protected override void OnError(EventArgs e)
{
Exception ex = Server.GetLastError();
Server.ClearError();
Response.Write(
"Error:" + ex.Message);
Response.End();
}

protected void Button1_Click(object sender, EventArgs e)
{
Response.Redirect(
"RedirectDestination.aspx");
}

With this code above, the application never enters the OnError method, so the exception is not caught this way. But if we put the Redirect in a try .. catch block, then the exception is caught; even if the redirect is actually performed, the code from the catch block is executed:

protected void Button1_Click(object sender, EventArgs e)
{
try
{
Response.Redirect(
"RedirectDestination.aspx");
}
catch (Exception ex)
{
Response.Write(
"Error:" + ex.Message);
Response.End();
}
}

Let's do some digging and find out more about this behaviour. For this, we use one of my favourite tools, the .NET Reflector, to be able to read the code from the System.Web.HttpResponse and System.Web.UI.Page classes. If we look inside the code implementation for Redirect(string url), we see that Redirect(string url, bool end) is called, with the boolean parameter set to true. This means, that the Response.End() method is called. Inside this method, we see a call to the Thread.CurrentThread.Abort method, which obviously aborts the current thread, so the response of the current page can be ended. The termination of the current thread is actually done by throwing a ThreadAbortException. This explains why calling Response("some url", false) does not throw this kind of exceptions.

Ok, now let's try to find out why the exception is not caught in the OnError overload. In order to see whos is responsilbe for executing the code for an ASP.NET page (all the events, including Init, Load, Render), we can check the stack trace of the method calls before the Page_Load; for this we can throw an Exception in the OnLoad event and write it's stack trace to the response, or in the Trace, in the OnError method. Then, we see that a method called ProcessRequestMain is called some time before OnLoad. Getting to the code of this method, again using the .NET Reflector, gives us the answer to our question: ThreadAbortException is caught and not rethrown - that's why we cannot catch it in OnError.

I am still wondering why the Redirect overload with a single string parameter is public, but at least I know how to use this method now: either call the overload with a second boolean parameter set to false (as Microsoft suggests), or catch the ThreadAbortException (but not in OnError as we have seen). You can find the source code for this post here.

.NET Technical Event

Sunday, September 9th, 2007

We are planning a tech meeting focused on .NET technologies, where interested developers are invited to come. This is the first from - I hope - the long presentation series we are going to organize.

Location: Software Incubator, Timisoara. 
Time: Friday, 14th of September, starting at 14.00.
Agenda:

Interval

Title

Speaker

1400 - 1445

Advanced ASP.NET 2.0

Mihai Tataran

1445 - 1530

Windows Presentation Foundation

Florin Toader

1530 - 1545

BREAK

 

1545 - 1630

Visual Studio 2008

Vanea Chiprianov

1630 - 1715

Silverlight

Stefan Filip

If you are interested to attend, please send an email with the number of devs coming from your organization to mihai[dot]tataran[at]hpc-consulting[dot]ro, so we can estimate the attendees count. The presentation room has approx 25 people cappacity, and the first come is the first served - if there is no room anymore, you will be announced via email.

Headaches with a VPN configuration

Sunday, September 9th, 2007

Due to the growths our company is facing, we needed a bigger office space. In the first Internship day, we received our second office room, and now we can grow up to 9 people without having any space problems.

So now we are planning to divide the company's employees into 2 teams, each working on different projects - and each project with its room. I know this sounds ok in theory, but I expect that practice will reveal some resource assignment problems. Before getting to those, we have been facing another one: there are 2 different networks which have to communicate with eachother. Shortly, it is like this: each of our room has a public IP assigned, and a router which creates a private network. Since we want to have all our source code database, development database server, files, etc - centraziled on one server, we need to access Room1 from Room2. I have taken the decision to do this by configuring a VPN connection between those 2 networks.

So, we have a Windows Server 2003 with Remote Access and Routing configured for VPN access, behind the router in Room1. First thing we had to do is forward the 1723 port on the router to the private IP of the Win2k3 server, and let PPTP walk through (the GRE protocol). In the second room, we had a test client (Vista Business) which needed to connect to the Win2k3. So here it goes…

First try: could not connect because IPX protocol is missing on the client (Vista). After some research on the net (I knew the problem, since the Vista's from Room1 already had IPX installed - because of the Quake3 rounds we sometimes play :-) ), we installed IPX on the client. Then comes the second problem: somebody is blocking GRE packets to pass. That "somebody" could be either of the following: the client computer, router2 (the router from Room2), router1, and the Win2k3 server.

So we began by disabling all the firewalls on the client computer. Tried again: still the same problem. We checked router2 to see if this is blocking something: no. So we came down to 2 possible causes router1 and the server. To be able to find out the cause, we tried to establish a VPN connection from a computer inside the server's private network, without passing through the router. In worked! So router1 is the problem…

We checked again that all the settings needed for the VPN connection are there: 1723 - check!, PPTP pass thourgh - check! I forgot to tell you that the router in cause is a Planet XRT-401D router. After reseting and re-configuring the router for a few times, after eating a pizza, we thought that maybe the router software is buggy (I am a developer, so honestly it was I who came up with the idea :-) ) and looked for the "firmware upgrade" feature of the router. Of course, we took the latest upgrade, installed it and everything worked on!

It may look simple to you, but all this stuff took more than 4 hours of my time and Andrei's time. Now, I am not a system administrator and I do not know much about configuring networks, but Andrei has just came from the finals of the IT section of the Imagine Cup contest, where he classified in the top 6 of the world! Luckilly, Andrei had a developer besides him who understands that somethimes releases are made with known bugs. It's a shame, though, that we had to find out ourselves by losing so much time - a public notification from the producer would have been great!

Summer interns at H.P.C. Consulting

Sunday, September 9th, 2007

This week is first of the 4 weeks Internship followed by 2 students, Cosmin Tartan and Ovidiu Szanto - both entering the 3rd year of study at the "Politehnica" University of Timisoara. There are severals objectives we are aiming with this project:

  1. Let a bunch of good students practice their theoretical knowledge. For this, they should first get some hands-on training.
  2. Spend much time with the Interns, and try to offer them a very intensive Internship. Since we are investing some resources into this project, we want to do it very well. I don't believe that Internships where the intern is offered some books to read and (maybe, but not always) is assigned some tasks and then nobody talks to him for 2-3 weeks is a good investment - nor for the intern, neither for the organizing company, even if the company's name is very well known and respected.
  3. Help the current employees' personal development plan, by giving them the chance to mentor an intern for a few days. I will come bak on this.
  4. Employ as many as possible out of the Interns, depending on the resources requirements we will have, on their cappabilities, and on their desire to stay more with us.

Our plan is to reserve the first 7-10 days of training on topics like: .NET and C# basics, Object Oriented Programming, database access from code, web programming, unit testing. After this period they should each be able to develop a small application (it can be a Windows or a web app), which accesses a MS SQL Server 2005 database - so the basic technology skills should be there. At the end of this phase, they will work on a small team project so they will be introduced into topics like accessing a code versioning system, team work, etc.

Second, there would be the mentoring phase. During about 5 days, they will each stand by an employed programmer and help him with his tasks. They will do some "pair programming", which I think is very usefull at least for the 2 reasons: (1) the intern learns very quickly when he's standing by a more experienced programmer, (2) the mentor has to share his working time with an intern, so his talking and interrelational abilities will be practiced. Concerning the 2nd reason, I think a good programmer which aims to be a project manager or an architect or a consultant in the near future has to be a good speaker, has to be able to explain very well and quickly the technical problems to a non technical person, and so on.

The third phase of the Internship will be focused on working (still with some help when needed) on some of our "real" projects. The difference between the 3rd and the 2nd phase is that in this one the Intern is mostly working by himself, he should be now able to do so, and only receive some quidance from the other team mates when requested.

Since we are currently in the first phase, I am very curious of what is going to happen. This is the first Internship organized by our company and I hope our objectives will be met.

“Microsoft - Partners in Learning” has reached a new phase

Sunday, September 9th, 2007

H.P.C. Consulting has been involved for a few months now in the "Microsoft - Partners in Learning" project, which, among others, has the aim to train Informatics high-school teachers on .NET technologies, so this can be inserted in the 12th grade's curricula. Which I believe it's a very important thing to do: let the students have the chance to play with the latest technologies, and leave aside "expired" ones.

Between 20th and 30th of August 2007, the most recent training course took place in Constanta, where approximately 55 Informatics teachers from all around the country had the chance to follow 2 courses: one on Object Oriented and Windows programming with .NET, the secon on web programming with ASP.NET. The courses have been taught by myself, Petru Jucovschi (DPE, Microsoft Romania), and Tudor Salomie (Team Lead, MSP UT Cluj).

Though there were some administrative problems, I can say that it has been a very nice journey: we had the chance to mix work with fun, since we were at the seaside and the weather was on our side almost all of the 10 days, and also because I had a great time with my wife, Petru and Salo staying up quite late in the night talking all kinds of stuff, from jokes to technology and Romanian IT market.

My new weblog

Wednesday, June 13th, 2007

It has been a while from my last posts in the blogosphere, when I was still an active member of the Microsoft Student Partners community in Romania. They can still be found here (RO).

Since I started my company I have been kind of busy growing it :), but now that there is more than one of us (we are 5 currently), we have decided to start posting here as we work on our current development / consulting projects. Readers can expect content related to programming, .NET, Visual Studio, MS SQL Server, IT business and so on. I'll be back soon.