Skip to main content

Posts

Showing posts from April, 2013

[Post-Event] Windows Azure Boot Camp in Cluj-Napoca

These Saturday all over the world Windows Azure Bootcamp took place. Of course we had to put Cluj-Napoca on the map – because of this we organize this event in Cluj also.  All the people that participate had the opportunity to discover and use Windows Azure. At every session there where around 40 people. There were 3 different sessions that explain how we can work with Service Bus, Mobile Services and how we can monitor our cloud applications. At the end of the post you can find my session slides.

[Post-Event] AISEC Cluj-Napoca, NoSQL

Last weeks I was invited by AISEC Romania to talk about NoSQL at AISEC School. In the 3 hours session I tried to make students to understand why NoSQL can be an option for us. We need to think outside the box. My presentations can be found here: NoSQL from Radu Vunvulea 3 weeks ago I had another session at AISEC School where I talk about Windows Azure – link .

Coding Stories III - JavaScript and Syntactic sugar

Usually people tend to think that if a code has a low number of lines that it will be more easily to read and understand. A similar ideas is that a code that has a fewer number of lines will be faster. In this post I will focus only on the first idea – code with a low number of line can be read and understand more easily. JavaScript sample: displayCustomValue: function (value) { return value !== null ? value === 0 ? "ON" : "OFF" : ""; } The cool thing is that it has only one line of code –one and powerful line of code. All of us know what a God class is. Based on this, we could say that our line of code from the method is a God line. When I looked for the first time over this method I said something like: “Ouuhhh! What is the behavior of this method? … Ahhh, IF value is NULL then return an empty string. ELSE, IF the value is 0 then return ON, ELSE return OFF. Good, now I understood this line of code. Even if the line looks cool, is not so

Coding Stories || - John and Gigel

