After producing an HTML5 banner, living in an iframe, delivered through Adtech / Helios, we had a case where the clicks weren’t tracked by the advertising platform. That’s as expected, since the content hosting the iframe is unable to manipulate any content within the iframe (unless they’re on the same originating host, and we’re serving our content by ourselves to make it dynamic and without a huge setup cost (in time)).
Turns out Adtech / Helios has a few variables that it can replace when delivering the URL or the HTML of the iframe (similar to the function of a clickTAG for Flash content):
_ADCLICK_: Standard variable for click tracking
_ADCLICKESC_: URL is escaped by the ad server
_ADCLICKDEC_: Decoded target URL
_ADCLICKDECESC_: Decoded and escaped URL
We went with
_ADCLICK_, which will be replaced by the URL to prefix any link in your own content with. That way the click will be routed through the tracking code at the ad server, and the counts should match what we’re actually seeing on the other side (through analytics and events).
Luckily the link to prefix does not contain any special characters that need to be escaped (they use ; as a separator) when used in as GET arguments in an URL, so you can add an argument to the existing URL:
After spending quite some time to install imagick for PHP under Windows, I’ve finally gotten a solution that work. Fetch the prebuilt binary files from pecl (select the newest one with a windows icon behind it), and download the version for your platform. If you’re not sure, you probably want Thread Safe (if running under Apache) and x86 (you can see which platform your PHP is compiled for at the top of the phpinfo() output).
After enabling the extension, you’ll probably get a few error message about missing DLLs. This is where it gets interesting – quite a few sources on the internet will tell you to install the ImageMagick distribution for Windows, but the current version of php_imagick uses a few deprecated functions in wand, etc. Previously the dll-s bundled with imagick in the same library could be copied into the installed version of imagick, but this doesn’t seem to work any longer.
However, hidden in a PHP bug report, there’s a path to a repository of dependencies for running php_imagick under Windows, which is the complete set of compiled dll files it expects. Download the correct version of ImageMagick (something like ImageMagick-6.8.8-…) and unpack it. I ended up copying everything from bin/ into my ImageMagick installation dir, but that’s .. rather overkill and will probably cause some mystery error in the future. Copy them to a separate location that you add to your path and test PHP from the command line. Hopefully you’ll see more supported image formats now!
While attempting to get sphinx to build the documentation for Imbo, I ran into the error message “Could not import extension sphinxcontrib.spelling (exception: cannot import name xmlrpc_client)”. I had just installed sphinxcontrib.spelling, so I had assumed it would pick up any dependencies – apparently not.
The python xmlrpc_client module name comes from the six library, a library to help write code that works on both python2 and python3. The library was installed, but apparently Ubuntu had an older version available, where xmlrpc_client wasn’t available.
Solution: Update six manually with pip:
sudo pip install --upgrade six
One of the issues I’ve come across when using Sphinx (awesome application) for writing documentation is that the table of contents disappear when using the
singlefile format (which generates the documentation as one large page instead of having to click through to other files).
Luckily Matteo Franchin had the same issue, and created a small extension for Sphinx that allows you to add a TOC to SingleHTML builders as well! The problem I discovered after a while is that it ends up adding redundante HTML anchors for each level when resolving the TOC, where it ends up generating #html#anchors like that. Which doesn’t work.
I solved the issue (.. for my simple case, this is still a hack) by adding regular expression that removes any HTML anchors that are followed by another HTML-anchor (and could very possibly eat a lot more in edge cases, but hey, it works for me!).
rendered_toctree = re.sub(r'(#[^ "]+)#', '#', rendered_toctree);
The lines around line 59 should then look like:
rendered_toctree = builder._get_local_toctree(docname, **kwargs)
rendered_toctree = re.sub(r'(#[^ "]+)#', '#', rendered_toctree);
node['content'] = rendered_toctree
After upgrading from Apache 2.2 to 2.4 in a Windows development environment, all my virtualhosts stopped working. I could add syntax errors to the files which would make Apache refuse to start up, or get notices about invalid document roots, but the virtual host server names just wouldn’t catch on.
After removing the reference to
Include conf/extra/httpd-vhosts.conf things suddenly started working! Weird. The reason seems to be that the default vhost referenced in
_default_ instead of
* to reference the virtualhost name. I’ve used
* in all my configuration files, and apparently Apache refuses to reference any
* references if it hits a
_default_ name in the VirtualHost configuration first. That seems weird, so if someone has any more information about what’s causing this, I’m very interested.
My setup now works again, so I’m not going to start digging into the source to find the reason for this just yet. :-)
This error message can be caused by placing an IP instead of a hostname in a
Require host statement in Apache 2.4+. After porting some old access rules to Apache 2.4 I had used
Require host 127.0.0.1 instead of the correct
Require ip 127.0.0.1. Switched it, and ahoy! It now works.
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:
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.
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.
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(). :-)
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"
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