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.
 
  • Locked thread
Bloody
Mar 3, 2013

Mr SuperAwesome posted:

personally i write all my string janitoring scripts in c#

Adbot
ADBOT LOVES YOU

Notorious b.s.d.
Jan 25, 2003

by Reene

Mido posted:

depends m8

use a mono if you wanna treat it like java when doing glue code for services and daemony poo poo

i honestly haent looked at C# MvC frameworks for web/restful/soapy poo poo so i dunno wahts out there

but C# isn't a microsoft thing per se

C# is entirely Microsoft. Very little of the standard library is contained in the emca "standard."

Mono is an abandoned crock of poo poo. I used to hack on it. Code is easy to read because it's primitive. Dog slow. Missing huge chunks of the Microsoft standard library. Compatibility with existing csharp code bases is a joke.

Don't talk to me about xamarin. 30 semi-employed iOS/android hackers are not the key to a robust language platform for commercial applications. Ximean and Novell could barely be arsed to support server side usage in the glory days and xamarin has 1/10000th of the budget w/ none of the focus

MononcQc
May 29, 2007

use awk for text manipulation :getin:

Mr SuperAwesome
Apr 6, 2011

im from the bad post police, and i'm afraid i have bad news
has anyone made a python ide worth using yet

i have some horrible lovely foss thing (that despite being python is windows only apparently, eugh) to make less lovely

Notorious b.s.d.
Jan 25, 2003

by Reene

Mr SuperAwesome posted:

has anyone made a python ide worth using yet

i have some horrible lovely foss thing (that despite being python is windows only apparently, eugh) to make less lovely

Komodo

Mr SuperAwesome
Apr 6, 2011

im from the bad post police, and i'm afraid i have bad news
i tried using xamarin and it was great once you got past everything being tricky and broken (this was never) with no debug warnings which is a shame


hopefully its better with ios 7 being live i cant wait to make my app for anderoid so poors can steal it

then again objc is good but c# ios dev is so tempting

Notorious b.s.d.
Jan 25, 2003

by Reene

Mr SuperAwesome posted:

i tried using xamarin and it was great once you got past everything being tricky and broken (this was never) with no debug warnings which is a shame


hopefully its better with ios 7 being live i cant wait to make my app for anderoid so poors can steal it

then again objc is good but c# ios dev is so tempting

Mono has been quirky and broken for eight years. Not gonna hold my breath for a smaller staff with a more difficult target platform to smooth out all the rough parts.

a cyberpunk goose
May 21, 2007


drat you have a lot of rage about xamarin/C#

i've been using xamarin at work to do mobile poo poo and they seem to push out pretty meaningful patches every month and things work well and i get poo poo done without having to fiddle with 3 different langs to deploy a similarly behaving application on a buncha different platforms

Notorious b.s.d.
Jan 25, 2003

by Reene
Any time you think you want csharp without windows, stop, take a deep breath and reconsider.

You actually needed java 8 or scala. Will you like them as much as csharp? Probably not. But you gotta choose between csharp and non-windows platform support. That's just how it is.

a cyberpunk goose
May 21, 2007

Notorious b.s.d. posted:

Any time you think you want csharp without windows, stop, take a deep breath and reconsider.

You actually needed java 8 or scala. Will you like them as much as csharp? Probably not. But you gotta choose between csharp and non-windows platform support. That's just how it is.

jfc, i use C#/GTK#(ugh) to deploy internal tools that we depend on and it's fuckin' fine, GOSH

JewKiller 3000
Nov 28, 2006

by Lowtax
the only reason to use .net is f#, and if you're not running on windows, you should just use ocaml. so there's no incentive for it to work outside windows

Notorious b.s.d.
Jan 25, 2003

by Reene

Mido posted:

drat you have a lot of rage about xamarin/C#

i've been using xamarin at work to do mobile poo poo and they seem to push out pretty meaningful patches every month and things work well and i get poo poo done without having to fiddle with 3 different langs to deploy a similarly behaving application on a buncha different platforms

to be fair mobile is xamarin's focus so I hope that part works.

I am not expecting c.a.s or entity framework or asp.net to see a lot of new dev work in mono

