Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Shaggar
Apr 26, 2006
it really depends on how your company uses the database. if they do a simple, dirty persistance model then you dont actually ever write any sql or care about the database design. if its a big company you probably have dbas who will handle all the data design and sql for you (dbas should be comp sci people, not cjs). if its a smaller one where you're going to be sharing responsibility for data design, writing sql, and writing code, then they probably already have something established that you'll learn when you get in there.

if you're starting from scratch then get ready to learn by trial and error!

Adbot
ADBOT LOVES YOU

ChiralCondensate
Nov 13, 2007

what is that man doing to his colour palette?
Grimey Drawer

Jonny 290 posted:

here have an unrelated one liner


perl -ane '/^APUS/?$ap{$F[0]}{'sw'}=$F[1]:0}{foreach(sort keys %ap){print "$_, $ap{$_}{'sw'}\n"}' test.txt
oh my god, what is that man doing to his APUS?!

Jonny 290
May 5, 2005



[ASK] me about OS/2 Warp
that was actually hosed up and an improper use of ?:

here

code:
perl -ane 'next unless /APUS/;shift @F if length($F[0]) == 1;if(/full/){$ap{$F[0]}{sw}=$F[1];$ap{$F[0]}{po}=$F[-2]}else{$ap{$F[0]}{mac}=$F[$#F-4]}}{map{print"$_,$ap{$_}{sw},$ap{$_}{po},$ap{$_}{mac}\n"}(sort keys %ap)' test.txt
that weird shift @F is in there because exactly one line starts with an asterisk and this line is going to echoed by perl through Net::Telnet on a remote machine so we have to watch our escaping and poo poo. also, ksh is an idiot.

FamDav
Mar 29, 2008
This old guy at work keeps telling me to learn perl.

Jonny is that u c/d.

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome
perl is good and people telling you that perl "leads to unreadable spaghetti code" is a good way to tell who the bozos are

Jonny 290
May 5, 2005



[ASK] me about OS/2 Warp
perl's a good hammer if you need to drive nails
its poo poo for gui or efficiency stuff

but it is really does seem to be the best glue code language out there

Sapozhnik
Jan 2, 2005

Nap Ghost

Shaggar posted:

it really depends on how your company uses the database. if they do a simple, dirty persistance model then you dont actually ever write any sql or care about the database design. if its a big company you probably have dbas who will handle all the data design and sql for you (dbas should be comp sci people, not cjs). if its a smaller one where you're going to be sharing responsibility for data design, writing sql, and writing code, then they probably already have something established that you'll learn when you get in there.

if you're starting from scratch then get ready to learn by trial and error!

shaggar was right

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde

Jonny 290 posted:

perl's a good hammer if you need to drive nails
its poo poo for gui or efficiency stuff

but it is really does seem to be the best glue code language out there
i used it for a while to edit MPEG-2 streams

(not high-level audio/video editing obv)

Jonny 290
May 5, 2005



[ASK] me about OS/2 Warp
perlschool: what does that line noise do




command line switches: -e says 'i want to type a program in', -n means 'read a filename from the command line and wrap the "-e program" in a foreach loop, iterating through that file' and -a means 'as you iterate through each line, split the line on spaces into an array named @F'

the above code takes input from a giant file that is just a tee output from running show commands on a controller

pre:
  APUS-0000-209     Cityname, VA 0000             B4-C7-99-00-11-22       2 W-W         0    1.23.42.19 ^M
  APUS-0000-218     Cityname, VA 0000             B4-C7-99-00-11-22       2 W-W         7   11.23.42.73 ^M
  APUS-0000-244     Cityname, VA 0000             B4-C7-99-00-11-22       2 W-W         0   11.23.42.49 ^M
  APUS-0000-300     Cityname, VA 0000             B4-C7-99-00-11-22       2 W-W         0   11.23.42.63 ^M
  APUS-0000-403     Cityname, VA 0000             B4-C7-99-00-11-22       2 W-W         0   11.23.42.34 ^M
  APUS-0000-400     Cityname, VA 0000             B4-C7-99-00-11-22       2 W-W         0   11.23.42.88 ^M
  APUS-0000-308     Cityname, VA 0000             B4-C7-99-00-11-22       2 W-W         1   11.23.42.03 ^M
  APUS-0000-303     Cityname, VA 0000             B4-C7-99-00-11-22       2 W-W         0    1.23.42.74 ^M
  APUS-0000-401     Cityname, VA 0000             B4-C7-99-00-11-22       2 W-W         0   11.23.42.39 ^M
