Windows Mobile Support

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Friday, 29 March 2013

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

Posted on 07:45 by Unknown

In one of my last post we talked about the performance of Windows Azure Service Bus and what is the maximum number of messages that we could process in a given period of time.
In this post we will see what is the maximum numbers of consumers that we can have for subscription on Service Bus. Before staring, you should know that this refers directly to our own requirements and with our custom actions that we need to do for each message. Because of this, for each kind of application, the result can vary a lot.
Scope:
To see what is the “magic” number of Windows Azure Worker Roles instances that we can have on cloud that can process messages from only one 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-center).
Action:
First step was to use only one instance that consumes messages. We tried to determine what kind of instance is more suitable for us – from CPU perspective and number of messages that are processed. We tried the size of the instance type that offers us the best price per instance also.
Remarks: The processer level of each instance was at around 80-85%. We use an automatic scaling mechanism over threads that take into account the CPU power, number of processors and so on. During the tests, there were client that produces messages in the same time – this was required because we had to see how Service Bus behave in a real situation, not in a situation when topic already contains all the messages
Second step was to identify the size of instance that was most suitable for us from all perspective. The cost was one of the most important one. After this we scale from 1 to n instance to identity where what is the maximum number of instances that we can have.
Results:
After first step we identify that 100.000 messages can be processed by roles in the following time:

  • Small – ~19 minutes
  • Medium – ~18 minutes
  • Large – ~18 minutes
  • Extra large – ~17 minutes

The best performance related to costs was offered by the Medium size instances.
Next step was to see what is the processing time of 100.000 messages using different number of instances. All the instances that were used at this step is Medium. We end up with the following times:

  • 1 instance – 18 minutes
  • 2 instances – 11 minutes 
  • 3 instances – 7 minutes
  • 4 instances - 4 minutes
  • 5 instances – 3 minutes
  • 6 instances – 2 minutes
  • 7 instances – 2 minutes
  • 8 instances - 2 minutes

In our case we observed that the number of instances that would make us happy and the cost would be pretty okay also is around 4 instances.
Costs:
The costs for processing 1.000.000 messages are pretty good:  4 x 0.16$ + 1$ = 1.64$.
Conclusion:
In this post we saw what is the size of the worker role that is most suitable for us. Using a Medium size worker role will offer us the best performance, reported to price. In the next post we will take a look over the duration of processing different number of messages using Medium size instances and differet number of instances.

Read More
Posted in Azure, service bus, Windows Azure | No comments

Wednesday, 27 March 2013

Microsoft comes to Cluj-Napoca to talk about Windows Azure – April 2

Posted on 02:43 by Unknown

If you want to find out more about Windows Azure features and business scenario when Azure can be the perfect solution for you, … then I invite you to Windows Azure Tech & Business Camp. The trainer of this camp will be Zoli Herczeg (BDM – App, Microsoft Romania).
The event will take occurs in 3 location Timisoara (Match 27), Cluj-Napoca (April 2), Iasi (April 4). In Bucharest this event is combined with Windows Azure Boot Camp that will occurs in April 27.
In the first part of the event, Zoli H. will presents what are the features of Windows Azure and how we should work with them. In the second part of the day he will talk about business scenario where cloud is our best friend, how we can make money from.
You can register to these events using the following links:

  • Timisoara – March 27
  • Cluj – April 2
  • Iasi – April 4
  • Bucuresti – April 27 http://sdrv.ms/WxOQSc and http://sdrv.ms/14iBe1N (the seccond link is for business discussion)


Don't forget that in Cluj-Napoca we also organize a Windows Azure BootCamp in April 27 - codecamp-cluj-apr2013.eventbrite.com

Read More
Posted in Azure, Cluj, cluj-napoca, eveniment, event, Windows Azure | No comments

Tuesday, 26 March 2013

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

Posted on 11:55 by Unknown

At the end of the last year I had the opportunity to write an application that had to handle millions of messages every day. To distribute the messages between different components of the application we used Windows Azure Service Bus Service.
In the past I talked a lot about this distribution messaging system. In this post we will see what are the magic numbers of a Topic from Windows Azure Service Bus Service.
Scope:
To see how many messages can be process in as short period of time. What is the maximum number of messages that can be processed using Service Bus using only one Topic. What is the optimal number of consumers for a subscriber or 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.
Action:
We created 5 to 10 worker roles that started to send hundreds of messages to our Service Bus Topic.  In a very short period of time we could send millions of messages.
Results:
We tried pushing on the topic around 5 million messages. We observe that after a part of the messages are send to the Topic, the server starts to be slower. By slower I mean that the response latency increased drastically. Not only on the send operation, but also on the subscribers – the messages started to be received by consumer slower and slower.
One interesting part was on the portal. Even if the Topic was almost full, the number of messages that were reported on the Topic was only around 200.000-300.000.
After different experiment, we observe that with the current version of Service Bus and with the current configuration, a Topic can handle around 1.000.000 messages every 30 minutes.
Note: This value was obtain based on our experiment with our topic and messages configuration. This value is not a generic value, for any kind of project and configuration.
Cost:
From the cost perspective, we end up with a cost around 1$ per day if we use Windows Azure Service Bus for processing 1.000.000 messages. The size of each message was calculated by us around 24kB. This means that for processing 10.000.000 messages every day for a month would cost us around 300$. Before thinking that this are a lot of money, you should take into account that Service Bus will not lose any messages and in the end we process 300.000.000 (300M) messages per month.

I would conclude that the obtained value is pretty good. It is more that we expect to process a 30 minutes job, using one topic.
In the next post I will present the number of consumers that we used to process the messages in the best way possible.
Read More
Posted in Azure, service bus, Windows Azure | No comments

Friday, 22 March 2013

Cluj IT Innovation Days, 03.22.2013 - Why people should believe in cloud

Posted on 00:55 by Unknown
This week we had in Cluj IT Innovation Days. The main purpose of this event is to develop business relations with international partners and bind the local community.
Different people were invited to talk at this event, from business to technical people. At this event I was invited to speak about cloud. The topic that I have chosen was “Why you should believe in cloud”. The slides from this session you find at the end of this post.
The most important thing that people should remember after this session is related of the maturity of cloud solution. In 2013, we reached the point where cloud providers have mature products. From now we expect big enterprise solutions to move to the cloud.
Why you should believe in cloud - ITCluster iQuest Cluj Napoca from Radu Vunvulea
Read More
Posted in Azure, Cloud, Cluj, cluj-napoca, eveniment, event, Windows Azure | No comments

Thursday, 21 March 2013

[Post Event] Codecamp event in Cluj-Napoca, March 20

Posted on 02:33 by Unknown

Today we had a great Codecamp event in Cluj-Napoca. There were over 80 people that attended to this event. We had great sessions about Behavior Driven Development and Task Parallel Library.
At the end of the event we had an open panel about UI and UX. We didn’t have too much time for the open-panel, but I promises that next time we will reserve enough time for it.
I would like to thanks speakers, attendees and also to our sponsors (ISDC and Fortech).

Some pictures from the event:





Read More
Posted in Cluj, cluj-napoca, codecamp, eveniment, event | No comments

Wednesday, 20 March 2013

WCF Client and multiply IP address - How to specify the IP that needs to be used

Posted on 05:00 by Unknown
Usually, when we are developing WCF clients, we have a machine that has only one network adapter. This means that there is only one LAN network that we can use. In 99.99% of scenarios this will work perfect.
What happens when we have two or three networks adapters and each WCF client need to be use a specific one? For example we can have a private network between our machine and company network. Another one can be between our machine and internet and the last one can be a secure network between us and a partner.
For this cases, the default settings of WCF client will not work. We need to be able to specify what network we want to use for each WCF client. I looked over the firewall configuration and routing tables, but I did not found a solution on this side.
A possible solution that I found over the internet and was tested by myself also is using ServiceEndpoint.
WCF give you the possibility to create a ServiceEndpoint for each IP/URL that you want to use (on the process level). In the moment when a request is made, the ServiceEndpoint will be used to resolve the client endpoint IP.
At this level we can define a delegate that can be used to specify what IP needs to be used for each request. Because, when we create a ServiceEndpoint we specify the service endpoint address, we can have different server endpoints that will use different local IP.
The BindIPEndPontDelegate delegate is called when the client IP needs to be resolved. When the local IP is specified in the callback we need to give a valid IP address of our machine, otherwise we will end up with an error. Don’t forget that this information can be cached by WCF. Also, we don’t specify a callback, the default behavior will be used.
The code would look like this:
ServicePoint servicePoint = 
ServicePointManager.FindServicePoint(
new Uri("https://www.myService.com/Services/Payment/"));
servicePoint.BindIPEndPointDelegate =
(sp, rm, retryCount) =>
{
return new IPEndPoint(myIpAddress, portNumber);
};
In the callback, we can specify any IP to be used by using IPAddress.Any.
Do you have other solutions that don’t involve writing code? Maybe doing some configuration on the local machine.    
Read More
Posted in | No comments

Sunday, 17 March 2013

Windows Azure Service Bus - Schedule Message Delivery

Posted on 10:11 by Unknown
Windows Azure Service Bus became a powerful mechanism to distribute messages in applications that are hosted in a cloud environment or in a system that has access to internet.
When we are using this service to notify different state change, I had moments when I need to signal a state change only after a specific time interval. To be able to support this functionality we need to be able to add the message to the topic only after the specific time elapsed. This means that we need to implement a component that can store this messages for a specific time interval. We will publish this message only after the specific time interval.
A new feature was added to Windows Azure Service Bus message. This new feature give us the possibility to make a message available in the topic only from a specific time. We can forget the component that we talked some lines ago. From now, this is supported by default. We have the support to specific the time from when the message will be available – in UTC format.
Before starting using this, we need to know a very important thing. This new feature guarantee that the message will be available only after the specific time, BUT we don’t have the guaranty that the message will be available from the next second. Based on the load of our Service Bus, this message can be made available on the specific time interval or after few seconds.
In the next example we will see how we create a message (BrokeredMessage) and specific the time when it will be available on the topic.
// Create the message
DateTime availableFromInUTC = ...
BrokeredMessage msg = new BrokeredMessage("some content");
msg.ScheduledEnqueueTimeUtc = availableFromUTC;

// Create message sender
MessagingFactory messageFactory =
MessagingFactory.CreateFromConnectionString(connectionString);
MessageSender messageSender = messageFactory.CreateMessageSender("topic1");

// Send the message to the topic
messageSender.Send(msg);
Another great feature on Windows Azure Service Bus.

Read More
Posted in Azure, service bus, Windows Azure | No comments

Shadows in a Windows 8 App

