Ever wondered where they are stored. Well wonder no longer they are in /Users/username/Library/Preferences
Archive for October, 2009
What is the x graphic in the top left hand corner of Dashcode?
This one. You can drag and drop it around. It didn’t seem to do anything. I thought it might be the point that the widget flipped round. Well none of those it is just an indicator that the code generator is switched on. Switch code generation of and it disappears. Well you live and learn.
& pasting columns">Copying, cutting & pasting columns
OK so it has to be on a Mac but in many applications, Word, TextEdit, Textmate, Dashcode you can select in column mode or indeed any arbitary area of text by holding down the option key and then holding the left mouse button down and dragging. This will select the areas of text under the cursor and then you can copy, cut and paste with it.
& Dashcode with REST">Twitter feeds in Snow Leopard & Dashcode with REST
This is a bit long winded but it might help someone.
I needed to add a twitter feed to a Dashcode, Dashboard Widget. I had recently upgraded to Snow Leopard and i am sure that before i did so the twitter feed was workng but afterwards not. However i could be mistaken on that one.
In this Widget i make a couple of curl called that need to authenticate and they work ok. I also could make unauthenticated Twitter calls but when i used the exact code for the Twitter api i wanted to it just hung the Widget out to dry. Cept it never dried.
OK so I need to run curl to get the external data i want, it is all written with REST, so i need to use curl. This is easy in PHP but in Dashcode i really only have Javascript and that won’t help as it i client side. So i need to make a call to the Mac system with widget.system. This is easy and looks like this
var rate_01 = widget.system("/usr/bin/curl --user username:password
http://api.worldfirst.com/rates/rate.php?pair=EUR/GBP", null).outputString;
This line by the way works, pulls the data in perfectly no problems. However for the Twitter API i need to be a bit more complex. I need a specific users timeline and i want only to get the latest feed from them to display. So check out the Twitter API and use screen_name=xxx and count=1 and the rusluting code looks like .…
var rate_02 = widget.system("/usr/bin/curl --user ausername:password
http://twitter.com/statuses/user_timeline.xml?screen_name=Screen_Name&count=1",
null).outputString;
Now if i strip the widget items out and just use the curl element a the CLI on the Mac it works fine, except for bringing back afull xml rather then the first item.
Just to be clear
/usr/bin/curl --user username:password
http://twitter.com/statuses/user_timeline.xml?screen_name=Screen_Name&count=1;
almost works outside of the widget, but running the whole thing inside the widget doesn’t even though the other authenticated REST call does.
Another point that also came to mind was that by using the authentication in the widget i was effectively giving this away to anyone who cared to download the widget and open up the files. Not a good ides.
So what i did was first set up a php page for my web site that got the data from the twitter api and then use simplexml to parse and extract the data i wanted
<?php
// twitter feed for company
// initilaise curl
$curl_conn = curl_init();
// set URL and other appropriate options
curl_setopt($curl_conn, CURLOPT_URL,
"http://twitter.com/statuses/user_timeline.xml?screen_name=Screen_Name&count=1");
// Use basic authentication
curl_setopt($curl_conn,CURLOPT_USERPWD,
"username:password" ); // aranaio:arana10
// grab URL and pass it to the browser
curl_setopt($curl_conn, CURLOPT_RETURNTRANSFER, 1);
// this loads to the srting as opposed to the screen so you can further process it
$result = curl_exec($curl_conn);
//curl_exec($curl_conn);
curl_close ($curl_conn);
// query data
$ss = simplexml_load_string($result);
$xml = $ss->xpath("status/text");
print $xml[0];
?>
then use a simple unauthenticated call from the widget to that site to get the data
function getTwitterFeed() {
var twitter_feed = widget.system("/usr/bin/curl
'http://www.aranaio.com/wftwit.php'", null).outputString;
document.getElementById('twitter-text').innerHTML = twitter_feed;
}
Thank you. You can always get in touch with me for more information
Using Dashcode and keep losing code?
Well remember Dashcode has a “View/Start Code Generator” and a “View/Stop Code Generator” when the code generator is running then it does useful things like when you create a new button or any other component it will fill it all out in the correct areas od Dashcode so you can then go and modify the data.
However sometimes when you have it running and you decide to reb=name a few items after you have added customised code it will most thoughtfully remove your customised code for , leaving you with a sort of negative deja-vu.
The trick is to remember to switch the generator on and of at critical times.
For instance if you want to drag a component to a new location and line it up, then you need the generator on els it stops you doing it.
I am using the Snow Leopard version which seems to have a few new bells knobs and whistles which i don’t seem t o be able to locate any Apple documentation on as yet.
& Snow Leopard">Growl & Snow Leopard
Nope still doesn’t work with Mail. Downloaded 1.2 and when i start Mail it says it is incompatible. However cannot see anything on the Growl site or discussions that touch on this.
Archives
- September 2010
- August 2010
- July 2010
- June 2010
- May 2010
- April 2010
- March 2010
- February 2010
- January 2010
- December 2009
- November 2009
- October 2009
- September 2009
- January 2009
- December 2008
- March 2008
- February 2008
- December 2007
- November 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- April 2007
- March 2007
- February 2007
- January 2007
- December 2006
- November 2006
- September 2006
- July 2006
- November 2005
ajax / javascript
cli
css / design
database & related
frameworks & patterns
FreeBSD
general / technical
just silly
mapping
moi
open source paradigms
people i know
plugins
programming
search technologies
smalltalk
tna
underlying engines
web 2.xx stuff
weird stuff