Hmm I seem to have gone from 3-a-day topic based posts to once every few days, all-in-one posts. Maybe I’m getting lazy, or maybe it’s 3:30am again and I realise that I have something to blog about when really I should go to sleep and wait until the morning.
Well my PHP assignment is going a bit wrong and I have to submit it by 7pm today (today in the after ‘it’s after 00:00am’ sense, not the ‘new day when you wake up’ sense…)
I have to create an Apache Log Viewer thingy which takes user input via an html form for start and end days and times and then produces wonderfully detailed reports on various things from the logs. Which is fine except I don’t really know PHP and I’m a weak programmer. Plus we haven’t been taught more than basic syntax, commenting and variable manipulation in this module.
So, my thing is going ok, we were given an extension because several facilities weren’t working that we were supposed to use and I have all of my form and log file reading working ok except for one thing.
My form values are being POSTed fine across to the results page which does all of the validation before doing any calculations and whatever on them. I can echo them out no problem, except that as soon as I try to assign $_post[“whatever”] to any kind of variable or manipulate it with any kind of function, all I get is the same values every time, no matter what I enter into the form:
This is just the output of me echoing the variables’ content after trying to do anything with them. Same every time regardless of what I enter. The first 3 are the start values for day of current month, hour and minutes, the second 3 are the same for end times and the final one is a report interval in minutes. I have to produce separate reports for each interval of the specified size for the time between the start and end times. Apart from all being wrong, the minute based ones are 00 while the rest are 01.
I don’t know what the hell is wrong. All I have done with them before this is check that they are in the right range (day is not less than 1 or more than number of days in the month, minutes between 0 and 59 etc), I can still echo the posted variables correctly after this, as soon I try to do anything else they go weird and I get the same values as above each time.
I need to put them into 2 digit day or time format, eg 00-09 and then 10+ and so on but I can’t touch them because I get the above output, I can’t think why this could be, unless it’s because they’re strings and I have to cast them to ints, longs or some kind of date/time type, but I thought PHP did this for you. It would also be nice to find a checktime function, like checkdate that just checks that your values are valid times and formats them according to your whims. I’ll have to play with strftime more. Until I can solve my weird variable problem and format my days and times to be 2 digit I can’t do any date/time analysis or create separate time based reports, which means I’ll struggle for a D. Shit. Maybe I have this all wrong.
On another note, I’ve been playing with my webcam today. I’ve never really bothered with it much before because I hadn’t had much luck with it under Linux until I started using Ubuntu, even though it is supported. It’s a Philips webcam so how much longer it remains that way I don’t know.
Well anyway, I wanted to record a video clip. Couldn’t. XawTV will display the stream but won’t save it to disk. Back to Windows to give the old driver CD a whirl. Installed the utils that came with the camera way back when and recorded an extremely long clip without a problem, no dropped frames or anything, apart from that I had let it run too long and the software stopped recording at 4GB. It occured to me that this was a home-user product from the Win98 era, quick check on FAT32 file sizes and yep I was right. Max file size is 4GB. Obviously to prevent the software hanging and the OS having to intervene to stop itself going down too, the video capture app cuts the file off at 4GB. Shame, what I wanted to record would have been about 45GB. Don’t know why it didn’t get the max file size from the OS or the filesystem type. Win2k had just come out at the time (ie NTFS – 16 terrabyte max file size). There are no newer versions of this software available either unless I’m paying I guess and it’s an OEM product, probably tied to the camera model like some optical drive manufacturers do with copies of Nero.
So I’ll have to put more work in on XawTV, I’d much prefer to use Linux anyway, Windows was just a case of having to make it work quickly. I just want to be able to use it as a cheap and nasty ‘capture a moment’ type device that is easily portable with no file size problems.
After this I decided to play with setting up a webcam page on my desktop’s Apache server. I’ve been interested by this idea for a long time. I came across some useful links by chance today. I used the webcam utility (can’t find a link, you try searching google for linux webcam utility) and this tutorial and I was up in minutes. Delighted.
Whether the drinkycam ever goes live to the world is another question. I don’t really fancy having my every move publicly available (unless there was money or sex involved…) and I don’t want to have to remember to turn it around everytime I get dressed/undressed, go to sleep, pick my nose, scratch my arse or whatever people do without thinking about it when nobody is around.