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
Jonny 290
May 5, 2005



[ASK] me about OS/2 Warp

MEAT TREAT posted:

I can't wrap my head around ASUS servers in the first place :wtc:

Your heart has yet to be touched by their rock-solidness.

Adbot
ADBOT LOVES YOU

Qwertycoatl
Dec 31, 2008

I came across this today:
code:
sprintf(buf, "%s.ext", buf);
strcat is for losers! So is well-defined behaviour!

CGameProgrammer
Nov 5, 2008
You guys are wrong about condition jumps, anyway. Non-conditional jumps (jmp) is one clock. Conditional jumps are slower but variable; the CPU will try to predict the outcome and prepare to execute the commands it thinks will come next, but this prediction is very complicated.

Impotence
Nov 8, 2010
Lipstick Apathy

Jonny 290 posted:

Your heart has yet to be touched by their rock-solidness.

Where did that slogan come from anyways? It seems utterly bizarre

shrughes
Oct 11, 2008

(call/cc call/cc)

CGameProgrammer posted:

You guys are wrong about condition jumps, anyway. Non-conditional jumps (jmp) is one clock. Conditional jumps are slower but variable; the CPU will try to predict the outcome and prepare to execute the commands it thinks will come next, but this prediction is very complicated.

No, as was convincingly demonstrated, a jmp is not one clock tick.

Opinion Haver
Apr 9, 2007

code:
> {} + [] == 0
true
> console.log({} + [] == 0)
false
> x = {} + []
"[object Object]"
> x == 0
false
What the gently caress.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
I can explain that one!

{} + [] is not being interpreted as an object literal plus an array literal. It's being interpreted as a block with no statements, and then an array literal with a unary plus in front. That is:

code:
{
   ;
}

+[]
And as you can see:

code:
> +[] == 0
true

Opinion Haver
Apr 9, 2007

I have no clue how the hell to feel about that.

Sinestro
Oct 31, 2010

The perfect day needs the perfect set of wheels.
Angry. Feel angry.

Doc Hawkins
Jun 15, 2010

Dashing? But I'm not even moving!


Get angry, then get Coffeescript. :frogc00l:

God of Mischief
Oct 22, 2010

yaoi prophet posted:

I have no clue how the hell to feel about that.

Confused, disgusted, and relieved it doesn't work like you originally thought. Almost like the rest of javascript, except that doesn't work like you think and not in a good way.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

Qwertycoatl posted:

I came across this today:
code:
sprintf(butt, "%sex", butt);

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
It's really because your REPL is interpreting it as a Program rather than a Statement, and there's an ambiguity between the two. Wrapping it in parens will make it work:

code:
> ({} + [] == 0)
false
This really never comes up outside of the REPL or eval case.

McGlockenshire
Dec 16, 2005

GOLLOCKS!

yaoi prophet posted:

I have no clue how the hell to feel about that.

See also, the "wat" talk on Ruby and Javascript (caution: heavy on image macros) and this article explaining it.

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."

Doc Hawkins posted:

Get angry, then get Coffeescript. :frogc00l:

I, too, react to the problem of hairy syntax and semantics riddled with special cases by adding a preprocessor layer which adds more "convenient" syntax and semantics.

Opinion Haver
Apr 9, 2007

Coffeescript owns though. If I were targeting something like a server or a normal desktop environment where I could switch to one of a dozen other languages, yeah, I'd say use something else instead. But what the gently caress am I going to do on the web?

Doc Hawkins
Jun 15, 2010

Dashing? But I'm not even moving!


How many times have you heard a variation on this statement:

quote:

Javascript is okay, but what's really holding it back is not having the grammar/syntax/features of $language, which I'm much more impressed by/comfortable with!

I've heard at least three. It's like the new C or something. Welcome to the era of ~transpiling~.

Opinion Haver
Apr 9, 2007

Being able to write 'for own key, value in obj' or 'for val in array' is really nice though? Like I could give less of a poo poo about braces/semicolons, but list comprehensions/iteration and the 'do' syntax for proper closures in loops fix a lot of the most annoying poo poo about JS.

Strong Sauce
Jul 2, 2003

You know I am not really your father.





I would use javascript but I evaluate ({} + []) too often to trust using it.

Vanadium
Jan 8, 2005

yaoi prophet posted:

Coffeescript owns though. If I were targeting something like a server or a normal desktop environment where I could switch to one of a dozen other languages, yeah, I'd say use something else instead. But what the gently caress am I going to do on the web?

http://opalang.org/ of course!

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.

yaoi prophet posted:

Coffeescript owns though. If I were targeting something like a server or a normal desktop environment where I could switch to one of a dozen other languages, yeah, I'd say use something else instead. But what the gently caress am I going to do on the web?
Pretty much, Ive been learning JavaScript out of necessity because I needed to use AJAX to make my web app nice to use, and Its just a really bad language if you dont know it's many gotchas and best practices well.