...
APUS-0000-305     s-TCM-01.s00000.savemoney.livebetter.com 12.34.5.22 cisco WS-C3750X-24P  ge1    GigabitEthernet2/0/7  full   ^M
APUS-0000-206     s-TCE-01.s00000.savemoney.livebetter.com 12.34.5.38 cisco WS-C3750X-24P  ge1    GigabitEthernet4/0/7  full   ^M
APUS-0000-008     s-TCK-01.s00000.savemoney.livebetter.com 12.34.5.26 cisco WS-C3750X-24P  ge1    GigabitEthernet1/0/24 full   ^M
APUS-0000-139     s-TCL-01.s00000.savemoney.livebetter.com 12.34.5.24 cisco WS-C3750X-24P  ge1    GigabitEthernet1/0/18 full   ^M
APUS-0000-209     s-TCO-01.s00000.savemoney.livebetter.com 12.34.5.18 cisco WS-C3750X-24P  ge1    GigabitEthernet2/0/4  full   ^M
APUS-0000-175     s-TCN-01.s00000.savemoney.livebetter.com 12.34.5.20 cisco WS-C3750X-24P  ge1    GigabitEthernet2/0/12 full   ^M
APUS-0000-401     s-TCP-01.s00000.savemoney.livebetter.com 12.34.5.16 cisco WS-C3750X-24P  ge1    GigabitEthernet2/0/23 full   ^M
APUS-0000-227     s-TC100-01.0000.savemoney.livebetter.com 12.34.5.52 cisco WS-C3750X-48P  ge1    GigabitEthernet2/0/43 full   ^M
APUS-0000-222     s-TC100-01.0000.savemoney.livebetter.com 12.34.5.52 cisco WS-C3750X-48P  ge1    GigabitEthernet2/0/41 full   ^M
APUS-0000-153     s-TCN-01.s00000.savemoney.livebetter.com 12.34.5.20 cisco WS-C3750X-24P  ge1    GigabitEthernet1/0/11 full   ^M
APUS-0000-231     s-TCP-01.s00000.savemoney.livebetter.com 12.34.5.16 cisco WS-C3750X-24P  ge1    GigabitEthernet1/0/17 full   ^M
APUS-0000-166     s-TCF-01.s00000.savemoney.livebetter.com 12.34.5.36 cisco WS-C3750X-24P  ge1    GigabitEthernet1/0/14 full   ^M
makes a hash tree using the hostname, yanks the MAC (or switch and port) and adds that to the hash tree.

then map loops through it and builds our CSV:
pre:
APUS-0000-205,s-TCO-01.s00000.savemoney.livebetter.com,GigabitEthernet3/0/3,B4-C7-99-11-22-33
APUS-0000-206,s-TCE-01.s00000.savemoney.livebetter.com,GigabitEthernet4/0/7,B4-C7-99-11-22-33
APUS-0000-207,s-TCE-01.s00000.savemoney.livebetter.com,GigabitEthernet4/0/9,B4-C7-99-11-22-33
APUS-0000-208,s-TCE-01.s00000.savemoney.livebetter.com,GigabitEthernet2/0/1,B4-C7-99-11-22-33
APUS-0000-209,s-TCO-01.s00000.savemoney.livebetter.com,GigabitEthernet2/0/4,B4-C7-99-11-22-33
APUS-0000-210,s-TC100-01.s00000.savemoney.livebetter.com,GigabitEthernet1/0/45,B4-C7-11-22-33-44

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

Jonny 290 posted:

perl's a good hammer if you need to drive nails
its poo poo for gui or efficiency stuff

but it is really does seem to be the best glue code language out there


for a gui it depends on what you need. for a user facing app it's not great (i mean it has gtk bindings like everything else but mleh). for internal stuff that doesn't have to look pretty but you want a gui and you want it done quick and with minimum hassle, perl/Tk is actually pretty neat and convenient

Notorious b.s.d.
Jan 25, 2003

by Reene

Otto Skorzeny posted:

for a gui it depends on what you need. for a user facing app it's not great (i mean it has gtk bindings like everything else but mleh). for internal stuff that doesn't have to look pretty but you want a gui and you want it done quick and with minimum hassle, perl/Tk is actually pretty neat and convenient

perl has adequate gtk bindings
and tolerable win32 gui bindings
and perl objC bridging for cocoa
and perl java bridging for awt/swing

perl is not particularly good for anything
perl is not particularly bad for anything

except SOAP
gently caress perl SOAP::Lite forever

ironic that the world's best glue language doesn't also make good soap

Zombywuf
Mar 29, 2008

Notorious b.s.d. posted:

gently caress SOAP forever

Meiwaku
Jan 10, 2011

Fun for the whole family!
SOAP < XMLRPC
CSV < TSV
Sometimes simpler is just better.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

Meiwaku posted:

CSV < TSV

Unit separator you scrub lord

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

Hard NOP Life posted:

Unit separator you scrub lord

