Saturday, December 18, 2004

I've been thinking of a plan

I recently started a beginners guide to GDI+ which seems to have put my site hits up by about 10%.

Are simple guides more popular?

Just thinking out loud here, which is what a blog is I suppose.

VAT collection by non EU sites

A question that has nagged at my brain in the last few months is "How do non EU companies collect VAT"
You see, VAT or Value Added Tax is europes form of sales tax. It is levied at a swingeing rate of up to 20% on some items so it can be a significant portion of the cost.

European union companies that collect VAT are obliged by law to put their VAT registration numbers on all invoices that charge VAT. Recently however I've noticed that many on-line shopping systems charge VAT to EU customers but don't put their VAT numbers onto the sites or on the invoices making me wonder if this is just a handy way for a US company to extort 20% of sales from europeans.

I have been charged VAT by Symantec and I don't know their VAT number for my company accounts.

Moreover, the rate of VAT isn't in line with the VAT rates in the countries to which they sell. This leads me to believe its bogus too because if there's one thing a tax man is keen on it's getting the percentages right. You see, the VAT rate for Symantec products is 20% no matter what EU country the purchase is made in. Does this VAT collected go into the general pool of VAT for Europe. I suspect not.

If I pay VAT I want to know it's going to the place it's supposed to go or I want a refund if the application of sales tax is just there to enrich the company because they think no-one has noticed.

Tuesday, October 05, 2004

Programming styles I use and why....

When the code you write is for the benefit of others, a clear and readable coding style is as important as a good prose style. This is my personal style guide which I use in all my programming.

#1 Naming conventions.

Concise naming is important if code is consumed by someone else. Cryptic names for variables, methods and properties are for obfuscators, not programmers.

Private Fields begin with an underbar and a lower case letter such as _data. Long names are CamelCased such as _myLongData.

Accessor properties remove the underbar and capitalize the first letter such as Data or MyLongData.

Variables in a method begin with a lower-case letter and are camel-cased if long such as "variable" or "myLongVariable". Parameters passed to a method follow similar convention.

Class names begin with capital letters and are camel-cased where necessary.

Class, method, property and field names are indicative of function wherever possible.

#2 Code layout

Code should be well laid out and as concise as possible.

Whitespace doesn't impact code size but can make a lot of difference to readability. Blank lines can be as informative as lines full of code.

Namespace items, classes, methods, properties and field groups are separated by white space to give separation between elements so that the eye automatically distinguishes between one section and another.

Braces are on their own lines and indentation is used to indicate nesting or scope. The exception to this rule is in the case of simple accessor properties where the get and set accessors may be defined on a single line. Acessors that are more complex than assigning the value to the associated private field follow the method brace and indentation rules.

#3 Comments

Be liberal and verbose with comments and documentation. Basic Inline XML documentation is a great help when studying a class library but little or no use when trying to get into the head of the programmer, even if that programmer may have been you two years ago. Remember the remarks and examples as well as internal comments

See the code example here.

Thursday, August 19, 2004

Fun with DHTML

I just published a new article on the Tips and Tricks page but this one has a difference. You may have noticed a few of my pages have optional C# and VB code sections that can be chosen on-the-fly as you read. These are simple DHTML scripts that turn different sections of the page on or off according to choice. The problem was with the method, which I got from another web-site I hasten to add, was that if more than one section of code needs swapping out then the javascript becomes ever more complex with each new bit. What I needed was a way of turning on all the C# or all the VB in one go.

This is the first time I've messed about with DHTML in any serious way and so I'm rather pleased with the end result. What I did was give all the C# or VB statements a unique ID based on the pattern "CSA" "CSB" or "VBA" "VBB" and so-on. Then I created code that went through all the specially named elements one by one turning them on or off as needed. Finally I put a couple of sexy mouseover buttons on the page to finish the thing up and voila...


If you'd like to see the code in it's production form go read the article. If you'd like to see the bare-bones dynamic page you can see it here.

I'm sure I'll get a bunch of responses from clever DHTML jockeys telling me it's all wrong but I'm as pleased as a dog with two tails...

Well Formed

I have temporarily suspended all Well Formed subscriptions while work goes ahead on the new site. I am currently fielding tens of requests per day that go something like this.

Subscriber: "Bob, I haven't seen the latest issue of Well Formed. Whats up??"

Bob: "Hi, your e-mail system bounced the subscription, heres a duplicate"

Subscriber: "Bob, are you there??"

Bob: "Hi, yes, your e-mail bounced that one too because it had an attachment, why not try using yahoo mail or something"

Subscriber: "Bob, I have written to you twice with no reply. Why are you ignoring me??"

Bob: "Dude, I'm not ignoring you, your SPAM filter has decided I am bad news and you can't see my replies"

Subscriber: "Bob, you are an ignorant useless git and I'm cancelling my subscription forthwith. I've never seen such unprofessional crap in all my years as a blah blah blah"

You can see that when this happens about 10 times a day it make me happy, contented and glad to be of service _NOT_.

Wednesday, August 18, 2004

Big changes going on.

If you've visited my site recently you'll have noticed some major changes going on. BobPowell.net is going back to its roots inasmuch as it will no longer provide consulting or tools offerings but will be a place for publishing information such a the FAQ and Tips and Tricks. It's becoming increasingly difficult to separate my need to educate from my need for an income and I don't want my personal site to degenerate into a mish-mash of confusing stuff that people go to for help but that screams "money-money-money!!!" at every turn.

For the commercial side I have a couple of projects in work. WellFormed.net is a site that will shortly be running the Well Formed Magazine and XRayTools.net will be providing tools to developers in a clear-cut and commercial manner. Both of these sites will sponsor BobPowell.net. This will allow me to get on with the business of creating articles and code of the higest quality possible for the FAQ and Tips and Tricks along with whatever else comes along.

Google Adsense is my only concession to online commercialism on that site and I came to a bit of a revalation the other day when I was explaining to my son Robyn, who wants to be a webmaster bye-the-way, that effectively, AdSense makes the hosting cost of the site free! This means that a site such as bobpowell.net can be self sustaining and self justifying without even worrying about the commercial aspect of trying to make a hard-sell every time someone visits the site.

Things will be a little bit up-in-the-air for a while but when they settle down again I hope that the new look and feel coupled with the philosophy of free information will be well received.

Friday, July 09, 2004

The best upgrade so-far.

I recently purchased a 19in. LCD flat-screen to replace my cheap little 15in. job. The big screen is excellent for editing code because the resolution is that much higher and I was all-ready to give the smaller monitor to one of my children when I realized I had an old matrox PCI video card hanging around somewhere. I found it, plugged in and attached the 15in. LCD monitor to it.

What an incredible difference! I am convinced that the combination of both monitors is probably ten times more useful than just replacing one monitor with a larger one. Of course, having the 19in. screen is great for editing code but to be able to drag stuff from one monitor to another is a real boon. Now, when I read newsgroups and click on a link Internet explorer pops up on the second monitor and doesn't obscure the newsgroup. I can run a virtual machine in full-screen mode on the second monitor to test longhorn or whidbey. The readable area of both screens multiplies the usefulness of the display rather than simply adding to it.

Of course, the secondary display will not handle some graphics tasks because the matrox card is a bit long in the tooth but for text and simple graphics it's adequate. I cannot play a DVD movie on the secondary screen for example but I can play one on the main screen and still browse the Internet on the other.

As the title of this post suggests, this is probably the best upgrade I've ever given my computer and would highly recommend it to anyone that spends a long time switching between windows as I do.

Monday, June 28, 2004

Long time no blog...

My day job is keeping me incredibly busy. I just got Longhorn 4074 and it's SDK up and running on Virtual PC so maybe I'll report on some avalon stuff later.

Anyway, I'm not dead...

New GDI+ article

If you're not already subscribed to the GDI+ FAQ RSS feed, now would be a good time to do so.

A new article on creating text-halo effects has just been published.

Saturday, May 29, 2004

Should I continue...

to post notifications of GDI+ FAQ and Windows Forms tips and tricks here or is it sufficient to assume that people who are interested will subscribe to the feeds for those services?

