More piratical pics!
Just a quicky...
One of my pirate mates, Mark, has put together a few more pics and video from my party. It's here. Check it out. His video's better than mine!
Benjimawoo - One man. No tagline.
Just a quicky...
One of my pirate mates, Mark, has put together a few more pics and video from my party. It's here. Check it out. His video's better than mine!
Posted by Benjimawoo at 2:29 AM
I sent the link to my birthday pics to a few friends of mine last night, and immediately JML got back to me via IM.
JML's a top guy. A real diamond. He's the IT manager where I used to work, and one of the only people from there whoI stil see regularly. Mrs Mawoo tells me he's the only person on the planet who I can talk to on the phone, as well.
So anyway, JML gets back to me immediately and says 'Can I offer some constructive criticism? Your pictures look shit. What interpolation did you use on them?' So I said I used the default compression, and promptly went out and tried to find out how I can apply a different algorithm to the images being shrunk (Curse you JML! I was about to go and watch some CSI!).
Good job I did, though, because I learnt a really cool, and quite fundamental thing.
System.Drawing.Graphics.FromImage() Doesn't give you a new blank canvas
Rather, it takes your blank canvas (or your canvas with an image on it) and allows you to use GDI+ to play about with it. Everything you do, though, every string you draw, every change you make, is made to the original image, not to a new one. To give an example:
Dim pic as Image
pic = pic.FromFile("C:\Monkey.jpg")
Dim little As New Bitmap(CInt(pic.Width / 4), CInt(pic.Height / 4))
Dim g As Graphics = Graphics.FromImage(little)
With g
.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBicubic
.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias
End With
g.DrawImage(pic, 0, 0, little.Width, little.Height)
little.Save("C:\SmallMonkey.jpg")
Now, yesterday, I would have said 'What? What are you doing saving a blank bitmap?'. That what it looked like to me. If you read through the code, it looks like the sequence of events is this:
Posted by Benjimawoo at 5:56 AM
Well it was my birthday last week, and after having a bit of a mare trying to get my pictures shrunk to web-size, I've finally got them online here.
You might find the layout of the page a little familiar. I really am lazy when it comes to layout.
Just one quick note, the video of the final (Mrs Mawoo versus my mate Rod) was made using my SPV E200 Smartphone. It's not the greates quality, but hey, it's a phone. What did you expect? Spielberg?
Just wanted to share. Feel free to tell me I look great in a hat and eyepatch.
Posted by Benjimawoo at 7:25 PM
Don't you hate it when you do something so stoopid it makes you want to cry? That happened to me just this morning. Bugger.
Over the past couple of days I've been writing just a very quick easy app to batch resize a folderful of images. I wanted to get a bunch of pictures from a party (it was my birthday Saturday. Woo and Yay) and resize them to put online somewhere. SImple, I know. Yes, I could have donme them by hand. Yes, I could have downloaded one of a million free utilities to do the same thing, but hey, where's the fun in that?
Originally the plan was to do it this way:
Posted by Benjimawoo at 7:52 AM
I've been playing a bit with non-rectangular Windows forms (using a background image and transparency key), and have discovered some strange things.
The TransparencyKey property doesn't work
Well, this is a known issue. The TransparencyKey property doesn't work on systems where you've got your screen colour depth set to more than 24 bit. Bit of an oversight in my book, but there you go.
Quick google search cured that, though. The problem can be solved by putting the following lines of code in your form.initialize method:
Dim Img As Bitmap = Me.BackgroundImage
Img.MakeTransparent(Img.GetPixel(1, 1))
Me.BackgroundImage = Img
Me.TransparencyKey = Img.GetPixel(1, 1)
That works, but seems to have a bit of a strange side-effect.
If I add a control to the form, a ListBox, say, and set its BackColor to Black, that control becomes transparent too. Like properly transparent. I mean it looks like there's a hole in the form. Any other colour's fine, it's just black makes a hole in the form.
It only seems to happen on the form with the transparency key stuff going on. On standard forms, it doesn't happen. Black controls look just as you'd expect. Black.
It's kind of disconcerting, seeing a selected item (blue bar and everything) floating seemingly in space (well, floating with a bunch of code behind it.
If anyone can figure out why this is happening, let me know. I'm really quite interested.
Anyway, that's what I learnt this evening.
PS - Feel free not to tell me the answer if you do know. I just needed to remind myself of an interesting thing I need to read up about.
Posted by Benjimawoo at 10:05 PM
Before I start, you're going to have to bear something in mind. I live in the UK. Which means that I'm at least 12 months behind the rest of the world when it comes to technology.
I had one of those proper 'Aha!' moments last night over the .NET framework 2.0. I went to an MSDN talk last night, ostensibly about Visual Studio Express. I'm not really that interested in the express versions per se, but I wanted to have a bit of a look at what the implications were for Visual Studio Standard Edition. What would the effect be of adding an extra layer of products at the bottom of the product line (bottom in terms of features and functionality, I hasten to add, not bottom in terms of the people using them!) have on the previous bottom of the ladder product.
And it looks good (providing the price for Standard stays about the same). Smart device development looks like it's supported in VS Standard, which is something I really kinda like. And it looks to be all round goodness in a box.
That wasn't what got me excited, though.
What got me excited was ASP.NET 2.0. Although I'm going to have to have a deeper look into how they really work, some of the data access features of ASP.NET look to really rock. Being able to put data sources with (and this is the important bit) parameters bound to other controls on the page right in the code on the ASPX page looks really cool. I'm sure there are security issues there, which is why I'm going to have to have to have a deeper look into how it works, but on the face of it, for quickly banging together web forms apps it looks like a really good thing.
Snaplines in Windows forms got me really fired up as well. Although I've seen quicky demos on channel 9 and the like, I never really appreciated just how funky a feature this really was. It's fantastic. Being able to snap controls so they line up with any of a dozen reference points (The top of the control, baseline of the text, middle of the control etc.) is really quite good. I might be biased because I've been knocking some forms together in Access, where that kind of thing is really quite hard. And even harder to do quickly without losing your train of thought.
The code editing formatting options are also really good. The demo showed a load of the options available in c#, like where opening curly brackets start and end (on a new line, inline etc), and stuff like that. In ASP.NET as well, the days of VS reformatting your code every time you switch from design to code view and back are gone You want to have a block of text hard-up against the margin, you can have a block of text hard-up against the margin. It's all preserved for you. Nice.
Data Access thingys in windows forms are quite cool as well. In the quicky demo the guy showed us, he did essentially what the Data Forms Wizard does in VS 2003, but all with just pure drag and drop. Just pull a datagrid onto a form (if I remember rightly) set its data source and run the app. It automagically generates the code to populate the grid, and even gives you a navigation menustrip to boot. The whole thing took under a minute. Sweet.
And the best thing, the thing that'll have me running out to the shop to buy VS the day it comes out, the thing that'll stick in my mind, the thing that when people ask me 'So what's so cool about VS Express?' I'll tell them about... They gave us beer and Pizza! God I'm a cheap whore.
Just wanted to share.
P.S. Sadly not many links to documentation. There's not a great deal online yet.
Posted by Benjimawoo at 8:40 AM
Apparently I'm a .DLL.
The next couple of weeks or so mihgt be a bit light on .NET stuff. And generally light overall. I might be working on an Access project for a little while.
Yeah yeah, I know. It's Access. Which is bad on more levels than I care to imagine, but such is life.
Just wanted to share.
Posted by Benjimawoo at 8:02 AM
Okay, this isn't a technical search that brought someone to my blog, but I thought it's be quite an interesting thing to write about since it's something I have (I think) a fair degree of experience in. And often colleagues at work ask me about it.
Mostly, they ask 'Why?'
Learning VB.net (via Yahoo)
Well, it's nice and vague, and I guess it is the title of my blog, so why not write a bit about my experiences learning VB.
Know that you know nothing
This I learnt after about 2 minutes playing with Viual Studio. I came from programming VBA and (gasp!) Access, thinking, 'Hey, know how this stuff works. I can write code that talks across applications, I know what a Select Case does.' I learnt very very soon that I didn't know diddly. I could talk for hours about the differences between VBA and .NET, but I'm not going to. You could try looking here for some inspiration. The 2 things that struck me first were
Posted by Benjimawoo at 3:26 PM
"This fella has a nice web log with some good information and seems to be right up our alley"Some people say the sweetest things. Right back atcha dude!
Posted by Benjimawoo at 4:48 PM
Krzysztof Cwalina has written this very good blog entry about the questions and issues you should be addressing when you're choosing whether to implement factory methods or constructors. I know in some situations, you don't have a choice, certainly when you get into the remoting and COM+ arena, you have to use factory methods since there can be issues with overloaded constructors, but otherwise how do you decide?
Found via Mike Gunderloy.
Just wanted to share.
Posted by Benjimawoo at 8:12 AM
Every now and again I go through my referral logs to see if there's anything interesting bringing people to my site, and if so, I've started writing a little bit about them.
I've previously written about the arraylist.Copy method after someone landed on my site looking for it in Yahoo.
This week someone landed here looking for "sessionid tutorial example vb.net" from Yahoo.
Session.SessionID returns a String, which is the web server's internal identifier of the current session for that particular user. It is this number that gets passed around in cookies and whatnot that allows ASP.NET applications to manage session state.
Although 99% of the time, normal people will never get to see their sessionID getting passed about (it's all done in the background) there are a couple of situations where the session ID is passed in the request's URL. The most common ones are:
Mobile web forms
Although mobile web apps are getting more widely used out in the real world (I've even written one or two myself), some things, like cookie handling, haven't been adopted in any kind of standard way. Some browsers on some devices have cookie handlig, but not all. As a result, the only way to tie the requests from the browser to the session state being managed on the web server is through the URL. If you ever navigate to a mobile webapp from Internet explorer, you'll notice that the URL in the address bar changes to something like "http://localhost/MyMobileApp/(biiig long number here)/Form1.aspx". The big long number being passed abut is the session ID.
Cookieless Sessions
In the same way that mobile web apps pass the session ID in the request URL, normal web browsers do that as well if you configure your app to use cookieless sessions. Kinda makes sense, really. If your user can't receive cookies, then you need some mechanism to associate the user with the session object.
There are one or two security issues, as well as aesthetic issues when it comes to passing session ID's in the URL. As far as security goes, putting the session ID in the URL makes it easier to copy/paste that URL into their browser and hijack someone's session. Not good, particularly if you have a website with restricted/controlled access areas.
Aesthetically, as well, it looks ugly. Big long URLs are bad enough, but put a session ID in there, in brackets, and that's just getting silly. If you've built your app properly, then if someone comes back with an invalid session ID, then nothing'll happen. Your app will gracefully handle the situation, and your user can continue as normal. I only mention this because of one of the other problems with cookieless sessions - if your app doesn't handle an invalid session ID properly, then you're going to have a number of users upset with you because they can't bookmark your site.
Well, that's about all you can say about SessionID. It's a member of the System.Web.SessionState.HttpSessionState class, and is used by the server to differentiate bewteen user sessions.
That is all.
Posted by Benjimawoo at 1:57 PM
My mouse packed up a littl ewhile ago, and my emergency mouse gave up the ghost last week. As a result I've spent the past week not being able to click/drag anything. It's been an experience, I can tell you!
Anyway, I've just been down to PC world and picked myself up one of these little beauties!.
It's terribly sexy and a very beautiful thing.
Just needed to share.
Posted by Benjimawoo at 1:12 PM
Nobody really likes giving all their personal information out. Lengthy registration processes, identity rape and the like really wind people up. Especially me.
We know it's not a particularly new idea, ever since the Doomsday book, the powers that be have kept records about everyone in the land. And now there's the census to content with. Which is fine, if you're into that kind of thing. Not everybody is, though. At the last census a couple of years ago, there was a bit of a mission to get Jedi acknowledged as a religion. Turns out Brighton has the most in the UK (2%).
What I found out today was that it's not a new idea at all. They did it in 1901 as well. Either that, or someone's been cursed from birth being called William Poop.
Well I thought it was interesting, anyway.
Posted by Benjimawoo at 4:28 PM
Just when you think your blog's going down the pan, with nothing on it at all worth reading, the great lord himself links to your blog. (And before you start asking, yes. I am trying to curry favour so I'm more likely to win free stuff.
Just thought I'd mention it.
And hey. Leave comments. I don't care how irrelevant they are, or what. Leave commentary. Even if it's just to call me a jerk, I wanna know. Do it. YES, do it! Now!
PS - if this post looks a bit crazy, it's for one/many/all of these reasons:
Posted by Benjimawoo at 3:29 AM
Looks like, at the time of writing, my blog is only a mere third Evil.
It's more evil than Rory's blog (28%), but less evil than MSDN (58%). So that's OK.
That is all...
EDIT: After I added this entry to my blog, my evil rating dropped to just 23%. I'm keeping the 33% rating, though.
Edit to the Edit: Although my blog Evil rating has gone down, it turns out, in a rather cool way, that my name is 99% evil. I'm impressed.
Posted by Benjimawoo at 1:05 PM
I spend quite a lot of my time learning how to do stuff. This is why many of the little ptojects I start working on amount to nothing. In that way, I guess I'm kinda like a mathematician, the guys who go "Well, we'll solve the problem to this point, but then, of course we already know how to do it from here, so there's no point doing it again."
Sometimes it's kinda cool that way. I do at least keep myself interested and avoid doing a whole load of drudgery (and by drudgery, I mean 'stuff I already know how to do')..
Anyway. I learn how to do stuff. And this is what I've learnt how to do this week:
Using SQL Server SCHEMA_INFORMATION
The SCHEMA_INFORMATION views give you a way of writing stored procedures that can pull out some of the metadata about your database. You can pull out data about tables, columns, contraints and all sorts of other stuff about how your database is structured.
I thought it was kind of useful. Particularly for the code generation widget I'm writing at the moment.
Quick note to self:
Regarding the code that's actually generated, I'm making it generate abstract classes, rather than getting it to generate normal classes for 2 reasons:
Posted by Benjimawoo at 8:45 PM
Just found UI Patterns and Techniques (via Duncan Mackenzie)
I've been looking for a site like this for a while now. UI design is something that I've been kind of thinking abot for a little while. There's a very good site here that's got just bucketloads of UI design disasters and successes. Unfortunately, it's starting to get a bit old (It hasn't been updated or a number of years...), and although a lot of the advice on there is still very valid, there are some aspects where the technology and users have moved on and adopted (rightly or wrongly) some of the design widgets on there.
Patterns and Techniques is more up to date, featuring a lot of the design-schema (if that's a real world) adopted from the web. Although I'm not a big fan of web-style windows apps, I know many people do find them quite familiar and intuitive to use, so I guess they're here to stay.
Just wanted to share.
Posted by Benjimawoo at 6:22 PM
The muse came and bit me really hard the other day.
I think I must have been thinking of 6 things at once, when all of a sudden all these things got jumbled together and started joining up. I was thinking of something like this:
Posted by Benjimawoo at 9:45 PM
I've just been looking up some event info on MSDN, and I came across this page.
Now here's a little exercise:
Posted by Benjimawoo at 11:41 AM