KevinADC 192 Practically a Posting Shark

I don't think that has anything to do with the daniweb website.

KevinADC 192 Practically a Posting Shark

if $text is always in that same format:

$text = "JEZEBEL (Disc, 1938)";
my ($title,$format,$r_date) = $text =~ /^(\S+)\s*\(([^,]+),\s*(\d+)\)/;
my $sql = "INSERT INTO movies (TITLE, MEDIA, YEAR) VALUES ('$title', '$format', $r_date)";
print $sql;
KevinADC 192 Practically a Posting Shark

Steven,

single-quotes inside of double-quoted strings have no special meaning. No need to escape them.

KevinADC 192 Practically a Posting Shark

jemather,

the code you posted shouldn't even produce values for the scalars in the $sql scalar.

('".$title1."', '".$format1."', ".$r_date1.")"

there are no $title1 or $format1 or $date1 scalars defined in the code you posted. You have $title and $format and $r_date.

with the correct scalars, the line is better written without using any concatenation at all:

my $sql = "INSERT INTO movies (TITLE, MEDIA, YEAR) VALUES ('$title', '$format', $r_date)";
KevinADC 192 Practically a Posting Shark

Likewise

this thread is from 2005, hopefully Shon05 has his program done by now. ;)

KevinADC 192 Practically a Posting Shark

<edit>sorry, posted in wrong thread</edit>

KevinADC 192 Practically a Posting Shark

I blocked that one a long time ago. It should NOT still be appearing. Will investigate ...

I just got it again. :mad:

See attachments. :sad:

KevinADC 192 Practically a Posting Shark

Some sections of the site are literally wall-to-wall advertising. Probably by accident, but still its as bad as it gets as far as size and placement of ads goes. See attachment. Screen shot is of code snippets section of site.

KevinADC 192 Practically a Posting Shark

I don't see what's wrong with doing such a thing, after all it's not like you're breaking the file-size requirements; you're still using up the same amount of space on the server.

I don't see what's wrong with it either, I've been doing it for years. :mrgreen:

Notice the laughter and smilies in my other post, I wasn't being serious. ;)

KevinADC 192 Practically a Posting Shark

hehehe... the forum moderator letting the forum members (at least the ones that couldn't figure it out) know how to defeat the file attachment restrictions. :)

As you can see, it's not a very sophisticated MIME checking routine. :D

KevinADC 192 Practically a Posting Shark

Oh come on Kevin, how can you say that ? What do you think should be done to make each and every contributing core member feel special ?

I don't think this website should try and make people (especially not each and everyone) feel special. Maybe just a poor choice of words on your part. They should get the sense this is a site that is compelling (in a broad sense) enough to want to return. From there they might develop a more intimate level of participation that can grow to a real sense of feeling like a part of a community of like-minded people, or if not like-minded, at least respected and taken seriously when the situation calls for it.


I do agree there are not many Perl hackers around here, but that shouldn't give you the feeling that you are not wanted. I guess since you don't visit the Geek's Lounge, you are not accquanited with many people and vice versa.

I don't get the feeling I am not wanted. You have leapt to a conclusion, maybe partially my fault by my choice of words in previous comments.


Even though our paths never cross a lot, I hope even you have the same the desire to render help to people out there who desperately or badly need it.

The desire (motivation is a better word) I have for helping others is probably not the same as yours or the same as person XYZ. I …

KevinADC 192 Practically a Posting Shark

Thats horrible to think like that just cause of a miss understanding and what not....

Take care

You have misinterpreted what I said, maybe because you have taken what I said in your quote out of context, but maybe not. But I do appreciate your concern. :)

KevinADC 192 Practically a Posting Shark

why can't you use the system() function or qx// or backtiks? You can look into the Term::Readkey module which I have never used but maybe it can do what you want. You would most likely have to install it though.

http://search.cpan.org/~jstowe/TermReadKey-2.30/ReadKey.pm

KevinADC 192 Practically a Posting Shark

> My participation or lack there-of will not be missed or even noticed.
Actually that's not quite true, as *I* know who you are, and the administrator of the site knowing who you are has to say something.

hehehe.... you're a nice person, can I adopt you? :mrgreen:

KevinADC 192 Practically a Posting Shark

What sites? I came here from Tek-Tips, because at the time Daniweb didn't use IntelliTXT and Tek-Tips did. Now that this site is polluted with it too, I've been searching for a site that won't trash/spam your posts with "in-text advertising".

I've looked at Experts-Exchange, and didn't like it. Again, the ads: IntelliTXT, and popunders, in particular.

A few years ago, I was active on codetoad.com, but found the overall quality poor. Well, that isn't quite fair. What I mean is that there were a lot of "askers" compared to very few "answerers". I don't mind answering questions, but I want a site where I can learn, too.

The prevailing forum culture, particulary with vBulletin-driven forums (which I myself use), seems to put ad revenue, and SEO-nonsense, as top priorities. People pick a forum topic because it's "hot" and they think therefore they can get lots of traffic and revenue, rather than because they have anything to say about the topic itself.

