Code review

In my 15 year career, I have yet to encounter a software company in Slovenia, where code review would be a part of work process. It is surprising how many companies just don’t care what kind of code they produce. And this is exactly the reason why most software originating from Slovenia, well, sucks.

[Read the rest of this entry...]

Opening new mail window from C# windows application

There are some things that are unreasonably difficult even in this day of age. Well, not exactly difficult. Let’s say programmer unfriendly. For instance, opening a new mail window in your default mail client from windows .NET application. Preferably with address filled in. Google for it and you will get the same answer I did. Just start a process with “mailto:email@address.xyz” command. Sounds simple enough. Right?

[Read the rest of this entry...]

Simple rules for selling software

If you want to sell software to me, you only have to follow these three simple rules:

  1. Do not lie to me.
  2. Have full featured trial version.
  3. Respect me.

 

Sounds simple right? It is. Except, there will always be that smart sales person that will say something like: “Why don’t we let users download a free trial, but when they want to actually do things with our software, we will make that impossible for them and instead cunningly remind them that they need this and this license to do that. Yeah. That surely beats time limited trial by a huge margin.”

Guess what, you just violated all three rules. Let’s analyze how?

[Read the rest of this entry...]

Unit testing

Unit testing has been around for ages (or at least since 1986, when IEEE standard on unit testing was confirmed). It still surprises me, though, how many people just won’t do unit testing. Reasons they state differ, but most of the times I hear something along the lines of: “Unit testing is too time consuming and when you are in a hurry, you don’t have time to fool around with it.”

Now, I am no unit testing evangelist (and many of my past co-workers can vouch for that), but this is wrong on so many levels, I don’t even know where to start. Let me tell you a little story.

When I first started with Unit testing (way back in 2011), I was of the same opinion as well. Then, a project came where I had to write software for storing information we obtained remotely from a stock broker company. This program had to connect to company’s API and of course, no testing environment could be established. Also, the PC used to connect to the company was constantly occupied. Thus, my only option to actually test, if my software is working was to go four flights of stairs up with my laptop, copy the software to the PC at hand and then run the software and see if it works. Much like in the days of mainframes and punch cards. That was the first time, when I thought: “Hmm… maybe if I can somehow test the logic my program uses and be confident that it works, I will only have to deal with one crisis and that is not knowing how exactly API works.”

Hence, I started to teach myself in ways of unit testing. Now, not being a very skilled unit tester at that point, I did tons of things, one should never ever do. Like, writing data in the database and then delete it later on or sending an e-mail to mail address. Still, when I was done (and way before deadline as well), I was pretty confident that my code will work and now just had to test it on that forsaken PC. It took another hour of fiddling with API implementation at the PC location and ever since then the program runs 24-7. Without a glitch. And ever since then, I consider unit testing as essential part of my projects.

You see, the thing with unit testing is, that the time you spend writing test code would be the time you would otherwise spend on testing and fixing bad code. Not to mention the time you would spend retesting and fixing bad code when new features arrive. With unit tests, you are always sure that as long as test passes, everything works as it did. It may be that you will write more code, but you will write it quicker and better than you would without tests.

Working on a project you hate

I think every developer, specially in-house one, gets once in a while assigned a project he or she hates. OK, so perhaps hate is too strong of a word. Still, if it happens too often, nobody could resent the use of word hate.

Anyway… I stumble on this sort of project once every three to four years. Projects differ as much as a kangaroo differs from a hypo. At previous gig it was working on a cloud based solution. At current gig it is a customer relationship system. It doesn’t really matter. It could be an app for counting wildebeests. The thing that matters is how you get it done. Professionally.

[Read the rest of this entry...]

Starting open source

At my current gig, it is an outright chore to get a telephone number of an employee you want to call. There are actually two ways to go about doing this task. You can open Lotus Notes client, find an news-desk application, open that, locate address book document, open the document, open excel file and then search for a person. You can also install a 3rd party application that works or not (depends on your PC configuration), remember in which department that person is employed and then look through all numbers to find the person. Granted, second way is faster, but for some odd reason, the application does not work on my PC. At all. So every time I want to find a person to call (and that is a lot of time, as I forget phone numbers constantly), it takes about 2 minutes to get it done.

Finally, I had enough of that, and took some time to write a simpleĀ  command line app that finds me all telephone numbers for a Active directory users whose names contain searched string. Got it done in an hour or so. Then, I thought: “Hmm, if I have this problem, then also some other IT guys must have too”. So, I distributed it and instantly got a moan about it being a command line application. So, it took me another 30 minutes of my spare time, to create a WPF based GUI application for Windows. Then, I also thought: “For years now, I have been looking for excuse to start an open source project, but I do not have the time to commit to an existing one. This would be a great opportunity!”

So, here you go. Entire code is posted online at GitHub. Everyone is more than welcome to contribute.

Creating meeting request in Lotus Notes from .NET

At my present gig, there is this .NET web application for scheduling and requesting approvals for vacation and other absences, that I wrote two years ago. The application gets a bit of an upgrade from time to time, so that it runs smoothly and so that we improve user experience. But there was one thing, that I really missed which we had at previous gig. At previous gig, whenever your vacation request was approved, you got this nice meeting request in your Lotus Notes mailbox, which you accepted and “pooof”, the calendar entry was created. This was good for two things. One was, that you actually got reminded that you are not at work on said day, and thus prevented you to make any false promises. Second one was that anyone scheduling a meeting saw that you were absent and could schedule it when you were at work.

Back to present day. I want our application to have that feature! And as much as it is piece of cake to send a Lotus Notes meeting request inside Lotus Notes environment, you get into all sorts of trouble in a mixed Lotus Notes and .NET environment like we do at my present gig. Now, if you do a search for how to send a Lotus Notes meeting request from .NET, you will get plenty of hits where people use Lotus Notes COM objects to connect to mail database, generate a notes document and send it. This was useless to my problem, because to access user’s mailbox and create a meeting request, you need to run application on user’s computer and get his password. Somehow. Also, we are inclining to leave Lotus Notes for good, so any day now, we might switch to Exchange server and as god is my witness, I have no desire to write same code twice.

[Read the rest of this entry...]

Happy New Year!

I wish you all a belated merry Christmas and a really happy, healthy and successful New Year 2014.

For this blog, I only wish I had inspiration, time and energy to write more posts than in 2013. However, as is with most new year’s resolutions, this one will most likely fail as well.

Appearance matters

You worked on a project for months. You made kazillion overtime hours to implement yet another feature that made it look just a little bit more like a rocket. It is your baby. You are proud of it. It cannot be crashed by a meteorite hitting Earth, it runs faster than the speed of light and that on a 10 year old server with 512MB of RAM and to top it all it does everything customer wanted and more. You are ready, project is ready, stars are aligned correctly. All is well. And then your peers ask you to demo the thing. You show up, load the home page and your peers go: “You said you had it done! This is nowhere near done. This is at best half finished!”

[Read the rest of this entry...]

Quick tip: Telerik Reporting and export to PowerPoint

For a project of mine, I needed to export Telerik report to PDF, Excel and Powerpoint. Now, first two options you get out-of-the-box when using Telerik.Reporting dll file. The third one, however, is a bit more tricky. Setting a format to PTTX in RenderReport method of ReportProcessor will return rendering exception. Quick Google search led me to Telerik help page, where I found out that to use PPTX as output format, I also need to use OpenXMLReporting extension for Telerik.Reporting. Thankfully, extension is included with Telerik Reporting product.

I put dll to my project and added reference to it and after solution rebuild, I tried to export to PowerPoint format again. Same failure. After some more googling, I have found link to support ticket, where it further explains that one needs an OpenXML SDK 2.0 for OpenXMLRendering extension to work. OpenXML SDK 2.0 is not included in Telerik Reporting and must be downloaded from the internet. I installed the SDK, copied dll to my project and added reference to it. Another rebuild and… it worked.

So, to keep long story short. To export Telerik report to PowerPoint format, you will need:

  • OpenXMLReporting extension that you can find in Telerik Reporting installation directory.
  • OpenXML SDK 2.0 that you can find here.