Serial Port Monitor in 20 Lines of Code

Here’s a serial-port monitor in 20 lines of code, thanks to PySerial. It opens the default or first serial port, and works with USB dongles, too.

import serial	# http://pyserial.sf.net
import SerialPortScanWin32

pList = [x for x in SerialPortScanWin32.comports()]
port = pList[0][0] - 1 # single/first serial port
ser = serial.Serial(port, baudrate=1200, parity='E', timeout=0.2) # opens, too.
print "Monitoring serial port " + ser.name
data = []
while True:
	ch = ser.read(1)
	if len(ch) == 0:
		# rec'd nothing print all
		if len(data) > 0:
			s = ''
			for x in data:
				s += ' %02X' % ord(x)
			print '%s [len = %d]' % (s, len(data))
		data = []
	else:
		data.append(ch)

Python rocks!

PS: No, serial comm hasn’t gone the way of the dodo, particularly for many industries.

LinkedIn broken?

As of right now, a couple LinkedIn connection requests I made, that were accepted, still aren’t showing up in my connections list. I received the e-mail that we’re connected. So it’s half-working, half-broken, even after 30 hours or so. (Surely the electrons can travel from one end of LinkedIn to the other in that time.)

The mind boggles at the mess this could potentially be if they’re dealing with a breakage of something that fundamental. My heart goes out to them. I hope they have (or can create) the right view of their system to make it all good. I haven’t seen any announcement to that effect.

Avoiding SubInACL.msi

Problem: An app I wrote (some time ago) refuses to run on Windows 7. MFC’s CDialog::DoModal() returns immediately. The web suggests it’s using an unregistered control. Sure enough, the registration for a control fails with:

The module “msflxgrd.ocx” was loaded but the call to DllRegisterServer failed with error code 0x8002801c.

One person says get and run SubInACL.msi, and use it to make sweeping recursive permissions changes to the registry and system directories.

Yikes! Really?!?!?

This much-less-intrusive solution worked for me:

Right-click on C:\WINDOWS\System32\cmd.exe, and choose “Run as Adminisstrator”. From that command-line, run the registration:

regsvr32 msflxgrd.ocx

The registration now passes, and my program now comes up (not needing to be run as administrator).

Note that we thought the account we were running under had full Administrator privileges, but still failed to run this app as such. (It didn’t ask for the password when running cmd as administrator.)

MSVC-8: alive and well

Over the weekend I installed the latest Flickr Uploadr for Win32.

The install popped up the familiar “Microsoft Visual C++ 2005 Redistributable” installer as part of its installation.

Microsoft Visual C++ 8 is still solid and widely used.

Bye-bye manifests!

Here’s a very interesting development, brought to my attention by a fellow developer:

Microsoft is doing away with the manifest scheme in Visual Studio 2010. From Deployment in Visual C++ 2010:

Differences between Visual C++ 2008 and Visual C++ 2010

The most significant changes between Visual C++ 2008 and Visual C++ 2010 are:

* Visual C++ libraries no longer depend on manifests and are no longer installed in the WinSxS folder.
* Dependent applications and libraries no longer require manifest information.
* Local deployment no longer requires a satellite manifest.

To me, the manifest scheme just traded one problem for another. And the problem traded away (DLL issues) was one I never had.

Biting Brit Commentary

In this piece from the UK’s Register, Dominic Connor savages British Computer Science Higher Ed:

No wonder CompSci grads are unemployed

His biting style is a little over the top, but entertaining. I hope not everything he claims is true.

A couple gems:

Java fanboys tell me that it is “easier” than C++, and seem miffed when I agree in a sneering way. A CompSci grad is supposed to be able to do difficult things that arts grads simply can’t understand. … BMW don’t say their cars are “so simple that they are built by cows” …

As far as I can tell, only Queen Mary College has undergrads bright enough not to be scared of C++, and even then less than half take the option. Kings College students/victims told me that they do operating system internals in Java, and no they weren’t joking.

Ouch.

Developers in Short Supply

From today’s Chicago Tribune:

Software engineers hard to find
Shortage of trained IT talent challenges Chicago companies

Good to know in these troubled times.

And to keep in mind:

“One good developer can do the work of three or four guys,”

And this…

… finding qualified job candidates is “the bane of my existence.”

Wally Gets It

Dilbert.com

Wally gets it (in his own Wally way).

The art of this job is binding the rare moments of inspiration to knowledge and machines.

That’s what I mean when I say, “…good ideas…”.

But we can’t afford the moments to be rare.

XMarks: fare thee well

Received XMarks’ notice that they’re folding, and their story is excellent reading. Here are a few of my observations.

First, it’s very well-written and has an excellent tone. I hope never to fold a business, but if I had to, I hope I’d bow out as gracefully as they are.

Hats off to them for knowing when to quit, and letting us all know with this much advance notice.

We’re not in another dot-com bubble. Without a convincing plan to turn a profit, investors won’t bite. Two million users (astonishingly!) seems not to be good enough.

Technically, it’s an excellent product. I’ve used it for some time and it works great. Shouldn’t that be enough?

Entrepreneurial authors like Guy Kawasaki say that a product based on something you’d want yourself is a better way to go than an anticipated audience. And that’s exactly what they had.

Your competition isn’t far behind. If they’d started a “freemium” service early on, would they have built a loyal customer base that despite the free competition?

I don’t mean this harshly: the CEO couldn’t conjure magic. The engineers couldn’t find a working business model, but neither could he. I suppose I’m biased toward engineers, and CEOs exist because the engineers too often can’t do it without them. But it’s not a slam dunk for anyone.

I’d love to hear their experiences after some time has passed. Would it have been a viable business for a leaner team? What if they’d geared toward a smaller long-term revenue stream from the start?

Of course, if this farewell is really XMarks’ maneuver to get their customers’ attention (and it turns the business around), the CEO has earned his keep right there.

Fare thee well XMarks. You have an excellent product.

Update, 12/18/2010: Xmarks gets acquired by LastPass. Ok, so was the good-bye post a ploy? (And if it was, did I call it or what?!) Either way, I’m glad they’re still around, for everyone’s sake.

Fixing it in the hardware

I wrote a graphics-intensive application for one client. He reported that when he tried to drag it from one monitor to another it seemed to lock up. Then he reported the fix: adjusting the fan for one of his multi-monitor video cards, to keep it from overheating.

When you push bits all day, it’s hard to imagine these kinds of real-world interactions.

Or when a multi-threaded, calculation-intensive program kicks the PC’s fan up a couple notches, you realize: hey, I did that.

Embedded developers joke about the HACF machine instruction: Halt and Catch Fire. You don’t expect that on your desktop machine, but don’t rule it out completely.