New Year’s (Image) Resolution

January 3rd, 2010 Kevin Fairchild Comments off

I’ve been messing with GDI+ a bit lately.

Working with multi-page TIFF images has been both frustrating and rewarding. Once I needed to add a dynamic header to each page, I ran into the usual pitfalls with that sort of thing…

Set the encoder parameter to MultiFrame? Check.
Save the first page and then calling SaveAdd for subsequent pages? Check.
Make the images bi-tonal and using CCITT4 to reduce file size? Check.
Scale down the image slightly so next text could be written without potentially covering up a part of the faxed document? Check.

Even writing text to the image with GDI+ was (relatively) painless once I understood the basics.

One issue I kept running into, though, was that certain images (typically from fax machines) were coming out somewhat skewed. As I worked through the details of it, I discovered that the horizontal resolution was kicked up to 200-something, while the vertical resolution was only 96. I messed with this for ages and couldn’t quite figure out how to actually APPLY that knowledge in a way that would help my situation.

Quite randomly, during a discussion about thumbnail generation in SharePoint, someone mentioned an issue with aspect ratio of faxed TIFF images. Getting more details, I found out how the horizontal/vertical resolution comes into play.

Originally, I was just shrinking the image’s width/height by a certain percentage and then writing my text to the top of the image. For images with a high horizontal resolution different from the vertical, the end result didn’t look very good. Sometimes the original image seemed alright, but the text looked large and blocky. At other times, I’d end up with even the original image seeming squished or stretched. It was totally my fault, though.

When scaling down the image, what I was originally doing was something along the lines of:
newWidth = sourceWidth * scaleFactor
newHeight = sourceHeight * scaleFactor

Instead, I needed to essentially do something along the lines of:
newWidth = (sourceWidth / sourceHRes) * scaleFactor * newRes
newHeight = (sourceHeight / sourceVRes) * scaleFactor * newRes

For ‘newRes’, I went with whatever the higher value was between HRes and VRes on the source image. The result? A properly scaled image with the same aspect ratio as the original. There’s a small degradation with this, I guess, since a lot of the imaging calls using integers and some of the calculations will get rounded, but it was good enough.

Tags:

Dear Sir/Madam: Your Website Sucks. Love, Kevin.

September 21st, 2009 Kevin Fairchild Comments off

Sent this to Citi’s customer service department.. after yet another horrible experience while using their website to manage my credit card.

Let users choose their own security questions. And don’t put any silly limits on it (i.e. asking a pet’s name and then complaining because the name wasn’t as long as what the system thinks should be a minimum length).

The current system security questions/answers is completely asinine.

I was just prompted with a security question asking what date my youngest child was born. Are you kidding me…? I’m 28 and don’t have any kids. If I have to put some bogus information in there (that I then can’t remember, of course), how is that considered effective security?

The second security question I was prompted with asked who my arch-nemesis was in elementary school. Let me say that again just for emphasis. ARCH…. NEMESIS…. Who do you issue credit cards to, Spider Man and the members of X-Men?!?!?

Please fix this system. Offer as many pre-made questions as you like, but give the option to let us choose our own questions and answers.

–Kevin Fairchild

Tags:

Missing Posts

March 17th, 2009 Kevin Fairchild Comments off

As some of you may have noticed, I had to restore my blog off backups recently. Was teaching a friend of mine how to do some stuff on MySQL and I must not have isolated things well enough *shakes head* The downside of running too many sites on the same host, I’m afraid.

So I’ve lost about a year’s worth of posts. On the bright side, I haven’t updated the blog in a while thanks to a slight addiction to StackOverflow.com ;) So it actually isn’t THAT much content. Mostly just little stuff here or there.

Push comes to shove, I should have most of my screenshots and sample code stored on another system, so it won’t be that difficult if I need to recreate a few of the major posts.

Tags:

Close Enough

April 26th, 2008 Kevin Fairchild Comments off

I was able to finally get the table structure the way I wanted it.

