Detecting Quercus

At Onoko, I’ve been using Quercus to run PHP applications on Elastic Beanstalk, Amazon’s scalable Java stack.

Quercus is great, although I’ve found I have to work round some of its unimplemented methods or implementation differences from PHP. I test on a plain Linux/Apache/PHP server though, and wanted a way to detect Quercus so I can conditionally use different work arounds. You can do this with the following PHP:

$IS_QUERCUS = strpos($_SERVER[“SERVER_SOFTWARE”],’Quercus’) !== false;

Force User Login Multisite

This is my first WordPress plugin in a while. Its a modification of the Force User Login plugin that extends it in two ways:

1) It works with WordPress multisite, so that you can set on a per site basis if a site requires login to view the content.
2) It allows you to set a minium user level to view content, so for example, only Editors and above can view the content. (This is useful when you have automatic user registration set up or on a multisite where users may have access to multiple sites.)

Get it from WordPress here

iPhoto ’11 No Place Smart Album

I was wanting to find all the Photos in my iPhoto 2011 library that didn’t have a place assigned, so I could assign a place to them. There wasn’t a filter option that would directly detect if a place was blank. Then I realised I could check for every single letter in the alphabet to see if the place didn’t contain them, but a Smart Album is only allow 10 filters, not the 26. Then I realised almost every place name will contain a vowel, so I could just check for the 5 vowels. If you want to do this your self, make sure you select “Match all of the following conditions”:

Update:
I later realised you could do this for a similar affect using the GPS tag, although its not quite the same because if a photo has a place assigned but wasn’t tagged with GPS it will still appear in this filter:

Random OSX Hacks

1) Custom Sidebar Icons
I had linked my “~/Movies” directory to a directory on my second hard drive (I have an SSD + 1TB 12.5mm in my 13″ MacBook Pro). However this removes the special icons OSX will show for folders like “Movies”, “Documents”, etc. if you drag them to Finder’s sidebar.

I found out that the sidebar icons are kept track of in “~/Library/Preferences/com.apple.sidebarlists.plist”. However it gets overwritten from cache when you log out, meaning you can’t edit it while you’re logged in. I was able to copy and paste in the icon information from the file of a second user when logged in as the second user or by using ssh when the original user wasn’t logged in.

2) Forcing Google Contact Sync
I found this through a combination of searching on google, and running “Sync Now” from the iSync.app menu item while doing a “ps -ef | grep google”.


/System/Library/PrivateFrameworks/GoogleContactSync.framework/Versions/A/Resources/gconsync --oneshot --sync com.google.ContactSync --entitynames com.apple.contacts.Contact,com.apple.contacts.Email Address,com.apple.contacts.IM,com.apple.contacts.Phone Number,com.apple.contacts.Street Address

3) Toggle File Invisibility
I’ve created an AppleScript app that you can drag to your Finder toolbar to toggle file visibility. It requires Xcode to be installed and will make files visible or invisible, but you’ll need something like Total Finder in order to be able to view hidden files to make them visible.

Apple LED Cinema Display with a PC

This is a really random post, but like the MySQL Bit post, it took me ages to find the right information on the internet, so thought I would blog it. I wondered if it was possible to run the 24″/27″ Apple LED Cinema Display which only have a DisplayPort input with a PC that normally only have a VGA or DVI adaptor. I’ve realised it is using these adaptors:

http://www.atlona.com/Atlona-DVI-to-Mini-DisplayPort-Converter-p-17859.htmlhttp://www.atlona.com/Atlona-Dual-Link-DVI-to-Mini-DisplayPort-Converter-USB-Powered.html

However the caveats are:

  • – VGA only supports up to 2048×1533 and I’m not sure if the above will take a VGA signal to DVI
  • – The first model which is DVI only supports up to 1920×1200
  • – The second model which supports the full 2560×1440 of the 27″ required a Dual Link DVI, which as few PCs have as have as a DisplayPort adaptor

Long and short of it is, if you really want to from a laptop you’ll get low resolution at best, from a desktop your best bet is to buy a graphics card with a DisplayPort adaptor output, or better yet get a mac. I think part of the reason for DisplayPort over VGA/DVI and even HDMI is the higher resolution.