Mushy-pea 36 What, you can change this tag?

Hello everyone. I read ~S.O.S.~'s signature today and it reminded me of somthing. The essence of it was a claim that you can't doubt logic or perception. About a year ago I had some experiences that brought logic and perception into direct conflict. These experiences might be called "daylight hallucinations" by some. By this I mean I was sober (on no strange chemicals) and seeing things happen that just "can't" happen. This happened to me intermittently over a period of several months (and at times was very scary).

I'm not going to go into details here, because its somewhat personal. However, suffice it to say I was faced with a choice: whether to believe logic or my own perception. My choice was to believe the hallucinations were reality (for a while) and construct a logical framework into which my strange perceptions would fit. This, however, lead me to the conclusion that I was....erm....dead....and in the after life. Basically, this perception vs. logic conflict opened a rather large can of worms for me :surprised .

Anyway, I'm better now (and certainly alive, I think :p ). So, my question is, has anyone else here faced a similar mental breakdown and how did you cope with it?

Steven.

Mushy-pea 36 What, you can change this tag?

Its a sad and perhaps little known story that two of the greatest mathematicians of the last century died in tragic circumstances. Alan Turing (as the "homepage" states) killed himself with a cyanide laced apple. This is perhaps because, having made ample use of his code breaking work during the war, the British turned to persucuting him for his homosexuality :mad: . Kurt Godel starved himself to death at the age of 70, believing people were trying to poison him through his food :sad: .

Steven.

Mushy-pea 36 What, you can change this tag?

WYSIWYG stands for What You See Is What You Get. A WYSIWIG web page editor is an application where you can build a web page a bit like you would build a page on a word processor or desktop publishing app. You place the various items (i.e. text, links, images) where you want them to appear on the page and the editor generates HTML to represent this. When you view one of these pages on a browser it should look just like it did on the editor.

Steven.

Jaysun commented: Awesome answer! +1
Mushy-pea 36 What, you can change this tag?

Hello. Here is me just after graduating from Surrey. It's about a year old.

Steven.

EDIT: oops....Scaling this image down has made my eyes look allweird and squinty.

Mushy-pea 36 What, you can change this tag?

Yes :p . Local testing is go. Thanks for the advice.

Steven.

Mushy-pea 36 What, you can change this tag?

