Archive for the 'Windows' Category

Waterproof USB Drive(s)

OK, I’ve been a little slow in posting this. Chalk it up to classwork and laziness. Sorry.

Project Background

Anyway, the back story for this project is; about 3 years ago, my daughter (around 6 at the time) accidentally spilled a cup of coffee (no she wasn’t drinking it!) onto a brand new Seagate 5GB USB 2.0 Pocket Hard Drive. I had set a cup of coffee down next to the new drive on the coffee table, and needed to go back into the kitchen for something. I specifically warned her to be careful not to bump the coffee or the table because I didn’t want my coffee spilled. Well, that must have triggered some inborn child-instinct that says “be extremely reckless when told to be careful.”

At any rate, the coffee got spilled and I got a chance to get a look at the internals of my new drive while I was drying it out. While doing this, I got to thinking about how small the microdrive was and how it could fit into a lot of different casings. Of course, I was also thinking of how to better protect it from liquid damage and how I had so many - now less useful, smaller capacity - thumb drives laying around.

I thought that if I could get a small enough USB hub that I could fit that inside a piece of PVC or other sealable container and plug the thumb drives into it. With my new drive back together, dry and ready to go, that’s just what I did! After all I had to figure something out to do with all those old thumb drives!

Materials and Build

wp_usb_hubI got a USB hub and some other pieces and started to work. Of course, all these parts took quite some time to gather. I managed to get a few left over parts from work (sealable caps from network connectors) and ordered a USB-B jack for plugging in a USB-A to USB-B cable into. I could have easily gotten a smaller, mini-USB connector and cable assembly, but my soldering skills are not that hot.

wp_usb_hubwp_usb_hubwp_usb_hubwp_usb_hub

I ordered a 4-port USB hub (to give you some idea of how old this project is, I bought the hub on ThinkGeek and they no longer carry the hub I bought) which had two stacked 2-port USB-A jacks. I also needed some plastic resin to seal the USB jack. I used a 2″ PVC compression coupling as a housing and a couple of 2″ long PVC pipe sections as end pieces.

wp_usb_hubwp_usb_hubwp_usb_hubwp_usb_hubwp_usb_hubwp_usb_hubwp_usb_hubwp_usb_hub

I removed most of the housing and USB cable from the hub and replaced the USB plug on the cable with the jack I’d gotten. Then I sealed the jack inside the PVC pipe with the plastic resin. Before I did that however, I needed to close the back of the USB jack with a glue stick gun to keep the resin from filling the jack and making it useless. I still ended up getting some inside, but it wasn’t much as I can still insert the USB plug into it.

wp_usb_hubwp_usb_hub

In order to get all the thumb drives into the tube, I had to strip the housings from them. I used a thin piece of plastic to separate the drives and keep them from performing their own circuit bending operations on any of my data. I had to scrape some tracks into the inside of the compression fitting in order to get the hub’s circuit board in all the way. The other end of the tube was going to hold another USB-A jack, to be used as a kind of feed through USB port, but as it turns out, I didn’t fill the back of that connector correctly and the resin filled the jack. In any event I don’t think the cable connecting the 4th USB port to that jack would have allowed the hub to fit in far enough to fit along with all the drives. So it’s probably better that I just used it for a 4th thumb drive anyway.

wp_usb_hubwp_usb_hubwp_usb_hubwp_usb_hubwp_usb_hub

The Cable

wp_usb_hubwp_usb_hubwp_usb_hubI also used a piece of conduit as a cable keeper, so that my USB cable doesn’t get tangled with other cables when in transit. I use this trick, albeit with a shorter section of larger diameter conduit, with my laptop cords too. I slit the conduit or take a ¼” strip longitudinally out of the center (depending on rigidity), neatly bundle the cables (folding in half 3 - 4 times), insert into conduit, and viola - instant portable cable minder.

Software

Well all this is well and good, but there’s a problem I didn’t foresee. That would be what a pain in the but this is to unmount all these devices on Windows. With a GNU/Linux system, you simply right a script to unmount the drives all at once (and presumably put that on one of the USB drives), Windows on the other hand, sucks for this kind of functionality. But there is a half-assed solution to the half-assed situation I’ve put myself in. The command:

mountvol X: /d

Where “X” = your thumb drives’ drive letter, works to safely unmount the volume under Windows (thanks and attribution to Joel on Software), but doesn’t solve disconnecting Windows from the device (you still have the little “Safely Remove Hardware” icon on your system tray). So you need the DevCon tool available here. Now you can use the mountvol command and:

devcon remove @usb\*

Conclusion

