Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
duTrieux.
Oct 9, 2003

javascript. i have a stack of variables which are all almost, but not quite, the same. (e.g. whatever_1, whatever 2, etc.) i need to iterate through them. right now i'm just building the variable names as strings and then slapping them into an eval() because idgaf

is there a better/more elegant way to do this?

Adbot
ADBOT LOVES YOU

tef
May 30, 2004

-> some l-system crap ->

suffix posted:

eh. proper async/await support is a strictly better interface, but promises at least papers over the callback hell, and with yield they can even be tolerable to write

yeah as soon as you have yield or some other ersatz do-notation, you don't even have to the cps transform for the nested stuff

quote:

the big problem with the js promises i've seen is they tend to swallow errors because there's nowhere to raise them

with an async statement you have a call point where you can just raise the exception as normal, with a proper stack trace and everything

well if you don't maintain a callstack you don't get poo poo, but it is surprising, to me at least, that errors get thrown down the chain in javascript rather than up, given it doesn't do any tco

quote:

promise stack traces tend to suck, when you even get them

yeah

when your state machine transitions map to function calls it's always a happy fun time, and hell when it isn't

Share Bear
Apr 27, 2004

duTrieux. posted:

javascript. i have a stack of variables which are all almost, but not quite, the same. (e.g. whatever_1, whatever 2, etc.) i need to iterate through them. right now i'm just building the variable names as strings and then slapping them into an eval() because idgaf

is there a better/more elegant way to do this?

are they returned or generated from something? is it possible to throw that into a custom object or iterative container?

tef
May 30, 2004

-> some l-system crap ->

duTrieux. posted:

javascript. i have a stack of variables which are all almost, but not quite, the same. (e.g. whatever_1, whatever 2, etc.) i need to iterate through them. right now i'm just building the variable names as strings and then slapping them into an eval() because idgaf

is there a better/more elegant way to do this?

slap em in an object mate

var my_butt = {};

my_butt.whatever_1 = "poop fart";

then you can sorta iterate through em

for (var c in my_butt) { console.log(c, my_butt[c]) }

tef
May 30, 2004

-> some l-system crap ->
once i realised that the code that was the most aesthetically pleasing was also the most unfriendly to beginners or new people to a code base, often hard to find somewhere to start, or relying on a very very clever and well greased abstraction

i've become a lot more sloppy where i know there isn't really a corner to cut but just a bikeshed to paint

Share Bear
Apr 27, 2004

tef posted:

once i realised that the code that was the most aesthetically pleasing was also the most unfriendly to beginners or new people to a code base, often hard to find somewhere to start, or relying on a very very clever and well greased abstraction

i've become a lot more sloppy where i know there isn't really a corner to cut but just a bikeshed to paint

the first time i tried to learn java i thought "what java project do i use most often", turns out it was azureus and a big pile of overengineered crap i could not figure out

i didnt learn java until last year thinking all projects were like that

duTrieux.
Oct 9, 2003

Share Bear posted:

are they returned or generated from something? is it possible to throw that into a custom object or iterative container?

nah, just a handful of arrays that i'm using to store poo poo

tef posted:

slap em in an object mate

var my_butt = {};

my_butt.whatever_1 = "poop fart";

then you can sorta iterate through em

for (var c in my_butt) { console.log(c, my_butt[c]) }

i'll probably do this but only because my job is, like, 90% self-directed so i might as well use the chance to get myself up to speed

tef
May 30, 2004

-> some l-system crap ->

duTrieux. posted:

nah, just a handful of arrays that i'm using to store poo poo


i'll probably do this but only because my job is, like, 90% self-directed so i might as well use the chance to get myself up to speed

best thing to do is read a bunch of other libraries for a bit and pick up bits and pieces rather than trying to pick everything up at once

unless you've done enough of a similar language where it's easier to learn the differences and core operations

duTrieux.
Oct 9, 2003

tef posted:

best thing to do is read a bunch of other libraries for a bit and pick up bits and pieces rather than trying to pick everything up at once

unless you've done enough of a similar language where it's easier to learn the differences and core operations

i'm familiar enough with basic concepts and have glancing experience with c++ and java. hobbyist-grade knowledge, i guess?

educationally i got through about ¼ of a computer science degree before switching to literature/writing, so y'know.

weirdest loving career trajectory, mang.

Valeyard
Mar 30, 2012


Grimey Drawer
heres a fun exercise, go look at the SA javascript lol

Soricidus
Oct 21, 2010
freedom-hating statist shill

Valeyard posted:

heres a fun exercise, go look at the SA javascript lol

i thought we weren't allowed to tell people to kill themselves any more

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

triple sulk posted:

yeah just like commercials, which was supposed to be illegal now iirc but still happens anyway