Coffeescript compiles to good namespacing, is much much easier to read, and just works. What it compiles to looks close enough to what you wrote so you can debug it in console without much hassle. Well worth learning in my opinion, my js codebase isn't great but it is certainly manageable and understandable enough.

Furthermore it's the best we're gonna get unless browsers adopt a new standard language for DOM manipulation, which is not really what the web needs right now.

that awful man
Feb 18, 2007

YOSPOS, bitch

Internet Janitor posted:

I, too, react to the problem of hairy syntax and semantics riddled with special cases by adding a preprocessor layer which adds more "convenient" syntax and semantics.

Unless you're some macho "Real Programmer" who writes machine code in hex, you're already doing some form of this.

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde
e: Really, given the context, I have to agree with Janitor. A better solution would be "then don't do that."

Gazpacho fucked around with this message at 10:41 on Jun 29, 2012

bobthecheese
Jun 7, 2006
Although I've never met Martha Stewart, I'll probably never birth her child.

Fun fact: "Opa" is "Grandpa" in German. I will only see that as an old man language.

e: Their FAQ covers the various meanings in different languages, pretty much none of which could have any positive connotations in web.

bobthecheese fucked around with this message at 10:51 on Jun 29, 2012

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.




What sadistic gently caress thinks gray text on a slightly lighter gray background is a good idea? I swear this is a slowly growing trend, too, because I've been seeing it more often in the last year or so. Makes me want to set up a fake design blog that's #F8F8F8 text on a #FBFBFB background but I don't think I'm good enough at spinning bullshit to dance on the Godwin line.

Johnny Cache Hit
Oct 17, 2011

Munkeymon posted:

What sadistic gently caress thinks gray text on a slightly lighter gray background is a good idea? I swear this is a slowly growing trend, too, because I've been seeing it more often in the last year or so. Makes me want to set up a fake design blog that's #F8F8F8 text on a #FBFBFB background but I don't think I'm good enough at spinning bullshit to dance on the Godwin line.

It's the coolest new fad in design that makes my life difficult, and I've got only a mild visual impairment. I can't imagine what people with really poor contrast sensitivity think about this poo poo. Seriously you don't need to do 18px black on white or anything but just remembering that not everyone has 20-20 vision would be great, thanks designers.

Graphics designers... a perpetual horror :downs:

Johnny Cache Hit fucked around with this message at 16:06 on Jun 29, 2012

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

yaoi prophet posted:

Coffeescript owns though. If I were targeting something like a server or a normal desktop environment where I could switch to one of a dozen other languages, yeah, I'd say use something else instead. But what the gently caress am I going to do on the web?

If you're writing a large scale JS application, Clojurescript is good.

Frozen Peach
Aug 25, 2004

garbage man from a garbage can
My place of employment had a "Health Fair" hosted by our insurance company this week. It was pretty stupid since all they did was get your BMI and blood pressure, then give you links to their website.

Anyways, after going to their website I find out the following fun pieces of information: Their system only supports 10 character alphanumeric passwords (but the password box takes 15 characters!) It doesn't tell you what is wrong with your password, it just fails if it has a special character or if it is longer than 10 characters. On top of that, passwords are stored in unstalted, unhashed, and unencrypted plain text in their database. Basically the worst possible login security you can imagine. When I did forgot password it actually sent me my plain text password over email. :downs:

There is a light at the end of the tunnel though. I submitted a little rant on their contact us form saying it was unacceptable to know that my health insurance information is so insecure. I just got a reply, and not a form letter "herp derp I promise we are secure because ..." either.

One of their developers wrote a personalized email talking about the new site he's developing and all the new security measures that are being put into place. He did start out saying that the site meets government regulations, but went on to say that obviously wasn't good enough and that the new system would support passwords of any length that have been properly salted, hashed, and separated from the rest of their systems.

It's always nice finding developers that actually care, even if the code base they're stuck working on is awful.

