We had a bug that just wouldn’t go away. Sometimes it would show up quickly, sometimes it would show up after the code had been running for a few days… but it would show up. What’s the programmer to do?
Permanent link to this article: http://blog.curioussystem.com/2012/05/the-case-of-the-random-lockup/
Permanent link to this article: http://blog.curioussystem.com/2012/02/two-clicks-to-program-a-pic/
Feb
04
Multithreading, Python and passed arguments
Recently I’ve had a project that required precompiling the firmware for a device so that the end user could program the device, but not have the source code. We’re not talking about a few versions of the code, but almost 1000. This is something that no person would want to do, especially since it would have to be redone every time the source code changes. Python to the rescue. It was simple enough to write a program that would copy the source code, change a bit of information in a header file, compile it and save the binary to the appropriate location. Controlling other programs is pretty easy with the subprocess module. That’s great and all, but doing it single-threaded, that’s so 90s. Python makes multithreading pretty simple using its multiprocessing library. The trick is not stepping on any toes when you do it.
Permanent link to this article: http://blog.curioussystem.com/2012/02/multithreading-python-and-passed-arguments/
Permanent link to this article: http://blog.curioussystem.com/2012/01/of-embedded-black-boxes/
Jan
07
Cleaning up filenames for transfer to windows
For those of you run multiple operating systems, you may have run across the problem where the filenames on one are not valid on the other. Specifically I’ve had that problem when using NTFS filesystems between Linux and Windows. The NTFS3G drivers on Linux will allow characters in the file names that windows doesn’t like. To solve this, I wrote a quick python script that will make the filenames windows acceptable. Enjoy.
windows_rename.py
#Copyright 2012 Chad Kidder
#Released under GPL v3.0
import os, sys, re, shutil
def SafeNames(location):
for root, dirs, files in os.walk(location):
for tfile in files:
NewFile = InvalidCharacters.sub("_",tfile)
if NewFile <> tfile:
shutil.move(os.path.join(root, tfile), os.path.join(root, NewFile))
print "%s -> %s" % (os.path.join(root, tfile), os.path.join(root, NewFile))
for tdir in dirs:
NewDir = InvalidCharacters.sub("_",tdir)
if NewDir <> tdir:
print "%s -> %s" % (os.path.join(root, tdir), os.path.join(root, NewDir))
shutil.move(os.path.join(root, tdir), os.path.join(root, NewDir))
if __name__ == "__main__":
if len(sys.argv) < 2:
print "Please enter a directory to fix the file names on"
else:
InvalidCharacters = re.compile(r"[\/?:*|'\"]")
for location in sys.argv[1:]:
SafeNames(location)
Permanent link to this article: http://blog.curioussystem.com/2012/01/cleaning-up-filenames-for-transfer-to-windows/
Jul
07
Using the Python HTMLParser library
When writing a script to download files off a site, I figured there was an easy python library to do that. Well, sort of. I chose to use the HTMLParser library. The documentation is not the best, so I thought I would add a bit of what I found. If I had to do it again, I might just use regular expressions to do it all.
Permanent link to this article: http://blog.curioussystem.com/2011/07/using-the-python-htmlparser-library/
Jul
05
Automating Dreamhost backups
We here at Curious System Solutions use dreamhost as our hosting provider. One of the nice things they give us is a nice, tidy, backup every month, if we ask for it. It may take a few days if you ask at the beginning of the month, and it is easy to forget to download. So, we have a handy python script that will check an imap4 email server to see if the backup is ready, and if so, download it. The script is designed to be a cron job that can be ran every night so you don’t have to worry about remembering to download things.
Permanent link to this article: http://blog.curioussystem.com/2011/07/automating-dreamhost-backups/
Permanent link to this article: http://blog.curioussystem.com/2011/06/capacitive-touch-sensing-on-the-msp430/
May
11
A quick note on “ATX” Power Supplies
After our recent activity making the emergency ATX power supplies, I got a call one evening from one of the hams who couldn’t get their salvaged 24-pin power supplies to work. It turns out that many of the larger computer manufacturers use their own proprietary pinouts. In this case, he got bit by a Compaq power supply. A good place to check to see if you can make a proprietary power supply work is pinouts.ru (yes, I know it is in Russia, but to my best knowledge it is not crawling with malicious software).
Permanent link to this article: http://blog.curioussystem.com/2011/05/a-quick-note-on-atx-power-supplies/
Apr
27
Directions for Soldering of Compact Emergency ATX 12V Output Board
Last Friday night one of the local amateur radio groups that I’m affiliated with had a get together with good food, friends and activity. We soldered together the Compact ATX 12V board that we wrote up a little while back. There were a few people who were unable to stay and put it together. For them (and for anyone else trying this), I have put together some instructions on how to put it together.
Permanent link to this article: http://blog.curioussystem.com/2011/04/directions-for-soldering-of-compact-emergency-atx-12v-output-board/