Since my source data is all plain text, I identify the URLs and then add in the HREF data with the url as the link text as well as the location. Add in basic tags for displaying the images I want next to the next and — BAM! — now I have a grid showing the posts/pictures for each user.

Once that was in place, I did something similar for usernames.

Last but not least, I hijacked the DocumentCompleted event of the browser control to add an OnClick event for each link… That event lets me selectively perform actions based on what I need… So clicking on a normal URL will open up a new browser window displaying what’s needed. Clicking on the image link (the user pic) performs some stuff on the client side to allow replying to that person’s post.

It’ll make a bit more sense once I post some pics…

More than one way to skin a cat…

April 26th, 2008 Kevin Fairchild Comments off

Needed to display some data in a grid. No biggie. But I wanted some custom formatting — mainly allowing for links and whatnot. Eventually, I was left with two options — inheriting a richtextbox control and using that as a custom datagridcolumn or doing an override on a paint event for the cell…

Started with the richtextbox method, but it seemed like the only way that worked was if the editing control was overridden… Not much use for displaying the stuff. Meh.

So I tried out using the paint event. That actually worked pretty good at first. Using GDI+ DrawString calls to write what I wanted in the color/formatting I wanted — albeit in a somewhat clumsy way. But then I began running into issues when I had multiple strings needing formatting or if the string needed to wrap within the cell.

Deciding both method were way too complex for what I needed, I started rethinking the issue. What I really needed was a way to have it render HTML text. That way I could do some handy-wavy string manipulations to set the various tags I needed and that would be all that’s needed.

After looking around for a while for a simple way of doing that within the datagridview, I changed my design plan a bit…

That’s when I got an idea…

If I used a web browser control, I’d certainly have the HTML support I needed. And by using tables within HTML, I’d be able to get pretty close to the same grid feel as that original datagridview.

I’m Baaaaack

April 16th, 2008 Kevin Fairchild Comments off

It’s been a year, but I’ve been keeping busy…

Have a new side project I’m working on in my spare time — a Twitter client for Windows. Nothing too fancy. Mainly just tired of using clients that are 70-90% what I want, so now I’ll make one that is 100% the way I want. Or, if not, I’ll at least have a better understanding about why certain things aren’t included in other clients.

Will post some pics of it later along with the basic gist of the features and whatnot.

I’m also slowly going to revamp the blog to move away from categories and more towards tags. Will see how it goes…

Tags:

Hiatus Haiku

March 14th, 2007 Kevin Fairchild Comments off

More than usual,
Life found me preoccupied.
Sorry, my readers.

Tags:

8 Things Intelligent People, Geeks and Nerds Need To Work Happy

March 12th, 2007 Kevin Fairchild Comments off

March 12th, 2007 by Nomadishere [mirror]

There are many reasons to let geeks work the way they want to work. Today they work in every industry. They are the knowledge base, blood and sweat equity of many businesses. They work harder than most. They work longer than most. Their job isn’t a separate ‘something they do’ while they look forward to going home and relaxing. Geeks *live* what they do. They eat, sleep and breathe it. They are your systems administrators, your IT team, your programmers, your web developers, your designers and sometimes even your customer service and sales people. Anyone who understands how to leverage todays technology to increase intelligence, productivity and efficiency; anyone who stays up nights working to get better at what they do; anyone whose job is their life – is a geek. These are the most important asset your company has. For this reason, its important to give geeks what they want. Best part is, if you do, they most likely will not leave your company to work for someone who will.

#1. Let them work when they want
Geeks work almost every moment they are awake. They are online before they go to the office. They are home working after the office closes. They work weekends. They are even sometimes working in their dreams. Employers should understand this and more importantly appreciate it. Don’t force geeks to work 8 – 5 if there is no real need other than ‘company morale.’ Meetings are one thing and so is socializing with coworkers, but a relaxed office schedule will do wonders for the contentment levels of your employed geeks.

