February 29th, 2012
I have found a third use for C# using statement.
The first is for including namespaces, the second is shorthand for making use Dispose is called and the third is for naming types.
using Cache = Dictionary<string, KeyValuePair<string,string>();
Cache cache = new Cache();
As can be seen in the code above I have replaced a long type description with a short.
Honour thouse who should.
February 24th, 2012
Cccommunicate news letter is out.
February 12th, 2012
If we must read all the EULAs we agree upon we would not have time for work. Nor free time.
TL;DR
The computer I am writing on right now has been in my custody for about a year and a half. During this time I have collected every EULA I needed to agree upon. It adds up to 192 EULAs. Many are most certainly similar, like GPL, and others are probably variants of themselves.
I stored the agreements in RTF format except for Flash that is in PDF and a IE9 update that it seems I had to track down on the web and download the HTML page with PNGs and all. It all ends up at slightly more than 62 megs.
Now these 62 megs of data stored mostly in RTF aren’t 62 millions of readable characters so I took a 72k rtf document and saved as text. 66k. That is roughly 10% overhead. So I guess out of 62 megs I have about 57 megs of characters.
192 files. 57 million characters. With about 5 letters in an english word this would be slightly more than 11 million words. If a page has 250 words this would be 45500 pages. By comparision the whole Harry Potters series is about 3400 pages. Encyclopædia Britannica is 40 million words.
To be honest: one can’t compare word count between a book and an EULA since the former is written in English while the latter in Legalece.
February 8th, 2012
Cccommunicate news letter is out.
February 3rd, 2012
Testing that transactions do as they should is probably easiest done right in Sqlserver management studio. The trick is to fire up two of them.
You can set breakpoints as with your usual Visual studio and use the same shortcuts for stepping through.
Transactions are complex, do not think otherwise. Similarly to multi threaded programming it requires knowledge beforehand and just not the usual intellisense-and-see-which-methods-pops-up we have learned to use.
Playing around with transactions before implementing them is crucial for understanding and correct behaviour.
Just understanding that the transaction does what it should is probably not enough for any solution that has more than a trickle of traffic. Resources I have used a lot are Inside Sqlserver and Sqlserver Books online (BOL). The latter is the same as the help.
January 29th, 2012
If you play with MSMQ and get an exception like
System.Messaging.MessageQueueException was unhandled
Message=A workgroup installation computer does not support the operation.
Source=System.Messaging
ErrorCode=-2147467259
StackTrace:
at System.Messaging.MessageQueue.ResolveFormatNameFromQueuePath(String queuePath, Boolean throwException)
at System.Messaging.MessageQueue.get_FormatName()
at System.Messaging.MessageQueue.ReceiveCurrent(TimeSpan timeout, Int32 action, CursorHandle cursor, MessagePropertyFilter filter, MessageQueueTransaction internalTransaction, MessageQueueTransactionType transactionType)
at System.Messaging.MessageQueue.Receive()
…
It might be due to a reason like mine.
With
var queues = MessageQueue.GetPrivateQueuesByMachine(“.”);
var queue = queues.Where(q => q.QueueName == “private$\\mynewqueue”).Single();
var message = queue.Receive();
it does work
but with
var queue = new MessageQueue(“private$\\mynewqueue”);
var message = queue.Receive();
it doesn’t.
Change to
var queue = new MessageQueue(“.\\private$\\mynewqueue”);
var message = queue.Receive();
and you might be good to go again.
I haven’t bothered to figure out exactly why but my workaround might help you.
January 27th, 2012
I, of course, have two monitors for my development computer. (sometimes three but that is subject for another post) The extra monitor I have is tilted to portrait so it is higher than wide. I strongly recommend it.
We write code with the flow going from the top to the bottom. Having a high monitor makes me see more code and keep less in the RAM part of the brain.
One could argue that methods should be short and there hence is no need for a screen that is so high that two methods are visible at once. One could also argue that cars should be fragile so as to feel the need for avoiding collisions. Or calculators to calculate wrongly so we learn to do it manually instead.
Try tilting your extra monitor to portrait today! You might not like it – hacking queries is better done wide, spreadsheets is often wide, presentations are wide – but then you have your other landscape monitor for that.
You might have to rearrange some tools in your favourite development environment but that is easy done.
I dare you to try it and leave a comment.
January 27th, 2012
The quick and dirty documentation found for instance here hints at one should write the project name and user name together with the https source path. So is not the case if one uses TortoiseSVN.
So the string
https://compulsorycat.googlecode.com/svn/trunk/ compulsorycat --username myusername@gmail.com
should really be
https://compulsorycat.googlecode.com/svn/trunk/
Not that hard to figure out really. But it took me a while. I even missed it at this helping side.
Just for information. Nothing fancy.
January 24th, 2012
Cccommunicate news letter is out.