There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

programmerhumor

This magazine is from a federated server and may be incomplete. Browse more on the original instance.

dactylotheca , in Regex flavors
@dactylotheca@suppo.fi avatar

Some people, when confronted with a problem, think “I know, I’ll use regular expressions.” Now they have two problems.

qaz ,

Regex really isn’t that bad when using named capture groups.

dactylotheca ,
@dactylotheca@suppo.fi avatar

Oh yeah they definitely have uses, but there’s a real tendency for people to go a bit crazy with them. Complex regexen aren’t exactly readable, there’s all kinds of fun performance gotchas, there’s sometimes other tools/algorithms that are more suitable for the task, and sometimes people try to use them to eg. parse HTML because they don’t know that it is literally impossible to use regular expressions to parse languages that aren’t regular

frezik ,

It’s entirely possible to parse HTML in PCRE. You shouldn’t, but it is possible. The language stopped being strictly regular a long time ago and is entirely capable of doing it.

stackoverflow.com/a/4234491/830741

dactylotheca ,
@dactylotheca@suppo.fi avatar

Oh yeah, extensions which make them non-regular definitely can make it possible, but just because it’s now somewhat possible with some regex engines doesn’t mean it’s a good idea

FooBarrington ,

I’ve once written a JS decompiler (de-bundler?) using ~150 regex for step-wise transformations. Worked surprisingly well!

Azzk1kr ,

What eldritch beast was summoned as a result?

FooBarrington ,

Well… No new ones, at least? Though it was around that time that I started hearing whispers in the night… “You can use WASM to ship Client-Side PHP”

bleistift2 ,

it is literally impossible to use regular expressions to parse languages that aren’t regular

It’s impossible to parse the whole syntax tree, but that doesn’t mean you can’t get the subset you’re interested in.

Mbourgon ,

Jwz’s 2nd law!

MashedTech ,

I learned Regex once and now it just works. Only problem for me is using MacOS so the Regex flavors aren’t consistent. But once I sort that, it’s smooth sailing.

bottleofchips , in More confusion for recruiters

…and it’s compiled

lurch ,

…but intended for web, but you can also misuse it for apps and system services

qaz ,

…to an intermediate set of instructions for a virtual machine…

…called the brainfuck interpreter

enleeten ,

Brainfuck.NET Interpreter that uses modified Java bytecode instructions.

qaz ,

Yes brainfuck with some Java Bytecode instructions for syscalls.

lurch , in More confusion for recruiters

all lines not terminated by a single space are comments

Ziglin ,

Also each line starts with a semicolon and you have to escape spaces in strings using a double forward slash

turbowafflz ,

I realized a while ago that there’s nothing stopping me from writing rust like this


<span style="color:#323232;">;println!(</span><span style="color:#183691;">"This is great"</span><span style="color:#323232;">)
</span><span style="color:#323232;">;println!(</span><span style="color:#183691;">"I think everyone should write rust like this"</span><span style="color:#323232;">)
</span><span style="color:#323232;">;println!(</span><span style="color:#183691;">"Probably works in most languages that use semicolons"</span><span style="color:#323232;">)
</span><span style="color:#323232;">;
</span>
miningforrocks ,

Also a spicial place in hell for you

rovingnothing29 ,
@rovingnothing29@lemmy.world avatar

Can we add the comefrom function too?

AVincentInSpace ,

hope you don’t forget the semicolon on a line by itself at the end (except in functions where you want to return the value of the last expression)

Ziglin ,

Nasm programmers probably think that is old code that you commented out.

tabarnaski ,

There’s a special place in hell for you

Australis13 , in More confusion for recruiters

Make sure it's not whitespace sensitive and requires explicit typing, just to mess with everyone.

itsathursday , in Regex flavors

Named groups are nice but can I please define a group more than once because maybe I want to group my data and consolidate values in a logical way without you complaining I have already used a group previously. I know I did, I’m the one telling you, now capture it twice!

Boxscape , in Site: "I don't feel so good...."
@Boxscape@lemmy.sdf.org avatar
ininewcrow ,
@ininewcrow@lemmy.ca avatar
sasquash , in More confusion for recruiters

There is a Tiger Jyhton version for the web www.tigerjython.ch/en

But at least just for educational purposes😅

Num10ck , in Site: "I don't feel so good...."

this is what Elon is doing to himself with X, by the signal to noise ratio.

BearOfaTime ,

Which he obliquely said he was going to do, before he bought it.

By slowly killing it, room is made for multiple other platforms to grow.

khannie , in Program in C
@khannie@lemmy.world avatar

The segfault at the end was perfection.

mogoh , (edited ) in More confusion for recruiters
AnarchistArtificer , in Regex flavors

Regex feels distinctly eldritch to me. Like, a lot of computing knowledge feels like magic, but regex feels like the kind of magic you get by consorting with dark forces

TunaCowboy ,

regex feels like the kind of magic you get by consorting with dark forces

AKA reading the manual.

Cysioland ,
@Cysioland@lemmygrad.ml avatar

Or studying computer science and learning about finite state machines

Tangent5280 ,

Im a good christian boy thats why I refuse to read the manual

tiramichu , in Site: "I don't feel so good...."

The fade should be slow and subtle. At first the client thinks they are just imagining it, but then they start getting customer support calls about the site being faded, and their bosses are pointing it out too in meetings, and as it happens more and more the panic really begins to set in.

Finally they reach out to you in a desperation when there’s barely anything left of the site and ask you to urgently fix the problem, and you just shrug your shoulders sympathetically and explain it’s happening because they haven’t paid - but not like in a way that suggests you are doing it on purpose, but a way where it’s simply an unavoidable natural consequence, like if you didn’t pay your electricity bill your power would get cut and the site is slowly “dying” and fading away because of that.

They’d pay so fast.

Crackhappy ,
@Crackhappy@lemmy.world avatar

Especially if you randomize the fade within a given range over time.

tiramichu ,

For added theatrics, after they pay you can slowly fade the site back in over a few days too, as if websites need bill money the same way humans need food, and it is slowly getting better after “being starved”

Crackhappy ,
@Crackhappy@lemmy.world avatar

I like the way you think.

ipkpjersi ,

Make the fade only apply 25% (or maybe a percentage range) of the time, slowly increase how often and how intense the opacity is. lol

howrar ,

Or, make it fade more and more for each “unique” visitor. Make sure it hits after they start their marketing campaign.

Agent641 ,

Make it fade out after 5pm friday and fade back in on monday at 9am.

Charge them extra for working outside of business hours

Crackhappy ,
@Crackhappy@lemmy.world avatar

What the duck did I do.

yokonzo ,

I mean does it matter if you’re frank and say "its happening because you didn’t pay? Its not like they can go to the cops or something

PlexSheep ,

Depends on what you sold, it might be funny fraud

stephen01king ,

Can it be considered sold if it hasn’t been paid?

PlexSheep ,

This is only useful if it’s a kind of subscription model, right? Otherwise, you sell the thing and fuck off, never to be seen and maintain it.

blujan ,

You don’t say that, you say they are on credit hold and you won’t do any more work until your past work is paid for, after they pay you say credit has been rescinded and they have to prepay for any more work to be done.

Agent641 ,

Send them a bill for “website toner”

yogthos , in Regex flavors
@yogthos@lemmy.ml avatar

I really like this approach for doing non trivial regex github.com/VerbalExpressions


<span style="color:#323232;">const tester = VerEx()
</span><span style="color:#323232;">    .startOfLine()
</span><span style="color:#323232;">    .then('http')
</span><span style="color:#323232;">    .maybe('s')
</span><span style="color:#323232;">    .then('://')
</span><span style="color:#323232;">    .maybe('www.')
</span><span style="color:#323232;">    .anythingBut(' ')
</span><span style="color:#323232;">    .endOfLine();
</span>
frezik , (edited )

I don’t. It may look less like line noise, but it doesn’t unravel the underlying complexity of what it does. It’s just wordier without being helpful.

www.wumpus-cave.net/post/2022/06/…/index.html

Edit: also, these alternative syntaxes tend to make some easy cases easy, but they have no idea what to do with more complicated cases. Try making nested capture groups with these, for instance. It gets messy fast.

JoeyJoeJoeJr ,

it doesn’t unravel the underlying complexity of what it does… these alternative syntaxes tend to make some easy cases easy, but they have no idea what to do with more complicated cases

This can be said of any higher-level language, or API. There is always a cost to abstraction. Binary -> Assembly -> C -> Python. As you go up that chain, many things get easier, but some things become impossible. You always have the option to drop down, though, and these regex tools are no different. Software development, sysops, devops, etc are full of compromises like this.

yogthos ,
@yogthos@lemmy.ml avatar

Exactly, at the end of the day it’s about using the right tool for the job. Code that’s clear and declarative is easier to maintain, so it makes sense to default to it, but nothing stops you from using low level constructs if you really need to.

TrickDacy , in Site: "I don't feel so good...."
@TrickDacy@lemmy.world avatar

You automate that shit, you never give them direct access to the source code, and you obfuscate the code that changes the opacity so that it’s really hard to find even if they manage to wrest control away from you. I did this once after the client failed to pay as agreed. They narrowly escaped their site being replaced with a message saying they did not pay their bill, by paying eventually, but I couldn’t let them get away with that shit if they decided to change passwords and tried to screw me completely.

mosiacmango ,

33% of payment on project start, 66% of payment on demonstration of final product, 100% payment on hand over.

Worst case you get 66% of your payment. Make sure 66% is enough to make the project profitable.

Clear contracts are also important. Fuck you, pay me.

TrickDacy ,
@TrickDacy@lemmy.world avatar

Yes to all this. Mike Monteiro is a hero of mine

mesamunefire ,

Loved that video back when I was contracting. I paid a lawyer to draft up a standard contract and that was the best thing I ever did. Great value for the $$s. Saved my butt a couple of times.

netvor ,
@netvor@lemmy.world avatar

I like that plan because it ends up paying 200%

edit: 199%

01189998819991197253 , in More confusion for recruiters
@01189998819991197253@infosec.pub avatar

And its syntax is nothing like python haha

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines