|
Sunday, 22 September 2002 |
Right, I'm clearing the cache, but my new items still aren't showing.
11:35:19 PM
|
|
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
|
|
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
|
|
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
|
|
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:
- add 60 * mins?
- 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
|
|
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
|
|
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
|
|
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
|
|
Creating tables: the following code creates a new table 'foo.bar'
new( tabletype, @foo.bar )
9:51:45 PM
|
|
© 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 |
|
|
|
|
|
|