Bhaal
Jul 13, 2001
I ain't going down alone
Dr. Infant, MD
If you or your employer gave them your SSN or even birthdate then they start to fall under HIPAA compliance and they will get their rear end nailed to the wall if they're audited and their servers aren't up to snuff for security (no unencrypted SSNs stored at rest, no report containing personal biometric data can be made available to your employer unless it's been properly deidentified) . That sounds very similar to the sort of thing my company does, though we go a lot further and take actual bloodwork data, questionnaire data (smoking habits, eating habits, etc) roughly once a year per person and run it through several proprietary risk & trend assessments as well as some openly published heuristics and so on. It's a neat field but there's a lot of rush-to-market shops out there and that sounds like one of them, and handling + reporting on data like that is working with live ammo. At least one guy over there cares, and it's not like your boss now knows your hemoglobin A1C count (largest indicator for pre-diabetes) if all they did was weigh you and so on. But still, unencrypted passwords certainly doesn't inspire confidence.

Hughlander
May 11, 2005

Bhaal posted:

If you or your employer gave them your SSN or even birthdate then they start to fall under HIPAA compliance and they will get their rear end nailed to the wall if they're audited and their servers aren't up to snuff for security (no unencrypted SSNs stored at rest, no report containing personal biometric data can be made available to your employer unless it's been properly deidentified) . That sounds very similar to the sort of thing my company does, though we go a lot further and take actual bloodwork data, questionnaire data (smoking habits, eating habits, etc) roughly once a year per person and run it through several proprietary risk & trend assessments as well as some openly published heuristics and so on. It's a neat field but there's a lot of rush-to-market shops out there and that sounds like one of them, and handling + reporting on data like that is working with live ammo. At least one guy over there cares, and it's not like your boss now knows your hemoglobin A1C count (largest indicator for pre-diabetes) if all they did was weigh you and so on. But still, unencrypted passwords certainly doesn't inspire confidence.

When I read Frozen-Solid's post I just assumed he wasn't in the US due to HIPAA compliance issues. If he is, I wonder if there's a snitching bonus...

Frozen Peach
Aug 25, 2004

garbage man from a garbage can

Hughlander posted:

When I read Frozen-Solid's post I just assumed he wasn't in the US due to HIPAA compliance issues. If he is, I wonder if there's a snitching bonus...

I'm in the US, and to be fair nothing really incriminating shows up when I poke around my account. The worst it shows is claims they paid, and to who and a way to reprint my card. It's bad enough that I filled out a few "contact us" forms and made a few angry tweets, but not so bad that I think they're actually violating HIPAA.

Either way, they're working on a new site and the dev who emailed me obviously knew what he was talking about. It's enough to appease me until I see the new site launched, assuming it's soon like he claimed.

Malfeasible
Sep 10, 2005

The sworn enemy of Florin
code:
if(cargo.getPhoneNumber().trim() != null 
	&& cargo.getPhoneNumber().trim().length() > 0){
    //do something..
}
I had to debug some Java not too long ago and saw this right away. I knew I was in for a real treat. The usual mistake is forgetting to check for a null value, this was the first time I ever saw someone who didn't even know how.


Mistakes this obvious make me lose all confidence in the rest of the code so I ran a search through the code base looking for the pattern ".trim() != null" and found a handful of other cases.


I laughed out loud at the time, but the more I think about it I get angry considering how much restaurant work I've done while looking for IT work. How many employed programmers were writing stuff like this all that time?

Bhaal
Jul 13, 2001
I ain't going down alone
Dr. Infant, MD
This came up in /r/programming

C++ Examples: Returning a Pointer

It starts with:

--------------
Instead of a regular value or even a reference, a function can return a pointer. You can start to specify this by typing the * operator on the left side of the function's name. Here is an example:
C++ code:
double * GetSalary()
{

}
Then, use the body of the function to define it. Before the closing curly bracket of the function, remember to return a pointer to the return value. Here is an example:
C++ code:
double * GetSalary()
{
    double salary = 26.48;

    double *HourlySalary = &salary;

    return HourlySalary;

}

KaneTW
Dec 2, 2011

The real horror is that somewhere, that code is production code.

Opinion Haver
Apr 9, 2007

I don't know C++ at all, what's the horror?

zeekner
Jul 14, 2007

yaoi prophet posted:

I don't know C++ at all, what's the horror?

Returning the memory location of a local variable. Probably some other horrors too.

Bruegels Fuckbooks
Sep 14, 2004

Now, listen - I know the two of you are very different from each other in a lot of ways, but you have to understand that as far as Grandpa's concerned, you're both pieces of shit! Yeah. I can prove it mathematically.

yaoi prophet posted:

I don't know C++ at all, what's the horror?

The code only looks like it works. The functions are returning pointers that reference local variables - when a function goes out of scope, we stop tracking its local variables, and the memory used is on its own. You have no way of knowing if/when this memory is going to get munged later, the behavior is undefined and totally up to the system itself. This can lead to very hard to troubleshoot bugs - the compiler should warn you if you have warnings enabled about doing this.

But honestly, it's probably stupider that there is no explanation on the page about the use case for making a function return a pointer! Why bother telling how if the user doesn't know why he would want to do something?

Malloc Voidstar
May 7, 2007

Fuck the cowboys. Unf. Fuck em hard.

yaoi prophet posted:

I don't know C++ at all, what's the horror?
Floating point for a monetary value

shrughes
Oct 11, 2008

(call/cc call/cc)

Aleksei Vasiliev posted:

Floating point for a monetary value

Floating point for monetary values isn't necessarily a coding horror.

Adbot
ADBOT LOVES YOU

chglcu
May 17, 2007

I'm so bored with the USA.

yaoi prophet posted:

I don't know C++ at all, what's the horror?

To expand a bit on the other explanations: Conceptually, at least, in C and C++ local variables are stored on a stack. When they go out of scope, they are popped from the stack. Later, another variable may be pushed onto the stack that overwrites the one your returned pointer points to. While that's easy enough to understand, It's hard to debug since your pointer still points to something. It's just something totally invalid. Due to compiler optimizations it gets even trickier: The variable may have been stored in a register, not on the stack at all; the stack might be pushed and popped at weird times, etc.

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