Posted on 00:46 by Unknown
This week I receive a question related to XAML and a Modern UI Windows 8 application (Metro Apps).  They need a method to draw shadows in a XAML application.
When the design team port an application from iPad to Windows 8, they try to reuse a lot of things that were used on iPad. Because of this elements like shadow can appear very easily in the design of a Windows 8 application. In theory, a Windows 8 application should not contains shadows. Because an app for Windows 8 should have a clean and simple design, shadow is saw like an element that will only load the UI.
Also, people that worked with UI effect already know that the shadow effect is one of the effects that use a lot of resources – especially video or processor resource. Having this kind of effects on a tablet could drain our battery very easily.  
This is why the XAML don’t contains any kind of support for shadow. You can make some hacks, using lines with different bluer levels and thing like this, but it will be only a hack. By default we don’t have support for this kind of effect.
The first thing that we should do when we receive a request like this is to send back the design and explain that a Modern UI Windows 8 App should not contains shadows.
If you really want the shadow effect you should try using DirectX in combination with C++. Using DirectX from C++ you can make any kind of effect you want. Yes, the implementation is not so trivial, but you will obtain the perfect shadow effect. Because you are using DirectX the performance will be pretty good.
If you don’t want to use C++ and DirectX directly, I recommend http://sharpdx.org/ . This is an open source project that offer support for DirectX from C#. They have a version of the frameworks that works pretty good on Win RT. The only thing that you should remember about Sharpdx is the performance. Because is only a wrapper over DirectX and C++, if you have any kind of problems you should fallback to C++ and write your own code.   
Read More
Posted in Metro App, windows 8 | No comments

Thursday, 14 March 2013

What are the steps done to authentication Windows Azure using federation mechanism and company Active Directory?

Posted on 08:47 by Unknown

Windows Azure supports federation and integration with Windows Server Active Directory. This information is not new. I observe that people tend to use services that don’t understand. The scope of this blog post is to explain how an end user login into Windows Azure Portal using federation mechanism.
Let’s assume that our company has already configured the integration of the private Active Directory with the federation mechanism. From our internal network a user wants to access the Windows Azure company portal (each company can define their own portal where users and subscriptions can be managed).
First thing that is done is made automatically when the user login into the computer and network with the credentials. In this moment the Active Directory server from our network is used to check the user credentials. There can be different ways of authentication from user/password to RSA SecureID, smartcard and so on. The company IT can configure different ways of authentication that will be recorded on the token (ticket) that is generated at this step.
When the user authenticate with success, the AD server will generate a token called Kerberos Ticket Granting Ticket (KTGT) that is valid for a specific time interval. The validation period is configurable by the company IT.
In the moment when a user wants to access the Windows Azure Portal of the company, the user will be redirected to the Windows Azure Active Directory where the company domain name will be added to the request. Based on the domain name, Windows Azure Active Directory will know what is the address of Active Directory Federation Service (ADFS) – from our on-premise network. This service needs to be exposed over internet through a public endpoint.
After this step, all the verification process will be on the client private network. The ADFS server will contact the client PC. In this step the KTGT ticket that was generated in the moment when user authenticates in the network is used to check the user. Based on this ticket the Ticket Granting Server (KDS) is contact to generate a Service Ticket (KST). The generated KST ticket is used by the client computer to authenticate to ADFS. During this last step the token is generated. This token is sight using Security Assertion Markup Language (SAML).
This is the last token that is generated and used. The user is redirected automatically to the Windows Azure Active Directory where the SAML token is attached. This is a POST request that contains all the information needed for the final steps (no credentials will be send from the client private network) to Windows Azure Active Directory. From this moment Windows Azure Active Directory will trust the user and will give access to the Windows Azure company portal.
Based on this token the Windows Azure Active Directory will be able to generate an identity token that is signed by Windows Azure Active Directory. This encrypted token contains the identity claims of the user. As in the previous step, this token is send through a POST to Windows Azure Portal.
With this encrypted token, Windows Azure Portal can extract the user identity and use to display all the related information and of course trust the user.
It is important to know, that IT team of the company can configure further authentications steps in the moment when KDS is generated. For example an authentication step that includes a RSA Security ID or a smart card can be requested.

And we are done. This is the authentication mechanism on Windows Azure Portal of a company that used the Federation. Implementing this mechanism is pretty simple and Windows Azure Portal can automatic generate the scripts required by IT to configure the system.
Read More
Posted in Azure, Windows Azure | No comments

Wednesday, 13 March 2013

Microsoft in the Open-Source World

Posted on 03:29 by Unknown

As we all know, the open-source project exists from the moment when the first line of code was written. In this post we will see what open-source meant for Microsoft in the past and what is the relationship between open-source community and Microsoft nowadays.

How everything started
The open-source community in one way or another appeared for the first time in 1950-1960. In those days, the code was usually written by researchers from universities, in colaboration with corporations. The IT industry was alone at the beginning and the accent was put on collaboration. Why? First of all, when a discovery was made, people tend to share it. In that period of time, people were open to collaboration and to share their ideas with the rest of the world. Also, each hardware device was different and if someone wanted to run an application on a different device he had to make some changes on the application. Because of this people used to share their code.
A good example of the collaboration is from 1960, when a lot of researchers worked to define the communication protocols. The output of this collaboration is the internet that we know nowadays. Officially, the internet appeared in 1969 through ARPANET (Advanced Research Projects Agency Network).
From 1970, applications began to be more and more complex. Different companies started to invest a lot of money in the software research and development of new software products. In time, this led to the appearance of new notions like license, trademark and copyright. Besides Microsoft, there were other companies that started to use licensing system. A good example is AT&T, that decided to make profit from UNIX system – and they started to sell it.

Open-Source and Microsoft before 2000
In the first part of the period, Microsoft had a rejection position. In 1970, Microsoft didn’t used to sustain open-source projects. From their perspective, open-source projects could not bring any kind of value or revenue. From their perspective, the quality and the performance of an open-source project was questionable.
In 1976, Bill Gates writes an essay about open-source. The name of this essay was “Open Letter to Hobbyists”, where the Altair BASIC community is indirectly attacked and people using software without license. From a corporation point of view, open-source represents a threat, especially from the financial perspective.   
With or without Microsoft, the open-source community goes forward and in 1983 they launch the GNU project. The scope of this project was to develop an open-source operation system that is free to everyone and without any kind of dependency to different companies. All the code would be open-source and anybody could change it and use it.
This project leads to a new form of licensing, because of the need to license open-source projects. In 1989, the GNU General Public License appears. After this different operating systems and products appeared under this kind of license.
In the last 20 years, a lot of open-source projects had a real success on the market. A perfect example is Apache. Also, around Netscape we have a pretty interesting story. At the beginning, Netscape was not an open-source project. After Netscape became open-source project, the code source was used for different projects. For example the Firefox browser and Thunderbird.
Meanwhile, Microsoft remains the enemy of open-source projects. The quality of the open-source projects is putted under question. In 1998 a series of articles named “Halloween Documents” appeared. In these articles, the open-source is seen as a bad thing and is compared to a cancer. During the years, there were a lot of lawsuits between Microsoft and different companies because of the patents.

Open-Source and Microsoft after 2000
After 2000, Microsoft position against open-source starts to change. With the entrance in the new era, Microsoft started to sustain and work at open-source projects – directly or indirectly. In the meantime a part of Microsoft projects become open-source.
A good example of collaboration between Microsoft and open-source community is related to Hiper-V. At this open-source project, Microsoft works on drivers. Another example is jQuery where Microsoft sustains the project and works directly with jQuery team.
A big change was made in 2006, when an open-source portal was launched by Microsoft. Codeplex is the name of the portal and during the years, it becomes an important site in the open-source world. The community of Codeplex is large and very active. This portal is used by Microsoft to publish their open source projects.
One year later, even if the relationships between open-source community and Microsoft were pretty tense, Microsoft launches two types of licenses for open-source:
  • ·  Microsoft Public License
  • ·        Microsoft Reciprocal License

This is the real turning point, when open-source projects are seen like something good, that can have a business potential and the quality of them is extremely good.
Date
Event
31 October 1998
A first memo appears under the name of „Halloween Memo”. Open-source is seen as a threat because of the licensing mode
May 2001
A message appears which gives the example of companies that had provide the source code hoping to earn some money and failed
June 2001
B. Gates describes the Generic Public License as Pac-Man-Like
June 2001
S. Ballmer says that if you write an open source operating system then you need to provide everything related to that project (source code, documentation etc.)
June 2005
S. Ballmer says that Microsoft works every day to carry out projects and doesn’t compete with movements (Linux and open source community)
June 2006
Codeplex is released
October 2007
Two license modes for open-source
Now
There are many open source projects supported by Microsoft
Tabel 1 Open-source și Microsoft

Open-source project developed by Microsoft
There are a lot of open-source projects that came from Microsoft world. We don’t talk about small projects. Projects like Entity Framework, ASP.NET MVC, ASP.NET Razor, ASP.NET Web API is open-source. Anybody can inspect this code. Every day, a new project that came from Microsoft world become open-source.

In the last period of time, there was some news announcing that Git will be integrated in IDE of Visual Studio. In this moment Git is consider one of the best and used source-control mechanism. People react in different ways, but what is important for Git is that more people will be able to use it. By this integration, Microsoft will need also to offer maintenance for Git. Because of this we could expect that bugs that are discover on Git to be resolved by Microsoft. The integration of Git in Visual Studio IDE was made some time ago. If we look over the check-ins that were made on Git, we can observe that name of Microsoft employees appear.
Another interesting project that has all the API documented and can be used by the open-source community is VM Depot. This is a service where people can share, rate and use different images of operating systems (including Linux).

Project Name
Description
Reactive Extension
Common interface for different data sources
(FB, Tweeter, NetFlix, GitHub, etc)
Reactive Extension
Allows working with different asynchronous data streams
Phone Gab, jQuery Mobile, SQLite, Senqua Touch
Different frameworks supported by Windows 8
SQL Server Connector for Apache Hadoop
Allows data transfer between SQL Server and Hadoop
EF, ASP.NET, MVC, WebPI
Well known frameworks have become open source
VM Depot
A catalog of virtual machines for Windows Azure
Type Script
Is a superset of JavaScript that complies to normal JavaScript.
Tabel 3 Open-source projects sustained by Microsoft

 

Microsoft Open Tech Hub
For an easier collaboration between Microsoft and the open source community, Microsoft Open Tech Hub appeared. In this hub there are people paid by Microsoft to contribute to open source projects. Through this hub they are hoping that people will be more involved, the communication between open-source community and Microsoft to be much better and easier and to facilitate the development of various standards.

We need to understand that open source doesn’t mean only sharing source code. It means more than that. In addition to the code share, information sharing is also important, perhaps even more important. We can have available the source code containing 20 million lines of code if there isn’t any documentation. Is exactly the same as having more than one assembly.  From this point of view, Microsoft is trying to bring value by providing not only the source code but also the documentation for it.

Conclusion
An open source project should be more than a source code you put on a server and share it. You need to provide documentation, support and be careful to be functional.
The future seems to be quite promising for the open source community. Microsoft has come to recognize the value the community and began to sustain it.
In conclusion we can say that until a few years ago open source didn’t existed for Microsoft, but now these things have changed enormously and in the future we might have some more surprises.



Read More
Posted in | No comments

Monday, 11 March 2013

Different methods to cancel a Task

