Alex Kirk
Alex Kirk
@alex@alex.kirk.at
269 posts
238 followers
Friends Plugin

friends.kirk.at

Enable Mastodon Apps Plugin

ema.kirk.at

Homepage

alex.kirk.at

  • preg_match, UTF-8 and whitespace

    Just a quick note, be careful when using the whitespace character \s in preg_match when operating with UTF-8 strings. Suppose you have a string containing a dagger symbol. When you try to strip all whitespace from the string like this, you will end up with an invalid UTF-8 character: $ php -r ‘echo preg_replace(“#\s#”, “”,…

  • Restoring single objects in mongodb

    Today I had the need to restore single objects from a mongodb installation. mongodb offers two tools for this mongodump and mongorestore, both of which seem to be designed to only dump and restore whole collections. So I’ll demonstrate the workflow just to restore a bunch of objects. Maybe it’s a clumsy way, but we’ll…