preach it

Nomnom Cookie
Aug 30, 2009



tef posted:

operator precedence is for weenies
Python

Shaggar
Apr 26, 2006
soap owns and is the best

Sniep
Mar 28, 2004

All I needed was that fatty blunt...



King of Breakfast

Shaggar posted:

soap owns and is the best

unusual sentiment for a goon

double sulk
Jul 2, 2010

Sniep posted:

unusual sentiment for a goon

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde
nuke it from teh cloud

homercles
Feb 14, 2010

Gobol amirte

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

Hard NOP Life posted:

Unit separator you scrub lord


TiMBuS
Sep 25, 2007

LOL WUT?

Notorious b.s.d. posted:

perl has adequate gtk bindings
and tolerable win32 gui bindings
and perl objC bridging for cocoa
and perl java bridging for awt/swing

perl is not particularly good for anything
perl is not particularly bad for anything

except SOAP
gently caress perl SOAP::Lite forever

ironic that the world's best glue language doesn't also make good soap

i made a perl gtk app for work and it sucked a bit, so i made the next program in C# + gtk# and well, i dont think i will do that again

penus de milo
Mar 9, 2002

CHAR CHAR
writing 'clever' code is for ppl with small weiners

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
confirmed

cowboy beepboop
Feb 24, 2001

Jonny 290 posted:

perl's a good hammer if you need to drive nails
its poo poo for gui or efficiency stuff

but it is really does seem to be the best glue code language out there

i had to replace some perl glue code due to changed requirements, i did it with python and it was 4x as fast and way more readable hth

basically taking some netflow data, doing some massaging and shoving it into a database, pretty straightforward stuff too. sqlalchemy was way quicker than raw sql in the perl code for some reason

tef
May 30, 2004

-> some l-system crap ->
http://www.pltgames.com/competition/2012/12 heh

Jonny 290
May 5, 2005



[ASK] me about OS/2 Warp

my stepdads beer posted:

i had to replace some perl glue code due to changed requirements, i did it with python and it was 4x as fast and way more readable hth

basically taking some netflow data, doing some massaging and shoving it into a database, pretty straightforward stuff too. sqlalchemy was way quicker than raw sql in the perl code for some reason

yeah i guess i could see python filling that void somewhat. it still feels like babby's first code to me but it's not a bad language

regardless i think that we all can agree that the answer to "what is perl 5's replacement?" will never be "perl 6"

0xB16B00B5
Aug 24, 2006

by Y Kant Ozma Post
python is a terrible language that attempts to dumb down programming enough for random assholes to pick it up and in the process becomes a disaster

neonburzt
Jul 25, 2010

Sniep posted:

unusual sentience for a goon

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror

0xB16B00B5 posted:

python is a terrible language that attempts to dumb down programming enough for random assholes to pick it up and in the process becomes a disaster

Shameproof
Mar 23, 2011

how long would it take to train my dog to be turing complete

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

my stepdads beer posted:

i had to replace some perl glue code due to changed requirements, i did it with python and it was 4x as fast and way more readable hth

basically taking some netflow data, doing some massaging and shoving it into a database, pretty straightforward stuff too. sqlalchemy was way quicker than raw sql in the perl code for some reason

let's not kid ourselves here, all the popular dynamic languages are so similar that going from writing your sql to using an orm (dbix::class, sqlalchemy etc) is a greater change than swapping languages, notwithstanding a dozen years of partisans on irc claiming otherwise

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

Otto Skorzeny posted:

let's not kid ourselves here, all the popular dynamic languages are so similar that going from writing your sql to using an orm (dbix::class, sqlalchemy etc) is a greater change than swapping languages, notwithstanding a dozen years of partisans on irc claiming otherwise

yeah i started telling people this, "if you like python you will like ruby, it's basically the same language"

tef
May 30, 2004

-> some l-system crap ->
liar liar

double sulk
Jul 2, 2010

Cocoa Crispies posted:

yeah i started telling people this, "if you like python you will like ruby, it's basically the same language"

python and ruby are actually rather different, hth

Shaggar
Apr 26, 2006
no they're both p languages.

Socracheese
Oct 20, 2008

python and ruby serve the same general purpose but ruby is sorta weird and isnt as widely adopted

0xB16B00B5 posted:

python is a terrible language that attempts to dumb down programming enough for random assholes to pick it up and in the process becomes a disaster

wrong, python owns for what it is, which is basically to be an intelligent version of php

Adbot
ADBOT LOVES YOU

Jonny 290
May 5, 2005



[ASK] me about OS/2 Warp
whenever i read about ruby i imagine anime eyed cartoon coders frolicking with woodland creatures in a glittery candyland

i just can't get past this and take ruby seriously

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply