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
LOOK I AM A TURTLE
May 22, 2003

"I'm actually a tortoise."
Grimey Drawer

Bongo Bill posted:

There are even fewer men in computers than women because men are larger.

Men in computers tend to be even larger than average. Makes you think.

Adbot
ADBOT LOVES YOU

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

Exactly, this is what I'm talking about. Look at those ladies perform system maintenance :swoon:

Germstore
Oct 17, 2012

A Serious Candidate For a Serious Time
"Why don't you come down and mount my disk- no, really- I mean mount my disk. I need those files."

omeg
Sep 3, 2012

C code:
ULONG SetVideoMode(int uWidth, int uHeight, int uBpp)
Why :negative:

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

omeg posted:

C code:
ULONG SetVideoMode(int uWidth, int uHeight, int uBpp)
Why :negative:

just to check I understood, is the issue here that they put "u" at the start of the variable names but they're signed integers?

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

omeg posted:

C code:
ULONG SetVideoMode(int uWidth, int uHeight, int uBpp)
Why :negative:

Part of the AT&T uVerse codebase? :v:

omeg
Sep 3, 2012

Hammerite posted:

just to check I understood, is the issue here that they put "u" at the start of the variable names but they're signed integers?

Yeah. I hate that poo poo. If you insist on using that awful notation at least keep it up to date.

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip


:stare:

evilentity
Jun 25, 2010
I'm a coding horror. Ive been working on my personal site/blog/portfolio thing and just couldnt get the loving flask-babel translations to work. They worked fine locally, but on the host only default language worked. After few days and some test apps, i was about to change my career to a bum, ive randomly decided to look at the files on the server. Compiled translation map or whatever that is, was missing. Since its compiled, ive ignored it in git. Turns out this isnt that great when your deployment consist of `git pull`. :suicide:

Munkeymon
Aug 14, 2003

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



Sulla-Marius 88 posted:

Just so I haven't misinterpreted this, you're referring to the overwhelming number of socially-maladjusted sexist IT workers who for some reason can't keep their worthless opinions to themselves, right? Rather than criticising 'radical feminists' yourself..

Pretty sure he actually thinks that those of us who understand that what MRAs would call 'biotruths' are just artifacts of a misogynistic patriarchy are actually misandrists and possibly gender traitors (for those of us who are male).

Holy poo poo - misogyny is in Opera's built-in dictionary but not misandry. Radical Feminism at work!

X-BUM-RAIDER-X
May 7, 2008

Munkeymon posted:

Pretty sure he actually thinks that those of us who understand that what MRAs would call 'biotruths' are just artifacts of a misogynistic patriarchy are actually misandrists and possibly gender traitors (for those of us who are male).

Holy poo poo - misogyny is in Opera's built-in dictionary but not misandry. Radical Feminism at work!

It's not men's fault if women make the decision not to embark on an IT career. The options are equal and fair, and having been through a fulfilling IT education myself, I see no reason to change it now. That would be like cancelling the Big Bang Theory because Penny's skirt was too short and offended the tumblr social justice brigade.

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

Munkeymon posted:

Pretty sure he actually thinks that those of us who understand that what MRAs would call 'biotruths' are just artifacts of a misogynistic patriarchy are actually misandrists and possibly gender traitors (for those of us who are male).

Holy poo poo - misogyny is in Opera's built-in dictionary but not misandry. Radical Feminism at work!

That's just what the coding horrors thread needed, another derail whereupon idiot IT workers in the bad code catharsis thread discuss critical gender theory while jerkin their gherkins into their fedoras. At least put some comedy into your shitposting if you're determined to turn every subforum into LF-prime.

Juventus stultorum magister:

A CODING HORROR:
code:
my $parser = Spreadsheet::ParseExcel->new;
my $excel = $parser->parse('range_3.xls');
my $range_sheet = $excel->worksheet(0); 
my ($first, $last) = (9, 281); #valid for the range matrix as of 04/09/2014
NOT A CODING HORROR:



