ballp.it

Snakes In The Ball Pit => Yay, I get to talk about me! => Topic started by: Ambious on July 01, 2016, 04:20:08 pm

Title: Thread.setTitle("Programmers Anonymous");
Post by: Ambious on July 01, 2016, 04:20:08 pm
A lot of people here dabble in code.
Let's share our experiences and bitch about how much we hate it but can't stop doing it anyway.
I'll go first:

My name is Ambious and I've spent my entire evening programming my first Python app.

WHO THE FUCK INVENTED THIS MESS!?
IT HAS ALL THE SYNTAX CONSISTENCY OF VISUAL BASIC!!!
AHHH!!! HOW IS THIS SHIT SO POPULAR!?
Title: Thread.setTitle("Programmers Anonymous");
Post by: EYE OF ZA on July 01, 2016, 05:26:27 pm
I make mods in the Skyrim engine because I like tinkering with game/level/quest design.  If you want to know why Skyrim runs poorly, here's an example of how the engine works.

Let's say I want to run a script on "NPCs in the vicinity of the player".  For instance, if I need to know whether the NPC can see the player via that NPC's OnGainLOS event.

1. Make a quest that points to the player.  This is the only way to run a script on startup: making a quest.
2. Create a cloak ability that the quest script adds to the player. 
2.a. Create a magic effect on an area around the player.  This is the easiest way to affect all NPCs within a certain area.
2.b. Right now, this magic effect is going to be applied every game tick, which is going to use up a lot of computational power.  Add a script that toggles it on for a second, then off for four seconds or so.
2.c. Skyrim has 'brawls' where you're not allowed to use magic, but because this is technically magic, it'll break those brawls.  Add conditions to the magic effect that make it stop working during brawls.
3. Create a spell.  This spell is what the cloak effect casts on any NPC that comes into contact with it. 
3.a. Create a magic effect for the spell that contains a script that runs AddSpell on the targeted NPC.
4. Create a spell of the 'Ability' type. This is what the AddSpell script adds to the NPCs. Normal spells expire, abilities do not.
4.a. Create the magic effect for that ability.
4.b. Put whatever script you want the NPC to run into that magic effect.
4.c. Make sure to include a special conditional statement for OnDying so that when the NPC dies, it doesn't keep running the script and bloat the save game.

So essentially you make a quest that adds a spell to you that casts a spell on any NPCs in the area that adds an ability that runs the script.

This is the easiest way the modding community has found to attach scripts to nearby NPCs.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Gyro on July 02, 2016, 10:15:26 am
I'm working on a voxel game engine in Rust because I'm a huge fucking hipster and Rust seems like a pretty good language actually. Here's the Github repo if you care: https://github.com/NotGyro/Gestalt
The latest thing I've been thinking about is whether to use Lua, Python, or C# as a scripting language for this project (in Python or C# the core engine bits would be embedded in the scripting language, rather than the other way around.) I'm leaning towards Lua, because my main problem with Lua was the "end" keyword you need to put everywhere and the global-by-default behavior, and both of those can be fixed with a little project called Moonscript (http://moonscript.org/), which is a transpiler and is basically CoffeeScript for Lua.

I make mods in the Skyrim engine because I like tinkering with game/level/quest design.  If you want to know why Skyrim runs poorly, here's an example of how the engine works.
EYE OF ZA, July 01, 2016, 05:26:27 pm

Wow, okay, that's a mess. Is it any easier with SKSE?

I considered developing Skyrim mods - but every time I think "I want X feature," I go looking on Nexus and somebody has already implemented X feature.

Could you link us to some of your mods? I'm curious.
Title: Thread.setTitle("Programmers Anonymous");
Post by: EYE OF ZA on July 02, 2016, 01:09:48 pm
It's been a while, but I remember making something with SKSE that could run a script on all actors in a cell.  It has the functions GetNumRefs/GetNthRef that let you iterate over all objects of a certain type (like NPCs) in a cell, so presumably you could set up a cycle like the above where every four seconds you AddSpell to all NPCs matching whatever conditions you specify.  (You have to repeat it because given NPCs' schedules and the player's movements, the NPCs in a cell can change at any time. Four seconds is a good medium because at top sprinting speed a player will cross a cell in about eight seconds.)  In this case, all you'd need to make is a quest, a script for that quest to run GetNumRefs/GetNthRef/AddSpell, and the ability that contains the actual script you want the NPCs to run.

It's entirely possible that this would break the engine or be more computationally expensive, though.  Skyrim's engine is such a weird cobbled together wreck that the fact that it can run at all is a feat.

I haven't put my mods up anywhere because they're more personal experimentation about "what if I could do ___" than any kind of finished product.  I like the problem-solving more than the polishing.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Zekka on July 02, 2016, 01:17:58 pm
I haven't put my mods up anywhere because
EYE OF ZA, July 02, 2016, 01:09:48 pm

Oh, so they're sex mods. Just be sure to send the links discreetly or else post pseudonymously and you probably won't get ratted out.
Title: Thread.setTitle("Programmers Anonymous");
Post by: duz on July 02, 2016, 03:04:59 pm
WHO THE FUCK INVENTED THIS MESS!?
IT HAS ALL THE SYNTAX CONSISTENCY OF VISUAL BASIC!!!
AHHH!!! HOW IS THIS SHIT SO POPULAR!?
Ambious, July 01, 2016, 04:20:08 pm

If you think those parts of Python are bad, wait until you try to write PHP!
Title: Thread.setTitle("Programmers Anonymous");
Post by: Ambious on July 02, 2016, 04:46:32 pm
WHO THE FUCK INVENTED THIS MESS!?
IT HAS ALL THE SYNTAX CONSISTENCY OF VISUAL BASIC!!!
AHHH!!! HOW IS THIS SHIT SO POPULAR!?
Ambious, July 01, 2016, 04:20:08 pm

If you think those parts of Python are bad, wait until you try to write PHP!
duz, July 02, 2016, 03:04:59 pm

PHP I get.
But a language that distincts between blocks by INDENTATION just seems alien to me.
Title: Thread.setTitle("Programmers Anonymous");
Post by: EYE OF ZA on July 02, 2016, 05:15:58 pm
at least it isn't hoon (https://github.com/cgyarvin/urbit/blob/master/doc/book/3-syntax.markdown)
Title: Thread.setTitle("Programmers Anonymous");
Post by: Gyro on July 02, 2016, 07:33:52 pm
PHP I get.
Ambious, July 02, 2016, 04:46:32 pm

No, you don't. (https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/)
Title: Thread.setTitle("Programmers Anonymous");
Post by: duz on July 02, 2016, 07:48:03 pm
PHP I get.
But a language that distincts between blocks by INDENTATION just seems alien to me.
Ambious, July 02, 2016, 04:46:32 pm

It's just replacing braces with indentation to make code blocks more obvious since not everyone has good highlighting in their editor.
It's also a way to force proper indentation upon your coworkers instead of having to use a linter to auto reject their commits.  Come on guys, it's part of the orientation I give you, try to keep up.


Edit: Like i said on tf2 tonight, I like helping juniors become useful programmers so feel free to pester me.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Nifty Nif on July 02, 2016, 10:07:38 pm
PHP I get.
But a language that distincts between blocks by INDENTATION just seems alien to me.
Ambious, July 02, 2016, 04:46:32 pm

It's just replacing braces with indentation to make code blocks more obvious since not everyone has good highlighting in their editor.
It's also a way to force proper indentation upon your coworkers instead of having to use a linter to auto reject their commits.  Come on guys, it's part of the orientation I give you, try to keep up.
duz, July 02, 2016, 07:48:03 pm

I've felt both of these ways.  Python's syntax is pretty stylish!  I like it as a way to unify indentation, especially since they specify it in their style guide (no holy wars here pls).  I mostly do Java nowadays so maybe I miss such a nice, minimal syntax. But the more I think about it, the more I think Python's whitespace-delimited blocks are on par with curly braces.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Ambious on July 03, 2016, 02:28:07 am
Don't get me wrong, I'm always a slut for proper indentation.
I'm just so used to curly brackets and semicolons that my brain has a hard time compiling what it sees without them.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Zekka on July 03, 2016, 02:42:26 am
C's notation actually falls into kind of a minority if you include non-imperative, non-OO languages (a lot of your imperative OO languages like Java, C++, and C#, are designedly in the lineage of C) -- but the only family I know of where indentation-sensitivity seems to be treated as a default is the ML family. C's relatives in ALGOL and BCPL did not use {} / ;.

The alternate design is usually to use keywords in place of {} / ;, or just to use a different delimiter/terminating punctuation (like Prolog's , / . )
Title: Thread.setTitle("Programmers Anonymous");
Post by: Gyro on July 03, 2016, 12:23:39 pm
The alternate design is usually to use keywords in place of {} / ;,
Zekka, July 03, 2016, 02:42:26 am

I'm reaaaally not a fan of Pascal / Lua's "end" syntax. It's just more typing all the time, for no real benefit over single-character punctuation.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Zekka on July 03, 2016, 12:47:39 pm
There was a study done that found that keyword-based syntax and indentation-based syntax were easier for new programmers to learn: https://www.quorumlanguage.com/evidence/evidence.pdf (https://www.quorumlanguage.com/evidence/evidence.pdf). (the full paper is unfortunately hard to find online, but from what I remember from reading it their methodology was super fair)
Title: Thread.setTitle("Programmers Anonymous");
Post by: Gyro on July 03, 2016, 12:52:02 pm
There was a study done that found that keyword-based syntax and indentation-based syntax were easier for new programmers to learn: https://www.quorumlanguage.com/evidence/evidence.pdf (https://www.quorumlanguage.com/evidence/evidence.pdf). (the full paper is unfortunately hard to find online, but from what I remember from reading it their methodology was super fair)
Zekka, July 03, 2016, 12:47:39 pm

That's pretty legitimate, but out of the two I'd still choose indentation-based syntax by a landslide (and I do, by using Moonscript over pure Lua). The difference is that proper indentation is something you should be doing anyway. No extra typing. Less typing than curly braces, in fact, if you're already indenting that way!

So yeah I kinda like Python.

e: Thanks for the study, by the way. That's pretty informative.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Lemon on July 03, 2016, 06:20:09 pm
I like indentation-based stuff a lot, but I don't get to use it much. I do a lot of writing in Jade (indent based HTML language), and that system just forces me to think in systems and dependencies, and I (sometimes) come out with cleaner code as a result. Always quicker to write.

I do some other stuff in yml, which is terse and that's nice, but I feel like the syntax is dumb and my yml files never work as well as I think they should.
I keep meaning to teach myself coffeescript to eliminate all of the fluff that JavaScript forces into a person, but I never find the time. Hopefully this year.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Zekka on July 03, 2016, 07:24:52 pm
I like indentation-based stuff a lot, but I don't get to use it much. I do a lot of writing in Jade (indent based HTML language), and that system just forces me to think in systems and dependencies, and I (sometimes) come out with cleaner code as a result. Always quicker to write.

I do some other stuff in yml, which is terse and that's nice, but I feel like the syntax is dumb and my yml files never work as well as I think they should.
I keep meaning to teach myself coffeescript to eliminate all of the fluff that JavaScript forces into a person, but I never find the time. Hopefully this year.
Lemon, July 03, 2016, 06:20:09 pm

The improvements Coffeescript introduces (at least as far as I remember) are pretty conservative -- you're a reasonably intelligent person so I doubt it would take you longer than a week to learn to use it. The annoying bit is that you have to manually recompile (or tell your build system to recompile automatically) when you use it -- but it sounds like you already use tools that have that workflow so probably you have no reason to care.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Lemon on July 03, 2016, 07:44:43 pm
Yeah, I precompile both my css and my html, so it makes sense to do it with js as well. Results don't seem quite as interesting, but if I can just avoid that "everything breaks if the last item in an array has a comma after it" problem, my life already improves a little.

Thanks for thinking I'm reasonably intelligent though!
Title: Thread.setTitle("Programmers Anonymous");
Post by: Zekka on July 03, 2016, 08:00:18 pm
Thanks for thinking I'm reasonably intelligent though!
Lemon, July 03, 2016, 07:44:43 pm

If you come into this thread and post a CoffeeScript question I'll probably have to rethink that assessment.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Nifty Nif on July 04, 2016, 02:47:55 pm
On the topic of compiling JS, I'm using React for the first time, and I am rethinking so many of my life choices at this moment.  I really wish they had more docs on their API calls because I don't like using their JSX syntax.  I'm also having to Browserify the Node underneath, which is a real pain in the ass, but it works okay I guess.  I'm probably going about this all wrong, but my main problem is with the lack of documentation on the api calls.  I can mostly pick them up, but for a non-javascripty person they're a little too loose and free to intuit.
Title: Thread.setTitle("Programmers Anonymous");
Post by: ham burger on July 04, 2016, 07:34:15 pm
I keep meaning to teach myself coffeescript to eliminate all of the fluff that JavaScript forces into a person, but I never find the time. Hopefully this year.
Lemon, July 03, 2016, 06:20:09 pm

So, my opinion only but if you're gonna dive in on coffeescript, and you're perfectly okay with compiling JS, forget about coffeescript. Learn all the new ES6 features and start writing ES6 and transpiling it back to ES5 if you're deploying to the internet at large.

ES6 has lots of nifty features Coffeescript will give you, and you have the added bonus of writing code that works without compilation in modern JS environments. Just my two cents. At my last job we used Typescript, and really dug it, but my current team owns a greenfield app that we did in react with ES6 over the past year and it's been a really, really brilliant transition (and JSX aside, we're writing vanilla JS that conforms to the ES specification so should work indefinitely as support for it/work on it will never be dropped.)
Title: Thread.setTitle("Programmers Anonymous");
Post by: nuffkins, of all people, on July 21, 2016, 03:35:57 pm
Today my prof explained that — sure — C++ lambda isn't really lambda, but it can do most things actual lambda can.

Problem: that assumes functional programming purists care about doing things.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Zekka on July 21, 2016, 03:59:07 pm
Today my prof explained that — sure — C++ lambda isn't really lambda, but it can do most things actual lambda can.

Problem: that assumes functional programming purists care about doing things.
nuffkins, July 21, 2016, 03:35:57 pm
What's not real about it?
Title: Thread.setTitle("Programmers Anonymous");
Post by: nuffkins, of all people, on July 21, 2016, 06:25:36 pm
What's not real about it?
Zekka, July 21, 2016, 03:59:07 pm

Functions aren't first class data in C++.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Zekka on July 21, 2016, 06:30:40 pm
What's not real about it?
Zekka, July 21, 2016, 03:59:07 pm

Functions aren't first class data in C++.
nuffkins, July 21, 2016, 06:25:36 pm
Why not? Aren't lambdas in C++ just function pointers paired with the parts of the scope that are already filled? I'm not sure what other properties you would expect a function-as-value to have.

IIRC function pointer plus scope pointer is basically how Haskell or your other purist functional languages represent them, unless static monster cockysis proves that the closure doesn't last any longer than the creating scope.
Title: Thread.setTitle("Programmers Anonymous");
Post by: ham burger on July 22, 2016, 10:02:46 am
unless static monster cockysis
Zekka, July 21, 2016, 06:30:40 pm

OH MY GOD
[/glow]
Title: Thread.setTitle("Programmers Anonymous");
Post by: A Whirring Bone-White Gleech on July 22, 2016, 10:56:03 am
Problem: that assumes functional programming purists care about doing things.
nuffkins, July 21, 2016, 03:35:57 pm

Languages with good functional programming support make setting up callbacks (in graphical programming, for example) much, much easier.  Compare the following:

Python 3:
button = tkinter.Button(root, text = "click me", command = lambda: print("clicked"))

Qt/C++
    QObject::connect(ui->pushButton, &QPushButton::clicked, [=](bool clicked) {
        std::cout << "clicked" << std::endl;
    });

Java Swing (old-style)
        button.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("clicked");
                }
            });