(if you're interested I updated the double buffer article with VB code today)

Peace of mind.. at a price

I just bought the MailWasher spam remover. It works really well but has a slight disadvantage inasmuch as my mailing system that answers all my PayPal purchase notifications now doesn't run automatically.

Mailwasher examines your POP or IMAP mailbox and marks suspect mail for deletion but if the automatic send and receive runs from outlook or whatever client you use, the mail is still downloaded, spam and all. You have to explicitly process mail in MailWasher to get rid of the junk and then run the send-receive manually.

I must say though, I am impressed with it's catch-rate.


Friday, May 28, 2004

Ppl i h8. u?

I h8 ppl who wrt 2 me like ths.

any 1 who wrts 2 me in ths style will b ignored!

It's 2 much trub 2 decipher & it bugs me.

At least people should have the decency to write as though they care!
If it's too much bother to put all the characters in a word I'll start doing that with code I supply and let them figure it out for themselves!!

Strategies

My site bobpowell.net will be changing radically soon. The content will remain similar but I'm going to a more web-based system for Well Formed and other new content.

I just wrote an RSS feed in ASP+ that builds a feed on demand and reads the database of articles to keep content fresh.

Well Formed will be moving to an online format so subscribers can access it and code without having to store it locally and to prevent me from having to e-mail to all the users each month. I get a lot of subscriber mail bounces these days and there are so many people that I can't spend time chasing their cases any more.

All the xray tools will leave that site and be moved to a new commercial site. I have a bunch of other tools but havent finished productization yet so it's another thing i need to do. When the commercial site is up and running It'll inspire me.

I want bobpowell.net to become a repository for knowledge and divorce it from the rest of my business.

As a result of all this, the site might be in a state of flux for a while. I just noticed that a feature I'm preparing has escaped into the wild before it was ready.

Ah well, back to the old grindstone.

Blogs

Rob Scoble is in new-scientist, Scott Wingo is on BBC radio. What is it with bloggers?

Some may say that it's just a way of self publicizing but is there more to blogging than talking about blogging?

Scoble seems to spend a lot of time writing about the process of blogging. He's an RSS nut-case who would have the whole world subscribe to his full-content blog. I say that's ok but only if you can afford to provide the bandwidth necessary for the world to hit your RSS feed once an hour. For people in the real world, it's probably overkill. If everyone demanded full content RSS feeds the internet would grind to a halt. We can afford to do it if we subscribe to very few full-content feeds but it should never be the norm.

Scott Wingo was probably one of the first true bloggers when taken in the current context. His MFC FAQ was a regular release that he worked for long hours on getting right. He used this communications vehicle as a marketing tool that sold Stingray software components to the developer community. Scott's writing skills are excellent and he pens a coherent and readable paragraph (although you'd never think so looking at his recent work in the eBay strategies blog [Sorry Scott]) He was the absolute master of guerilla marketing and someone who I respect enormously. I'd like to see Scott doing more of the real stuff.

Perhaps the process of putting your ideas down for everyone to see clarifies it in your own mind. After all. What use is an idea if it cannot be communicated? Perhaps bloggers are the sort of people who write things in their diaries and then leave the book open in the hope that someone will read it. Maybe they just need to be seen.

Do you blog? Why?

Friday, May 21, 2004

New GDI+ FAQ article

The GDI+ FAQ now contains an article that explains how to create multi-frame TIFF files and includes code in C# and VB that demonstrates the process with a neat drag and drop file creator.

RSS feed changed

This might not reach all of the intended audience :-/

Roy Osherove's SiteFeeder server seems to be offline. The site feed that was on here is gone and updates aren't getting out.

All is not lost however because Blogger now provides syndication via it's own system.

Check out the XML feed from the button in the left-hand column.

Sorry for any inconveinience. The matter was out of my control.

Saturday, May 08, 2004

Support, or lack of it.

My euphoria at getting the site moved to the new servers was short lived because I soon discovered that it was impossible to edit the information that I had transferred there. Frontpage refused to connect either to allow me to open the site for editing or to publish changes I had made using my development system. Of course, the first thing that I did was to read the frequently asked questions lists and knowledge base articles on the providers site but soon have to resort to contacting their support department. As usual, I got the standard support letters with links to all of their helpful frequently asked questions even though I had mentioned in my mile to the support department that I had actually read all of their frequently asked questions and could I please have some real support now.

When dealing with these people I get the vision in my head of spotty faced youths who act as salesman in companies like Dixons (the British equivalent of Best Buy ) who know absolutely nothing about the product they are selling and who quote from a standard set of texts and are incapable of making an independent intelligent judgment on their own.

After having my "support" case passed backwards and forwards between five different personnel, each of them having sent me the same knowledge base articles, I discovered, through my own hard work and investigation, that the problem is indeed at their end and is because the site does not support the authentication scheme required by frontpage to connect through a proxy server.

Hopefully, I can persuade them to adjust this because it seems to me that using a proxy server is not an uncommon thing these days and not to support such a thing is ridiculous. I certainly hope that my continued relationship with Brinksters "support" team does not continue in this way otherwise this won't be the only move I make to a new server.

