Solving SVG import issues in Adobe Illustrator CS6 and CC

So when trying to import an SVG into Illustrator today, I was greeted by the following message:

Screen Shot 2013-10-30 at 12.02.14

The operation cannot complete because of an unknown error [CANT]

This isn’t exactly a programming issue (well, it is on Adobe’s side for sure :D), but I hope the poor souls having to deal with SVG in Illustrator will find this helpful.

Long story short: the SVG in question contained “font-family” directives. Apparently, Illustrator will show the above error message if it does not find a font referenced by such a directive, which is kind of a problem since “sans-serif” is a valid value for an SVG font-family directive.

I’ve sent a bug report to Adobe, hoping that this will be fixed soon.

Solving NDK build issues on OS X

So my OUYA arrived today, and of course I couldn’t resist to try and build some stuff myself. When building Mupen64Plus AE (a Nintendo64 emulator), the following build error message didn’t seem to want to go away:

In file included from /usr/include/sys/_types.h:33:0,
                 from /usr/include/_types.h:27,
                 from /usr/include/stdlib.h:63,
                 from jni/core/projects/android/../../src/api/callbacks.c:26:
/usr/include/machine/_types.h:34:24: fatal error: arm/_types.h: No such file or directory
compilation terminated.

This was caused by the fact that, for some reason, the project I was building added


as a compilation flag, and since I didn’t have a $SYSROOT environment variable set, that resulted in /usr/include being included. My system header files then conflicted with the NDK header files. My quick workaround was this:

SYSROOT="foo" ndk-build

And voilá, a little “foo” solved the problem perfectly :D

Programmatically adding PHP generated TypoScript to the backend configuration

Today I’ve struggled with adding PHP generated TypoScript configuration to the backend. There doesn’t seem to be an API for this, unfortunately, so I had to dig a little bit into the TYPO3 source.

Turns out that t3lib_befunc#getPagesTSconfig, which is responsible for retrieving TypoScript configuration for the backend, makes use of the following global variable as the “default TypoScript configuration”:


So, being short of a proper API, I ended up simply appending my generated configuration to the defaultPageTSconfig string (in my ext_localconf.php file).

Is there a better way to achieve the same thing? If so, let me know :)

ArgumentError: Could not parse PKey: no start line

After updating my net-ssh gem to 2.6.x I started getting this error message from Capistrano:

ArgumentError: Could not parse PKey: no start line

The private key in question was completely fine though, given that it had been working in several other applications, including openssh itself, for quite some time. There seem to be some weird issues with net-ssh 2.6.x and Capistrano at the moment, and so I simply downgraded to v2.5.2 and everything worked fine once again:

gem uninstall net-ssh
gem install net-ssh -v 2.5.2

Keep deploying :)

InstantiationException when creating Akka Actor

This post might help you if you get an exception such as the following when creating an Akka Actor with actorOf(Props[SomeActor]):

[ERROR] 15:32:44.249 :: akka://.../user/foo :: :: error while creating actor
    java.lang.InstantiationException: package.of.SomeActor
    at java.lang.Class.newInstance0(

The reason I got this error was simply because I didn’t have a constructor with zero arguments, that is, my Actor’s class signature looked like this:

class SomeActor(val attrs:Map[String, String] = Map()) extends Actor

I assumed that, since map has a default value, it would work just like a no-argument constructor, but that was foolish, of course. Akka invokes java.lang.Class.newInstance, which in turn calls java.lang.Class.newInstance0, which (as far as I know) is a special case of newInstance for constructors with no arguments. Given that this special case is not applicable for our Actor class, an exception is thrown.

I worked around this problem like this:

class SomeActor(val attrs:Map[String, String] = Map()) extends Actor {
    def this() = this(Map())

Why is my Akka Actor getting “deadLetters” as sender?

That is a question that kept my busy for almost an hour… I had an Actor defined like this (simplified, of course):

trait Foo { self: Actor =>
class Bar extends Actor with Foo {
    def receive = {
        case x => sender ! x

Weirdly enough, when I was sending messages to that actor, the responses always came from the deadLetters Actor belonging to my actor system. The reason for this behavior was the fact that I used self as the name for the Foo trait’s self-type, because “There is already an implicit val self defined in Actor which refers to an actor’s own ActorRef”, and if you override that, well, it breaks.

Therefore, if I change my trait to read something like this

trait Foo { actor: Actor =>

everything works as expected.

How to emulate a slow internet connection on Mac OS X

I found this note-to-self which explains how to do bandwidth and latency emulation on Mac OS X system wide, that is, independent of Chrome, Firefox, Safari or whatever browser you may be using.

It can be done using a “network pipe”, and it is relatively easy to find several detailed articles about its usage once you know the name. One of these articles is this one, which, apart from explaining the basic usage of network pipes, also lets us know that there is a GUI tool called “Network Link Conditioner” bundled with Xcode 4.2 for this very purpose.

Now go and optimize your app/website for low bandwidth conditions :)

Searching your Git history for a string or regular expression

Git seems to always have the feature I need, but often I’m not able to find it right away. While searching for a commit where a certain constant had been removed, I stumbled upon the deprecated git-diff-grep, which, in its readme, led me to the solution I could have easily found by just reading the, you know, manual (i.e. man git-log) :)

    Look for differences that introduce or remove an instance of
    <string>.Note that this is different than the string simply
    appearing in diff output; see the pickaxe entry in gitdiffcore(7)
    for more details.
    Look for differences whose added or removed line matches the given

Knowing that, you can simply do the following:

$ git log -S"WHERE_DID_IT_GO"
$ git log -G"WHERE_DID.*"

If you want to see the commit’s diff as well, just supply the -p option.

Cisco VPN Client on Mac OS X 10.6+ – You don’t need it!

My university provides us with VPN access, and the only supported way to connect to it is the Cisco VPN Client, which doesn’t work on any 64-bit Mac OS system though. If you still try to use it, you will most certainly be presented the following error:

Error 51 - unable to communicate with the subsystem

The Cisco VPN Client support is discontinued for good reason, though. As of Mac OS X 10.6, there is a built-in IPSec VPN feature, so you really don’t need any third party software anymore. And here’s how you use it:

  1. Open System Preferences > Network
    • You may need to click the “Unlock” button to make changes
  2. Click the plus sign above the lock button
    1. Select VPN in the Interface dropdown
    2. Choose Cisco IPSec as the VPN Type.
    3. Give it a descriptive “Service Name”
    4. Click “Create”

Now you’ve created a new VPN connection, but you still need to configure it. If you know all the necessary configuration parameters just go ahead an configure away. More probably though, you have a .pcf file which contains all the configuration. But don’t worry. First of all, open the .pcf configuration file in your favorite text editor. It should at least contain the following configuration parameters:

  • Host
  • GroupName
  • enc_GroupPwd

You’ll also need to know your username and password for the IPSec VPN. Enter the configuration value for “Host” into the “Server Address” field, and you username below it. Mac OS automatically prompts you for your password when connecting to the VPN.

Now click the Authentication Settings... button. Enter the “GroupName” found in the .pcf file into the “Group Name” field. Unfortunately you can’t directly copy the “enc_GroupPwd” into the “Shared Secret” field because it is “encrypted”. However, certain ways and means exist for getting the clear group password. Enter it into the “Shared Secret” field, and you’re done.

If I explained everything correctly, you should now be able to click the “Connect” button, to stop worrying about VPN configuration stuff and finally get back to work :)

Whenever Gem and Capistrano – Specifying the cronjob user

If you are using Capistrano in a project that relies on the Whenever gem to manage your crontab, it will update the crontab of the user that you use for your Capistrano deploys. So if, for example, you’d deploy with the user capistrano and your app runs under the user www-data, you could run into all sorts of trouble, e.g. permissions in case your cronjob creates new files.

Specifying the user under whom the cronjob command should be executed is relatively easy though. This mailing list entry tells us that we should add --user your_user as a parameter to the whenever command. The problem with that is that you don’t execute the command yourself, but the whenever gem’s Capistrano recipe does. So all we need to do is change the whenever_update_flags variable to meet our wishes. First the original line, and after that our modification:

# Old
_cset(:whenever_update_flags) { "--update-crontab #{fetch :whenever_identifier} --set #{fetch :whenever_variables}" }
# New
_cset(:whenever_update_flags) { "--update-crontab #{fetch :whenever_identifier} --set #{fetch :whenever_variables} --user www-data" }

You probably don’t want to change the whenever gem directly, so placing that line anywhere in the deploy.rb file should work just fine.