i'm pretty sure they're not louder in terms of how many dB they are, they just use some funky audio processing to sound louder without breaking the law.

which is actually kind of cool but also kill all marketers

Bloody
Mar 3, 2013

tef posted:

once i realised that the code that was the most aesthetically pleasing was also the most unfriendly to beginners or new people to a code base, often hard to find somewhere to start, or relying on a very very clever and well greased abstraction

i've become a lot more sloppy where i know there isn't really a corner to cut but just a bikeshed to paint

my coworkers who dont write code give me poo poo for just slapping poo poo together to make a thing work in the most obvious lowest-effort manner and im like dudes, does it work or not and they're like yeah and i'm like okay so gently caress yuo

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

thanks for the explanations re: promises

MononcQc
May 29, 2007

Proper support for yield/poll/wait/fetch whatever beats the hell out of promises day and night. I guess cps promises are an okay lesser evil when you don't have that though.

Luigi Thirty
Apr 30, 2006

Emergency confection port.

aaaaaag one week into new job and i feel like a big ol fraud

"here see if you can figure out why this customer's reports are displaying wrong"

"hmm okay how is it generated?" *opens ssms, finds 350 line stored procedure*

"uhhh okay, how about debugging it to see what it's doing?" *steps through, 90 lines of unions and temp tables make up one statement in the debugger*

*kills self*

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

that doesn't sound like fraud

Jonny 290
May 5, 2005



[ASK] me about OS/2 Warp

Share Bear posted:

the first time i tried to learn java i thought "what java project do i use most often", turns out it was azureus and a big pile of overengineered crap i could not figure out

i didnt learn java until last year thinking all projects were like that

i still think java's like that, to me its an impenetrable 90000 layer onion of just what appears to be arbitrary object creation and type casting forever and ever and i'm like WOULD YOU GET TO THE GOD drat POINT ALREADY

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

Jonny 290 posted:

i still think java's like that, to me its an impenetrable 90000 layer of onion of just what appears to be arbitrary object creation and type casting forever and ever and i'm like WOULD YOU GET TO THE GOD drat POINT ALREADY

agreed

Jerry Bindle
May 16, 2003
i felt that way about java for a long time. i started getting paid to do a java and read "effective java" and then it just clicked, not sure which did it though

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

Luigi Thirty posted:

aaaaaag one week into new job and i feel like a big ol fraud

"here see if you can figure out why this customer's reports are displaying wrong"

"hmm okay how is it generated?" *opens ssms, finds 350 line stored procedure*

"uhhh okay, how about debugging it to see what it's doing?" *steps through, 90 lines of unions and temp tables make up one statement in the debugger*

*kills self*

sounds like a perfectly reasonable reaction to that kind of thing to me

Flat Daddy
Dec 3, 2014

by Nyc_Tattoo
im pretty sure 90% of my haskell dependencies don't do actually anything. its just imaginary math stuff

triple sulk
Sep 17, 2014



Barnyard Protein posted:

i felt that way about java for a long time. i started getting paid to do a java and read "effective java" and then it just clicked, not sure which did it though

i still really, really need to read c# in depth beyond the first chapter or so

Luigi Thirty
Apr 30, 2006

Emergency confection port.

eschaton posted:

sounds like a perfectly reasonable reaction to that kind of thing to me

probably but i think that would be rude to do it's a very nice office

~Coxy
Dec 9, 2003

R.I.P. Inter-OS Sass - b.2000AD d.2003AD

Luigi Thirty posted:

aaaaaag one week into new job and i feel like a big ol fraud

"here see if you can figure out why this customer's reports are displaying wrong"

"hmm okay how is it generated?" *opens ssms, finds 350 line stored procedure*

"uhhh okay, how about debugging it to see what it's doing?" *steps through, 90 lines of unions and temp tables make up one statement in the debugger*

*kills self*

if it's anything like our 350 line SSRS sprocs it will create a table, then insert some stuff into it, then potentially modify those rows with sums or differences or hiding negative values or whatever, then return that table to the SSRS report

comment out the sproc parts and run it as a SSMS query

then comment out everything except for the initial table generation

slowly uncomment sections in turn (hopefully they should be linear/procedural, ours are) until you work out what each piece does

good luck

