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
LOOK I AM A TURTLE
May 22, 2003

"I'm actually a tortoise."
Grimey Drawer
(did-you-start? 'programming (with 'lisp))

Adbot
ADBOT LOVES YOU

Soricidus
Oct 21, 2010
freedom-hating statist shill

LOOK I AM A TURTLE posted:

(did-you-start? 'programming (with 'lisp))

(did-startp you programming (lambda (event) (usesp event lisp)))

RobertKerans
Aug 25, 2006

There is a heppy lend
Fur, fur aw-a-a-ay.

redleader posted:

Would you be able to expand on the caveats and issues with Elm? Most users seem to tend towards the fanboy end of the spectrum, so I haven't seen much discussion of its limitations etc.

This is probably the wrong thread, it is not a coding horror at all, but : it feels like a toy. A very pretty toy that works really well and makes me feel like a Real Functional Programmer with my immutable data structures and curried-everything and lack of side effects, fighting the holy war against imperative code. It’s very carefully designed, language is small and pretty simple and well thought through. It works _great_ for simple things, the compiler is fantastic for debugging (even if the passive-aggressive error messages get a bit much after a while), generally stuff Just Works if it compiles and runtime errors are extremely rare. I liked using it most of the time but I’ll probably never write another Elm app again. Some people love it and I totally understand why. But just a few things off the top of my head (sorry for the brain dump):

  • The language creator needs to bless any packages that use native JS bindings. The outline of why is here: https://groups.google.com/forum/#!msg/elm-dev/1JW6wknkDIo/H9ZnS71BCAAJ, and he makes good points, but it locks the language down into a subset of JS functionality, and everything moves so slowly. The speedier compilation times & code splitting of the last release are nice, but it would have been nicer if WebSocket support was fixed after years of being hosed, for example.
  • Highly prescriptive and by design, no escape hatches. For example, I can’t just generate random numbers or just use timing functions on the fly (or have transient state) without integrating into the model. This is cool for non-complex apps and toys: being able to see and manipulate the entire state of the app is great in those cases. This is less cool when you need to get stuff done in larger apps. It is also less than cool for animation.
  • The models and the update functions bloat (the last point is a factor here). There are techniques to break models down into discrete parts but they aren’t particularly nice. The update function in every app I’ve worked on either becomes enormous or gets split down (this update delegates to this update delegates to this update etc), getting progressively harder to edit. nb, given they’re based on the Elm architecture, this is an issue with Redux/Flux style state management solutions in JS, but in that context the solutions can just be ignored when they need to be ignored.
  • Interop with JS is done via async ports. Some people seem to like the isolation from scary, messy JS code. The way they work is quite straightforward, but it creates lots of boilerplate and it’s a pain in the rear end. There is no FFI, and there never will be afaik.
  • Handling JSON (serialising/deserialising to/from the typed records Elm wants) is extremely boilerplate-y and a pain in the rear end.
  • Miniscule community.
  • Very small ecosystem.
  • Very slow moving (still years old bugs in the compiler + important key packages).
  • JS output is generally unreadable, which is hella annoying
  • Minor, but mandates GitHub usage if you want to use the package manager.
  • Minor but bizarre language/package versioning issues. Generally takes the form of: install packages. Packages install suspiciously fast. Installer says yup, everything installed. Check install directory, nothing there. Faff on trying to to figure out which older version of lang/older versions of packages was causing the issue: installer consistently says everything is ok. “Packages configured successfully!” says the cheery liar. Every. loving. Time.
  • Outside of a few core packages, the docs are not generally very good at all. The language is fairly simple and highly constrained, which mitigates this issue a bit, but it’s still loving frustrating.
  • The REPL is annoyingly poo poo.
  • I probably don’t need the complexity of another language for the front end: JS is mighty lovely in many ways but it does work for a lot of things. An isolated, incomplete language that feels a wee bit like a functional programmer’s tech demo, no matter how pretty that demo is, feels a bit like a trap. Good things, architecture-wise and technique-wise, have and (I'm sure will continue) to come out of it but I can't shake the feeling that, like Haskell, it feels like a research languge. In Elm's case, it's one person's research language, and though he's done a super job, it's really just him and I don't think he can keep up; I think it will die and be fondly remembered

mod saas posted:

Did you start (programming [with lisp])?

Was very late (and I was very tired [And I kept making edits to the post {and adding them in brackets (and my thought process kinda leaked through)}]). Reading it back, and indeed it does look like lisp gibberish

RobertKerans fucked around with this message at 13:34 on Jan 29, 2019

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

RobertKerans posted:

Was very late (and I was very tired [And I kept making edits to the post {and adding them in brackets (and my thought process kinda leaked through)}]). Reading it back, and indeed it does look like lisp gibberish

Please don't steal my posting gimmick

redleader
Aug 18, 2005

Engage according to operational parameters

Thanks for the detailed write up! Good stuff.

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


It sounds like at least a few of the Elm issues would be resolved if web assembly takes off and you can bypass Javascript. Is that a fair assessment?

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


double post

ultrafilter fucked around with this message at 01:03 on Jan 30, 2019

Doc Hawkins
Jun 15, 2010

Dashing? But I'm not even moving!


ultrafilter posted:

It sounds like at least a few of the Elm issues would be resolved if web assembly takes off and you can bypass Javascript. Is that a fair assessment?

I can see how having webassembly as a compilation target would help elm, but I don't don't see how it would address any issues in that list.

Speaking of the list, I liked it, too. I'm surprised that ffi seemed so insurmountable; it was my understanding that you can write modules with synchronous javascript interop, just that you couldn't publish them (although looking into it now I see someone wrote a package manager to get around that).

No one can reasonably disagree that the language is being developed with the brakes firmly applied, and I'd expect there to be things falling by the wayside as a result.

Zopotantor
Feb 24, 2013

...und ist er drin dann lassen wir ihn niemals wieder raus...

Soricidus posted:

(did-startp you programming (lambda (event) (usesp event lisp)))

love first my was FORTH

Osmosisch
Sep 9, 2007

I shall make everyone look like me! Then when they trick each other, they will say "oh that Coyote, he is the smartest one, he can even trick the great Coyote."



Grimey Drawer
code:
10 INPUT "ENTER NAME?"; A$
20 PRINT "YOU HAVE LEARNED BASIC, " A$
And then you just PEEK and POKE all day.

RobertKerans
Aug 25, 2006

There is a heppy lend
Fur, fur aw-a-a-ay.

Doc Hawkins posted:

I can see how having webassembly as a compilation target would help elm, but I don't don't see how it would address any issues in that list.

Speaking of the list, I liked it, too. I'm surprised that ffi seemed so insurmountable; it was my understanding that you can write modules with synchronous javascript interop, just that you couldn't publish them (although looking into it now I see someone wrote a package manager to get around that).

No one can reasonably disagree that the language is being developed with the brakes firmly applied, and I'd expect there to be things falling by the wayside as a result.

Yeah, the FFI thing you can get around, but then you're going off-piste and the risk of things not working when the runtime/packages/etc are updated or modified starts to rise; we tried to do it for a few minor things, but dropped it and wen't back to the boilerplate as it wan't really worth the hassle.

webassembly...meh, it would probably help Elm overall, but yeah, I would expect it to mean nothing with regards to actually programming in Elm. If it did switch to that as a compilation target, I don't see how anything else would change.

Cuntpunch
Oct 3, 2003

A monkey in a long line of kings
Pull Request day!

code:
public First Last {get; set;}
:smithicide:

Doc Hawkins
Jun 15, 2010

Dashing? But I'm not even moving!


RobertKerans posted:

but then you're going off-piste

I resolve to start using this phrase.

Joda
Apr 24, 2010

When I'm off, I just like to really let go and have fun, y'know?

Fun Shoe
I found a database table at works that has not one but three composite indices that all order by primary key first.

Good Sphere
Jun 16, 2018

I found these very incorrect iOS pixel to point and point to pixel conversions on GitHub written in Obj-C

code:
- (CGFloat)pixelToPoints:(CGFloat)px {
    CGFloat pointsPerInch = 72.0; // see: [url]http://en.wikipedia.org/wiki/Point%5Fsize#Current%5FDTP%5Fpoint%5Fsystem[/url]
    CGFloat scale = 1;
    float pixelPerInch; // DPI
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
        pixelPerInch = 132 * scale;
    } else if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
        pixelPerInch = 163 * scale;
    } else {
        pixelPerInch = 160 * scale;
    }
    CGFloat points = px * pointsPerInch / pixelPerInch;
    return points;
}

- (CGFloat)pointsToPixels:(CGFloat)points {
    CGFloat pointsPerInch = 72.0; // see: [url]http://en.wikipedia.org/wiki/Point%5Fsize#Current%5FDTP%5Fpoint%5Fsystem[/url]
    CGFloat scale = 1;
    float pixelPerInch; // DPI
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
        pixelPerInch = 132 * scale;
    } else if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
        pixelPerInch = 163 * scale;
    } else {
        pixelPerInch = 160 * scale;
    }
    CGFloat px = points / pointsPerInch * pixelPerInch;
    return px;
}
It doesn't have to do with the devices that were around at the time, since it's from 2018. My favorite part is multiplying by the unchanging scale value of 1.

CPColin
Sep 9, 2003

Big ol' smile.
Noticed this in another department's form for submitting an RSVP to an event:

HTML code:
<input class="hide" type="checkbox" name="_cc[]" checked value="foo@example.com,bar@example.com">
I think somebody forgot about <input type="hidden"> here?? Also, who wants to bet that stuffing this parameter would let people CC whatever emails they want to?

cynic
Jan 19, 2004



CPColin posted:

Noticed this in another department's form for submitting an RSVP to an event:

HTML code:
<input class="hide" type="checkbox" name="_cc[]" checked value="foo@example.com,bar@example.com">
I think somebody forgot about <input type="hidden"> here?? Also, who wants to bet that stuffing this parameter would let people CC whatever emails they want to?

I recently found something like this on a server, thankfully they had also misconfigured the mailserver so nothing had ever actually sent, I love it when one fuckup fixes another fuckup - like the time I found some code that was incidentally secure because the input cleansing code was so loving backwards that even valid values weren't getting through, never mind someone doing some SQL injection or something.

xtal
Jan 9, 2011

by Fluffdaddy

CPColin posted:

Noticed this in another department's form for submitting an RSVP to an event:

HTML code:
<input class="hide" type="checkbox" name="_cc[]" checked value="foo@example.com,bar@example.com">
I think somebody forgot about <input type="hidden"> here?? Also, who wants to bet that stuffing this parameter would let people CC whatever emails they want to?

Given how thoroughly dead semantic HTML is on the front-end, you're lucky it's not <div class="hidden checked form button" data-name="_cc[]" data-value="foo@example.com"></div>

Carbon dioxide
Oct 9, 2012

cynic posted:

I recently found something like this on a server, thankfully they had also misconfigured the mailserver so nothing had ever actually sent, I love it when one fuckup fixes another fuckup - like the time I found some code that was incidentally secure because the input cleansing code was so loving backwards that even valid values weren't getting through, never mind someone doing some SQL injection or something.

For a simple website I maintain I use a tiny little CMS called CouchCMS. It's free to use and the nicest thing for me was that it makes it incredibly easy to migrate static html/css pages into the CMS WYSIWYG editor.

Anyway, you can build extremely simple web forms through it, that do nothing but some basic validation, send the form contents to a pre-configured e-mail address, and show the user a success or error message you can define.
When I built one of those a couple years ago I wanted a script to do a bit of processing on the form input, add the processed result into a hidden form field, and send that along in the e-mail. Yes, I am aware that anyone who knows of the dev console can change that processing logic but this wasn't anything sensitive so whatever.

Anyway, I tried using the CMS's hidden input field (which seems to correspond to the html input type=hidden) and it didn't work. Turns out this hidden field is used by the CMS purely to send immutable data. It will send whatever you preconfigured in there.
CouchCMS Support confirmed that my approach of using a regular input field for my processing output and making it hidden with css was the way to go.

Ellie Crabcakes
Feb 1, 2008

Stop emailing my boyfriend Gay Crungus

Carbon dioxide posted:

For a simple website I maintain I use a tiny little CMS called CouchCMS. It's free to use and the nicest thing for me was that it makes it incredibly easy to migrate static html/css pages into the CMS WYSIWYG editor.

Anyway, you can build extremely simple web forms through it, that do nothing but some basic validation, send the form contents to a pre-configured e-mail address, and show the user a success or error message you can define.
When I built one of those a couple years ago I wanted a script to do a bit of processing on the form input, add the processed result into a hidden form field, and send that along in the e-mail. Yes, I am aware that anyone who knows of the dev console can change that processing logic but this wasn't anything sensitive so whatever.

Anyway, I tried using the CMS's hidden input field (which seems to correspond to the html input type=hidden) and it didn't work. Turns out this hidden field is used by the CMS purely to send immutable data. It will send whatever you preconfigured in there.
CouchCMS Support confirmed that my approach of using a regular input field for my processing output and making it hidden with css was the way to go.
Eww

KaneTW
Dec 2, 2011


A while back, but yeah, this. Chris Allen is also very responsive and offers educational discounts and stuff.

Sinestro
Oct 31, 2010

The perfect day needs the perfect set of wheels.
He's also a huge piece of poo poo and a major bully within the community, up to and including screwing his co-author out of any money for the book, but... I'm glad you had good experiences, I guess? The book is good, though, I'd just suggest finding a way to obtain it that doesn't give him money.

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice

Sinestro posted:

He's also a huge piece of poo poo and a major bully within the community, up to and including screwing his co-author out of any money for the book, but... I'm glad you had good experiences, I guess? The book is good, though, I'd just suggest finding a way to obtain it that doesn't give him money.

I haven't heard anything about this; do you have a link?

dougdrums
Feb 25, 2005
CLIENT REQUESTED ELECTRONIC FUNDING RECEIPT (FUNDS NOW)
E: Totally wrong thread ....

Absurd Alhazred
Mar 27, 2010

by Athanatos
I think this is the result of some underlying coding horror. Let me know if there's a more appropriate thread for it:

https://twitter.com/LouiseMCMLXXV/status/1094608284772958214

JehovahsWetness
Dec 9, 2005

bang that shit retarded
nvm

Taffer
Oct 15, 2010


Absurd Alhazred posted:

I think this is the result of some underlying coding horror. Let me know if there's a more appropriate thread for it:

https://twitter.com/LouiseMCMLXXV/status/1094608284772958214

That is an extremely common error. Jan 1 1970 is the staring point of unix epoch time, so a variety of errors that miscalculate time for whatever reason end up with this date, which is zero. Unix time is measured in milliseconds since that date, and is the underlying system for most timekeeping.

https://en.m.wikipedia.org/wiki/Unix_time

Absurd Alhazred
Mar 27, 2010

by Athanatos

Taffer posted:

That is an extremely common error. Jan 1 1970 is the staring point of unix epoch time, so a variety of errors that miscalculate time for whatever reason end up with this date, which is zero. Unix time is measured in milliseconds since that date, and is the underlying system for most timekeeping.

https://en.m.wikipedia.org/wiki/Unix_time

Yeah, quite a few people in the responses pointed that out. Kind of silly to write up a situation where an error results in "please come back at 0".

xtal
Jan 9, 2011

by Fluffdaddy
My bet is a null pointer exception somewhere.

JavaScript code:
> new Date(null)
Date 1970-01-01T00:00:00.000Z
If they use a weakly-typed language, and the timestamp column is null but not checked, it would result in this.

xtal fucked around with this message at 16:09 on Feb 11, 2019

duz
Jul 11, 2005

Come on Ilhan, lets go bag us a shitpost


Absurd Alhazred posted:

Yeah, quite a few people in the responses pointed that out. Kind of silly to write up a situation where an error results in "please come back at 0".

Not really, that's what I would expect of something with no error handling.

JawnV6
Jul 4, 2004

So hot ...
Over here it shows up as Dec 31 1969 :smug:

GI_Clutch
Aug 22, 2000

by Fluffdaddy
Dinosaur Gum
Speaking of dates, while not a coding horror, we frequently implement a CMS that runs with MS SQL Server as the back end. While going through testing, the customer apparently went hardcore, checking to see what the oldest date that could be entered into date fields was. Then they demanded the system design document be updated to reflect that the oldest date that could be entered was 1/1/1753. You know, because their workers are going to be trying to search for child support or medicaid applications turned in before we even became a country.

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.
code:
try {
  foreach (..) {
    lock(..) {
      try {
:smithicide:

tyrelhill
Jul 30, 2006
:yeshaha:

poemdexter
Feb 18, 2005

Hooray Indie Games!

College Slice
At least they are trying, right? That's all any of us can do.

Che Delilas
Nov 23, 2009
FREE TIBET WEED
It's so safe!

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.

Che Delilas posted:

It's so safe!

I mean... the outer try was there because the lock could throw. :smith:

Ola
Jul 19, 2004

poemdexter posted:

At least they are trying, right? That's all any of us can do.

If at first you don't succeed, nest another try clause.

omeg
Sep 3, 2012

Exceptions were a mistake.

Adbot
ADBOT LOVES YOU

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

Ola posted:

If at first you don't succeed, nest another try clause.

code:
If (AtFirstArray[0] != 'Succeed')
   { Try
       { Try 
          { // Again
          }
       }
    }

Scaramouche fucked around with this message at 00:28 on Feb 16, 2019

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