So, I'll give Daniweb this much: a lot of work goes into the content, and historically there have been very knowledgable folks here. The culture is changing, though. I think Daniweb is at a crucial moment, and I'm interested in seeing which way it goes.

I have not citicised the quality of the content on the daniweb site, which I agree is very good. I have already said I think this is a good website.

Tek-tips has one small ad at the top of the …

KevinADC 192 Practically a Posting Shark

i think daniwebs ads are great
they dont get in the way and daniweb is free unlike say experts echange where there are loads of ads and you have to pay

I don't know how you could think the ads are great, but I could see how you think they are not intrusive. EE does have ads, but I don't see any ads on EE, I'm one of the "experts", the experts don't see adds and don't pay to use the site. Maybe daniweb could do that too? :cheesy:

KevinADC 192 Practically a Posting Shark

Dani, please see the attached screenshot.

Thats the same one I saw.

KevinADC 192 Practically a Posting Shark

JAS (just another spammer)

KevinADC 192 Practically a Posting Shark

Have to admit that I think the work that Dani has put into the placement of ads integral to the site layout without impacting upon usability/readability is amongst the best I have encountered.

As others have said, there should be no scrolly ads as Dani is pretty strict with the advertising folk over what she will and and will not allow here.

I see you are an administrator as well as a member of this forum in a variety of capacities, so I'm not surprised to see that you appreciate the efforts this site takes to balance the needs of advertisers with the needs of the forum members. But I trust you would be objective and criticise this site if you thought something was in need of criticism, so I take it that you are being honest and not just jumping to Dani's defense as a loyal member of this website/forum.

I disagree with you about it being the best or even better than many other forums. I post frequently on about 10 programming/web dev forums and daniweb ranks low in that regards.

Of all the forums I post on, this is the only one I have ever bothered to mention that the advertisments are starting to get too prominent, or as I put it: obnoxious.

Anyways, I've made my point, there is nothing new for me to add to it. This is a good site, keep up the good work.

KevinADC 192 Practically a Posting Shark

ive never encountered a scrolly ad

the whole point is supposed to be that there intellitxt and revelant banners instead of full screen ads

hopefuly there will never be any full screen ads. :eek:

KevinADC 192 Practically a Posting Shark

What ad scrolled across the screen? It's not supposed to do that! Can you take a screenshot next time you see it happen? Thanks!

if it ever repeats I will let you know. I was pretty surprised myself.

KevinADC 192 Practically a Posting Shark

alternatives that do the same thing:

print directly from file:

print "Content-type: text/html\n\n";
open (HTML, "<../path/to/your/file.htm");
print <HTML>;
close (HTML);

use a scalar instead of an array (slurp mode)

print "Content-type: text/html\n\n";
open (HTML, "<../path/to/your/file.htm");
my $html = do {local $/; <HTML>}; 
close (HTML);
print $html;
KevinADC 192 Practically a Posting Shark

maybe the expect module is what you need:

http://search.cpan.org/~rgiersig/Expect-1.20/Expect.pod

but you need to use Cygwin. See the above link.

KevinADC 192 Practically a Posting Shark

maybe you need to use an array instead of a scalar for capturing the reults:

my @result = $t->cmd(("grep - $filename.txt~ | wc -l | awk '{print $1}'"));

KevinADC 192 Practically a Posting Shark

The amount, size, placement, and etc, of advertisements on the pages is getting a bit obnoxious (one ad that scrolled across the screen was very obnoxious). I understand the need and the desire for advertising, but the pages are starting to look like billboards with some content thrown in instead of the other way around.

Regards,
Kevin

KevinADC 192 Practically a Posting Shark

that really looks like query string data, in which case the CGI module could be used to get you name value pairs into your script for further use.

KevinADC 192 Practically a Posting Shark

good guess, but no, there is no taint module (or taint pragma).

KevinADC 192 Practically a Posting Shark

windows does not read/use the shebang line. I don't tknow what the work-around would be for this problem. It works with the http server (apache at leat) because apache for windows does some kind of unix/shebang line emulation.

KevinADC 192 Practically a Posting Shark

Are you forgetting the "Content-type: text/html\n\n" line? If you do, the browser doesn't know that HTML is coming and displays the script source instead.

if you forget that line with perl generated output to a browser you get an internal server error. But the server error log should show an error about incomplete/malformed header. The exact error message depends on the http server being used.

~s.o.s~ commented: The only person to keep the Perl Forum alive ;) - ~s.o.s~ +9
KevinADC 192 Practically a Posting Shark

No Kani,
Actually I m working on a website which works as a webserver.I want that if we write a perl and call it through HTML then while we host this HTML page it is showing the source code of the perl and we don't want that.
I want tht when we code into perl in HTML then it will host the output of the perl.
Take an example suppose we are connecting a database in MySql through perl and hosting tht code through HTML then it should display the contents of the database or the query fired on the database not the source code of the perl.

Obviously you first need perl installed on the server. Then the server has to be configured to execute scripts instead of just returning the text like it would with html documents.

But as far as "hosting the code through html" goes, are you trying to use SSI tags to run scripts? You can do that in pages that the server knows to parse fo SSI tags, normally .shtml or .shtm pages.

KevinADC 192 Practically a Posting Shark

I'va just seen too many problems with it on forums associated with perl, mostly trying to install new modules but some other problems I don't remember off the top of my head. I used to recommend it too, but not anymore.

KevinADC 192 Practically a Posting Shark

Do you mean you want the perl code embedded in the html code (sort of like php)?

Search google for: "embedded perl"

KevinADC 192 Practically a Posting Shark

it should have been written like this:

for (@files) {
$_->close;
}

I had the object and the method reversed for some strange reason.

KevinADC 192 Practically a Posting Shark

take out this part of the code:

for (@files) {
close->$_;
}

and see if that helps.

KevinADC 192 Practically a Posting Shark

OK, so it's working now?

KevinADC 192 Practically a Posting Shark

let's see your perl code and what is line number 1370 of the file you are working with?

Generally there is no memory allocation necessary for perl scripts. Perl will use what memory is needed all they way to using all memory if thats what it takes.

KevinADC 192 Practically a Posting Shark

Well then, here is one possble way:

use strict;
use warnings;
use IO::File;
open FH,'datafile.txt' or die "$!";
my @files = split(/\s+/,<FH>);
for (@files) {
   my $f = "$_.txt";
   $_ = new IO::File "> $f" or die "$!";
}	
while(my @data = split(/\s+/,<FH>)) {
   for (@files) {
      print $_ shift @data,"\n";
   }
}
for (@files) {
   close->$_;
}
KevinADC 192 Practically a Posting Shark

brax4444,

what perl code have you tried so far? Is this class/school work?

KevinADC 192 Practically a Posting Shark

you might want to post that question on the perlmonks site to get answers.

KevinADC 192 Practically a Posting Shark
KevinADC 192 Practically a Posting Shark

Good luck with the project.

KevinADC 192 Practically a Posting Shark

technically, as far as I know, it is OK. In general I would say it's not good practice unless it's clear why you needed to do that or put comments in the code explaining why you are doing that. Like in the CGI module you will see a sub routine that is just an empty block:

# avoid autoloader warnings
sub DESTROY {}

as the comment notes it's just there to avoid a warning message. In your case make sure it's really necessary, there is probably a better way to do whatever it is you are doing but can't tell by the sample code you posted.

KevinADC 192 Practically a Posting Shark

what ever you do, do not install XAMPP (apache friends) I have seen too many problems people have after installing that bundle. Better to bite the bullet and install apache/perl/php/mysql and anything else you want, and take a day to get it all running with the help of tutorials or asking questions.

KevinADC 192 Practically a Posting Shark

If you are running windows you want to install activestate perl

http://www.activestate.com/Products/ActivePerl/?mp=1

this article might help but I don't know which version of apache the article is written for:

http://www.thesitewizard.com/archive/addcgitoapache.shtml

KevinADC 192 Practically a Posting Shark

best to ask in a shell scripting or unix/linux forum.

KevinADC 192 Practically a Posting Shark

See if anything helps you:

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

KevinADC 192 Practically a Posting Shark

OK, that is fine, it's just a bit funky how you start a block and then declare all the variables in one line at the beginning which through me off:

my($field, @expected_names, @given_names, @max_length, $num_fields, $status, $m, $n, @input1, @block1, @block2, $original_field, $length, $code, $code1, $code2, $code3, $offset1, $offset2, $count, $var, $result, $replace, $input, $flag_done);


that seems quite lazy to me and will probably make maintenance harder.

KevinADC 192 Practically a Posting Shark

Mushy-pea,

cgi-lib was replaced maybe 10 years ago with CGI.pm. cgi-lib is from the old days of perl 4 and should not be used anymore except where cases of backwards compatibility with existing progams is needed. And even then it can be avoided since CGI.pm has built in compatibility for old cgi-lib programs.

KevinADC 192 Practically a Posting Shark

It may seem strange to you, but thats because you don't understand what is happening. Whenever you send anything in the system array to a sub routine or function the list becomes "flattened". This means that where one list ends and another begins is lost, and it becomes one long list, as you experience.

See this page:

http://perldoc.perl.org/perlsub.html#Pass-by-Reference-pass-by-reference-pass-by-reference-reference

But you have a bigger problem, you are not using "strict" with your perl program. All perl programs should use:

use warnings;
use strict;

KevinADC 192 Practically a Posting Shark

It sounds like what you are asking for is bascially a robot that automatically signs you up, and most servers hate people that do that because 999 out of a 1000 times it would be used for some type of abuse. I personally have no interest in helping you with this question besides what I already said, look into WWW::Mechanize (perl).