Video of the week

I've found this great video and I recommend you to watch if you are interested in wireshark and filtering methods

How to reIndex a mongoDB collection using PowerShell

I wanted to find a way to automatically rebuild the index of a particular mongoDB collection, but this time with kind of different approach. As I've been getting familiar with PowerShell for some time now, I wanted to write a script and resign from writing anything with the help of pure .NET technology and Visual Studio (I'm aware that PowerShell is based on .NET but it's not the same as writing code using the most popular IDE by Microsoft). To make a long story short if you want to use PowerShell cmdlet(s) to work with your mongoDB instance visit the following website - - and read more on how to work with Mdbc module written by Roman Kuzmin.

Install the module and list all the cmdlet(s) included in the package:


If you want to read more about each of these cmdlet(s) use the following command pattern: Get-Help <Cmdlet> -Full (or use my second favorite pattern: Help <Cmdlet> -Examples)

My short script looks as follows:


The reason why I put the database name in a red circle is to indicate, that this is the database you authenticate your mongoDB user against. If another database is used to authenticate a user then you should attach it at the end of that connection string - simply replace phonebook with the right one.

Another thing is to check if the script actually works:


And the last thing was to add it to Windows Scheduler so it could run daily:


Write comment (0 Comments)

Debug with symbols in Visual Studio - Why does it take so long?

Be careful when using Microsoft's symbol servers - it requires some patience. If you will, well, it will take some time before you run any bigger project. You can read more about the concept here - - like always, everything has its pros and cons. In practice, however, I definitely encourage my friends to disable this option. I've found some articles on running the projects endlessly. One was able to run after an hour of waiting until all symbols were fully loaded.

debug symbols


Write comment (0 Comments)

[C#] What a complex declaration we've got here (..)

I've been familiar with C# for a long time and yet there are moments when I consider this language quite difficult to read. I want to create an extension method to be able to count a specific character in a string object. I could do it using simple foreach loop but no - let's try different approach. I wanna use the Count method and provide simple lambda expression as the parameter. When some people look at some complex declarations of various methods in C#, they usually say "What is that?!" - look at the following declaration of the Count method:


  1. int IEnumerable<char>.Count<char>(Func<char, bool> predicate)

 Let's try to decrypt the declaration which is not that easy to understand at first glance.

int - method returns int - number of a specific character in a string object, this is easy

IEnumerable<char>. - doesn't it look like: (IEnumerable<char>).method()? - so we have a simple OBJECT in brackets,
and the dot says that we're about to call one of its methods. No matter what, the object in brackets must implement the IEnumerable interface.

.Count<char> - our method which needs a simple character as the input parameter

(Func<char, bool> predicate) - Func is a delegate which needs a simple character as the input parameter
to provide a bool value as the result - so we need a piece of code here. It can be a method or a simple lambda expression.

The lambda expression is called for each character in the Array. Each character becomes the input paramater and each time either false (_c != c) or true (_c == c) value is return.

Write comment (0 Comments)

jQuery Not Found (404) controller's action (ASP.NET MVC)

Recently I've been working on a small ASP.NET MVC project and I was about to launch it on the production server. Everything seemed just fine until I called one jQuery function from my Scripts\phonebook.js file. The result was very clear - 404 NOT FOUND (btw. developer tools available in either Firefox or Chrome are very helpful in the process of solving these types of network / web development issues). According to what I've found on the web, it's quite common problem but it wasn't that obvious when it came to the solution. Here's a piece of the code:

  1. $.ajax({
  2. type: 'POST',
  3. url: '/Home/InsertNumber',
  4. data: JSON.stringify({
  5. Firstname: firstname.trim(),
  6. Lastname: lastname.trim(),
  7. Department: department.trim(),
  8. Telephone: telephone.trim(),
  9. Keywords: keywords.trim()
  10. }),

So when I click my #button on the website and InsertNumber is called then I get NOT FOUND (404) - why? When I run it on IIS Express instance in debug mode, everything is ok but after I publish my app on IIS it doesn't work. Is there something wrong with my InsertNumber method?

  1. [HttpPost]
  2. public JsonResult InsertNumber(string firstname, string lastname, string department, string telephone, string keywords)
  3. {
  4. try
  5. {
  6. var client = new MongoClient(_connectionString);
  7. var database = client.GetDatabase(_database);
  8. var collection = database.GetCollection<BsonDocument>(_queue);
  9. // ..
  11. return Json("result");

This method is fine - there must be something wrong with ajax call. It came up that I forgot about one very important thing. When you upload your website on IIS you give it a name - right? I called my app (website) 'telefony' - so when I run it i type: http://server/telefony - so all I had to do to fix my 404 problem was to add telefony before /Home/InsertNumber method call in url parameter: /telefony/Home/InsertNumber.

To make it work like a charm I had to correct this one part only:

  1. $.ajax({
  2. type: 'POST',
  3. url: '/telefony/Home/InsertNumber',
  4. data: JSON.stringify({
  5. Firstname: firstname.trim(),
  6. Lastname: lastname.trim(),
  7. Department: department.trim(),
  8. Telephone: telephone.trim(),
  9. Keywords: keywords.trim()
  10. }),

Solution: Let's do not forget about the name of our app deployed on IIS server - it must be included in url parameter when want to call a method from jQuery! You can optionally paste your java code in html and use '@Url.Action('Method', 'Controller')' as the parameter of url - then simply look at the source code. You'll find something like this: url: '/telefony/Home/InsertNumber' - do it when you're not sure about the correct url.

Write comment (0 Comments)

WP7 - Map control does not display content [SOLVED]

Map control cannot display its content?

There are some articles available in the Internet where You can read about the issue. I found that the reason can be related to third party additional elements like animated controls, which consumes lots of resources especially when You work with WP7 Emulator and 256 MB of RAM ( - recommended by Nokia btw ;) ).

I decided to check each element - one by one - by removing it from the code. Then I launched the app using the Emulator. I noticed that the problem was: ATTENTION - ANIMATED ELEMENT FROM TELERIK UI LIB - RadBusyIndicator


I put even two RadBusyIndicator controls in the same page's code where Map control was crucial and the primary element. After removing them both I got:


So the reason can be one or more of such elements existing in Your code - consider this and test the solution if You have similar problem with displaying Map's content.

Write comment (0 Comments)