Updated: 6/10/2002; 3:00:02 a.m..
Myelin: Radio Dev
A blog for testing stuff: SharpBlog, Comment Monitor, etc
        

Sunday, 22 September 2002

Right, I'm clearing the cache, but my new items still aren't showing.
11:35:19 PM    comment []

If you add a story to the aggregatorData.stories table, the aggregator page doesn't update straight away, because it's been cached.  xml.aggregator.clearCache() will empty the cache, and radio.aggregator.preCacheNewsPage() will fill it in if empty.
11:29:56 PM    comment []

Given a story number in the aggregator (a key for the aggregatorData.stories table, with or without the leading zeros), you can get a pointer to the table with:

story = radio.aggregator.getStoryAddress( "123" )

(for story #123)


11:25:09 PM    comment []

[Ctrl-J] aggregatorData.stories [ENTER]

Notice how all the numbers are zero-padded?

string.padWithZeros( num, 8 ) does that.


11:13:35 PM    comment []

Fetching a web page with tcp.httpClient results in a single big string with all the HTTP headers as well as the content.

Use string.httpResultSplit() to split it up.


11:11:34 PM    comment []

Aha!  When you add a number to a date object, it adds that many seconds.  So if I want to add a number of minutes, do I:

    1. add 60 * mins?
    2. add date.set( 0, 0, 0, 0, mins, 0 )?

I suspect the first one will do it.  The second will probably add 1932 years plus 'mins' mins.

Update: the first one worked.


11:01:42 PM    comment []

Looks like array indices in UserTalk start at 1.

Python:

foo = [ 'a', 'b', 'c' ]
a = foo[0]
b = foo[1]
c = foo[2]

UserTalk:

foo = { "a", "b", "c" }
a = foo[1]
b = foo[2]
c = foo[3]

What's all this about local(), by the way?  Are vars global unless specified otherwise?  Or is it just a way to put multiple variable assignments on one line?


10:43:57 PM    comment []

Fetching a web page: use tcp.httpClient()

Python: txt = urllib.urlopen( url ).read()

Radio: txt = tcp.httpClient( "GET", server, "/" + path, 80 )

Splitting a URL into its components: use string.urlSplit()

Python: proto, server, path = urlparse.urlparse( url )[:3]

Radio:

bits = string.urlSplit( url )
local ( proto = bits[0], server = bits[1], path = bits[2] )


10:30:54 PM    comment []

Frontier verbs: DocServer
10:19:49 PM    comment []

Adding fields to tables: just assign to them and they will appear.

Checking for fields: use defined().

Python:

if not foo.has_key( 'bar' ):
    foo['bar'] = blah

UserTalk:

if not defined( foo^.bar )
    foo^.bar = blah


10:12:38 PM    comment []

Creating tables: the following code creates a new table 'foo.bar'

new( tabletype, @foo.bar )


9:51:45 PM    comment []

Radio / Frontier hacking bookmark: the object database


9:51:02 PM    comment []


© Copyright 2002 Phillip Pearson.
 
September 2002
Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30          
Aug   Oct


Click here to visit the Radio UserLand website.

Subscribe to "Myelin: Radio Dev" in Radio UserLand.

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.