I just refactored some of my MySpace code this afternoon, to contact an outside server from an OpenSocial app you have to use the makeRequest call, here’s how my makeRequest wrapper looks like:
Here’s how you call this from the MySpace canvas surface:
function submitForm(){
makeRequestWrapper("/form_submit?"+ $("#user_info_form").formSerialize(),function(data){
submitFormCallback(gadgets.json.parse(data.text));})}
function submitForm() { makeRequestWrapper( "/form_submit?" + $("#user_info_form").formSerialize(), function (data) { submitFormCallback(gadgets.json.parse(data.text)); } ) }
In the userFormCallBack method, you can access the JSON object as arg.foo.
Method to perform makeRequest from the home and profile surfaces (I have no idea why they are different, but this works):
function retrieveHistory(){
makeRequestWrapper("/show_history",function(data){ displayHistory(data);})}
function retrieveHistory() { makeRequestWrapper("/show_history", function (data) { displayHistory(data); } ) }
Notice here you don’t need use data.text like you have to in the canvas surface. I found out that MySpace ignores the request type, on canvas it always returns a JSON object and if your server endpoint returns a JSON encoded object (like with render :json => my_hash.to_json in Rails ), it is stored in data.text, so you have to parse that with gadget.json.parse() to get another JSON object. On the home and profile surfaces it always returns HTML, you can parse the data as it (no need to use data.text), or you can just display the html returned with something like $(“div#blah”).html(data), if you use jQuery.
Been wanting to write a blog post for [context] blog on my experience with MySpace Developer Platform (MDP), got some free time last week and finally got to it, and it has just been published at the [context] blog. Check it! 🙂
I like it, I’ve visiting flickrleech to check out the Interestingness stream at least once a day for years, it’s also a great way to check out anyone’s Flickr stream… The new version’s beta just came out:
I prefer the original version for its usage of square thumbnails, but found out I can get it back from the preference pane:
I’ve been looking for a simple way to sync and share multiple calendars between iCal and GCal, BusySync 2.0 just went beta and I gave it a try. It’s almost there, a major problem is that I can only sync with one Google account. A lot of us have at least two – a personal one and a work one (with Google apps for domains), I have 3 of them (I don’t use my personal one but would probably use it if it makes syncing calendars easier, I know I can create multiple calendars per account and share private feeds so I can use a single account to work with the other accounts but I will stress that simple is the goal here).
I actually haven’t tested out the syncing part thoroughly, so far I’ve done what I would call subscribing, will make some appointments on both iCal and GCal later to see how it well handles them.
The other slight problem is that it’s 20 bucks and I need a license on each computer, I need at least 2 and 40 bucks for syncing calendars is quite a bit IMO… I don’t have the time for it or I’ll write it myself, I’m sure it’s non-trivial though, coz it’s been forever since gCal came out and there still isn’t something that works well. What I used to do is to subscribe to a private feed and make modifications on GCal only, so my iCal has an read-only view.
For syncing info between my Mac and my Treo Missing Sync works extremely well, the Blackberry version works well also.The guys at Mark/Space seems to understand syncing really well, maybe they should write an ical/gcal sync.
I couldn’t wait for the update to come out as I badly needed a new laptop, also didn’t want to set everything up twice at the new job. (though next time Migration Wizard might actually work)
The changes to the MacBook Pro are minor but nice, not enough to get me to eBay this one for it. I could use the bigger hard drive so my iTunes lossless library would actually fit on my laptop, faster and more efficient processor (45nm!) with new SSE4 instructions, better battery life, and better graphics performance will be nice for Photoshop work. I don’t really care for MultiTouch myself, I’d much rather get a Wacom tablet. I read that Intel will update the Santa Rosa platform with Montevina in June, might upgrade it then. 🙂
We’d love to tell you that during AnandTech’s dissection of the “new” MacBook Pros they made a shocking discovery about the internals of the systems that brought into light significant changes and / or upgrades to the computers. We’d like nothing more then to say that it appears Apple has completely reworked the architecture of these machines to be harder, better, faster, and stronger. But honestly? They’re exactly the same as the old models, save for those little Penryns, and as a result, kind of boring. Don’t believe us? Take a look at the photos — you’ll see.
If you use Twitter you probably use TinyURL to shorten your URLs pretty often, I looked into doing this with Quicksilver, there are a couple of blog posts that show you how to do it, but none of them I really liked. One even said it was crap himself in the beginning of the post.
What I really want is this:
I would copy the URL I want to shorten to my OS X clipboard
I run something in Quicksilver
The clipboard will be updated with the shortened URL
This turned out to be extremely easy to do. Here’s a Ruby script that does exactly that. If you make the script executable, Quicksilver should include it in its catalog. So just copy a long URL into your clipboard (?-C), invoke Quicksilver, type the filename (I just type “tiny”), and wola, your clipboard will have the TinyURL so you can paste (?-V) it into wherever.
When I wrote my last app at OnMyList I had to roll my own autocomplete/typeahead feature with FBJS, I was looking at Preload FQL and found out last Dec they added a beta Typeahead tag, I tried it out with the FBML test console and it works great.
oh btw, this Typeahead is static, which means there is no way to ask it to do an ajax call to get results dynamically. I’m sure they’ll have an Ajax-Typeahead at some point…
In Firefox, you can drag any images to the desktop or anywhere in Finder and it will download it. I turned on Mouse Gestures, and with that on, dragging of the mouse starts a gesture and won’t trigger the default action. To get both gestures and drag-and-drop to work with the left button, i.e., just one finger touching the trackpad, I switched from Mouse Gesture to All-in-One Gestures, and configured it like this:
Now navigation gestures as well as drag-n-drop work perfect.
A problem I’ve been having is that everywhere I go I need to change the SMTP server settings for my personal and consulting accounts. The GMail IMAP accounts have authenticated SMTP and they work great everywhere, but for my personal IMAP accounts, I use the SMTP server provided by my ISP as I don’t want to set up authenticated SMTP over SSL or POP/IMAP before SMTP on my server and I definitely don’t want to run an open relay.
To solve this, I found Marco Polo, with it you can define a set of Contexts, which could be something like Office, Home, or anything else. You then define a set of Rules to figure out which Context you’re in based on Evidence Sources such as the mac address or SSID of the wireless access point you’re connected to, presence of Bluetooth/USB keyboard/mouse, external monitor, ethernet cable plugged in or unplugged, etc. Base on these you can setup rules
Here are screenshots of my setup:
Contexts:
Evidence sources:
Rules:
Once you have these setup it will guess where you’re at based with a confidence score, and you can trigger Actions on entering or leaving a Context.
Here are my actions to set SMTP servers:
Notice the first 3 MailSMTPServer actions were disabled, this is because that action actually changes the smtp server of ALL your accounts in Mail.app. I have 2 GMail over IMAP accounts (GApps for domains) and I want to use GMail’s authenticated SMTP server for those because they manage your sent mail properly when you do that. There is a “User only this server” checkbox in Leopard’s Mail.app but that doesn’t prevent the MailSMTPServer action from changing it! So to get what I want, which is to only set the SMTP server for my personal and consulting accounts, I had to do a little bit of scripting, I like Ruby so I write a rb-appscript like this:
#!/usr/bin/env rubybegin; require'rubygems'; rescueLoadError; endrequire"appscript"include Appscript
['Personal', 'Consulting'].eachdo|account_name|#tell application "Mail" to set smtp server of account_name to argv[0]
app('Mail').accounts[account_name].delivery_account.set(app('Mail').smtp_servers[ARGV[0]])end
#!/usr/bin/env rubybegin; require 'rubygems'; rescue LoadError; end require "appscript" include Appscript['Personal', 'Consulting'].each do |account_name| #tell application "Mail" to set smtp server of account_name to argv[0] app('Mail').accounts[account_name].delivery_account.set(app('Mail').smtp_servers[ARGV[0]]) end
Marco Polo however can only execute shell scripts, so I had to compile the script into a Mac application to use the Open action in Marco Polo. To do that I had to write a shell script for each SMTP, something like this:
#!/bin/sh/Users/ayn/bin/setSMTP.rb comcast
#!/bin/sh /Users/ayn/bin/setSMTP.rb comcast
To make this script into an OS X application, I used Platypus:
It didn’t work at first, I ran it with error outputs and turned out the Ruby library wasn’t setup correctly, so to get it working I had to go add the path for Ruby:
Now you can compile the shell script, which calls the ruby script with an argument, into a Mac application. In Marco Polo you can then use the Open action to call that .app. Kindda a long way to do something relatively simple, I wish the “Use only this server” account option in Mail.app actually works as expected.