Spoke too soon.

The site is up but the email isn't.

BobPowell.net back up.

Wow, quick and efficient changeover to Brinkster. The site was only down for 12 hours or so. Business as usual resumes!

Friday, May 07, 2004

BobPowell.net is offline...

I just cancelled the old hosting account. Mail and web will be offline 'till the new stuff propogates.

I feel kinda sad. Don't know why.

Wednesday, May 05, 2004

Moving day is set for May 7

The up and coming move of the BobPowell.net servers is set for May 7-9. The domain itself has been moved from Yahoo and the server already set up on Brinkster. Bandwidth is going up to 300Gigs per month and I'll be able to run ASPX applications so the possibilities will be greatly increased.

Thursday, April 29, 2004

Polarization

Just checking my subscriber base today I notice that interestingly a massive 68% of my readers are C# programmers. I really expected to get more VB readers simply because of the supposed disparity in numbers between the VB and C/C++/C# programmers.

Is this because there are now more C# programmers than VB.NET programmers? a situation I somewhat doubt.

Perhaps VB programmers are more concerned with DB apps than application and graphics fundamentals or perhaps I don't target that community so efficiently.

Moving time

I've finally decided to bite the bullet and move my site to a new server. The bandwidth requirements of the site seem to be causing yahoo to put the brakes on it from time to time and moving will enable me to do sensible things like provide ASP pages that are a bit more interactive than the plain old html I have up at the moment.

This move will take place somewhen in May. The last time I moved a site from yahoo to another host it took over a week to happen. I'm hoping I can streamline this a bit better this time around but you never know.

This blog will still be up though and anyone wishing to contact me while my e-mail is offline can do so on bobpowell1@yahoo.com

Monday, April 26, 2004

Odd week. [non tech related]

What a blinkin week it's been. On Monday I fell down stairs and caught my hand on the bannister rail on the way down. I all-but tore the little fnger of my left hand right off. I had to go get it stiched back on again. I suppose I can be thankful that I'm not much of a touch typist and I can adapt back to the old four-finger hunt and peck method. After that, on Wednesday my son Jeremy, who is 14, poked himself in the knuckle with a screwdriver and then went and messed about in the river that runs through our garden. A couple of days later his hand swelled up like a ballon and he was admitted to hospital with a bad dose of blood poisoning. He had to have an operation to clean the hand and save the finger. To cap it all this morning I was head-butted in the face by my daughter's horse, a young stallion who is probably destined for the old snip-snip any time now. Maybe I should just go out and buy a couple of bricks!

Thursday, April 22, 2004

Sunday, April 18, 2004

Freeware, at what cost?

I just had an interesting experience at http://www.toniarts.com, A site that provides a "free" system cleaning utility which came highly recommended on a newsgroup that I frequent. Easyclean, the software in question, is listed on that site has being freeware but before you can download it, supposedly for free, you have to pay a 19.95 membership fee.

Now don't get me wrong, I have no objection to somebody making money through their web site. Indeed, I make my living through my web site, but this particular tactic seems to me to be just a little bit silly. I buy a lot of software online and when a piece of useful software has a fair price tag I'm more than happy to pay if I believe it's going to be worth the money. Sometimes, I pay just because I think the person or product needs the support.

I certainly won't be buying this particular piece of "freeware"

Updated Article

I've just updated the RGB-HSL article to include VB listings of the utility code and the demonstration applications.

Saturday, April 17, 2004

Bogus e-mail

If you don't already know, no-one will ever receive mail from "my staff" or the webmaster at bobpowell.net or anyone else but me personally.

I have seen a bunch of mails proporting to be from the e-mail gateway team at bobpowell.net which have a virus attachment. This is a spoof.

Be very suspicious of all attachments, yes, even Well Formed if you like and use an up-to-date virus scanner at all times.

Mail from me is scanned when sent.

Thursday, April 08, 2004

Whidbey Poll

I was using Whidbey recently and found that Microsoft have changed the way overrides are generated from the IDE. If you override a method the new wizard generates code that doesn't automatically call the base class but throws a NotImplementedExeption instead. I was just wondering what the general opinion of this was?

New Tip: How to find and use the ToolboxBitmap icon in your DLL

One of the more confusing subjects in control design is how to correctly locate and use the icon which is displayed in the toolbox alongside your controls. After some experimentation and finding an apparent error in Microsoft's code I have published the details in the Windows Forms tips and tricks pages.