#2. Let them work where they want
Geeks prefer to have a couch around to nap on if they are tired. Some like no windows, others want to stare out into a city or landscape. At home, geek’s offices are usually more lived in, more comfortable and enjoyable than anywhere else in the world. This is because they love what they do, and they do it so much of the time they need to be comfortable where they do it.

#3. Let them control their lighting
There is nothing more annoying than working in bright crappy fluorescent lighting if you prefer to work in the dark, or vice versa. Geeks usually have sensitive eyes from staring at CRT monitors for too long. The last thing you want is your geeks to have headaches. Most geeks aren’t very pleasant to work with when they have headaches.

#4. Let them wear headphones
Geeks are experts in the arts of ‘focus.’ Focusing takes removing all unnecessary distractions from your environment and creating a state where nothing else is going on but what they are working on. The harder the problem they are trying to solve or the more creative they have to be, the more they need to focus. Headphones, or simply a lack of ringing phones and talking sales people allow geeks to focus much easier.

#5. Do not expect them to wear a suit
Geeks find arbitrary activities that lack real and meaningful purpose, a waste of time and energy. This includes attire. Most companies today are aware of this and even practice casual dress so as to make everyone more comfortable, but geeks are a special case. ‘Suits’ (the kind of person) usually represent a business man who lacks most things other than a nice smile and great negotiation skills.

#6. Do not make them participate in company events (unless you are sure it is geek-friendly)
Most geeks will not be jumping up and down with joy to attend a company party to celebrate the local football team, unless of course there is beer, and they can hang around and talk to each other about geeky things. Keep this in mind when planning company events. Geeks like to have fun, just not the same kind of fun as your typical non-geek.

#7. Do not hold a lot of arbitrary meetings that could have otherwise been handled through email or IM
This one is important. Like I said, geeks need to focus to be happy and able to focus. Nothing is more of an interruption than someone walking into their space unexpectedly and saying ‘hey do you have a minute?’ The answer is usually going to be a disgruntled ‘Sure.’ The truth is geeks are fine with attending planned meetings (and will happily be there if the meeting is really a necessary one for them to attend in person), but are usually most happy communicating through email and IM. These forms of communication are most appealing to geeks because they do not interrupt you, and polite geeks will even respond with a quick ‘hold on a sec, I’m in the middle of something.’ Email and IM are recorded, searchable records of conversations. They are efficient and to the point. This also makes geeks happy. Geeks can discuss anything through email and IM and will usually be more willing and thorough with their response. Face to face meetings are important, geeks know that, but I would guess that 90% of conversations and meetings held face to face, would be more efficient and end with happier people, if they were held in a recordable, written, virtual space.

#8. Do not make them do anything other than work
This one isn’t completely accurate all the time. Geeks are team players, but they are also easily insulted by being given a task below their level of expertise or outside of the scope of their position. They’ll do it, but they won’t be totally happy. This includes: answering phones, taking out trash, going shopping for company supplies, and ‘filling in’ for a sales person.
I hope this summary helps employers further understand the world of geeks, and how to keep them happy. I also hope this helps other geeks out there approach their employers with a list of what they need to work happy.

Tags:

Tron

March 9th, 2007 Kevin Fairchild 2 comments

I’m not a big fan of tennis shoes or whatever. I’m happy with whatever fits nice. But I’d totally enjoy wearing these suckers out on the town… just for the Tron-effect…

Check out pics of them in action.

Tags:

Feedback

March 8th, 2007 Kevin Fairchild 2 comments

For those of you who have worked with me in the past (or do currently), can you give me some ideas of stuff to mention about myself?   Since it’s likely I’ll be asked to go over some of what I’ve worked on in the past next week, I could use some material to work off of.

I know the lack of ASP.NET development is gonna’ hurt things a bit, but what can I say? I just haven’t had any interest in it yet.

Anyhow, if I’ve made any applications, tools, or systems that you think are worth mentioning, let me know.  I figured I’d ask here since there not a whole lot that I was too impressed with most of what I’ve made, but I’m sure some of the other people at the office have a different view :-)

Thanks, folks!

Tags: