Monday, January 31, 2005

A Use for #If... Then

I've read about #If... Then time and time again. BUt, like so many things, I haven't really hada n excuse to use it.

I know it's only a very small constructional fish in a huge software pond. More of an ocean really. But still, I never had an excuse to use it.

Until yesterday. With the cunning use of '#If DEBUG Then' I've managed to make debugging layout things in my little dial control a doddle by adding various lines and stuff when it's compiled in Debug mode, but leaving them out in the Release version.

Well, I was impressed. It even helped me sort out a wierd layout thing that I had going on. Now I just have to cure the weird rounding error that's happening instead...

Just wanted to share.

Friday, January 28, 2005

Gotcha, you little blighter!

I finally managed to find a solution to finding a point on an ellipse.

As is always the way, the answer was surprisingly simple. These 10-ish lines of code are the culmination of many frustrated cigarettes out on the front porch, constant annoyance for a few days, and a niggling feeling that yes, I am really a failure. I even have a small pile of paper covered with calculations trying to fathom how to do it. Don't you really hate it when it takes so much to produce what looks(at least to Mrs Mawoo) like so little.

So here it is. The code to find a point on the circumference of an ellipse based on the value you want to display.
Private Function GetHandEndPoint(Angle As Integer, BoundingRectangle As Rectangle) As PointF

Dim Radians As Double
Radians = Degrees * (System.Math.PI / 180)

With GetHandEndPoint
.X = CType((BoundingRectangle.Width / 2) + ((BoundingRectangle.Width / 2) * System.Math.Cos(Radians)), _
Integer)
.Y = CType(BoundingRectangle.Height / 2 + (BoundingRectangle.Height / 2) * System.Math.Sin(Radians), _
Integer)
End With
End Function
I can't believe I spent so long trying to work this out!

Note: Special credit goes to Paul for leaving the comment that spurred me to get this sorted. He managed to ask if I had in exactly the same tone that my mother used to use to ask me if I'd finished my homework. Thanks.

Edit: I know the angle isn't maintained when the ellipse is stretched out. This is intentional. Using this method of calculating the point gives (I reckon) a better display that going solely on angle. One of these days I'll post images to prove it!

Thursday, January 27, 2005

Slightly mind-expanding

It's been suggested that I try to expand my resume a little, and have a bit of a stab at classic ASP for a little bit.

So I'm going to be reprising my Dad's wedding photos website. It's nice and simple, just uses a bit of data access to bung some HTML together to show the pics. This one was knocked up about 18 months ago in about 2 hours.

No doubt I'll be posting my experiences when I've had some. I've heard old-school ASP's a bit simpler, or at least has slightly smaller scope design-wise than .NET. Which isn't a bad thing, it's just something I've never really had an excuse to use before.

Wanted to share. And wanted to remind myself when I get home.
Note to self: Do that damned site. It's only 1 page, you lazy toerag. And tonight's the best time for it, what with Mrs Mawoo being out for a little while and all that!

Slave for a Day

The .NET Celeb Auction for Aceh Aid at IDEF needs, no doubt, no introduction.

But what would you do if you had at your disposal the time and attention of one of .NET's bigger (or at least better known) guns? Barry Givern has a fair idea.

Found via Julie Lerman

Well it made me chuckle, anyway.

Tuesday, January 25, 2005

Don't believe the hype.

Rightly or wrongly, I amd a grumpy old man. Particularly when it comes to 'new' things. If a movie comes out, and it's praised to the hilt in the press, I'll bethe one guy ho says 'nah. I'm gonna wait for the hype to die down.' It's not for any feeling of superiority. I'm sure that if a milion and one poeple say a movie's good, then chances are it will be. I just stay away from new hypie things.

So naturally, and in a completely subconcious way, without me even realizing it, I've been ignoring this research about yesterday being the most depressing day of the year.

No. I'm a cantankerous old bugger, and I'm not going to be depressed just because the BBC say I'm most likely going to be.

No.

I'm going to be depressed today, it would seem. I woke up this morning with a huge hangover, which wouldn't be so bad if I'd got wildly drunk last night; but i didn't.

I'm bored senseless.

I really do feel like I'm going to crack and start shooting in a minute.

Or I might not. I'm also feeling a more than a little apathetic today as well.

Grr.

I'm sure it'll all be better tommorrow, though.

Just wanted to share. Apologies, as usual, for irrelevance. There will be someting worth reading up here one of these days. Promise.

Sunday, January 23, 2005

Woo, Yay and WTF?

So I had my first real google weirdo today.

It was: buggering penelope

Now I'm not going to nick Rory's idea and add any commentary, but I just wanted to share it. I thought it was kinda funny. Particularly since my blog doesn't even appear on, like, page 30 or anything, but it's right there on page 1. PAGE 1!!! Weird.
Edit: I'm even top of the list when you search for 'Geoff Maciolek Hair'

Saturday, January 22, 2005

Dot Net Rocks, Mondays, BitTorrent 'n' stuff...

I've been vaguely aware of BitTorrent as a filesharing type system for a while now. There are a few reasons I haven't been using it, though:

  1. I didn't really know anything about how it works
  2. What I know of filesharing utilities I don't really like, As far as I can tell, they're veritable feasts of security holes and spyware. At least the slightly dubious ones are, and I didn't really know of any un-dubious ones
  3. I'd never seen it applied in a productive way. At the risk of sounding like an old man, the only applications I'd heard of for it revolved around movies and porn. And both.
  4. I never really saw a need for it when we've got FTP and other protocols out there which are perfectly capable of pulling files at my maximum connection speed

However, I've just been listening to DotNetRocks where the team there seem to rate it quite highly.

They rate it so highly, in fact, that Carl and Geoff have a demo video on how to install and use their BitTorrent client of choice, Azureus. Having seen it in action, I actually think it looks like quite a cool thing.

Essentially the way BitTorrent works is this: When you go to download a file, as well as looking for it on the original server, it also finds other machines online that are downloading that file as well. What it then does is pulls down bits of the file from each of these different machines. With the load being shared by all these connections, it shares the bandwidth over the lot.

At the same time, however, it also uploads bits of the file that it's already collected to other computers that request it. So you get this whole 'swarm' download thing going on. The end result is faster downloads. The other benefit of doing this is that (in direct contrast to the normal thing of all clients downloading from one server) the more clients you have downloading a file at once, the faster it'll be, since it'll have more places to download parts of the file from simultaneously.

Where this becomes most relevant is in automatic content stuff like, for example, podcasting (I'm not a big podcaster. I'm not even a small one. My computer & music habits aren't really suited to it.). I only mention podcasting because it's the only context I've seen it used to demonstrate this. But if you happen to have 12 million people who all schedule their podcasting clients to retrieve new content on the hour, each and every one of them will have 11,999,999 peers to pull bits of the file from. Rather than slowing everything right down as the server is flooded, everything gets faster as more people are there to share the download.

Cool huh?

I'm not rushing out and installing Azureus just yet, though. I want to have a bit of a deeper look into security 'n' stuff around it. And it's just gone 3 am, so I haven't got time to go into it now.

I'll get round to it this weekend, though. Mrs Mawoo's out tomorrow, so I'll be able to get it sorted. I could do with having it up and running to download Mondays. Carl's having some bandwidth issues right now, so downloads are coming in reeeaaallllyyyy slow. It'll be interesting to see a comparison, though (assuming there are some other people online to share the load etc...)

Just wanted to share. Time for bed.

Thursday, January 20, 2005

Damn my maths is poor!

I used to be pretty hot at maths at school. Took my GCSE a year early, got an A, did A-Level Stats, that sort of thing. I wasn't completely non-numeric. Which was handy, because I'm about as charismatic as a smokestack with the lingual ability of a dead badger.

So back to the point. I'm trying to work out how to calculate the co-ordinates of a point on the circumference of an ellipse. See, I'm trying to neaten up my little dial control. At the moment the hand is drawn by drawing a pie (Graphics.DrawPie) with a sweep angle of 0.001 degrees. Which strikes me as being a bit of a fudge. It also makes it a bit limiting in terms of what I can do with the hands by way of styling etc.

What I'm trying to do instead is calculate the co-ordinates of the outer end of the hand, given the angle that the hand should be at. Doing that for a round control is OK - I can just about remember how to do that from school. And I looked it up somewhere. I'm trying to work out how to get the same thing to work for an ellipse. So if I resize the control so it's not square any more, the hands still look right.

Think I need to get my trusty bit of paper and a pen out. Rest assured, when I work it out I'll be blogging about it.

Just wanted to share.

Wednesday, January 19, 2005

I did have a huge long post written for this,

It was great. Included code, things I'd learnt, the works.

It was really rubbish, though.

Suffice to say, I've been writing a custom control. Just one more thing to tick off on my list of 'Stuff I've Done'. It's very nice. It's a dial sort of display type control.

At the moment it looks like this:


I'm actually quite impressed with it myself (never having done one before). Tripped up a coupla times, most notably before I found the Control.SetStyle method, but hey, it's done now, and I'm a little wiser for it.

There are a couple of things I need to do, a couple of bits that could do with a re-write, but that's all part of the fun (or so I've been told).

Anyway, I was quite chuffed with it.

You're lucky I didn't post the long one!

Tuesday, January 18, 2005

Why not 'My'?

Going through the Environment.SpecialFolder enumeration (as in 'System.Environment.GetSpecialFolder(Folder as Environment.SpecialFolder)'), I've noticed this:





EnumerationFolder Name
MyComputerMy Computer
MyMusicMy Music
MyPicturesMy Pictures
?My Documents

Can you guess the missing value?

Yes. That's right. Score 1 for order and consistency, 0 for randomness and chaos.

The misssing value is Personal.

Personally, I'm torn. Do I prefer the consistency of 'MyDocuments'? Or do I prefer 'Personal' and its cheeky rebellion against the word 'My'? I mean, 'PersonalPictures' just sounds rude, doesn't it?

Tricky. Just wanted to share.

Thursday, January 13, 2005

Yarrr!!!!

After my fine bit of piratical goodness back in October, I'm going to let you, yes you the reader decide what kind of a pirate I really am:

