May 22nd, 2013
A client received a large collection of emails today, where the sender’s software had split the mail into several parts. Outlook / Exchange at our end did however not understand the scheme the user had used to split the files, so the mails arrived as separate entities in the mailbox.
Each mail was named in the same manner:
filename [1_3].dat
filename [2_3].dat
filename [3_3].dat
After saving the files by themselves, it became clear that the files contained a set of mime encoded files (separated by ------=_NextPart_) (I first attempted to decode one of the files by itself as base64, which failed).
To decode these files, I saved all the different parts of the .dat to a directory, then appended the files together with cat *.dat > merged.dat. At least we have a complete version of the attachment.
To extract the files from the attachment, use munpack – available in the mpack package under Ubuntu.
munpack merged.dat extracts all the files from the .dat to the current directory.
Tags: attachments, base64, dat, mpack, munpack, nextpart, outlook
Posted in Hacks | No Comments »
April 26th, 2013
Trying to build my first (or second, I tend to forget) Android project under NetBeans, I ran into an issue where the emulator would never show up when I tried to build the project. Turns out I even got a null pointer exception which I thought were generated somewhere else in NetBeans (next time: read the actual exception and don’t assume).
The solution to fix the emulator never showing up? Update the currently installed version of the JDK. (Thanks to a Stackoverflow thread for hinting in the correct direction) Remember that NetBeans might be tied to a particular version of the JDK (either in the command line arguments or in netbeans.conf in the etc/ directory of the NetBeans installation directory). I uninstalled any older version, which gave me an error about the value of jdkhome being wrong, and asking if I wanted to use the default path instead. That worked, but the error shows up each time. Comment out the jdkhome-line in netbeans.conf and it’ll guess automagically each time (if guessing works for you), or if guessing doesn’t work, add the new path to the JDK in netbeans.conf.
Tags: adk, android, emulator, mobile, nbandroid, netbeans
Posted in Android, Java | No Comments »
April 26th, 2013
This error may occur if you’re using sort=geodist() in your Solr Spatial / Geographic Search. The reason is probably that you have an empty pt= value or that the parameter is missing all together.
You might also want to make sure that your Solr version is new enough to support sorting by functions, but if you’re doing anything useful with spatial searches you’re probably updated enough – at least for geodist(). :-)
Tags: geodist, geographic, searching, Solr, spatial
Posted in Solr | No Comments »
April 13th, 2013
Trying to generate Murmur.php for the server component of Mumble (named Murmur (which is the only place I’ve ever encountered Ice)), slice2php gave the error:
/usr/share/slice/Murmur.ice:9: error: Can't open include file "Ice/SliceChecksumDict.ice"
#include
1 error in preprocessor.
To fix this I had to run slice2php with a -I statement, to tell it where to find the SliceChecksumDict file (which you can locate using locate or find or the packages search):
slice2php -I/usr/share/Ice-3.4.2/slice /usr/share/slice/Murmur.ice
Tags: ice, mumble, murmur, slice2php, Ubuntu
Posted in Hacks, Linux | No Comments »
April 13th, 2013
While apt-get upgrade-ing a server that apparently had bind9 installed, it barfed out complaining about something about sendmail. Weird, as sendmail isn’t installed (at least not any longer), but since sendmail isn’t installed, it couldn’t be removed either.
The solution: mv /etc/resolvconf/update-libc.d/sendmail /tmp — and run dpkg / apt-get / aptitude again. If it works now (and you don’t have sendmail installed either), delete the file from /tmp.
/etc/resolvconf/update-libc.d/sendmail: 7: .: Can't open /usr/share/sendmail/dynamic
run-parts: /etc/resolvconf/update-libc.d/sendmail exited with return code 2
run-parts: /etc/resolvconf/update.d/libc exited with return code 1
invoke-rc.d: initscript bind9, action "restart" failed.
dpkg: error processing bind9 (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
bind9
Posted in Linux, Ubuntu | No Comments »
April 5th, 2013
I have no idea why this happens. I have not been able to fix the underlying issue, but .. do you have photoshop open?
It turns out photoshop interrupts the alt+number keys globally, so even if you have putty open, changing windows with alt+<number key> won’t work. Closing photoshop makes everything work again.
Weird.
Tags: irssi, putty, Windows
Posted in Hacks, Windows | No Comments »
April 5th, 2013
After plugging in an unrelated USB device my built-in realtek sound card suddenly decided to go into low volume mode, where the output level was several levels below what it used to be. The mixer in Windows 7 shows the full volume for the application playing (Spotify in this case), but the volume output on the speakers was very low.
Go into the “Realtek HD Audio Manager” on the control panel, select “Speakers” and then “Default Format“. This had suddenly been set to 24 bit, switching it back to 16-bit 192KHz made the volume normal again. Unless you require another format on the digital output, 16-bit 192KHz or 48KHz should be more than enough (I’m guessing this adjust the quality of the internal DAC on the sound card, so go with 192KHz).
Update: turns out this still happens, but changing it to something else, then back to the previous value solves the issue. No idea why.
Tags: realtek, sound cards, volume, Windows
Posted in Windows | No Comments »
March 31st, 2013
To make this a bit more searcable on the magic intarwebs:
jQuery 1.6.x changed the behaviour of attr(‘checked’), as it is no longer used to manipulate the state of radio buttons (or other elements using the checked element). This is considered a property, not an attribute (the difference is subtle), so instead of:
-
$("#element").attr('checked', 'checked'); // or
-
$("#element").attr('checked', true);
The correct ™ way of doing this is:
-
$("#element").prop('checked', true);
Tags: checked, javascript, jquery
Posted in javascript, jquery | No Comments »
March 31st, 2013
A small hack to do natural, numeric sort of string values in Python is to use the int function when calling sorted (here, applied to a dictionary get it sorted by its keys):
-
for position in sorted(positions.keys(), key=int):
This will call int() for each value in the list to sorted, and use the numeric value instead of the asciivalue (if the keys / elements are strings instead of numbers).
Tags: Python, python3, sorted
Posted in Hacks, Python | No Comments »
January 25th, 2013
While SQLAlchemy uses UTF-8 by default, the charset used when communicating with MySQL will affect the encoding of the returned data. To be sure that everything is handled properly as UTF-8 (which you might use SET NAMES 'utf8' in the console (don’t do that here..)), add ?charset=utf8 to your connection url:
-
mysql://user:password@localhost/database?charset=utf8
Thanks to RustyFluff at StackOverflow.
Tags: MySQL, Python, sqlalchemy
Posted in MySQL, Programming, Pyramid, Python | No Comments »