New Tip: Display a check-box in the property grid for Boolean values.

My Windows Forms tips and tricks page has a new article with code in C# and Visual Basic.net that explains how to draw a check box in the property grid next to boolean values.

New Tip: Display Yes/No instead of True/False

Many people would like the option to display yes or no instead of true and false for boolean values. my Windows Forms tips and tricks page now includes an article with code in C# and Visual Basic.net that explains how to create a type converter to do this job.

Wednesday, April 07, 2004

Updated GDI+ FAQ article

The article on manipulating graphics on screen has been updated to include techniques that enable transformations such as scaling and rotation of the graphics. Any transformation has the potential to upset the mouse input so a method of backtracking the mouse is included. See Manipulate Graphics for details.

Tuesday, March 30, 2004

Bouncy Bouncy!

I'm still getting email bounces on Well Formed subscription deliveries. If you were expecting to receive Well Formed and haven't done so please send me your updated e-mail addresses.

Sunday, March 28, 2004

Well Formed

The latest edition of WellFormed has articles on non-client mouse interactions and two articles on ListView customization that are probably the most detailed on the web. I was researching for the articles and found very scant information so there's a lot of good stuff in there.

Wednesday, March 10, 2004

Binit Shah

Will Binit Shah or Pradip Shah please check your e-mail system because despite having replied to all of your enquiries and sent the issues of Well Formed you ordered you continue to pester me to reply and it's getting a bit wearing.

You seem to be ignoring all my replies, with or without attachments but the mail system does not bounce them, I suspect that you have a lunatic spam filter turned on or have accidentally added me to a list of junk senders.

----------

If anyone has this blog on an RSS feed in the USA could I trouble you to call Mr Shah on his US freefone number to contact him. Mail me and I will reply with an 0800 number to call. I cannot call him because I can't call an 800 number from europe. You can get my e-mail from my site.

Thursday, February 26, 2004

WellFormed released

February's Well Formed is available.

The mail shot has gone out but I have had a lot of bounce notifications this month. Maybe people have their spam systems turned up high.

If you haven't got your copy yet, ping me and let me know.

Thursday, February 05, 2004

Revised article

I updated the article which explains how to capture a control. RelaseDC needed a window handle and an hDC. The old code only had the hDC so a memory leak was caused.

Friday, January 30, 2004

Not polite?

I've just noticed that a few comments have been posted through the HaloScan system which I seem to have had no notification for. Normally when somebody posts a comment I get a mail telling me that it's there but for the last few days and certainly the last few comments made I have had nothing. This may be to do with the recent spate of e-mail viruses and the fact that I've got my Spam checking turned up to its fullest extent so please, if you make a comment and I don't respond straight away, be patient.

Sunday, January 25, 2004

Wednesday, January 14, 2004

Monday, January 12, 2004

ColorMatrix weirdness

Someone asked me a simple question on Saturday that has had me wracking my brains and pulling out my hair over the weekend. They had a problem with an image containing some text which they had tried to invert to a negative but which came out completely black even though the original text was black on a white background. Obviously, it was expected to show white text on a black background. First of all I thought this was a bug and searched around in the code for errors but could find nothing glaringly obvious. Then I sat down and wrote a simple test that loaded up a picture, drew a checkerboard pattern of black squares on top of the picture and made a negative image using the color matrix as described in my GDI+ FAQ article. Imagine my surprise when the negative image had black squares on it instead of cyan ones. I was even more surprised when every graphic I tried came out black in the negative instead of its inverse color. I tried black, white, red, blue, green, yellow and magenta text and graphics and everything came out black in the negative image.

Suddenly, I realized that the common factor with all of these colors is that they all had one or more elements fully saturated or zero with no intermediate values whatsoever. The answer is of course that when using the color matrix to create a negative image color triplet values are multiplied by -1. These values are also eight bit values and so 255 multiplied by -1 is -255 which overflows the 8 bit value to zero. This means that every color with a fully saturated component will be incorrect in the negative and therefore inverting a negative created with this process will produce an incorrect positive.

In an effort to overcome this problem I decided that the solution was to ensure that there were no elements in the image which had fully saturated values or zeros in any of the pixels. To do this I used the color matrix again this time scaling all the colors to make them a tiny bit darker and then shifting all the colors up by one value. This produces positive images which are imperceptibly changed and which produce perfect negatives every time. I am just in the process of updating the GDI+ FAQ with this information and a little bit of code.