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
Shaggar
Apr 26, 2006

abraham linksys posted:

my only beef is with its mutable api and they're working on adding an immutable/frozen mode (https://github.com/moment/moment-rfcs/pull/2) so that's not gonna be an issue in the future. like i reckon if that feature never comes to pass we'll have a better library within the next year or two take moment's place

the state of js's "standard lib" is dire and it's a drat shame, but tbf it's not like other languages don't have similar problems (see python's popular "arrow" package). i just wish there was any path forward for the shipped-with-runtime standard lib to be shaped up, but idk that would be

python is also garbage

Adbot
ADBOT LOVES YOU

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
okay that's really great and your comments were informative as always, but can you now please do a version of what that code might look like were it found in the wild, written by someone who just autocompleted to victory.

abraham linksys
Sep 6, 2010

:darksouls:
i mean it's not like alternative datetime libraries are limited to just plangs

Bloody
Mar 3, 2013

key difference being that the stdlibs in those languages actually work and are well documented

JewKiller 3000
Nov 28, 2006

by Lowtax

MALE SHOEGAZE posted:

okay that's really great and your comments were informative as always, but can you now please do a version of what that code might look like were it found in the wild, written by someone who just autocompleted to victory.

just remove all the comments and randomize the variable names

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

JewKiller 3000 posted:

just remove all the comments and randomize the variable names

yeah not very interesting in retrospect

hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av
you can't write code like that except by 100% commitment. to phone it in, you'd use C++ with ATL I guess. I'll have to try it, but I never used ATL in my entire life because when I was learning COM, Visual Studio still cost money

Luigi Thirty
Apr 30, 2006

Emergency confection port.

https://github.com/Luigi30/simdos/blob/master/fat12.x68

this 68k code is an abortion but it's miiiiine and i'm so proud

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Luigi Thirty posted:

https://github.com/Luigi30/simdos/blob/master/fat12.x68

this 68k code is an abortion but it's miiiiine and i'm so proud

i'm the floppy pointer

Sapozhnik
Jan 2, 2005

Nap Ghost

hackbunny posted:

you can't write code like that except by 100% commitment. to phone it in, you'd use C++ with ATL I guess. I'll have to try it, but I never used ATL in my entire life because when I was learning COM, Visual Studio still cost money

CComBSTR and CComVariant RAII away a lot of that pain, and it's still awful enough even armed with ATL. I think CComVariant might be parameterized on the VT_ constant the variable holds? can't remember

Nice writeup, now do one involving SAFEARRAYs :unsmigghh:

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Luigi Thirty posted:

https://github.com/Luigi30/simdos/blob/master/fat12.x68

this 68k code is an abortion but it's miiiiine and i'm so proud

also please keep posting updates in this thread. i think your posts are eventually going to inspire me to get into lower level stuff.

Lutha Mahtin
Oct 10, 2010

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

Bloody posted:

key difference being that the stdlibs in those languages actually work and are well documented

the original date and time libraries for java are kinda weird, iirc. they added more of them over time though

anthonypants
May 6, 2007

by Nyc_Tattoo
Dinosaur Gum

Bloody posted:

i don't understand you
buddy, you should try understanding some of their posts some time

e: poo poo, gently caress

anthonypants fucked around with this message at 17:28 on Aug 18, 2016

hobbesmaster
Jan 28, 2008

Space Whale posted:

gently caress finishing a 4 year, in loving EE, to take a pay cut.

I mean poo poo if you got a degree in stats and did ~data science~ that's even more $$$ right?

waaay back there now but i had to reply:

the standards for EE coders is also miserable, but you still need that degree for whatever reason.

i interviewed for a firmware embedded position. there was no coding screen before the on site. this was the white board coding question:

given the signature below, write a function to swap the first element of the array with the last, the second with the second to last, etc. such that the array is reversed
code:
void swapArray(int *array, int n)
{

}
easy reverse an array question. they even gave you the hugest loving hints in the world as to doing it in place
they were loving astounded when talked through this in under 5 minutes: (spot all the mistakes i'm not looking at this more than once)
code:
void swapArray(int *array, int n)
{
    int tmp;
    for(int i=0; i<n/2; i++){
        tmp = array[0];
        array[0] = array[n-i-1];
        array[1] = tmp;
    }
}
they had no other coding questions prepared. apparently only 50% of the EEs applying for this job as a senior firmware developer could do that function after prodding

they switched to this question after asking about sorting and over several years zero applicants could come up with anything better than an insertion sort, and that only after being guided from a naive bubble sort.

Space Whale
Nov 6, 2014

hobbesmaster posted:

waaay back there now but i had to reply:

the standards for EE coders is also miserable, but you still need that degree for whatever reason.

i interviewed for a firmware embedded position. there was no coding screen before the on site. this was the white board coding question:

given the signature below, write a function to swap the first element of the array with the last, the second with the second to last, etc. such that the array is reversed
code:
void swapArray(int *array, int n)
{

}
easy reverse an array question. they even gave you the hugest loving hints in the world as to doing it in place
they were loving astounded when talked through this in under 5 minutes: (spot all the mistakes i'm not looking at this more than once)
code:
void swapArray(int *array, int n)
{
    int tmp;
    for(int i=0; i<n/2; i++){
        tmp = array[0];
        array[0] = array[n-i-1];
        array[1] = tmp;
    }
}
they had no other coding questions prepared. apparently only 50% of the EEs applying for this job as a senior firmware developer could do that function after prodding

they switched to this question after asking about sorting and over several years zero applicants could come up with anything better than an insertion sort, and that only after being guided from a naive bubble sort.

:psyboom:

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

Lutha Mahtin posted:

the original date and time libraries for java are kinda weird, iirc. they added more of them over time though

java.time package.

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
i can't write a sorting algorithm on a whiteboard because if i need to sort something, i google "sort <data structure> in <language>"


i whiffed on an interview a year ago where i had to :o:

Star War Sex Parrot
Oct 2, 2003

hobbesmaster posted:

waaay back there now but i had to reply:

the standards for EE coders is also miserable, but you still need that degree for whatever reason.

i interviewed for a firmware embedded position. there was no coding screen before the on site. this was the white board coding question:

given the signature below, write a function to swap the first element of the array with the last, the second with the second to last, etc. such that the array is reversed
code:
void swapArray(int *array, int n)
{

}
easy reverse an array question. they even gave you the hugest loving hints in the world as to doing it in place
they were loving astounded when talked through this in under 5 minutes: (spot all the mistakes i'm not looking at this more than once)
code:
void swapArray(int *array, int n)
{
    int tmp;
    for(int i=0; i<n/2; i++){
        tmp = array[0];
        array[0] = array[n-i-1];
        array[1] = tmp;
    }
}
they had no other coding questions prepared. apparently only 50% of the EEs applying for this job as a senior firmware developer could do that function after prodding

they switched to this question after asking about sorting and over several years zero applicants could come up with anything better than an insertion sort, and that only after being guided from a naive bubble sort.
This is why most of our firmware devs arent EEs.

They're horrible programmers. Also the programming curriculum at my university for EEs is understandably shallow. They take like 2 intro courses

Star War Sex Parrot fucked around with this message at 06:30 on Aug 18, 2016

Star War Sex Parrot
Oct 2, 2003

It was fun destroying the EEs in my DSP Lab class because none of them could write C worth a drat for the little TI (?) DSP boards we were using

They killed us in the prerequisite DSP theory/math class because they had more discrete and continuous time signals classes, but they couldn't implement it digitally for poo poo

Star War Sex Parrot fucked around with this message at 06:33 on Aug 18, 2016

triple sulk
Sep 17, 2014



Wheany posted:

i can't write a sorting algorithm on a whiteboard because if i need to sort something, i google "sort <data structure> in <language>"


i whiffed on an interview a year ago where i had to :o:

most programmers are so bad that the fact that you understand and admit that you need to look something up when you don't know it probably puts you in the top 25%, and the fact that anyone would get turned down for that in 99% of jobs is hilariously sad because the tech industry has the worst superiority complex

hobbesmaster
Jan 28, 2008

Star War Sex Parrot posted:

This is why most of our firmware devs arent EEs.

They're horrible programmers. Also the programming curriculum at my university for EEs is understandably shallow. They take like 2 intro courses

most EEs at my school had a minor in CS

this meant they somehow passed introductory discrete math and algorithms.

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

triple sulk posted:

most programmers are so bad that the fact that you understand and admit that you need to look something up when you don't know it probably puts you in the top 25%, and the fact that anyone would get turned down for that in 99% of jobs is hilariously sad because the tech industry has the worst superiority complex

the job was for an ad agency, btw. i understood that i would have been doing python and js development

comedyblissoption
Mar 15, 2006

abraham linksys posted:

my only beef is with its mutable api and they're working on adding an immutable/frozen mode (https://github.com/moment/moment-rfcs/pull/2) so that's not gonna be an issue in the future.
lol why the gently caress did they FINALLY come around? the last time i looked up why the hell they made everything mutable, they were very resistant to immutability and the justification was that an unrealistic microbenchmark was a little faster w/ the mutable API and ignored real world use cases where everyone had to defensively clone everywhere

gonadic io
Feb 16, 2011

>>=

hackbunny posted:

I wonder sometimes. I actually liked doing it

Forgive my terrible programmer question, but I don't really understand what it's for

Like is it a platform independent? Windows only? There's easier ways to create a file so what's the more general use case? Making and manipulating office files? Just windows programming in general?

hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av

gonadic io posted:

Forgive my terrible programmer question, but I don't really understand what it's for

Like is it a platform independent? Windows only? There's easier ways to create a file so what's the more general use case? Making and manipulating office files? Just windows programming in general?

windows only afaik, it's been ported elsewhere but only to port applications, it never gained traction. as I mentioned, mozilla applications use COM but through a very different API. of course I picked file creation example for the absurdity of it, to show how a four line script expands into a hundred+ line monster. the general case is, more than controlling applications, extending them: browser plugins used to be activex controls for example (activex being an application of ole2 which is in turn an application of com), things that extend right-click menus for files with sub-menus are com components, etc. controlling applications is a legitimate use case too of course, and yes windows programming in general sometimes because some APIs (e.g. WMI) are only accessible through COM. no one does it in C because you can do it in C++, with plenty frameworks available, you can do it in visual basic, you can do it with old school windows scripting host, you can do it with any .net language etc.

Mr Dog posted:

Nice writeup, now do one involving SAFEARRAYs :unsmigghh:

never had to deal with the notorious SAFEARRAYs, sorry. I've always been curious if they were as bad as their reputation

anthonypants posted:

buddy, you should try understanding some of his posts some time

sorry but I gotta defend my personal brand: it's "her" posts tia

qntm
Jun 17, 2009

Space Whale posted:

So if I have the object

var o = {0: 1, 1:2, dick: "butt"};

would foreach iterate over 1 and 2 but not dick?

Ordinary objects do not have the forEach method. However, if you had an array

JavaScript code:
var a = [1, 2];
a.dick = "butt";
then yes, forEach would iterate over 1 and 2 only, not dick.

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
Object.keys(o) will return an array of rhe object's keys.

Object.keys(o).forEach(k => console.log(o[k]))

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

Lutha Mahtin posted:

the original date and time libraries for java are kinda weird, iirc. they added more of them over time though

http://classicprogrammerpaintings.com/post/142649999919/javautildate-salvador-dali-oil-on-canvas-1931

Lutha Mahtin
Oct 10, 2010

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

yeah that's the one i never use because wtf. there's also the one that is some kind of abstract class that allows you to define your own calendar system, which is good if you're like the ulillillia of calendars and need to implement your improved and extended version of the mayan calendar i guess

redleader
Aug 18, 2005

Engage according to operational parameters
hackbunny you are an absolute star

quiggy
Aug 7, 2010

[in Russian] Oof.


hobbesmaster posted:

waaay back there now but i had to reply:

the standards for EE coders is also miserable, but you still need that degree for whatever reason.

i interviewed for a firmware embedded position. there was no coding screen before the on site. this was the white board coding question:

given the signature below, write a function to swap the first element of the array with the last, the second with the second to last, etc. such that the array is reversed
code:
void swapArray(int *array, int n)
{

}
easy reverse an array question. they even gave you the hugest loving hints in the world as to doing it in place
they were loving astounded when talked through this in under 5 minutes: (spot all the mistakes i'm not looking at this more than once)
code:
void swapArray(int *array, int n)
{
    int tmp;
    for(int i=0; i<n/2; i++){
        tmp = array[0];
        array[0] = array[n-i-1];
        array[1] = tmp;
    }
}
they had no other coding questions prepared. apparently only 50% of the EEs applying for this job as a senior firmware developer could do that function after prodding

they switched to this question after asking about sorting and over several years zero applicants could come up with anything better than an insertion sort, and that only after being guided from a naive bubble sort.

you should've used an xor swap :2bong:

Bloody
Mar 3, 2013

hobbesmaster posted:

waaay back there now but i had to reply:

the standards for EE coders is also miserable, but you still need that degree for whatever reason.

i interviewed for a firmware embedded position. there was no coding screen before the on site. this was the white board coding question:

given the signature below, write a function to swap the first element of the array with the last, the second with the second to last, etc. such that the array is reversed
code:

void swapArray(int *array, int n)
{

}

easy reverse an array question. they even gave you the hugest loving hints in the world as to doing it in place
they were loving astounded when talked through this in under 5 minutes: (spot all the mistakes i'm not looking at this more than once)
code:

void swapArray(int *array, int n)
{
    int tmp;
    for(int i=0; i<n/2; i++){
        tmp = array[0];
        array[0] = array[n-i-1];
        array[1] = tmp;
    }
}

they had no other coding questions prepared. apparently only 50% of the EEs applying for this job as a senior firmware developer could do that function after prodding

they switched to this question after asking about sorting and over several years zero applicants could come up with anything better than an insertion sort, and that only after being guided from a naive bubble sort.

this kills the array

Bloody
Mar 3, 2013

quiggy posted:

you should've used an xor swap :2bong:

I've gotten the swap a couple of times in interviews and each time they ask if I can do it without a temporary variable I say yes but I'm not going to and shame them for asking

quiggy
Aug 7, 2010

[in Russian] Oof.


Bloody posted:

I've gotten the swap a couple of times in interviews and each time they ask if I can do it without a temporary variable I say yes but I'm not going to and shame them for asking

tbf if you're interviewing for a firmware embedded position like hobbesmaster that's the one time an xor swap is actually maybe justifiable

hobbesmaster
Jan 28, 2008

not in C, in asm maybe

Bloody
Mar 3, 2013

it's basically never justifiable

hobbesmaster
Jan 28, 2008

clearly i should've used this macro

i only say "asm maybe" because i'm sure theres some retarded architecture where using a tmp is somehow slower than the xors instead of faster like every other architecture.

luckily if you can write C someone else has theoretically figured all this poo poo out for you!

quiggy
Aug 7, 2010

[in Russian] Oof.


Bloody posted:

it's basically never justifiable

i dont disagree but if it's justifiable anywhere it's justifiable there

quiggy
Aug 7, 2010

[in Russian] Oof.



:gonk:

Adbot
ADBOT LOVES YOU

hobbesmaster
Jan 28, 2008

since it doesn't involve a goto or longjmp its automatically not one of the worst C macros

C codebases that have try/throw/catch/finally blocks are crazy. heres an example that actually explains whats going on which removes 99% of the fun

  • Locked thread