Archive for July, 2013

Bling up your database coding

July 4, 2013 Leave a comment

Class helpers can really bling up your database programming. If you like your database management neatly isolated in classes rather than scattered on a form in the shape of components, then this will really make things easier:

TFirebirdHelper = class helper for TIBDatabase
  function makeQuery(out aQuery:TIBQuery):Boolean;

function TFirebirdHelper.makeQuery(out aQuery:TIBQuery):Boolean;

    //just a stub, you would log at this point
    on exception do;

    //same here, just a stub
    on exception do

  if result then

And you use it with minimal gap between creation and destruction like this, COM style:

 if IBDatabase1.makeQuery(mQuery) then
     mQuery.sql.add('your sql goes here');
       //Log and handle errors here

I use the same technique to isolate common sql stuff like “count of” and “max(field)” and so on.
With enough helpers in place, writing rock solid database wrappers is both fun and easy! And it’s easy to port as well, re-write the core unit and the rest of your app doesnt need to know “where” the data comes from. It only needs to know about TDataset and other abstractions.

Abstract, abstract and abstract

Fiber connection, oh how I have missed ye!

July 3, 2013 Leave a comment
OMG its so fast!

OMG its so fast!

Well what can I say. I havent had proper Internet access since september 2012, and today when I got home from work — roast my raisins (!) the landlord had finally gotten around to installing a new cable-tv decoder and fiber internet (40/40). I kid you not – the past months have been like living in celibacy, in the darkness, bound to a keg of beer which has no opening, or like being held captive by a woman who is remarkably reminiscent of the keg. Being a coder without proper internet access is … hell. Pure, evil and absolute terror.

Just think about it — whenever you want to send an email larger than 1k.. it may or may not actually get sent. So you always have to double-check EVERYTHING. And you can imagine working from home every odd week, downloading a huge codebase, running Skype + Teamviewer and pretty much everything else a modern programmer needs. Something as simple as holding a plain audio meeting over google is like shaving with a cheese grinder, because the connection would break all the time (and with connection I mean: telephone cable speed, yes, the landlord advertised with “free internet” and it was a bloody phone cable!). One day my skateboard will meet his face, and it will be mary.

Born again network junkie

It feels almost magical to start Skype, G+ and downloading a database – at the same time (!) It’s like working on a Commodore 64 and suddenly you are given an Amiga. Or owning an MSX and getting an Atari. It’s like living in pitch darkness and suddenly you find 2 supermodels in your bed.. (tried that, not what it’s cracked up to be, but fun enough)…  but you get my point!

Cant believe it still works

Cant believe it still works

Og shut up and enjoy the playlist

Oh shut up and enjoy the playlist

So I guess i have to admit it: yes, I am a network junkie. I have a gazillion different devices in my apartment, from mac’s to Playstation’s to iPad’s to XBox (actually that was only booted once but it makes a nice doorstop)… And without these silly devices for my kids to play with (ahem.. sort of) the place is damn boring! I’m still waiting for the coffee machine to get bluetooth and hog downloads. You think 3d printing is avant? Oh no.. just wait until they get nano 3d printing. That’s when the fun begins. That way you buy one substance and it assembles whatever you want. Including coffee, beef, a rose, the left boob of the madonna with the big kahuna – whatever you want (!) And you think I’m kidding? Yeah they said that about VHS, DVD and cars that run on electricity as well. Damn dude get your creative coat on and bite 😉

Hopefully my coffee machine will be online and able to print/make whatever I fancy by the time I’m old. Then I’ll buy some stupid Trekkie outfit and order “earl grey, with beef” and watch the whole thing blow up.

PS: Why do you think these companies are trying to patent molecules? Pure logic, and always 10 steps ahead of the consumer. He he, never saw that one comming did you 😉 Jez.. this has been looming since samsung got their first real factory.

Delphi of the day

As for Delphi – I’ve started playing around with annotations. Still makes NO sense why they have ejected the security descriptors. Wouldnt it be nice to sign a procedure with admin requirements? And a dialog would pop up automatically whenever that method is called? You know.. like C# can do with a bit of tweaking?

Since VMT injection is already there and possible via manual code with the new RTTI, why not?

Imagine if you could do something like this and just forget about checking if you are admin or not? (pseudocode obviously):

function TActiveDirectoryLogin.ExtractAllUsers(aDomain:String;
         const aBuffer:PByte;const aLoginInfo: Array of const):Boolean;
  //Enter the caves of mordor here

DWS to the rescue

This is where DWS really shines. Why? Because it is by nature a “rule agnostic”. It can be molded and shaped into whatever you need – and it’s all Delphi. It’s raw object pascal. What is harder? Making Embarcadero change their minds – or forking the DWS codebase and adding annotation support? See my point? Object Pascal is RIGHT NOW at that point in it’s timeline when its make or break. And without stomping on someone’s religion – all things exist as pure potential in the mind first, then someone have the balls to decide. Et voila — you make it real. DWS should be funded head to toe by Embarcadero, because a scripting engine is able to adapt, move and absorb concepts faster.

Even Visual Basic has this now… Jez.. what the F** are you doing Embarcadero..

Well, enough rambling… I got a Dropbox to sync which havent been in sync for 6 months!

Oh! And 8track has 49 tracks online that you can enjoy — thnx Crystalkarma!