Menu Close

Bonus systems in IT – most probably you’re doing it wrong

money bag (from https://www.iconfinder.com/mrpixel)Distribution of wealth in companies and generally money subject is equally hard and interesting. It’s hard, because emotions (mine as well) kick in pretty easily, personal biases and issues around the subject are often deep and seem to be significant part of one’s personality. And this is what makes it interesting. Bonus systems are one part of broader subject of compensation plans, but it is so popular and strong form of (de)motivating that it deserves special attention.

NRW2013 – Conference day

20131011_161645After living 5 months in Germany, given opportunity and encouragement I finally got from under the rock and went to IT event – NRW2013 conference. Language barrier is still big obstacle, but, as it turned out, listening to well illustrated talks on subjects that touch more or less known domain is not very hard. NRW2013 conference consists of 2 days – one workshop day and one conference day. I attended only conference day.

Custom Tool Error when updating service reference in VS 2010[Solved]

Day as usual, I was assigned some task to do in project, that I am working on. To meet the requirement I had to update service reference to one of WCF web-services included in solution. This was nothing new, service was in this solution almost from the start of the project, even before I got to work on it, being one of it’s central parts. I was really surprised, when operation, that I’ve completed many times before failed with error:

Error    27    Custom tool error: Failed to generate code for the service reference ‘<<serviceName>>’. Please check other error and warning messages for details.

After looking through the warnings I’ve found that three of them seemed to be the causes of this error. They looked something like this:

Custom tool warning: Cannot import wsdl:binding
Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on.
<some more info, some XPaths>

and alike for “port” and “portType”. I’ve looked at Reference.cs – there was no code inside, only some generated, commented out header.

That’s a bummer! After googling I’ve found that most popular solutions were:

  • remove reference, restart VS, add it from scratch
  • try restarting machine
  • check “Reuse types from referenced assemblies”
  • if you have installed VS2012 uninstall it reinstall VS2010

First and second one did not work. Third one was no good solution. Well, it made service reference to update, but in project referencing it I had all types doubled, so ambiguous types references all over the place. Fourth solution did not help.

How to: MySQL InnoDB search engine

It seems like all world besides me knew that InnoDB storage system (of MySQL) does not support full text indexes, but MyIsam does. Since MyIsam does not support transactions it was not an acceptable solution in my case. While searching through the web for solution I’ve found that quite common one is to use Sphinx. I’ve never used this software, and since target hosting environment was external with no guarantee to adapt to my requests I couldn’t rely on Sphinx being installed. Other commonly applied solution is to build twin table based on MyIsam for every table that you wont to search in. That approach is not what I particularly like, so I’ve decided to build my search engine without full text indexes.

MooTools>=jQuery

Since I remember every JS programmer I know uses jQuery. It was my frolic to try MooTools few years ago. I really loved it, and since first use it’s my library of choice. Since I use jQuery a lot, for the team-work sake, let me briefly explain why and when, in my opinion, MooTools is better.

If you are looking for technical differences I advise you to read this great article/page: http://jqueryvsmootools.com/. I am just going to show difference in attitudes and it’s outcomes.

Different approach to reading data from SqlDataReader [source code included]

When reading data from SqlDataReader you have to know your select statement’s columns order to read and map data from database to your model. Often it looks somehow like this:

using (SqlDataReader reader = command.ExecuteReader())
{
	if (reader.Read())
		return new AnimalModel
		{
			AnimalId = reader.GetInt32(0),//or better with enum like that: AnimalId = reader.GetInt32((int)AnimalSelect.AnimalId)
			BirthDate = reader.GetDateTime(1),
			Name = reader.GetString(2)
			//etc...
		};
	else return null;
}

It’s a good practice to create enum representing select’s columns and using it instead of int indexes.
But wouldn’t it be better if you could just do it like that:

using (SqlDataReader reader = command.ExecuteReader())
{
	if (reader.Read())
		return reader.ReadObject();
	else return null;
}