Posted on 14:15 by Unknown
From .NET 4.0, Task’s made our life easier. In comparison with threads, it is much simple to start a new thread execution. Because of this, you can create Task pretty simple, but when you want to make more complex things, you end up with a big headache.
In this post we will see how we should cancel a Task. Creating a task it is pretty simple thing:
Task task = new Tasl(()=> { Console.WriteLine(“New Task”); } );
But how we can cancel a task? To be able to cancel a task we need to use a cancellation token. Using this kind of object we will be able to transmit the cancelation request to our task. Don’t forget that you can use a cancellation token instance only once. This means that we cannot reuse the cancelation tokens more than once.
The task constructor accepts as second parameter a cancelation token. This token can be used in our task when we are in a point when we want to check if our task was cancelled. There are different methods to detect if the current task was cancelled or not.
The simplest way to check if our task was cancelled or not is with ThrowIfCancellationRequested method of CacellationToken. If our task was cancelled, than this method will throw an OperationCanceledException. Be aware that you should not cache this exception in your task. This exception should be catch in the code that call Wait method.
CancellationToken cancellationToken = cancellationTokenSource.Token;
…
cancellationToken.ThrowIfCancellationRequested();
Another way to check if a task was cancelled or not is by checking IsCancellationRquested property of CancellationToken. This property will return true if the task was cancelled. Like in the first option, if we have an infinite loop, we should stop it (this needs to be done from our code) – it will not be made automatically.
if (cancellationToken.IsCancellationRquested)
{
// do custom action that needs to be done when the task is cancelled
}
There also cases when we cannot have this kind of checks in our code. For example if we call long running methods from external components. In this case we can register to an event of CancellationToken that will be called when our task is cancelled. In this event callback we can do any kind of action to cancel our task.
cancellationToken.Register( () =>
{
// do custom action that needs to be done to cancel our task
});
When you create a new task, the CancellationToken instance can be obtained pretty easy from CancellationTokenSource. This is used to signal a cancellation action. Be aware of one important thing. If you wait a task with Wait method, than you should surround this call with a try cache. The OperationCanceledException exception needs to be catch. This method is thrown every time when a task is cancelled and ThrowIfCancellationRequested is used.

Read More
Posted in multitasking | No comments

Friday, 8 March 2013

Compare two person name (Are the names similar?)

Posted on 00:50 by Unknown

Working on a personal project I need a mechanism to compare two names and find out if they are similar. The first think that I done was to try to define a regular expression that could help me.
I end up studying different algorithms that can measure the distance between two sequences.  In this post I will talk about what algorithms I found and what I finally used.
First algorithm that I found was the based on Hammed distance. This algorithm measure the minimum number of substitutions that need to be done to change a string to another string. This is a great algorithm that works very well when we have string with the same length.
Another interesting algorithm was based on Euclidean distance and is used to measure the distance between two points. It is based on Pythagorean formula. It is a pretty complicated algorithm and in my case was too complicated. I need a simple solution, that doesn't consume a lot of resources. I don’t need exact match each time.
The 3th algorithm that I discover was Jaccard similarity coefficient. Using this solution you can obtain the similarity and diversity value of two sets – in our case two strings.
In the end I found what I need. The Levenshtein distance compare two sequences and measure the difference between them. It will give us how many changes we need to make to the first sequence to obtain the second one.
It is pretty similar to Hammed algorithm, but in my case this solution is good and resolves my problem. The algorithm returns a positive number. In my case when the returned value is 2 or lower I consider that the two names are similar.
Of course there are also a lot of solutions, different components that resolve this problem. In my case this was the perfect solution. The implementation in C# can be found at the end of the post.
You will observe that the algorithm is recursive. We can rewrite it in different ways of course.
Recursive version:
int LevenshteinDistance(string s, string t)
{
int n = s.Length;
int m = t.Length;

if (n == 0)
{
return m;
}
if (m == 0)
{
return n;
}

int cost = s[n - 1] == t[m - 1]
? 0
: 1;

return
Math.Min(
Math.Min(LevenshteinDistance(s.Substring(0, n - 1), t) + 1,
LevenshteinDistance(s, t.Substring(0, m - 1)) + 1),
LevenshteinDistance(s.Substring(0, n - 1), t.Substring(0, m - 1)) + cost);
}
Non recursive version:
int LevenshteinDistance(string s, string t)
{
int n = s.Length;
int m = t.Length;
int[,] d = new int[n + 1, m + 1];

if (n == 0)
{
return m;
}

if (m == 0)
{
return n;
}

for (int i = 0; i <= n; d[i, 0] = i++){ }
for (int j = 0; j <= m; d[0, j] = j++){ }

for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= m; j++)
{
int cost = (t[j - 1] == s[i - 1])
? 0
: 1;
d[i, j] = Math.Min(
Math.Min(
d[i - 1, j] + 1,
d[i, j - 1] + 1),
d[i - 1, j - 1] + cost);
}
}
return d[n, m];
}
Read More
Posted in | No comments

Thursday, 7 March 2013

Today Software Magazine, number 9 - Microsoft in open-source world

Posted on 05:04 by Unknown

In the last number of Today Software Magazine I wrote about Microsoft in open-source world. In this moment the article is only in Romanian, but in the next days it will be available in English also.
Romanian version: http://www.todaysoftmag.com/article/ro/9/Microsoft_in_lumea_Open-Source_264

And the video:
Read More
Posted in eveniment, event | No comments

Monday, 4 March 2013

Windows Azure - Filter Subscriptions feature

Posted on 12:44 by Unknown

There is a new feature available on the new Windows Azure portal that help me lot when I need to manage different subscriptions.
The true is that I had the bad experience to manage around 8 different deployments on Windows Azure in the same time (with different subscriptions). When you have the same service type used by different subscriptions and applications there were time when I open the wrong service or I had to search a while until I discover the specific service instance.
Also, when I need to make a presentation or a demo, I need a demo account because the Windows Azure portal would display all the subscription that are associated with your account. You don’t want to display the name of your clients or what kind of services are used by them.
This is way, when this new feature was available for the first time I was extremely excited, but until now I didn't had time to blog about it. As you can guess, this new feature give us the possibility to filter the subscription list. We can select from the menu the subscriptions for which the services will be displayed.
For example if we have 10 subscriptions and each subscription have 2 web roles, we can select to see only the web roles for the first and second subscription.
This simple feature, can increase your productivity a lot. Now, it is simpler for me to manage active services from Windows Azure.
Read More
Posted in Azure, Windows Azure | No comments

Codecamp event in Cluj-Napoca, March 20

Posted on 07:06 by Unknown

Registration link
ÃŽn luna martie, odată cu venirea primăverii, Codecamp  organizeză un nou evenimet pentru dezvoltatorii din Cluj-Napoca. Evenimentul urmează să aibe loc pe data de 20 martie, la sediul ISDC.
Participarea la eveniment este gratuită. Mulțumim în special sponsorilor pentru susținere (FORTECH si ISDC).

Agendă
18:15-18:30
Sosirea participanților

18:30-19:30
Behavior Driven Development and friends
Lorant Domokos
At the heart of BDD is a rethinking of the approach to unit testing and acceptance testing in order to address issues that often come up with these practices. In this session we will explore the concepts behind BDD like integration testing, acceptance testing, specification by example and will look at how the practice can be used in some scenarios targeting different application layers. We will use Specflow and Selenium and also try to highlight some best practices to follow so that we don't do more harm than good.
19:30-20:30
Introduction to Task Parallel Library (TPL)
Andrei Petrut
In this session you'll learn what TPL is and how to implement parallelism in .NET 4.0. Also you'll experience how TPL code runs on multiple cores and how to debug and profile a parallel application.
20:40-21:40
Open Panel
Open discussion about User Interface and User Experience.


Pentru mai multe informații
  • Radu Vunvulea
    • vunvulear@yahoo.com
    • 0766562375
Read More
Posted in Cluj, cluj-napoca, codecamp, eveniment, event | No comments

Saturday, 2 March 2013

Windows Azure Mobile Services supports Android

Posted on 10:21 by Unknown
I have a great news for people that develop application for mobile devices. Windows Azure Mobile Services officially support Android. Until now we had support for Windows 8, Windows Phone 8 and iOS.
From this perspective, in this moment Windows Azure Mobile Services support the most commons operating systems for mobile devices. You can use the same Mobile Service endpoint for different clients. This means that you can have only one Mobile Service that can be used by a Windows Phone 8, a iOS, Windows 8 and Android application in the same time.
If is your first time when you hear about Mobile Services you should know that is a service that provide support to create the backend of your application. Storage, tables, authentications, custom scripts, batch operation and many more are supported by default. This means that you can focus on your client application without worrying about the backend. Everting is exposed as a REST API and can be accessed directly using REST API of using client SDK (Windows 8, Windows Phone 8, iOS and Android).
When you create a new mobile service, you will be able to download a project that is already setup for your client. Depending on your client (Windows 8, Windows Phone 8, iOS or Android) different project can be downloaded. Because of this you can start using and integrate the Mobile Services without losing time on setup.
One thing that I really enjoy on Mobile Services is the SDK support for different environments. Even if Mobile Services endpoints can be accessed using REST calls, Azure team created SDKs for each environment. In this case, we have an Android SDK that can be downloaded from here (https://go.microsoft.com/fwLink/p/?LinkID=280125).
The first step to be able to use Mobile Services is to create a “MobileServiceClient” instance. This will be used to access all the services available on Mobile Services. When you create a new instance of this class, you will need to specify the url of your mobile service and the application key. All this information are available on Windows Azure portal or on the default application that can be downloaded when you create a new Mobile Service. Warning, don’t share your application key – using this key anybody can access your services.
MobileServiceClient mobileClient = new MobileServiceClient(“mobileSericeUrl”,”applicationKey”,this);
If you want to access a specific table from the backend you can use “getTable” method. The only thing that you need to know is the name of table:
… = mobileClient.getTable(“myTable”);
All the CRUD operation are supported over this table (insert, update, delete and select). In the next example we can see how you can select the rows from a table that have a column equal with a specific value:
myTable.where().field(“name”).eq(“tom”)
.execute(new TableQueryCallback<MyItem>() {
public void onCompleted(List<MyItem> result, int count, Exception exception, ServiceFilterResponse response) {
// custom code
}
});
As we can see, it is pretty simple to access any kind of resources from Mobile Services. On the backend we can define custom scripts that can run before a CRUD operation is execute over the tables. This custom scripts are defined in JavaScript.
The authentication of the user is already supported. Different identity are supported like Google, Facebook, Microsoft account, Twitter. Before using them we need to configure the identity provider on the backend. Is pretty simple, we only need to add the key and secret key for each identify provider.  For this, Windows Azure team created a page where we can add this information.
After we make this configuration we can specify for each CRUD operation over each table what kind user can access it. On the client when we want to request the user to login we need to call the login method of MobileServiceClient and specify what kind of identity we want to use.
mobileClient.login(MobileServiceAuthenticationProvider.Google, new UserAuthenticationCallback() {
new UserAuthenticationCallback() {
…
}
});
From the moment when a user is authenticated, every time when a request is made to Mobile Serivces, the user identity information will be send.
What I liked when Mobile Services were launched was the support for push notification not only for Windows 8 and Windows Phone 8, but also for iOS. Of course we have support for Android application also.
To be able to use push notification on Android devices you will need to use Google apis to push data. After you create an account, you will need to enter the api key in the push tab of Mobile Services portal. On the client application you can use your Google apis as you normally do.
From Mobile Services backend you will be able to send push notification from different location. For example we can send a push notification to our client when someone insert an item in table.
function insert(item, user, request) {
request.execute({
success: function() {
request.respond();
push.gcm.send(item.channel, “New data available”, {
success: function(response) {
// …
}, error: function(error) {
// …
}
});
}
});
}
As we can see, from now we can create Android application that use Windows Azure Mobile Services very simple. From now, when we need to create a backend for a mobile application that have support for different platform we should really take into account Windows Azure Mobile Services.
Read More
Posted in Azure, mobile services, Windows Azure | No comments
Newer Posts Older Posts Home
Subscribe to: Comments (Atom)

Popular Posts

  • Service Bus Topic - Automatic forward messages from a subscription to a topic
    Windows Azure Service Bus Topic is a service that enables us to distribute the same messages to different consumers without having to know e...
  • CDN is not the only solution to improve the page speed - Reverse Caching Proxy
    I heard more and more often think like this: “If your website is to slow, you should use a CDN.” Great, CDN is THE solution for any kind of ...
  • Content Types - Level 6: Rich Media
    Level 6: Rich Media NOTE: This is part 7 of 7 and the conclusion of this continuing series; please see earlier posts for more background inf...
  • Publishing our CellCast Widget for iPad
    The rush has been on this week as our development team worked to design a new version of our CellCast Widget specifically for Apple's up...
  • Patterns in Windows Azure Service Bus - Message Splitter Pattern
    In one of my post about Service Bus Topics from Windows Azure I told you that I will write about a post that describe how we can design an a...
  • E-Learning Vendors Attempt to Morph Mobile
    The sign should read: " Don't touch! Wet Paint !" I had a good chuckle today after receiving my latest emailed copy of the eLe...
  • SQL - UNION and UNION ALL
    I think that all of us used until now UNION in a SQLstatement. Using this operator we can combine the result of 2 queries. For example we wa...
  • Cum sa salvezi un stream direct intr-un fisier
    Cred ca este a 2-a oara când întâlnesc aceasta cerința in decurs de câteva săptămâni. Se da un stream și o locație unde trebuie salvat, se c...
  • Task.Yield(...), Task.Delay(...)
    I think that a lot of person already heard about these new methods. In this post I want to clarify some things about these new methods that ...
  • Content Types - Level 4: Reference
    Level 4: Reference Materials & Static Content NOTE: This is part 5 of 7 in a continuing series; please see earlier posts for more backgr...

Categories

  • .NET
  • .NET nice to have
  • #if DEBUG
  • 15 iunie 2011
  • 15 octombrie 2011
  • 2011
  • abstracta
  • action
  • adaugare
  • ajax
  • Amsterdam
  • Android
  • aplicatii
  • App Fabric
  • Apple iSlate
  • array
  • as
  • ASP.NET
  • AsReadOnly
  • Assembly comun
  • async
  • Asynchronous programming
  • asyncron
  • Autofac
  • AutoMapper
  • az
  • Azure
  • Azure AppFabric Cache
  • Azure backup solution
  • Azure Storage Explorer
  • azure. cloud
  • backup
  • BCP utility
  • bing maps v7
  • BitArray
  • BlackBerry
  • blob
  • BlobContainerPublicAccessType
  • breakpoint
  • bucuresti
  • C#
  • cache
  • CallerMemberName
  • CellCast
  • Certificate
  • CES
  • change
  • ChannelFactory
  • clasa
  • classinitialize
  • clean code
  • click event
  • close
  • Cloud
  • Cluj
  • cluj-napoca
  • Code contracts
  • code retrat
  • codecamp
  • CollectionAssert
  • Compact Edition
  • compara
  • Comparer T .Default
  • CompareTo
  • comparison
  • comunitate
  • concurs
  • Conditional attribute
  • configurare
  • connection string
  • container
  • content type
  • control
  • Convert
  • convertAll
  • convertor
  • cross platform
  • CRUD
  • css
  • custom properties
  • custom request
  • DACPAC
  • Daniel Andres
  • data sync service
  • database
  • date time
  • datetime
  • debug
  • default
  • delegate
  • dependency injection
  • deploy
  • DeploymentItem
  • design patterns
  • Dev de Amsterdam
  • development stoage
  • dictionary
  • diferente
  • digging
  • director
  • Directory.Exist
  • disable
  • dispatcher
  • dispose
  • dropdown
  • dynamic
  • EF
  • email
  • encoding
  • entity framework
  • enum
  • enumerable
  • Environment.NewLine
  • error
  • error 404
  • error handling
  • eveniment
  • event
  • ews
  • excel
  • exception
  • exchange
  • exita
  • explicit
  • export
  • extension
  • field
  • File.Exist
  • finalize
  • fire and forget
  • Fluent interface pattern
  • format
  • func
  • GC.SuppressFinalize
  • generic
  • getdirectoryname
  • globalization
  • gmail
  • hackathon
  • Hadoop
  • handle
  • HTML
  • html 5
  • Html.ActionLink
  • http://www.blogger.com/img/blank.gif
  • HttpModule
  • IComparable
  • IE
  • ienumerable
  • IIS
  • image
  • implicit
  • import
  • int
  • internationalization
  • Internet Explorer
  • interop
  • Ioc
  • IP Filter
  • iPhone
  • iQuest
  • IStructuralEquatable
  • ITCamp
  • itspark
  • java script
  • javascript
  • July 2012
  • KeyedByTypeCollection
  • KeyNotFoundException
  • Kinect SDK
  • lambda expression
  • LightSwitch Microsoft Silverlight
  • linq
  • list
  • lista
  • lista servicii
  • liste
  • Live Connect
  • Live ID
  • load
  • localization
  • lock
  • m-learning
  • MAC
  • Mango
  • map
  • mapare
  • mapare propietati
  • messagequeue
  • meta properties
  • method
  • MethodImpl
  • Metro App
  • Microsoft
  • Microsoft Sync Framework
  • mlearning
  • mlearning devices
  • Mobile Apps
  • mobile in the cloud
  • mobile learning
  • mobile services
  • Mobile Web
  • mongoDb
  • monitorizare
  • msmq
  • multitasking
  • MVC
  • MVC 3
  • MVVM
  • namespace
  • nextpartitionkey
  • nextrowkey
  • Ninject
  • nivel acces
  • no result
  • normalize
  • nosql
  • null expcetion
  • null object pattern
  • NullReferenceException
  • OAuth API
  • office
  • offline
  • Open ID
  • openhackeu2011
  • operations
  • operator
  • optimization
  • option
  • outputcache
  • OutputCacheProvider
  • override
  • paginare
  • pagination
  • path
  • persistare
  • Portable Library tool
  • Post event – CodeCamp Cluj-Napoca
  • predicate
  • predictions
  • prezentare
  • process
  • proiect
  • property
  • propietati
  • query
  • ReadOnlyCollection
  • ReadOnlyDictionary
  • referinta
  • reflection
  • remote
  • reply command
  • request
  • request response
  • resouce
  • REST
  • REST Client
  • RESTSharp
  • ronua
  • rss
  • rulare
  • salvare in fisier
  • sc
  • schimbare timp
  • select
  • select nodes
  • send
  • serializare
  • serialization
  • Server.Transfer. Resposen.Redirect
  • service bus
  • ServiceBase
  • servicecontroller
  • sesiune
  • session
  • Session_End
  • Session_Start
  • setup
  • Sibiu
  • signalR
  • Silverlight
  • sincronizare
  • Single Responsibility Principle
  • SkyDrive
  • skype
  • smartphones
  • smtp
  • Snapguide
  • sniffer
  • socket
  • solid
  • spec#
  • sql
  • Sql Azure
  • SQL CE
  • sql server 2008 RC
  • SRP
  • startuptype
  • stateful
  • stateless
  • static
  • stergere
  • store
  • store procedure
  • stream
  • string
  • string.join
  • struct
  • StructuralEqualityComparer
  • submit
  • switch
  • Symbian
  • Synchronized
  • system
  • tabele
  • table
  • techEd 2012
  • tempdata
  • test
  • testcleanup
  • testinitialize
  • testmethod
  • thread
  • timer
  • ToLower
  • tool
  • tostring
  • Total Cost Calculator
  • trace ASP.NET
  • transcoding
  • tuplu
  • tutorial
  • TWmLearning
  • type
  • unit test
  • unittest
  • UrlParameter.Optional
  • Validate
  • validation
  • verificare
  • video
  • view
  • ViewBag
  • virtual
  • visual studio
  • VM role
  • Vunvulea Radu
  • wallpaper
  • WCF
  • WebBrower
  • WebRequest
  • where clause
  • Windows
  • windows 8
  • Windows Azure
  • Windows Azure Service Management CmdLets
  • windows live messenger
  • Windows Mobile
  • Windows Phone
  • windows service
  • windows store application
  • Windows Task
  • WinRT
  • word
  • workaround
  • XBox
  • xml
  • xmlns
  • XNA
  • xpath
  • YMesseger
  • Yonder
  • Zip

Blog Archive

  • ▼  2013 (139)
    • ►  November (17)
    • ►  October (12)
    • ►  September (10)
    • ►  August (7)
    • ►  July (8)
    • ►  June (15)
    • ►  May (12)
    • ►  April (17)
    • ▼  March (16)
      • (Part 2) Testing the limits of Windows Azure Servi...
      • Microsoft comes to Cluj-Napoca to talk about Windo...
      • (Part 1) Testing the limits of Windows Azure Servi...
      • Cluj IT Innovation Days, 03.22.2013 - Why people s...
      • [Post Event] Codecamp event in Cluj-Napoca, March 20
      • WCF Client and multiply IP address - How to spec...
      • Windows Azure Service Bus - Schedule Message Delivery
      • Shadows in a Windows 8 App
      • What are the steps done to authentication Windows ...
      • Microsoft in the Open-Source World
      • Different methods to cancel a Task
      • Compare two person name (Are the names similar?)
      • Today Software Magazine, number 9 - Microsoft in o...
      • Windows Azure - Filter Subscriptions feature
      • Codecamp event in Cluj-Napoca, March 20
      • Windows Azure Mobile Services supports Android
    • ►  February (9)
    • ►  January (16)
  • ►  2012 (251)
    • ►  December (9)
    • ►  November (19)
    • ►  October (26)
    • ►  September (13)
    • ►  August (35)
    • ►  July (28)
    • ►  June (27)
    • ►  May (24)
    • ►  April (18)
    • ►  March (17)
    • ►  February (20)
    • ►  January (15)
  • ►  2011 (127)
    • ►  December (11)
    • ►  November (20)
    • ►  October (8)
    • ►  September (8)
    • ►  August (8)
    • ►  July (10)
    • ►  June (5)
    • ►  May (8)
    • ►  April (9)
    • ►  March (14)
    • ►  February (20)
    • ►  January (6)
  • ►  2010 (26)
    • ►  December (1)
    • ►  November (1)
    • ►  October (1)
    • ►  June (2)
    • ►  May (1)
    • ►  April (4)
    • ►  March (1)
    • ►  February (1)
    • ►  January (14)
Powered by Blogger.

About Me

Unknown
View my complete profile