(it really sucks that a report can't be backed by a nice snippet of C# code without doing annoying things like SQL Server hosted assemblies)

Luigi Thirty
Apr 30, 2006

Emergency confection port.

~Coxy posted:

if it's anything like our 350 line SSRS sprocs it will create a table, then insert some stuff into it, then potentially modify those rows with sums or differences or hiding negative values or whatever, then return that table to the SSRS report

comment out the sproc parts and run it as a SSMS query

then comment out everything except for the initial table generation

slowly uncomment sections in turn (hopefully they should be linear/procedural, ours are) until you work out what each piece does

good luck

(it really sucks that a report can't be backed by a nice snippet of C# code without doing annoying things like SQL Server hosted assemblies)

yeah it makes sense (other than the confusing as hell short names for all the tables) and i'm reasonably competent with sql server but i've never worked with anything so big, so complicated, or so on a client's production system before and it's scary af

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Luigi Thirty posted:

aaaaaag one week into new job and i feel like a big ol fraud

"here see if you can figure out why this customer's reports are displaying wrong"

"hmm okay how is it generated?" *opens ssms, finds 350 line stored procedure*

"uhhh okay, how about debugging it to see what it's doing?" *steps through, 90 lines of unions and temp tables make up one statement in the debugger*

*kills self*

lol ur fine

Jonny 290
May 5, 2005



[ASK] me about OS/2 Warp
you a: know what a debugger is and b: how to invoke it which puts you in the top 10 percentile of "computer programmers" in the market today

Luigi Thirty
Apr 30, 2006

Emergency confection port.

Jonny 290 posted:

you a: know what a debugger is and b: how to invoke it which puts you in the top 10 percentile of "computer programmers" in the market today

nothing against coworkers but apparently this is true from what I observed.

plus I already got the "you did what to the client's data" out of the way

protip: don't delete things from client production databases without telling someone in charge first (double happy ending: they had a daily backup plus the one I made beforehand and I was right anyway)

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
having the new guy work directly on the client's production database seems like a massive horror

actually, doing anything at all in production other than "roll out a new version" is highly suspicious. clone that stuff to a dev instance (if necessary) and work on it there.

Luigi Thirty
Apr 30, 2006

Emergency confection port.

Jabor posted:

having the new guy work directly on the client's production database seems like a massive horror

actually, doing anything at all in production other than "roll out a new version" is highly suspicious. clone that stuff to a dev instance (if necessary) and work on it there.

I agree with all these things because working with production databases for a huge app I know not very much about the inner workings of is :froggonk:

we have local instances and test instances out the rear end but it's always the loving case where they tried to import data from Lotus 1-2-3 using Windows CardFile or some poo poo and their data got hosed

Luigi Thirty fucked around with this message at 07:07 on Feb 21, 2015

~Coxy
Dec 9, 2003

R.I.P. Inter-OS Sass - b.2000AD d.2003AD

Luigi Thirty posted:

other than the confusing as hell short names for all the tables

probably an oracle dev

don't be too scared to mess with sprocs in prod, you can make changes and rollbacks very easily compared to actual data

gonadic io
Feb 16, 2011

>>=

Flat Daddy posted:

im pretty sure 90% of my haskell dependencies don't do actually anything. its just imaginary math stuff

yeah anything written by ekmett has a million module dependencies (also all written by him). he doesn't care, as it makes his job easier and it's not like it really affects much other than install time

Luigi Thirty
Apr 30, 2006

Emergency confection port.

yeah i know i'm fine but it's my first actual computer job (even if it's glorified computer janitoring) and i don't want to mess it up! from what i read they want you to work at an impossibly fast pace and throw you out on your rear end in 6 months if you can't.

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
i've been stunned at how quickly my imposter syndrome has gone away at my first real computer programmer job

like the first 6 months were rough but now lol

Jonny 290
May 5, 2005



[ASK] me about OS/2 Warp

MALE SHOEGAZE posted:

i've been stunned at how quickly my imposter syndrome has gone away at my first real computer programmer job

like the first 6 months were rough but now lol

impostor syndrome is failure to recognize that the only job skill that really matters over anybody's career is if you can spit game or not, and if you can learn poo poo to back up that game

everything else is vestigial

Luigi Thirty
Apr 30, 2006

Emergency confection port.

sadly that doesn't work with ~metrics~

Valeyard
Mar 30, 2012


Grimey Drawer
code:
import java.util.Scanner;

public class CLI {
	
		public CLI(){
		}
		
		public static void main(String args[]){
			boolean running = true;
			        Scanner s = new Scanner(System.in);
			        while(running){
			           String command = s.next();
			           System.out.println(command);
			        }
		}
}
so say I have something like this. i export it as a runnable jar (with eclipse), and then get a jar file that wont run. ive tried using command line and running:

java -jar testJar.jar

but nothing, the process just hangs. no errors, just nothing

qntm
Jun 17, 2009
I don't know what java.util.Scanner is exactly but I'm guessing that sitting there apparently doing nothing while waiting for you to type something is exactly the correct behaviour for that program

Adbot
ADBOT LOVES YOU

gonadic io
Feb 16, 2011

>>=

Luigi Thirty posted:

sadly that doesn't work with ~metrics~

yeah but gaming metrics is still not about being a competent programmer

  • Locked thread