Mischiefblog
I make apps for other people

Tech

Capturing CD-ROM insert events in Linux

Posted by Chris Jones
On March 24th, 2015 at 20:26

Permalink | Trackback | Links In |

Comments Off on Capturing CD-ROM insert events in Linux
Posted in Tech

I’ve been looking into how to capture CD-ROM (music CD) insert events for . . . reasons. Like I’ve got a big collection of CDs and I’d really like to rip them to FLAC files before jukeboxing the media. Now, I’ve looked into doing this on OS X (using the Disk Arbitration framework — this is relatively easy in Swift and Objective C but a bit harder from Go), and I’ve also considered how to capture the events in DBus on Linux/GNOME systems. However, I’m a stick in the mud when it comes to GNOME and I’ve pulled it off more than one machine because of the GNOME keystore and problems encountered because of that, so I’m reluctant to write anything that requires DBus when there’s a perfectly UI independent solution available: udev.
(more…)

Mint VM setup

Posted by Chris Jones
On December 30th, 2013 at 13:13

Permalink | Trackback | Links In |

Comments Off on Mint VM setup
Posted in Java, Tech

On Windows, use VMWare. I’ve run into problems with Oracle VirtualBox and Windows networking, although it works very well on Linux.

On the Thinkpad T420s I needed to enable VT-x (Virtualization support) in the BIOS setup under the Security-Virtualization menu.

VM Configuration
For a Core i5 vPro with four cores, I assign:

  • Four GB of RAM
  • Two processors
  • 32 GB of disk in a single file

Distribution Choice
On my hardware (Thinkpad T420s) I’ve had problems with Fedora. Ubuntu derived distributions work fine, including Linux Mint. I’ll assume that you’re using Linux Mint 16 Petra 64-bit.

I’ll download the .iso version via BitTorrent. Both VMWare and VirtualBox can mount and use ISO files for VM installation, plus it boots significantly faster than physical media.
(more…)

n-Commandments of Identity Security

Posted by Chris Jones
On May 3rd, 2012 at 09:01

Permalink | Trackback | Links In |

Comments Off on n-Commandments of Identity Security
Posted in Tech
  1. Thou shalt encrypt all external communications with thy users
  2. Thou shalt encrypt some internal communications on behalf of they users
  3. Thou shalt keep thy passwords and thy email addresses in distinct and separate stores, as if they were credit card numbers
  4. Thou shalt require encrypted communication with client keys to retrieve passwords and email addresses
  5. Thou shalt never accept an unhashed or plaintext password and thy client will never send one
  6. Thou shalt treat users as salted hashes and never have immediate identification of any user or user action in thy systems
  7. Thy password and username systems shall be accessible only by API or service call and shall be implemented as separate, distinct, and secured networks, achieving defense in depth
  8. Email campaigns shall be built on salted hashes and only the emailer shall have access to user names and email addresses
  9. Customer service systems shall be able to construct salted hashes from user information but shall not keep copies of user names, email addresses, or passwords
  10. Thou shalt disable all default user ids, passwords, keys, and conveniences for thy databases, management systems, and third party tools
  11. Thou shalt never need to send an email to thy customers informing them that their private information has been accessed

In defense of Pair Programming

Posted by Chris Jones
On March 18th, 2012 at 08:42

Permalink | Trackback | Links In |

Comments Off on In defense of Pair Programming
Posted in Tech, Work

A TechCrunch opinion piece posted yesterday, “Pair Programming Considered Extremely Beneficial,” was very complimentary about Pair Programming, a practice in which two developers work together to build software, one driving (typing) and the other navigating (describing what needs to be done). The author even included an amusing anecdote about Guy Steele pairing with Richard Stallman and how intense that experience was.

Since starting work at Overstock in 2010, I’ve had the opportunity to pair on a lot of user stories. Depending on the team lead pairing was either more or less the norm (less on my current team) but the company does have an inviolable rule when pairing must take place: when you’re working on financially impacting code. I’d extend that to say that you should pair on anything that impacts your core business and could cause the company to lose or have to restate revenue.
(more…)

Cache eviction

Posted by Chris Jones
On July 25th, 2008 at 17:09

Permalink | Trackback | Links In |

Comments Off on Cache eviction
Posted in Java, Tech

B: size of the buffer
K: number of items having distinct access probabilities

LRU eviction: O(KB)
FIFO eviction: O(K)

Unless it costs a lot more to load an object into the cache, FIFO eviction may make the most sense. In most LRU implementations I’ve written, the cost to maintain the “use” status of the cached object was more expensive than a cache miss because of the object had been evicted. Consider the cost of loading the object versus the SLA for the service. Also, if the cache objects retrieved tend to be clustered very strongly with few if any changes, the cached objects won’t be evicted from the cache very often. A FIFO strategy only loses in the case of a full cache where rarely used objects are occasionally inserted and frequently used objects are evicted and reloaded.


The JVM garbage collector is generally less efficient with larger heap sizes. Heaps over 1 GB with efficient garbage collection is possible if the JVM is properly tuned. Concurrent Mark and Sweep collector may be buggy in very large heaps–tiny JDK 6+ JVMs in federation worked okay. Cache growth should be limited (especially with hashmap caches). The number of long living objects is a problem moreso than the size of those objects, so consider serializing/deserializing the objects to byte arrays (the JVM is optimized around short-lived object garbage collection and the cost of young generation garbage collection is proportionally lower than older generation garbage collection).

Tuning JVM Garbage Collection JDK 5.0

JCS vs Ehcache metrics

Weekend update

Posted by Chris Jones
On March 10th, 2008 at 11:45

Permalink | Trackback | Links In |

Comments Off on Weekend update
Posted in Pets, Tech

I got my new laptop on Friday, an ASUS G1S-B1 from NewEgg. It was the best deal on the hardware that I could find, and it’s a strong performer, over five times faster (in terms of 3DMark 06) than my desktop. Lenovo wouldn’t have shipped a laptop to me until March 20, so it was worth going with such a consistently well-reviewed piece of hardware. I spent a lot of time playing Waffle in Warsong Gulch over the weekend. This week, I’ll be receiving a Zalman notebook cooler and a SIIG USB Soundwave 7.1 Pro USB microphone and audio adapter. The cooler is for obvious reasons, and this one reviewed well. The USB audio is because on my last Cardinal laptop, a Dell, the solder on the audio card and audio jack was defective which caused the audio to fail. Since I only plan on using headphones and a microphone when playing in a different room from Becky, I’ll plug the audio adapter into a USB hub (a poor man’s docking station) and use it that way.

The afternoon after I ordered my laptop, Arnold’s eye started weeping. He apparently developed glaucoma in his right eye, the feline iris melanoma finally progressing to the point where, during our vet trip on Thursday afternoon, Dr. Wrycha recommended enucleation. I dropped Arnold off at the vet for surgery this morning: he gets the last of the tax refund money and all of the pet savings account for his medical care. Arnold spent the weekend feeling no pain as I’ve kept him doped up on Torbugesic syrup, 1.0 cc’s every twelve hours.

102.JPG

Brody and Rose are getting alone. While Becky and I played online games, Rose babysat Brody.

Rose and Brody

Brody is a very sweet, cuddly dog. He’s going to be a total nightmare when he gets to be a “teen” in three months or so.

093.JPG

Laying the groundwork

Posted by Chris Jones
On January 4th, 2008 at 15:37

Permalink | Trackback | Links In |

Comments Off on Laying the groundwork
Posted in Python, Tech

I’ve previously identified a few elements that are needed to make a successful web based application. Since then, I’ve been prototyping, designing, coding on the bus and while making dinner, and have a pared down, minimal proof of concept for a few of those.

  • XMLHttpRequest: I’ve verified XMLHttpRequest works with my wife’s iPhone. I expected it to, but had to make sure. This is the core Javascript call for dynamic web pages that retrieve content from servers.
  • Timer: I still need to verify this works as expected on the iPhone, but I have a demo page to verify it ready.

In addition to the front end work (of which there will be much, much more), I needed a back-end that I could develop actively. My platform choices were limited in that it needs to work on a Dreamhost shared server, work on my desktop at home, and also on my laptop for the bus or coding around the house. Tomcat had to be discarded: I’d need to set up a separate Tomcat server and Java environment at Dreamhost. Perl was discarded as I really don’t appreciate the language. 🙂 I strongly considered PHP but decided against it in the end. Ruby was also considered but I didn’t want to learn a new language while coding a new app. I toyed with using Lua. In the end, I decided on Python 2.4 so I don’t have to do any gymnastics at Dreamhost. As far as my scripts are concerned, it’s a one-line change between platforms:

