TLN

transmission line noise

Archive for October, 2009

Mac Wid­get Preferences

Ever won­dered where they are stored. Well won­der no longer they are in /Users/username/Library/Preferences

posted by Administrator in Dashcode and have No Comments

What is the x graphic in the top left hand cor­ner of Dashcode?

This one. You can drag and drop it around. It didn’t seem to do any­thing. I thought it might be the point that the wid­get flipped round. Well none of those it is just an indi­ca­tor that the code gen­er­a­tor is switched on. Switch code gen­er­a­tion of and it dis­ap­pears. Well you live and learn.

posted by Administrator in Dashcode and have No Comments

& past­ing columns">Copy­ing, cut­ting & past­ing columns

OK so it has to be on a Mac but in many appli­ca­tions, Word, TextE­dit, Text­mate, Dash­code you can select in col­umn mode or indeed any arbitary area of text by hold­ing down the option key and then hold­ing the left mouse but­ton down and drag­ging. This will select the areas of text under the cur­sor and then you can copy, cut and paste with it.

posted by Administrator in Dashcode,Snow Leopard and have No Comments

& Dash­code with REST">Twit­ter feeds in Snow Leop­ard & Dash­code with REST

This is a bit long winded but it might help someone.

I needed to add a twit­ter feed to a Dash­code, Dash­board Wid­get. I had recently upgraded to Snow Leop­ard and i am sure that before i did so the twit­ter feed was workng but after­wards not. How­ever i could be mis­taken on that one.

In this Wid­get i make a cou­ple of curl called that need to authen­ti­cate and they work ok. I also could make unau­then­ti­cated Twit­ter calls but when i used the exact code for the Twit­ter api i wanted to it just hung the Wid­get out to dry. Cept it never dried.

OK so I need to run curl to get the exter­nal data i want, it is all writ­ten with REST, so i need to use curl. This is easy in PHP but in Dash­code 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 sys­tem 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 per­fectly no prob­lems. How­ever for the Twit­ter API i need to be a bit more com­plex. I need a spe­cific users time­line and i want only to get the lat­est feed from them to dis­play. So check out the Twit­ter API and use screen_name=xxx and count=1 and the rus­lut­ing 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 wid­get items out and just use the curl ele­ment a the CLI on the Mac it works fine, except for bring­ing 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 out­side of the wid­get, but run­ning the whole thing inside the wid­get doesn’t even though the other authen­ti­cated REST call does.

Another point that also came to mind was that by using the authen­ti­ca­tion in the wid­get i was effec­tively giv­ing this away to any­one who cared to down­load the wid­get 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 twit­ter api and then use sim­plexml 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 sim­ple unau­then­ti­cated call from the wid­get 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

posted by Administrator in Dashcode,REST,Snow Leopard,php and have No Comments

Using Dash­code and keep los­ing code?

Well remem­ber Dash­code has a “View/Start Code Gen­er­a­tor” and a “View/Stop Code Gen­er­a­tor” when the code gen­er­a­tor is run­ning then it does use­ful things like when you cre­ate a new but­ton or any other com­po­nent it will fill it all out in the cor­rect areas od Dash­code so you can then go and mod­ify the data.

How­ever some­times when you have it run­ning and you decide to reb=name a few items after you have added cus­tomised code it will most thought­fully remove your cus­tomised code for , leav­ing you with a sort of neg­a­tive deja-vu.

The trick is to remem­ber to switch the gen­er­a­tor on and of at crit­i­cal times.

For instance if you want to drag a com­po­nent to a new loca­tion and line it up, then you need the gen­er­a­tor on els it stops you doing it.

I am using the Snow Leop­ard ver­sion which seems to have a few new bells knobs and whis­tles which i don’t seem t o be able to locate any Apple doc­u­men­ta­tion on as yet.

posted by Administrator in Dashcode and have No Comments

& Snow Leopard">Growl & Snow Leopard

Nope still doesn’t work with Mail. Down­loaded 1.2 and when i start Mail it says it is incom­pat­i­ble. How­ever can­not see any­thing on the Growl site or dis­cus­sions that touch on this.

posted by Administrator in miscellaneous and have No Comments
Get Adobe Flash playerPlugin by wpburn.com wordpress themes