Wednesday, August 5, 2009

Easy Way Detect Changes On The Clipboard With Windows API

A recent Windows Forms project required that I copy data from a grid and an associated object with each cell copied. This allows a user to paste the data in the same grid but in a different set of cells.

My problem came when a user would copy data from an external application like Excel, and tries to copy the text into my grid. I had to come up with a way to determine the user was trying to paste something copied from an external program.

There is a great solution using a Windows API called GetClipboardSequenceNumber().

[DllImport("user32.dll")]

static extern uint GetClipboardSequenceNumber();



Using this API allows you top capture the sequence number every time something is copied to the clipboard. Here is the workflow I went through.



1. Capture the sequence number when the mouse or keyboard events are fired



2. When the paste event is fired, check the clipboard sequence and compare it to one saved locally. If the numbers are difference, only paste the text, if they are the same, paste the text and the object.



I put the sequence capture in my Copy method so it’s changed internally every time someone chooses Edit/Copy from the menu, presses CTL-C, or right clicks and selects Copy from a popup menu.



This seems to work pretty well. There really isn’t any code to share other than the knowing which DLL and method to use. Where to store the sequence and how you use it is going to be up to you.

read more...

Saturday, June 20, 2009

Elevator Pitch 1.0

In a post from yesterday, I talked about my lack of an elevator pitch. I also admitted that I have a really hard time conveying what I actually do. This post is a simple explanation. It’s a work in progress. But here is the short direct answer:

I’m a programmer, and I run a company called PressDev. We are web designers and developers. We also build iPhone and social network applications, and create customized WordPress sites. This is what I do. And I do it really well.

If you don’t read any further, I’ve shared with you what I do. Without sounding like a resume, I’ll share some details, if you please.

Yes, I’ve done a lot of things. So far I’ve led a diverse life. I’ve traveled the world. I’ve worked for very small companies and very large companies. I spent four years in the United States Marine Corps in the mid eighties. Honestly, that experience shaped who I am today. It’s where I learned to lead by example, work in a team environment, and make decisions quickly.

I’ve spent over 20 years writing computer software. Yes, I write computer code. Most of the time in Microsoft C# and PHP, and even sometimes in Python. I’ve managed small and large teams. I’ve managed offshore development teams. I’ve architected complete software solutions.

In order to be an expert at something, I believe you must immerse yourself in it. Personally I’ve spent years building a career network. I think that’s why I find so much value in services like Twitter, Facebook, and blogging. I was a very early adopter of LinkedIn. I’m an early adopter of most technology. That’s how I stay ahead. And while my business isn’t being an expert in marketing using Twitter, Facebook or LinkedIn, I spend a lot of time using the social networks so I can help my customers best use the services in their personal or business life.

I also like to speak in technology topics. I’ve spoken dozens of time to small and large audiences. I love the share my knowledge.

I’m also an entrepreneur. My mind never stops thinking though ideas and try getting them off the ground. That may be why some people are confused at what I do. It’s interesting, because if you look at someone like Gary Vaynerchuk, he does a lot of things, but you still think of him as the Wine Library guy. No matter what I’m doing, my core is still the same.

Whew, I’m sure that’s about all I want to share in this post. Go ahead, ask questions. Tell me what you think.

read more...

Friday, June 19, 2009

A Question That Haunts Me Wherever I Go

I recently attended a local social networking event (one where you meet people face to face, not through #hashtags.) I like to get to these things early for the chance to network. You never know who you are going to meet. And this time was unlike many in the past. I’ll get to the title of the post, “The Question That Haunts Me Where Ever I Go”, in just a few minutes. This is something I must work up too.

The first person I was introduced too was Alistair Cockburn (thanks @ghennipher). In the software development world, Alistair is the rock star God of the agile methodology. I’ve met him before, but he wouldn’t remember because they were quick meets. But I’ve followed his work, and I appreciate all that he has given to the development community. I was fortunate to have 10 minutes of uninterrupted conversation. At the end, he started to ask me what I did. First sign the night was going to be rocky.

Next I spent several minutes shaking hands with various guest, many who I knew, and several I didn’t. Most asked me again, what I did. I wondered where these people had been. Why don’t they remember? I Exchanged some business cards, ate some food, and found a seat for the presentation. But my mind was not into what was going on around me.

Fifteen minutes into the presentation I needed to get up and stretch my legs. I made my way to the back where another very good friend was standing. We quietly talked about a few things, and waited for the presentation to end. At some point during our conversation, he announced to the group we were standing with that I was connected to everyone. He doesn’t know this, but that kind of threw me. While I know a lot of people, and I feel I’m a pretty good networker, it feels unnatural when someone says that about me.

Now to the question. Just as we were about to head out for the night, I asked this good friend a question. I was hoping he would give me a straight answer, because I really needed some advice. The conversation went something like this:

Me: “So, it’s funny that you mentioned I’m connected to everyone. Do you really think that?”

Him: “Of course…”

Me: “So let me ask you, why do I have such a hard time getting people to remember what I do?”

Him: after a brief pause… “because no one really knows what you do! Most people think you do everything, but no one knows what you do. You’re always vague.”

Me: “So when I ask someone what you do, the immediate answer is, he’s the SEO guy.”

Him: “Right.”

Bingo. That was the candid answer I needed to hear. He went on to tell me I didn’t have an elevator pitch. He gave me his pitch. He’s worked on it for years. Me, I guess, for some selfish reason, assumed everyone already knows what I do. But I am so wrong. My friend encouraged me to spend some time putting together a better elevator pitch. It was so obvious, it’s even something I push others to do. But I haven’t taken my own advise.

There are two parts to me; the one I need to be, and the one I want to be. I read a blog post on JibberJobber yesterday about Job Envy. I guess my failure to successfully convey what I do stems from years of not wanting to be defined by my work. So I kept it vague. But as a business owner I can’t do that anymore. I need to clearly define what I do. There’s no way I can network without being able to convey what I do. It’s not the part I want to be, but it’s the part that I need to  be.

While I want to continue to discuss what I do and don’t do, I’ll save that discussion for tomorrow, and maybe a first draft of the elevator pitch. Thank you for taking a few minutes to read this.

read more...

Tuesday, June 16, 2009

Creating Multiple Streams Of Income

At the beginning of 2009, Jason Alba started talking about multiple streams of income. Seeing how it's the middle of the year, it was time for an evaluation of my streams.

PressDev is my first income stream. The primary mission of PressDev is to build custom websites and software for businesses and individual. Our unique skill is converting static and stale websites into dynamic growing content management systems (usually with WordPress). We integrate social networks and digital media to make websites sticky. We also build social networking applications for platforms like Twitter and Facebook, and we also write iPhone, Android and Windows Mobile applications.

New services we are offering include SEO, Graphic and Logo Design, and Copy Writing.

Over the next several months I'll be profiling more of my income streams. I'll also be writing more on business and entrepreneurship.

Here is a breakdown of the revenue streams I’ve shared so far:

* Revenue Stream 1: PressDev
* Revenue Stream 2: (not announced yet)
* Revenue Stream 3: (not announced yet)
* Revenue Stream 4: (not announced yet)
* Revenue Stream 5: (not announced yet)
* Revenue Stream 6: (not announced yet)
* Revenue Stream 7: (not announced yet)
* Revenue Stream 8: (not announced yet)
* Revenue Stream 9: (not announced yet)
* Revenue Stream 10: (not announced yet)
read more...

Today I Learned About WordPress Category Templates

Today I learned about category templates in WordPress. There is a simple, yet rarely used feature, that allows you to display content based on a specific category. For example, if you have 10 categories, with ID’s 1-10, and you want to show your visitors something different for each of these 10 categories, you can create files with this naming convention:

category-1.php, category-2.php, and so on.

When the URL http://mydomain.com/category/coolcat is entered into the browsers address bar, and WordPress sees a category request made, it looks for a category-x.php file in the main template folder. If one exists, that will be used over the default template file. If a template file isn’t found for the requested category, the next file that WordPress looks for is category.php. This is another template default file that can be applied to all categories that don’t have their own template. If a category.php isn’t found, then the default template file is used.

One thing I discovered while trying to get category templates to work, I was entering http://mydomain.com/coolcat and expecting the category template to display. But as you may know, WordPress was trying to find a Page named “coolcat”. I struggled with this for a week, and after ripping out the small hair follicles on my head, it dawned on me I was entering the wrong URL. Remember, /category/ must precede the category name, or it just doesn’t work.

Here is a link to the WordPress Codex explaining category template.

read more...
 
Copyright © 2003 - 2014 Thom Allen Weblog • All Rights Reserved.