#!/Python24/pythonw for Win32
#!/usr/bin/python for Linux

I have a working Python back-end that gives me a minimum of helper objects for working with HTTP requests in a CGI environment. (No WSGI here, at least not yet.) I have room to plug in different request interpreters and a complete world engine or whatever might strike my fancy as long as I keep this minimal interface in place.

Now, nobody said I had to produce anything pretty when proving this works…

Try out my first proof of concept

I’d like my next proof of concept to be an interactive “game” or other social, multi-user activity.

Band aids? Upfront process and design are better

Posted by Chris Jones
On December 29th, 2007 at 10:37

Permalink | Trackback | Links In |

Comments Off on Band aids? Upfront process and design are better
Posted in Design Journal, Tech

From Zubon of Kill Ten Rats:

Fixing the fundamental only gets worse once you already have a dozen band-aids on the wound. You must tear them all off and throw them away. But at least you get to do all those things you wanted to do if you had it to do over again.

And this is why we Unit Test.

Games that ship and have few bugs have well developed and scrupulously followed development processes. Games with bugs just get shoved out the door because scope creep and featuritis are given more importance than good project management. And for one-off, traditional single-player games, it wasn’t so bad, especially when the game developers were also designers and a four person development team was big. Check out High Moon Studios’ “Day in the Life” seminal article on SCRUM and Unit Testing a modern console game.

An MMO is more like a corporate ERP system than a Pac-Man or Tetris clone, and cutting corners to hit deadlines or out of sheer laziness (and believe me, programmers are lazy–it’s a virtue) helps create emergent behavior or bugs. Strong, comprehensive Unit Testing at the cost of adding dubious features to still meet the development schedule is the best defense against this. The Unit Test becomes a kind of document, an artifact that demonstrates how the developer believed the code was to be invoked and what it should return, and future changes against the code can be verified with execution against the entire suite of Unit Tests. The designer, developer, and producer will sleep well at night knowing that the vision has been translated to code or scripts accurately.
(more…)

Mockup in progress

Posted by Chris Jones
On December 28th, 2007 at 17:49

Permalink | Trackback | Links In |

Comments Off on Mockup in progress
Posted in Design Journal, Tech

Demo in progressAn iPhone web app mockup

Supposedly (I’ll have to test this at home) it’ll display without the iPhone graphic framing the content on a real iPhone. I’m not sure that I understand logic in CSS files well enough to guarantee that.

Does anyone have a lead on good tilesets for demos or mockups, game oriented (I don’t care about the theme, as long as people look distinctive and there’s a little bit of furniture or props available), around 20×20 pixels? I don’t want to make a smiley demo.

Note that I don’t have any of the Javascript hooked up for this, and I’ve only tested it under Firefox (so far).

Edit: The media tag didn’t work as I needed it to–I could restructure the CSS and probably fix it under the iPhone so that the fake iPhone frame won’t show up. Internet Explorer 6, on the other hand, can’t render it properly in any case: problems with DIV tags, or so it looks.

Designing for the iPhone could be a full time job

Posted by Chris Jones
On December 28th, 2007 at 12:36

Permalink | Trackback | Links In |

Comments Off on Designing for the iPhone could be a full time job
Posted in Design Journal, Tech

Check out Apple’s iPhone Safari Web Content guidelines (PDF, 6.1 MB) for some ideas about why iPhone web page development is different from typical web page development. A lot is the same: CSS, layout and positioning, XHTML and standards, etc. Some is different, like a META tag that defines the viewport size. And some new page events are generated, like onorientationchange–and there’s a hell of a lot you simply can’t do. It makes you, as a web application designer or developer, think hard about the interactions you plan on using and consider if they’re necessary or other ways that they can be done. And as a web app developer, you’re suddenly thinking about minimizing content sizes again and keeping an entire page under 30 MB, stripping unnecessary whitespace, and optimizing for a relatively slow 100 Kbps EDGE connection with 500 ms latency (since your users won’t always be using WiFi).

onorientationchange is going to require an additional 30% or more work for designing the page layout.

Here’s a thought for budding iPhone web app developers to mull on:

The finger and tap interface isn't the same as using a mouse