Greenguy's Board


Go Back   Greenguy's Board > General Business Knowledge
Register FAQ Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 2008-10-09, 01:03 PM   #1
Mike-mijen
What do you mean, my birth certificate expired?
 
Mike-mijen's Avatar
 
Join Date: Aug 2004
Location: Fla
Posts: 995
Send a message via ICQ to Mike-mijen
Yeah I need to learn pearl. Thats true
Thanks
Mike-mijen is offline   Reply With Quote
Old 2008-10-10, 03:17 AM   #2
MadCat
If something's hard to do, then it's not worth doing
 
MadCat's Avatar
 
Join Date: Sep 2008
Location: Berlin, Germany
Posts: 247
Quote:
Originally Posted by Mike-mijen View Post
Yeah I need to learn pearl. Thats true
Thanks

I did 14 years ago, it helps. When I mentioned the 'making copies' bit, I've got a perl script (rather, a web application right now), that will let me upload the template, the content, asks me to type in the relevant bits of text, automatically puts banners and text links in the proper places, generates thumbnails off the content I uploaded, writes the whole bunch to disk in the proper spot, and makes 3 copies of every site.

Also automatically picks the recips to put on it based on what category I said it should be in, and so on.

Be careful though, writing good perl is hard And if you learn perl, or any other programming language, soon every problem you encounter will look like it needs more code to solve it, so the danger of spending 5 hours coding to fix a problem that would otherwise take 2 hours to take care of is very real
MadCat is offline   Reply With Quote
Old 2008-10-10, 04:37 AM   #3
ecchi
Banned
 
ecchi's Avatar
 
Join Date: Oct 2003
Location: About to be evicted!!!!
Posts: 4,082
Quote:
Originally Posted by MadCat View Post
Be careful though, writing good perl is hard
I disagree, Took me a few hours to learn the basics and write my first useful bit of code. I could not guess how long it took to learn more throughly because from then on I learnt more as I needed it. Although in the early days some of the jobs were hard to write, and I did occasionally suffer from the "spend five hours writing code that will save you two hours work" syndrome, that was simply because I was still learning. Once it is learnt (and learning it is not hard) writing good Perl is relatively easy.
ecchi is offline   Reply With Quote
Old 2008-10-10, 10:44 AM   #4
MadCat
If something's hard to do, then it's not worth doing
 
MadCat's Avatar
 
Join Date: Sep 2008
Location: Berlin, Germany
Posts: 247
Quote:
Originally Posted by ecchi View Post
I disagree, Took me a few hours to learn the basics and write my first useful bit of code. I could not guess how long it took to learn more throughly because from then on I learnt more as I needed it. Although in the early days some of the jobs were hard to write, and I did occasionally suffer from the "spend five hours writing code that will save you two hours work" syndrome, that was simply because I was still learning. Once it is learnt (and learning it is not hard) writing good Perl is relatively easy.
There's a difference though between "good" as in syntactically correct, and "good" as in maintainable -- the latter bit is very difficult due to the way that Perl allows you to solve problems in a variety of ways, some are good, some aren't. Especially if you're dealing with code that needs to perform well and still remain maintainable.

Practical example being, suppose I have an array full of, say, usernames, and I want to de-dupe them. There's at least 2 ways to do it:

Code:
# usernames
my @usernames = ('a'..'z','a'..'z'); # a thru z, twice

# method 1
sub method_one {
  my %usernames = (map { $_ => 1 } @usernames);
  print sort keys %usernames;
}

# method 2
sub method_two {
  my %usernames = ();
  $usernames{$_}++ for(@usernames);
  print sort keys %usernames
}
Most people I show this one to will say that method #1 will be the most efficient, however if you run this through benchmark:

Code:
                    Rate             Method #1   Method #2
Method #1    16181/s        --                -41%
Method #2    27624/s        71%            --
The 2nd method is almost twice as fast, even though a lot of people will say map would be much more efficient.

Another fun one; say you have to http escape a string by turning the string into it's own hex interpretation, the one I see most (I've asked this question to applicants at job interviews) is this:

