||[Oct. 21st, 2004|08:19 pm]
LiveJournal Client Discussions
I am writing a widget for Konfabulator (mac app). The purpose of this widget is to watch my friend's groups and notify me when there has been an update to a group. Because all Macs running OSX have curl I have decided this will be my medium to grab information about wheather the friends group has been updated.|
This code works for getting the generic friends list from the command line in Terminal.
curl http://www.livejournal.com/interface/flat -s -A MacOSX%2DKonfabulator%20Widget%2F1%2E0%2E4 --connect-timeout 10 -b ljfastserver=1 -d mode=checkfriends -d user=[username] -d password=[password]
According to the documentation in order to look at a specific group all i need do is add the "mask" option with an unsigned int as it's value to bring up the group(as in my example below).
curl http://www.livejournal.com/interface/flat -s -A MacOSX%2DKonfabulator%20Widget%2F1%2E0%2E4 --connect-timeout 10 -b ljfastserver=1 -d mode=checkfriends -d user=username -d password=password -d mask=1
I would expect this second command to get me the last updated journal entry in group number 1 this sadly is not the case. What am I doing wrong?
(Optional) The friend group(s) in which the client is checking for new entries, represented as a 32-bit unsigned int. Turn on any combination of bits 1-30 to check for entries by friends in the respective friend groups. Turn on bit 0, or leave the mask off entirely, to check for entries by any friends.
(You're only turning on bit 0. Try turning on bit 1 if you want to check friend group 1.)
ok, so I am still confused, though not nearly as much. I do a lot of text based web programming normally, so I am not sure what they are asking for then. Could you give me an example of what turning bit 1/2/3 on looks like. I have never had to deal with turning on individual bits before.
ok... I am going to take a stab at figuring this out, can you tell me if I am inturpretting this correctly. a bit is binary speak so I am going to guess that a 32 bit unsigned int is a 32 character length number composed of ones and zerors like so...
If so I would expect that if we are counting binary it's from right to left bit 0 bring the bit closest to the right bit one being the next one, so for me to look at group one I would change the second bit from the right to a 1 like so...
and so on and so forth. I am probably on the right track, but probably wrong as it doesn't seem to be doing what I expect it to when I try it in my command.
Yep, now convert it back to decimal.
1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, etc
So turning on bit 0 means mask = 1.
Turning on bit 1 means mask = 2.
Bit 2 is mask = 4.
If you want to check for posts in groups 2 and 5, you turn on bits 2 and 5, and end up with mask = 36.
could they have made it any more confusing? thanks, I get the picture now.
Thanks for you help, it's amazing how one answer allowed me to finish my Widget. If you are on a Mac I'm willing to share so you can use it. :-D Now I don't have to keep hitting refresh. :-)
Is your widget avaliable for download