Yesterday, I start looking over a web application. Unfortunately, I didn’t have the last version of the application. Why unfortunately? Because I was surprise to find something like this in the code: public override string CssClass { get { if(ResourceManager.GetResourceAsString([someName]) { return "gigel"; } else { return "john"; } } } Remarks: Gigel is a name in Rumanian, like John, Tom. These two names are used in our language (Rumanian) especially in jokes and funny story.

WCF and "Error in deserializing body of reply message for operation …" errors

These days I had to update a component that is used in Microsoft Dynamic AX. I don’t know to work with AX, but some time ago I had to write a component in C# that calls a WCF service of a 3rd party and is used by an AX application. The client proxy from C# component was update with the new client proxy; the code was also updated with the new logic. The unit-tests were updated also and we had a full green. Perfect, we send the component to AX team to update the reference to the component. They come back to us with a big ugly error: Error in deserializing body of reply message for operation … WTF, we had the same endpoint. We had a client proxy that works on our unit-tests and a command line test application, but when AX make calls using our component we get this great error message. The oddest thing is that we receive this error even if the message that is returned from the endpoint has only 20 characters. Before updating the AX worked great with our component. Looking over the int

Configuration files horror

Nowadays, working with services is pretty simple. Almost anybody can create a WCF service and expose functionalists  The same thing is with WCF clients. .NET development environment can create the client proxy very easily. When we are creating the client proxy, a part of the configuration will be added to the configuration file. In the configuration files we will find the URL of the service, which will be modified a lot of time during the development phase. We can have a testing service, a mock service, a development service and so on. If the client and the service can be hosted on the same machine, than developers will be happy, but the configuration files will be a mess. They will forget that they change the URL address and they will make commits with this change. A part of them will use “localhost”, other part will use the machine name. When you end up in a project with 40, 50 or almost 100 configuration files, changing the URL can become a time consuming process. Not only this,

Steam.CopyTo - Performance problems

This week I heard about an interesting performance problem, that I want to share with you. There is a desktop application that is used to import data from files to database. These files were in different formats, from XML to binary. Everything was fine, the application work great in the development and first phase of testing. All the code was double check, each stream was dispose when it was no longer used. During the testing phase, the application started to have an odd behavior, the RAM memory started to go crazy. Normally, the application use around 200MB during an import, but there were times when more than 1500MB of ram were consumed. Not only this, but “Out of memory” exception appeared a lot of time during different imports. All this started too appeared at the testing phase. With the same setup, developers manage to reproduce the problem and using the memory profiles that comes with Visual Studio the problem was spotted. Stream stream1 = … Stream stream2 = … stream2.Copy

Asynchronous Master Class, May 18-19, Cluj-Napoca

In May we will have a great master class in Cluj-Napoca. Codecamp will bring Andrew Clymer and Richard Blewett to Cluj-Napoca. They will talk about asynchronous programming. Registration link:  http://codecamp-cluj-mai2013.eventbrite.com/ Toata lumea stie ca lucrul cu thread-uri nu este usor. Exista multe lucruri care pot sa mearga prost - problemele de concurenta sau de thread safe sunt la ordinea zilei. Codecamp doreste sa vina in ajutorul dezvoltatorilor din Cluj-Napoca cu un master class – Asynchronous Master Class. Acest master este in totalitate gratuit. When : 18-19 Mai (full day’s event) Where : Hotel Golden Tulip (Cluj-Napoca) Cost : None Master Class Title : Asynchronous Master Class Trainers : Andrew Clymer and Richard Blewett Abstract : The goal of the two days is to take people at various levels of asynchronous programming and show them a variety of programming styles, techniques to deliver modern asynchronous applications. Topics : Tasks, Thread Safety, Concur

(Part 4) Testing the limits of Windows Azure Service Bus

In the last post related to this subject we discover how we can process millions of messages over a network using Windows Azure Service Bus Topic. For the problem that we want to resolve we find out that 4 worker roles of Medium size is the perfect configuration for our case. In this post we will talk about costs. We will see what the costs to process 10.000.000 messages are. We assume that messages are send to Service Bus from our on-premise servers. If the messages are send from our the same data center, the cost related to bandwidth would be 0. Sending messages to Service Bus Sending messages: 10$ Bandwidth cost: 27.46$  Receive messages from Service Bus Receiving messages: 10$ Bandwidth cost: 0$ (we are in the same data center) Worker role costs: 4 medium worker roles: 8.64$ Remarks: From our results, we need 8h and 40 minutes to process 10.000.000 messages from Service Bus. In this time we included the warm up of each instance – 20 minutes. We calculate

[Post-Event] AISEC Cluj-Napoca, Cloud and Windows Azure workshop

This week I had the opportunity to be one of the trainers of AISEC Academy - http://academy.myaiesec.ro/despre/ I had 3 hours to talk about Cloud Computing and Windows Azure. My main scope was to make students understand what does cloud means from a software engineering perspective. In the second part of the workshop I tried to cover the most important features that are offered by Windows Azure. I hope that students enjoyed these 3 hours and they will come in April 24, at my next workshop where I will talk about NoSQL. The slides from my last session can be found here: Cloud and Windows Azure from Radu Vunvulea

How to NOT do Web Services versioning (WCF)

On the internet, there are a lot of companies that sell information or different functionalities that are exposed like as web-services. This week I had the “opportunity” to update a client application that use remote services from a 3rd part provider. And now the story begins. In the last 12 months, there were more than 9 new versions of the service that were roll out by the 3rd part. Not all the clients use the last version of the services of course, because of this they had to support also the old versions of the services. What was their solution for this? To create for each version a new method exposed in the same endpoint and service. Because of this for an operation like GetDriver we had the following possible calls: GetDriver(), GetDriver_V2(), GetDriver_V3(), GetDriver_V4(),GetDriver_V5(), GetDriver_V6(), GetDriver_V7(), GetDriver_V8(),GetDriver_V9() Imagine that this is happening for a lot of operations that are exposed. Beside this, not all the operations were updated,

ITCamp 2013, May 23-24

You should book in your calendar May 23st and May 24st. Why? There will be the 3th edition of ITCamp in Cluj-Napoca. This is the largest premium conference that is focused on Microsoft technologies in Romania. During these two days there will be 3 different tracks: Private & Public Cloud, Development & Mobile and Architecture & Best Practices. You will find extremely interesting subject on every track. I already have problems to select at what sessions I want to participate. If you want to participate at this event you can register at the following link http://itcamp.ro . There is a great Early Bird discount until April 21st. At this conference I will have a session that is dedicate to messaging patterns over cloud infrastructure. If you will attend to my session you will discover different way to exchange messaging between enterprise applications. See you in May at ITCamp.

How to write unit-tests for async methods

All developer that works with .NET heard about Task, async, await – Task Parallel Library (TPL). Great library when we need to write code that runs in parallel. With TPL, writing code that run in parallel is pretty simple. This is great, but of course, all code that run in parallel need to be tested also – unit tests. Do you know how you need to write unit tests for async calls? I so pretty strange way of unit tests for async methods. Some of them were ugly and complicated. Why? Because the unit test method is a sync one and there we try to run and wait a response from an async call. This is why we can end up with something like this: [TestMethod] public void MoveFile_ExistingFile_ResultsFileMovedAndOriginalFileDeleted() { StorageFolder destinationFolder = null; Task.Run(() => destinationFolder = CreateFolderAsync(_originalFolder).Result)

Windows Azure Bootcamp at Cluj-Napoca, 27 April 2013

Registration link Codecamp is organizing in Cluj-Napoca the Windows Azure Bootcamp. This free event is part of the Global Windows Azure Bootcamp. The materials that will be used are based on Windows Azure Training Kit (each speaker may customize the training kits). This one day deep dive class will get you up to speed on developing for Windows Azure. The class includes a trainer with deep real world experience with Windows Azure, as well as a series of labs so you can practice what you just learned. Awesome. How much does it cost? This event is FREE to the attendees. What do I need to bring? You will need to bring your own laptop and have it preloaded with Visual Studio 2010 or Visual Studio 2012 and the last Windows Azure SDK. Please do the installation upfront as there will be no time to troubleshoot installations during the day. Is this for beginners? Yes and no. The local trainers will use the Windows Azure Training Kit to guide you to the basics. We’ll also be running

Coding Stories

Parameter names public void class Person { … public bool IsSimilar(Person person2) { … } } What do you think about the name of parameter name ‘person2’. Names of parameters, fields like xxx1, xxx2, xxx3 are not the best choice. In this case maybe a better name would be ‘otherPerson’. Magic numbers public void ValidatePhone(string phoneNumber) { … phoneNumber.Contains(“40”); } The “40” don’t’ say nothing to a reader. What this value represent, why is used and so on. If this value is used in only one place you should at least extract a constant in the body of method. In the case the same value is used in different places of the application, you should put this constraints in a common place. Property names and enums public class InvitesFilter { public bool SendByLetter { get; set; } public bool SendBySms { get; set; } public bool SendByMail { get; set; } … } First of all, do we really need the ‘SendBy’ prefix? We already know that it is in invitation filter. You

(Part 3) Testing the limits of Windows Azure Service Bus

In the latest post series about the limits of Windows Azure Service Bus, we saw that is the maximum number of messages that we can process through a single topic (1.000.000 messages every 30 minutes) and what kind of worker role we should use to process this messages in the optimum way (Medium size). In this post I will try to respond to another question that is normal to appear when we are using a cloud solution. Can I scale the number of instances that consume messages from the topic? Environment : Each message that was added to Service Bus was pretty small. We had around 100 characters in UTF7 and 3 properties added to each BrokeredMessage. We run the tests with one; two and three subscribers with different filter rules and the result were similar. Each message that is received from Service Bus required a custom action to be executed. This action is pretty complicated and consumes CPU power. Also the logic requires to access remote services (that are stored in the same data-ce