Code:
my $string = 'http://someurl/';
printf "%02X", $_ for(split //, $string);
Nothing wrong with that one, but...

Code:
my $string = 'http://someurl/';
printf '%02X' x length($string), map { ord $_  } (split //, $string);
Is faster:

Code:
one 53763/s   --      -16%
two 64103/s   19%   --
Anyhow, not trying to be a dick (probably am looking like one right now), just trying to illustrate the difference between knowing the language and knowing the language

Now, for fun, let's both solve this problem: Write a perl script that outputs the numbers from 1 to 100, 10 per line, zero-padded.

Example output:

Code:
001 002 003 004 005 006 007 008 009 010 
011 012 013 014 015 016 017 018 019 020 
.
.
.
.
I'll post my solution later on And sorry for the thread hijack
MadCat is offline   Reply With Quote
Old 2008-10-13, 02:26 PM   #5
Star Man
A boy without mischief is like a bowling ball without a liquid center
 
Star Man's Avatar
 
Join Date: Feb 2006
Location: clevel.......don't make me say it!
Posts: 436
Hi Mike-mijen.Heres a few tips that might make the free site building go a bit faster.I don't know what or how much you know so this might be coca-dodo basic stuff to you but maybe it will speed up a few newbs.

First off, figure out what categories your going to be building for,then build a template with for each one containing your recips.This way you'll never have to hunt down recips every time you build a new site.

When you grab content from your sponsor,don't spend all day looking for that 'perfect set' with the hot girl you like.Unless it's real lousy content,just download like 4 or 5 sets and start resizing/re cutting them.

Have your keywords and the name of your site chosen before building your site.

Make your site nice,attractive and to your liking but DON'T turn it into an all day art project! When I first started it took me forever to churn out a single free site due to my OCD. I would spend the whole afternoon reshaping and rearranging my site and never get anything done.I learned that it's best just to get your site out there on the lists even if your not totally satisfied with it.Besides,surfers aren't sitting at their PC with their pants around their ankles because they like my artwork.

When your building a site,just don't make one and call it a day.Build like 4 or 5 sites in a row or even more if you can.Try to set it up where your submitting a site you built a few weeks ago like said.

Finely,just like anything else,it comes down to repetition.At first your going to be a bit slow,trying to come up with good sales text,layout design ect. but once you build about 5 or 10 sites you'll start to find your own style and see what works and what doesn't.
__________________
good luck
Star Man is offline   Reply With Quote
Old 2008-10-13, 04:16 PM   #6
Mike-mijen
What do you mean, my birth certificate expired?
 
Mike-mijen's Avatar
 
Join Date: Aug 2004
Location: Fla
Posts: 995
Send a message via ICQ to Mike-mijen
Yeah I feel thats the biggest thing is being organized and not repeating the same steps over and over. Thanks man
peace Mike|acid
Mike-mijen is offline   Reply With Quote
Old 2008-10-14, 06:39 AM   #7
ecchi
Banned
 
ecchi's Avatar
 
Join Date: Oct 2003
Location: About to be evicted!!!!
Posts: 4,082
Quote:
Originally Posted by MadCat View Post
There's a difference though between "good" as in syntactically correct, and "good" as in maintainable........
The idea is to write code that works for you, I was not suggesting he set up a script writing service, just write Perl to use on his own computer and scripts to use on his own site. I find that if I leave in enough comments I can see what I did the first time if I want to change something or add a bit on. If you are writing for your server, rather than just scripts to use on your own computer then obviously you have to know enough about security, and also be competent enough not to crash the server with bad code. But you appear to want to write code to impress. There is no need for that, no one is going to see the code (unless you share). Just learn Perl, write what you need, and try not to make it as complicated as you seem to want to make your code.

There is (nearly) always more than one way to do it. Pick the quickest, easiest way. No one will see your code but you, so there is no need to make it dance a jig and whistle the national anthem backwards while counting hits and filing them under referrers. Stick to that rule, and writing Perl IS easy!
ecchi is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:20 PM.


Mark Read
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc