Thursday, July 23, 2009
Flash/SSD drive comparison
This is a totally unscientific comparison of two drives, one is a Solid State Drive which works both as internal or external USB/SATA, and a traditional "keychain" flash drive, both have the same capacity of 32GB and formatted as FAT32.
Name | bought | for | Read | Write |
Cavalry Pelican 32GB ssd | Dec'08 | $80 | 28.42 | 21.81 |
Kingston 32GB DataTraveler 120 USB Flash Drive | July'09 | $62 | 16.26 | 11.93 |
Read/Write speed is given in MB/s. 1 MB = 1048576 bytes.
Conclusion:
- SSD is roughly 75% faster;
- In both instances, reading speed is about 33% faster than writing speed.
Labels: hardware
Wednesday, July 22, 2009
Inline JavaScript
I write a lot of Web Interfaces in Python. Occasionally generated Web pages are using moderately complicated JavaScript code. In this situation, you can do one of two things:
- Insert JavaScript code in Python source as a (multi-line) string;
- Use a separate JavaScript file.
First approach is a good one when there are relatively few lines of JavaScript code, while second approach makes sense if this stand-alone file could be re-used.
However, neither approach works if JavaScript logic is complicated but current page-specific.
A possible alternative is to keep JavaScript in a separate source file in the depository, but embed a copy of it into python files immediately before check-in.
This solution could be used directly, or combined with some JavaScript compression and/or obfuscation technology.
First, about compression and obfuscation.
I found it most productive to use combination of two separate tools: a popular compression tool JSMin (available in 10 different languages, I am using Python version) and ShrinkSafe, an obfuscation/compression tool written in Java.
Provided that you have SUN java available, js.jar (Rhino “JavaScript in pure Java” engine from Mozilla) is somewhere in you CLASSPATH, and jsmin.py is in PATH, the complete process looks like that:
java -jar <path>/shrinksafe.jar <original>.js | jsmin.py > <new>.js
Next step is to use a Python utility jsprocess.py which I wrote. It is reading a list of Python input files and is looking for all calls to the utility inline_js() (which must not exists other than version created by a previous run of jsprocess.py). For very call which looks like inline_js ("file_name.js"), e.g.
fh.write ( inline_js("docform.js") )
it will append to the end of the file definition of inline_js() which embeds compressed/obfuscated copy of "docform.js". If function inline_js() is already defined (anywhere), it will be replaced.
Labels: development, javascript, python
Tuesday, July 14, 2009
UbuntuOne
My number finally came up, I was able to register for new revolutionary file sharing service by Ubuntu Team called UbuntuOne. The service is still in closed-beta; see some reviews here, here and here.
(There isn’t much information (currently) on the official site, other than installation instructions, mailing list and bugs database)
This is a potentially brilliant idea, because it gives people a convenient way to support financially their favorite distribution, and with solid financial support this could become a reliable backup solution. Correct, there may be cheaper options available on the market, but you never know how long they’ll last (Streamload being a good example of that)
On the other hand, as of right now the service is hardly usable.
- It is clearly inferior compared to the popular (among Linux crowd) DropBox service, which provided 5 times more of paid storage, supports versions, has be better UI (web-based and client-side) and is compatible with every modern Linux distributions, Windows and Mac;
- It is still very buggy and incomplete. For example, when I added a file through Web UI, it never showed up in my Ubuntu folder, though synchronization the other way around worked fine;
- There are also browser-compatibility issues, e.g. with Google Chrome;
- Is this service supposed to be open source? I could not find any reference to the server source code anywhere, nor to any plans for future client-side API.
Mailing list appears to be relatively low-volume, and I am not sure many people are actually using this – which, given the modest, at best, progress of development and plenty of competitors, does not promise a bright future for this project any time soon, in my opinion.
But, whatever this is going to turn out, the idea was really a good one.
Labels: internet, linux, Ubuntu, web-services
Monday, July 13, 2009
Skype Web Services
Apparently, if you installed latest Skype 4.1, it is advisable to go to Control Panel => Add or Remove Programs and remove something which is called "Skype Web Services".
This will save you from some unnecessary authorization requests, communication failure messages, and slow down of Internet Explorer, and should also clean up a mysterious "skypenames.exe" executable.
For some background info, see this thread.