Whatever you do, don’t panic!
Development
PHP converting object to array
Jan 10th
If an object is converted to an array, the result is an array whose elements are the object‘s properties. The keys are the member variable names, with a few notable exceptions: private variables have the class name prepended to the variable name; protected variables have a ‘*’ prepended to the variable name. These prepended values have null bytes on either side. This can result in some unexpected behaviour.
Source: http://www.php.net/manual/de/language.types.array.php#language.types.array.casting
No kidding? This must be one of the most stupid decisions ever in the whole language of PHP. Why pad some array keys with NULL BYTES? I mean, how can anyone ever be expected to find that out, by looking at the data the script writes out? This makes absolutely no sense whatsoever.
Just spent around an hour hunting this down!
I hope this post will save someone else the amount of hassle this has caused me.
Automatically add links from emails to Safari Reading List
Jul 31st
This is kind of a stripped down version of Read It Later or Instapaper, but functions perfectly for my workflow.
Requirements
- Apple Mail
- Apple Safari (with Reading List Support)
- ifttt Account
First I’ve set up actions in ifttt that forward Links I favorite in Twitter or Google Reader, to my personal Email and prepend the subject with “#ReadLater”. Next I constructed a Mail Rule that acts on all messages who’s subjects begin with said keyword. The Mail Rule will invoke the following Applescript, mark the message as read and move it to the trash.
using terms from application "Mail" on perform mail action with messages theSelectedMessages tell application "Mail" repeat with eachMessage in theSelectedMessages set mailbody to content of eachMessage set theUrl to paragraph 1 of mailbody tell application "Safari" add reading list item theUrl end tell end repeat end tell end perform mail action with messages end using terms from
Use cases
- Read newsfeeds on iPhone. Save longer or interesting articles for later by clicking the favorite star.
- Interesting item pops up on twitter, but you don’t have time now to read the containing link right now.
- While walking in the street you see a URL you want to remember, just mail it to yourself with the appropriate keyword in the subject.
Get MySQL database size from query
Jul 4th
Braindump:
SELECT table_schema "Data Base Name", sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB" FROM information_schema.TABLES GROUP BY table_schema ;
How to delete Redmine users
Apr 27th
I’ve recently transfered all my project planning, development, bug ticketing and repositories to the awesome Redmine project tracking software. From now on all of my development work will live on tracking.42dev.eu
To facilitate bug reports and feature planning for my latest WordPress Plugin I’ve activated user registrations in Redmine, so people can post messages on the Forums. Now I wanted to have some sort of mechanism to delete unwanted users from the Redmine database. Since the software has no such option on the webinterface I searched for an alternative and found one on the Redmine forums.
Go to you Redmine install directory and enter the following (substitute USER_ID with the desired value):
>> script/console >> u = User.find(USER_ID) >> u.destroy
Make sure, that the user you are deleting doesn’t have any activity on the site yet, otherwise problems could arise, if the user already posted messages etc.
Facebook Send Button WordPress Plugin
Apr 26th
Facebook has released their new “Send” button that lets you share content all over the web with selected groups or individuals.
I wrote a little plugin that will insert this button under every post in your blog including the correct permalink.
This is version 0.1 and very basic. Head over to the project site to download and read about upcoming features.












