News for hackers. Stuff that matters.
Re:Ask HN: What technologies did you learn in 2018? by Zhyl on Sunday December 23, 2018 @08:08AM (#18745866)
Weirdly, perl. I found myself on a client site in a locked down environment with only the Windows version of GIT installed. Powershell disabled, no other programs allowed. I had to produce reports on the log files for this machine, but had to obfuscate information before taking it off the server.

I discovered that git had bash installed quite early on, so my initial automation and reporting was based on UNIX pipelines. As the data volumes became bigger and the customer requirements became more demanding, I eventually bit the bullet and started learning perl one-liners to do some gymnastics that just weren't possible or practical with just bash (first big win was adding the MD5 of the line so that I could dedupe the obfuscated data).

This lead to eventually writing full scripts in perl and now I have basically all of my reporting automated, even able to take up some 'value add' reporting that I didn't think was going to be possible.

So yeah, not a new technology but I'm now a perl convert and will almost certainly use it in the future if I'm faced with a similar situation.

Re:Ask HN: What technologies did you learn in 2018? by elorm on Sunday December 23, 2018 @08:28AM (#18745952)
Hey, there’s an old school community(they prefer monastery) called PerlMonks[0]where you can share your Perl oneliners and also pick up some mind blowing stuff. Come hang around sometime

[0]https://perlmonks.org/

Re:Ask HN: What technologies did you learn in 2018? by collyw on Sunday December 23, 2018 @08:53AM (#18746054)
Worth noting that PerlMonks functions similarly to stack overflow (for Perl at least), with the difference that discussion is actually encouraged.
Re:Ask HN: What technologies did you learn in 2018? by eitland on Sunday December 23, 2018 @09:29AM (#18746232)
Somebody should pick up that idea and create a site like stack overflow but that doesn't discourage discusssion or reward destroying useful knowledge.
Re:Ask HN: What technologies did you learn in 2018? by lucb1e on Sunday December 23, 2018 @01:26PM (#18747508)
But... it does discourage discussion. It's a Q&A site, not a forum. You don't just post some thoughts and reply to other people's thoughts: you post either a question, or an answer. If you need clarification on a post, you comment. It's not a discussion forum.

And I'm not a new, disgruntled user. I like the site a lot and am quite active on the IT Security stackexchange site. From my semi-moderator's point of view, the only place for discussion is the chat function (which only a few regulars use).

Re:Ask HN: What technologies did you learn in 2018? by amenod on Sunday December 23, 2018 @03:30PM (#18748141)
Yeah... the problem is that SO is becoming the only place where people hang out, and it's really difficult to find active programming forums nowadays. Except, as you say, SO is not a forum, it's a QA site. Which means there is no place left for discussions. While I certainly use SO a lot to find those small bits of missing knowledge, I think it has made search for help (in specific cases) actually much harder.
Re:Ask HN: What technologies did you learn in 2018? by lucb1e on Sunday December 23, 2018 @04:48PM (#18748551)
Agreed! I moved to HN and SO after two forums slowly died. I have some friends from those forums, but a chat group is different from a forum with dozens or sometimes hundreds of active topics every day. Not just in activity, but also the kind of things you can talk about.

I'm not quite sure what is going to fill this gap. I don't always have a place to post things. Blogging doesn't exactly work without an audience. The mainstream things these days appear to be just chats. There are still forums, mailing lists... heck, there are BBSes but it's niche and hard to find anything that isn't already on the decline.

Re:Ask HN: What technologies did you learn in 2018? by eitland on Monday December 24, 2018 @05:29AM (#18751463)
dchuk tried to start https://hackerforums.co earlier this year.

It was a nice forum and I really wanted it to succeed and but it seems to have faded out.

Re:Ask HN: What technologies did you learn in 2018? by webmaven on Tuesday December 25, 2018 @08:01AM (#18757238)
> I'm not quite sure what is going to fill this gap.

Reddit?

Re:Ask HN: What technologies did you learn in 2018? by collyw on Thursday December 27, 2018 @07:15AM (#18769048)
I always find Reddit fairly poor in terms of what people actually suggest on the technical subreddits that I subscribe to.
Re:Ask HN: What technologies did you learn in 2018? by apeacox on Sunday December 23, 2018 @02:00PM (#18747690)
Maybe something like https://dev.to ? I really enjoy that community.
Re:Ask HN: What technologies did you learn in 2018? by raverbashing on Sunday December 23, 2018 @10:22AM (#18746541)
The discussion post is hard as you have to filter the noise and people who know less than they think they know. It might be doable but it is a hard problem
Re:Ask HN: What technologies did you learn in 2018? by tmaly on Sunday December 23, 2018 @09:44AM (#18746301)
My team has used Perl successfully for 13 years. We use modern Perl and the code is clean. In the process of switching new team members to Python as it is hard to hire people with Perl. I still think the meta capability in Perl is stronger than Python.
Re:Ask HN: What technologies did you learn in 2018? by yellowapple on Sunday December 23, 2018 @05:45PM (#18748884)
Meanwhile, I had a hard time finding (or getting) a Perl programming job (though I resisted coming to the Bay Area for a long time, so that was likely a significant factor). I've had to settle with other languages (mostly Ruby, Elixir, and now Python professionally, though I did sneak a bit of Perl into the Ruby one ;) ).

Where are y'all based? I'm reasonably happy with my current job, but I'm definitely curious about what else is out there (especially if it's not in the Bay Area).

Re:Ask HN: What technologies did you learn in 2018? by tmaly on Friday December 28, 2018 @11:00AM (#18777477)
We are in Greenwich CT close to NYC but we also have an NYC office.

https://careers-interactivebrokers.icims.com/jobs/1777/progr...

Re:Ask HN: What technologies did you learn in 2018? by lucb1e on Sunday December 23, 2018 @01:32PM (#18747534)
I'm a security guy but like to develop as well. I'd apply for a job in Perl any day, despite not knowing it very well and Python being my main language. But I guess it's easy to say when I just read that you're having trouble hiring, as my expectations of entry requirements are now different. Anyway, it's a shame you have to make such a big change for what shouldn't be a big deal. The language is a tool -- I've even written C# in Visual Studio on Windows 8 for a year in two different companies, which is about as Microsoft-oriented as you can get (I'd rather use something Linux-based). Unless there are major deficiencies and the team is looking to move away already, it shouldn't be a problem to adapt to the team's standards.
Re:Ask HN: What technologies did you learn in 2018? by C1sc0cat on Monday December 24, 2018 @10:17AM (#18752483)
You haven't tried training them ?
Re:Ask HN: What technologies did you learn in 2018? by tmaly on Friday December 28, 2018 @11:03AM (#18777496)
That is what I do now. But I find it easier to migrate older code to Python.
Re:Ask HN: What technologies did you learn in 2018? by catacombs on Sunday December 23, 2018 @11:09AM (#18746816)
In this day and age, with Python and all, is Perl still worth learning?
Re:Ask HN: What technologies did you learn in 2018? by Zhyl on Sunday December 23, 2018 @01:10PM (#18747415)
It's worth getting a few insights into what it does well. As with any language it _can_ do anything, but a few key features that made it stand out for me:

* Perl is set up for really terse one-liners. You can basically emulate or surpass most Unix tools with only a cursory knowledge of the syntax

* Perl syntax is highly geared towards text processing and regular expressions. File handling and regexes are so much quicker and easier to use than Python.

If I were in a situation where I had a bunch of files I needed to process and the task didn't easily fall into something that could be done with a bash command, I'd probably reach for perl over python for a quick and dirty disposable script.

Re:Ask HN: What technologies did you learn in 2018? by catacombs on Sunday December 23, 2018 @04:21PM (#18748403)
> * Perl is set up for really terse one-liners. You can basically emulate or surpass most Unix tools with only a cursory knowledge of the syntax

This definitely interests me. How does perl surpass Unix tools? I guess perl has the benefit of handling the equivalent of sed and awk.

Re:Ask HN: What technologies did you learn in 2018? by Zhyl on Sunday December 23, 2018 @08:10PM (#18749572)
Yeah, it has equivalents for each.

Sed:

perl -pe 's/foo/bar/' file1

Grep:

perl -pe '/foo/' file1

uniq:

perl -ne 'print unless $seen{$_}++' file1

But then you can combine conditions:

perl -ne 's/foo/bar/ if /baz/ && /yot/; print "Line number $. changed to $_"' file1

And do some awk-ish line splitting:

perl -F, -ane '$sum += $F[2]; END{ print "The sum of column 3 is $sum" }' file1

It absolutely flies in the face of the unix philosophy and is much more complicated than picking up each tool individually, but once you get to grips with 'em they're very handy.

Re:Ask HN: What technologies did you learn in 2018? by a_bonobo on Sunday December 23, 2018 @09:49PM (#18749939)
This blew my mind recently, when I had to delete millions of files in a directory and rm didn't make the cut (too many arguments), and find -delete took forever:

https://unix.stackexchange.com/a/79656

perl -e 'for(<*>){((stat)[9]<(unlink))}'

seems to be the fastest possible way to delete enormous amounts of files

Re:Ask HN: What technologies did you learn in 2018? by mkl on Monday December 24, 2018 @09:32AM (#18752273)
Did you try xargs, to do groups of files at once? That's what I usually do:

  find -type f -print0 | xargs -0 rm
Re:Ask HN: What technologies did you learn in 2018? by kamaal on Monday December 24, 2018 @05:40AM (#18751511)
Yes, if you don't want to be forced to write exception handling and doing a dozen different tricks for merely writing and using one single regular expression.

A lot of forced indentation and absence of braces, and absence of sigils makes it harder to read Python scripts. However that's not the only problem with Python. If you are scripting you want the regular `unix_command` command thingy to work fine. More-so you want to read the output of that thing using a syntax like my @command_output = `unix_command`;

You also want heredocs. And you want multiline anonymous functions. I could go on and on.

But Python seems to be more like a tool trying to compete with Java than Perl.

Re:Ask HN: What technologies did you learn in 2018? by marcosdumay on Sunday December 23, 2018 @06:13PM (#18749043)
People keep saying Perl6 is great, and I have no reason to think it's any worse than Python (but I don't know it).

One may also want to learn Perl5 for dealing with legacy stuff (either keeping or getting rid of it). There is a lot of it out there.

Re:Ask HN: What technologies did you learn in 2018? by singingfish on Tuesday December 25, 2018 @07:03AM (#18757111)
perl is a fine language. It scales quite well from terse one liners to large (and with appropriate application of discipline, readable) applications. It's a shame it's so unfashionable at the moment.
Re:Ask HN: What technologies did you learn in 2018? by gronne on Sunday December 23, 2018 @09:21AM (#18746193)
Im curious to what tasks you felt you could not solve in bash incl. the nix toolchain?
Re:Ask HN: What technologies did you learn in 2018? by Zhyl on Sunday December 23, 2018 @10:11AM (#18746469)
Many of my issues will be specific to the environment. The thing that made me use the first perl one-liners is because I was used to using 'rename' in the command line and I was able to emulate this with perl more easily (using a regex substitution) than 'mv'.

The second and more pivotal one liner was when I needed to create a primary key to ensure I wasn't getting any dupes later down the pipeline (a requirement that came about as some of the other contractors on the project were messing with my exports and then blaming my files for their conflicting numbers). My first approach was to use the MD5 tool included in GIT bash, but this was prohibitively slow, taking 45 mins to loop through each line of a 4mb file. Not sure if there was a performance penalty on the box I was using, but the perl one liner did the job in a couple of seconds for all the files I had.

After that it mostly became a question of maintainability, with the performance being a boosting factor. I found my perl deduping one liner was faster than either 'sort -u' or 'sort | uniq'. I was able to add new features and account for weird issues more easily. Regex was better than sed, syntax was more flexible than awk, there were more filtering options than grep.

Plus it was good fun. Perl has so many things that just feel so nice and tidy compared to bash.

Having said that, I still use Unix pipelines extensively, they just tend to be for ad hoc queries rather than for my automated reports.

Re:Ask HN: What technologies did you learn in 2018? by gronne on Sunday December 23, 2018 @10:40AM (#18746638)
All right - thanks for the elaboration. The perfomance diff sounds interesting. I might check it out at some point :)
Re:Ask HN: What technologies did you learn in 2018? by zdw on Sunday December 23, 2018 @10:32AM (#18746605)
perl has a less divergent set of options across different unix versions - for example, trying to run `sed` in place across MacOS and Linux you'll soon find that the options are different. There are similar issues with BSD vs GNU options in other programs as well.

There's an old quip that "perl is portable sed" - in my experience this is pretty true.

Re:Ask HN: What technologies did you learn in 2018? by Ultimatt on Sunday December 23, 2018 @04:48PM (#18748550)
Yeah this is actually a major reason everyone should at least know or use some perl. macOS is a popular dev environment but the quirky macOS/BSD versions of grep and sed are super annoying for portable build scripts.