What kind of pirate am I? You decide!
You can also view a breakdown of results or put one of these on your own page!
Brought to you by Rum and Monkey



Just wanted to share. Apologies for irrelevance.

Wednesday, January 12, 2005

Contrived Solutions to Fake Problems...

It sometimes is quite hard to think of contrived projects to write.

apart from anything else, the clue's in the question. They're contrived. I'll write something not to solve a problem, or meet a need. I'll write something to get some sort of experience of the stuff I've been reading about. As a result, however, it's very very easy to lose my motivation. My inner monologue goes something like this:
Me: Here's a fiddly bit of code. Fancy writing it?
Me2: Hmmm. Dunno. What'll happen if I don't?
Me: Not a lot. it won't get written, that's all.
Me2: And the result will be?
Me: You'll feel a bit guilty for a bit, but that's about it.
Me2: Is that Mrs Mawoo calling me?
Me: Yeah. You'd better go see what she wants.
...
Me: So how about that fiddly bit of code?
Me2: Fancy a bit of Flight simulator?
Me: Oh go on then.
Me2: Cool. Let's go!

And so it goes on, until I forget what the fiddly bit of code was meant to do, and my little project dies.

I've found in the past that the only projects I finish are the ones where I have a real thing that I want to do. I want to write an online version of Lingo Bingo. Ok, I'll get that done. I want something to add ID3 tags to my MP3 collection. Ok, I'll get that one. I want to build something that gives me a chance to get to know how inheritance works. Erm... Maybe later. I want to do something in SQL Server to exercise some good database design practices to get a bit of a better understanding of what's going on inside. Uhhh. Am I sure I don't fancy a sandwich instead?

I really do find it quite difficult to keep the motivation going for contrived solutions to fake problems.

But that's just a personal thing, I'm sure.

Does anyone else get that? I mean I haven't got a problem with learning new stuff, I soak that stuff right up. at a push, I could probably even tell you how a bunch of stuff works with analogies, diagrams and everything. But how I motivate myself to get some stuff actually written?

Anyone got any suggestions?

Friday, January 07, 2005

The Real Terror

There are some things that truly terrify me.

One of them is Shaun of the Dead.

It's not scary, au contraire, it's a romantic comedy. With Zombies.

No. The truly terrifying thing about it is that every time I see Penelope Wilton (Shaun's Mum, and darling of British Theatre and Cinema), she looks more and more like my mum (Sorry, no link to a picture of my mum!).

Just wanted to share. It's been scaring me this evening...

Not starting a fight

I'm not trying to start a fight. I'm not saing one thing is better than the other. I use Firefox and IE in about equal measure at home, and I'm qite adamant that software is (for the most part) only as secure as the person using it.

That's the disclaimer out of the way.

But the only reason I'm posting this is after the madness that Peter Torr's Firefox entry created, there have been several vulnerabilities found in Mozilla.

I really don't care either way. Like I said, if I'm an insecure user, then of course my machine's going to get screwed with.

Just wanted to share.

Thursday, January 06, 2005

Oh for Bandwagon Shame!!

It's bad enough that I just did an online test because I found it on someone else's blog (several people, actually).

It's even worse that I can't even use my nerdliness to justify it!


I am nerdier than 56% of all people. Are you nerdier? Click here to find out!


I am, it would seem, only 56% nerd. How can I show my face in my neighborhod, knowing that 44% of the rest of the world are more nerd than me.

Oh well. Looks like I'll have to keep studying.

And stop washing my hair.

Just wanted to share my abject shame.

Tuesday, January 04, 2005

Swingy Swingy

Well, it looks like I'm going to be forced to get back into the swing of normal life after a whole week and a half out of it.

That means making many small but oh so crucial adjustments to my life.

  • Moving my joystick out of the way of my keyboard
  • Drinking only on non-school nights
  • Getting up at 6 in the morning. WTF? 6? Did I ever get up at 6? Guess I must have - that seems to be the ungodly hour my alarm's set for...
  • Coding again
  • Wearing a tie every damned day!

Very weird. It would seem that in just 2 weeks I've virtually forgotten how to type, my liver's been reduced to just a fistful of very angry scar tissue, and I've just fired up visual studio which has proudly announced that the last project I was working on was last edited on 23rd December 2004.

Eugh. Back to real life. I really hate that. I would happily never have another day off work if it meant never feeling like this ever again. Or possibly not. I haven't really decided on that one yet.

Oh yeah, the other facet of real life I need to get back into. Blogging. Okay, it's dull and no-one reads it. I have to reduce myself to making stupid pictures of other people to get anyone here, but hey, I only ever started writing this to
  1. Help me stop biting my nails (10 months and counting!),
  2. Vent my eternal frustration at my seemingly stagnant career, and...
  3. help me remember stuff I'd learnt about that day


So yes, you'll have plenty more inanity and frustration from me semi-regularly. Woo and Yay.

But having said that, Caustic Phil's got back to blogging, and he is one funny dude. If I thought I was frustrated, then I was very very wrong.

Just wanted to share.
PS - Skip the Cast and Crew Commentary on Goodfellas. It's not as interesting as it could be. Oh well.