Categories

Useful tidbits

During my day to day work I often stumble upon problems I’ve not encountered before. Usually I find solutions quickly, either by thrawling manual pages (oh ‘man’ how I love thee), StackOverflow or Google. When I discover good solutions I think to myself “must remember to share this with someone”, and then I forget all about it. This post is my attempt at rectifying that.

The things I will present are fairly trivial in themselves, and may very well be available through documentation, but have some aspect that I find worth noting. We’ll start off easy.

Cancel CouchDB replication

Today I needed to cancel one of the replications that were running between two couchdb-instances. The manual tells you that you can restart the couchdb server, since that clears the list of replication jobs. I wanted to leave the other replications running and just kill the one I really needed to die.

If you read the documentation on replication you will learn how easy it is to do it using curl.

1
2
3
4
5
curl \
-X POST \
-H 'Content-Type: application/json' \
-d '{"source":"mydb","target":"http://mytargethost.com:5984/mydb/", "cancel": true}' \
http://mysourcehost.com:5984/_replicate

The only problem is that this will not do anything if it is set up to be a continuous replication. To cancel a running continuous replication you have to explicity tell CouchDB that “yeah, I know what I am doing, I really do want to cancel thins continuous replication”. Like so;

1
2
3
4
5
curl \
-X POST \
-H 'Content-Type: application/json' \
-d '{"source":"mydb","target":"http://mytargethost.com:5984/mydb/", "continuous":true, "cancel": true}' \
http://mysourcehost.com:5984/_replicate

Do you see the difference? I added “continuous”:true to the json structure. That’s really all there is to it!

Stay tuned for more of these. I’ll try to update on a day to day basis.

Lemon cheesecake with physalis and jelly topping

Yesterday I made a very nice cheesecake that I thought I should share with the world. Well, the recipe that is. The cake disappeared as by magic. ;)

I started with this excellent recipe: Helt Vilt – Ostekake . It’s in Norwegian so if you’re not a native try Google translate.

The first thing I changed was the order in which I made the layers. I started with the bottom and worked my way up. ‘Why?’ you ask?  Because I only have those springform cakepans. The thing with those is that they are 100% unable to hold liquid inside. So if you follow the recipe and pour the jelly in the bottom (to make the top) then you will have some cleaning to do pretty soon.

So start from the bottom if you have a springform. I blended the biscuits  and poured the melted butter in and put it in the fridge. Let it sit there until cool and firm.

Make the cheese filling and pour over. Smooth out with a spatula or other similar tool. I have discovered that when working with semi-solids like this cheese filling you would do much like you do with concrete to make it smooth. Apply gentle strokes and vibrations and the filling (or concrete) will do the rest of the job for you, suddenly transforming into a nice smooth surface. Pop it in the fridge again until firm. I let it sit there for a couple of hours. Remember, you should rather leave it in too long than too short.

When I took it out of the fridge came my second alteration of the recipe. I made 1.5mm thick slices of Physalis and made a layer that covered the cheese filling. Only one slice thick though. Don’t bother laying it out in a fancy pattern like I did. You’ll just (like I did) discover that the darn things float pretty darn well. Oh and one more thing: do not apply jelly until the liquid is maximum at room temperature!

If you do indeed want a fancy pattern then first apply a very thin layer of jelly on top of the cheese filling before you add the physalis slices. This only works if the cheese filling is smooth and level AND the surface on which the cake is resting is level. When I say thin I mean about 1/3 of the thickness of the slices. Wait a couple of minutes and gently place the physalis slices into the jelly however you want. Let it sit in the fridge for a couple of minutes until it’s become more solid. You can then take it out from the fridge and apply however much jelly you want without the darn things floating up.

Pop the whole thing into the fridge again and let it sit until the jelly is all solid. And again; you should rather wait too long that too short. Cover it with something and let it sit over night for example. Why cover it? That’s because you do not want the other things you have in your fridge to “contaminate” your treat with the wrong scents.

So that’s it. One delicious cake all done. Sorry for not posting any pictures. It got eaten too quickly. I’ll try to be quicker the next time around.

Tip Of The Day: Rescan faces in Picasa 3

Picasa is a wonderful application, it really is. The feature that lets you scan for face in pictures and tag people is simply put brilliant. It has worked much better than what I expected. However, like everything else, it has some flaws.

When you start the initial scan the application will hog whatever resources your machine has available (at least on single/low-core machines). This is not a bad thing, and not the problem which I encountered. The problem is actually related to the developers solution to the resource-hogging. If you start messing around in the program while the scan is running, then the program will in fact queue / pause or simply cancel the running job (so you will have a snappy, not laggy interface), never to resume it again. At least this is what I assume from observing the behavior of the application.