Hello everyone. I decided to try out XAMPP ( http://www.apachefriends.org/en/xampp ), which contains a pre configured distribution of Apache 2.2.3. My intention is to use it for some local testing of a web application that uses Perl scripts. I got Apache running easily enough and it runs the sample Perl script that comes with it fine. However, when I ask it to run my script I get

The server encountered an internal error and was unable to complete your request.

Error message: Premature end of script headers

The test script and mine both start with

#!"C:\Program Files\xampp\xampp\perl\bin\perl.exe"
print "Content-type: text/html"

The script is in the "htdocs" directory within the XAMPP directory. Can anyone think what might be going wrong here? Any help appriciated.

Steven.

Mushy-pea 36 What, you can change this tag?

Well, "installing" it turned out to be easy and I soon had Apache running. I tried the sample Perl script "perltest.cgi" and it worked on the server. However, when I ask the server to run my own script I get

The server encountered an internal error and was unable to complete your request.

Error message: Premature end of script headers: forum.cgi

I can't see what's wrong with it by comparing the top of my script with "perltest.cgi". Did you run into problems like this Matt?

Steven.

Mushy-pea 36 What, you can change this tag?

Nice one, that sounds like just the job :p . I'll give it a try. Thanks.

Steven.

Mushy-pea 36 What, you can change this tag?

Hello everyone. I've been working on a web application (written in Perl) called perlBB for about 11 weeks ( http://sourceforge.net/projects/perlbb ). I'm getting close to finishing an early version. However, suitable testing methods have become a bit of an "issue" for me on this project. So far I've been testing the code from the command line on my local machine and on a web server that I have an account on. This is OK until I start wishing I could test my application on the local machine "as if" it was running on a server. i.e. a server running on my computer.

I know I could try installing a server on my computer and use that as a test bed, but I have two reservations:

1. The machine in question uses Windows 98.

2. I am thinking that installing a web server and getting the Perl interpreter to work with it could prove rather tricky for a novice like me.

Does anyone know of available test bed systems that fit this bill and aren't too much on the difficult end to set up (on Windows 98)? Any advice appriciated.

Steven.

Mushy-pea 36 What, you can change this tag?

I found this:

http://www.mushypea.co.uk/images/mushypea.gif

Interestingly, I've just registered a domain in my name with a very similar URL. Be assured I'll be back to SPAM the Lounge with info about it soon (in a nice way :p ).

Steven.

Mushy-pea 36 What, you can change this tag?

I love the way Bruce Willis always starts off with a clean white T-shirt in those films, then it gradually gets more torn and covered in blood and dirt as the film progresses. Correct me if I'm wrong, but haven't there already been four Die Hard films (Die Hard with a vengence being the fourth)?

Steven.

Mushy-pea 36 What, you can change this tag?

Hello everyone. If you're a regular Perl user you might already know this; the developers of Perl 6 are using a prototype version of the Perl 6 interpreter written in Haskell to do various "proof of principle" testing. It's called Pugs (maybe a pun on the Haskell interpreter Hugs). However, the developers' website states that a parallel project called Parrot is the "final target for the Perl 6 interpreter". Parrot is written in C and does sound quite cool, as its designed to compile various languages (including Perl 6) into a common bytecode.

But my question is, why not stick with Haskell as the dev language for the production Perl 6 interpreter? I don't have anything against C, except that it seems to be used for building all and sundry. If the developers have found that another language provides a usefull platform for development, why not be diverse and stick with it? I know some might say that C allows the most portable programs to be written, but I think this can be true of various languages if they have good enough libraries bundled with them. Just my opinion. What do others think?

Steven.

Mushy-pea 36 What, you can change this tag?

Thanks Kevin. Actually, I have decided to release the application I am working on (perlBB) as open source software. So, if you want to have a peek at the code you can visit the project home page on Sourceforge (http://sourceforge.net/projects/perlbb ). The if....else construct I mentioned is in "sub update_list" in /perlbb_0_4/forum.pl.

Steven.

Mushy-pea 36 What, you can change this tag?

Hello everyone. I was just wondering if it is OK to do this:

if ($beer == $wine) {# Some code}
elsif ($beer == $vodka) {}
else {die("Oh dear!  Neither condition satisfied!")}

i.e. have an empty block attached to an if, elsif or else. It might sound like an odd question, but I don't want to put undefined behaviour into my program by breaking some obscure rule. Any advice appriciated.

Steven.

Mushy-pea 36 What, you can change this tag?

definition: single: never been married. shacking up with someone doesn't constitute marriage in most places. So, you are either single, married, divorced or windowed. There are no other categories

Hmmm, not with you on this one. Many couples these days live together as if they were married for years, even buying a house and having children together. No one would call such people single, except in a strictly legal sense. I think marrige means less in terms of someone's place in society than it used to. For a woman to bear a child out of wedlock (in England) used to be the height of scandal only a hundred years ago. Now its a matter of personal choice.

Steven.

Mushy-pea 36 What, you can change this tag?

too shy to talk to women in the wild

I said somthing similar to that to a friend once. You know what he said?

I think strong larger is the key

Since then I've found there's some truth in his advice :p . Don't get too drunk and try to pull though or it'll be worse than if you were sober :lol: .

Steven.

iamthwee commented: good advice(iamthwee) +6
Mushy-pea 36 What, you can change this tag?

Hello everyone. I am getting close to completing an early version of my open source forum system perlBB (http://sourceforge.net/projects/perlbb). I was wondering if someone could give me some advice about distribution of code between modules. In the scenario that the perl scripts in my system are run non - persistantly on a server, they will of course have to be compiled to bytecode every time they're run. So I need to place an upper limit on the size of any one script to avoid performance bottlenecks caused by long compile times.

At the moment the core script is about 25 KB and will (when finished) handle the most common requests. Should I be thinking about splitting into modules at this point? Or maybe that already sounds too big for a CGI script. Any advice appriciated.

Steven.

Mushy-pea 36 What, you can change this tag?

Hello everyone. Does anyone know if there is a way to start a child process from within a script, then capture the child's standard output and exit code? From looking at the docs it seems that

$status = system("command");

lets you capture the exit code but not STDOUT. While

$output = `command`;

gives you the STDOUT but not exit status. Any help appriciated.

Steven.

Mushy-pea 36 What, you can change this tag?

They can use whatever they feel like using. However, if I ever get around to writing a programming language you'll find the docs look a bit more like this:

if ($beer == $wine) {print "Everything tastes the same these days"}
or if ($whisky == $vodka) {print "I never liked vodka."

Steven.

Mushy-pea 36 What, you can change this tag?

Game: Sonic the Hedgehog (Megadrive)

What: Level select menu

How: At the title screen press up, down, left, right and then A and START together. This has to be done quickly so it might take a few times to crack it.

Game: Sonic the Hedgehog 2 (Megadrive)

What: Level select menu

How: Go to the options screen and play these sounds in this order in the sound test section: 19, 65, 9, 17. You should hear a ring sound. Return to the title screen and press A and start together.

Steven.

Mushy-pea 36 What, you can change this tag?

Ah, I see. However, I am actually using strict in this program. I only posted a snippit of code so that can't be seen. At the top of the code you would find:

#!/usr/bin/perl -wT

use strict;

Which I think is equivalent to what you are suggesting.

Steven.

Mushy-pea 36 What, you can change this tag?

Hello everyone. I'm sure a few people around here have played a few computer games. But how many cheats do you know? To set the ball rolling I'll list my favourite ever cheat first:

Game: Star Wars Knights of the Old Republic (Xbox)

What: Turn Zalbar the Wookie into a Jedi.

How: The details are hazy now. I think you had to hold the main character's level back to 3 until you reached the stage when you gain a Jedi level-up. You also need to hold Zaalbar back to level 6. Then when you're ready to level-up to a Jedi you pull a little trick with the control pad and BANG! Your faithful Wookie can use lightsabers and force powers :p (making him the deadliest character in the game).

Portability: I am unaware if this cheat works on the PC version of the game.

Steven.

Mushy-pea 36 What, you can change this tag?

You don't need to deal with ports or FTP to do this. What you require can be done with a form on your website and a Perl script to process the form on the server. There may be open source scripts that can fill your requirements already out there (try HTadmin). However, if you want / need to implement your own solution you need to first assess your requirements. The script will need to do the following things:

1. Validate and process the submitted registration forms.
2. Update a record of registered users, using either a text file or a real database.
3. Process login forms and check username / password details against your database / text file.
4. Serve "members only" pages to those who submit the correct details.

If you do take this approach, look into cgi-lib. It's a Perl library that will make processing forms easier. Also, be sure to check your code is secure before putting it on your website or you might get hacked into. I think your best bet though is to search for existing scripts on Google. Good luck.

Steven.

Mushy-pea 36 What, you can change this tag?

Hello everyone. I'm still working on that forum system I mentioned a bit ago (perlBB). Hopefully it'll be ready for Christmas :p . However, I ran into a strange problem while I was re-writing parts the two functions below.

sub enter_post {
my(@field, $input, $offset1, $offset2, $n, $name, $field_length, $flag_guest, $flag_verify, @data, $lockfile, $output, $write_length, $write_length2, $post_id, $post_num, $dbase, $chunk, $chunk2, $num_links, $link, $num_replies, $offset_last, $result_all, @stat, @date, $check, $link_check, $dbase, @offset_ext, $flag_reply, @week_day, $num_records, @expected_names, @max_length, @link_info); @expected_names = ("enter_post    $conf::password", "username", "password", "subject", "content", "flag_reply", "thread_id"); @max_length = (4, 14, 14, 48, 8000, 3, 10);
$offset1 = 0; $post_num = 0; $chunk = ""; @week_day = ("", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"); print "\nenter_post()";
&process_form(\@field, 7, 1, @expected_names, @max_length);
$check = ($field[5] eq "no" && $field[6] ne "null");
unless ($check == 0) {&security_alert("Form field conflict.", 1, 0)}
$check = ($field[5] eq "yes" && $field[6] eq "null");
unless ($check == 0) {&security_alert("Form field conflict.", 2, 0)}
if ($field[2] eq "null") {$flag_verify = 1;}
else
{
$flag_verify = &verify_user(@field);
}
@stat = stat($conf::MESSAGE_DB);
$lockfile = "lockfile3.txt";
while (-e $lockfile) {sleep 1;}
open(LOCK, $lockfile);
close(LOCK);
open(file8, "+<", $conf::MESSAGE_DB) || die("Unable to open $conf::MESSAGE_DB for writing.  $!");
@data = <file8>;
if ($field[5] eq "yes")
{
$flag_reply = 1;
@link_info = &update_links(@field, $link, @stat, \@data);
}
elsif ($field[5] eq "no") {$field[6] = &new_thread; $flag_reply = 0;}
else {&security_alert("Invalid form value.", 3, 0)}
unless ($flag_verify == 1) {&security_alert("User privalidges violation.", 4, 0)}
@date = localtime(time);
$date[5] = 1900 + $date[5];
unless …
Mushy-pea 36 What, you can change this tag?

I would guess it has somthing to do with cookies (or a lack of them on Justine's computer).

Steven.

Mushy-pea 36 What, you can change this tag?

Hello everyone. Does anyone know why Unix developers seem to have an obsession with the words foo and bar? Anyone who has read many Unix manual pages or the official Perl documentation will know what I mean. They appear as example variable or parameter names all over the place! Maybe it has somthing to do with FUBAR (**cked Up Beyond All Recognition) :p .

Steven.

Mushy-pea 36 What, you can change this tag?

Hmmm, I decided to leave Daniweb once. But look at me now, still posting away :p . Guess I'll be staying then. So, I don't think you'll be getting away that easily Justine :) . Hope to hear from you soon.

Steven.

Mushy-pea 36 What, you can change this tag?

I suspect there are billions of planets in the universe that have water. We earthlins are probably not alone.

I suspect you are correct. But consider this; if the universe is spatially infinite and (on large distance scales) of uniform density, intuition suggests that there are an infinite number of other stars and planets out there. Probability theory suggests that if one travelled far enough from Earth they would eventually reach a region of space with "exactly" the same configuration of matter and energy as our solar system. In other words a replica Earth (with a replica Dani of course). There would actually be an infinite number of identical Earths if you follow this argument to it's logical conclusion.

Steven.

Mushy-pea 36 What, you can change this tag?

Hello everyone. Which of these do you prefer? As people who know me would agree, I'm a bit of a depressive ******* somtimes :sad: . So, obviously I'm voting for the Chronicles (which for the uninitiated, is one of the darkest fantasy series' ever written). I do really like the other two as well though.

Steven.

Mushy-pea 36 What, you can change this tag?

Of course, you could try to build a game that doesn't use any high - res graphics. Ever heard of ZZT? That's what I'd do if I wanted to build a game for a hobby. Why? Because I'm too lazy to even try to learn all that 3D programming bumf :p .

Steven.

Mushy-pea 36 What, you can change this tag?

Thanks you two. Problem solved. I like the avatar Salam and a nice sentiment, keeping to standards and all that. But tell me, can using

void main ()

ever cause undefined behavior in a program?

Steven.

Mushy-pea 36 What, you can change this tag?

Hello everyone. I was writing somthing in C++ today and a little "issue" occured to me. How can you avoid the possibility of a buffer overrun when reading from STDIN into a character array? In this simple example

#include <iostream>
using namespace std;

int main ()
{
char *some_text = new char[10];
cout <<"Enter some sample text: ";
cin >> *some_text;
}

all seems well and good at first glance. But if someone enters more than 9 characters at the prompt they'll be a buffer overrun. The string of characters entered by the user is (I assume) copied into *some_text from a buffer outside the program. So how do you make sure no more than 10 characters are copied into *some_text? Begginers question I know, but an important one. Any answers appriciated.

Steven.

Mushy-pea 36 What, you can change this tag?

Please post some of the code you have be unable to compile and the compile errors you have been getting. Then someone might be able to help.

Steven.

Mushy-pea 36 What, you can change this tag?

i know its wierd but my cousin (shes female) always makes herself male when shes setting up profiles for forums as it means she gets chatted up less by desperate guys

I've believed I was desperate at times, but I see now I wasn't that bad on the scale of things.

Steven.

Mushy-pea 36 What, you can change this tag?

Hello everyone. I would imagine a fair few people who hang around in this forum have done or are doing computing related degrees. I was just wondering, do computer science / related degrees these days contain material on upcoming new computing technologies like quantum computing and biological computing? You can find some interesting articles about these technologies here:

http://news.bbc.co.uk/1/hi/sci/tech/358822.stm

http://www.daniweb.com/blogs/entry904.html

Steven.

Mushy-pea 36 What, you can change this tag?

Tutorials are good for learning the basics of a language. However, if you want a reference resource where you can look up a manual page on any keyword (with some tutorials thrown in as well) try out

http://perldoc.perl.org

They've got a particularly good tutorial on regular expressions here

http://perldoc.perl.org/perlretut.html

I recommend it.

Steven.

Mushy-pea 36 What, you can change this tag?

On the topic of making money out of software, what do people here think about the Sun Microsystems "participation era" approach. This being to make some of the software open source and try to make money from support contracts and such like (and hardware sales in their case of course). Then there's the idea of letting users contribute to the development process (as in "J2SE 6.0 (community developed)" - Sun Microsystems). Interesting ideas don't you think?

Steven.

Mushy-pea 36 What, you can change this tag?

Hello everyone. I've been using my parents computer for a while to do various usefull stuff. It has Windows 98 SE and has been on broadband with no virus scanner or firewall for months. Before that it was on dial up for years with no protection. Thankfully it's still going strong :p . Except that the icons for various things keep changing to different types. Like today all the Word document icons changed to Napster icons in Explorer and the "Get Quicktime" icon changed to an "MS-DOS app" icon. This has been going on for a while now but there are no other symptoms. Do you think it's a virus or maybe I'm just being paranoid? Any advice appriciated.

Steven.

Mushy-pea 36 What, you can change this tag?

To make a Perl script display a page you have already created, do this:

open(file1, "thanks.html");
@data = <file1>;
close(file1);
$page = join("", @data);
print "Content-type: text/html\n\n$page";

Just make sure your thanks page has a link for the user to get back to the rest of your site.

Steven.

Mushy-pea 36 What, you can change this tag?

Insomnia by Faithless:

I only smoke weed when I need to
And I need to get some rest yo
Where's the sense?
And I confess I burned a hole in the matress, YES, YES
It was me
I feel guilty

And at the count of three I pull back the duvet
To the refridgerator
Only one dry potato
No lie
Not even bread or jam
As the light above my head went BANG

Greasy
Somthing's all over me
Insomnia please release me
And let me dream of making mad love on the heath
Tearing off tights with my teeth :p 
But there's no relief no peace
I toss and turn without cease

Creepy noises make my skin creep
Oh if I could only get some sleep
I need to get some sleep
I can't get no sleep

Steven.

Mushy-pea 36 What, you can change this tag?

I've tried version 0.3 (alpha). Average uptime: 5 to 10 minutes. No, I'm not joking. Somtimes it would die after a specific event, other times it would just randomly bomb out for no apparent reason. Then it's the Black Screen of Death (not even an exception code). It crashed during the install a couple of times too. which is never a good sign.

I installed it on a 1.3 GHz AMD (original Athlon) system that I've sold now. Maybe it was some kind of incompatability with the AMD chip I was using, but after ten years you'd think they would have got on top of things like that. Unununium is my favourite OS project, so I've joined the development team. It's got no kernel. I'd like to see someone try and sue those guys for stealing others ideas :lol: .

Steven.

Mushy-pea 36 What, you can change this tag?

Actually (I should have said this at the start), the regexes were inside an eval so I'm not surprised that strange things were happening. At the time it appeared that the matches extracted from one regex were not being overwritten by those from the next match. However I could be mistaken about this. Anyway, I've found a better way of doing what I was trying to and there's not an eval in sight. It works as well :p . Thanks for the advice.

Steven.

Mushy-pea 36 What, you can change this tag?

Hello everyone. I recently came accross the concept of Turing completeness (in languages). I was wondering, is there a general method for determining if a language is Turing complete? Or is it one of those intuitive things where you just have to look at it for a while and go "oh yes" (or "oh no)? When I say a general method I mean a mathematical proof. This isn't a support question, I'm just curious. Any answers appriciated.

Steven.

Mushy-pea 36 What, you can change this tag?

Hello everyone. I've run into a problem with regular expressions; the extraction "variables" ($1, $2, $3 etc.) are read only and scoped to the current block. If you need to do two regex extraction operations in the same block, is there a way to reset the ($1, $2, $3 etc.) so they can be reused? Any help appriciated.

Steven.

Mushy-pea 36 What, you can change this tag?

I did Physics at university and the course included some numerical modelling work. Guess what language we were given to learn first....Fortran. It has some neat features, like having loads of fancy mathematical functions built into the core of the language. Since learning about other languages I've realised it's not really worth using unless you're doing heavy number crunching. But somthing I've noticed is that every other language I know about has many similarities to it. This is not surprising as they all came after it.

So, I'd recommend learning Fortran to a wannabe programmer. It's the original and best :p .

Steven.

Mushy-pea 36 What, you can change this tag?

Thanks Kevin. I read somthing on a site called www.pageresource.com about that issue. I usually use perldoc.perl.org for things specific to Perl. Guess it could have been a typo.

Steven.

Mushy-pea 36 What, you can change this tag?

"Well, bye. Oh, I didn't catch your name." you say. "Yes, well thats the thing. You can't put a name to a face somthimes, ha ha!" he chuckles. You shrug and walk through the door marked "I can't understand myself any more....".

EXPERIENCE POINTS GAINED: 50 (TOTAL 50).

As soon as you're through the door you notice the air in the tunnel is cold and you're breath is showing up as steam. Regularly spaced torches along the left wall provide a dim illumination. As you walk nervously down the (5 foot wide) tunnel you notice there are some mirrors on the left wall up ahead, stretching into the darkness. However, as you get near to them you notice yourself becoming invisible. The closer you get the fainter you become. You stop and consider going back, but you've seen enough films to know that won't save you.

As you reach the first mirror you're completely transparent directly but can see yourself clearly in the mirror. Hmmm, no big deal you think. You pass by and approach the next mirror. What you see in it is yourself....with your left arm missing :!: . Obviously there's a lot of blood spraying out of the hole and you scream in horror and grasp your....arm? You can feel your arm is still there and intact. You turn away from the mirror, "It's just an illusion, keep it together now" you can hear your thoughts saying behind your hammering heart.

A few …

Mushy-pea 36 What, you can change this tag?

Hello everyone. I've tried several times to use associative arrays in my Perl scripts, but each time I have got syntax errors I can't understand. Based on the tutorials I've read I have tried to do things like this:

sub test_function {
my($key, %table); %table = ('word1', 'Perl', 'word2', 'is', 'word3', 'great'); $key = "word3";
print $table('word1');
print $table("word2");
print $table($key);
}

Each syntax used above produces a compile error and I can't work out the correct useage. Could someone tell me what I'm doing wrong? Any help appriciated.

Steven.

Mushy-pea 36 What, you can change this tag?

Hello everyone. I'm trying to write a small Perl script to test a web application I'm developing. The problem is it needs to open a cookie file in the "Temporary Internet Files" folder and Windows seems to be denying it access. The shell seems to be blocked from accessing this folder as well, so I can't use that to copy the file to a normal location from within the script. Will I have to use a system call to access this file or is there a simpler way? Any help appriciated.

Steven.

Note: I'm using Windows 98 SE (i.e. the best Windows ever :p ).

Mushy-pea 36 What, you can change this tag?

Hello everyone. I will soon be releasing an early version of my open source bulletin board system, PerlBB. Can you guess how I thought the name up :p ? I'm not going to say whats special about it here, but there will be plenty of promotion on my homepage when it's ready. Anyway, I was wondering if anyone would like to help me out by designing a logo for the project. I'm not really the arty type you see. You can be in the credits of course (if you want to). Kind of open source artwork you could say. Any ideas would be appriciated.

Steven.

P.S. You might even get famous :) .