Programming help

10 replies [Last post]
magill
Offline
Joined: 27 Apr 2012
Hi I can successfully use Explorer/Firefox to interrogate HAH parameters via the webserver applet ie http://***********:8080/dbzoo.livebox.Controller:1wire.1/input.state/dis... I'm messing with Java and Android and have issued an httpGET request for same URL and keep getting "client protocol exception" Probably something obvious but I'm out of my depth. Any help? John
brett
Offline
Providence, United States
Joined: 9 Jan 2010
John,The web server caching

John,

The web server caching applet is a bit of a toy webserver in that it implements a very minimal amount of protocol to send back data via a http request.  I wrote it in response to a problem that Gary was having integrating an iPhone app.  It does work with the various devices I've used to prod it.   To debug you will need a little more depth in your knowledge of HTTP protocols.  You do have full source code for the lua applet if you care to play around.

Brett

magill
Offline
Joined: 27 Apr 2012
java programming
Brett My wife has an Iphone and I have been using Garry's recommended "Mote" app to request data. However I'm also putting together a java app on my Android. Is it possible, without messing with your server applet, for me to to implement a different method of requesting the data? thanks John
magill
Offline
Joined: 27 Apr 2012
Happy now!

Brett I did a bit of research and downloaded a web debugger called "fiddler" which suggested a problem in The response's status line local message = "HTTP/1.0 200/OK\r\n" I changed this to local message = "HTTP/1.0 200 /OK\r\n" and all comes good! Happy now thanks John

brett
Offline
Providence, United States
Joined: 9 Jan 2010
Yes that line is wrong in

Yes that line is wrong in fact I'm not sure why the slash was there in the first place.  As you say it should be:

local message = "HTTP/1.0 200 OK\r\n"

I'll update the code and check that sample back in.  Thx.

Brett

magill
Offline
Joined: 27 Apr 2012
cron problem
Hi Can someone help please. I can use crontab -e and add a line 43 17 * * * aliasmsg "rf 1 on" and it works. But if I write to the file within a lua function eg function xyz() file = io.open("/etc/crontabs/root","w+") file:write("43 17 * * * aliasmsg \"rf 1 on\"") file:close() end I can view the file with crontab -l and it looks fine but won't work! John
garrydwilms
Offline
United Kingdom
Joined: 31 Mar 2011
 Think you need to reload the

 Think you need to reload the crontab once updated. It's "crontab root" from command line. 

Maybe you can echo it from a script?

 

Garry

magill
Offline
Joined: 27 Apr 2012
cron update
Garry
Thanks, but I don't know how to do that. Seems curious though because when I update the file using crontab -e (VI editor I think) it all works without reloading cron. Surely that's just the same process as the script which opens, modifies, and closes the file.
John
garrydwilms
Offline
United Kingdom
Joined: 31 Mar 2011
I think by doing crontab -e

I think by doing crontab -e you automatically update the Cron scheduler. By just text editing not sure you do. 

 

Maybe try this:

os.execute("crontab /etc/crontabs/root") 

 

 

Although, reading up on Cron. I now agree with you that Cron should update on its own when it sees that the file has been changed??

 

Garry

magill
Offline
Joined: 27 Apr 2012
Result!

Garry

You're a star. Works now.

John

garrydwilms
Offline
United Kingdom
Joined: 31 Mar 2011
Cool. In that case I'll use

Cool. In that case I'll use it myself from now on instead if google calendar!!!

 

Garry

Hardware Info