A Confused Programmer's Blog

This blog is dedicated to C# and Java programming that I happen to do for living – with accent on curious cases and with sincere intent to make the world of coding a slightly better place as a result

Archive for the ‘C# Programming’ Category

Connection to VIM API fails with ‘Insufficient permissions for setting the configuration’ error

I rarely post about the issues I am experiencing in this blog. This is mostly because most of the solutions are already there in the web. So, what pushed me to publish this post, is extremely rare scenario, that as I suspect might not be covered somewhere else. In our testing automation framework we make extensive use of virtual machines. Most of control messages are passed using vSphere API (VIM API). To my dismay, I discovered that some of previously  [ Read More ]


Selenium changes format of DateTime attribute

Recently I was assigned a task of writing automated tests for web based application. The testing framework that was chosen was Selenium v2.25. While this tool is quite powerful (for example, it will fail attempted interaction with element if this element is not accessible because it is hidden or currently blocked by another object), I ran into two issues. The first one is being slowness when it comes to retrieving data. I had a table consisting of ~100 cells. When  [ Read More ]


WCF asynchronous actions and connection limits

I ran into curious issue that took me a while to sort out. We are using WCF 3.5 for interconnection between modules. Some of the commands return AsyncResult in order to be executed concurrently. I needed to write a code that executes 11 concurrent actions using WCF. Strangely, last action hanged and never arrived to the recipient module. This looked like WCF (mis-)configuration issue, and indeed it was so. WCF asynchronous methods framework is a separate entity with complex logic  [ Read More ]


No super class for numeric values in C#? Not cool, dudes

Today I discovered a surprising C# limitation: apparently (as of .Net 3.5) numeric types in C# do not share common super class. I believe that this feature would come quite handy in cases like mine. My goal was to write a function that calculates average value of some numeric collection without taking into account top 10% and bottom 10%. So the code I came up with was: public static double AverageWithoutExtremeValues(List<double> values) {   values.Sort();   return values.Skip((int)Math.Round(values.Count * 0.1))     .Take((int)Math.Round(values.Count *  [ Read More ]


Possible reason of System.AccessViolationException when using PInvoke

I this short post I will not dive into details describing why PInvoke is essential to writing Windows based applications. Most people who are referred to this page by search engine already know what it is and have an issue of System.AccessViolationException popping when invoking one of Win32 API functions. In my case, reason for this exception appeared to be trivial – usage of wrong parameter type in the function signature. Namely, I was trying to set power scheme: [DllImport(“powrprof.dll”,  [ Read More ]


Visual Studio will talk to you if you are willing to listen

In this post I will share with you one of the development environment practices that I use and find quite helpful. Few years ago I was browsing through windows “Sounds” tab for some irrelevant obscure reason and stumbled into option of setting Visual Studio sounds. You see, incidentally, both Visual Studio and MS Windows are Microsoft’s products  – and this fact opens a room for integration features between these products that one wouldn’t normally expect. There are 4 Visual Studio  [ Read More ]


OWASP 2011 conference impressions, part one

Last week I visited OWASP IL 2011 annual conference. OWASP is a non profit organization dedicated to promote web and application security. I first got to know this initiative when the lecture based on my university research was presented about 4 years ago. Since then local OWASP branch has grown and now one can actually find interesting presentations being shown there from time to time. I myself began regularly visiting OWASP meetings since then (who in their right mind would possibly  [ Read More ]


NetJoinDomain failed with code 2 (File Not Found)

Many times when we are using PInvoke, the return value of the function specifying the error code might return some generic error that will leave the programmer scratching his head. We cannot demand from DLL producers to return meaningful error for each possible case and what happened today was just one example of this happening. I hope that my sad example will prevent critical sanity loss to someone who encounters similar problem. In order to implement domain management, we are  [ Read More ]


Subscribe to email feed

  • RSS
  • Delicious
  • Digg
  • Facebook
  • Twitter
  • Linkedin
  • Youtube

REST Assured and une

If you stumbled onto this article, it is safe to ...

Getting rid of Error

Since I upgraded my Windows 8 to Windows 10, I ...

Bypassing EULA step

We are working on automated testing of virtual appliance. This appliance ...

How I got rid of "Ac

OVF is a VMware virtual appliance format which allows you ...

My use-case of Perfo

In my blog I am set on a mission to ...

Twitter updates

RSS not configured