What to do… what to do…?

I just couldn’t resist 😀 Had to log into Windows today and on startup was presented with this dialog:

randomdialog.png

What do you do?

Resizing NTFS Partitions

Quite simply, the very idea freaks me out. The way NTFS partitions are managed in Windows… well, let’s just say resizing appears to be less straightforward than it makes me comfortable. And yes, there are some tool$ available to do the job securely, but again, in an emerging economy, some tool$ are just not priced affordably. Hello, GParted.

Defrag your NTFS partition (mostly ‘cos it invokes a layer of warm and fuzzy doing so)
Download the GParted LiveCD, burn the ISO (while we’re on the topic of burning ISO’s from Windows, again, it really is a bit of a unaffordable freeware/shareware mission)
Boot up with the LiveCD
Resize your NTFS
Reboot back into Windows (this allows windows to do it’s own CHKDSK on the “new” partition)

That’s it. Did it work? Oh yeah, it works. No corrupt programs, data, files, nada. Even my Lenovo SecureDrive volume is still intact…

perfmap.png
… as you can see.

Fractions and Foating-Points

Floating-point arithmetic on a computer is hazardous, at best. This post is not a detail description of the problem. Varied descriptions of the problem already abound, like this one, for example. There’s also documented pain out there to understand that it’s not just your computer 🙂 No, this post is just one way of getting around the problem in a particular context.

The environment: JavaScript. The problem: convert decimals to fractions and fractions to decimals. Getting a decimal is straightforward:

function fractiontodecimal( wholenumber, numerator, denominator ) {
wholenumber = parseFloat(wholenumber);
numerator = parseFloat(numerator);
denominator = parseFloat(denominator);
return ( ( ( wholenumber * denominator ) + numerator) / denominator );
}

Obtaining a fraction was slightly more insane since in JavaScript
23.8 * 10 = 238
but
23.88 * 10 = 238.79999999999998

Not exactly what you need to work with. As you can imagine, inside a loop of sorts, and if the number becomes very small and you divide by it, you start getting bigger errors. Anyways, that’s a digression in itself. What i needed was a reliable way to multiple by a float by an integer, 10, and get a predictable response. In other words, i just needed to keep shifting the decimal point. Most immediate response might be: string manipulation. Isn’t that what JavaScript is for? :p

Another way was using e-notation. 23.88 being represented as 23.88e0. Multiply by 10: 23.88e1, and so on. The good news is you still get to do a little string manipulation, but not nearly as hectic as finding and moving a “.”

The particularly heavy looking string manipulation looking like:

newDecimal = mantissa + “e” + exponent;
That wasn’t so hard, now was it? 😀

Browse through the code for decimal.htm (HTLM page with JavaScript)

Categories
perspective

SA Bashing

i used to think that the popular pasttime of South Africa-bashing was reserved for expats living, mostly, in the UK. but the sport has caught on quite quickly within our borders. sad, but true. you’ll recognise over-indulged sentences like “the government should have” or “those people” and “you see, i told you”. And more. Everyone’s a critic it seems, and more so true than ever before.

And while we do have our share of issues to deal with, we, the ones still living in this incredibly beautiful country, still have to deal with them. Complaining without action is just complaining. It’s not a solution. Offering your unsolicited, uneducated and distanced opinion is also not a solution. Ground work is where it counts. And there are plenty of organisations, initiatives and causes to throw yourself into that can make a visible difference. That is, if you really wanted to. Especially now that you’re earning the currency so often bragged about. And if you don’t want to pitch in and make a difference, polluting our environment with negative emotions is one less problem we can do without.

There is a stark reality to what South Africa is- no one can deny it. But there is also hope.

Ok. So that’s the end of my rant in response to the never-ceasing (or so it seems) opinions of Saffers living elsewhere. I’m not negating or even want to come close to nullify reasons and experiences that may serve to wholly justify the array of negative opinion. It’s not about that. It’s about: life happens, so now what? and character, as we saw from the Super14 Final game… is what shows when the chips are down 😀

