Post #: 76
Date: 2013-01-07 14:36:31.000
Welcome to 2013! It's fun living in the future.
I've upgraded the server from Ubuntu 10.04 to Ubuntu 12.04 LTS, so please let me know if there are any hiccups or strange behaviors on the site.
I'll be posting more soon!
xerxes on 2013-01-08 10:54:11.000
Hi Rocket Man
I am in and out quickly tonight, & will feed back any funnies if they do happen.
xerxes on 2013-01-08 11:45:11.000
I am a total beginner at web programming, & not experienced in newLISP. So, now, I decided to try to make a quick & dirty form to save a couple of fields to a SQLite3 database, using Rockets: experienced guys will see straight away what I am doing wrong, (the web form looks fine), but I keep getting 500 Internal Server errors when I submit ...
(create-record "usrtbl" UserId u e) (close-database)
I first thought that since UserId is autoincrementing, I should set it to nil. That doesn't work. If I try to supply a value to UserId, I get: // "ERR: symbol expected in function set : UserId" // whether I set it as a number (1) or a string ('1') or nil or 'null'
I would really love to get past this little hurdle, and would be grateful if anyone can help.
Rocket Man on 2013-01-08 15:42:23.000
I haven't tested Rockets with autoincrementing values. If UserId is set as INTEGER PRIMARY KEY AUTOINCREMENT then I'm not sure what will happen. If it is set as INTEGER PRIMARY KEY then you just pass in an integer.
The other thing to check is your values "u" and "e"... are they actual database field names or just temporary variables? The way (create-record) and all the other database functions work in Rockets is that the variable names need to be the same as the actual field names in the SQLite database.
Can you run a page that just dies (displayln (query "Pragma table_info('usrtbl')") and tell me the results?
xerxes on 2013-01-09 00:41:28.000
Thanks - I am very grateful for your response and attention.
I had overlooked how you specified variable names needing to be the same as actual field names, but of course remember seeing it more than once in the source code. I will check that out when at home today, and will also run the (dying) page as you suggested.
Rocket Man on 2013-01-09 02:29:14.000
Heh.. I meant to say "does" instead of dies.. I really should implement editing for individual comments. :)
xerxes on 2013-01-09 08:12:29.000
Hello again. I changed the source code of the action page to match the exact names of columns in table "usrtbl": // #!/usr/bin/env newlisp (load "newlisp-rockets.lisp")
The values are now correctly written to the Sqlite3 database (I open SqliteMan to verify afterward), but ... the browser still crashes with a 500 internal server error! I am now sure this is something I am doing wrong with Apache, perhaps with permissions in /var/www, because I really don't know my way around these constraints, and haven't ever used Apache before.
We talked about AUTOINCREMENT: the last time I wrote rows to a Sqlite3 database set up this way, I think I didn't even set a value for the Id Column. I just inserted values into the remaining columns, leaving Sqlite3 to increment the Id. I may have set this database up this way, so I will try it without setting UserId.
xerxes on 2013-01-09 08:14:14.000
Just so you know. When I posted the above, I got the message about a post not being requested, and no post sent, even after trying a second time. So I closed Chromium, and pasted the message in to this site after loading it in Firefox. It went through, as you can see, without problems.
xerxes on 2013-01-09 08:19:28.000
I used the form again after taking out all references to UserId in the action script, only inserting values into UserName & UserEmail. It worked exactly the same as before. The values are saved in the database, UserId is indeed augmented, but the browser then crashed with a 500 Internal Server Error. Gets curiouser and curiouser!
xerxes on 2013-01-09 08:20:03.000
and the last post was posted from Chromium, just fine ...
Rocket Man on 2013-01-09 17:09:56.000
500 Server Errors are hard to debug, because they can be almost anything. Your best bet is to run your script, and then immediately go into /var/log/apache2 and sudo nano error.log, then hit Ctrl W Ctrl V to jump to the end of the file. Here you can see what the error message was.
If it says something like "Forbidden" then you know you have permission problems. sudo chown www-data:www-data can fix these, or sudo chmod 755.
If it's something like "Premature end of script header" one of the most common causes is that the file being executed was edited on a Windows machine and thus has Windows-style carriage return + line feed combos as the end of the line. You can convert these files with a utility called ToFroDos ( http://www.thefreecountry.com/tofrodos/index.shtml ) that can be installed as a package in Ubuntu, or by using a text editor that will save in Unix line-end format.
As for the "No post requested" errors in Rockets, that's something I have to debug myself. :)
xerxes on 2013-01-10 06:06:40.000
Ok, I found this last entry in the log: [Thu Jan 10 16:01:06 2013] [error] [client 127.0.0.1] Premature end of script headers: GetDbVals.lsp, referer: http://localhost/testrkt.lsp
xerxes on 2013-01-10 06:12:00.000
the others are all about scripts too, but about not finding the css & js files: that must be because I have left out the partials but something else is looking for those files in rockets-main.
[Thu Jan 10 16:00:48 2013] [error] [client 127.0.0.1] File does not exist: /var/www/css/datepicker.css, referer:
http://localhost/testrkt.lsp [Thu Jan 10 16:00:48 2013] [error] [client 127.0.0.1] File does not exist: /var/www/js/jquery-1.8.2.min.js, referer: http://localhost/testrkt.lsp [Thu Jan 10 16:00:48 2013] [error] [client 127.0.0.1] File does not exist: /var/www/js/bootstrap-datepicker.js, referer: http://localhost/testrkt.lsp
xerxes on 2013-01-10 06:12:32.000
I had to resort to Firefox again to get the last comment sent
Rocket Man on 2013-01-10 15:35:04.000
Okay, so the issue is with the script headers in GetDbVals.lsp. I think I know what the problem might be. Make sure that at the end of that file you add the command (display-page). This line is required for any page that runs in Rockets, even if the page doesn't display anything (like in your example). The reason is that (display-page) actually displays all the headers required by Apache, displays anything you wanted to put on your page, and then calls (exit). Without (display-page) in your source code at the end of the file, there are no headers printed at all, thus Apache cannot execute the script.
If you don't want your page to display anything and you just want to redirect from that script back to the main page (or any other page) then use (page-redirect). This will display all the headers WITHOUT displaying anything and redirect to a new page.
This is definitely something I need to put in the documentation for Rockets because it's not immediately obvious!
xerxes on 2013-01-11 01:14:29.000
xerxes on 2013-01-11 03:58:24.000
Well, (display-page) did it. I put in (display-footer) before it for good measure.
Thanks. Now I can really start put stuff in, knowing that the bones are there!
xerxes on 2013-01-11 06:11:39.000
And using (page-redirect) to the input page solved the "true" hangover ...
xerxes on 2013-01-11 06:12:04.000
this is such a joy
Rocket Man on 2013-01-11 13:08:23.000
That's great! I'm glad to see things are working now. You're right, working in newLISP is always a joy. :)
xerxes on 2013-01-15 12:44:55.000
Next will be an attempt to get this going on Win 7, with wampserver. Let's see how it goes!
Rocket Man on 2013-01-16 13:22:35.000
xerxes on 2013-02-02 02:07:00.000
Well, now. All was going well. Then, all of a sudden, I get "Invalid Request" when I try to load the test file on localhost. I guess it has to do with the fact that I installed web2py out of curiosity, because I think it is since then that the error has come up. Yet I can't see any changes made to my apache setup, and apached is running. Sigh. And that, I guess, is web-writing for you.
xerxes on 2013-02-02 04:08:29.000
And ... it was indeed web2py. It over-wrote the default file in /sites-enabled/ with all of its own stuff. I am too duff at all this to try to make them co-exist, so I removed web2py, and recreated the default file to enable .lsp scripts as cgi.
Now, back in the saddle.
I suppose I should really give up trying to run Rockets on wampserver, given all the other things that happen on my Win 7 machine: it has Visual Web Developer on it, too, which is bound to over-ride apache with IIS as a Windows Service. Well, that's what I discovered last time.
So, it will be Ubuntu for Rockets, and Windows 7 for whatever I can get working there without delving too much!
xerxes on 2013-02-02 04:10:19.000
more funnies in Chromium: When I tried to post this message from Chromium, I twice, on two separate tries (signing out/in between), got: Sorry! We couldn't process your request, probably due to a timeout. Please refresh the page and try again. These last two posts are from Firefox.
Rocket Man on 2013-02-02 17:46:31.000
Yeah, that error message seems to come up for some people (I've seen it twice on my machine but it's not easily repeatable) but refreshing the page got rid of it. I'll have to track down exactly why it does that-- it's definitely a bug in my code somewhere, but without steps to repeat it consistently I don't know how to debug it just yet. I'll try Chromium and see if it happens more often (I usually post from Chrome on OSX, though, so I'm not sure why it would happen in Chromium and not Chrome)
I run PHP on Apache concurrently on this server with Rockets, so in theory you should be able to run web2py as well at the same time, but it would take some fiddling around with the sites-enabled config files. But if you aren't using web2py it makes sense to leave it uninstalled.
Best of luck with your efforts!
xerxes on 2013-02-02 23:49:00.000
xerxes on 2013-02-02 23:49:52.000
PHP ... I have read so much about it, tried it, and it seems very easy to grasp, with lots of useful libraries, and yet ...
Because I don't write web stuff for anyone other than myself, maybe, I have just not been able to get into it. newLISP feels very natural when I look at it, but PHP always looks like it's trying to be something, and possibly just succeeding despite all the odds! Perhaps it's all those dollar signs, yanking me back to my QBasic (shudder) days, but I can't get into that or Perl.
Once more, I posted this from Chromium, with no success, even after refreshing a few times. So this is from Firefox.
Rocket Man on 2013-02-03 00:54:24.000
Yeah, I have coded in PHP when I absolutely had to at work, and didn't really like it. newLISP is the only language that felt natural and fun for me. PHP is kind of messy.
But I have it running so I can host my legacy bulletin board system on my personal website (it's read-only now, but it ran from Aug 17, 2002 - Apr 5 2011 and I wanted to keep the archives up).
I will try downloading Chromium and see if I can replicate the error. It's weird because it seems to be posting something but just failing to gracefully transition from that something to the thread page (which is why it throws the error).
xerxes on 2013-02-03 20:47:07.000
I am having another try from Chromium now, because I notice that Ubuntu has just sent through some updates.
xerxes on 2013-02-03 20:47:21.000
and that worked!
xerxes on 2013-02-03 21:01:29.000
But, the text below did not. It's a time-out issue of some kind. So this is from Firefox.
It seems you do your work on OS X, but use an Ubuntu server. Interesting. I had a Mac Mini for a while, the whole idea being that because Apple is renowned for good sound, I'd use Sibelius for composing and arranging. That was because Vista was really such an atrocity, and Sibelius had all sorts of issues running under Vista.
In the end, the Mac Mini was no better. Sound quality on playback was far superior to Vista, and superior to that on my (Win 7) Dell Vostro. But the program kept on crashing. Long story short, Apple support blamed Avid (who now own Sibelius) and Avid blamed OS X. In the end, I gave the Mac Mini away. My daughter and her partner now use it as a media centre. They watch all their videos from it, and listen to all their music on it, and confirm that both video and sound really trounce their previous Windows job.
I now use Sibelius under Win 7. The sound playback can be a problem, with some stuttering, no matter how many times I try to configure it differently, nor how many updates I apply. Hell, I was a pro musician for 50 years, and none of the humans had problems like this on playback! But at least the program does not crash, and I lose nothing.
Rocket Man on 2013-02-04 11:43:43.000
Yeah, I will be adding some debug code to that error message and trying Chromium myself on my Macbook. Eventually we'll figure it out!
I haven't done much sound stuff other than use Audacity to edit podcasts. I do like OS X but I use Windows 7 as my media center, so I'm fully stocked with operating systems!
xerxes on 2013-02-08 01:58:06.000
On our intranet, there is no need for captcha, some I am going to attempt registration/login without that. If I get stuck, I'll ask for help :)
Rocket Man on 2013-02-08 13:23:24.000
Not having to do captcha makes life a LOT easier. I'd be glad to help you with any questions you might have.