Consider how painful something like node.js (https://nodejs.org/en/) would be, if every time you called an async function, you had to use the Java syntax.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Gyro on July 22, 2016, 12:06:12 pm
It seems to me that, when people talk about functional programming, they're talking about two different things. There are languages with good functional programming support, like Python 3, Scala, and Rust. Then there are pure functional languages where mutable state does not exist outside of monads, like Haskell and (I think) Erlang. I'm pretty sure nuffkins was complaining about proponents of the latter.

Of course, in their defense, Erlang has been used to build practical things a bunch of times. It was born out of a desire to build telephone exchanges. So, you've got at least one functional programming language that people have used to solve real problems.

Pure functional languages still weird me out and I have no idea how to build anything in any of them. Take my opinion with a grain of salt, since I don't know shit.

Functional features in imperative languages are pretty sweet, though, in my experience.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Zekka on July 22, 2016, 12:54:14 pm
It seems to me that, when people talk about functional programming, they're talking about two different things. There are languages with good functional programming support, like Python 3, Scala, and Rust. Then there are pure functional languages where mutable state does not exist outside of monads, like Haskell and (I think) Erlang. I'm pretty sure nuffkins was complaining about proponents of the latter.

Of course, in their defense, Erlang has been used to build practical things a bunch of times. It was born out of a desire to build telephone exchanges. So, you've got at least one functional programming language that people have used to solve real problems.

Pure functional languages still weird me out and I have no idea how to build anything in any of them. Take my opinion with a grain of salt, since I don't know shit.

Functional features in imperative languages are pretty sweet, though, in my experience.
Gyro, July 22, 2016, 12:06:12 pm

FWIW, IIRC Haskell and Idris are the only functional languages right now that are widely cared-about and have a strong preference towards monads. The monad thing is basically a magic trick you use to convince yourself code you would write anyways is OK -- there are advantages but for most programs they are pretty negligible. Monads just guarantee your program is rewritable to a version of your program that didn't use mutation.

IIRC some dogmatic functional languages that don't use monads are Mercury and Clean. (not positive, but I believe they use linear typing, which works like Rust's affine typing)

IIRC erlang is pretty pragmatic and doesn't represent most of the stuff you dislike -- it's also largely untyped.

IIRC. IIRC.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Nifty Nif on July 22, 2016, 05:26:06 pm
If we start talking about Rust in here I'm going to start having a lot of opinions about Rust so I'm going to resist the urge to do that.  (I worked on it as a paid contributor for a brief internship.)

I'm also going to resist the urge to go deep about functional programming.  I have a lot of opinions about that too.  Javascript is beautiful when written functionally, though, and I think NodeJS really takes advantage of that.  Promise yourself to stay out of Callback Hell!  I also think Haskell is gorgeous and I'd love to get into it.

Here's a personal thing: I'm sick of Java haters.  Call me bias [sic], but it's an immensely powerful language that has given rise to some incredible design patterns, and if you don't like reflection you can fuck right off.  I like reflection a lot.  Sure, it's dangerous in the wrong hands, but I can unit test literally any codebase I want with the right libraries.  Haters gonna hate, I'll just be over here with my 100% test coverage and then we'll see who thinks what of Java.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Zekka on July 22, 2016, 05:49:49 pm
I think Java's a little bit too verbose for its own good, but I think it's very faithful to the "don't give people features that they will abuse" credo. I think that the default way of doing a lot of stuff in Java is usually wrong though. Example: there's not a good builtin pattern in Java to derive an extra suite of operations for an object that already supports a smaller one. (Rust has traits, Haskell has typeclasses, Scala has implicits)

I softened on this a lot though after spending a lot of time translating Haskell code to Java. Example with the trait pattern: you can simulate the Haskell, Rust, and Scala approaches by foregoing code that looks like this:

public interface List<T> {
  public T get(int i);
  public void set(int i, T t);
}

public interface Iterable<T> {
  public Iterator<T> iterator();
}

// any List must opt into being Iterable by implementing IterableList instead of implementing List
// if a List author was not aware of IterableList, his List will not support the Iterable operations
public interface IterableList<T> implements List<T>, Iterable<T> {
  default Iterator<T> iterator() {
    // builds a default Iterator that uses the List<T> methods
  }
}

and writing your java code like this instead:

public interface ListOperations<This, T> {
  public T get(This this, int i);
  public void set(This this, int i, T t);
}

public interface IterableOperations<This, T> {
  public Iterator<T> iterator(This this);
}

// you can instantiate this for any ListOperations -- the ListOperations does not have to opt in
public final class ListIterableOperations implements IterableOperations<This, T> {
  private final ListOperations<This, T> asList;

  public ListIterableOperations(ListOperations<This, T> asList) {
    this.asList = asList;
  }

  public Iterator<T> iterator(This this_) {
    // build an Iterator<T> using this.asList
  }
}

This is actually exactly the pattern Haskell uses to compile its equivalent of interfaces. (Haskell interfaces have a feature where you can automatically deduce that an implementation like ListIterableOperations applies to any List) After I saw what Scala did to this pattern with implicits, I actually kinda prefer this take -- it's way less abusable. (Haskell's feature is also quite abusable, but the community is way more aggressive about avoiding the usages of implicits that make code harder to understand.)

I think Java is a pretty good language for super verbosely specifying patterns involving vtables and GC'ed records-referencing-records. I just think a lot of people default to using its features in ways that are not super sound (most patterns involving subclassing non-abstract classes) or which discourage code reuse. (interfaces for the objects that contain the data)
Title: Thread.setTitle("Programmers Anonymous");
Post by: Nifty Nif on July 22, 2016, 06:33:39 pm
I think Java's a little bit too verbose for its own good, but I think it's very faithful to the "don't give people features that they will abuse" credo. I think that the default way of doing a lot of stuff in Java is usually wrong though. Example: there's not a good builtin pattern in Java to derive an extra suite of operations for an object that already supports a smaller one. (Rust has traits, Haskell has typeclasses, Scala has implicits)

I softened on this a lot though after spending a lot of time translating Haskell code to Java. Example with the trait pattern: you can simulate the Haskell, Rust, and Scala approaches by foregoing code that looks like this:

public interface List<T> {
  public T get(int i);
  public void set(int i, T t);
}

public interface Iterable<T> {
  public Iterator<T> iterator();
}

// any List must opt into being Iterable by implementing IterableList instead of implementing List
// if a List author was not aware of IterableList, his List will not support the Iterable operations
public interface IterableList<T> implements List<T>, Iterable<T> {
  default Iterator<T> iterator() {
    // builds a default Iterator that uses the List<T> methods
  }
}

and writing your java code like this instead:

public interface ListOperations<This, T> {
  public T get(This this, int i);
  public void set(This this, int i, T t);
}

public interface IterableOperations<This, T> {
  public Iterator<T> iterator(This this);
}

// you can instantiate this for any ListOperations -- the ListOperations does not have to opt in
public final class ListIterableOperations implements IterableOperations<This, T> {
  private final ListOperations<This, T> asList;

  public ListIterableOperations(ListOperations<This, T> asList) {
    this.asList = asList;
  }

  public Iterator<T> iterator(This this_) {
    // build an Iterator<T> using this.asList
  }
}

This is actually exactly the pattern Haskell uses to compile its equivalent of interfaces. (Haskell interfaces have a feature where you can automatically deduce that an implementation like ListIterableOperations applies to any List) After I saw what Scala did to this pattern with implicits, I actually kinda prefer this take -- it's way less abusable. (Haskell's feature is also quite abusable, but the community is way more aggressive about avoiding the usages of implicits that make code harder to understand.)

I think Java is a pretty good language for super verbosely specifying patterns involving vtables and GC'ed records-referencing-records. I just think a lot of people default to using its features in ways that are not super sound (most patterns involving subclassing non-abstract classes) or which discourage code reuse. (interfaces for the objects that contain the data)
Zekka, July 22, 2016, 05:49:49 pm

Okay, sure, I get the verbosity thing.  But I... I actually like it.
Take your examples.  I actually think the first one is more readable than the second one.  This may come from me being an environment where I write and read Java all day long, or maybe you don't do much OO.  I'm also super used to working on a team, so if someone inherits your code base, practically speaking, they've got to be able to write to it.  In order to do that, they've got to read it first.  Java may be wordy, but it's really explicit about what it's doing, so it's really easy to pick up.

On the OO front, yeah, sorry, Java's type inheritance only goes down and sideways.  It is, to your point, faithful to its credo of giving people features that they will use well, so you get to interface stuff (sideways) and subclass stuff (down), but you don't get to do the inverse (going up, or having to opt-out of features).  Your second example does look very much like Rust or Haskell, for sure, and maybe that is why it made something in my brain itch a little bit.  It feels like something I dislike about Rust, which is its inherent elitism.

Oh boy, here I go.  Seeing myself out now before I go on a tangent.  You're not an elitist, Zekka, don't worry.  I just have a lot of feelings.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Zekka on July 22, 2016, 07:56:33 pm
Minor note on verbosity thing -- I think you could cut Java verbosity a lot just by shortening keywords, implicitly making things private, making inner class syntax much shorter, and providing literals for lists and maps.

I guess what I'm arguing about with Java is something similar to what I usually argue to Haskell programmers. Haskell has a very idealized worldview where your code only asks for as much power as it needs -- as a result, you have multiple lifts that give your code varying amounts of power. In roughly ascending order of power (although there's no strict ordering). These are the functions in the standard library that represent various ways to ask for "pretty please, give me {mutation support | access to the outside world | coroutines | error handling | suboxone}":

(<$>) :: (a -> b) -> (f a -> f b)
(<*>) :: f (a -> b) -> (f a -> f b)
(=<<) :: (a -> f b) -> (f a -> f b)
lift :: f a -> (g f) a
-- this one doesn't fit the mold of the others but I'm throwing in because it breaks EVERYTHING
runST :: (forall s. ST s a) -> a

These all correspond to the same *meaning*, which is something roughly like:
liftPlease :: some kind of a -> some other kind of a

Since Haskell has this worldview where you only want to use the one that has exactly as much power as you need, you have to remember four or five ways to write the same thing. (I was kind enough to spare you the Traversable and Foldable operations, which give you three or four more ways to write it.) You can kinda solve the problem in Haskell by writing everything as an (a -> (g f) b): then you only care about (=<<) and never have to use any of the other operations. But that's opting out of Haskell's worldview.

I think Java-style OOP starts with very weak primitives which often are not that powerful by themselves, and you're kinda right -- if you want to force Java to give you additional powers, you have to get a little crude and ugly, because when you do that you're opting out of Java's world-view. I think Java's builtins have the same appeal as Haskell primitives -- writing Java the way I learned to write it is kind of like bootstrapping your favorite language's data model in C, except you get a garbage collector too. You can get exactly the powers you want and no extra ones. Your abstractions are pretty close to the machine and there's no magic going on under the covers -- in exchange, all you get are vtables and your base inheritance feature is kinda weaksauce, but guaranteed non-evil.

If you don't want bootstrapping to be part of your problem, though, Java's inheritance primitives are weak and punish you for writing all the code that means the same thing the same way. (it's probably not just the inheritance primitives -- I think a lot of design patterns are reactions to similar problems that happen if you use Java naively) Its builtins are not that flexible, because its worldview is that its builtin inheritance is all you need. Sometimes you really need the trait-like formulation, and other times you can totally get away without it. I found Java really frustrating until I got used to thinking about it like that, and then I only found it mildly frustrating.

My alternative probably would have been to write all my code in a language whose default data model looks like one of the ones I bootstrap, like Prolog or Haskell. But I actually did used to write almost everything in Prolog and Haskell and I don't think they're as suitable for the general case as your generic typed imperative language. (I felt like Haskell made a lot of my problems harder, not easier, even after I was very comfortable with how it was meant to work.)
Title: Thread.setTitle("Programmers Anonymous");
Post by: Zekka on July 22, 2016, 08:06:14 pm
I think I made things confusing. Quick attempted summary:

Basic Haskell worldview: you need to ask for more power if you want to get access to resources. There are a lot of fiddly, specific ways to do this. The built-in model is probably inadequate. This is weird and hacky, and you need to remember lots of different ways to do it.

Basic Java worldview: our builtin tools are good enough. There are not tools to ask Java to do a lot of things you likely want to ask it to do. There are fiddly, specific ways to do it anyway. This gets weird and hacky, and you need to remember lots of different ways to do it.

Conclusion: in the domain of access to resources Haskell is intentionally annoying for dogma reasons. IIn the domain of data modeling, Java is accidentally annoying for lack-of-foresight reasons. Java's builtin annoying tools are operationally easy to explain. (pretty fundamental to how the computer works) Haskell's builtin annoying tools are operationally hard to explain. (a significant layer above how the machine works) Opting out in Java means being more explicit about what your code does, making your code superficially more complex. Opting out in Haskell means being less explicit about what your code does, making it superficially simpler.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Gyro on July 22, 2016, 08:18:59 pm
If we start talking about Rust in here I'm going to start having a lot of opinions about Rust so I'm going to resist the urge to do that.  (I worked on it as a paid contributor for a brief internship.)
Nifty Nif, July 22, 2016, 05:26:06 pm
I actually want to know the Rust opinions. I'm using it and working around the borrow checker is kind-of a bitch, especially when you need to work with explicit lifetimes, but I enjoy a lot about the language so far  - pretty great support for metaprogramming, the lightweight and non-restrictive nature of traits, binary literals, operator overloading exists, and, as a bonus, I like the syntax.

Here's a personal thing: I'm sick of Java haters.  Call me bias [sic], but it's an immensely powerful language that has given rise to some incredible design patterns, and if you don't like reflection you can fuck right off.  I like reflection a lot.  Sure, it's dangerous in the wrong hands, but I can unit test literally any codebase I want with the right libraries.  Haters gonna hate, I'll just be over here with my 100% test coverage and then we'll see who thinks what of Java.
Nifty Nif, July 22, 2016, 05:26:06 pm
I agree with you a lot, actually. Java is a pretty good language - especially modern Java, with annotations and typechecked generics.
Title: Thread.setTitle("Programmers Anonymous");
Post by: A Whirring Bone-White Gleech on July 23, 2016, 02:21:12 pm
I'm one of the people who really, completely detests Java (and, for context, loves python and C#).  I agree that C++ was sort of a mess, but Java removed way too much of it, and left us with an under-expressive, awkward language.  I think the rich panoply of design patterns in Java is sort of an indictment of the language, because I kind of feel like a common design pattern is a thing that your language probably should have automated (and probably should automate in its next release).

Python has a lot of the features that Java won't give me because I might abuse them (like multiple inheritance and operator-overloads).  And python's duck-typing frees me from ever having to specify an interface.  And that makes me more productive, and the sky hasn't come crashing to the earth.  (Then again, I am coding in an academic context, so...)

C# has added (and added back) a lot of the features that Java lacks, and is a vastly better language for it.  C#'s support for delegates and events removes the need for several annoying Java design patterns, and I think that C# Properties are just the greatest fucking things.  (Properties are a feature that I really wish Python would import.)

I really regret all the inane politics around Mono; I'd work in C# so much more if I could. :(

ETA: I feel like I'm coming off as a real bitch in this thread :(

ETA2: I'd also be really interested in hearing opinions about Rust.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Gyro on July 23, 2016, 02:54:36 pm
Python has a lot of the features that Java won't give me because I might abuse them (like multiple inheritance and operator-overloads).  And python's duck-typing frees me from ever having to specify an interface.  And that makes me more productive, and the sky hasn't come crashing to the earth.  (Then again, I am coding in an academic context, so...)

C# has added (and added back) a lot of the features that Java lacks, and is a vastly better language for it.  C#'s support for delegates and events removes the need for several annoying Java design patterns, and I think that C# Properties are just the greatest fucking things.  (Properties are a feature that I really wish Python would import.)

I really regret all the inane politics around Mono; I'd work in C# so much more if I could. :(
Der Trommelngleech, July 23, 2016, 02:21:12 pm

I agree with you about C# and Python - they're fucking fantastic, both of them, and I'd choose them over Java on most days. It's just that I don't think Java's problems sink it or make it infuriating. Don't try to multithread anything in Java, though, holy shit (Don't do that in Python either, the GIL won't let you).

I don't know, I guess I just like all of the languages that aren't PHP or Visual Basic.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Nifty Nif on July 23, 2016, 03:36:29 pm
If we start talking about Rust in here I'm going to start having a lot of opinions about Rust so I'm going to resist the urge to do that.  (I worked on it as a paid contributor for a brief internship.)
Nifty Nif, July 22, 2016, 05:26:06 pm
I actually want to know the Rust opinions. I'm using it and working around the borrow checker is kind-of a bitch, especially when you need to work with explicit lifetimes, but I enjoy a lot about the language so far  - pretty great support for metaprogramming, the lightweight and non-restrictive nature of traits, binary literals, operator overloading exists, and, as a bonus, I like the syntax.

Here's a personal thing: I'm sick of Java haters.  Call me bias [sic], but it's an immensely powerful language that has given rise to some incredible design patterns, and if you don't like reflection you can fuck right off.  I like reflection a lot.  Sure, it's dangerous in the wrong hands, but I can unit test literally any codebase I want with the right libraries.  Haters gonna hate, I'll just be over here with my 100% test coverage and then we'll see who thinks what of Java.
Nifty Nif, July 22, 2016, 05:26:06 pm
I agree with you a lot, actually. Java is a pretty good language - especially modern Java, with annotations and typechecked generics.
Gyro, July 22, 2016, 08:18:59 pm

Annotations and typechecked generics are the bomb!  I think part of my affinity for Java comes from the fact that I have little experience with pre-Java 7 versions.  I love using Java 8 and I enjoy its support for functional paradigms.  It's becoming a more expansive language.  Generics are extremely useful also, and I know some critics think that they're overly powerful or not in step with Java's philosophy.  I disagree, as they're pretty fundamental to OO, IMHO.  I agree with @Zekka that you could implicitly make things private, though, that'd be nice.  Package-private is a bullshit designation that people don't really use that often.


Okay, Rust stuff.  I worked on Rust for a little while, and the feeling that I got while poring over loads of documentation and wrestling with the compiler for hours and hours was that the core design team had written a language with some incredibly robust features but didn't give a single fuck if it was unusable to everyone.

Sure, the documentation is arguably lengthy.  And yeah, maybe someone will give you the advice not to program in Rust if you don't understand the ins and outs of execution state, reference passing, etc.  As a developer who is fortunate enough to know a bit about a few impractical things, I think this is bullshit.  The situation as it stands is that Rust is a language with an insurmountably steep learning curve.  It only has real utility for kernel hackers, and it really does have great use for them (userspace concurrency, memory management with unsafe keywords, etc).  However, Mozilla is trying to pitch Rust as a C-killer, and Rust is too hard to use for that to ever be possible at this point in time.  They're trying to shoehorn Rust into Servo, their browser engine.  There was another engineer working on Servo at the same time as I was working on Rust, and I think she was using Rust to accomplish her task.  She had a lot of the same problems I did, as far as I could tell--the compiler doesn't cooperate as soon as you decide to pass a variable to another function, so you've got to decide whether to pass by value or reference, and god help you if you choose the wrong one.  The way around this is to use Rust's paradigms, but these are obscure and highly functional in nature and often inaccessible to the average developer. 

I did manage to write a gorgeous B-tree library (the task for my internship), but sadly, my laptop crashed on the last day of my internship and all of my work was lost right before I could commit, so all that's in the repo is the piss-poor OO one I tried to write, which never worked.  The only reason I was able to write a working implementation at all was because I was invited out to meet the core team at their research summit, and I had one of the head engineers write it with me.  Once it finally clicked, it was like magic.  I couldn't replicate it now--this was almost 3 years ago, and like I said, the work has been scattered to bits.  Good thing the feature I wrote was non-essential and will never exist anywhere for anyone.  Someone else has probably written it by now, or tried and failed again.

So the way to write Rust is to pretend you're writing Scala or Haskell or something, never an OO language, and just be as minimal as possible.  Once the borrow-checker starts arguing with you, throw your computer out the window or just write some nice Python instead.  Or maybe do something nice for yourself, like play video games or hang out with your friends.  Anything but program in Rust.  It's not a C-killer and it's not revolutionary.  It's just syntactic salt and syntactic sugar in the same jar.
Title: Thread.setTitle("Programmers Anonymous");
Post by: A Whirring Bone-White Gleech on July 23, 2016, 04:39:12 pm
Python has a lot of the features that Java won't give me because I might abuse them (like multiple inheritance and operator-overloads).  And python's duck-typing frees me from ever having to specify an interface.  And that makes me more productive, and the sky hasn't come crashing to the earth.  (Then again, I am coding in an academic context, so...)

C# has added (and added back) a lot of the features that Java lacks, and is a vastly better language for it.  C#'s support for delegates and events removes the need for several annoying Java design patterns, and I think that C# Properties are just the greatest fucking things.  (Properties are a feature that I really wish Python would import.)

I really regret all the inane politics around Mono; I'd work in C# so much more if I could. :(
Der Trommelngleech, July 23, 2016, 02:21:12 pm

I agree with you about C# and Python - they're fucking fantastic, both of them, and I'd choose them over Java on most days. It's just that I don't think Java's problems sink it or make it infuriating. Don't try to multithread anything in Java, though, holy shit (Don't do that in Python either, the GIL won't let you).

I don't know, I guess I just like all of the languages that aren't PHP or Visual Basic.
Gyro, July 23, 2016, 02:54:36 pm

I'm of two minds.  On the one hand, maybe yeah, "terrible" is a bit too strong, and there are a lot of languages that are much, much worse; I can concede that Java is probably an improvement over C++ in a lot of ways.  On the other hand, I think C# is also just kind of strictly better than Java: the two languages are in substantially the same niche, and everything that's good about Java is good about C#, and a lot of the things that are bad about Java are not bad in C#.

The GIL is a weakness in python, but python threads are still useful sometimes.  Notably, the GIL is released when blocking I/O is happening, so that's a situation when python threads might still also be useful.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Gyro on July 27, 2016, 05:42:37 pm
Does anyone mind if I post projects / progress in this thread?

I've been working on a Minecraft clone in Rust. Just got the renderer to work last night.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Emperor Jack Chick on July 28, 2016, 01:03:34 am
today i had a huge revelation about javascript when i opened up a function, looked at it, and exclaimed "what in the fuck are these inputs?" since the thing took two parameters and ofcourse there were no goddamned comments about what those inputs were supposed to be

and all of a sudden i understood why C style languages have their parameters initialized.


i literally ended up just trying a bunch of combinations until i discovered it was string/string and then PROMPTLY added a comment about it.


disclaimer: i am very bad at coding

immediate edit after: also last week i wrote some code that asserted to do some shit when true == false and i thought my developers were going to have a hernia :D (i needed it to fail 100% of the time)
Title: Thread.setTitle("Programmers Anonymous");
Post by: Emperor Jack Chick on July 29, 2016, 12:35:22 pm
the way that gitignore is designed is the most pointlessly ass-backwards possible
Title: Thread.setTitle("Programmers Anonymous");
Post by: McShrimpsky on July 29, 2016, 12:57:28 pm
"what in the fuck are these inputs?"jack chick, July 28, 2016, 01:03:34 am
Yeah, I'm actually a fan of static typing (and Java in general) for this reason.  This (http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html) is the one thing that bugged me when I had to go back to Java from Python, though.  It sure is nice to be able to declare functions that aren't wrapped in an arbitrary class, and static functions seem like a whole other can of worms that are generally frowned upon.

As for Javascript, I watched this talk (https://www.youtube.com/watch?v=hQVTIJBZook) about "The Good Parts" a while back.  It was pretty cool, but it made me realize that if you kept all The Good Parts of Javascript, while fixing all The Bad Parts of Javascript, the resulting language would literally be Python.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Zekka on July 29, 2016, 01:22:24 pm
FWIW, there are a lot of languages that have static typing and not classes. "Languages like Java" vs "Languages like Python" is kind of a false choice.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Zekka on July 29, 2016, 02:47:46 pm
This program is designed to be used by hundreds of thousands of people.

Obviously, in addition to using two other implementations of json that actually comply with the spec, we wrote our own, Featuring logic such as:

Interestingly enough, this application (which is open-source) deals with user input.
Title: Thread.setTitle("Programmers Anonymous");
Post by: McShrimpsky on July 29, 2016, 03:33:54 pm
Woof.  That's always fun.  Someone on the team we're working with decided that our functional tests should run in Javascript, and that everything should use promises, even though all the tests are run sequentially and none of them do any asynchronous stuff.  At some point in the distant future we may want to run test suites in parallel or something, but for now we're writing asynchronous code that runs sequentially and it's totally unnecessary and annoying.

FWIW, there are a lot of languages that have static typing and not classes. "Languages like Java" vs "Languages like Python" is kind of a false choice.
Zekka, July 29, 2016, 01:22:24 pm
I didn't mean to imply that it was a choice between the two, and those things were the deciding factors.  Java and Python are just the two languages I've used the most (with Clojure a distant third... anyone else here do much in Lisp?), and there are things I like and dislike about each.  I'm not even sure if I prefer static typing over dynamic typing, it's just reassuring to have the compiler enforce that kind of stuff for you sometimes.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Emperor Jack Chick on July 29, 2016, 05:29:48 pm
Woof.  That's always fun.  Someone on the team we're working with decided that our functional tests should run in Javascript, and that everything should use promises, even though all the tests are run sequentially and none of them do any asynchronous stuff.  At some point in the distant future we may want to run test suites in parallel or something, but for now we're writing asynchronous code that runs sequentially and it's totally unnecessary and annoying.
McShrimpsky, July 29, 2016, 03:33:54 pm

that is literally what i do all day
Title: Thread.setTitle("Programmers Anonymous");
Post by: A Whirring Bone-White Gleech on August 04, 2016, 09:19:37 pm
So the way to write Rust is to pretend you're writing Scala or Haskell or something, never an OO language, and just be as minimal as possible.  Once the borrow-checker starts arguing with you, throw your computer out the window or just write some nice Python instead.  Or maybe do something nice for yourself, like play video games or hang out with your friends.  Anything but program in Rust.  It's not a C-killer and it's not revolutionary.  It's just syntactic salt and syntactic sugar in the same jar.
Nifty Nif, July 23, 2016, 03:36:29 pm

Me trying to sound smrt: that reminds me a lot of my experiences with Ada.  It's an efficient, low-level compiled language, that's much safer (and syntactically a lot clearer) than C.  And it's got some really neat stuff in it.  But it's also trying to be a lot safer than C, with minimal run-time overhead, and they did it with a compile-time type system that is a bloody horror to deal with.  The system is so inflexible that people are more likely to circumvent it rather than use it as intended, which renders the resulting Ada code vulnerable to all the same problems the equivalent C code would have been, which in turn makes the whole exercise sort of meaningless.
Title: Thread.setTitle("Programmers Anonymous");
Post by: A Whirring Bone-White Gleech on September 05, 2016, 06:40:17 pm
C++ is a language where it is difficult to write a function that returns an array of arrays of integers, if you don't know how big each array is going to be or how many there are at compile time.

I have settled on std::vector< std::vector<int> > which will work but I feel like is kind of absurd.

Fuck this language.

edit: having to push_back onto the vectors got to be more irritating than it was worth, now I have no idea what I'm going to do.
edit 2: std:array and boost:array both take their length as a template parameter which super helpfully means that their length must be a compile-time constant.  This prevent me from using them right now, in a situation where their size is an argument - an argument that could be a constant over the course of the function, but just marking it const doesn't make it constant enough.  WHICH FROM WHERE I SIT SEEMS TO DEFEAT THE WHOLE FUCKING POINT.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Emperor Jack Chick on September 05, 2016, 11:16:36 pm
so the other day i'm happily running my automation when it starts breaking, even though the test was working just a few minutes ago. Dig down a little bit and my SUPER GOOD code is breaking between the hour of 5-6pm because reasons. Now part of the handler for this code was in a ternary statement, and so I figured I'd just slap an OR in there and add another ternary. It looked kinda like this ((d.getHours == 0 ? d.getHours + 12 : d.getHours) || (d.getHours < 12 ? d.getHours -12 : d.getHours)).  So I sent that to one of my developers who is a quiet, sarcastic kid, and he just sends back "OMG WHAT THE FUCK IS THAT". So I go up and start explaining to him why my code is breaking between 5-6pm, and he's cracking up. He opens up the date handler for the actual platform I'm writing automated tests against and it was written with about 3 more layers of abstraction than necessary in order to do the modifications I need to support. We then discover that there are several functions in the date handler that do not have any references to them at all.

About this time another of our devs walks in and announces, "Hey guys! Guess what I'm doing! I'm hardcoding a bunch of static user roles into our dynamic roles service so that they will statically be able to handle dynamic roles!"

Professional software development in a nutshell.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Runic on September 05, 2016, 11:29:41 pm
What a magical industry I am heading towards!
Title: Thread.setTitle("Programmers Anonymous");
Post by: Gyro on September 06, 2016, 08:13:06 am
C++ is a language where it is difficult to write a function that returns an array of arrays of integers, if you don't know how big each array is going to be or how many there are at compile time.

I have settled on std::vector< std::vector<int> > which will work but I feel like is kind of absurd.

Fuck this language.

edit: having to push_back onto the vectors got to be more irritating than it was worth, now I have no idea what I'm going to do.
edit 2: std:array and boost:array both take their length as a template parameter which super helpfully means that their length must be a compile-time constant.  This prevent me from using them right now, in a situation where their size is an argument - an argument that could be a constant over the course of the function, but just marking it const doesn't make it constant enough.  WHICH FROM WHERE I SIT SEEMS TO DEFEAT THE WHOLE FUCKING POINT.
Der Trommelngleech, September 05, 2016, 06:40:17 pm

std::vector<thing> is the real array type in C++. It's kind of fucked, but at least it has a variable defining its length at run-time. I'd recommend going with that. I believe there's a .set(index, value) (or .set(value, index), I forget the signature) method on vectors, they can be treated as arrays. Better than calling push_back() all over the place. I think they have iterators too? I'll check when I get home.

But, yeah, it's a fucking mess. 
Title: Thread.setTitle("Programmers Anonymous");
Post by: duz on September 08, 2016, 10:55:14 am
so the other day i'm happily running my automation when it starts breaking, even though the test was working just a few minutes ago. Dig down a little bit and my SUPER GOOD code is breaking between the hour of 5-6pm because reasons. Now part of the handler for this code was in a ternary statement, and so I figured I'd just slap an OR in there and add another ternary. It looked kinda like this ((d.getHours == 0 ? d.getHours + 12 : d.getHours) || (d.getHours < 12 ? d.getHours -12 : d.getHours)).  So I sent that to one of my developers who is a quiet, sarcastic kid, and he just sends back "OMG WHAT THE FUCK IS THAT". So I go up and start explaining to him why my code is breaking between 5-6pm, and he's cracking up. He opens up the date handler for the actual platform I'm writing automated tests against and it was written with about 3 more layers of abstraction than necessary in order to do the modifications I need to support. We then discover that there are several functions in the date handler that do not have any references to them at all.

About this time another of our devs walks in and announces, "Hey guys! Guess what I'm doing! I'm hardcoding a bunch of static user roles into our dynamic roles service so that they will statically be able to handle dynamic roles!"

Professional software development in a nutshell.
jack chick, September 05, 2016, 11:16:36 pm

Yep, that sounds about right.

Title: Thread.setTitle("Programmers Anonymous");
Post by: Gyro on September 25, 2016, 05:59:21 pm
About this time another of our devs walks in and announces, "Hey guys! Guess what I'm doing! I'm hardcoding a bunch of static user roles into our dynamic roles service so that they will statically be able to handle dynamic roles!"
jack chick, September 05, 2016, 11:16:36 pm

What the fuck does that even MEAN?

It sounds like it's a static table of a few common roles for optimization's sake and then the rest of them would be handled dynamically, but it also sounds far stupider than that, so I don't know.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Captain Capacitor on November 01, 2016, 02:00:15 am
Hello thread. I have a confession.

I work for Microsoft. I don't write Microsoft code. Ask me things I might answer. I am also mostly made of alcohol at the moment.
Title: Thread.setTitle("Programmers Anonymous");
Post by: A Whirring Bone-White Gleech on February 24, 2017, 02:58:27 am
Lists are the “bread and butter” of Haskell collections. In an imperative language, we might perform a task many items by iterating through a loop. This is something that we often do in Haskell by traversing a list, either by recursing or using a function that recurses for us. Lists are the easiest stepping stone into the idea that we can use data to structure our program and its control flow. We'll be spending a lot more time discussing lists in Chapter 4, Functional programming.
Real-World Haskell: The Title is a Lie

Oh god, is that their trying-way-too-hard-to-be-positive way of saying "we're way to pure-functional to support something as vulgar as a for-loop"?  Am I going to have to write a recursive function every time I want to iterate over a list?

Jesus Christ, I thought people learned not to do this shit when the only real-world project to use Common Lisp was EMACS.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Zekka on February 24, 2017, 12:19:38 pm
Haskell has monster cockogues for foreach (through map, foldr, and forM_) and for while. (through unfold and iterate) They're not that bad in practical use.

You possibly won't like these constructs, but they're what Haskell has.
Title: Thread.setTitle("Programmers Anonymous");
Post by: junior associate faguar on February 24, 2017, 03:21:53 pm
Lists are the “bread and butter” of Haskell collections. In an imperative language, we might perform a task many items by iterating through a loop. This is something that we often do in Haskell by traversing a list, either by recursing or using a function that recurses for us. Lists are the easiest stepping stone into the idea that we can use data to structure our program and its control flow. We'll be spending a lot more time discussing lists in Chapter 4, Functional programming.
Real-World Haskell: The Title is a Lie

Oh god, is that their trying-way-too-hard-to-be-positive way of saying "we're way to pure-functional to support something as vulgar as a for-loop"?  Am I going to have to write a recursive function every time I want to iterate over a list?

Jesus Christ, I thought people learned not to do this shit when the only real-world project to use Common Lisp was EMACS.
Der Trommelngleech, February 24, 2017, 02:58:27 am

Real World Haskell is quite outdated and pretty awful in general. Haskell Programming from First Principals (http://haskellbook.com/) is much better.
Title: Thread.setTitle("Programmers Anonymous");
Post by: A Whirring Bone-White Gleech on February 24, 2017, 07:57:27 pm
Haskell has monster cockogues for foreach (through map, foldr, and forM_) and for while. (through unfold and iterate) They're not that bad in practical use.

You possibly won't like these constructs, but they're what Haskell has.
Zekka, February 24, 2017, 12:19:38 pm

I kind of remember these things from Common Lisp.  Python3, my one true love, also has, for example, map, filter and apply.  They weren't really good substitutes for just having a for loop.  They weren't really the best solution for the problem they were trying to solve, either: they've been more-or-less deprecated by list comprehensions (and generators), which do the same thing far more cleanly (IMO).

For the casual reader, this is a Python list comprehension:
roots = [ math.sqrt(x) for x in numbers ]

I get what map does and I still think that saying "you don't need a for-loop because we have map" is pretty dumb, is what I'm trying to say.


Real World Haskell is quite outdated and pretty awful in general. Haskell Programming from First Principals (http://haskellbook.com/) is much better.
journeyman faguar, February 24, 2017, 03:21:53 pm

Thanks very much for the tip!  I'm all for doing things the most current/refined way first.  =)
Title: Thread.setTitle("Programmers Anonymous");
Post by: Zekka on February 24, 2017, 09:46:58 pm
Oh yeah, I get that. (By the way, Haskell has list comprehensions and they work much like Python list comprehensions.)

You can implement a letter-of-the-law for loop that has an initial value, an update, and a condition to check each iteration, and it looks something like this

for :: Monad m => a -> (a -> Bool) -> (a -> a) -> (a -> m ()) -> m ()
for value condition update body
  | condition value = body value >> for (update value) condition update body
  | otherwise = return ()

main = for 0 (< 10) (+ 1) $ \i ->
  print i

It's not actually that useful in practice because usually people who want an actual for loop want the ability for that for loop to be able to assign variables defined outside the for loop, stuff like that, and because Haskell's type system is incredibly opinionated, you basically can't do that and get it right. (there is a tool called ST designed to help you do that sort of thing, but my opinion is that it sucks)

I hope I didn't mislead you! I was really just trying to say you don't have to use explicit recursion all the time. You really can't get normal for loops without sacrificing the type system and probably also the default laziness. If you really can't survive without for loops that can affect variables in the outer code, you will not like Haskell. (which is an OK stance to have)
Title: Thread.setTitle("Programmers Anonymous");
Post by: Ambious on February 25, 2017, 03:02:57 am
I really need to get into Lambda expressions.
They seem useful and I have no idea how to use them.
Title: Thread.setTitle("Programmers Anonymous");
Post by: A Whirring Bone-White Gleech on February 25, 2017, 05:56:58 am
I hope I didn't mislead you! I was really just trying to say you don't have to use explicit recursion all the time. You really can't get normal for loops without sacrificing the type system and probably also the default laziness. If you really can't survive without for loops that can affect variables in the outer code, you will not like Haskell. (which is an OK stance to have)
Zekka, February 24, 2017, 09:46:58 pm

No worries.  I'm just whining; I used common lisp a little for a class forever ago, and I'm starting to get the very strong impression that Haskell is going to be painful to use in all the ways that Common Lisp was painful to use.  It's interesting in a lot of ways, but I suspect it's also going to be an intensely frustrating experience to try to write a non-trivial program in a language that discourages me from mutating state.  I don't like it, and I wouldn't do it if wasn't required too.  This is not going to be a fun project. :(

On a happier note, I have learned two nifty things about Python.  I said a while ago that I wished Python had C#-like properties; I just learned that it actually does (https://docs.python.org/3/library/functions.html#property), and it has since forever, I just didn't know it.  I'm very happy about this!

Also, python 3.4 added Enums (https://docs.python.org/3/library/enum.html), which I have sorely missed.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Zekka on February 25, 2017, 12:31:13 pm
I hope I didn't mislead you! I was really just trying to say you don't have to use explicit recursion all the time. You really can't get normal for loops without sacrificing the type system and probably also the default laziness. If you really can't survive without for loops that can affect variables in the outer code, you will not like Haskell. (which is an OK stance to have)
Zekka, February 24, 2017, 09:46:58 pm

No worries.  I'm just whining; I used common lisp a little for a class forever ago, and I'm starting to get the very strong impression that Haskell is going to be painful to use in all the ways that Common Lisp was painful to use.  It's interesting in a lot of ways, but I suspect it's also going to be an intensely frustrating experience to try to write a non-trivial program in a language that discourages me from mutating state.  I don't like it, and I wouldn't do it if wasn't required too.  This is not going to be a fun project. :(
Der Trommelngleech, February 25, 2017, 05:56:58 am

Haskell is more ideological than Common Lisp. It has some tools builtin to make easy cases of mutable state doable, but with hard cases of mutable state those tools may not help very much. Those tools all intimately involve the type system.

Once you understand monads, check out IORefs and State, which are both designed to help with that problem. (IORefs will be more familiar to you, but they are less popular for general use.) You can also try STRefs, but like I said, I think ST takes a strong stomach.

Easy cases of mutable state: you only need to track changes in one mutable value. That value may be a record (in which case State simulates a scope with mutable vars), or it may not be: it's up to you.

Hard cases of mutable state: different procedures need to track changes in different variables.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Emperor Jack Chick on March 01, 2017, 11:22:36 am
HOW TO INCREASE MY SKILLS?????!!!!??!?!?!?!?!?!

had my yearly review yesterday. boss is stoked that i've been spending most of my downtime refactoring and building out our automation test codebase, both on a test level and in an application framework manner. He wants to see me increase my skills in this arena, but i'm not sure what the best path forwards is for that. Framework is written in Protractor running angular JS (using the chai-as-promised assertion library).

My options as i see it are the following:

Thoughts?
Title: Thread.setTitle("Programmers Anonymous");
Post by: A Whirring Bone-White Gleech on March 04, 2017, 06:00:51 am
Help out my coworker who is building the our ipad automation framework (requiring me to learn ruby)
jack chick, March 01, 2017, 11:22:36 am
This sounds like a thing that every employer on the planet would really like.  Ruby is also a widely-used language and learning it would not be bad.

Spend time learning more core computing concepts. data structures, application management, stuff like that
jack chick, March 01, 2017, 11:22:36 am
A solid grasp of best practices, common object-oriented techniques and design patterns never goes amiss.  But you've probably already taught yourself some of that.
Title: Thread.setTitle("Programmers Anonymous");
Post by: A Whirring Bone-White Gleech on March 31, 2017, 04:59:30 am
Jesus Christ, fuck fuck monads and fuck haskell.  This language is awful.

Edit: I don't want to keep making rage-posts, so I'm just going to edit this one every time I encounter something new.
This snippet works:
import Numeric.LinearAlgebra

main = do
    let m = (3><3) ([1..] :: [Double])
    let d = 0.5 :: Double
    let m' = 0.1 * m
    putStrLn (show m')
...but, this one won't compile:
import Numeric.LinearAlgebra

main = do
    let m = (3><3) ([1..] :: [Double])
    let d = 0.5 :: Double
    let m' = (0.1 / d) * m
    putStrLn (show m')

I repeat, fuck this god-awful, useless language.

like 5 minutes later, I've narrowed it down a little:
    let m' = (0.5          ) * (m :: Matrix Double) -- works
    let m' = (0.5 :: Double) * (m :: Matrix Double) -- doesn't
Why on earth that makes any difference, I have no clue.

I found out why it's that way, and it's incredibly stupid (http://stackoverflow.com/questions/39028176/why-does-fail-to-typecheck-when-i-place-a-double-matrix-on-the-left-and-a-do).  This is what ultimately works:
    let m' = cmap (*d) m


Edit 2: Space Leaks

A bunch of simple recurrent functions resulted in a joyous occasion in the process of learning Haskell: my very first "space leak"!  A "space leak" is the cutesy name for 'a tail-recursive function that doesn't get optimized into a loop, and keeps producing thunks for intermediate values until your system runs out of memory and dies'.  It's not exactly a memory leak, because the system hasn't lost the handle to that memory: in principle, if the computation finished, it would clean up all that memory and correctly terminate.  It just winds up at the same place: allocating an obscene amount of memory, possibly hanging your system.

The problem comes in part from one of the glorious selling-points of Haskell, it's lazyness; it turns out that that lazyness often sabotages building tail-recursive loop optimization.  The comical solution, which it's taken me more than a week to figure out, is: "use ! to mark every god damned thing in the function as strict", i.e. "not-lazy".  Doing that has changed my memory requirements from "reaching 12G and then hanging the system" to 50 Kb.  I guess I get to look forward to a glorious future of marking every production with ! in a desperate attempt to ask GHC to kindly not piss away all my system's memory.

Edit 3:

Speaking of: run time for a GRU: 55 minutes in Python, 129 minutes in Haskell.  I don't know why.

Edit 4:

Cabal.  On the down-side, Cabal took a lot of fighting to get working, and I kind of feel like I shouldn't have needed to set up Cabal and a local package repository just to enable profiling.  On the up-side, though, now that it's actually working, it is kind of cool, I have to admit.  `cabal repl` made getting a local-packages-aware interpreter pretty easy, I'm pretty grateful for that.
Title: Thread.setTitle("Programmers Anonymous");
Post by: EYE OF ZA on March 31, 2017, 05:29:41 am
That's my sister's opinion of Haskell, which she had to learn for a job because the start-up guys she was working for were dead-set on using Haskell with Yesod for their web application
Title: Thread.setTitle("Programmers Anonymous");
Post by: Dirk Dammit on April 12, 2017, 08:02:12 pm
I just finished a "fullstack developer course" in which I got a semi decent grasp on beginner front end development like css, javascript, and ruby, while backend development concepts such as mvc architecture still elude the hell out of me. I just had a phone interview yesterday with a company and they want me to, as closely as possible, replicate the appearance of a jpg image of a site, and it's got me kinda nervous.

As a side note I need to learn node.

edit: would you guys say this is bootstrap or a different framework?

http://i.imgur.com/YG7Z2z3.jpg (http://i.imgur.com/YG7Z2z3.jpg)
Title: Thread.setTitle("Programmers Anonymous");
Post by: lazzer grardaion? on July 10, 2017, 04:05:30 pm
So, since I'm probably going to be looking for jobs in the not-too-distant future, I thought that I would try learning more coding, since that's something I don't have nearly as much experience in as I would like, and which seems to be pretty important for jobs that people might want to hire physics PhDs for. I did take some C programming back at undergrad, but I thought that python would be a good place to start, as the syntax seems a lot more manageable than other languages.

As a mini practice project, I decided to make a simulation of the Ising Model (https://en.wikipedia.org/wiki/Ising_model), which is a system that follows some very basic mathematical rules, and is fun to watch. So, my python code is this:

# This program is designed to simulate the 2D Ising model using Monte-Carlo
# methods.

import random
import copy
import math
import numpy as np
import matplotlib.animation as animation
import matplotlib.pyplot as plt

# This sets the number of steps per frame update.
steps = 500

# This sets the temp of the system. There's a phase transition
# from stable to chaotic around 2.7
temperature = float(input('Temperature? \n'))

# n sets size of the grid
n = 50

# The grid is then randomly laid out with +1 and -1 squares.
g = [[2*random.randint(0,1)-1 for i in range(1,n+1)] for j in range(1,n+1)]
def isingupdate(data):
    global g
    for l in range(1, steps):
        newg = g.copy()
        t = 0

        # Random locations on the grid are then selected.
        # The energy of the selected location is computed , and it checks if
        # the system can lower its energy by flipping the square
        # from + to - or vice-versa
        i = random.randint(1, n - 2)
        j = random.randint(1, n - 2)
        energy = -(g[i][j])*(g[i+1][j]+g[i-1][j]+g[i][j+1]+g[i][j-1])
        if energy > 0:
            g[i][j] = -g[i][j]
           
        # If the flip isn't energetically favorable, there's still a random
        # chance for it to happen, based on the energy and temperature.
        else:
            k = random.random()
            if math.log(k) < 2*energy/temperature:
                g[i][j] = -g[i][j]

        # Time is incremented, and the grid is updated with new values.
        t += 1
        mat.set_data(newg)
        g = newg

    return [mat]

# The figure and axes are initialized, and then told to update based on the
# rules defined above.

fig, ax = plt.subplots()
mat = ax.matshow(g)
ani = animation.FuncAnimation(fig, isingupdate, interval = 1, blit = True)
plt.show()


And it works and all, but it's pretty slow, and can seemingly only handle a couple hundred updates per second. On the other hand this simulation (http://physics.weber.edu/schroeder/software/demos/IsingModel.html) can handle about 500000 updates per second. Like, is python just not the appropriate language to try and do this kind of thing?
Title: Thread.setTitle("Programmers Anonymous");
Post by: Turtle on July 10, 2017, 09:04:23 pm
I write neither python nor javascript, so I'm not familiar with performance pitfalls in either, but I'd be pretty shocked if there was a 1000x difference between python and javascript.

Have you tried identifying the bottlenecks in your code by benchmarking individual components? My first thought is your random calls - standard random libraries tend to be slower than you'd expect. I also wonder if the animation library you're using is as quick as what he's using - have you tried simulating it without drawing?

Edit: I guess as long as I'm talking performance: I recently completely rewrote our unit testing framework in C# instead of (old ass language) and cut execution time from 15 minutes to 2 minutes. I'm a little bit happy about that.
Title: Thread.setTitle("Programmers Anonymous");
Post by: A Whirring Bone-White Gleech on July 11, 2017, 06:56:07 am
So, since I'm probably going to be looking for jobs in the not-too-distant future, I thought that I would try learning more coding, since that's something I don't have nearly as much experience in as I would like, and which seems to be pretty important for jobs that people might want to hire physics PhDs for. I did take some C programming back at undergrad, but I thought that python would be a good place to start, as the syntax seems a lot more manageable than other languages.

As a mini practice project, I decided to make a simulation of the Ising Model (https://en.wikipedia.org/wiki/Ising_model), which is a system that follows some very basic mathematical rules, and is fun to watch. So, my python code is this:

# This program is designed to simulate the 2D Ising model using Monte-Carlo
# methods.

import random
import copy
import math
import numpy as np
import matplotlib.animation as animation
import matplotlib.pyplot as plt

# This sets the number of steps per frame update.
steps = 500

# This sets the temp of the system. There's a phase transition
# from stable to chaotic around 2.7
temperature = float(input('Temperature? \n'))

# n sets size of the grid
n = 50

# The grid is then randomly laid out with +1 and -1 squares.
g = [[2*random.randint(0,1)-1 for i in range(1,n+1)] for j in range(1,n+1)]
def isingupdate(data):
    global g
    for l in range(1, steps):
        newg = g.copy()
        t = 0

        # Random locations on the grid are then selected.
        # The energy of the selected location is computed , and it checks if
        # the system can lower its energy by flipping the square
        # from + to - or vice-versa
        i = random.randint(1, n - 2)
        j = random.randint(1, n - 2)
        energy = -(g[i][j])*(g[i+1][j]+g[i-1][j]+g[i][j+1]+g[i][j-1])
        if energy > 0:
            g[i][j] = -g[i][j]
           
        # If the flip isn't energetically favorable, there's still a random
        # chance for it to happen, based on the energy and temperature.
        else:
            k = random.random()
            if math.log(k) < 2*energy/temperature:
                g[i][j] = -g[i][j]

        # Time is incremented, and the grid is updated with new values.
        t += 1
        mat.set_data(newg)
        g = newg

    return [mat]

# The figure and axes are initialized, and then told to update based on the
# rules defined above.

fig, ax = plt.subplots()
mat = ax.matshow(g)
ani = animation.FuncAnimation(fig, isingupdate, interval = 1, blit = True)
plt.show()


And it works and all, but it's pretty slow, and can seemingly only handle a couple hundred updates per second. On the other hand this simulation (http://physics.weber.edu/schroeder/software/demos/IsingModel.html) can handle about 500000 updates per second. Like, is python just not the appropriate language to try and do this kind of thing?
LancashireMcGee, July 10, 2017, 04:05:30 pm

I *think* you're setting mat at the wrong place.  You're doing it inside your 500-steps-per-frame, so you're actually setting (and re-rendering?) that display every single update.  And that could be super slow.  I moved it outside the inner loop, and it looks like it's a lot faster.

So, this:

        # Time is incremented, and the grid is updated with new values.
        t += 1
        #mat.set_data(newg)
        g = newg

    mat.set_data(newg)

    return [mat]

Also, to answer your question, yes, python is really slow; I've heard it said that it's something like 100x slower that compiled code.  While python is used pretty heavily in science, it's almost always used with  numpy, and something like PyDSTool or Theano.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Emperor Jack Chick on July 11, 2017, 09:31:18 am
FOR PERFORMANCE I WRITE EVERYTHING IN ASSEMBLY


on a real note - maybe you wanna look into a linter. you're importing copy and numpy and never using either.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Zekka on July 11, 2017, 07:55:47 pm
g.copy is probably very slow. it doesn't look like you ever use t or take advantage of newg?

for posterity, here's a hyperoptimized C version that gets 30mil steps per second on my computer. i tried microoptimizing the assembly but it didn't really help. be sure to compile for 64-bit!

#include <math.h>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

#define STEPS (1000 * 1000 * 100)
#define N 50
#define TEMPERATURE 2.7

// keep random numbers small so we don't lose cache for logs
#define NEWRAND_MAX 0x100
#define NEWRAND_MASK 0xff
#define newrand_int(low, high) (rand() % ((high) - (low)) + (low))
#define newrand() rand() & NEWRAND_MASK

typedef int64_t t_cell;

t_cell data[N][N];
char logs[NEWRAND_MAX][9];

// #define: avoid making extra calls
#define step_ising() { \
  int i = newrand_int(1, N - 2); \
  int j = newrand_int(1, N - 2); \
  int energy = (-data[i][j]) * (data[i + 1][j] + data[i - 1][j] + data[i][j + 1] + data[i][j - 1]); \
  if (energy > 0 || logs[newrand() & NEWRAND_MASK][energy + 4]) { \
    data[i][j] = -data[i][j]; \
  } \
}

void init_ising() {
  for (int x = 0; x < N; x++) {
    for (int y = 0; y < N; y++) {
      data[x][y] = (t_cell) (newrand() & 1);
    }
  }

  // precompute logs
  for (int i = 0; i < NEWRAND_MAX; i++) {
    for (int energy = -4; energy <= 4; energy++) {
      logs[i][energy + 4] = log(i/(float)NEWRAND_MAX) < 2 * energy/TEMPERATURE;
    }
  }
}

void main() {
  init_ising();

  clock_t start = clock();
  for (int i = 0; i < STEPS; i++) { step_ising(); }
  clock_t end = clock();

  printf("%f steps per second", STEPS/((float)(end - start)/CLOCKS_PER_SEC));
}
Title: Thread.setTitle("Programmers Anonymous");
Post by: A Whirring Bone-White Gleech on July 13, 2017, 05:02:56 am
FOR PERFORMANCE I WRITE EVERYTHING IN ASSEMBLY


on a real note - maybe you wanna look into a linter. you're importing copy and numpy and never using either.
jack chick, July 11, 2017, 09:31:18 am

Honestly, I've never bothered with linters, although I mostly do academic programming, so.  FWIW, pylint (https://www.pylint.org/) exists, and VS Code will install it for you.  (VS Code (https://code.visualstudio.com/) is a super nice editor, btw.  It even works well on linux!)

Actually, kind of related to nothing but maybe useful, Spyder (https://pythonhosted.org/spyder/) is a really grate python IDE for scientific computing.  I find that both Spyder and VS Code make really great python IDEs, if you're looking for one.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Emperor Jack Chick on July 13, 2017, 09:43:16 am
FOR PERFORMANCE I WRITE EVERYTHING IN ASSEMBLY


on a real note - maybe you wanna look into a linter. you're importing copy and numpy and never using either.
jack chick, July 11, 2017, 09:31:18 am

Honestly, I've never bothered with linters, although I mostly do academic programming, so.  FWIW, pylint (https://www.pylint.org/) exists, and VS Code will install it for you.  (VS Code (https://code.visualstudio.com/) is a super nice editor, btw.  It even works well on linux!)

Actually, kind of related to nothing but maybe useful, Spyder (https://pythonhosted.org/spyder/) is a really grate python IDE for scientific computing.  I find that both Spyder and VS Code make really great python IDEs, if you're looking for one.
A Gleech that is a False Movie, July 13, 2017, 05:02:56 am


linters have been extremely useful in my professional life and have saved me a lot of time.

for python i use sublimeLint and Anaconda (cause i use sublime text fight me)
Title: Thread.setTitle("Programmers Anonymous");
Post by: Ambious on July 13, 2017, 11:35:23 am
Honestly, I've never bothered with linters, although I mostly do academic programming, so.  FWIW, pylint (https://www.pylint.org/) exists, and VS Code will install it for you.  (VS Code (https://code.visualstudio.com/) is a super nice editor, btw.  It even works well on linux!)

Actually, kind of related to nothing but maybe useful, Spyder (https://pythonhosted.org/spyder/) is a really grate python IDE for scientific computing.  I find that both Spyder and VS Code make really great python IDEs, if you're looking for one.
A Gleech that is a False Movie, July 13, 2017, 05:02:56 am

+1 for VSCode and pylint
Title: Thread.setTitle("Programmers Anonymous");
Post by: lazzer grardaion? on July 14, 2017, 04:31:29 pm
All this advice has been very helpful, though it does certainly make me wish I'd started learning this, like, five years ago. Anyways, I've been playing around with slightly more complicated versions of the thing I did, and it made a bunch of pretty pictures, so here you all go:

(http://i.imgur.com/F636yaM.png)

(http://i.imgur.com/kBSYF20.png)

(http://i.imgur.com/7pLNe21.png)
Title: Thread.setTitle("Programmers Anonymous");
Post by: A Whirring Bone-White Gleech on July 17, 2017, 09:58:01 pm
for python i use sublimeLint and Anaconda (cause i use sublime text fight me)
jack chick, July 13, 2017, 09:43:16 am

How do you like Anaconda?  I've been telling students to use WinPython, but it looks like Anaconda's packaging might be even better.

Same question for Sublime.  I've never used it, I usually use gvim or VS Code, like I said.  How do you like Sublime, think it's worth trying out?  (I wonder if I could convince the department to spring for a key...)

All this advice has been very helpful, though it does certainly make me wish I'd started learning this, like, five years ago. Anyways, I've been playing around with slightly more complicated versions of the thing I did, and it made a bunch of pretty pictures, so here you all go:

(http://i.imgur.com/F636yaM.png)

(http://i.imgur.com/kBSYF20.png)

(http://i.imgur.com/7pLNe21.png)
LancashireMcGee, July 14, 2017, 04:31:29 pm

Very nice!  Feel like sharing the code you used to generate those, if you'd like some further pointers? =D

It reminds me of my brother's first project.  He's a math PhD.  One of the things that made him pretty excited about programming - and python in particular - was when he built a fractal viewer from scratch.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Emperor Jack Chick on July 18, 2017, 12:05:15 pm
I mostly use anaconda for goto references regarding variable instantiation, which I'm happy with. I haven't dug into its more advanced features yet

I really like sublime for a lot of little things it does. I love that I can select multiple several different sections with a mouse and then insert/delete the same text simultaneously cutting down on problematic find/replace operations. Its search operates either with string matching or regex, which is a toggle so that you can tailor your find and replaces easily. Package control works beautifully and allows for rapid customization. I like its font scaling. its key commands make a lot more sense to me than other things (like notepad++ or pycharm).

I haven't used Atom and I"m certainly not a power user, just FYI.

Also you don't need a key, the only thing a sublime key does is stop an annoying popup from happening.
Title: Thread.setTitle("Programmers Anonymous");
Post by: lazzer grardaion? on July 18, 2017, 02:07:46 pm

Very nice!  Feel like sharing the code you used to generate those, if you'd like some further pointers? =D

It reminds me of my brother's first project.  He's a math PhD.  One of the things that made him pretty excited about programming - and python in particular - was when he built a fractal viewer from scratch.
A Gleech that is a False Movie, July 17, 2017, 09:58:01 pm

Sure thing. It's basically a version of the Ising model called the Potts Model (https://en.wikipedia.org/wiki/Potts_model), where instead of 'up' or 'down', there are n possible states that can be thought of as evenly-spaced points on a circle, and the energy between two neighbors is determined by the cosine of the difference in angle.

# This program simulates the n-state Vector Potts model using Monte-Carlo methods

import random
import math
import matplotlib.animation as animation
import matplotlib.pyplot as plt

# This sets the number of steps per frame update.
steps = 1000

# This sets the temp of the system.
temperature = float(input('Temperature? \n'))

# This sets the number of possible states or 'directions' a cell can have.

m = int(input('Number of states? \n'))

# n sets size of the grid
n = 150

def c(x):
    return math.cos(2*math.pi*x/m)

'''
The partition function determines the probabilities of a cell picking different
states after a step. This probability of ending up in a given state is
exp(-energy/temperature)/Z, where Z is the sum of exp(-energy/temperature) over
all possible states for the cell.

Since there is a finite number of possible energies for a given cell, these are
computed beforehand.
'''

partsgrid = [[[[[math.exp((c(a-b)+c(a-d)+c(a-e)+c(a-f))/temperature)
                  for a in range( 0 , m ) ] for b in range( 0 , m ) ] for d in range( 0 , m ) ]
                  for e in range( 0 , m ) ] for f in range( 0 , m ) ]
zlist = [[[[sum(partsgrid[f][e][d][b][a] for a in range( 0 , m ))
                  for b in range( 0 , m ) ] for d in range( 0 , m ) ] for e in range( 0 , m ) ]
                  for f in range( 0 , m ) ]

# The grid is randomly laid out with the m possible directions.
g = [[random.randint( 0 , m - 1 ) for i in range( 1 , n + 1 )] for j in range( 1 , n + 1 )]

def pottsupdate(data):
    global g
    for q in range(1, steps):

        # Random locations on the grid are then selected.
        i = random.randint(-1, n - 2)
        j = random.randint(-1, n - 2)

        '''
        Cells randomly choose a new state, with probabilities determined by the
        relative weights exp(-energy/temperature)/Z. This is done by making a
        list of the partial sums of these probabilities, and then counting how
        many of those partial sums are less than a randomly chosen number .
        '''

        partstemp = [partsgrid[g[i+1][j]][g[i-1][j]][g[i][j+1]][g[i][j-1]][s] for s in range(0,m)]
        energyspace = [sum(partstemp[p] for p in range(0,s)) / zlist[g[i][j-1]][g[i][j+1]][g[i-1][j]][g[i+1][j]] for s in range(1,m)]
        k = random.random()
        g[i][j] = len([a for a in energyspace if a < k])
    mat.set_data(g)
    return [mat]

# The figure and axes are initialized, and then told to update based on the
# rules defined above.

fig, ax = plt.subplots()
mat = ax.matshow(g)
ani = animation.FuncAnimation(fig, pottsupdate, interval = 1, blit = True)
plt.show()


Fractal viewer might be a fun next project. Waaaaay back in highschool I programmed a Mandelbrot set grapher on my TI-83. It worked great, but it took like 2 hours to run.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Ambious on July 29, 2017, 04:54:49 pm
Title: Thread.setTitle("Programmers Anonymous");
Post by: junior associate faguar on October 08, 2017, 11:07:08 pm
(https://pbs.twimg.com/media/DLeByTUVwAAecrX.jpg:large)
Title: Thread.setTitle("Programmers Anonymous");
Post by: Emperor Jack Chick on October 09, 2017, 10:35:07 am
(https://pbs.twimg.com/media/DLeByTUVwAAecrX.jpg:large)
journeyman faguar, October 08, 2017, 11:07:08 pm

legit buying that mug for my coworker.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Schumin Capote on October 11, 2017, 02:49:05 am
We have a rotating role where each sprint, we assign one developer as the "bug hunter." Unfortunately, the rest of the team doesn't seem to be aware of the true meaning of that phrase, so I do my best not to laugh whenever they mention it. Somehow, I don't think I'll be sending them a link to the "Raw Top Breeding Zone" episode of Lou Read's the Internet for You.
Title: Thread.setTitle("Programmers Anonymous");
Post by: lazzer grardaion? on October 11, 2017, 12:47:15 pm
We have a rotating role where each sprint, we assign one developer as the "bug hunter." Unfortunately, the rest of the team doesn't seem to be aware of the true meaning of that phrase, so I do my best not to laugh whenever they mention it. Somehow, I don't think I'll be sending them a link to the "Raw Top Breeding Zone" episode of Lou Read's the Internet for You.
Schumin Capote, October 11, 2017, 02:49:05 am

(https://i.imgur.com/0xsGWlcl.jpg)
(https://i.imgur.com/ip0WuI0l.jpg)

I can't help but feel that programmers are more likely to be familiar with sci-fi action classics than horrifying internet subcultures. Either that or I've been interpreting Aliens completely wrong all these years.
Title: Thread.setTitle("Programmers Anonymous");
Post by: A Whirring Bone-White Gleech on October 12, 2017, 06:13:41 pm
Why is java so goddamned over-engineered?  Why do five different classes have to interact to achieve absolutely anything?  Why do they provide four competing ways, each composed of 50 classes, to do absolutely everything?  Why is opening a file and writing to it a multi-step process?  WHO DESIGNED THIS NIGHTMARE?
Title: Thread.setTitle("Programmers Anonymous");
Post by: junior associate faguar on October 12, 2017, 06:24:20 pm
WHO DESIGNED THIS NIGHTMARE?
A Whirring, Bone-White Gleech, October 12, 2017, 06:13:41 pm

You've found the problem. No one designed it, many people designed it all at once, and whenever they disagreed they just made it more complicated to fix the problem.

See also: C++.
Title: Thread.setTitle("Programmers Anonymous");
Post by: A Whirring Bone-White Gleech on October 23, 2017, 04:39:33 pm
WHO DESIGNED THIS NIGHTMARE?
A Whirring, Bone-White Gleech, October 12, 2017, 06:13:41 pm

You've found the problem. No one designed it, many people designed it all at once, and whenever they disagreed they just made it more complicated to fix the problem.

See also: C++.
journeyman faguar, October 12, 2017, 06:24:20 pm

Consider the following:

def write(points, fname):
    with open(fname, "w") as outfile:
        for p in points:
            outfile.write("<{}, {}>\n".format(p.x, p.y))
Wow, that's concise, innit?  If you aren't familiar with python, the with-block will guarantee that my file gets closed when that block is exited, even if an exception is thrown, without me having to do anything.  Note also that open() just kicks up a file-like object with a nice, tractable write method.

Now let's see that in C++.
void write(const std::vector<Point> & points, const std::string & fname) {
    std::ofstream outfile(fname);

    for(auto p: points) {
        outfile << "<" << p.x << ", " << p.y << ">" << std::endl;
    }
}
OK, so, unsurprisingly, it's a little uglier.  Note the use of auto in that for-loop: type-declarations can get really ugly when you're using C++ templated containers, especially when it's a const-reference-to something.  Auto doesn't really make that not true, it just makes it not my problem, which is good enough.

It's not obvious, but this also guaranteeably closes my output file, even if an exception is thrown.  The reason why would take some explaining (http://en.cppreference.com/w/cpp/language/raii), but it's true.

Now let's look at this trivial things in Java.
    public static void write(Vector<Point> points, String fname) throws IOException {
        BufferedWriter outbuffer = null;
        try {
            FileWriter outfile = new FileWriter(fname);
            outbuffer = new BufferedWriter(outfile);
           
            for (Point p: points) {
                outbuffer.write("<" + p.x + ", " + p.y + ">\n");
            }
        } finally {
            if (outbuffer != null) {
                outbuffer.close();
            }
        }
    }

I have so many questions.  What are the responsibilities of those two classes, FileWriter and BufferedWriter?  Doesn't FileWriter already have a write() method?  Do I need the BufferedWriter?  Is it providing buffering for non-buffered output?  Why are those responsibilities split?  Why doesn't the FileWriter just buffer by default and provide a flush() method like any reasonable implementation would?  Why is this my problem as a user?

Why do I need a try/catch block if I marked the function as throwing?  Well, that's for the finally block, to make sure the file is closed.  But again, why the fuck is that even my problem?  Why doesn't Java have a with() block or similar construct?  Why does the close method itself throw an IOException?  What the fuck am I supposed to do if that happens?  Actually handling that exception would make my code way more complicated, so I just gave up and marked the function as throwing.  Why is the try block out-of-scope in the finally block?  That makes using it for its intended purpose more annoying, to no benefit.

Many of these complaints are small things, but they add up, and they add up more in non-trivial cases.

My answer to all these questions: the java developers are a) way, way too conservative, refusing to implement features (like with blocks) that are common-place in every other language in 2017, or b) they're way to enamored with the whole "a clean object model as the only metaphor for programming, period" ethos that sort of defined the early Java community, or c) they're lazy idiots and just don't give a fuck.  Or maybe some combination of all three.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Emperor Jack Chick on October 23, 2017, 07:05:58 pm
(https://pbs.twimg.com/media/DLeByTUVwAAecrX.jpg:large)
journeyman faguar, October 08, 2017, 11:07:08 pm

legit buying that mug for my coworker.
jack chick, October 09, 2017, 10:35:07 am

UPDATE: the mug has arrived.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Ambious on January 08, 2018, 05:54:42 pm
(https://cdn.discordapp.com/attachments/374783633187143689/399315711949799444/git.png)

True story.
I coded so much yesterday I forgot to eat. Took no breaks. Coded all day.
Then today I made an even bigger commit before lunch, then TOOK a lunch break, then chased a bug for four hours that ended up being a rogue dynamic cast, then coded some more.

tl;dr don't code on Ritalin if you don't have to, you'll starve.

Title: Thread.setTitle("Programmers Anonymous");
Post by: Turtle on January 11, 2018, 05:05:18 pm
I had a problem where I needed to parse through nearly a gigabyte of log files, each line of which represented an operation, and interpret that data.
This wasn't a task I was given as much as it was a task that I gave myself because I was curious about a mismatch in the data we were seeing from it. An idle curiosity that I wanted to throw an hour at.

In short, each of these log files represented a run of the program. An operation could fail or succeed. Successes would be present in the next log file and errors would be reattempted.
The problem was that I noticed that a very small number of these operations would show up in the log as an error, but never appear in the next log as a success. It would just disappear.
This occurred to an incredibly small number. We predicted 67 out of 2.3 million operations.

So the plan for this utility is: Iterate through each line of each file. When you find an error, hold onto it, then when you find a success, check to see if it matched any of the error lines. If it did, remove that error line. At the end, any errors remaining are our orphans.
I shit this together in 30 minutes, ran it, went off to lunch. After lunch, it wasn't finished, but whatever, it's a lot of data, this may take awhile. I'll just let it run in the background while I do other shit.

The next day, it was still executing. I inspected the process - it was definitely doing work, but at the rate it was going, it would take roughly 60 hours to interpret everything. Whatever, it's nearly the weekend, I'll just let it go.
Until late this afternoon - Processes started hanging. Explorer.exe stopped and refused to start up again. I could not start Task Manager. I could not ctrl+alt+del. This process was consuming every resource it could get its hands on. With great regret, I killed the machine, losing over a day of execution time.

I rewrote the code giving a shit about performance. Same idea, just a slightly different implementation. Only took 10 or so minutes, maybe 20 lines of code. Started it up, then went to inspect the process's Read/Write data. By the time I did, it was done.
Rewriting the program brought execution time down from 60 hours to 20 seconds.

PROGRAMMING
Title: Thread.setTitle("Programmers Anonymous");
Post by: Ambious on February 07, 2018, 04:57:48 am
(https://i.imgur.com/wYpUvtK.jpg)
Title: Thread.setTitle("Programmers Anonymous");
Post by: Ambious on March 04, 2018, 05:01:58 am
So last week I submitted my Web Programming project, and let me just say I fucking hate JavaScript.
We also had to use AngularJS which I guess is an improvement over native JavaScript, but holy fuck it's overly unnecessarily complex.
Also we were not allowed to use any other external library (except for Bootstrap and jQuery) so things were just being difficult for difficulty's sake.
I will say I kinda love the whole concept of Bootstrap - it sort of normalizes and unifies design concepts so you can make a site that doesn't look like something whipped up in 1995 and not have to go into the depths and antwork of CSS manually.
I mean I still had to do a lot of CSS overriding, but it beats writing it from scratch.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Emperor Jack Chick on March 04, 2018, 11:25:35 am
So last week I submitted my Web Programming project, and let me just say I fucking hate JavaScript.
We also had to use AngularJS which I guess is an improvement over native JavaScript, but holy fuck it's overly unnecessarily complex.
Also we were not allowed to use any other external library (except for Bootstrap and jQuery) so things were just being difficult for difficulty's sake.
I will say I kinda love the whole concept of Bootstrap - it sort of normalizes and unifies design concepts so you can make a site that doesn't look like something whipped up in 1995 and not have to go into the depths and antwork of CSS manually.
I mean I still had to do a lot of CSS overriding, but it beats writing it from scratch.
The Ambious, March 04, 2018, 05:01:58 am

.then(function(howDidItGo) {
    if (howDidItGo === false) {
        sorryDude();
    }
});

i work in angular every day. :(
Title: Thread.setTitle("Programmers Anonymous");
Post by: Ambious on March 05, 2018, 03:00:43 am
So last week I submitted my Web Programming project, and let me just say I fucking hate JavaScript.
We also had to use AngularJS which I guess is an improvement over native JavaScript, but holy fuck it's overly unnecessarily complex.
Also we were not allowed to use any other external library (except for Bootstrap and jQuery) so things were just being difficult for difficulty's sake.
I will say I kinda love the whole concept of Bootstrap - it sort of normalizes and unifies design concepts so you can make a site that doesn't look like something whipped up in 1995 and not have to go into the depths and antwork of CSS manually.
I mean I still had to do a lot of CSS overriding, but it beats writing it from scratch.
The Ambious, March 04, 2018, 05:01:58 am

.then(function(howDidItGo) {
    if (howDidItGo === false) {
        sorryDude();
    }
});

i work in angular every day. :(
jack chick, March 04, 2018, 11:25:35 am

Is it any less annoying and complicated when you don't have the limitations of "don't use anything 3rd party"?
I mean some of the directives and html tags are actually really useful, but the implementation is so cumbersome.

Anyway I don't know how it went yet, it'll probably be a week or two before we get a grade.
We got an email from the TA yesterday that one of the main features of the site (user registration) wasn't working because of an SQL error.
We tried it again and again and found nothing.
I did find a leftover method using a non-existing variable that simply caused the whole thing to not refresh when logging in, and fixed it, and also some weird CSS thing, which I also fixed, but couldn't reproduce the SQL error.
I sent him a "fix" (which was just the aforementioned  fixes which don't go anywhere near SQL) and suddenly he said it was ok.
I suspect he just didn't clean the Derby directory from the previous project he graded and it messed up with ours, so when I sent the "fix" he DID clean it that time and that's why it worked.

But that's the thing - I come from compiled languages where if you do something like use a non-existing variable it will immediately throw error messages at you and won't let you do anything.
JavaScript - in my experience - is just a crapshoot. You entire website might stop working because of a single missing mistake somewhere that might not even have anything to do with what stopped working, and good luck hunting it down.

Also can I just say Apache Derby is the stupidest implementation of SQL I ever had the displeasure of working with.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Emperor Jack Chick on March 05, 2018, 02:36:22 pm
No, not it is not.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Ashto on March 05, 2018, 06:42:42 pm
I kinda like JavaScript, goodbye!
Title: Thread.setTitle("Programmers Anonymous");
Post by: Lemon on March 05, 2018, 07:46:15 pm
Is it any less annoying and complicated when you don't have the limitations of "don't use anything 3rd party"?
I mean some of the directives and html tags are actually really useful, but the implementation is so cumbersome.
The Ambious, March 05, 2018, 03:00:43 am

I'll say that I'm confused by the assignment they're giving you. They're telling you to put something together using Angular, which I get, that's a thing that a lot of people are hiring for these days, have you use Bootstrap (which is a little old fashioned and also kinda outside the ecosystem - Why not go full-bore ng and use Material (https://material.angularjs.org/latest/)), but then jQuery? Like, at the point that you're putting together an Angular app, you shouldn't have a need for jQuery.

Like, what 3rd party stuff were you prevented from using that would have been helpful?
Title: Thread.setTitle("Programmers Anonymous");
Post by: Ambious on March 05, 2018, 08:30:12 pm
Is it any less annoying and complicated when you don't have the limitations of "don't use anything 3rd party"?
I mean some of the directives and html tags are actually really useful, but the implementation is so cumbersome.
The Ambious, March 05, 2018, 03:00:43 am

I'll say that I'm confused by the assignment they're giving you. They're telling you to put something together using Angular, which I get, that's a thing that a lot of people are hiring for these days, have you use Bootstrap (which is a little old fashioned and also kinda outside the ecosystem - Why not go full-bore ng and use Material (https://material.angularjs.org/latest/)), but then jQuery? Like, at the point that you're putting together an Angular app, you shouldn't have a need for jQuery.

Like, what 3rd party stuff were you prevented from using that would have been helpful?
Lemon, March 05, 2018, 07:46:15 pm

You are right to be confused.
Have I mentioned I study at the 2nd worst CS establishment in the country?

Anyway,  it wasn't just not allowing to use anything 3rd party, I forgot to mention we weren't allowed to use any versions of this stuff but only specifically the versions he specified, so a lot of stuff was out of date and had bugs or missing features that didn't all fit well together. One thing I kept running into online - which we weren't allowed to use - was AngularUI for AngularJS, which seemed to solved a lot of the problems I was having. Specifically I had an issue with some navbar elements in IE, something which would've been fixable with a 3rd party addon or a newer version of either Bootstrap, AngularJS, or both - and I couldn't just say fuck it and go "this website doesn't work well on IE" because we were required to make it work in all browsers.

Also our server-side had to be Java based Servlets, except we HAD to use Java 8 (that's after he originally wanted to make us use Java 7 to which we almost rioted), and we HAD to use Eclipse Oxygen and nothing else as he would test and grade the project IN Eclipse. Eclipse sucks donkey balls, so we wrote most of the project in IntelliJ and worried about making it Eclipse compatible towards the end only, but still - fuck those stupid limitations.

My Web Programming professor seems to have come from a completely different field with zero idea what he was doing and was recycling an old course, and his excuse for not allowing any deviation was that he wanted everyone to be "on the same level" or something or rather.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Schumin Capote on March 05, 2018, 08:31:48 pm
I guess it doesn't hurt to have some knowledge of jQuery, since you'll inevitably work on legacy projects, and it works very differently than modern JS frameworks like Vue, React, Angular, and Ember. That being said, I wouldn't recommend using it for a new project, since most things can be done far easier in a modern framework. As for Bootstrap, I agree that it's getting dated and Material would make a lot more sense for an Angular project. Heck, you could even use a library like ng-bootstrap (https://ng-bootstrap.github.io/#/home), so that you can use Bootstrap natively with Angular.

How is the Angular community doing these days? It seems like Google nearly killed it with Angular 2 and while I've heard that Angular 4 is better, I haven't had much reason to check it out.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Schumin Capote on March 05, 2018, 08:36:02 pm
Is it any less annoying and complicated when you don't have the limitations of "don't use anything 3rd party"?
I mean some of the directives and html tags are actually really useful, but the implementation is so cumbersome.
The Ambious, March 05, 2018, 03:00:43 am

I'll say that I'm confused by the assignment they're giving you. They're telling you to put something together using Angular, which I get, that's a thing that a lot of people are hiring for these days, have you use Bootstrap (which is a little old fashioned and also kinda outside the ecosystem - Why not go full-bore ng and use Material (https://material.angularjs.org/latest/)), but then jQuery? Like, at the point that you're putting together an Angular app, you shouldn't have a need for jQuery.

Like, what 3rd party stuff were you prevented from using that would have been helpful?
Lemon, March 05, 2018, 07:46:15 pm

You are right to be confused.
Have I mentioned I study at the 2nd worst CS establishment in the country?

Anyway,  it wasn't just not allowing to use anything 3rd party, I forgot to mention we weren't allowed to use any versions of this stuff but only specifically the versions he specified, so a lot of stuff was out of date and had bugs or missing features that didn't all fit well together. One thing I kept running into online - which we weren't allowed to use - was AngularUI for AngularJS, which seemed to solved a lot of the problems I was having. Specifically I had an issue with some navbar elements in IE, something which would've been fixable with a 3rd party addon or a newer version of either Bootstrap, AngularJS or both - and I couldn't just say fuck it and go "this website doesn't work well on IE" because we were required to make it work in all browsers.

Also our server-side had to be Java based Servlets, except we HAD to use Java 8 (that's after he originally wanted to make us use Java 7 to which we almost rioted), we HAD to use Eclipse Oxygen and nothing else (as he would test and grade the project IN Eclipse. Eclipse sucks donkey balls, so we wrote most of the project in IntelliJ and worried about making it Eclipse compatible towards the end only, but still - fuck those stupid limitations.

My Web Programming professor seems to have come from a completely different field with zero idea what he was doing and was recycling an old course, and his excuse for not allowing any deviation was that he wanted everyone to be "on the same level" or something or rather.
Ambious, March 05, 2018, 08:30:12 pm

That's a classic case of school curricula lagging behind the industry. Though I have a friend who is a Java developer for a bank and he mentioned that they just recently migrated over to Java 8, so there are segments of the industry where you're stuck using outdated libraries.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Lemon on March 05, 2018, 09:04:08 pm
How is the Angular community doing these days? It seems like Google nearly killed it with Angular 2 and while I've heard that Angular 4 is better, I haven't had much reason to check it out.
Schumin Capote, March 05, 2018, 08:31:48 pm

AFAIK the Angular community is still going strong. Google's still pushing it, in the way that Google pushes things (which means really heavily for like 3 months before ignoring it for another 3 and then coming back to it and wanting to change everything) and there's a lot of corporate buy-in to the ecosystem because "Google Has Invented The System" is an appealing thing for the business people to hear. I still do not like the syntax and I'm sure I never will, but I find it infinitely more agreeable than React. And I personally think Ember and Vue will always be considered niche.

we weren't allowed to use any versions of this stuff but only specifically the versions he specified
[...]
Specifically I had an issue with some navbar elements in IE
[...]
Also our server-side had to be Java based Servlets, except we HAD to use Java 8
[...]
he would test and grade the project IN Eclipse.
Ambious, March 05, 2018, 08:30:12 pm

So you're building a website with an old version of angular, and it has to work in IE, and it's Java on the server side, and it has to run in a specific IDE?

I mean, on the one hand, there's something to be said for the real-world education of "Here is less-than-optimal technology and bad requirements", but in a real-world scenario, people inherit those kind of websites, they don't build them fresh.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Ambious on March 05, 2018, 09:17:57 pm
we weren't allowed to use any versions of this stuff but only specifically the versions he specified
[...]
Specifically I had an issue with some navbar elements in IE
[...]
Also our server-side had to be Java based Servlets, except we HAD to use Java 8
[...]
he would test and grade the project IN Eclipse.
Ambious, March 05, 2018, 08:30:12 pm

So you're building a website with an old version of angular, and it has to work in IE, and it's Java on the server side, and it has to run in a specific IDE?

I mean, on the one hand, there's something to be said for the real-world education of "Here is less-than-optimal technology and bad requirements", but in a real-world scenario, people inherit those kind of websites, they don't build them fresh.
Lemon, March 05, 2018, 09:04:08 pm

Assuming they gave us all those limitations to give us 'real world education' is really giving them too much credit. Both my professor and TA seem like they just inherited the course from previous years and wanted to do as little work as possible.
That's a really common thing in our shitty University. A couple of years ago I had a course that hasn't been updated in so long it was partially based on fucking PASCAL.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Turtle on March 05, 2018, 10:54:20 pm
I've been using typescript and Angular5 for about a month now, coming off of years and years of absolutely zero web experience, and it's mostly tolerable. Every so often I will get incredibly angry that the promise of typescript is broken when it allows me to pass a string to something that is very explicitly declared as a specific class, but it's overall *okay*. I'm less annoyed by the language than by the tooling. I feel 10x more productive when I'm working on our C# code.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Schumin Capote on March 06, 2018, 12:54:45 am
How is the Angular community doing these days? It seems like Google nearly killed it with Angular 2 and while I've heard that Angular 4 is better, I haven't had much reason to check it out.
Schumin Capote, March 05, 2018, 08:31:48 pm

AFAIK the Angular community is still going strong. Google's still pushing it, in the way that Google pushes things (which means really heavily for like 3 months before ignoring it for another 3 and then coming back to it and wanting to change everything) and there's a lot of corporate buy-in to the ecosystem because "Google Has Invented The System" is an appealing thing for the business people to hear. I still do not like the syntax and I'm sure I never will, but I find it infinitely more agreeable than React. And I personally think Ember and Vue will always be considered niche.

...
Lemon, March 05, 2018, 09:04:08 pm

Ember is definitely niche, but it was my first exposure to a modern JS framework. With Vue, it's not backed by a major US company like Facebook or Google, but it still has fairly strong support from big companies and has a good community. It may never surpass React in terms of market share, but it is big enough that I'm comfortable with it. We've already launched an online education site and practice relationship manager with it and I've had good success transitioning developers from Angular 1 to Vue. It won't be the right fit in every company or project, but it's worked for what we are doing.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Ambious on March 11, 2018, 02:02:27 pm
The son of a bitch fined us by 20 points (out of 100) for using "external libraries" ngMessages and ngCookies.
Those are part of the AngularJS API! They're in the official documentation! We got them from the AngularJS website!
IN WHAT WORLD ARE THOSE "EXTERNAL" PACKAGES?!

I AM ANGRY!
Title: Thread.setTitle("Programmers Anonymous");
Post by: Emperor Jack Chick on March 12, 2018, 01:01:44 pm
The son of a bitch fined us by 20 points (out of 100) for using "external libraries" ngMessages and ngCookies.
Those are part of the AngularJS API! They're in the official documentation! We got them from the AngularJS website!
IN WHAT WORLD ARE THOSE "EXTERNAL" PACKAGES?!

I AM ANGRY!
Ambious, March 11, 2018, 02:02:27 pm

what is the point of limiting the libraries you can use in the first place
Title: Thread.setTitle("Programmers Anonymous");
Post by: Ambious on March 12, 2018, 05:13:08 pm
The son of a bitch fined us by 20 points (out of 100) for using "external libraries" ngMessages and ngCookies.
Those are part of the AngularJS API! They're in the official documentation! We got them from the AngularJS website!
IN WHAT WORLD ARE THOSE "EXTERNAL" PACKAGES?!

I AM ANGRY!
Ambious, March 11, 2018, 02:02:27 pm

what is the point of limiting the libraries you can use in the first place
jack chick, March 12, 2018, 01:01:44 pm

The official explanation: He wants us to learn to code stuff ourselves and not just rely on external libraries to do everything for us.
The real reason probably: He doesn't want to have to check code he doesn't understand because it uses libraries he doesn't have the time or patience to read the documentation of because like all IBM employees he has a stick so far up his ass he doesn't even know how to read anything without the IBM logo on it. I bet even his turds are up to company policy.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Turtle on March 12, 2018, 05:30:08 pm
The sentiment of having to do the code yourself instead of using an external library is valid, but should not apply to the framework you're using, the common tools of the language, or aspects of the program that are not the focus of the exercise.

If I asked you to write a json serializer in C# and you turned in a program that references Newtonsoft.Json.NET, I would not accept that. If I asked for a calendar application and it referenced System.DateTime, well come the hell on.
Title: Thread.setTitle("Programmers Anonymous");
Post by: A Whirring Bone-White Gleech on March 14, 2018, 07:03:40 pm
The son of a bitch fined us by 20 points (out of 100) for using "external libraries" ngMessages and ngCookies.
Those are part of the AngularJS API! They're in the official documentation! We got them from the AngularJS website!
IN WHAT WORLD ARE THOSE "EXTERNAL" PACKAGES?!

I AM ANGRY!
Ambious, March 11, 2018, 02:02:27 pm

what is the point of limiting the libraries you can use in the first place
jack chick, March 12, 2018, 01:01:44 pm

The official explanation: He wants us to learn to code stuff ourselves and not just rely on external libraries to do everything for us.
The real reason probably: He doesn't want to have to check code he doesn't understand because it uses libraries he doesn't have the time or patience to read the documentation of because like all IBM employees he has a stick so far up his ass he doesn't even know how to read anything without the IBM logo on it. I bet even his turds are up to company policy.
Ambious, March 12, 2018, 05:13:08 pm

Also, it might be because it's a practical impossibility to grade projects if they might use any arbitrary external library, and require unique non-trivial set-up.  If you get 30 projects, and each project requires some external dependency--some other library, a database, a cloud service, god knows what--then setting all of those up on your computer will take you for-fucking-ever.  It might not even be possible in some cases, like if you need an API key or something!  And that's even more true if you're grading on a platform other than what the student worked on.

Having said that, my usual solution is to require students to do a demo of their projects in their presentation, that way I can see that it's built and run at least once without having to do whatever crazy dance would be required to build it on my computer.
Title: Thread.setTitle("Programmers Anonymous");
Post by: junior associate faguar on March 23, 2018, 02:51:09 am
I'm trying to do Google Summer of Code this year, and I eagerly await getting laughed at and told that I'm not good enough even for an "easy" difficulty problem, much less the one I really want to do.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Runic on March 25, 2018, 01:21:18 am
Python is fucking magic or something
Title: Thread.setTitle("Programmers Anonymous");
Post by: Ambious on March 25, 2018, 09:55:31 am
Python is fucking magic or something
Runic, March 25, 2018, 01:21:18 am

The joke goes:
Someone: "You can't code in pseudocode!"
Python: "Hold my beer..."
Title: Thread.setTitle("Programmers Anonymous");
Post by: A Whirring Bone-White Gleech on May 24, 2018, 01:13:43 am
Tensorflow is so immensely frustrating.

I've been trying to build a Dataset from a generator.  This fails completely:
def get_random_tensors(count):
    for _ in range(count):
        yield tf.random_uniform((30, 1))

dset = tf.data.Dataset.from_generator(lambda: get_random_tensors(5000), tf.float32)

but this works correctly:
def get_random_tensors(count):
    for _ in range(count):
        yield np.random.uniform(-1.0, 1.0, (30,1))

dset = tf.data.Dataset.from_generator(get_random_tensors(5000), tf.float32)

I should have known I need to produce an actual numpy value immediately rather than a tensor, I guess.  Though why I have to wrap my generator expression in a lambda, I have no goddamned idea.  But my bigger complaint is, those two errors where super hard to figure out, because the error reports I got look like this:

Traceback (most recent call last):

  File "<ipython-input-49-1b94387c5bca>", line 1, in <module>
    runfile('/home/ /tensorflow_learning/dset race.py', wdir='/home/ /tensorflow_learning')

  File "/home/ /tensorflow_learning/tflowv/lib64/python3.6/site-packages/spyder/utils/site/sitecustomize.py", line 705, in runfile
    execfile(filename, namespace)

  File "/home/ /tensorflow_learning/tflowv/lib64/python3.6/site-packages/spyder/utils/site/sitecustomize.py", line 102, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "/home/ /tensorflow_learning/dset race.py", line 32, in <module>
    sess.run(x_dset)

  File "/home/ /tensorflow_learning/tflowv/lib64/python3.6/site-packages/tensorflow/python/client/session.py", line 900, in run
    run_metadata_ptr)

  File "/home/ /tensorflow_learning/tflowv/lib64/python3.6/site-packages/tensorflow/python/client/session.py", line 1135, in _run
    feed_dict_tensor, options, run_metadata)

  File "/home/ /tensorflow_learning/tflowv/lib64/python3.6/site-packages/tensorflow/python/client/session.py", line 1316, in _do_run
    run_metadata)

  File "/home/ /tensorflow_learning/tflowv/lib64/python3.6/site-packages/tensorflow/python/client/session.py", line 1335, in _do_call
    raise type(e)(node_def, op, message)

InvalidArgumentError: ValueError: setting an array element with a sequence.
Traceback (most recent call last):

  File "/home/ /tensorflow_learning/tflowv/lib64/python3.6/site-packages/tensorflow/python/ops/script_ops.py", line 157, in __call__
    ret = func(*args)

  File "/home/ /tensorflow_learning/tflowv/lib64/python3.6/site-packages/tensorflow/python/data/ops/dataset_ops.py", line 391, in generator_py_func
    nest.flatten_up_to(output_types, values), flattened_types)

  File "/home/ /tensorflow_learning/tflowv/lib64/python3.6/site-packages/tensorflow/python/data/ops/dataset_ops.py", line 390, in <listcomp>
    for ret, dtype in zip(

  File "/home/ /tensorflow_learning/tflowv/lib64/python3.6/site-packages/tensorflow/python/ops/script_ops.py", line 124, in _convert
    result = np.asarray(value, dtype=dtype, order="C")

  File "/home/ /tensorflow_learning/tflowv/lib64/python3.6/site-packages/numpy/core/numeric.py", line 492, in asarray
    return array(a, dtype, copy=False, order=order)

ValueError: setting an array element with a sequence.


[[Node: PyFunc = PyFunc[Tin=[DT_INT64], Tout=[DT_FLOAT], token="pyfunc_73"](arg0)]]
[[Node: IteratorGetNext_41 = IteratorGetNext[output_shapes=[<unknown>], output_types=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"](Iterator_37)]]

I've learned a lesson about building software from Tesorflow today: test your inputs and throw your errors early, so you can give the user useful information about what they did, instead of shitting up like this.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Runic on June 20, 2018, 02:21:28 pm
So in the course of researching machine learning, I have learned about the strange afterlife of Enron. Yes, that Enron (https://en.wikipedia.org/wiki/Enron_scandal). When the company got hit by the big fraud case, the government released 1.6 million emails relevant to the case. It turns out that that giant chunk of emails is actually really useful for machine learning research (https://medium.com/@williamkoehrsen/machine-learning-with-python-on-the-enron-dataset-8d71015be26d) and even today I've found datasets based on it (https://archive.ics.uci.edu/ml/machine-learning-databases/bag-of-words/vocab.enron.txt) that are useful for my own projects.

What a world, eh?
Title: Thread.setTitle("Programmers Anonymous");
Post by: A Whirring Bone-White Gleech on July 26, 2018, 05:54:54 am
Once again, I'm writing a C++ program, and I just want to create an array, of length provided by a variable not known at compile time, that will have bounds-checking and that will be deleted when it goes out of scope.  And despite the insane profusion of containers and smart-types available in C++, none of them does that.

std::array doesn't, because its size is a template parameter, so it needs to be a compile-time constant.

std::vector doesn't, because it's not fixed-size.  Which I admit is picky on my part.

std::unique_ptr<int[]> doesn't, because it doesn't check the array bounds any more than a basic int[] does.

WHY THE FUCK IS THIS SUCH AN UNREASONABLE REQUEST.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Turtle on July 26, 2018, 04:26:06 pm
WHY THE FUCK IS THIS SUCH AN UNREASONABLE REQUEST.A Whirring, Bone-White Gleech, July 26, 2018, 05:54:54 am
I'm only familiar with C++ at a cursory level, but I think I've figured something out, let me know what you think

    int variableArraySize;
   
    std:array<int, 1> array1;
    std:array<int, 2> array2;
    std:array<int, 3> array3;
    ...
    std:array<int, 1000> array1000;

    ...   
   
    int elementAt(int arraySize, int index) {
        switch(arraySize) {
            case 1: return array1[index];
            case 2: return array2[index];
            ...
            case 1000: return array1000[index];
        }
    }
 
    ...
   
    iterator begin(int arraySize) {
        switch(arraySize) {
            case 1: return array1.begin();
            case 2: return array2.begin();
            ...
            case 1000: return array1000.begin();
        }
    }
Title: Thread.setTitle("Programmers Anonymous");
Post by: Emperor Jack Chick on July 26, 2018, 10:11:24 pm
WHY THE FUCK IS THIS SUCH AN UNREASONABLE REQUEST.A Whirring, Bone-White Gleech, July 26, 2018, 05:54:54 am
I'm only familiar with C++ at a cursory level, but I think I've figured something out, let me know what you think

    int variableArraySize;
   
    std:array<int, 1> array1;
    std:array<int, 2> array2;
    std:array<int, 3> array3;
    ...
    std:array<int, 1000> array1000;

    ...   
   
    int elementAt(int arraySize, int index) {
        switch(arraySize) {
            case 1: return array1[index];
            case 2: return array2[index];
            ...
            case 1000: return array1000[index];
        }
    }
 
    ...
   
    iterator begin(int arraySize) {
        switch(arraySize) {
            case 1: return array1.begin();
            case 2: return array2.begin();
            ...
            case 1000: return array1000.begin();
        }
    }
Turtle, July 26, 2018, 04:26:06 pm

lol
Title: Thread.setTitle("Programmers Anonymous");
Post by: A Whirring Bone-White Gleech on July 31, 2018, 02:43:01 am
WHY THE FUCK IS THIS SUCH AN UNREASONABLE REQUEST.A Whirring, Bone-White Gleech, July 26, 2018, 05:54:54 am
I'm only familiar with C++ at a cursory level, but I think I've figured something out, let me know what you think

    int variableArraySize;
   
    std:array<int, 1> array1;
    std:array<int, 2> array2;
    std:array<int, 3> array3;
    ...
    std:array<int, 1000> array1000;

    ...   
   
    int elementAt(int arraySize, int index) {
        switch(arraySize) {
            case 1: return array1[index];
            case 2: return array2[index];
            ...
            case 1000: return array1000[index];
        }
    }
 
    ...
   
    iterator begin(int arraySize) {
        switch(arraySize) {
            case 1: return array1.begin();
            case 2: return array2.begin();
            ...
            case 1000: return array1000.begin();
        }
    }
Turtle, July 26, 2018, 04:26:06 pm

I think we've got something here, let's see if we can get this into boost.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Ashto on August 30, 2018, 11:53:35 am
For my latest project, I'm trying to drop jQuery in favor of just regular JS, and part of the process involves moving from $.getJSON() to fetch(). However, I'm trying to fetch the json data from HTTPS to HTTP, which throws an error. I can set the call mode to 'no-cors', but then all I get is an opaque response, likely because the HTTPS server isn't set up to handle the request. Is there any way to make fetch() work? I assume it has to be possible since $.getJSON() works just fine. I could just make the source use HTTPS as well to get around the whole issue, but I'm trying to make it so that the code will work no matter where it's being run from (basically, is it common practice to make HTTPS a hard dependency?)

Edit: nevermind, did a deep dive into how JSONP works, and how jQuery automates the process behind the scenes. I've learned how to append the script into the head tag (https://stackoverflow.com/questions/6789502/running-script-tags-fetched-with-jsonp) to pull it's info.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Tupocky on October 25, 2018, 12:33:00 pm
I'm in a "concepts of programming languages" class, and the past few weeks have been entirely on this language, Standard Meta Language. Using it is kinda like coding exclusively in command-line Python, but with the added bonus of being a functional language from 1983. I think at this point in my education I can justifiably say "why the hell am I learning this, and when will this ever be useful?"
Title: Thread.setTitle("Programmers Anonymous");
Post by: Ambious on November 18, 2018, 04:46:52 pm
TIL that with "Git Extensions" you can stage discrete lines for commits rather than entire files if you want to. Made splitting up the GIANT commit I had for my month long project into subject commits much easier.
Also the more I use C# the more I discovered how great it really is.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Ashto on November 18, 2018, 09:55:07 pm
Got my first interview request! I'm going to be cramming and preparing for interviews as much as possible over the next couple of days (haven't confirmed on an interview date). There's a few things that might work against me: 1) I don't have a relevant degree (Graphic Design, not Computer Science), and 2) I've never used Vue.js, which is something they're really looking for. I'm basically going in on the premise that I can easily apply my current degree's skills to match their needs, and plan to be upfront about not knowing Vue but willing to self-teach (already started with the basics, seems fairly straight-forward and not too different from React!). Do you guys have any advice on these things, or anything in general?
Title: Thread.setTitle("Programmers Anonymous");
Post by: Emperor Jack Chick on January 05, 2019, 12:58:47 am
today i was reverse engineering a test from another team in order to access some arcane APIs and encountered the a GET call titled "get website". being the intrepid sort that I am, I called it and received a 6.2k line JSON object back containing, presumably, the website. the very next call in the repo is called "update website", which is a POST request that submits a 6.2k line JSON object to a very similar URL. They did, however, change about 20 fields or so. as this is tangentially related to the work i'm doing, i explored around to see if this was relevant to the test that's being run, and no, it doesn't actually have any effect. HOORAY!!!
Title: Thread.setTitle("Programmers Anonymous");
Post by: Ambious on January 05, 2019, 02:01:56 pm
today i was reverse engineering a test from another team in order to access some arcane APIs and encountered the a GET call titled "get website". being the intrepid sort that I am, I called it and received a 6.2k line JSON object back containing, presumably, the website. the very next call in the repo is called "update website", which is a POST request that submits a 6.2k line JSON object to a very similar URL. They did, however, change about 20 fields or so. as this is tangentially related to the work i'm doing, i explored around to see if this was relevant to the test that's being run, and no, it doesn't actually have any effect. HOORAY!!!
jack chick, January 05, 2019, 12:58:47 am

This is how security breaches are born.
Back when I was working in retail I found a similar call on a competing company's website that basically gave me access to all their products and pricing, and so I made a scraping tool for our sales reps to be able to match prices on the fly.
Title: Thread.setTitle("Programmers Anonymous");
Post by: EYE OF ZA on January 05, 2019, 06:30:24 pm
Good: I'm learning PHP as I work on building my own portfolio website.

Bad: "//The tag array is sorted alphanumerically by default."  The tag array, after thirty minutes of breaking half the web page, turns out to not be sorted alphanumerically, or, indeed, at all.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Emperor Jack Chick on February 15, 2019, 12:41:17 am
Hey, question. Anyone super familiar with the builder design pattern?  (my project is in Java)

Basically: I have a class with ~30 fields, and an inner public builder class. The build() method of the inner class returns a new instance of the parent class and passes in an instance of itself. the parent class has a private constructor which assigns the fields collected by the inner class to the private fields on the parent. One of my coworkers has  requested that I move the initialization of those fields out of the private parent constructor and into the build() method between instantiating the new parent and returning it.

The question is: Does this matter? Is there any real tangible gain here aside from not having to pass an argument? The person making the request hasn't explained why he wants this beyond "the way you're doing it is Bad".  Guy is also kinda dumb so I'm not really inclined to listen to him.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Lemon on February 26, 2019, 03:23:09 pm
This seems like the right place to bring this up:

Trying an experimental redesign of the code block. First attempt was to mimic the Apple ][e color scheme.

https://github.com/AhoyLemon/ballpit/issues/50

If you have a preference on how you'd like to see it, let me know. Keeping in mind that I'm not gonna do syntax colors - whatever it ends up being, it'll be monochrome.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Lemon on February 27, 2019, 12:59:18 pm
Ignore me, testing something.

javascript
alert('hi');
Title: Thread.setTitle("Programmers Anonymous");
Post by: Ambious on February 27, 2019, 04:07:14 pm
Hey, question. Anyone super familiar with the builder design pattern?  (my project is in Java)

Basically: I have a class with ~30 fields, and an inner public builder class. The build() method of the inner class returns a new instance of the parent class and passes in an instance of itself. the parent class has a private constructor which assigns the fields collected by the inner class to the private fields on the parent. One of my coworkers has  requested that I move the initialization of those fields out of the private parent constructor and into the build() method between instantiating the new parent and returning it.

The question is: Does this matter? Is there any real tangible gain here aside from not having to pass an argument? The person making the request hasn't explained why he wants this beyond "the way you're doing it is Bad".  Guy is also kinda dumb so I'm not really inclined to listen to him.
jack chick, February 15, 2019, 12:41:17 am

It only matters if any of the fields is meant to be read only, and even then your way is better. It also depends on how the inheritance relationship is implemented - but it doesn't REALLY tangibly matter.
Most design patters are highly theoretical anyway and only exist to make different coders remain internally consistent, and especially in languages like Java and C# it doesn't really matter.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Ambious on March 16, 2019, 02:04:06 pm
A lot of people here dabble in code.
Let's share our experiences and bitch about how much we hate it but can't stop doing it anyway.
I'll go first:

My name is Ambious and I've spent my entire evening programming my first Python app.

WHO THE FUCK INVENTED THIS MESS!?
IT HAS ALL THE SYNTAX CONSISTENCY OF VISUAL BASIC!!!
AHHH!!! HOW IS THIS SHIT SO POPULAR!?
Ambious, July 01, 2016, 04:20:08 pm

This post did not age well.
Given the choice of language to perform scripting operations nowadays I'd pick Python over anything.
I still prefer C# for OOP, as Pyhton's OOP is extremely bad and feels like it was tacked on as an afterthought, but yeah Python is great and I was wrong.

I'm hoping to code something with some picky requirements, so I'm wondering if anyone has recommendations.

Basically, I want to make a simple app that I'll be using at work. Any language/frameworks I use are going to have to be portable, since I can't really install things on work PCs. Additionally, it'll have to be easy to run on different computers, so it can't have any dependencies that aren't easily bundled into the app itself.

I'm considering just using html and javascript, but I'll want to save/load files (probably just json data) and I feel like an html "app" would have too much friction with that, although I've never really done a lot of javascript so I could be wrong.

I'm pretty familiar with Python, and I can install a portable Python version on my own PC to do my development. Would something like py2exe make it easily runable on other PCs? I've never really used it before.

Is there anything else I should consider?
Darkly, March 16, 2019, 01:44:07 pm

I think you'd be best to go with Node.js
It's very portable (unlike Python, the packages are per-project so they go with you), and it's cross - platform and versatile.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Ambious on March 17, 2019, 04:49:13 am
I think you'd be best to go with Node.js
It's very portable (unlike Python, the packages are per-project so they go with you), and it's cross - platform and versatile.
Ambious, March 16, 2019, 02:04:06 pm

I tried node.js for another unrelated project once, and I was turned off from it when I tried installing node-sass but couldn't without admin privileges.

I might give it another shot though. It seems pretty attractive as long as it works in my environment.

Edit: after playing with node some more, I think that plus electron may actually be exactly what I need!
Darkly, March 16, 2019, 02:15:25 pm

Yeah Electron is great for cross-platforming. Good luck!
Title: Thread.setTitle("Programmers Anonymous");
Post by: Lemon on March 17, 2019, 08:54:07 am
Based on what you're describing, I agree with Electron. It's incredibly portable, you end up with a small executable that you can run anywhere.

Just be careful about entering npm hell. Just cause you're making an electron app doesn't mean you need to start out with 4Gb worth of dependencies. Start as slim as you can.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Turtle on April 20, 2019, 06:38:34 pm
Oh jesus christ I didn't even notice the far right line fuck what
Title: Thread.setTitle("Programmers Anonymous");
Post by: EYE OF ZA on April 21, 2019, 12:48:17 pm
don't mind me just closing my brackets ;}}}
Title: Thread.setTitle("Programmers Anonymous");
Post by: lazzer grardaion? on May 03, 2019, 05:23:43 pm
I made my own raytracer from scratch and I'm disproportionately proud of it.

(https://i.imgur.com/PoZbFTK.png)
Title: Thread.setTitle("Programmers Anonymous");
Post by: Ambious on May 07, 2019, 05:33:18 pm
We wasted an hour at work today trying to come up with a documentation convention for our Python code because all of the existing conventions are really, really bad.
I love writing in Python, but everything tangential to it (like conventions, linters, package managers, dependencies, etc.) is a hot mess.
Also why is parallelization such a tall order in Python? It's so uncharacteristic for something to be this complicated on a language that's basically pseudo-code.
In C# I can just do
Parallel.ForEach((room, ridiculist) => {
    ridiculist.clap(); //And all the ridiculists will clap concurrently - each in their own thread.
});

In Python to achieve the same in a controlled mannger I have to start dealing with pools and futures and manually iterate over threads or do something called a starmap and what the fuck were they thinking!?
Title: Thread.setTitle("Programmers Anonymous");
Post by: Turtle on August 26, 2019, 09:23:48 pm
I've been feeling burned out as hell for months at work for reasons I won't get into here but I've recently picked up a personal project that's doing a damn good job of reminding me that I do, in fact, enjoy doing this shit and I guess this is a reminder that even though your hobby may have become your job, you should take time out to do something for you.
Title: Thread.setTitle("Programmers Anonymous");
Post by: ham burger on June 23, 2021, 12:20:17 pm
i am resurrecting this thread to complain about a thing i am enduring right now

i pay for a fairly beefy server ~in the cloud~ that i use to host some software i need, some personal projects, and some game servers/other things for friends as a kindness. i just like doing it, it's nice to have a whole bunch of digital horses that are on demand to throw at a problem. i generally find it rewarding.

some friends of mine recently started a forum-based RPG with this tool, lorekeeper, that is one of the worst things i've ever interacted with. i'm in deep on being its admin at this point, but if you could imagine a laravel/php app built by 16 year olds with a fairly deep amount of complexity, this is it. config randomly scattered between environment vars and php config files. randomly laid out nested menus for managing the software that puts the upload for the css override under "image management," for example. every css class is highly specific so as to make styling it a nightmare, with liberal use of !important. tons of bugs. so many bugs. terrible documentation. no unit tests. it is an unholy nightmare.

the most demeaning thing, however, is how i get support. i am going to come here and say that i am a fairly experienced Technology Man with some knowledge of how to do a code or two and i've been at this for easily 25 years, 15ish years professionally so far, so i kinda know the lay of the land. i have to be nice to these kids, because they're kids, but also tech support. i say stuff like "the configuration values seem to be caching in a weird way and i can't flush the cache" and they say "yeah, configuration is very susceptible to caching" or i will say something like "this configuration value is not being read" and they will say "well are you committing it to git?" initially i solved all my problems by just reading the code, but as you can imagine, it is a nightmare and i will not be doing that.

i genuinely want to scream it is the most frustrating experience ever but i love my friends and will persevere.
Title: Thread.setTitle("Programmers Anonymous");
Post by: Emperor Jack Chick on June 23, 2021, 08:02:11 pm
That sounds very similar to a tool we have at work!

At some point the need for data about how automated tests performed across all layers of our application, and most teams were doing some half-assed work on their own. Naturally this bred the opportunity for someone to create a mechanism for data collation. Sadly, the way this works at my company is the idea is floated and then a specific team that handles all cross-team tooling builds whatever it is. Sadly, because this team is wholly and completely incompetent. 

So what we have now is a giant react app that was written by said team, a team that is not in the business of ui development, so they built the whole thing without taking advantage of components or composition. Configs are all hardcoded in data and copy pasted across files (also they didnt bother writing a BE service for it so all data is just live loaded from a DB in the fucking react code.

Naturally, this thing is fucking broken and doesn't report data properly for my team. My boss asked me to look into what it would take to fix our data, so I cloned the repo and started investigating. After 2 days of this I reported back that it would be a steep effort just to even figure out what the hell anything did and how to get around it to start figuring out the bugs, much less hacking in stuff to fix what we needed. We then looked into alternative solutions and have better, more comprehensive reports from Splunk (our data already reported to there) which took us about 2 hours to get setup and rolling. HOORAY!