A CODING HORROR:
code:
# round to one decimal place and
# separate into whole and fractional parts
parts = str(round(star_sum/num_raters, 1)).split('.')
whole = int(parts[0])
frac = int(parts[1])
if frac < 3:
___frac = 0
elif frac > 7:
___frac = 0
___whole += 1
else:
___frac = 5
# recombine for a star rating rounded to the half
stars = float(str(whole)+’.'+str(frac))
NOT CODING HORRORS:






In short, suck the fattest part of my rear end in a top hat!

No Safe Word
Feb 26, 2005

Oh man, Otto, you reminded me of that Leah Culver thing and that's just rude.

tractor fanatic
Sep 9, 2005

Pillbug
Has anyone worked with formally verifying code? Is it really that difficult to prove correctness for programs? With all the Heartbleed craziness it seems weird that critical crypto code that millions of users and billions of dollars rely on could be so badly written. Is it intractable to write a formally proven TLS library in C, or is mathematical correctness just not a high priority?

coffeetable
Feb 5, 2006

TELL ME AGAIN HOW GREAT BRITAIN WOULD BE IF IT WAS RULED BY THE MERCILESS JACKBOOT OF PRINCE CHARLES

YES I DO TALK TO PLANTS ACTUALLY

tractor fanatic posted:

Is it really that difficult to prove correctness for programs?
Yes.

quote:

Is it intractable to write a formally proven TLS library in C, or is mathematical correctness just not a high priority?
It's not intractable in the mathematical sense, but it is so expensive that no-one outside aerospace can be bothered.

e: Or rather, writing buggy software and dealing with the consequences is so cheap that no-one sees the point in paying for correct software. See also: various proposals for licensing software engineers.

Pie Colony
Dec 8, 2006
I AM SUCH A FUCKUP THAT I CAN'T EVEN POST IN AN E/N THREAD I STARTED

tractor fanatic posted:

Has anyone worked with formally verifying code? Is it really that difficult to prove correctness for programs? With all the Heartbleed craziness it seems weird that critical crypto code that millions of users and billions of dollars rely on could be so badly written. Is it intractable to write a formally proven TLS library in C, or is mathematical correctness just not a high priority?

Yes, proving correctness is very hard, especially when you are trying to prove correctness of a program written in a real programming language and not a convenient subset of one. But there are a lot of static analysis techniques that are practical and can fix those types of bugs.

baby puzzle
Jun 3, 2011

I'll Sequence your Storm.
The sketchiest if that I have ever seen:

code:
...
				const Rodb *rodb =  RumpusSubSys<RumpusObjectRepository>()->GetMatchRodb(objName);
				ASSERTF(rodb, ("RumpusObjectLoadQueue - trying to spawn object from queue that's not in rumpus database [ %s ]", objName.GetString()));
			
				RumpusObject* parentData = RumpusObjectRepository::GetRumpusData(m_curNodePtr->value.m_parentHandle);
			if( parentData )
				ASSERTF(rodb, ("RumpusObjectLoadQueue - Originate from object [ %s ]", parentData->GetRodb()->m_filename.GetString()) );

				GENIE_LOG( LOG_RUMPUS_CREATE, "RumpusObjectLoadQueue: [%d] Creating Rumpus Object %s : %d\n", count, objName.GetString(),  (uint32_t)frontObj.groupPortionId );
...

Strong Sauce
Jul 2, 2003

You know I am not really your father.





ASI is not some scary thing where the compiler will randomly inserts semicolons into your code. People just make it out to be bigger than it actually is.

I only bring up return for #1 because that's the only time I could see that rule ever applying. Where you decide to return an object and place the curly brace on the next line rather than next to the return. Because for all those other statements it makes no sense. Who writes a throw on two lines? If some beginner is writing a throw on two lines, there's bigger problems than the ASI. And when's the last time you actually had to apply an identifier to a break/continue? Then put it on a separate line?

If you are someone who writes a lot of javascript code you should be aware of these rules anyways and realize 0% chance you'll run into them.

pokeyman posted:

I write my C and C++ using trigraphs whenever possible. The rules aren't complicated, it's a simple step before preprocessing. I mean, just memorize this brief table:

OK, weird strawman argument to bring in.

shrughes posted:

I think optional semicolons are great because when you see somebody that thinks it makes sense to omit them or that semicolons are ugly, you'll be ready for superficialities in other opinions they hold, be it on encodings, design patterns, how to use version control systems, or radical feminism.
Eh, if the company I work for uses semicolons, I'm not going to argue against it. But at least _my_ company is consistent with it.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

tractor fanatic posted:

Has anyone worked with formally verifying code? Is it really that difficult to prove correctness for programs? With all the Heartbleed craziness it seems weird that critical crypto code that millions of users and billions of dollars rely on could be so badly written. Is it intractable to write a formally proven TLS library in C, or is mathematical correctness just not a high priority?

Heartbleed's bug isn't cryptographic, really. It'd have the same impact if it were in the HTTP server or whatever else that's widely deployed. There's been a lot of work done on model checking of crypto protocols (and that work has found real SSL problems, IIRC), but the gap between "model as specified" and "code as typed" is pretty big, especially when running in the same address space as other programs. AFAIK model extractors that work from the actual C source don't currently handle pointer algebra, so they would choke to death immediately on OpenSSL. (Or basically any other industrial C system.) My layman's understanding is that the kernel of things that can be effectively verified is growing at a decent rate, but there is still a long way to go until it can verify important properties when there are libcs and kernels and whatever else in the mix, even once the models expand to cover all of the intricate TLS specification.

https://alfredo.pironti.eu/research/sites/default/files/cf11.pdf has a pretty good summary of recent state of the art, IMO.

And of course, you get brilliant decisions like this one: http://article.gmane.org/gmane.os.openbsd.misc/211963

Theo de Raadt posted:

quote:

No. OpenSSL has exploit mitigation countermeasures to make sure it's
exploitable.

What Ted is saying may sound like a joke...

So years ago we added exploit mitigations counter measures to libc
malloc and mmap, so that a variety of bugs can be exposed. Such
memory accesses will cause an immediate crash, or even a core dump,
then the bug can be analyed, and fixed forever.

Some other debugging toolkits get them too. To a large extent these
come with almost no performance cost.

But around that time OpenSSL adds a wrapper around malloc & free so
that the library will cache memory on it's own, and not free it to the
protective malloc.

You can find the comment in their sources ...

code:
#ifndef OPENSSL_NO_BUF_FREELISTS
 /* On some platforms, malloc() performance is bad enough that you can't just
OH, because SOME platforms have slow performance, it means even if you
build protective technology into malloc() and free(), it will be
ineffective. On ALL PLATFORMS, because that option is the default,
and Ted's tests show you can't turn it off because they haven't tested
without it in ages.

So then a bug shows up which leaks the content of memory mishandled by
that layer. If the memoory had been properly returned via free, it
would likely have been handed to munmap, and triggered a daemon crash
instead of leaking your keys.

OpenSSL is not developed by a responsible team.

Another question might be "why write critical code in C?" The people who care about verified properties pretty much don't.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

Strong Sauce posted:

Who writes a throw on two lines? If some beginner is writing a throw on two lines, there's bigger problems than the ASI.

The code not doing what it looks like it ought to do, but following some crazy moon logic instead, is a bigger problem than someone making an idiosyncratic formatting choice?

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
Meanwhile people unironically dismiss Ada as a viable systems programming option because
  • static analysis can't catch EVERY error
  • we already wrote tons of code in C and it's worked so far
  • end is "harder to type" than }
  • "I know what I'm doing"
  • etc.
We're going to be stuck with C and lovely tools forever.

Alereon
Feb 6, 2004

Dehumanize yourself and face to Trumpshed
College Slice
While it seems like we are back on track, we will definitely not be continuing any derails regarding people's lovely opinions about feminism. As a reminder, if someone makes a post that you feel is an obvious troll or derail bait, report it and do not reply.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Strong Sauce posted:

I only bring up return for #1 because that's the only time I could see that rule ever applying. Where you decide to return an object and place the curly brace on the next line rather than next to the return. Because for all those other statements it makes no sense. Who writes a throw on two lines? If some beginner is writing a throw on two lines, there's bigger problems than the ASI. And when's the last time you actually had to apply an identifier to a break/continue? Then put it on a separate line?

People throw and yield objects as well as returning them. Why is that less reasonable than returning one? I guess you could have an "only throw primitives" house rule.

My reason for bringing up the additional cases is that "just understand it" seems like pretty facile advice, and it's not the cases that happen every day that cause problems. It's the unusual edges that you bump into where using the more consistent syntactic pattern helps you, because there are fewer "these 5 constructs are special" rules to keep in mind when minifying/transpiling/gluing together/refactoring/generating code/whatever. Doug Crockford and @fat collided this way in the jsmin/bootstrap thing, and whatever one might say about either's technical tastes, there is no lack of expertise. The issue there isn't that the JS parser does magic with ASI and [nlth], it's that every other tool (including humans) has to correctly deal with a more complex grammar.

Internet Janitor posted:

Meanwhile people unironically dismiss Ada as a viable systems programming option because
  • static analysis can't catch EVERY error
  • we already wrote tons of code in C and it's worked so far
  • end is "harder to type" than }
  • "I know what I'm doing"
  • etc.
We're going to be stuck with C and lovely tools forever.

Also, because it requires semicolons.

Zombywuf
Mar 29, 2008

Internet Janitor posted:

Meanwhile people unironically dismiss Ada as a viable systems programming option because
  • static analysis can't catch EVERY error
  • we already wrote tons of code in C and it's worked so far
  • end is "harder to type" than }
  • "I know what I'm doing"
  • etc.
We're going to be stuck with C and lovely tools forever.

Give it up, ADA is never going to be a thing outside the defence industry. Even there it's loosing ground: https://en.wikipedia.org/wiki/Lockheed_Martin_F-35_Lightning_II

Toady
Jan 12, 2009

Strong Sauce posted:

ASI is not some scary thing where the compiler will randomly inserts semicolons into your code. People just make it out to be bigger than it actually is.

I only bring up return for #1 because that's the only time I could see that rule ever applying. Where you decide to return an object and place the curly brace on the next line rather than next to the return. Because for all those other statements it makes no sense. Who writes a throw on two lines? If some beginner is writing a throw on two lines, there's bigger problems than the ASI. And when's the last time you actually had to apply an identifier to a break/continue? Then put it on a separate line?

If you are someone who writes a lot of javascript code you should be aware of these rules anyways and realize 0% chance you'll run into them.

Just use the goddamned semicolons.

necrotic
Aug 2, 2005
I owe my brother big time for this!
I had to look into an issue with a deploy that went out a week ago that caused our GC time to increase ~400% (why no one caught it at release is another story). After digging around for a bit, I found a change to a view partial for country selection for targeting purposes. Originally the partial was a select list of countries, nothing crazy. The updated version added a hierarchy of Continents, Countries and Regions (States or Providences), which doesn't sound to crazy except it ends up generating ~4,000 lines every time the partial is rendered (which is on every form related to targeting, or almost all of our forms).

After some profiling my theory was confirmed: the original partial had at most 1 GC invocation per 10 runs; the updated partial invoked GC at least 3 times for every render. Not to mention every render sorts every "region" for every country without caching the sorted region list. Oh, and render times went from ~60ms to over 1 second.

I'm still pretty upset this change got in, we're generally pretty good about keeping such horible performance hits out of our codebase (or at least mitigated through aggressive caching / client-side rendering)

Zombywuf
Mar 29, 2008

necrotic posted:

I had to look into an issue with a deploy that went out a week ago that caused our GC time to increase ~400% (why no one caught it at release is another story). After digging around for a bit, I found a change to a view partial for country selection for targeting purposes. Originally the partial was a select list of countries, nothing crazy. The updated version added a hierarchy of Continents, Countries and Regions (States or Providences), which doesn't sound to crazy except it ends up generating ~4,000 lines every time the partial is rendered (which is on every form related to targeting, or almost all of our forms).

This sounds so much like it could have happened in a company I used to work for. Well apart from the bit about the aggressive caching making the site faster, where I worked aggressive caching tended to make it slower.

raminasi
Jan 25, 2005

a last drink with no ice
This works as expected:
C# code:
var foo = customFooCollection[someIndex];
foo.SomeProperty = false; // SomeProperty is now false
This does not:
C# code:
customFooCollection[someIndex].SomeProperty = false; // This setter is apparently actually a no-op
I can't decide whether it's worse that a setter just does nothing without informing you (the docs say nothing about this), or that it only does nothing sometimes.

e: My original version used "true" in the first snippet but "false" in the second, but that was a brain fart.

raminasi fucked around with this message at 19:40 on Apr 10, 2014

necrotic
Aug 2, 2005
I owe my brother big time for this!

Zombywuf posted:

This sounds so much like it could have happened in a company I used to work for. Well apart from the bit about the aggressive caching making the site faster, where I worked aggressive caching tended to make it slower.

I... how? Is the cache stored on a floppy through a ethernet connection measured in baud?

tractor fanatic
Sep 9, 2005

Pillbug

GrumpyDoctor posted:

This works as expected:
C# code:
var foo = customFooCollection[someIndex];
foo.SomeProperty = true; // SomeProperty is now true

Is SomeProperty true for foo or for customFooCollection[someIndex]?

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

GrumpyDoctor posted:

This works as expected:
C# code:
var foo = customFooCollection[someIndex];
foo.SomeProperty = true; // SomeProperty is now true
This does not:
C# code:
customFooCollection[someIndex].SomeProperty = false; // This setter is apparently actually a no-op
I can't decide whether it's worse that a setter just does nothing without informing you (the docs say nothing about this), or that it only does nothing sometimes.

That seems weird. Are you sure that the behavior isn't like this (which is dumb beyond belief, don't get me wrong):

code:
private bool someProperty;
public bool SomeProperty  
{
    get { return someProperty; }
    set 
    {
        if (!value) return;
        someProperty=true;
    }
}
As far as I know, those two snippets you pasted should be functionally equivalent.

feedmegin
Jul 30, 2008

Zombywuf posted:

Give it up, ADA is never going to be a thing outside the defence industry. Even there it's loosing ground: https://en.wikipedia.org/wiki/Lockheed_Martin_F-35_Lightning_II

Ada is not an acronym...

raminasi
Jan 25, 2005

a last drink with no ice

tractor fanatic posted:

Is SomeProperty true for foo or for customFooCollection[someIndex]?

Well I assumed that they'd be the same, but what I think is happening based on my tea-leaf readings of other parts of the documentation is that the collection's indexer is actually kicking out a clone, and in the original, the property is read-only, but doesn't throw or anything when you try write to it. Most of this documentation is only "documentation" in the sense that Sandcastle created it, but it's not giving me any more information than just using Intellisense.

Ithaqua posted:

That seems weird. Are you sure that the behavior isn't like this (which is dumb beyond belief, don't get me wrong):

code:
private bool someProperty;
public bool SomeProperty  
{
    get { return someProperty; }
    set 
    {
        if (!value) return;
        someProperty=true;
    }
}
As far as I know, those two snippets you pasted should be functionally equivalent.

I have clarified my example.

ninjeff
Jan 19, 2004

GrumpyDoctor posted:

Well I assumed that they'd be the same, but what I think is happening based on my tea-leaf readings of other parts of the documentation is that the collection's indexer is actually kicking out a clone, and in the original, the property is read-only, but doesn't throw or anything when you try write to it. Most of this documentation is only "documentation" in the sense that Sandcastle created it, but it's not giving me any more information than just using Intellisense.

Looks like you're using a struct (value type) as the type stored in customFooCollection. You'll need to get an item out, change it, and then put it back into the dictionary to get that working correctly.

Munkeymon
Aug 14, 2003

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



Internet Janitor posted:

Meanwhile people unironically dismiss Ada as a viable systems programming option because
[list]

Ada isn't the language that either compiles and runs or, if you have any error, says 'No' without any explanation, right? I'd really like to clear that up if I have it wrong.

feedmegin
Jul 30, 2008

Munkeymon posted:

Ada isn't the language that either compiles and runs or, if you have any error, says 'No' without any explanation, right? I'd really like to clear that up if I have it wrong.

That's not a language thing, that's a 'my compiler is poo poo at reporting errors' thing. The language in no way mandates bad error reporting.

raminasi
Jan 25, 2005

a last drink with no ice

ninjeff posted:

Looks like you're using a struct (value type) as the type stored in customFooCollection. You'll need to get an item out, change it, and then put it back into the dictionary to get that working correctly.

The contained type is a reference type; if it were a value type, this wouldn't have compiled.

JawnV6
Jul 4, 2004

So hot ...

feedmegin posted:

That's not a language thing, that's a 'my compiler is poo poo at reporting errors' thing. The language in no way mandates bad error reporting.

no.

he's talking about prolog

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

necrotic posted:

I... how? Is the cache stored on a floppy through a ethernet connection measured in baud?

I've encountered a lot of caches that don't actually make anything faster. Common reasons include terrible cache implementations that take as long to look up things as looking them up in the database, caching things that take less time to compute from scratch each time than to cache, the cache getting invalidated too frequently to be of any real use, having to spend enough time ensuring the cache gets invalidated when needed that it ends up outweighing the speed gains, bad LRU implementations that slow down as the cache gets bigger and so appear great in tiny benchmarks but suck in real usage, and just plain never actually reading stuff from the cache.

A cache making things slower is of course still far better than the more common failure case of stale things being read from the cache. I tend to get twitchy when people propose Just Cache It.

Adbot
ADBOT LOVES YOU

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
Munkeymon:
code:
with Ada.Text_IO; use Ada.Text_IO;
procedure Hello is
begin
  Put_Line ("Hello, world!")
end Hello;
code:
red:ada ij$ gnatmake hello.adb 
gcc -c hello.adb
hello.adb:4:29: missing ";"
gnatmake: "hello.adb" compilation error
Seems pretty normal to me.

Ada isn't anything really weird or exotic- it's basically a beefed-up version of Pascal.

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