Hot, no? Actually yes, this set up does get pretty hot after a while. I guess that’s a drawback of having this in a sealed container. Another drawback, I’ll never be able to take this on an airplane… :(

If you’re looking for something to do with all those old USB drives that are getting exponentially smaller with every passing day, then this might be a solution for what to do with your old drives. But I think the next time I do this, I’ll use the left over clear resin and do something a little more slick, like Russell Jones, and encase the whole shebang in a clear plastic block.

HowTo - Make Your Own WebApp

This is just a quick howto on making your own WebRunner/Prism webapp file. This is a very simple process and shouldn’t take more than a few minutes of your time. There are a couple of tools you need however, to get started.

  • a file archiver - my favorite is 7-zip, but you can just as easily use any archiving program that is compatible with zip files
  • a text plain text editor

For more advanced webapps, a more advanced context highlighting text editor can be helpful for coding custom style sheets or adding javascript customizations. And don’t forget icons! I use a combination of Paint.Net and @icon sushi (which covers everything but MacOS, which is because I can’t seem to find software for Linux or Windows to accommodate icons for it - recommendations anyone?).

The No “.webapp” WebApp

There are several ways to open webpages with Prism or WebRunner. The first and easiest is to install Prism, then create a link to it on your desktop. Then change that link adding the option “-uri” and the url of the page you want to open. Here are two examples:

Windows:
c:\your\path\to_prism\prism.exe -uri http://web_url_of_site c:\your\path\to_prism\prism.exe -uri c:\location\of\local_file

GNU/Linux:
/your/path/to_prism/prism -uri http://web_url_of_site /your/path/to_prism/prism -uri /location/of/local_file

This method does not require a webapp file, it just launches the website or file you specify. This means, no icons are required, but you also don’t get to add any custom themes or js files. This would be a really good method to use with applications like Wiki on a Stick (woas).

WebApp Bundles

The second method is also pretty straight forward (until you make it complex by adding more functionality). For the most basic webApp bundle you only need to create one file; the webapp.ini. Here’s the content from the example webapp.ini on the Prism wiki:

[Parameters] id=unique-app-id@unique-author-id.whatever uri=http://[the-url-what-you-want-to-connect-to]/ status=yes location=no sidebar=no navigation=no

The “id” parameter is required to be unique. I’ve been using my website’s url (as most others have done as well) preceded by the name of the site, but any unique identifier will work. The “uri” parameter is required and will accept both url of the target website as well as local file paths. Everything after that appears to be optional and the values show are the defaults. These remaining parameters are options to tell Prism whether or not to show certain GUI elements (”status” = status bar;”location” = address bar;”sidebar” = sidebar;”navigation” = well, quite frankly, I have no idea - maybe navigation buttons that haven’t been implemented yet?).

The next step after saving your changes to this document, is to use your archiving program to zip up this file creating, as an example, “your_webapp.zip”. Replace the “zip” extension with “webapp” and you’re ready to roll! Now either double click the webapp file or you can launch the webapp from the command line thusly:

Windows:
c:\your\path\to_prism\prism.exe -webapp your_webapp_bundle

GNU/Linux:
/your/path/to_prism/prism -webapp your_webapp_bundle

For more advanced webapps you can add icons, scripting and style sheet support (see the Prism page for more details).

Happy coding!

Prism
Prism/WebApp Bundle
Prism/Scripting
Prism/Styling
7-Zip
Paint.Net
@icon sushi
Wiki on a Stick

WebRunner now Prism, Whatever - Here’s How To Make An Extension Compatible With At Least One…

UPDATE AGAIN! 080611
I’ve made a new post on this subject cause it’s easier to update by adding new posts instead of updating this one. Enjoy!

Update!!
Had to add a comment to the replacement code below in order for this to work.

080404 Update!!
Yet again, code changes for new versions and what not.

Looks like Mozilla has added WebRunner to it’s Mozilla Labs line up and changed the name to Prism. From what they say, it’s going to be a cross between an open version of Adobe Air and Microsoft Silverlight and a localized lancher for web applications. Which, by my definition, is what utility computing is supposed to be like. Prism is currently for Windows only (they’d better hurry up with a Linux version), but it runs the same webapp files and also has added style sheet support - among other things - so you can style your webapps your way.

Anyway, I’ve been kind of discouraged by the lack of extension availability for WebRunner (and XulRunner for that matter). You’ll find in another of my posts a webapp for accessing the WebRunner extensions panel. Using this webapp, you can add new extensions (by installing or dropping them onto the panel), but at this point, adding extensions will fail because the version checking mechanism for WebRunner/XulRunner. To get around that, you need to change the extension’s compatibility information. These instructions will not work for every extension and your results will vary…

I recommend you find a smaller extension, download it and make the following changes:

  1. Open the extension package (you can open it with 7-zip, ALzip, Winzip or any other archive program that works with zip files.
  2. Extract and open the install.rdf with a text editor, I’d recommend Wordpad if your using windows.
  3. Locate and change the following or something that looks like the following (this will vary by extension, but look for the Firefox description section - and you may find that you have to remove all references to all other Mozilla programs that the extension is compatible with for this to work):

<!--Firefox--> <RDF:Description RDF:about="rdf:#$djS7s" em:id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}" em:minVersion="0.8" em:maxVersion="2.0.0.*" />

To:

<!--Webrunner-->
<RDF:Description RDF:about="webrunner" em:id="webrunner@webapps.org" em:minVersion="0.1" em:maxVersion="10.0" />

or (again it will depend on which way the developer implemented the Firefox description):

<em:targetApplication> <!--Webrunner--> <Description> <em:id>webrunner@webapps.org</em:id> <em:minVersion>0.1</em:minVersion> <em:maxVersion>10.0</em:maxVersion> </Description> </em:targetApplication>

If you’re using Prism, change to the following:

<RDF:Description RDF:about="prism" em:id="prism@developer.mozilla.org" em:minVersion="0.1" em:maxVersion="10.0" />

or

&lt;em:targetApplication&gt; &lt;Description&gt; <code>&lt;!--Prism--&gt;
<em:id>prism@developer.mozilla.org</em:id>
<em:minVersion>0.1</em:minVersion>
<em:maxVersion>10.0</em:maxVersion>
</Description>
</em:targetApplication>

4. Then save the rdf file and add it back into the xpi archive.
5. You should be ready to install the extension using the Extensions.webapp

I found this parts of this bit of magic on Alex Sirota’s website along with the tip to check in the applicaiton.ini file for any XulRunner application’s ID. If you run into errors, then something is probably malformed in the rdf file so check that first. I won’t be much help in trouble shooting, and I’m not about to offer support for other peoples extensions on an unsupported application, but if you have problems, post a comment and I’ll give editing the rdf a go myself.