10. februar 2012
After being annoyed for the last year that my MacBook Pro was eating up my battery life while in hibernation, I finally chose to investigate the matter further. Several articles describe the pmset command (here is one), but to make a long story short I wrote a script that will let my Mac enter hibernation mode (suspend to disk) immediately, without altering the settings (permanently at least).
I uploaded it to pastebin to increase the chances of it being spread. Link.
It should be pretty self explanatory, but to sum it up it does the following:
- Back up your existing hibernation settings
- Sets new ones that will suspend to disk and then cut power (not keeping any power to RAM)
- Hibernates (and shuts off)
- On power on, it restores the previous settings
If you find it useful, drop me a comment. Maybe I could make this into a small systray utility some day if someone finds it useful.
Legg igjen en kommentar » |
Beep-beep, Progging | Tagget: battery, battery life, hibernate, hibernation, mac, os x, power, power management, standby, suspend |
Permalink
Sendt av Carl-Erik
14. desember 2011
I often have to resort to tcpdump to debug the input and output to production services consuming SOAP messages. The problem with tcpdump is that the ASCII output is littered with binary garbage at the start, and this makes it a rather laborious thing to clean up. The following article is a description of some scripts, along with the source code, that cleans up the output. Les resten av dette innlegget »
Legg igjen en kommentar » |
Linux, Progging, Programmer | Tagget: commandline, dump, filtering, Linux, osx, python, regex, sed, soap, tcp, tcpdump, xml |
Permalink
Sendt av Carl-Erik
14. desember 2011
This is a brief code snippet showing how to use command line tools to count the occurences of words matching a regex. In the following example, I am trying to list all the unique hits on the urls from the apache access log matching “/chart”. Les resten av dette innlegget »
Legg igjen en kommentar » |
Progging | Tagget: bsd, commandline, cygwin, gnu, Linux, osx, regex, sed, unique |
Permalink
Sendt av Carl-Erik
10. november 2011
In the process of removing PMD warnings from our main product at work I was trying to automate some parts of this process by using sed (Stream EDitor), a command line program common on all Unices (such as OS X and Linux). I had already been using a regex in Vim to do remove final modifiers from methods on a file by file basis, but thought it might be quicker to do this using “find” and “sed” in stead. Boy was I wrong
But mainly just because of the different regex dialect of sed that took me a long time to figure out.
The problem was mainly due to trying to match square brackets, such as in “final public int[] myMethod(int[] args)”. Les resten av dette innlegget »
Legg igjen en kommentar » |
Beep-beep, Linux, Progging |
Permalink
Sendt av Carl-Erik
2. november 2011
Have you specified file.encoding as a parameter to the JVM, but ended up getting an unexpected startup exception instead? Here is what caused it and how to fix it.
Les resten av dette innlegget »
Legg igjen en kommentar » |
Beep-beep, Progging | Tagget: bug, charsets, file.encoding, glassfish, grails, java, jvm, utf-8 |
Permalink
Sendt av Carl-Erik
6. oktober 2011

Var på en fin visning av Hansen i Norwegian Rains/T. Michaels lokaler i dag. Hansen (ved sjefsdesigner Åse Helen Hansen) har en karakteristisk stil som føles veldig dansk; naturmaterialer, god kvalitet, ikke strengt, men deilig og ledig å ha på. Kanskje en effekt av flere års utlendighet i Danmark? Det skal sies at Åse er ekte bergenser – på lik linje med Silje og Aleksander som driver butikken i Kirkegata – en butikk som er det nærmeste man kommer bergensbølgen i tekstilform. (Aleksander Helle har faktisk leflet med tanken på å utvide butikken til en showcase for noe mer enn bare bergenske tekstiler. Kanskje et eget Tellé Records-hjørne ville gjort seg?)
Klær produsert med ull fra Gudbrandsdalen eller restpartier av engelsk høykvalitets tweed fra en ære som lengst er forbi blir naturligvis ikke billig. På den annen side er mange av klærne nærmest for investeringer å regne; kvaliteten er så god at man kan regne med å ha dem i år etter år. I samtale med Åses danske kjæreste om hvordan virkelig gode klær blir ens favorittøy med tiden, kom det utsagnet som fikk synapsene mine til å fyre av som et fyrverkeri:
Det er viktig at (…) sjelen må få tid til å flytte inn i klærne.
Jeg likte det så godt at jeg bare måtte få det ut – noe dette innlegget bare er en dårlig unnskyldning for
Legg igjen en kommentar » |
Brød og sirkus, Kulturmelk |
Permalink
Sendt av Carl-Erik
5. oktober 2011
We had TDD guru Johannes Brodwall deliver a workshop on TDD and refactoring for my company last Friday, and that prompted me to (yet again) try to get Infinitest working in IntelliJ. Today I managed to get it working, but it was certainly not thanks to the non-existing documentation!
The key missing part of getting it working after installing the plugin through the IntelliJ plugin wizard is to enable the Infinitest facet for your project. Right click on the project, choose facet, add Infinitest and voila! You now have a new tab called Infinitest.
Legg igjen en kommentar » |
Beep-beep, Progging, Uncategorized | Tagget: continuous integration, continuous testing, howto, infinitest, intellij, jbrodwall, johannes brodwall, plugin, tdd |
Permalink
Sendt av Carl-Erik
29. september 2011
Due to some restrictions at work, we need to install software via USB and not by direct download. The problem is that when trying to get the Chrome Offline Installer it seems virtually impossible to download it for another os.
There are links for other operating systems, but these lead to the online installers. Duh! Fortunately I found a trick by looking at the URL generated for the online installer, where I saw that two parameter that could be used to select the right version:
platform and hl.
Example url: http://www.google.com/chrome/eula.html?standalone=1&platform=win&hl=no
The url above would select a standalone (offline) installer for Windows where the language version would be Norwegian. Cool,huh?
Platform choices are: “mac”, “win” and “linux
Legg igjen en kommentar » |
Uncategorized | Tagget: chrome, fix, hack, language choice, offline installer, other os |
Permalink
Sendt av Carl-Erik
14. september 2011
I recently lost my iPhone and so I was back to my trusty, old Sony Ericsson C702. Far from fancy, but it works and I can use it for far longer than I ever could with my iPhone without charging. But I sometimes need on-the-road access to the internet, and now I kneed to do that using C702, which is what this post concerns. Les resten av dette innlegget »
Legg igjen en kommentar » |
Uncategorized | Tagget: apple support, bluetooth, bluetooth setup assistant, bt, c702, dial-up, error, modem, osx, pan, sec702, snow leopard, sony ericsson |
Permalink
Sendt av Carl-Erik
6. september 2011
At times my server gets a new ip from my router, thus rendering my hosts file invalid and generally making life less pleasant. So in order to get contact with the server again, I need to get the IP. This is where nmblookup comes in.
Simply type
nmblookup name-of-the-machine
(where name-of-the-machine obviously is the samba configured name) will pop out a result like this
querying name-of-the-machine on 192.168.10.0
192.168.10.114
Legg igjen en kommentar » |
Beep-beep | Tagget: Linux, netbios, nmb, osx, samba, smb, Windows |
Permalink
Sendt av Carl-Erik