Tallies the techno monkey
in

dotnet.org.za

South African .NET Developer Portal

Tallies the techno monkey

  • C# code parsing, so simple, and yet so difficult...

    I've been scouring the net to try and find a “CodeParser” implementation that will work with .Net's CodeDom interface. I think I've looking in all the wrong places though. The only one I could find was “CS CODEDOM Parser” which is very promising, but alas does not parse method implementation code (i.e. it parse up until the method signature, but none of the code inside).

    Surely I cannot be the first person on this community to want to parse a source file! I know that one of you fine people out there has some ideas for me.

    Can anybody please point me in the right direction regarding finding a C# parser (does not even have to work with .Net's Codedom) so that I can load a .cs file and programmatically work with it.

    And don't suggest: “fix CS CODEDOM Parser to parse statements“, because I've looked at the code, and it's shocking! Everything is prefixed with “yy“ (yes, I also thought “why y?!“ :-) ) and named extremely poorly. Plus it's got a switch statement from hell that works using magic numbers. Oh yeah, things that aren't prefixed with yy (and there aren't a lot), are called descriptive names like “a“, “obj“, “unt“. Nice...

    Why couldn't MS just include theirs and make my life easier?! Damn stingy if you ask me :) .

  • Web Services and Datasets - Continued 2...

    Word of Warning!

    Apparently Microsoft conveniently forgot to post on the previously mentioned article that the third example actually doesn't work. Theoretically it should, BUT it doesn't. There's a bug. A big bad bug, that has made my so pissed off right now, I'm farting in a bag to unleash my fury later in a shopping mall (or any place crowded).

    How can they actually keep a misleading article like that on their site? This is one of many Microsoft technical articles that I've seen where whoever wrote it just didn't seem to bother about making sure that the insightful knowledge they're about to pass on actually works.

    That's it, I'm downloading Linux! Oh, wait, they've incomprehensible "how-to's" written by geeks with zits bigger than my nipples. Forget it...

  • Web Services and Datasets - Continued...

    So I've been hard at work catching up on web services and how to do what, and what to for what, and so on. Satisfied with to explanations and answers I got regarding Datasets as a bad method of data transportation, I was still on the hunt though to find out how one should go about creating your business objects and how to get them into arrays to easily to push a set of objects across the aether with the minimum of fuss.

    I kept thinking, wouldn't it be nice if there was a method on datasets to push its data out into an array or some usable simplified object? It turns out there isn't, which isn't a surprise, but it would have been nice.

    Then while reading almost all of the excellent articles on MSDN's “At Your Service”, I found this little beauty.

    Read the article, but it turns out that you can wrap a dataset with a XmlDataDocument, then expose it via the web service's WSDL as an array of a “compatible” datatype to be used on the client side. That way, the client expects well defined data (which is what one wants), you have very little work to do to get the the data into an array of a object. Nice...

    Now I just have to see whether all this niceness can be put together into some workable format....

  • Know of anybody (worthwhile) looking for employment?

    Now I hope I won't be castigated too much for this! I know I'm probably breaking a plethora of blogging rules, etiquette and the like, but it's kind of an emergency!

    We have urgent need of a skilled senior developer at Digital Architect. Look at the details on our Employment page.

  • Web Services and Datasets - Input needed...

    Oh dear, it had to happen some time I suppose. Eventually I would have had implement web services and then choose whether or not to use DataSets. What a dilemma?

    So I'd LIKE to use DataSets , but then, if I go the dynamic route, I'll loose (easy) interoperability with potentially other WS toolkits. (Good article)

    Don't want to piss anybody off... 

    So I suppose I could go the Typed Dataset route, but then this dude seems to be of the opinion that it will imply I'm bad at making good technical decisions. He's mostly right of course (read the second last paragraph to see why its a bad idea).

    Don't want to seem stupid...

    So, I guess I could also slog away and write wrapper objects for all the distinct data (business objects) that I'm going to need to return and zip it into arrays (for multiple objects of a type), but oh my, to think of the pain. It... well... it pains me...

    So, what to do?

    Who on the dotnet.org.za community (the smartest on average Dev community on the net, of course :-) ) has had to decide what to do? What did you decide, and more importantly how did it work out for you?

    Please dear Dr(s) Abby, help....

  • Blog Spam (Smog?!)

    These spammers are killing me! I can't stand these people. What I find very hard to believe is that there are arseholes in the world that actually make money doing this shit! Arseholes in the world I can stand. Arseholes making money by leeching off and annoying everybody else in the world, I can't! Things like this make me want to become involved in an road rage incident.

    Does anybody know what measures dotnet.org.za have against blog spam? I'd mail Armand directly, but I think he's on holiday. Some things we could try:
    HIP-CATCHA
    SQL Triggers

    Obviously, we're not the only one taking it up the nought at the moment, this dude seems to be putting on his boxing gloves.

    Here is what Scott Watermasysk thinks. I implore you all to do as he suggests. Because, not doing anything now, will end up in not being able to do anything later.

    And look, even Wikis are going for a ball of shit. Where will it all end!

    If only I could get one of these spammers into a room. I'll be waiting with a big pair of pliers. Then we'll see how he likes having his manliness made into the shape a coin...

  • Telkom suck donkey balls!!!

    I know this isn't news to you, but since I'm normally a pretty positive chap, I've always felt that maybe they've just been misunderstood. Not any more, oh no, I've been set straight regarding that little misconception but Telkom themselves. They have just confirmed an suspicion in my mind that they are the WORST bloody telecommunications company EVER to exist.
     
    I'm mean, not that I would think anything is wrong when the CEO of a company gets and R11 000 000 salary (that's right, there are 6 zeroes in that), months before the company decides to retrench thousands of workers(here). No, I wouldn't be that judgmental. Nor would I blink an eye when it officially emerges that the company is committing financial rape on all its clients by being the most expensive (here) in the WORLD at providing the services they offer.
     
    But I draw the line when they tell me the following (a short excerpt of a conversation I just had):
     
    Me: So let me get this straight, you are now charging me a R5 insurance fee, per month, for the telephone jack, so that you will come and replace it for free should something go wrong? Not that I've ever had problems with a telephone jack.
    Rep: Yes sir.
    Me: And for some reason I've never needed this insurance before, even though I've had a jack?
    Rep: You would have had to replace it yourself.
    Me (incredulous): I would have had to replace it myself? I've NEVER EVER needed to replace telephone jacks or such by myself, Telkom has always fixed problems WITHOUT any insurance. So what about when something goes wrong on my line?
    Rep: You would have sort that out yourself?
    Me: So this R5 insurance does not cover the line?
    Rep: No sir, it's for the jack only.
    Me: And before [you made this change], I would have to "sort this out myself"?
    Rep: Yes sir. Me: That is so stupid.
    Rep: I'm sorry sir that's just the way it is. It's company policy.
     
    Now never mind the truth being revealed in that last sentence about how much Telkom actually cares about it's customers. Here's some background. I applied for ADSL (the most expensive in the world), and on the day of the connection Telkom sent out a techie to check my line. I have an alarm system, and this was coupled to the telephone jack directly. The techie tells me that the alarm system could give me trouble on my ADSL and the it would be better to move the alarm line to sit behind the ADSL POTS filter. Only problem is that he is not allowed to touch it, because of the alarm connection, so I would need to get the alarm people out to connect a new jack. He leaves the jack and is off on his jolly little way. No mention of that it will cost me a sent, or that there is now some mystical new insurance for the jack. Now suddenly I'm paying R5 a month (btw, it's the principal that's pissing my off, not the amount) for insurance on the jack (that Telkom didn't even install) ONLY.
     
    A word of note to everybody reading this. According to the above conversation, if something goes wrong on your line or jack and you don't have this mystical insurance, you will have to "sort it out yourself" or pay lots of money for Telkom to fix their stuff (remember, you are technically just renting their lines). How much? Well for them to come and fix the jack only would cost R250 or so bucks. I didn't bother to find out about the lines, because I heard they want to finance another round of retrenchments, and my guess that they don't finance it, but get it via bullshit like insurance on telephone jacks!
     
    Here are some fun facts about the company that wants us to "Touch Tommorrow [on the back of financial rape]":
     
    I'm so pissed off right now, I'm going to go club some baby seals... (Please send your letters of thank to Telkom for the deaths of young innocent baby seals)
  • Pull over, I'm confiscating your car

    I listened to SAFM (yes, it is the best damn station to listen too) this morning, and they were debating the issue of whether it's acceptable to confiscate your car when you're caught driving drunk or over the speed limit. I don't think they should confiscate your car right of the bat, but by golly, if you're caught driving drunk or over the speed limit 3 or more times in a year (or even two years), then you are obviously unable to look after yourself. In the word of Yoda: "Be stripped of your car you should". I have enough things to concern myself over, and don't need to worry about some idiot who just cannot seem to break through the Kid-to-Grownup barrier.
     
    That reminds me of another thing. Why are people people always bitching about traffic officers "hiding" under bridges or behind bushes? Why is that a problem? Could it be that it's a problem because people are actually caught? If you drive over the speed limit (and, then by law, recklessly) then you SHOULD be caught! In an ideal world, we wouldn't need traffic officers, because people would have a proper sense of responsibility, and wouldn't be doing stupid things while driving. But alas, we don't live in a world like that, so now people need to be policed, because most people have this condition that I term: "A higher than normal level of idiocy". This whole Speed Kills campaign is wholly incorrect. It isn't speed that kills, it's the daft ogre doing the speeding. Their slogan should be: "Don't fool yourself, If you're speeding, you're an daft ogreish arsehole and you would do better to have a penis enlargement than to be driving a car."
  • Dispose(), Finalize(), ~Myobject... What the!?

    Ever wondered why the hell .Net has more than one way of getting rid of stuff. I was wondering the same thing today. After I got back from the hospital for bashing my head against Microsoft's documentation, I look around a little on the aether and finally, began to see the light. To all those, who like me, are MS documentation impaired, here's what it means (in the mind of Tallies, that is)...

    Finalize
    Finalize is a protected method inherited from Object. If you reference and use instances of other objects in your class (ie. via member variables), you need to drop those suckers in the Finalize method. Now in C# and Managed C++, you don't, however, override Finalize (in VB you do). You implement a destructor (which really isn't a destructor at all!), like so:

    public class MyObject
    {
        void MyObject(){}

        ~MyObject()
        {
             //destroy all those nasty resource hogs here....
        }
    }

    Now, that's all good and well, but there's a catch. When the GC runs and it finds an object that is dead, but still needs to be finalized (which you can't do yourself in code, ie. you cannot call a “destructor” or (in VB) the Finalize method), it does NOT reclaim the space used by that object. In fact it, it keeps it alive (and makes sure any internal references are also kept alive!) and adds it to a special queue ('freachable' queue). This finalizer thread (every .Net process has one), runs through that queue (when it likes!) and finalizes the objects in it. This simply means that any object still needing finalization will survive at-least one GC run. Not always desirable.

    Dispose
    But wait, all is not lost. The uber-geeks at Redmond knew that anybody with some C++ background, or who likes deterministic memory management would be running for the hills. So they created the IDisposable Interface. When your class implements this interface, you have to implement only one method: Dispose(). This method *should* be called by clients of your object. “But wait!”, I hear you say, “This does nothing for the finalize situation above!”. No it doesn't, unless off course if you call GC.SuppressFinalize in your dispose method, which tells the GC that your object does not need to be finalized, and can be collected.

    It's a little open to “abuse”, if I can call it that. This is because, though it's encouraged to call dispose when available, it's not enforced, so your object might still linger around longer than needed (By show of hands, who ,reading this, ALWAYS calls Dispose() on SQLConnection? Oh, it has a Dispose()?). A good strategy, when implementing IDisposable, is to have one common clean up method, called from Dispose and your “destructor”, which cleans up all those nasty monsters lying around and the calling GC.SuppressFinalize in the Dispose() method.

    Note that I've skipped a lot of detail, and may be outrightly wrong in some places (due to lack of detail), but I believe the gist of it is accurate enough. There are considerations to keep in mind when deciding whether you should implement IDisposable or not. In short, use IDisposable whenever you have really resource hungry things like db connections or streams etc lying around. My rule of thumb: If you're using objects in your class that implements IDisposable, then so should you.

    Anyways, I hope this was somewhat insightful and not all together inaccurate! ;-) Oooohh, long post.... bad blogger, BAD...

  • Productivity killer

    New Yeti sports is out! Game 6. http://www.yetisports.org/
  • Well, I'll be sure to try and fly Lufthansa on long flights!

    Isn't technology great! Browse, blog, game online while 10000m in the air. If only my laptop's power supply will hold :-(.

    http://radio.weblogs.com/0001011/2004/10/07.html#a8362

  • When (n<0) won't do.

    One of the funnier The Daily WTF I've read! What hoot... 
  • Legislation for a Nation...Literally...

    Here is a pretty cool site regarding South African legislation. Need to find out out what legislation there is regarding Companies? No problem, read the Companies Act of 1973 (with subsequent amendments). Want to find out where you stand regarding income tax. Read the Income Tax Act, 1962 (1962!? Income tax seems too have taken the leech stance forever).

    Off course, actually making sense of all the legal pussyfooting around making a simple intuitive point, is a different matter...

    Now if you'll excuse me, I need to work through “National Sports and Recreation Act, 1998” to see whether there is hope for out Cricket!

  • Good ol' life's little twists

    The British company I work for recently got bought out by another British company, Microgen. On Thursday, they sprang the, somewhat surprising but hardly unexpected, news that they'll be cutting staff by *at least* 35%. In my division, I have a 50% chance of keeping my job.

    Needless to say, the mood is a little somber around the office today, but I expect that to change when people realise that they actually have 60 days paid “office leave”. Yep, according to our (SA) labour laws, from the date of announcing retrenchments, they may not actually carry out those retrenchments within sixty days! Unreal Tournament, here I come! And blogging too! Also, should Microgen at some stage start offering posts again (which they will), all ex-retrenched-employees has first option on they posts advertise. They have to re-hire you. That made us come op with the scheme, that when they do, we'll all apply, and then on the day of actually starting, phone up and say that you've changed your mind. Should be worth a laugh.

    Bad news though is, that if I'm ear-marked as being one of the people they'd like to keep on, and I tell them that I don't want to stay, they could say that they're NOT going to offer me a retrenchment package, and that if I'd like to leave, then I would have to quit. I.e. no free mulla for an extra month...

    What I'd like to know is, to who else (in the dotnet.org.za community) has this happened to? What happened at your company? Were some people slaving themselves to death to impress the “retrenchment officers”, or did the network performance drop on the back of some serious downloading and network games?

    Anyways, got get UT on my machine, so if you'll excuse me...

  • A visual history of spam

    Check out this pretty cool post on spam by Raymond Chen. He's apparently KEPT every single piece of spam he's received since 1997.

    Sounds a little bizarre if you ask me, but hey, it makes for a pretty picture...

More Posts Next page »
Powered by Community Server (Commercial Edition), by Telligent Systems