Categories
perspective

Rational Thinking

there does seem to be a particular glory bestowed upon the “rational thinker”. we can certainly pride ourselves in it when, either by delusion, reality or way of compliment, we are attributed with the phrase “rational thinker”. and as such, we perpetuate the idea that there is something superior to the art/skill of rational thinking. however…

how many times you had a great idea just hit you “out of the blue”? anything rational about that experience? and i would hazard to assume that a large percentage of revolutionary ideas are from rational. for example, was creating a mode of transport that defied gravity a rational decision? if anything, in it’s time, flying was not certainly not logical, nor a reasonable idea. and as much as “the world is round” was also not a logical conclusion, based on the knowledge at hand at the time. until, with time, it became a rational idea. and therein too, lies the rub. what is not rational today, may be rational tomorrow and vice-versa thereby betraying the fickle nature of reason and logic.

i don’t think rational thought is the be all and end all, and not even close to being one of the more superior thought processes available to man. in fact, sometimes rational thought is precisely what holds us back and curbs our potential. nay, rational thought is but one of many “tools” we can use at the right time to a ‘better’ end. but let’s not neglect, nor relegate it’s cousins, inspired thought and gut feeling, to second class citizenship πŸ˜‰

now that’s to not say that if you pride yourself on being a rational thinker, you’re somewhat missing the point. in that case, your skill is more advanced than others in the domain of reason. but if you want to explore the untapped potential of what you can achieve, tap a little more creatively into the inspired side of your life… not with reckless abandon, but with a little less inhibition and get ready to be surprised πŸ˜‰

Timing Trap

It’s subtle, and easily overlooked.

Server side calls in the domain layer are setting all sorts of properties on an object before pushing it over to the database for persistence. The database receives the object, persists and returns. The domain then requests an updated snapshot from the database (which may or may not include the data recently persisted). Nothing tricky, stock standard code.
Domain::Foo::DeactivateContact(DateTime.Now);
Domain::Foo::SelectDeactivatedContacts();

Problem creeps in when the server side code (domain) resides on a different server to the database and both servers are dealing with DateTime as a parameter for filtering on datasets. If their timestamps are not synchronized, down to the millisecond, you’re likely to get an inconsitently reproducible bug. As was the case recently…

A ‘contact’ was deactivated by setting the deactivatedTime field with a value on the domain server.
Deactivated contacts were returned by the data server based on the data server’s getdate() value.

When the two calls are sufficiently close to one another, your newly deactivated record sometimes appears in the second result set, depending on whether the two calls are within the same second according to the various timestamps on the different servers. Huh? πŸ™‚
“Esoteric”, as Eugene used to say.

And you can’t overcome the issue 100% of the time reliably. Not when you start partitioning, synchronizing, servicing and load-balancing logic within a virtual network. You can however, be aware of the problem and plan accordingly. It’s just one of those (depending on the kind of systems you’re writing) you just keep in the back of your head until it surfaces one day… πŸ™‚

Currently Learning…

So part of the whole Ubuntu move has also involved migrating my predominantly MS-based programming skillset into something *else*. As it is, i am studying part-time to complete a B.Sc Applied Mathematics, so this year will be a little slower at times on the technology front, but it proceeds, nonetheless.

So far, i’ve managed to learn a little Python and PHP. Turbogears, Django, CakePHP and Zend all occupy my headspace at the moment. The one thing they (the frameworks) have in common though is MVC, so once you have that covered, getting to grips with the semantics of each framework is a little easier.

In the process though, i’ve ended up learning a lot about my Ubuntu installations (server and desktop), managing Apache2, user rights and managing those on the system, network interfaces, MySql and Sqlite, a lot of “notepad” editing (ala nano, vi and gedit)… actually, come to think of it, i’ve learned more about *nix this year than Windows and i’ve had a whole lot more fun too πŸ˜€
Of course, i could have spent the time learning Linq, WPF, WCS, etc.. etc… but you can tell from my enthusiasm, i’ve been getting a little jaded with all the MS hype that just turns out to be the same ol’, only with more hoops. To be fair though, i did enjoy some of the .NET porting to Mono.
And that’s been the difference: the fun factor. Learning is fun. When it’s not fun, it’s not learning. It’s cramping.

Preserving the Stacktrace

Exception handling is important enough to get right. And there’s plenty of sample code out there to help you get it right, nonetheless, i come across two major variations:
catch (Exception ex) {
throw;
}

and

catch (Exception ex) {
throw ex;
}

There’s more about catching general Exception but that’s beyond the scope of this post. So, moving right along…

There is one other variation:

catch (Exception ex) {
throw new Exception(ex);
}
But the first two are more interesting. The second (throw ex;) is the least desirable, unless of course you have a good reason to not preserve the stacktrace.

rethrowexception.PNG
Code attached rethrow.txt

Hello, Baby J

the most anticipated birth of the century… πŸ˜€
She’s adorable, she’s gorgeous… she’s everything i thought only more than everything i thought.

dscf0146.JPG

www.flickr.com


And “My Wife”… wow! I am so proud of her. For nine months she worked so hard at making sure Jessie would come out just perfect and right to the end, she gave it her all and did an absolutely amazingly fantastic “thing”. I am stumped by her ability, tenacity, perseverance, love and courage in the face of everything that went down… (Lolly, you’re beautiful!)

And again, we have an absolutely awesome Father in Heaven. A true, righteous and loving God…

And so we start, the three of us, our next exciting episode πŸ˜€

Firefox is unsupported?

I was trying to access the MS Partner website… but with Firefox. They didn’t seem to like that very much πŸ™‚

screenshot.png

i really hate spam

There, i said it. And i’ll say it again. I hate spam.
Akismet is a real lifesaver, and along with SpamAssassin as well as Mozilla Thunderbird and i live in a state of “managed” spam. The odd irritation gets through, but nothing like before…
Between viruses, worms and spyware the computer desktop is enough of a nightmare and then you got to deal with spambots everywhere! Seriously… it’s outta hand.

It’s ridiculous to the point that you get initiatives which have to spend their time and effort combating something which nobody even wants?! methinks a good time to throw what time i have saved from spam filters and put it into Kill Spam πŸ™‚

Everybody’s Guessing :)

Who’s gonna get it right? πŸ™‚
We got takers spanning anywhere within 3 weeks and almost a 50/50 whether J is a girl or a boy.
This is sooo much more fun than getting the sex confirmed and booking a caesarian πŸ˜€

DefaultWsdlHelpGenerator Gotcha

Whiskey Tango Foxtrot, but this was super unpleasant to uncover.

I’ve got a website up ‘n running and wanted to add a webservice to it, aight? Wizards make the job easy so here i go:

“Add > New item > Asp.Net > Web Service > Ok” Programming has never been so easy…
Navigate to webservice and … *poof!*

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Line 1333:
Line 1334:    OperationBinding FindHttpBinding(string verb) {
Line 1335:        foreach (ServiceDescription description in serviceDescriptions) {
Line 1336:            foreach (Binding binding in description.Bindings) {
Line 1337:                HttpBinding httpBinding = (HttpBinding)binding.Extensions.Find(typeof(HttpBinding));
    
[NullReferenceException: Object reference not set to an instance of an object.]
ASP.defaultwsdlhelpgenerator_aspx.FindHttpBinding(String verb) in
c:WINDOWSMicrosoft.NETFrameworkv2.0.50727CONFIGDefaultWsdlHelpGenerator.aspx:1335

Dang wizards! Obviously badly generated code? Not so…
All the performance hints and profilers will tell you, if you don’t need to automatically wire up your events, set the AutoEventWireUp=false (no, i’m not going on a blatant tangent here) in your .config. What they don’t tell you is that the @Page directive influences the generation of Wdsl for your webservice. Obviously. :S

http://www.dotnet247.com/247reference/msgs/35/177335.aspx

http://forums.asp.net/p/385662/385662.aspx#385662

http://support.microsoft.com/default.aspx?scid=kb;en-us;324151

And in the immortal words of John Lennon: “I’m not the only one” (who got duped).

MS, you’re gonna have to do better than that if you want to catch us out πŸ˜‰

MATLAB R14sp3 On Ubuntu 7.04

A couple of things to be aware of if you’re doing this installation, which i discovered through trial and error πŸ™‚

The machine id used for activation is based on the MAC address of eth0. On my machine, for example, my active interface is primarily the wireless card which is set as eth1. Hence, no machine id available for activation. How to fix?

bryan@noah:~$ cat /etc/iftab
# This file assigns persistent names to network interfaces.
# See iftab(5) for syntax.

eth1 mac 00:00:00:00:00:00 arp 1
eth0 mac 11:11:11:11:11:11 arp 1

where 00:00… and 11:11… represent your actual MAC addresses obtained by ifconfig.

My wireless card was eth1, so i simply switched this around so that my wireless is now eth0, rebooted and i now have a machine id with which to activate MATLAB.

Second issue was an error to the tune of: “version GLIBC_2.0 not defined in file libc.so.6” when trying to use the Symbolic Toolkit, particularly. See the MathWorks Technical Solution for more information on this error. The steps they outline there didn’t work for me (it is for Red Hat afterall), but what did work was copying the libmaple.so (provided by MathWorks) into your matlab/glnx/bin directory. See discussion here (in German).

Success. Incidentally, i’m using MATLAB because my university wants me to use it, but otherwise if you need something equivalent in the OSS sphere, try Octave. πŸ˜‰