-
Remember to brake your egg at the small end*
Sometimes the interoperability between .NET and Win32 could by a pain in the ass. Especially in places you don’t expect it to be. I’ve worked recently on a cryptography algorithm. I had the source code in Clarion and all I had to do was to implement it in C#. No problem I guessed. But… The Clarion algorithm used pointers extensively. I have worked with byte arrays. I read the text as a char array and I copied the bytes into long variables using a binary shift. Lets say we have a string s = "abcd"; Its something like this: If we try to interpret this as a uint variable: uint…
-
Multiple projects – multiple repositories
Do you have one project you want to share between multiple solutions? Something like a big set of helpers or a framework you need here and there? There are multiple ways ones have achieved this goal. Let me describe how I’ve done this. We work with Visual Studio as our main development environment and Subversion as our source control system. What we needed was a systematic approach where we share our framework across all of our projects. We are actively developing our framework so simple dll reference is not an option. Our rules according to framework development make it fairly save to share the same code across multiple projects and…
-
Aiding your work with Visual Studio Code Snippets
I’ve bin writing //TODO comments in my code every time wondering what pattern have we agreed upon in our team. Was it a // TODO Recipient Priority Sender, Message or // TODO Priority Sender Recipient, Message or something else. Today I thought: who am I to remember all those dentils? Do I have something to help me with this burning problem? Well I have. The name is Visual Studio Code Snippet. It in a XML file that describes a quickly insertable text. With such XML description I will by able to write only a word “todo” in my VS and everything else will happen automagically. There will by a nicely…
-
Writing MSBuild Custom Task
Scenario: we have Subversion server to manage our source code and a build server (CruiseControl.NET) to manage our deployment. We have decided to automatically set the SVN revision number to our assembly version. [assembly: System.Reflection.AssemblyVersion("1.2.3.0")] [assembly: System.Reflection.AssemblyFileVersion("1.2.3.0")] So we will replace the last 0 with the current Subversion revision number. How to do this? One way to achieve this is to modify the AssemblyInfo.cs and read the modified number from that exists. The file modification is easy with MSBuild Community Task FileUpdate <FileUpdate Files="Cic.P001001PropertiesAssemblyInfo.cs" Regex="(d+).(d+).(d+).(d+)" ReplacementText="$1.$2.$3.$(RevisionNumber)" /> But how to read it back? Well there is no easy way. I have written a custom MSBuidl task to achieve this like…
-
Developing Vista Sidebar Gadget with Script#
C# to JavaScript compiler? What? Jea! I thought the same way. It’s amazing what smart people can invent. My men is Nikhil Kothari with his Script#. What do I need the C# to JavaScript compiler for, you ask. Is IL not enough? Well think of enriching your ASP.NET web sites with JavaScript written in C#. Or using Ajax with scripts written in Visual Studio with Intelisense and refactoring. Or developing the Vista Sidebar Gadgets without writing a single line of code in Javascript! I instantly lookd at the third possibility. since I have Vista on board I was thinking about writing my own Sidebar Gadget (you know the little programs…
-
I’m sure you don’t care…
… but I’m very glad so I share 😉 I’ve just became a MCTS – Microsoft Certified Technology Specialist in ASP.NET. I passed the 70-536 and 70-528 (with quite good marks). Now I’m starting to learn to became Professional Developer (exam 70-547). Wish my luck!
-
Language doesn’t matter
My father is a land-surveyor (geodesist if you will). Nowadays he uses a notebook for his field measurements, but there was a time when he used a scientific calculator. Recently he’s notebook went dead, so he wanted to move back to his Casio scientific calculator. But, ups! Not in use for a while the battery ran out and the geodetical programs are gone. So I have to type my old programs back to the small computer. I thought I’ll share one of them as a example that programming language does not matter. What matters is how you use it and how well others could use your work. So let my…
-
It’s not magic – it’s floating point math
Please remember that 3 / 12 is not always 0.25! 😉 Take this example: int i = 3; Console.WriteLine(i / 12); You will get 0. I admit it could by a little confusing at first but I assure you, there is nothing wrong in the way JIT thinks. We dividing an integer over a… integer. What we are getting? Well, of course an integer! Is it not what you expected? How to fix this? Well the easiest way is to: int i = 3; Console.WriteLine(i / 12.0); You will get 0.25. Why? Well 12.0 is a double so the whole equation will by a double. You can check this easily…
-
ClickOnce i Continuous Integration
Od wielu lat współpracowałem z wydawnictwem Software. Mój pierwszy artykuł opublikowałem gdzieś około 2003 roku. Publikowałem w Software 2.0, i w Software Developers Journal. Pisałem artykuły do PHP Solutions i dodatków Extra. Współpraca układała się całkiem dobrze i wszystko trwałoby pewnie jeszcze latami gdyby nie to jedno „ale”. Za mój pierwszy tekst otrzymałem największe honorarium w historii mojej współpracy z Software Wydawnictwo. Później z tekstu na tekst otrzymywałem coraz mniej. Najpierw „stroną maszynopisu” było 3800 znaków wraz z kodami, później, 3800 znaków bez spacji, później i bez kodów. Do tego widełki za „nakład pracy redakcyjnej” / naturalnie o ile zastosowane to tylko na minus. Nie wspominając już o tym, że…
-
The power of image – merging in SVN
I’ve recently read a short explanation of joining in SQL. I was simply amazed how ease it was to explain fairly complicated matter with few well chosen pictures. Please read it, no matter how good are you in SQL – it will surely help you next time you will have to explain joining in SQL to someone else. I’ve decided to try the same way to taking SVN branching and merging as a target. To remind you. When you are using the source control system like Subversion (SVN) you can always branch. Meaning you can take a copy of your current sandbox and check it in as a new “path…