Scuttle Firefox extension
I use Scuttle on my server (for storing bookmarks). The beauty of the solution is that I have a centralized repository of bookmarks (which isn't too special considering that many services provide this feature) but in addition, it's very nicely set up to server as Live Bookmark lists in Firefox. So for example, I can have a single Live Bookmark drop-down for all work-related links, or all my "daily" websites or whatever and automatically add and remove from them as I see fit. The Live Bookmarks mean that all I need to do to reorganize links is retag them and it's instantly working on all the computers I have.
It's handy. But there's a problem. The Firefox extension for Scuttle isn't really being maintained. It's pretty simple but needed a new "max firefox version supported" string in the configuration. I've updated this and am now posting the unofficial 0.4.2 release of the Firefox Scuttle plugin with support for Firefox 3.5+.
Unicorns?
I don't know how many people reading this may know, but you can use Google as a calculator. Doing a search for "4 * pi" will in fact return a special "first result" that is the calculation. This is handy as it also does unit conversions like in order to convert 22 km to furlongs. There are some easter eggs though, and this is definitely the best: number of horns on a unicorn. Maybe it's just me, but this is incredibly funny to me.
I've been playing with the very impressive WolframAlpha and wondered if they had done anything similar. Sure enough "number of horns on a unicorn" return the expected result. Even more amusingly, my second guess, number of horns on a horse shows that they really having some fun:

C++ from Python
I was impressed today to see how easy it was to call a C++ DLL from Python. I got the following information from another site:
1. Create a file called dlltest.cpp and write a function that sums two numbers and returns the result:
//dlltest.cpp #define DLLEXPORT extern "C" __declspec(dllexport) DLLEXPORT int sum(int a, int b) { return a + b; }The extern "C" construct tells the compiler that the function is a C function. It also removes the decorations from the functions names in the DLL.
__declspec(dllexport) adds the export directive to the object file so you do not need to use a .def file.
2. Include the header of the function in dlltest.h://dlltest.h int sum(int, int);3. Create a new Dinamic-Link Library project and include the two files, compile, and create the DLL.
4. You can now use Dependency Walker to see the list of the exported functions. You should see here the sum function.
5. Move the DLL in the Python folder or use>>> import sys >>> sys.path.append(r"C:\path\of\dll")to include the DLL folder in the list of Python folders.
6. Use the ctypes module to access the DLL:
>>> from ctypes import * >>>mydll = cdll.dlltest >>> mydllNote: ctype module is already included from Python 2.5. If you are using an older version you can download ctypes here.
7. Now call the function:>>> sum = mydll.sum >>> sum <_FuncPtr object at 0x0097DBE8> >>> sum(5, 3) 8
Reposted from here... (Thanks!)
I need to get into Python more -- I've used Ruby a bit but have tended to ignore Python simply because I've not seen it is needed. Evidently, I need more side projects.
Google CTemplate
I just realized that I reinvented the wheel a month or so... I had a need for a nice templating language and although I did look for a solution that already existed, I didn't look hard enough. Google CTemplate is exactly what I wanted. My solution was basically to create this from scratch while ignoring all the complexities that I thought I wouldn't need. The result works (and may even be faster) but it feels clunky and it's not very flexible. You learn something new every day. Maybe with Rev2 of our release I'll start using this -- it certainly would be easier and the API is already documented.
From their website:
Here is a simple template file:
Hello {{NAME}},
You have just won ${{VALUE}}!
{{#IN_CA}}Well, ${{TAXED_VALUE}}, after taxes.{{/IN_CA}}Here is a C++ program to fill in the template, which we assume is stored in the file 'example.tpl':
#include <stdlib.h> #include <string> #include <iostream> #include <google/template.h> int main(int argc, char** argv) { google::TemplateDictionary dict("example"); dict.SetValue("NAME", "John Smith"); int winnings = rand() % 100000; dict.SetIntValue("VALUE", winnings); dict.SetFormattedValue("TAXED_VALUE", "%.2f", winnings * 0.83); // For now, assume everyone lives in CA. // (Try running the program with a 0 here instead!) if (1) { dict.ShowSection("IN_CA"); } google::Template* tpl = google::Template::GetTemplate("example.tpl", google::DO_NOT_STRIP); std::string output; tpl->Expand(&output, &dict); std::cout << output; return 0; }
So Pretty
It's truly amazing what beauty people can create. The Internet can be a fun place.
Wait for it to load and then move your cursor around and see what happens.
Because Perl is Too Straightforward…
...someone created Perligata.
Here's an example:
#! /usr/local/bin/perl -w use Lingua::Romana::Perligata; maximum inquementum tum biguttam egresso scribe. meo maximo vestibulo perlegamentum da. da duo tum maximum conscribementa meis listis. dum listis decapitamentum damentum nexto fac sic nextum tum novumversum scribe egresso. lista sic hoc recidementum nextum cis vannementa da listis. cis.
is equivalent to:
#! /usr/local/bin/perl -w print STDOUT 'maximum:'; my $maxim = <STDIN>; my (@list) = (2..$maxim); while ($next = shift @list) { print STDOUT $next, "\n"; @list = grep {$_ % $next} @list; }
No Way…
I think I actually got a snippet of Symbian code to work on the first attempt! This is a first... Maybe I'm actually getting the hang of this. I just find the whole "descriptor" concept very odd.
Anyway, all I was trying to do was replace all plus signs with spaces. I normally wrestle with descriptor nonsense for a while but this time, I got it on the first try!
_LIT(TestData, "THIS+IS+A+TEST"); HBufC* heapBuf = HBufC::NewLC(255); *heapBuf = TestData; TPtr pHeapBuf(heapBuf->Des()); while (heapBuf->Find(_L("+")) > 0) { pHeapBuf.Replace(heapBuf->Find(_L("+")), 1, _L(" ")); } CleanupStack::PopAndDestroy(heapBuf); //Don't forget!
Bleh... stupid Symbian. Thank goodness I didn't have to change the length of the descriptor...
Malaise
...not to be confused with mayonnaise (although both tend to ruin an otherwise tasty sandwich).
I've had a lot recently (again, malaise, not mayonnaise). There's a lot going on and I empathize with Alice:
"Well, in our country," said Alice, still panting a little, "you'd generally get to somewhere else — if you run very fast for a long time, as we've been doing."
"A slow sort of country!" said the Queen. "Now, here, you see, it takes all the running you can do, to keep in the same place. If you want to get somewhere else, you must run at least twice as fast as that!"
I'm way behind on reading, way behind on chores around the house (although I did finally wrap up my inspirational Plant Ledge Project). not keeping up with my supposedly rigorous exercise routine, behind on a huge bunch of personal geeky projects. Today I stayed home from work since I wasn't feeling so hot. I feel like I'm in continual deadlock as I analyze new tasks that I feel may be higher priority than my current tasks. There's no reason that I can't accomplish what I have in front of me, I just keep thinking that among the continual stream of tasks flowing at me, there might be a more critical task that I should immediately stick at the front of my queue. The problem is that except for very small tasks, almost all of my time is spent analyzing the incoming tasks. So even if I do identify the critical tasks and properly prioritize them, it doesn't really matter because unless a task can be done quickly, it will never actually have any opportunity to run despite its priority.
This causes feelings of guilt and malaise. Also, my cold doesn't help.
O’Reilly Books
I love almost all the O'Reilly books that I've read. The content is great. The style is readable. The quality is excellent.
I've heard of Safari Books Online over the last year or two and I've been thinking about it more recently. Safari Books offers unlimited access for $42.99/month to all the O'Reilly books. At first blush, it seems expensive. Yes, it's nice to be able to do a full-text search through a printed book that's sitting in front of you -- those "index" things in the back are so hard to use!
but at the same time, I don't typically enjoy reading things on the computer for extended periods if time.
...But I'm trying it anyway. My thought is that over the last 12 months I think I've spent at least $50/month on technical books. Most of them (all but 3 I think) have been O'Reilly.

Anybody reading this used Safari Books? Any opinions? I'll post my thoughts in the next week when I make the decision whether to keep the subscription or not.
Pictures used in this post are owned by O'Reilly.
