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
vodkat
Jun 30, 2012



cannot legally be sold as vodka
I need to make a simple website that will be updated occasionally, is using Jekyll for this a good or bad idea?

Adbot
ADBOT LOVES YOU

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE
I know some people who write modern idiomatic C++ and it is a terrifying sight to behold

gonadic io
Feb 16, 2011

>>=

vodkat posted:

I need to make a simple website that will be updated occasionally, is using Jekyll for this a good or bad idea?

I did this for my website, seemed fine. Better than writing any loving html it was just about writing md files and putting them in the right place

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE
this miserable pile of angle brackets and colons allegedly wraps a c function that uses setjmp/longjmp for error handling (lol libjpeg) such that it throws c++ exceptions instead and im not sure if it’s terrible or awesome

maybe “awful” in the olde English sense is the word I’m looking for

Xarn
Jun 26, 2015

TheFluff posted:

this miserable pile of angle brackets and colons allegedly wraps a c function that uses setjmp/longjmp for error handling (lol libjpeg) such that it throws c++ exceptions instead and im not sure if it’s terrible or awesome

maybe “awful” in the olde English sense is the word I’m looking for


quote:

code:
/*************
  ▒▒▒▒▒
  ▒▒▒▒▒▒▒▒▒
  ▓▓▓░░▓░
 ▓░▓░░░▓░░░
 ▓░▓▓░░░▓░░░
 ▓▓░░░░▓▓▓▓
  ░░░░░░░░
  ▓▓▒▓▓▓▒▓▓
 ▓▓▓▒▓▓▓▒▓▓▓
▓▓▓▓▒▒▒▒▒▓▓▓▓
░░▓▒░▒▒▒░▒▓░░
░░░▒▒▒▒▒▒▒░░░
░░▒▒▒▒▒▒▒▒▒░░
  ▒▒▒   ▒▒▒
 ▓▓▓    ▓▓▓
▓▓▓▓    ▓▓▓▓
*************/
class Jumpman {

:drat:

Slurps Mad Rips
Jan 25, 2009

There's No Guarantee

TheFluff posted:

this miserable pile of angle brackets and colons allegedly wraps a c function that uses setjmp/longjmp for error handling (lol libjpeg) such that it throws c++ exceptions instead and im not sure if it’s terrible or awesome

maybe “awful” in the olde English sense is the word I’m looking for

This is actually pretty neat. setjmp/longjmp error handling in stuff like lua means you need to compile these C libraries as C++ just so destructors run and that's a nightmare. That said, this code is deffo c++11/c++14. result_of_t was deprecated in c++17 and removed for c++20.

A more "modern" code example would look like this. i probably hosed up the perfect forwarding for returning a value but who cares you get the idea

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

Slurps Mad Rips posted:

This is actually pretty neat. setjmp/longjmp error handling in stuff like lua means you need to compile these C libraries as C++ just so destructors run and that's a nightmare. That said, this code is deffo c++11/c++14. result_of_t was deprecated in c++17 and removed for c++20.

A more "modern" code example would look like this. i probably hosed up the perfect forwarding for returning a value but who cares you get the idea

this is me reading this:

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE

Slurps Mad Rips posted:

This is actually pretty neat. setjmp/longjmp error handling in stuff like lua means you need to compile these C libraries as C++ just so destructors run and that's a nightmare. That said, this code is deffo c++11/c++14. result_of_t was deprecated in c++17 and removed for c++20.

A more "modern" code example would look like this. i probably hosed up the perfect forwarding for returning a value but who cares you get the idea

it's a few years old yeah. still, c++ generics just look like :pwn: to me

e: the same guy has also written a good deal of video dsp code that uses c++ templates in combination with assembler intrinsics and there's just something vaguely unsettling about that to me

TheFluff fucked around with this message at 15:23 on Aug 16, 2018

prisoner of waffles
May 8, 2007

Ah! well a-day! what evil looks
Had I from old and young!
Instead of the cross, the fishmech
About my neck was hung.

Symbolic Butt posted:

this is me reading this:

Finster Dexter
Oct 20, 2014

Beyond is Finster's mad vision of Earth transformed.

Symbolic Butt posted:

this is me reading this:


:yossame:

Sapozhnik
Jan 2, 2005

Nap Ghost

Symbolic Butt posted:

this is me reading this:

Xarn
Jun 26, 2015
I might be permanently broken, I find it pretty readable. :v:


I'll admit I am pretty bad writing these things, didn't really have reason to practice too much.

prisoner of waffles
May 8, 2007

Ah! well a-day! what evil looks
Had I from old and young!
Instead of the cross, the fishmech
About my neck was hung.
I understand what it is supposed to do (turning C-style "exception handling" into C++-style)

I read 50 lines and I think I understand them

but now my brain wants to turn off

e: gently caress me now I'm reading jumpman.cpp

prisoner of waffles fucked around with this message at 17:26 on Aug 16, 2018

Slurps Mad Rips
Jan 25, 2009

There's No Guarantee

prisoner of waffles posted:

I understand what it is supposed to do (turning C-style "exception handling" into C++-style)

I read 50 lines and I think I understand them

but now my brain wants to turn off

e: gently caress me now I'm reading jumpman.cpp

tbqh the idea of converting setjmp/longjmp to a c++ exception entirely within c++ without using ABI specific info is an insane idea and I never would have thought it was possible

Finster Dexter
Oct 20, 2014

Beyond is Finster's mad vision of Earth transformed.
ctps: I'm plumbing the depths of a whole new universe of being terrible. Currently staring at the AWS console and wondering why I agreed to do devops stuff. Currently reading Aurora docs and still unsure why I would want this. I just want to set up a database server, geez.

Sapozhnik
Jan 2, 2005

Nap Ghost
yeah so just set up a regular postgres rds instance and be done with it

bring lots of money

Finster Dexter
Oct 20, 2014

Beyond is Finster's mad vision of Earth transformed.

Sapozhnik posted:

yeah so just set up a regular postgres rds instance and be done with it

bring lots of money

I can't get over how loving expensive aws is. Our staging really needs to be up in aws though, since we want to match prod as much as possible.

my new dog
May 7, 2007

by Nyc_Tattoo
my academic license for github expired and now microsoft is holding my codes ransom

FlapYoJacks
Feb 12, 2009
Modern C++ >= 14 is cool and good and makes C++ almost a higher level language.

If the C++ is hard to read, it's probably because of either:
1) A garbage programmer who is probably afraid of function pointers and uses threads with callbacks for everything
2) A C programmer who treats C++ as just C with classes and doesn't use it like a modern language.
3) A P-Lang developer who never learned C and tries to treat C++ as a pure P-Lang.

You need a C++ guy who knows C and P-Langs, and has embraced C++ as a modern language.

Either way, modern C++ is cool and good.

FlapYoJacks fucked around with this message at 21:48 on Aug 16, 2018

Fiedler
Jun 29, 2002

I, for one, welcome our new mouse overlords.
the best way to ensure that you're using c++ properly is: don't.

Sapozhnik
Jan 2, 2005

Nap Ghost

ratbert90 posted:

Modern C++ >= 14 is cool and good and makes C++ almost a higher level language.

If the C++ is hard to read, it's probably because of either:
1) A garbage programmer who is probably afraid of function pointers and uses threads with callbacks for everything
2) A C programmer who treats C++ as just C with classes and doesn't use it like a modern language.
3) A P-Lang developer who never learned C and tries to treat C++ as a pure P-Lang.

You need a C++ guy who knows C and P-Langs, and has embraced C++ as a modern language.

Either way, modern C++ is cool and good.

counterpoint: no

Lutha Mahtin
Oct 10, 2010

Your brokebrain sin is absolved...go and shitpost no more!

my new dog posted:

my academic license for github expired and now microsoft is holding my codes ransom

i use bit bucket for personal projects because of this im cheap

Corla Plankun
May 8, 2007

improve the lives of everyone
is there a better way to json.loads() something and failover to an empty object if the string is bad than just a try catch?

it seems hacky to have to trycatch for thousands of lines that might fail this json parsing step

jony neuemonic
Nov 13, 2009

Lutha Mahtin posted:

i use bit bucket for personal projects because of this im cheap

:same:

though they throw in free ci now too which is pretty great.

Schadenboner
Aug 15, 2011

by Shine

Lutha Mahtin posted:

i use bit bucket for personal projects because of this im cheap

Has anyone called it "butt bucket" yet?

gonadic io
Feb 16, 2011

>>=

my new dog posted:

my academic license for github expired and now microsoft is holding my codes ransom

that's what you get for having secret projects. all public all the time baby

Lutha Mahtin
Oct 10, 2010

Your brokebrain sin is absolved...go and shitpost no more!

Schadenboner posted:

Has anyone called it "butt bucket" yet?

brb gonna go push some code into the bucket

Corla Plankun
May 8, 2007

improve the lives of everyone
i feel like there should be a json.get_object(json_string, default_value) method but maybe the json module is really excited about the dumb python institutionalized try/except ideology

tef
May 30, 2004

-> some l-system crap ->

Corla Plankun posted:

is there a better way to json.loads() something and failover to an empty object if the string is bad than just a try catch?

it seems hacky to have to trycatch for thousands of lines that might fail this json parsing step

you spent longer typing this than it would take to do what you suggest and move on

tef
May 30, 2004

-> some l-system crap ->
if you want a language that retuns null for everything, try ruby

FlapYoJacks
Feb 12, 2009

Sapozhnik posted:

counterpoint: no

Sorry you don't understand a good programming language.

FlapYoJacks fucked around with this message at 23:10 on Aug 16, 2018

tef
May 30, 2004

-> some l-system crap ->

ratbert90 posted:

Modern C++ >= 14 is cool and good and makes C++ almost a higher level language.

If the C++ is hard to read, it's probably because of either:
1) A garbage programmer who is probably afraid of function pointers and uses threads with callbacks for everything
2) A C programmer who treats C++ as just C with classes and doesn't use it like a modern language.
3) A P-Lang developer who never learned C and tries to treat C++ as a pure P-Lang.

You need a C++ guy who knows C and P-Langs, and has embraced C++ as a modern language.

Either way, modern C++ is cool and good.

you know i had sympathy for you once

FlapYoJacks
Feb 12, 2009

tef posted:

you know i had sympathy for you once

I like modern C++ and think it has it's place.
I also really like Python and think it has it's place.

PHP can go gently caress right off though. :colbert:

cinci zoo sniper
Mar 15, 2013




Corla Plankun posted:

i feel like there should be a json.get_object(json_string, default_value) method but maybe the json module is really excited about the dumb python institutionalized try/except ideology

thing is the alternative to try/except here is

code:
foo.get('bar', {}).get('baz', {}).get('loren', {}).get('ipsum')
on the resulting dictionary. please us try/except for this specific thing, or at least something like https://pydash.readthedocs.io/en/latest/api.html#pydash.objects.has

Corla Plankun
May 8, 2007

improve the lives of everyone
i did it after i posted about it i just wanted to talk about terrible programming in the terrible programming thread tef, gosh

this dataset is literally going to fall into the except clause 60,000 times a day so it feels really bad to rely on catches here. i probably should just count brackets on any string that's max length but its not really worth the trouble, I was just wondering and honestly kinda surprised that json.loads doesn't have some kind of default argument like dict.get does

Finster Dexter
Oct 20, 2014

Beyond is Finster's mad vision of Earth transformed.

ratbert90 posted:

I also really like Python and think it has it's place.

This is a bridge too far

Stringent
Dec 22, 2004

The internet is the universal sewer.

Corla Plankun posted:

i did it after i posted about it i just wanted to talk about terrible programming in the terrible programming thread tef, gosh

this dataset is literally going to fall into the except clause 60,000 times a day so it feels really bad to rely on catches here. i probably should just count brackets on any string that's max length but its not really worth the trouble, I was just wondering and honestly kinda surprised that json.loads doesn't have some kind of default argument like dict.get does

make a with block out of it so a) you don't have to look at it and b) the next poor bastard that has to look at it will have no loving clue what is going on

Ellie Crabcakes
Feb 1, 2008

Stop emailing my boyfriend Gay Crungus

Corla Plankun posted:

i feel like there should be a json.get_object(json_string, default_value) method but maybe the json module is really excited about the dumb python institutionalized try/except ideology
You could always use dpath or something similar.

tef
May 30, 2004

-> some l-system crap ->

Corla Plankun posted:

this dataset is literally going to fall into the except clause 60,000 times a day so it feels really bad to rely on catches here.

exceptions are pretty cheap in python when compared with the rest of the intepretation, it's cool

i mean, i prefer getattr(item, name, default) style stuff where possible, but 60k times a day is uh just over once a second, you have time

Adbot
ADBOT LOVES YOU

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS

Finster Dexter posted:

ctps: I'm plumbing the depths of a whole new universe of being terrible. Currently staring at the AWS console and wondering why I agreed to do devops stuff. Currently reading Aurora docs and still unsure why I would want this. I just want to set up a database server, geez.

aws loving owns and paas is super cool and good

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