Archive
words and words and words
News
Patience

It has been the strangest year for me, professionally. I had a good job, where i was hired to do C++ in a Windows CE environment, but where i ended up doing the back-end in SQL Server and C#/.NET. Where i also learned about WPF and WCF and was really impressed. WCF is really easy. Dead-simple. But I really love WPF! It feels like HTML/CSS for Windows UI, except more powerful :) Granted, it took me a while to really get to grips with it, it is not as easy as WinForms is. Although it is not complicated, it's just a different way of thinking. Then i got another offer, from a company where i worked before, long ago, as a youngster, before i became self-employed. I was not really looking, but it felt welcome. I was reluctant somehow, because the other programmers in the company would be leaving, but they promised that would give me the chance to make a new start. I told them i was not going to be able to do it all alone, and needed support. That would not be a problem, they said. So back to geographical information systems. It sounded awesome! I saw the product they were selling, and we could improve that easily. It was web-based, so that would be my chance to finally get into that. I was looking at all kinds of technologies, thinking of .NET, SilverLight, Ruby and RoR. When i arrived there was one guy, not willing to share any info with me. I had to maintain and keep 5 projects up and running on my own, while i didn't even know them from scratch. Communication, like in with a client, is not really my cup op tea. I think i am good at explaining a program, sometimes i think i would like teaching, but i am not good at giving commercial info. All i could think off: sorry, i am all alone here, so i think you will need to wait a few months before i can start on your project. Which i assumed would not sound good, but it was the truth, so i kept silent. Which i believe, in all honesty, is even worse. I told our so-called commercial guy that we needed to communicate to all our clients they were going to have to be delayed, i needed to be worked in, i needed time, ... But all he did was trying to push me to take care of his pet-project. The other projects he just didn't care about (or at least: didn't seemed to). At the same time, there were also a lot of requests for changes to the software used inside our own company. And i was looking around at the possible future implementations. New technologies. It was a though, hard, and stressy time. Too many balls to keep in the air, and juggling never was my strong point. Now, we are almost 5 months further. I have implemented software in VBA for MicroStation and AutoCad. If they had told me beforehand most of my implementation work would be VBA, i might reconsider :) But let's not get into that. I have written one application to calibrate data along a pipeline, in C# and WPF, and show it graphically. That was awesome. We hired a junior, which I try to coach. Not very good i am afraid, with all the work pressure. But coming January i will have a new boss (project manager/commercial) and two more new collegues shortly after. The ambition of my new boss is simple: become the market leader in what we are doing now. Great! That sounds awesome. The last year i have been looking around at so many new technologies. I have played a bit with ruby. I tried out Ruby on Rails. I want to get my hands dirty. And soon! But we need to soothe our clients first, which means: improving their existing systems, before we continue on and create something new. Has anybody ever heard of WebDev? Well i hope you haven't, but i need to work in it. It should be extremely powerful, but maybe i just don't see that yet. Patience is a virtue.

More ...
News
Hiring a new developer

At the company where i am working now, i need to hire new developers/programmers. Remember, the IT-department of this company is constituted entirely by me alone. Problem is: how to recognize a good developer? Luckily there are some very useful articles available on the net:

  • Joel's Guerilla-Guide to Interviewing
  • Interview questions for Candidate Software developers (can you see where he got his inspiration from :))
  • Write a String Reverser (and use recursion!) It has been a long while for me to interview people. I don't want it centered around a specific technology, i just want to be able to grasp, somehow, whether or not they are good developers. Good developers, which i consider myself to be, will get their head round a new programming language in no time. I feel these interviewing hints (mentioned above) will help me finding the right collegue. On top of that, the environment I am working in is still a bit volatile, we could still choose for any valid technology at the moment (java/j2ee, C#.NET, RoR). I guess it will depend on my new collegues experience (and mine). I am favouring either .NET (because i know it well, because it is very developer friendly) or RoR (new, but very promising). If i get a very good java collegue, i am willing to go down that road too.
More ...
Uncategorized dba ora-01031 oracle
ORA-01031 error when creating database

At my new job I am back to administering Oracle. The last time I had to do any dba-job, they were still using Oracle 7 :) At my current job, the IT-department can be summed up in one word: me! So, now i have to do everything again. So today, i was trying to get a database installed on a laptop left behind, with no passwords. I was able to solve that, luckily. I had a script to create the database in Oracle 8, had to port it to 9. The biggest change there was: instead of svrmgrl you have to use sqlplus. So i could run the script, but kept getting ORA-01031 error (insufficient privileges). At first: didn't use a sys-account, then lost password of sys-account (set it again using Enterprise Manager), logon using sys-account, but my network user had no ora_dba rights. Logon with a local user with adminstrator rights, put him in the right group, and then it still didn't work ... And at those times, I am so happy there exists this something called internet. I found my solution here. I would never have thought of that. Go figure: a whole day spent trying to create a database. MS SQL Server or MySQL seem so much easier. Industry leader or not, you would suppose they could make equally simple. Or maybe i just haven't found it yet. Don't mention import and export. That is also a pain. But once it is runnning ... :)

More ...
Uncategorized
Removing VBA Password in AutoCAD

Both AutoCad and MicroStation can now be automated/extended using VBA. This is fabulous. In my current working environment, these programs are used extensively, and a lot of software has been written for it. But unfortunately as well, a lot of programmers have come and went again. So i was left with a program to change, which was locked using a password. A VBA password. I am not quite sure why one would do such a thing, one valid reason would be that some user would accidently get into to the code, and change stuff? No idea. Stop reverse engineering? I could get into a whole discussion about protecting knowledge and sharing knowledge. Anyway, i needed to get in the code, and the person was either unreachable or not willing or forgot the password himself. So i looked for ways to break a VBA password. Apparently there is a very simple way, which took my hours to find. In the *.dvb file, look for the tag "DPB=", and replace that with "DPx=" using a hex editor. Load the project, click through all error-messages, open the properties of the project, and set the password again to something you know and remember, and after that you can remove the password protection all together (if you want). A more detailed description can be found here. This method seems to work for Excel, AutoCAD, let me know if it works for other VBA password protected documents or applications (e.g. Word/Access/... ??).

More ...
News
Firefox 3 beta 5: switch off autocomplete

I find the new Firefox 3 beta 5 unbelievable. It is much faster than the older version. But one of the new "features" bothers me a lot. I don't like the new address-bar autocomplete function. The location bar is now very clever, and if you start typing a word, it will look for all similar words and tags in your bookmarks and history. This is all swell if you don't know the exact url where you want to go, but most of the time i do. Then this option becomes counter-intuitive.

And frankly, i don't like how it looks. It is too big. Too much in my face.

Maybe i still need to get used to it.

But there is an alternative. There are two ways in which the behaviour of the urlbar can be configured.

If you type "about:config" in your location bar, you can configure Firefox 3 beta 5. If you then look for the browser.urlbar there are two relevant settings:

  • matchOnlyTyped: set this to true, and you get more or less the same behaviour as before, it will only match on url, but it will still sport the new look
  • maxRichResults: if you set this to zero, you disable the location bar autocomplete function entirely.

So it is up to you, which you prefer.

Mind you, if privacy is the issue, like embarassing url's popping up while typing an url (who likes to admit an unhealthy Disney addiction), record-keeping in Firefox can now easily be disabled. Just open Extra-\>Options-\>Privacy and unselect the "keep history for at least ..." checkbox.

More ...
Uncategorized csharp xml
Easy XML reading using XmlTextReader

When looking at examples and samples for the .NET System.Xml.XmlTextReader, i was hoping it would be as easy to use as XmlTextWriter. But i did not find such examples.

XmlTextReader will read node per node, using the method Read, and a programmer will have to evaluate what type of node the current node is. But XmlTextReader has two short-hand methods: ReadStartElement and ReadElementString.

Suppose we have the following xml :

 <root>
   <itemlist>
     <item> 
       <name>Item1</name> 
       <value>110</value>
     </item>
     <item>
       <name>Item2</name>
       <value>234</value>
     </item>
     <item>
       <name>Another Item</name>
       <value>432</value> 
     </item> 
   </itemlist>
 </root>

What we want to do is read one item in a simple way. That is possible as follows:

 private void ReadItem(XmlTextReader reader, out String name, out String value) { reader.ReadStartElement("item"); name = reader.ReadElementString("name") ; value = reader.ReadElementString("value"); reader.ReadEndElement(); //item } 

Unfortunately ReadStartElement will throw an exception if the current element is not the same as the wanted element. So we need a bit more code to iterate smartly over all possibilities.

private void ReadItemList(XmlTextReader reader) 
{ 
    reader.ReadStartElement("itemlist"); 
    reader.Read(); 
    // read next element 
    while (reader.LocalName == "item") 
    { 
        String name; 
        String value; 
        ReadItem(reader, out name, out value) ; 
        // ... do something here with read item ... 
        reader.Read(); 
    } 
    reader.ReadEndElement(); // itemlist 
}

The reader.Read() positions ourself on the next node, allowing some kind of look-ahead, while the ReadEndElement and ReadStartElement can handle this perfectly well. They will either proceed to the next node, or stay on the current node. That's why this code works. For completeness, this does the setup:

XmlTextReader importReader = new XmlTextReader(fileName); 
importReader.ReadStartElement("root"); 
ReadItemList(importReader); 
importReader.ReadEndElement(); 

... where filename points to the file containing the above shown xml.

If you have any questions or comments regarding this example, please let me know.

This allows for very readable and concise code, but only if you know how the xml file you are reading is formed (the order of the elements). I will solve this in the next post.

More ...
Uncategorized wcf csharp
WCF maximum string length

WCF and MaxStringContentLength on XmlDictionaryReaderQuotas

When sending xml-data over WCF using a string, i bumped into the following error :

The formatter threw an exception while trying to deserialize the message: Error in deserializing body of 
request message for operation 'Test'. The maximum string content length quota (8192) has been exceeded 
while reading XML data. This quota may be increased by changing the MaxStringContentLength property 
on the XmlDictionaryReaderQuotas object used when creating the XML reader.

Right. This sounded like some foreign language where i can't even make out the syllables. I am using WCF with a NetTcpBinding, so after extensive googling i was able to produce the following C# code :

    ushort myport= 27001;
    const Int32 myMaxMessageSize = 6553500;
    string address = String.Format("net.tcp://localhost:9000/myservice/{0}", myport);
    XmlDictionaryReaderQuotas quotas = new XmlDictionaryReaderQuotas();
    quotas.MaxStringContentLength = myMaxMessageSize;

    NetTcpBinding binding = new NetTcpBinding();
    binding.ReaderQuotas = quotas;
    binding.MaxReceivedMessageSize = myMaxMessageSize;
    binding.MaxBufferSize = myMaxMessageSize;

    m_factory = new ChannelFactory<imyservicecontract>(binding);

    m_proxy = m_factory.CreateChannel(new EndpointAddress(address));

Setting the MaxStringContentLength alone doesn't cut it. Once your buffer grows larger than 65K (the default for MaxBufferSize and MaxReceivedMessageSize ) you will run into errors again. So that's why i opted to change those as well.

Hope this helps :)

More ...
Uncategorized
Configuring MS SQL Server 2005 for remote access

Well apparently MS SQL Server 2005 does not accept remote connections by default. Luckily i was not the first to bump into this problem, here is a step-by-step explanation to solve that. Kudos to those guys! :)

More ...
N/A