The result of this is that everything is seemingly fine, and you have gotten a lot of faces to tag with names. What you do not get any indication of is how many of the pictures were scanned. When you discover that not all of the pictures were scanned it’s natural to ask the question “Where is the ‘rescan for new faces’-button?”. The short answer is; “There is none!”. At least not as of this writing.

There is however a solution to the problem. Go to “Tools”->”Folder Manager”, highlight the topmost directory that contains pictures / folders of pictures and click the option “Face detection” from “On” to “Off” then back to “On” again. When you then click “Ok” the application should start scanning again. At this point you should go grab a cold one, write a note to your spouse so he / she does not disturb it and go do something else. It’ll take it’s time to complete. Do NOT click “Ok” before you have switched the “Face detection”-option back to “On”. If you press “Ok” while it is “Off” then Picasa will forget everyone you have already tagged and you’ll have to tag everyone again.

Oh, and dear Picasa developers: please make it so that Picasa can use more resources while performing these tasks. Here it’s using only one core, and very little available disc-bandwidth. It’s got 7 idle cores, 6 GB ram not being used for anything and a disc that’s screaming to be utilized. You could provide a configuration-parameter / slider that indicates how much of the available ‘juice’ it can use: “Please be gentle…” -> “You think you can take me?” -> “USE ME BABY! USE ME!”

I’l let you decide on the labels. ;)

Getting contacts from old phone into a Google account on Android

I recently decided it was about time to replace my old phone with some new and shiny gizmo. The choice fell on the HTC Desire. It is a very slick device with capabilities and a level of freedom that far exceeds other similar devices I have considered.

I set out to have the contacts from my old phone transferred to the new one and placed in my Google Contacts account so I would have access to them from other devices and on my desktop computers.

In the new phone I had configured my Google account and things seemed to work. Calendar synced along with a few test-contacts I had created online. I then started the work on getting the old contacts imported.

That part was also fairly easy. Activated Bluetooth on both devices and hit the send button. Contacts appeared in the Desire and all seemed well. At least until I discovered that the new contacts were not synchronized to Google.

After some poking around in the menus I discovered that you get to choose where to store a contact when creating one manually. The options were “Phone”, “SIM” and “Google Applications”. When choosing the latter, contacts appeared in the online contacts application.

I checked the imported contacts and found that all the ones I looked at were marked with “Phone”. So, how do you get them moved into the Google account? The interface provided no apparent simple way of doing what I wanted. Going through each and every one and changing where it was stored was simply out of the question.

My solution? Go into the contacts view and choose the “Import / Export” option. There I chose to export to the memorycard. I then deleted all contacts. Again into the “Import / Export” menu, but that time around I chose to import from memorycard. The program asked me where I wanted to save the contacts and I picked “Google Applications”.

When it was done importing the contacts were magically synchronized to my online Google account. Mission accomplished.

Also, this post was written on my new Desire. It does actually work very well. Though a nice old keyboard with solid tactile feedback beats a touchscreen hands down any day. That being said, HTC have done a great job with this phone.

Kontact & Google Calendar

Have you ever been annoyed at the fact that there has been no straightforward and easy way of having a two-way synchronization between Kontact and the perhaps biggest online calendaring-service Google Calendar? I certainly have. The good news is that the wait is now over. Kontact now talks to Google Calendar.

Historically you would have to go through the tedious steps of setting up GCalDaemon to read / write to a local iCal-file and have Kontact read / write to that again. I am not going to go into detail on the issues with the above approach. What I feel that I must say is even though it was cumbersome, error prone and generally not how I like things; it did work. Most of the time.

What we have now is a brand new KDE ( 4.3.2 here on my desktop ) which sport some pretty decent advances. One of these is Akonadi. Akonadi seeks to facilitate easy administration and utilization of various data sources for personal information, such as mail, contacts, calendaring, etc.

To get Google Calendar working in KDE you now need to install the “googledata” Akonadi resource. In Debian this is done by issuing the following command:

sudo aptitude install akonadi-kde-resource-googledata

