Ever try to copy-and-paste text from a website or document into Gmail? And you get that awful formatting side effect of
HUGE BOLD TEXT
out of nowhere? Here’s how to avoid that, courtesy of Stack Exchange: Paste your text using ctrl-shift-V instead of just ctrl-V. Easy huh?
But wait! It doesn’t work for me! It pulls up some AdBlock Plus sidebar!
Yep, unfortunately in Firefox (and possibly others) AdBlock Plus stupidly claims ctrl-shift-V as the hotkey to open its sidebar. FORTUNATELY you can fix that stupidity by opening your about:config page and changing the extensions.adblockplus.sidebar_key to anything else (I left mine blank). Restart your browser and you will be able to do a formatting-free paste into Gmail.
There you go. Hope that helps!
This one is a quickie. Open the about:config page, navigate to browser.newtab.url, and change it to about:blank. Easy peasy. Now you can open a fast-loading clean blank tab instead of the default Firefox grid of nonsense.
Recently I tried my hand at developing a Windows-based GUI. Tossing together the GUI elements in Visual Studio 2010 was a piece of cake. Getting the GUI to talk to a USB HID, not so much. I literally tried three different C# USB HID libraries before I found one that would work reliably and without a ton of over head. Here’s the winner: Jan Axelson’s Lakeview Research generic hid. I used the generic_hid_cs_50 example (which is actually targeted to Visual Studio 2008 but Visual Studio 2010 had no trouble importing it). The default generic_hid application is a nice way to initially test connectivity to your USB HID device. You can specify your VID/PID (Vendor ID and Product ID, which are the numbers that differentiate your HID from other HIDs), control transfers versus interrupt transfers, single report TX/RX versus repeated report requests, and other nifty configuration settings. It worked almost flawlessly out of the box.
Fairly quickly I was able to merge the USB HID functionality I needed from this example application into my own application. It uses FileStreams and SafeFileHandles which seemed to work much better than the other HID libraries I tried. For example, I also tried Florian Leitner-Fischer’s USBHIDDRIVER, which is frequently referenced online and on sites like StackOverflow. Unfortunately Florian’s now-aging library repeatedly hung forever at the second or third WriteFile/SetOutputReport and I wasn’t able to find a satisfactory workaround for that issue.
So there you have it. Need a C# USB HID library? Give Jan Axelson’s generic_hid example app a try. Hope that helps someone! -Andrew
The default C syntax highlighting in VIM is pretty good. I’ve used the default for several years. However, there are a few whitespace issues I encounter when editing C files that just PAIN me. Here they are, as well as tricks to highlight them as errors so they can easily be spotted and destroyed!
Extra spaces at the end-of-line. It’s no biggie but it annoys me. The extra spaces can pop up for a variety of reasons: Cut and paste issue, line-wrapping when entering a long comment, lazy indention (leaving lines with just a bunch of spaces). Whatever the cause, here’s how to highlight them as errors. It’s easy:
- Edit your vimrc file. Mine is C:\Program Files(x86)\Vim\_vimrc. Yours may be somewhere else.
- Somewhere in that file will be the line “syntax on”. Add this line BEFORE syntax on and save the file:
let c_space_errors = 1
- Open your file containing end-of-line spaces and they should now be highlighted as errors.
Hard tabs. Unlike end-of-line spaces, hard tabs are more than just an annoyance. If your editor opens to a different tabstop setting than the author who added the hard tabs then the file is likely to look like utter crap… the indention will be all messed up between the space-indented code and the tab-indented code. This is why I banish hard tabs whenever I find them. Here’s how to spot them easily… and it’s slightly trickier than above.
- We’re going to add some additional C-specific syntax highlighting. We won’t do this by modifying the default c.vim syntax file. Instead we’ll create a separate additional syntax file. See “:help mysyntaxfile-add” in vim for all the details of what we’re about to do.
- If you don’t already have one (and you probably don’t) you’ll need to create an after-syntax folder. In my case, neither “after” nor “syntax” existed, so I created them. You’ll create them in your vimfiles folder. For example, my final folder was: C:\users\myname\vimfiles\after\syntax.
- In the syntax folder, create a new file named c.vim.
- Add this line to your new c.vim file and save it:
syn match cError display "\t"
- Open up your hideous file containing mixed hard tabs and space indention and recoil in horror at the now-highlighted hard tabs.
Hope that helps someone! -Andrew