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

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



quote:

First, the basics: CoffeeScript uses significant whitespace to delimit blocks of code.

suck my entire rear end

Adbot
ADBOT LOVES YOU

30 TO 50 FERAL HOG
Mar 2, 2005



okay its me the terrible programmer. im writing some javascript (Actually CoffeeScript but whatever) app and im getting a little frustrated with promises, at least in a particular situation

since im on CoffeeScript 1.x, I dont have async/await available to me. otherwise I could do this

code:
results = []

for item in items
	temp = {}
	temp["a"] = await someAsyncFunction(item)
	temp["b"] = item.someProperty 
	results.push temp
and all would be well in the world. what ive resorted to is this..... thing

code:
promises = []
results = []

for item in items
	temp = {}
	tempPromise = someAsyncFunction(item)
	promises.push tempPromise
	temp["a"] = tempPromise
	temp["b"] = item.someProperty 
	results.push temp

Promise.all(promises)
which works, I guess, the object assigned to temp["a"] is a promise and not the actual result of that promise, but I can at least get to it in some way

30 TO 50 FERAL HOG
Mar 2, 2005



bob dobbs is dead posted:

done, we'll believe you're a terrible programmer now. you can get the statuette when you get out, the little id card is in the mail

namaste

30 TO 50 FERAL HOG
Mar 2, 2005



suffix posted:

it's terrible in python as well, maybe worse since python code tends to be less overload-crazy in general


your non-async version is technically 'better' here because it can run all the someAsyncFunction calls in parallel, which may or may not matter more than code clarity
i would expect something maybe like
code:
var promises = items.map(item => someAsyncFunction(item)
    .then(result => ({a: result, b: item.someProperty})));
return Promise.all(promises);

I like this, Ill have to work it in

30 TO 50 FERAL HOG
Mar 2, 2005



Sagacity posted:

ah, the Ultimate Extensibility pattern.

it's a nice pattern that disallows:
* database optimizations
* any kind of sharding
* intellisense
* refactoring your code

good

i look forward to your horror novel

lmao the bungie manifest is a sqlite db with an id (signed int, you have to manually convert it to unsigned for it to be useful) and a text field, which is a JSON object string

its the loving worst

30 TO 50 FERAL HOG fucked around with this message at 14:59 on Oct 24, 2018

30 TO 50 FERAL HOG
Mar 2, 2005



xml isnt bad but attributes vs elements is real annoying and honestly json just does it better

30 TO 50 FERAL HOG
Mar 2, 2005



prisoner of waffles posted:

attributes are guaranteed to have 0 or 1 cardinality and their order is insignificant tho

right but thats how it should be.

having an xml tree with multiple elements with the same name is loving stupid in all cases where you arent representing an array. and if youre representing an array, those elements should be isolated in a child element that denotes it's an array.

json does it better

30 TO 50 FERAL HOG
Mar 2, 2005



its a way to save documents for people too stupid to use explorer mapped drives

30 TO 50 FERAL HOG
Mar 2, 2005



Pie Colony posted:

unfortunately i have to learn c++ for work, what’s a good resource for doing so? i’m comfortable with c and java so i don’t necessarily need to start from first principles

get a new job

30 TO 50 FERAL HOG
Mar 2, 2005



Corla Plankun posted:

im sure i've posted about this before but i once found a query in the wild that was being used "for financial modelling" that was like

code:
SELECT
  DAYOFMONTH(date) as day_of_month,
  butt_type,
  butt_size,
  butt_shape,
  avg(butt_volume),
  sum(butt_users)
FROM insanely_big_hive_table_that_took_ninety_minutes_to_scan
WHERE
  various_butt_conditions 
  AND DAYOFMONTH(date) = 1

UNION ALL

SELECT
  DAYOFMONTH(date) as day_of_month,
  butt_type,
  butt_size,
  butt_shape,
  avg(butt_volume),
  sum(butt_users)
FROM insanely_big_hive_table_that_took_ninety_minutes_to_scan
WHERE
  various_butt_conditions 
  AND DAYOFMONTH(date) = 2

UNION ALL 

-- etc, etc, etc

UNION ALL

SELECT
  DAYOFMONTH(date) as day_of_month,
  butt_type,
  butt_size,
  butt_shape,
  avg(butt_volume),
  sum(butt_users)
FROM insanely_big_hive_table_that_took_ninety_minutes_to_scan
WHERE
  various_butt_conditions 
  AND DAYOFMONTH(date) = 31

:stare:

30 TO 50 FERAL HOG
Mar 2, 2005



wish i could dig up that post about "big data is just consulting telling you to give your virtual server more ram" because holy lmao

Adbot
ADBOT LOVES YOU

30 TO 50 FERAL HOG
Mar 2, 2005



namaste

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