After that you open Kontact and do the following:

  • Click [Calendar] in the sidebar (usually in the left hand side of the window)
  • In the resources view (field in bottom left corner) right-click and select “Add new resource”
  • Choose ‘Akonadi resource’ in the dialog that pops up
  • A new dialog will pop up. Here you should click “Edit calendar resources” (translations may vary)
  • Click ‘Add’ in the new dialog. Choose ‘Akonadi Google Calendar Resource’
  • Enter username and password when prompted
  • Press the ‘Close’-button
  • A new resource with a name similar to ‘akonadi_gcal_resource_X’ should now be visible
  • Select it and press ‘Synchronize folder’ to do an initial sync
  • Press the ‘Ok’-button to return to your calendar view

The items you have in your Google Calendar should now be present in Kontact.

I hope someone will find this helpful.

Wordpress and Twitter

At this point my twitter-account and my blog should be nicely tied together using a couple of very nifty plugins. I chose to use separate plugins for displaying latest tweets in the WordPress sidebar and posting on Twitter when I post something new here on the blog. I guess this will be a test of wether or not it is really working.

Check out the WordPress plugin directory for a lot of pretty decent Twitter-plugins. The two I landed on (after some trial and error) was the following:

Anyone else have something interesting to share about Twitter-plugins for WordPress?

Kudos: Petter Haukeland

So for a while I’ve been meaning to write a little something about people or things I have taken a liking to or been satisfied with from a consumer perspective. Up today is Petter Haukeland a naprapat and personal trainer at SATS Nesttun.

I contacted Petter because I wanted to gain weight. It may seem silly to a lot of you, but I do fit the stereotypical geek when it comes to being a bit on the scrawny side. So my goal was to increase mass, but do that in such a way that I do not get any injuries in muscles or joints and also do it in a manner where we focus on keeping the workout healthy.

Petter has a high level of attention to detail when it comes to how exercises are performed and perceives and corrects where it is needed. His knowledge about dietary things have also been very valuable. He has helped me to find the things to eat that will benefit me and my health the most when working out.

So, if you need to loose weight, gain weight, get rid of injuries or just need some advice on health; do contact him. It is well worth the expense. Thumbs up Petter!

Mantis and Subversion-integration

The last couple of years I’ve been using Mantis for issue-tracking and have been really pleased with it. It’s simple, does what it’s supposed to do and is simple enough that my customers can be given access and gain some feeling with what’s happening in the projects I’m running for them.

I have also been using Subversion for version control. I’m happy with that as well (was a nice step up from CVS). A very non-steep learning curve makes it a very nice tool even for people who have never user VC systems before. And yes, some of you will probably comment about how I should be using Git instead. To you I have this to say; git have it’s uses and is well suited for some things. For me and the way my business is structured though, Subversion is a better tool. But, that was not what this post was supposed to be about.

Ever since I started using Mantis I wanted to integrate it with Subversion so that when I write “Fixed issue #1234. A good description of whatever bug I fixed / feature I implemented.” then the corresponding issue in Mantis will be marked as ‘fixed’ automatically. I did that first in the 1.1.x-series of Mantis-releases and it worked well. By that I mean that once you had hacked on Mantis enough it would actually do what you wanted and all was good.

With the release of 1.2 the team behind Mantis gave us a plugin-system and we saw the emergence of a multitude of plugins for email-handling, extending various forms in Mantis, providing links to wiki-engines and integration with VC systems. In the latter category you find the Mantis Source Integration Plugin by John Reese. It’s a nice piece of work that makes it a LOT easier to get a link between Mantis and various VC systems.

If you want to get this set up then you should have a look at this post by Chris Dornfeld in addition to this post by John Reese. Just be mindful that the screenshots there are somewhat outdate. The plugin-page and configration looks a little different today, but it’s nothing you won’t figure out if you just use your head a little.

So, thanks to Chris and John for this.

Been a while…

To those of you who keep visiting and commenting on my posts; thank you. I really appreciate the feedback. I figure it’s about time I do my part now, and that is responding to what you’ve told me.

I have gotten a lot of feedback on my post about getting the MySQL-driver built for Qt on Windows (using MinGW). For some reason people are having difficulties getting the procedure I used to work, even though it has worked for me on several occasions.

This post is just to say that I’m about to start reworking the original article and see what it is I do (and have neglected to write down) that makes it work for me and not some people.

On a similar note; There will probably be a great deal more technical posts here now that things have calmed down a bit in my private life and I have time to actually sit down and write here.

Stay tuned.

Qt 4.5 and MySQL-plugin with Mingw on Windows XP

This is meant to be a quick howto / tutorial on how to setup a build-enviroment for C++ / Qt with Qt Creator ( Trolltech / Nokias new Qt IDE) where you use Mingw to compile your applications and have a MySQL-plugin available.

Continue reading Qt 4.5 and MySQL-plugin with Mingw on Windows XP