Go, Bulls!!

Categories
perspective

Shavuot, erm Pentecost

it’s that time of year where we have opportunity to celebrate just two radical gifts that God chose to give the world: the law and the Spirit. in this day, back in history, these two gifts significantly changed, and continue to shape the world we live in.

now if you’ve got a culture of Judaism, you’ll understand the meaning of Shavuot quite well.. if you’ve got more of a Christian upbringing, chances are, …well, let’s just say that it will mean different things depending on where you experienced that culture.

anyhow, so not to confuse Pentecost with Shavuot too much, there is a useful link, celebrating the giving of the torah i came across which helps explain (at least for me) some of the more biblical traditions. And yes, there are some non-scriptural traditions too. but i’m referring mostly to understanding transmitted in those pages which help shed light on origin, without the fluff of post-modern christian-oriented humanism.

the persepctive is refreshing and worth considering, even if the only thing it does is get you to open your bible and mediate upon His Word 😉

Oh, and if you think living by the Ten Commandments is old-fashioned, i bet you’d be surprised by just how many you probably agree are valuable principles for a peaceful society.

Anyhow, but let’s not forget that although “rules is rules”, without a heartfelt understanding of the Spirit of the law, the letter remains unattainable and horribly binding. But by Spirit, the application is liberating! 😀 That’s Part Deux to Pentecost, this day in history…

“And when the day of Pentecost was now come, they were all together in one place.
And suddenly there came from heaven a sound as of the rushing of a
mighty wind, and it filled all the house where they were sitting.
And there appeared unto them tongues parting asunder, like as of fire;
and it sat upon each one of them.
And they were all filled with the Holy Spirit, and began to speak with
other tongues, as the Spirit gave them utterance.”

log4net

Not gonna lie- it wasn’t altogether _that_ intuitive to begin with. Appenders, logging levels, loggers and a whole bunch of different configuration going on: it wasn’t just working. But, i thought to myself: many others are happy with it so it must be worth the initial pain. Of course, in a world of instant gratification and high-speed demands, how long exactly do you sit with a problem?

If it’s a maths problem, like something involving integrals, sometimes you can do nothing but sit with it. No amount of Google is ever gonna give you the answer. And if you think it can, i’ll happily take on the challenge 🙂 But this is code…

CodeBetter, CodeProject, Koders and even log4Net itself have plenty of sample code and tutorials designed to get you off the ground. And they all have their strong points so if you thinking about log4net, take some time upfront just to read how different people go about explaining various setups and configurations. You’re bound to find one you like. So back to this particular log4net experience…

What i wanted is to have an open console running which recorded anything i wanted while my asp.net application was executing. i love consoles ‘cos of their simplicity, power, flexibility and in-obtrusiveness. in the right place, at the right time, they definitely rock. So that’s the mission.

There’s this article which gave me a great jump start in the right direction. I made a few modifications (i am programmer) and as a result… well, this picture is worth a paragraph or two:

log4net console
More than anything, this is testimony that log4net really does work despite some of the comments and posts (and initial pain) and once you’ve got it down, you can add massive geek-value to your project. You also just might have fun, but keep that to yourself 😉

Go on… have a little fun

Worse Than Failure are hosting a little contest, which perchance happened to stumble upon. it is just for fun [eegads! don’t let anyone know you’re actually having fun programming] so my entry is up… who knows, maybe it’s a good enough attempt at winning that high quality JPEG! 😀

Minimum Computing Power

There is a lot of hype about computing power, technology and what we _really_ need to everyday compute. We find a similar push with cellphone technology too… but what exactly do you really need?

I’ve just finished setting up Feisty… i am impressed. It really does just work. Out of curiousity, i ran a quick check to see what kind of computing power something funky like Feisty would need… and then compared to the current new generation in the Windows world…

Ubuntu Minimum Requirements
(the recommended minimum)
500 MHz x86 processor
192 MB of system memory (RAM)
8 GB of disk space
Graphics card capable of 1024×768 resolution
Sound card
A network or Internet connection
Note: All 64-bit (x86-64) PCs should be able to run Ubuntu. Use the 64-bit installation CD for a 64-bit-optimised installation.

Vista Minimum Requirements
1 GHz 32-bit (x86) or 64-bit (x64) processor
512 MB of system memory
20 GB hard drive with at least 15 GB of available space
Support for DirectX 9 graphics and 32 MB of graphics memory
DVD-ROM drive
Audio Output
Internet access (fees may apply)

Uhuh.. not pretty.

Importing Data into SQL Server 2005

i must say i was quite surprised, in a negative kind of way, by the SQL Server 2005 Express Edition feature set. I took the leap and migrated databases from MSDE2000Sp4. All is well in the Express Management Studio and it ticks over for about 90% of the tasks i need to perform… but then there’s importing data.

Ya think i could locate _anything_ to import a flat file [.CSV] into a table? And bcp doesn’t count.

Eish. The MS forums are a tirade with respect to this issue, so i’m not going to add my rant 🙂 What there is though, is a pretty nifty solution i found on the jackol’s den

SELECT *
INTO theImportTable
FROM
OPENROWSET(‘MSDASQL’,
‘Driver={Microsoft Text Driver (*.txt; *.csv)};
DEFAULTDIR=C:\dev\documents;Extensions=CSV;’,
‘SELECT * FROM data.csv’)

And walah! 😀 Oh, and if you get an error like:

Ad hoc access to OLE DB provider ‘MSDASQL’ has been denied. You must access this provider through a linked server.

You can make changes according to MS Support.

Categories
perspective

Religious Fervour

it is ironic that the only people Jesus ever fought with were the super-religious types. here were a bunch of people who really followed the details of the letter but completely missed the boat. i guess they favoured the process over the people. and Jesus rectified that, but He also never said to throw out the process, did He?

We live with these Christian traditions that are in danger of institutionalizing themselves [if not already] to the degree that the people are no longer the point. It’s about the order of service. It’s about maintaining and defending the traditions of church, with scant regard to how people respond to them. And yes, there are examples of this not happening: this is not about those examples.

There’s this checklist which defines who is and who isn’t a christian, as if it’s actually quite important to be one in the eyes of the world. And we’re challenged by the world, and ourselves, to maintain and represent christians around the world, in truth. and as noble and true as that might ring, that is completely not the point. yet it is 🙂

first priority is your own salvation in the eyes of God; not man, not church, not even your own pastor. not even a prophet can declare your state of salvation. God alone has that right, and what a good thing that is. and you will know because He will declare it to you. also, believing you are a child of God is quite different from knowing you are one. kinda like marriage. before you enter into a covenant relationship with someone, you have all sorts of fancy ideas and presumptuous notions about what it is. you might even believe you’re married [co-habiting] but then you actually get married. it’s no surprise a relationship with God is any different. afterall, marriage is His institution. so unless you’re enjoined to God in a covenant, talking like you are is not going to help anyone, the very least of whom is yourself.

so church traditions and the order of service are setup to establish a form of godliness, but deny the power of God. they might never have been intended that way, but they become that way. give it enough time, enough apathy and pretty soon all you got is a framework that exists to define what is christian and what is not.

does that mean you throw out the framework? no. it’s all about attitude and no amount of re-engineering of the process is going to realign your life with God. you’re just going to establish yet another framework or framework version 2. so instead of trying to make up your own, use the one that God provided, from the beginning. afterall, we do need a framework of sorts with which to worship God otherwise it’s too loose for us to grasp, or be intentional about. fortunately, God did provide us with a framework, a process which we can use to facilitate our worship of Him. it starts with a sabbath…

uhoh. sounds like legalism 🙂 well, if God’s instructions are too legalistic, then so be it. but then perhpas we should not be so ready to defend our own traditions against God’s wisdom and commands. then we have a bigger problem than just the letter. it is ironic though, in all this, how religious we can get about being “not religious”. of course, the advantage of religiously supporting a “no religious attitudes” policy is that it’s open to everyone…