@pjh They're all different from each other; they've got different numbers written on them. GENIUS!
Best posts made by dkf
-
RE: Spot the difference: Chickens.
-
Shuffling off this mortal coil
One of our (thankfully now former) developers was writing some code to randomly distributed things over a grid. That developer was someone who loved to write what he thought were super-fast algorithms that were simultaneously as Pythonic as possible. He never met an advanced feature of a programming language that he didn't want to work into what he was doing, whether or not it was useful, and Python is a language that gives you a lot of rope for mischief indeed. Why would you use classes when you could use something custom? Why would you write a simple sort when you could use a complex list comprehension instead? His code was often extremely short and had a beautiful surface reading, yet would open great chasms of bewilderment once you poked under the covers.
Now, the grid was of reasonable size, but 256×256 really isn't exactly massive. The only real nuance was that the things that were being distributed would sometimes be much fewer than the number of grid cells, and other times would end up needing to cover the whole grid; a few orders of magnitude of difference in the number of items.
Now, there's a well known algorithm for doing random placing of a dense collection: shuffle the items or the places and just match them up against each other. It's been around forever and is pretty simple: shuffle the grid points in a big list and then match off against the set of things to be placed. It takes linear time; nice and efficient, no surprises. The only time you ought to consider picking anything else is when the number of items to place is much much smaller than the number of points you could use, when you'd pick random places and hope that there were no collisions. That'd happen some of the time with our application, but often there'd be a lot more loading.
But the developer in this little story just couldn't see past the fact that that algorithm would need to quite a bit of work in the case that there were very few points, so he decided to use the random selection algorithm for all the items. He'd just kept a set of locations that he'd already used and retried placing if the point had already been used.
Sure, his code worked fine with the test cases he ran, and was extremely fast. But as the number of points increased, things would go strange; the amount of time to place the items would increase massively. (What was happening was that as the number of used points increased, the probability of choosing an unused point would decrease and the number of iterations would increase. Massively so, as the target loading factor approached 1.) This was unacceptable! Being under a bit of pressure due to his impending departure for pastures new, and unwilling to admit that an up-front shuffle would be better, he came up with a “clever” adjustment to his algorithm to stop the infinite looping problem. He put an upper bound on the number of iterations used. That pesky apparently-infinite loop gone: the amount of work required was now strictly bounded and everything was fine!
Our (enormously more competent) intern had a good look at this code yesterday, and noticed that it would tend to not place all the items; a random selection would simply get forgotten. She realised that the code, which could have been using that classic shuffle and been working correctly with a few hours coding, had instead started out using a Bad algorithm (which would produce a right answer eventually) and then, under mild pressure, had been converted to a Fail of a non-algorithm that didn't produce even a vaguely correct answer.
I don't remember our intern actually facepalming before.
Our former developer's code is gradually being converted into things that work with more conventional code and less crazy, and in the process is becoming often orders of magnitude faster. Smartass coding is all very well, but paying attention to what costs and what you can cache actually works better.
-
RE: Guy leaves programming career because he wants to change the world... meditating
@Jarry said in Guy leaves programming career because he wants to change the world... meditating:
he decided he wants to make the world a better place, meditating.
Well, if he's stopped writing shit that other poor folks have to maintain, he will have made the world a better place.
-
CSVs ought to be in ASCII
Sometimes, Microsoft just makes you wonder what they are thinking.
I happen to have some code that generates a CSV that contains, among other things, a list of student names (it'll also contain automatic marking info). Some of those student names contain diacritics (because that's how things go). No big deal, just make sure the CSV is written out as UTF-8 (the system encoding on Macs and Linux) and write it out like that. Job done.
Then double-click on the resulting file to open in Excel for Mac to get the mojibake experience! Because when opening a CSV you don't use the platform's default encoding! It doesn't even work when you put a BOM at the beginning of the file or choose an explicit import using UTF-8 (unless you like the diacritics converted to underscores). Huh.
What about if we export a file from Excel with these characters in? Surely that will work. Well, on output it generates the file using Mac Latin (:WTF:?! Nobody else has used that in the OSX era.) and when reading it back in, the same file it generated, it really assumes that it's CP1250, the Windows Western European encoding (a.k.a., not-quite-ISO8859-1). Well done, Microsoft, you've made some software that can't even round-trip with itself let alone with any sane tool, at least not without making a whole bunch of twiddly adjustments along the way.
What's better, the bug report on this has a truly pathetic corporate response:
Excel for Mac does not currently support UTF-8.
If this is a feature you’d like to see in future versions of Office for Mac, be sure to send your feedback by clicking “Help” > “Send Feedback…” in any Office application or by clicking on the link below:
The link is the standard feature request one. Total failure to understand what is going on here. Idiots.
-
RE: The International Space Station is finally getting a printer upgrade
@gąska said in The International Space Station is finally getting a printer upgrade:
They're one of the most technologically advanced organizations in the world. Why print out anything?
They are part of the US Government. They have to print things out to show that they are conforming to the Paperwork Reduction Act.
-
RE: Which is better? Australia or Maths? There's only one way to find out....
@pjh He ought to try repealing the Law of Gravity and then proving his success by stepping off the top floor of a high building.
-
RE: In other news today...
@PJH Sounds like they've emulated the behaviour of human BMW drivers perfectly!
-
RE: WTF Bites
@tsaukpaetra said in WTF Bites:
"C:\WINDOWS\system32\rundll32.exe" Shell32.dll,Control_RunDLL input.dll,,{C07337D3-DB2C-4D0B-9A93-B722A6C106E2}
DISCOVERABLE!
-
RE: Signs your code is unmaintainable
For a bad code practice, the monkeypatching done widely in the Ruby-on-Rails community is a classic example of how something that makes things appear easier on the surface can really shit on long-term maintainability. The core of the issue is that it makes things so massively magical that when things go wrong, it's very hard to figure out ways to fix them in a sensible amount of time/effort. You end up with something that starts out great but progressively converts into codethulhu's pet black hole and nobody can figure how you got there because every step along the way seemed like a great idea at the time.
-
RE: Paying developers to maintain code loses money! We need more outsourcing!
@Magus Just half? Things are better than I thought!
-
RE: WTF Bites
@cartman82 said in WTF Bites:
Yesterday's job candidate brought dog to a technical interview. HR lady says, "they worked together on the task".
They gave up after an hour.Hire the dog. Just the dog.
-
RE: What users say versus what they mean
@pie_flavor said in What users say versus what they mean:
Absolutely nobody reads the error boxes unless someone tells them to.
QFT
One of my coworkers used to maintain a system that actually produced good error messages. He would have conversations like this with a particular one of his users multiple times a day…
The service isn't working.
What did the error message say?
Oh. Thank you. I see what I did wrong.Yes, that user was definitely smarter than average.
-
RE: In other news today...
@scarlet_manuka said in In other news today...:
@boner said in In other news today...:
'Don't call police over KFC crisis'
@boomzilla said in In other news today...:
Woman Pretended to be Undercover Agent So She Could Get Chick-fil-A Discount, Prosecutors Say
... People take their fast food chicken way too seriously.
The KFC thing here is a classic (though calling the police over it is still ). Apparently, KFC changed their supplier of logistics for moving the chicken from the abattoirs to their franchises; it'd previously been some specialist provider that I'd not heard of, but now is DHL who undercut the other firm. Despite not actually knowing the faintest thing about moving many tons of fresh chicken a day. As you might quickly guess, it's a total fustercluck, with vast amounts of now unusable chicken accumulating at a single warehouse that's not large enough or certified to handle this sort of thing, and those KFC franchises are now without their chicken. Plenty of blame on the managements of both DHL and KFC, and very little sympathy from anyone else.
Who knew that temperature- and time-sensitive food logistics in a just-in-time delivery chain isn't exactly the same thing as moving a few parcels? Next up, we'll end up with someone suggesting that management needs to know something about the business they're in charge of, and the whole world will come to a juddering end…
-
RE: Software disenchantment
The thing is… we're the people to blame for this. Anyone who just slaps shit together and then wraps it all in layers of indirection to hide the shittiness is entirely to blame. Using your latest cool language to generate WASM that you then put inside Electron to deploy to users? YOU ARE TO BLAME! You could have just generated native code from the start and not had nearly so many performance problems.
I work with systems that are swimming against this tide of shit. We have hard limits on memory for code on our main system (32kiB per core, no negotiation; embedded C and ASM are the only options) and our controller system (which isn't memory limited in any sane way) is being ported away from horribly wasteful systems (Python) to things that give far better performance (Java, which we've measured to be really fast in practice). We do things that are much closer to the limits of what practical computation can achieve, but doing so requires ditching those lazy bad habits and actually studying the performance of what's happening in reality. That's pretty hard, but we just gotta suck it up because we're software engineers and not just a bunch of code monkeys.
The code monkeys can have a few peanuts.
-
RE: WTF Bites
@ben_lubar said in WTF Bites:
Obviously the correct solution is to use a programming language with a 2-letter name.
I'm gonna use a three-letter abbreviation as the name for my next language: it's going to stand for @dkf's Lovely Language…
-
RE: WTF Bites
Which dumbass configured that shit?
Whenever I ask that question, I then quietly check to see if it was myself a few years ago…
-
RE: OOP is TRWTF
@boomzilla said in OOP is TRWTF:
obviously he was shilling for FP,
Better than that, he appeared to be saying not only that OOP isn't a magic bullet, but also that FP instead is a magic bullet. Which elevates him from the Usual Fuckwad category into the Snake-Oil Salesman category. This industry has far too many purveyors of snake-oil, and over and over we find that the best approach is one that uses a mix of techniques, applying each when it makes sense but never pretending that any of them is a universal hammer.
But a sensible balanced approach doesn't make for epic rants or sell expensive seats to lectures.
-
Procurement also has it's WTF moments
I was talking to an acquaintance yesterday. He's a purchasing manager, and he told me of this little tale which happened recently. Apparently, they were organising a coordinated acquisition of a lot of expensive kit (electron microscopes, etc.) and so were having a big get together between the purchasing people and the various vendors who were interested in trying to supply this group. So far, so ordinary. (Far quicker to do this than to get every last damn supplier to come and listen to what you have to say in their own special meeting.)
The WTF moment was when my acquaintance stood up and said that the criteria for selecting the supplier would be price and quality of product/support, because that got an immediate complaint from one of the suppliers that these were unfair and unreasonable criteria. Apparently this floored my acquaintance for a few seconds (a rare thing!) and then he responded “Well, what other criteria would you propose we use? Colour of logo? Number of ‘R’s in the month?”
-
RE: WTF Bites
We had some “fun” today. My current project is about working with some… funky… hardware that is designed to scale up rather larger than you're average Intel-based system. It's instead based on a very low power version of an ARM core, and in particular, it lacks hardware floating point and memory protection and has a complex internal protocol for communicating between the cores on a chip, the chips on a board, and the boards that make up an overall computer. The plus side is that we have test systems with around two hundred cores on a desktop and can power the whole lot with a standard wall wart. :)
Anyway, enough scene-setting.
We were debugging this weather simulation (a cut-down proof of concept that we're doing to prove that porting the real thing to our production system — a monster with close to a million cores IIRC — is feasible). It was crashing during the launch of the program that we'd uploaded onto each core, during the boot up of the communications library. This was weird as the comms library had basically not done anything at all at that point, not even had the IRQs switched on. Some debugging later, and we found that we had a variable with an unexpected value in it;
-2
just isn't the same as-1
. :(Except the variable hadn't ever been assigned to at that point; it was getting the wrong value either from a compiler bug (!) or a runtime library bug (!). A quick scan of the binary itself cleared the compiler (the correct value was in the
DATA
section) yet if we put aprintf()
as the first statement inmain()
the variable had the wrong value; the runtime was definitely at fault despite the fact that it was in use in lots of other programs just fine.In the end, we tracked it down to whether any of the program included a very particular mathematical operation. It turns out that any program that has a divide in it is unable to communicate at all, tripping the whole comms library into a panic instead.
Why a divide cause this? Well, remember that we don't have hardware floating point. Instead, we use fixed point arithmetic that is much faster on the hardware that we have except for divides which are criminally slow. (We also have a real numerical analyst on staff.) And it turns out that the implementation of the division code must do some sort of setup in the runtime (I had to leave for my train before we'd finished digging in that far) that scribbles over a part of memory that happens to be used by the comms code to store its current state, throwing that into a situation where it can only recover by crashing hard. (The system monitor — a dedicated CPU — then picks up the pieces, sending things like most of the contents of memory back to the development harness.)
All well and fine, but it's still a moment when changing a
/
to a+
in code that isn't run at all (but still linked in in a way that the compiler can't optimise out) changes your program from crashing to working. ;) -
RE: A fool and his not-really-money are soon parted
@dragnslcr Do you think that giving Lorne some defunct cryptocurrency would count as simultaneously both “fuck you” and “give you money”?
-
RE: Google wants to make e-mail more "interactive" - what could possibley go wrong?
@pie_flavor said in Google wants to make e-mail more "interactive" - what could possibley go wrong?:
I don't fucking believe it. Goatse is now a cryptocurrency.
They must've seen a… gap… in the market…
-
RE: The absolute state of faxing in 2020
@MrL said in The absolute state of faxing in 2020:
Once we were building a frontend for a bank - I was seriously asked why we bother with some stupid shit called .Net, why not write it all in Cobol, like normal people.
I heard of a bank (in the early 1990s) claiming in court that they wrote everything in assembler because then any bugs would immediately crash the program instead of doing damage, with the obvious corollary (in their eyes): if it runs, it must be correct. By that point, I already knew that the difference between low-level and high-level languages is that low-level langs give whole extra layers of bugs that the high-level ones prevent while not actually getting rid of any high-level bugs, so the “if it runs, it must be correct” attitude has always rankled. Even now, with the most sophisticated of languages, “if it runs, it must be correct” only applies in the simplest of cases. There are many possible programs that will exactly calculate the wrong answers in some cases.
-
RE: WTF is happening with Windows 10? And nothing else
Holy run-on sentence, Batman! Dude, do you ever remember to breathe?
-
RE: Another day, another cryptocurrency clusterfuck
@dcoder said in Another day, another cryptocurrency clusterfuck:
A key part of Ethereum is "smart contracts", small programs you write to process funds.
Random users are writing and sending around programs to handle money? Crikey! There's no way that could possibly go wrong…
-
RE: WTF Bites
Jumping to every pre-alpha buggy turd in sight and using it for mission critical stuff seems to be the default mode for average programmer.
Q: How do you distinguish an average programmer from a good programmer?
A: Show them npm and the JS ecosystem. If they run screaming, they're a good programmer. -
RE: The FROM Clause
@blakeyrat said in The FROM Clause:
deleted to protect the innocent
The creator of this is anything but innocent.
-
RE: JAVASCRIPT OUTDATED JAVA OVERRATED LONG HAVE WE WAITED PYTHON ACTIVATED
@Maciejasjmj said in JAVASCRIPT OUTDATED JAVA OVERRATED LONG HAVE WE WAITED PYTHON ACTIVATED:
Fuck you, here's a
ten-pagevideo guide with three whole sample applications that do random shit unrelated to the library you're using, go find it.FTFMillennialFuckYous
-
RE: The Official Funny Stuff Thread™
@arantor said in The Official Funny Stuff Thread™:
English is too complex to generalise and even somewhat specific generalised rules have exceptions
English uses an entirely rule-based spelling system. Usually it uses one rule per word…
-
RE: Apple stand
@dcon said in Apple stand:
LOL, yup! My Lenovo monitor came with a (plastic) adjustable stand. It's stayed in place quite well for the last 5 years...
And there I am using two reams of cheap paper as a monitor stand like a chump!
-
RE: News flash, Stack Exchange sites are run by jackasses
@kt_ said in News flash, Stack Exchange sites are run by jackasses:
"Comments aren't permanent, deal with it."
Best response possible: “Comments would be permanent if you didn't delete them.”
-
RE: The Official Funny Stuff Thread™
@Tsaukpaetra Yes, if you''re going to split hairs.
-
RE: The Official Funny Stuff Thread™
As told to me by my parents over the weekend…
“If he wants a mandate, he should use Grindr instead of screwing the rest of us.”
-
RE: The most important part of selling a product: having a product
@ScienceCat said in The most important part of selling a product: having a product:
"Re: Re: Re: Re: Re: Re: Fw: Re: Re: Fw: Re: Re: question".
You need some bonus Germans in there: "Re: Aw: Re: Re: Aw: Re: Aw: Re: Re: Fw: Re: Re: Aw: Fw: Re: Re: question"
-
RE: Programming Confessions Thread
@dfdub said in Programming Confessions Thread:
Every week, I go through the history of the modules I've written to find out whether someone has done something obviously stupid.
I'd do that except I'm afraid of finding that the idiot doing that obviously stupid stuff was me a few months ago…
-
RE: The Official Funny Stuff Thread™
@boner said in The Official Funny Stuff Thread™:
There are times when I think that that's definitely my orientation…
-
RE: In other news today...
@PJH said in In other news today...:
‘FTP’ is a commonly used acronym for ‘f**k the Pope,’ a phrase used often by some fans of Rangers Football Club, whose supporters go by the nicknames of ‘bears’ and bluenoses.’
I also find “FTP” offensive, but in my case it is because of its poor security and horrible behaviour w.r.t. NAT and firewalls.
-
RE: Firefox Quantum WTF Of The Day
@dcon said in Firefox Quantum WTF Of The Day:
You do not want in the toolbar.
Awww. The hamburger's fallen over and it's top is coming off… :(
-
RE: Do not upgrade
@Gąska I get the vague impression (at a disinterested distance) that it's some sort of virtualized server cluster manager, and that it is used to add modes of failure to your software stack.
-
RE: WTF Bites
Or, perhaps more accurately, it was rather 3D and unfond of squishings in it's original state, before going through the shipping process.
It's rumoured that the atom was originally split by simply shipping it through the post in a box marked FRAGILE.
-
RE: WTF Bites
We even are required to jot down who sat where exactly, name and timestamps for every time someone goes to the toilet and who is requesting how many additional sheets of paper.
Do you also need to write down how soft the paper was?
-
RE: Internet of shit
@pie_flavor said in Internet of shit:
Only to the extent that you get paid for sitting there and tapping at a keyboard.
I remember this from when they were trying to standardise the job roles at work a few years ago. The people doing this exercise wanted to characterise all IT and programming support as just “uses a computer”, just like a basic secretarial role. The response of the whole department, from new hires to senior managers, was basically “you fucking what?”
-
RE: WTF Bites
@Cursorkeys said in WTF Bites:
It's a chat client! What the hell is in there.