- Strength to Increase Rep
- +11
- Strength to Decrease Rep
- -2
- Upvotes Received
- 103
- Posts with Upvotes
- 93
- Upvoting Members
- 57
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
Born in Toronto, CANADA. Attended elementary and high school in Smiths Falls, B.A. at University of Toronto in philosophy and psychology. Met and married Franceen in Montreal. Worked as Programmer/Analyst in Montreal and down south in Georgia, USA. Returned…
- Interests
- Reading blogs, books, philosophy, psychology, futurism.
- PC Specs
- HP notebook computerModel: G60-230CAUbuntu 10.04 LTS - the Lucid Lynx
Re: I can't point to an authority to back me up, but my guess is that we discover the one-one vs. on-many relationship by studying the PRIMARY key of the tables in question. Because the values of the primary keys of the two tables do not have to be identical between … | |
Re: [CODE=perl]#!/usr/bin/perl -w #ReplaceBackslashWithSlash.pl use strict; my $myPath = 'c:\perl\test'; # Example string containing backslashes print "\nOriginal string is: $myPath\n\n"; # The following command substitutes backslashes with forward slashes # You need to escape the backslash and slash with backslash $myPath =~ s/\\/\//g; print "Modified string is: $myPath\n";[/CODE] | |
Re: I don't know but you could start by finding your httpd.conf file and having a look at [URL="http://serverfault.com/questions/29942/xampp-on-windows-permission-problems"]this post[/URL] in case the solution to that person's problem throws light on yours. | |
Re: I think you can use pretty much the same list that you used for the simpler problem. All you need to come up with is a formula to calculate the index for each grade. [code=PYTHON] def main(): grade = raw_input("Enter the student's grade: ") index = int(grade)/10 grades = ["F", … | |
Re: Maybe the PHP configuration on the server running your script tells PHP not to display any errors (although I don't see any errors in your script.) Try adding the following line to the beginning of your script: [iCODE]ini_set('display_errors', 1);[/iCODE] [URL="http://www.wallpaperama.com/forums/how-to-display-php-errors-in-my-script-code-when-display-errors-is-disabled-t453.html"]http://www.wallpaperama.com/forums/how-to-display-php-errors-in-my-script-code-when-display-errors-is-disabled-t453.html[/URL] | |
Re: I'll have another look when I get some time but the first thing I'd suggest: [CODE]use strict; use warnings;[/CODE] belong in every non-trivial Perl script. Add them to your script and declare any undeclared variables, such as @sesname, @title1, @all, @title2 and $i. Another general suggestion: when opening files, use … | |
Re: I used to have @david_ellis on Twitter and I thought if I made it shorter people would retweet me more often. (This was before Twitter came up with their new retweet action that doesn't include the posters handle in the character count.) I shortened it to @d5e5 because my first … | |
Re: For a table named 'items':[CODE]update items set itemName = replace(itemName,'/','');[/CODE] | |
Re: The following may not exactly correspond to what you mean by 'numeric' but it will serve as an example of what the Scalar::Util module can do. #!/usr/bin/perl use warnings; use strict; use Scalar::Util qw(looks_like_number); while (my $teststring = <DATA>){ chomp $teststring;#Remove newline character from end of string if (looks_like_number($teststring)){ print … | |
Re: #!/usr/bin/perl use warnings; use strict; my $path = <DATA>; chomp($path); print 'Original path: ', $path, "\n"; $path =~ s/"/'/g;#Replace all " with ' print 'Changed path: ', $path, "\n"; __DATA__ "C:\Users\ABC\XYZ\1.txt" | |
Re: [QUOTE=Ancient Dragon;1570084]The best at what? Best communist country? Might be, I don't know. But I hear people in Russia have very limited food in their stores with long lines to buy anything. That's what I hear from here. >>Could you please explain how this can be when the gap between … | |
Re: Look closely at lines 16 - 17. my $Header; $hash{$Header} = $_; You declare a lexical variable called $Header and assign no value to it, so its value is undefined. Then you use $Header (whose value is undefined) as a key to $hash. In effect you are assigning all the … | |
Re: You may also want to look at the [Bio::DB::Fasta](http://search.cpan.org/~cjfields/BioPerl-1.6.901/Bio/DB/Fasta.pm) module. I haven't tried it but according to the docs it has the following method to extract specific substrings from fasta files: > $raw_seq = $db->seq($id [,$start, $stop]) > Return the raw sequence (a string) given an ID and optionally a … | |
Re: I would create a text file in comma separated values (or tab-separated if you prefer) format extension because I find it easier to write text files. Then you can start up Excel and import the movies_or_whatever.txt file into a sheet using Excel and save it as an Excel file. | |
Re: What data are you trying to read? Please post an example of your input data and some example code showing how you try to read it. I don't know much about XML and nothing about soap but maybe somebody here does and can help you if you provide relevant information. | |
Re: OpenOffice::OODoc looks like the module you need to install and learn how to use. I have no expertise with it so if you don't want to learn how to do it yourself I think you may need to hire a programmer with the relevant experience to write a script that … | |
Re: Scripting makes it easier to do something that we repeatedly do, so what scripting language would serve you best depends on your answer to the question what do you do repeatedly that has several steps, that you would like to do in fewer steps, automatically? As Aristotle said, ["We are … | |
Re: In general I would try to tailor the complexity of the solution and extent of explanation to the apparent knowledge level of the person posing the question. However, figuring out what the poster needs to know is a two-way street. If someone posts a vague and hastily-written question and never … | |
Re: > Any simple ways to get hyperlinks using perl without the HTML table? Yes. What's wrong with the example shown in the [docs](http://search.cpan.org/~gaas/libwww-perl-6.04/lib/LWP/Simple.pm)? use LWP::Simple; $content = get("http://www.sn.no/"); I assume that you want to retrieve the html content from the site refered to in a given hyperlink, right? If the … | |
Re: The following script creates a table (if it doesn't already exist) and saves all the image names (extension included) and the directory names. #!/usr/bin/perl use strict; use warnings; use DBI; use File::Glob ':glob'; use File::Basename; my $dbh=DBI->connect('dbi:mysql:daniweb','david','dogfood') || die "Error opening database: $DBI::errstr\n"; $dbh->do("CREATE TABLE IF NOT EXISTS images (id … | |
Re: You could write your subroutines as values in a hash in your script and then run it from the commandline with the name of your desired function as the first argument on the command line. For example, a script named many_functions.pl #!/usr/bin/perl use warnings; use strict; my %funcs = (thisismyfunction1 … | |
Re: In Perl I would change the value of the special variable representing the input record separator $/ to '!' to read entire records instead of one line at a time. Then you need only one loop within which you can use regex to capture values into variables. #!/usr/bin/perl use warnings; … | |
Re: If you run perl and your script from the command-line interface in a DOS window or a Terminal in linux and print to STDIN then maybe the DOS or Terminal can't print those characters. I think that depends on the platform. However if you print something encoded as utf-8 to … | |
Re: Multi-line records with no record separator make it tricky. As for writing CSV output it's worth installing the [Text::CSV](http://search.cpan.org/~makamaka/Text-CSV-1.21/lib/Text/CSV.pm) module if you don't already have it. #!/usr/bin/perl use warnings; use strict; use Text::CSV; my $csv = Text::CSV->new ( { binary => 1 } ) # should set binary attribute. or … | |
Re: > open my $fh, '<', $file1 or die "can't open $file1:$!"; Why do you have statements like the above where I see '<' instead of '<'? Besides fixing the above, mostly all you need to do to get what you want is to switch the filenames, as follows: #!/usr/bin/perl use … | |
Re: If one of 2teez's scripts works for you with the large files, good. Otherwise you could try the following modified version. When working with large files you need to consider memory limitations vs. speed. I think 2teez's scripts make good use of memory but take a bit longer than using … | |
Re: > I face some real problems here. I need a Perl script that can open a text file, read a series of URLs, get the content of the pages and save it to another file. Divide your task into steps, such as: 1. open a text file 2. read a … | |
Re: > suppose my input string is "a*b+c/\/" and I want a Perl regex expression to match it. #!/usr/bin/perl use warnings; use strict; my $x = 'String of 8 words including numbers and letters'; my $y = 'String including characters like a*b+c/\/ plus text'; my $z = 'Some numbers 7, 8 … | |
Re: > Thanks for helping .. could you pls order them time by time. Also they should be from the new time to last time abulut, Do you mean you want them ordered by a combination of date and time? Should 2012-03-16 14:29:54.61 print before (above) 2012-04-23 07:16:21.83 for example? Normally … | |
Re: Start by reading both files into a suitable data structure (see [the data structure cookbook](http://perldoc.perl.org/perldsc.html#HASHES-OF-HASHES)). Then you can read and test values from your data structure to print the details of your report. #!/usr/bin/perl use strict; use warnings; @ARGV = qw(FILE1.txt FILE2.txt); my %HoH; #Hash of hash references while (my … |