Notorious b.s.d.
Jan 25, 2003

by Reene

Mido posted:

jfc, i use C#/GTK#(ugh) to deploy internal tools that we depend on and it's fuckin' fine, GOSH

Gtk# is tied to gtk2, which is dead

They could update to gtk3, but the API is unstable and there is like, one dev left working on ggtk, so have fun getting bugs fixed. (I waited over three years on a bug report and it got fixed by accident)

When you write mono/ggtk sharp code you are two layers deep in dead projects

Brain Candy
May 18, 2006

MononcQc posted:

use awk for text manipulation :getin:

i had to look at logs today :getin:

MononcQc
May 29, 2007

if you're dealing with logs and are not using awk you need to learn awk


(unless you have something sweet like splunk going on)

Stringent
Dec 22, 2004


image text goes here

Notorious b.s.d. posted:

perl, Python, and ruby are all much more similar than they are different. They're all slow, they share a lot of the same awful implementation problems, they all have half baked type systems

They're all better for cj poo poo than bash. I don't care which one you use just don't use bash/ksh.

People who get butthurt bout the trivial differences between scripting languages should be tied down and forced to debug ksh code. A full 40 hour work week for every time they bring it up.

Jonny 290 posted:

perl loving sucks for text manipulation what the gently caress are you gibbering fools blathering on about, INSANITY, theres no way to even manipulate a loving text file at ALL in perl. its worthless leftover glue garbage from slackware autists who couldnt possibly fathom writing a shell script more than four lines long. throw it in the trash

why are the best posts always at the bottom of the page?

forum enthusiast
Aug 12, 2010

Mr SuperAwesome posted:

has anyone made a python ide worth using yet

i have some horrible lovely foss thing (that despite being python is windows only apparently, eugh) to make less lovely

i think pycharm is pretty cute. they also released a free version somewhat recently that has most of the functionality that you would need unless you do a lot of web stuff.

JewKiller 3000
Nov 28, 2006

by Lowtax
what is a python ide going to do for you that vim doesn't? i guess you can have one window containing code, a directory tree, and a console, great. what about any of the actual features that make ides useful? you're limited by python to no more than a gui for grep

Bloody
Mar 3, 2013

why don't modern .net apps have reasonable cross-platform guarantees within the windows ecosystem? i feel like all .net 4.5 or whatever applications should be compatible with x86, winRT, and winphone out of the box (unless youre doing something weird/stupid/whatever) but i also feel like that almost certainly isn't the case? shouldnt the whole CLR nonsense make this trivial (if you are microsoft)?

Posting Principle
Dec 10, 2011

by Ralp

MononcQc posted:

if you're dealing with logs and are not using awk you need to learn awk


(unless you have something sweet like splunk going on)

I keep two books on my desk at all times, APUE and sed and awl pocket reference. awk owns

prefect
Sep 11, 2001

No one, Woodhouse.
No one.




Dead Man’s Band

Mr SuperAwesome posted:

has anyone made a python ide worth using yet

i have some horrible lovely foss thing (that despite being python is windows only apparently, eugh) to make less lovely

is wing any good? i haven't done python in a while, but it seemed pretty good (although i'm not really a huge ide person in general)



also, shell scripting is terrible, and powershell is no exception

hubris.height
Jan 6, 2005

Pork Pro
so installing the windows driver update for my laptop's video card updates microsoft's .net framework to a version that crashes all visual studio poo poo the instant i try to load it. not even an error, just straight up closes with a windows must close this poo poo error

anyway now its 3 days later and i'm ready to start writing this project for the music thread

Dessert Rose
May 17, 2004

awoken in control of a lucid deep dream...

Stringent posted:

oh god

nonononono

string parsing is what perl is loving for!!!!

no joke i had an entire contract to convert a bunch of word docs to a new xml format they were moving to

just converted those things to plaintext, dumped them into a perl script, this was when ruby was my preferred language

in the first 3-month stint i had written code that did 90% of the job for me.

later on, the company acquired another contract from the same place, asked me back. within two weeks i had gotten that to about 99%

literally just ran the tool on a bunch of files, sanity checked them, did the couple of manual steps required (there was a part of the job that actually required human thought, you know, the part you actually can't automate but don't really want to anyway) and blam six months' work done in two weeks

Dessert Rose
May 17, 2004

awoken in control of a lucid deep dream...
and then i hosed around on the internet for the next four months because i knew they wouldn't have paid me the amount they were making off that contract otherwise

double sulk
Jul 2, 2010

sublime text is the best editor. it helps to have basic vim knowledge for if youre in ssh or have no other editor available, but subl is generally all you need.

Jonny 290
May 5, 2005



[ASK] me about OS/2 Warp

Dessert Rose posted:

no joke i had an entire contract to convert a bunch of word docs to a new xml format they were moving to

just converted those things to plaintext, dumped them into a perl script, this was when ruby was my preferred language

in the first 3-month stint i had written code that did 90% of the job for me.

later on, the company acquired another contract from the same place, asked me back. within two weeks i had gotten that to about 99%

literally just ran the tool on a bunch of files, sanity checked them, did the couple of manual steps required (there was a part of the job that actually required human thought, you know, the part you actually can't automate but don't really want to anyway) and blam six months' work done in two weeks

writing a wacky deployment tool last fall for some wireless configs is giving me 2 week vacations all through the fall and winter

"Deployment framework will take two weeks" "that's all?" :smug:

uG
Apr 23, 2003

by Ralp

JewKiller 3000 posted:

what is a python ide going to do for you that vim doesn't? i guess you can have one window containing code, a directory tree, and a console, great. what about any of the actual features that make ides useful? you're limited by python to no more than a gui for grep

plangers often feel inadequate so they try to look for things the people they look up to, real programmers, use. it doesnt matter why the real programmers use them, because you're a planger, you just want to emulate them without having to invest any time.

fritz
Jul 26, 2003

MononcQc posted:

if you're dealing with logs and are not using awk you need to learn awk


(unless you have something sweet like splunk going on)


is there any reason to use awk instead of perl

i remember back when i started in the perl4 days one of its big selling points was that it was an awk- and sed-killer and thats still all i use it for, all " perl -pi.back -e 's/buttz/butts/g;' "

qntm
Jun 17, 2009

Nomnom Cookie posted:

if history substitution is enabled, ! is a special character within "". however, if you escape it with \ then bash doesn't remove the \. what if i want to substitute a variable into a string containing a ! ? afaict the answer is gently caress you or use a heredoc

a way back but: don't use double quotes, just backslash-escape every non-alphanumberic character including spaces

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Mr SuperAwesome posted:

has anyone made a python ide worth using yet

i have some horrible lovely foss thing (that despite being python is windows only apparently, eugh) to make less lovely

sublime text 2

prefect
Sep 11, 2001

No one, Woodhouse.
No one.




Dead Man’s Band

fritz posted:

is there any reason to use awk instead of perl

i remember back when i started in the perl4 days one of its big selling points was that it was an awk- and sed-killer and thats still all i use it for, all " perl -pi.back -e 's/buttz/butts/g;' "

if you're already an awk expert, it's probably worth sticking with awk. there's value in using what you know well. but perl can do just about all the same stuff, and more :shrug:

uG
Apr 23, 2003

by Ralp

fritz posted:

is there any reason to use awk instead of perl

you are too stupid to understand/too lazy to learn perl

uG
Apr 23, 2003

by Ralp
also if you get butt hurt about things like string/numerical comparison operators http://perldoc.perl.org/perltrap.html#Awk-Traps

a cyberpunk goose
May 21, 2007

Notorious b.s.d. posted:

Gtk# is tied to gtk2, which is dead

They could update to gtk3, but the API is unstable and there is like, one dev left working on ggtk, so have fun getting bugs fixed. (I waited over three years on a bug report and it got fixed by accident)

When you write mono/ggtk sharp code you are two layers deep in dead projects

oh believe me i know, gtk# is hell

"yes let us attempt to write an OO wrapper for a bunch of nasty C code and let the namespaces be a total loving clutterfuck" amongst other atrocities

when i'm doing desktop applications i usually give up and just do them in C++/Qt :sigh:

PrBacterio
Jul 19, 2000

Notorious b.s.d. posted:

People who get butthurt bout the trivial differences between scripting languages should be tied down and forced to debug ksh code. A full 40 hour work week for every time they bring it up.
Im fairly sure this is unconstitutional

MononcQc
May 29, 2007

fritz posted:

is there any reason to use awk instead of perl

i remember back when i started in the perl4 days one of its big selling points was that it was an awk- and sed-killer and thats still all i use it for, all " perl -pi.back -e 's/buttz/butts/g;' "

Awk is fast as hell and so simple it takes literally 15-30 minutes to learn the basics and get going if you have the right tutorial.

I have parsed crash dumps before to do some simple analytics using awk and it was fairly sweet and straightforward:

code:
# Parse Erlang Crash Dumps and correlate mailbox size to the currently running
# function.
#
# Once in the procs section of the dump, all processes are displayed with
# =proc:<0.M.N> followed by a list of their attributes, which include the
# message queue length and the program counter (what code is currently
# executing).
BEGIN {
    threshold = 10000 # mailbox size
    procs = 0 # are we in the =procs entries?
    print "MESSAGE QUEUE LENGTH: CURRENT FUNCTION"
    print "======================================"
}

# Only bother with the =proc: entries. Anything else is useless.
procs == 0 && /^=proc/ { procs = 1 } # entering the =procs entries
procs == 1 && /^=/ && !/^=proc/ { exit 0 } # we're done


# Message queue length: 1210
# 1       2     3       4
/^Message queue length: / && $4 >= threshold { flag=1; ct=$4 }
/^Message queue length: / && $4 <  threshold { flag=0 }

# Program counter: 0x00007f5fb8cb2238 (io:wait_io_mon_reply/2 + 56)
# 1       2        3                  4                       5 6
flag == 1 && /^Program counter: / { print ct ":", substr($4,2) }
The format is literally:

REGEX AND/OR BOOLEAN { THINGS TO DO IF IT MATCHES }

Every line goes down every clause to be possibly matched, and you have special BEGIN and END clauses that get run once at the beginning and at the end respectively. The REGEX AND/OR BOOLEAN part uses C syntax to do the matching, and supports one or more regex, and works by line.

Then you have a few special variables that can be used:

  • A line is $0
  • Every field of the line is $1, $2, $3, $4, ... $N, where the separator is defined by the variable FS -- the comments in the snippet above show this usage
  • FS is the field-separator, as I said. It can be set per clause, globally, or whatever, depending on when you use the $N variables.
  • OFS is the output field-separator, so that if you do OFS=":"; print $1, $2, you're separating all the values with a colon.
  • NF tells you how many fields there are in a line
  • NR is the current line number
  • RS is the record separator and can be changed if you don't want newlines, similarly for ORS for the output

Each variable is otherwise global in scope, doesn't need initialization, and will act both as string and integers if they can (what is lovely in PHP and JS, but kind of useful for logs). There are also arrays (with trick arrays to multidimensional). Comments start with a #.

The script above would be run by calling:
code:
$ awk -f queue_fun.awk $PATH_TO_DUMP
MESSAGE QUEUE LENGTH: CURRENT FUNCTION
======================================
10641: io:wait_io_mon_reply/2
12646: io:wait_io_mon_reply/2
32991: io:wait_io_mon_reply/2
2183837: io:wait_io_mon_reply/2
730790: io:wait_io_mon_reply/2
...
10412: io:wait_io_mon_reply/2
2554519: some_server:handle_info/3
12443: io:wait_io_mon_reply/2
168785: io:wait_io_mon_reply/2
26314: io:wait_io_mon_reply/2
It's stupidly fast to get something going to parse log files. The one above showed that blocking IO would back memory up and kill nodes.

MononcQc fucked around with this message at 19:28 on Oct 23, 2013

a cyberpunk goose
May 21, 2007

MononcQc posted:

It's stupidly fast to get something going to parse log files. The one above showed that blocking IO would back memory up and kill nodes.

sir im going to have to ask you to leave

this is a safespace for bad programmers

MononcQc
May 29, 2007

I'm too enthusiastic about my one-off awk scripts to leave!!

PrBacterio
Jul 19, 2000

MononcQc posted:

I'm too enthusiastic about my one-off awk scripts to leave!!
dont worry awk is terrible too, it's snobol where its really at so you fit right in!


I really do wonder though how regex based languages became so utterly dominant to the point that the "regexes" they parse arent even regular anymore but some sort of hybrid hellspawn of backtracking and exponential running time, when context free grammar parsing has been a solved problems for so long now. I mean obviously snobol and its successors are poo poo too, but why havent any modern, usable CFG based parsing languages been invented for whats literally decades now, when its quite obvious to anyone with a brain that regexes arent really what people actually want or need for parsing in most cases as, for one, what people call regexes nowadays actually arent

Adbot
ADBOT LOVES YOU

Notorious b.s.d.
Jan 25, 2003

by Reene

MononcQc posted:

Awk is fast as hell and so simple it takes literally 15-30 minutes to learn the basics and get going if you have the right tutorial.

I have parsed crash dumps before to do some simple analytics using awk and it was fairly sweet and straightforward:

code:
# Parse Erlang Crash Dumps and correlate mailbox size to the currently running
# function.
#
# Once in the procs section of the dump, all processes are displayed with
# =proc:<0.M.N> followed by a list of their attributes, which include the
# message queue length and the program counter (what code is currently
# executing).
BEGIN {
    threshold = 10000 # mailbox size
    procs = 0 # are we in the =procs entries?
    print "MESSAGE QUEUE LENGTH: CURRENT FUNCTION"
    print "======================================"
}

# Only bother with the =proc: entries. Anything else is useless.
procs == 0 && /^=proc/ { procs = 1 } # entering the =procs entries
procs == 1 && /^=/ && !/^=proc/ { exit 0 } # we're done


# Message queue length: 1210
# 1       2     3       4
/^Message queue length: / && $4 >= threshold { flag=1; ct=$4 }
/^Message queue length: / && $4 <  threshold { flag=0 }

# Program counter: 0x00007f5fb8cb2238 (io:wait_io_mon_reply/2 + 56)
# 1       2        3                  4                       5 6
flag == 1 && /^Program counter: / { print ct ":", substr($4,2) }
The format is literally:

REGEX AND/OR BOOLEAN { THINGS TO DO IF IT MATCHES }

Every line goes down every clause to be possibly matched, and you have special BEGIN and END clauses that get run once at the beginning and at the end respectively. The REGEX AND/OR BOOLEAN part uses C syntax to do the matching, and supports one or more regex, and works by line.

Then you have a few special variables that can be used:

  • A line is $0
  • Every field of the line is $1, $2, $3, $4, ... $N, where the separator is defined by the variable FS -- the comments in the snippet above show this usage
  • FS is the field-separator, as I said. It can be set per clause, globally, or whatever, depending on when you use the $N variables.
  • OFS is the output field-separator, so that if you do OFS=":"; print $1, $2, you're separating all the values with a colon.
  • NF tells you how many fields there are in a line
  • NR is the current line number
  • RS is the record separator and can be changed if you don't want newlines, similarly for ORS for the output

Each variable is otherwise global in scope, doesn't need initialization, and will act both as string and integers if they can (what is lovely in PHP and JS, but kind of useful for logs). There are also arrays (with trick arrays to multidimensional). Comments start with a #.

The script above would be run by calling:
code:
$ awk -f queue_fun.awk $PATH_TO_DUMP
MESSAGE QUEUE LENGTH: CURRENT FUNCTION
======================================
10641: io:wait_io_mon_reply/2
12646: io:wait_io_mon_reply/2
32991: io:wait_io_mon_reply/2
2183837: io:wait_io_mon_reply/2
730790: io:wait_io_mon_reply/2
...
10412: io:wait_io_mon_reply/2
2554519: some_server:handle_info/3
12443: io:wait_io_mon_reply/2
168785: io:wait_io_mon_reply/2
26314: io:wait_io_mon_reply/2
It's stupidly fast to get something going to parse log files. The one above showed that blocking IO would back memory up and kill nodes.

the perl version is like ten characters longer and is still a one-liner. there's no reason to learn a terrible 1980s scripting language to write one-liners. learn perl be happy

  • Locked thread