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
csammis
Aug 26, 2003

Mental Institution

xzzy posted:

As for the plugin problem, I don't even know what that means. After you get syntax highlighting (and vim ships with rules for just about every language), what else is there?

Tons of stuff. I have a very lightweight vim configuration and still have plugins for autocompletion and showing the git diff in the line number gutter. I guess whether you find plugins useful depends on where you want to draw the line between portability (since not all vim installs will have your special snowflake setup) and creating a personalized IDEish experience for yourself.

Adbot
ADBOT LOVES YOU

csammis
Aug 26, 2003

Mental Institution
Try the Working in Development: Unironic Agilefall thread for good times

csammis
Aug 26, 2003

Mental Institution
Code looks like a mad doctor turned Wordpress inside out.

Did you pry that code off a dead Cold Fusion developer or what?

Radium-rear end code.

csammis
Aug 26, 2003

Mental Institution

xzzy posted:

UNIX almost managed it with epoch time

Ah yes a single standard computing epoch!

:suicide:

csammis
Aug 26, 2003

Mental Institution

Klades posted:

Now you have me imagining a Java programmer trying to code in C++ without bothering to understand the differences, just slapping down java code and changing it until it compiles.

code:
class Foo {
  public: Foo (void);
  public: int get_bar (void);
  public: void set_bar (int);
};
etc

This programmer is not imaginary :smith:

csammis
Aug 26, 2003

Mental Institution
Only when all tokens are whitespace will we have achieved enlightenment

csammis
Aug 26, 2003

Mental Institution
Whitespace is the only language which exhibits Buddha-nature, for it is indistinguishable from no code at all

csammis
Aug 26, 2003

Mental Institution
I was really tired at the end of the day earlier this week and wrote

code:
std::vector<unsigned char>::const_iterator index;

...

char* ptr = reinterpret_cast<char*>(const_cast<unsigned char*>(&(*index)));
I must've really wanted that char* :psyduck:

csammis
Aug 26, 2003

Mental Institution
Just use non-printing ASCII characters for the delimiters, duh. No one's never going to type an ASCII ACK!

*starts accepting non-ASCII content*

:suicide:

csammis
Aug 26, 2003

Mental Institution
Let's not miss the horror where the cache was being updated with written values despite the hardware write apparently failing


e: fb

csammis
Aug 26, 2003

Mental Institution

NihilCredo posted:

Nullos non patieris vivere. There are very, very few reasons to allow nullable columns in your schema to begin with. You'll live much happier if you can assume NULLs only come from unmatched outer joins.

The only use case I could ever think of in which nullable columns were even a little okay was a "modified date" where the business case stated that if a record had never been modified the UI should be presented as blank. It was nicer to allow that value to be NULL rather than have defined a sentinel value or introduced display logic in which "if modified date == created date then modified date is blank"

But yes even this could have been solved by evolving the schema into an even more normal form :c00l:

csammis
Aug 26, 2003

Mental Institution

Spatial posted:

No, but this isn't something I do professionally or at scale. What's wrong with it?

Let's say when a user accesses a Person record they always want to know whether or not they're dead, so every retrieval of a Person from the database requires a JOIN to Person_Death. That means the Person_Death table is as hot as Person, which means space for another table on what may be an expensive storage medium...but a DBA maintaining this schema might not necessarily realize that and put Person_Death on a slower but cheaper storage. Whoops, now all Person retrieval is only as fast as the Person_Death storage!

Getting a more into long-term database design, you may want your Person table to be partitioned by whether or not a person is alive or dead. It might make sense for records corresponding to living people to be on a faster storage medium and dead people can be on nearline storage - accessible, but slower. A DBMS can manage table partitioning by a date column but that date column needs to exist on that table*. "Pfft, just keep a flag on the Person table indicating whether they've died and partition by that"...okay, but now you've violated a ~perfectly normal~ form and you still require a JOIN to get the information that a human probably wants anyway.

"Properly normalized" databases are great in theory. In practice you make a schema that makes sense for your use cases. Normalization and denormalization both have their place in the world.

Dylan16807 posted:

You need special display logic either way so even in that scenario using NULL instead of 0 doesn't buy you much.

I'm not a UI guy at all so don't hold me to this, but shouldn't data binding to an unset field just work? Requiring a client side data binding to understand that a certain sentinel value means "no date" sounds like a horror to me.


* edit: I'm like 98% positive about this. A DBMS might be able to manage table partitioning by information that's not actually on that table but if so that's awfully strange and almost certainly less performant. Oracle probably touts it as a flagship feature :smith:

csammis fucked around with this message at 00:07 on Apr 29, 2017

csammis
Aug 26, 2003

Mental Institution

return0 posted:

Is person to death date one to one?

Good question! We've been assuming one to zero or one to one, but your business case might state that nope a record in the main Person table (as opposed to in an historical table / data warehouse) has to maintain a one to many relationship to death date. But hey, now that implies that person to birth date is also one to many, unless you're drawing a distinction between a person becoming not-dead and a person being born in which case you need yet another field to record a 1-many dead-to-alive transition date versus a 1-1 being born date...but is there a medical case in which someone has been recorded as born multiple times? gently caress it, let's make a LivenessStateChange table with a columns for event date and event type (UnbornToAlive, UnbornToDead, AliveToDead, DeadToAlive, etc.) and one-to-many the relationship between Person to LivenessStateChange.

If this conversation doesn't make you sad about databases then you should become a data architect for Cerner or Epic because I guarantee this argument has been had before :smith:

csammis
Aug 26, 2003

Mental Institution
Like literally everything else in the entire job-seeking discussion, it depends on the company. I know that I got my current job because I had pet embedded dev projects on my Github and I was able to talk passionately and in detail about them. The hiring manager and his manager talked with me about those projects at length in the interview, and since I had next to no professional experience in the field that was all we could go on.

csammis
Aug 26, 2003

Mental Institution

Spatial posted:

A couple of days ago I came across this line which made me double-take:
C++ code:
*(volatile unsigned int*)(0x28000000 | ((3<<4 | 2) << 13);
What does this do? This is from an embedded system. It talks to an SDRAM chip via the address pins. The magic numbers "(3<<4 | 2)" are the operating mode: CAS latency 3, bursts of 4. I still don't know what the shift by 13 does since there are only 15 address pins, but it doesn't work if the shift is not there.

It works out to 0x28064000...is that address aliased to a region that maps to the SDRAM with those specific parameters? :psyduck:

edit:

Jabor posted:

Are you sure it's 3 and 4 that are the parameters there? I would have thought that it's the 3 and 2, and the shift by 4 is to put the 3 in the right bits.

I would think that too but I also wouldn't think that an MCU would do what I suggested above anyway. The parts I've worked with have discrete modes for setting the timing parameters prior to reading and writing.

csammis fucked around with this message at 03:06 on Mar 6, 2018

csammis
Aug 26, 2003

Mental Institution
“Float”?

csammis
Aug 26, 2003

Mental Institution

areEqual :colbert:

csammis
Aug 26, 2003

Mental Institution

I have two shirts with this

csammis
Aug 26, 2003

Mental Institution

feedmegin posted:

My most recent fun one was a bug in the hardware specification of the RAM being accessed by the Cortex-M0 on the FPGA for which I was writing firmware, where the byte lane enable signals on the data bus weren't routed properly so all loads and stores were 32 bits even if the machine code was intending to do 16 or 8. Actually worked almost fine because most of the variables in the firmware were in fact 32 bits, but then I'd put a char variable on the stack or something and variables around it would mysteriously get corrupted.

This exact problem but it was our EDA librarians who created the RAM component symbol with byte lane enable signals as swappable when in reality they weren't. Most projects didn't have an issue because the person doing the PCB routing happened to pick the right order because it happened to be easier for the layout.

Guess whose project didn't guess correctly :suicide:

Spatial posted:

Current favourite bug: Low power microcontroller's sleep state from which it is able to wake 999,999 out of 1,000,000 times.

This is one too few times. Once it stops waking up it stops responding to any stimulus, internal or external. It's impossible to debug because you can't enter sleep states when a debugger is connected and primarily controlled by a hardware FSM. Added bonus: even the system watchdog ceases to function.

Hardware guys' opinion: You're holding it wrong

Workaround: Don't go to sleep, increasing power consumption by a factor of 500

Sounds like it's time for a fun chat with the vendor!

csammis
Aug 26, 2003

Mental Institution

quote:

OOP code is non-deterministic — unlike with functional programming, we’re not guaranteed to get the same output given the same inputs. This makes reasoning about the program very hard. As an oversimplified example, the output of 2+2 or calculator.Add(2, 2) mostly is equal to four, but sometimes it might become equal to three, five, and maybe even 1004. The dependencies of the Calculator object might change the result of the computation in subtle, but profound ways. OOPs…

Goofus the object-oriented programmer codes his addition operator to return random values.

Gallant the functional programmer would never change the implementation of a function :smug:

csammis
Aug 26, 2003

Mental Institution

JawnV6 posted:

the best part of atwood's visit was him latching onto forums user Victor as the sole voice of reason amongst a bunch of nay-sayers

Agreed, I vaguely remembered that thread and was glad to re-read it. Oh Victor :allears:

csammis
Aug 26, 2003

Mental Institution

Thermopyle posted:

That might be better than a check engine light that flashes at you for every possible reason from the minor to the major. Maybe?

It’s not like a message about BAD SECTORS is more actionable to the driver than a check engine light, or even more understandable to most people.

csammis
Aug 26, 2003

Mental Institution

netcat posted:

I feel like I'm one of the few people who don't mind meetings that much because it's a nice break from having to stare into a glowing rectangle all day.

:same:

csammis
Aug 26, 2003

Mental Institution
I think you missed the “arbitrary number of 72 character-wide lines” part. No one’s saying you’re limited to exactly 72 characters after a 50 character subject line.

It’s still a stupid loving rule.

csammis
Aug 26, 2003

Mental Institution

pokeyman posted:

The couple times a year when I do that last one, I immediately spend an hour making the build faster in penance.

What’s faster than not running the build? :confused:

csammis
Aug 26, 2003

Mental Institution
“Hey csammis, we need you to take over this feature. The guy who wrote it is gone and the guy who tried to fix it can’t get it finished.”

It’s all C++-without-classes functions with no fewer than 21 parameters, some of which are references to pointers to objects with still more parameters.

I think I know why the feature’s been orphaned

csammis
Aug 26, 2003

Mental Institution
The person who approved the feature is also no longer with the company :v:

csammis
Aug 26, 2003

Mental Institution

Volmarias posted:

I hope you had a very delicate conversation with your boss about how this is going to require an outsized amount of time, either in fixing it, or completely rewriting it.

In fact the opposite! It’s so loving bad that my boss convinced the product manager that it is absolutely critical that we refactor or rewrite this before adding the new pieces they want because multiple engineers have taken a stab at it and failed. It’s the textbook definition of unmaintainable and it’s a pretty important feature for the product. I was asked to be the fixer and given five months.

Tei posted:

It would be fun to document how is actually used. Maybe you can mark the methods that are really in use.

This is how I started yesterday - I was hoping I could just begin by cutting entire chunks. No such luck.

quote:

the whole codebase is dumb poo poo.

In all of the rest of my company’s engineers’ defense, the vast vast vast majority of our codebase does not look like this. The feature in question is thankfully not foundational. If it were, :sever:

csammis
Aug 26, 2003

Mental Institution
I’ve worked for a company that went into git submodules so hard that wouldn’t be unusual to have a superrepo with at least a couple hundred of them. None of them used semantic versioning, or a coherent feature / bug fix branching scheme, and you’d better believe there were interdependencies. Like DLL Hell all over again but it would take half a day to update submodules and get a good build going.

csammis
Aug 26, 2003

Mental Institution
Dehumanize yourself and face to ten levels of indent

csammis
Aug 26, 2003

Mental Institution

Tei posted:

I like the C++ way.

I also like to see the world burn, no relation.

This is a loving pro tier post, just outstanding :golfclap:

csammis
Aug 26, 2003

Mental Institution
...well, is there?

csammis
Aug 26, 2003

Mental Institution

Zopotantor posted:

IIRC the original BASIC had an OPTION BASE 0/1 command, checks out.

This was true through VB6 :eng99:

csammis
Aug 26, 2003

Mental Institution

Sagacity posted:

Yes, having the URL hashcode method do a DNS lookup definitely means that the entire language and standard library is trash.

Yeah if anything it’s the fact that the entire language and standard library are trash means that the URL hashcode method was destined to be trash too

csammis
Aug 26, 2003

Mental Institution
If we accept the axiom that all code is bad and that to write code is a sin, then von Neumann, Turing, Backus, Lovelace, Hopper, etc. are the greatest sinners of them all

csammis
Aug 26, 2003

Mental Institution

I had to check the date on this tweet because I discovered the same msvc “limitation” in 2009ish. I think it had something to do with automated code generation for a JNI bridge.

Adbot
ADBOT LOVES YOU

csammis
Aug 26, 2003

Mental Institution

Jen heir rick posted:

This is really a database horror than a coding horror isn't it? Not that it matters, poo poo still sucks.

What is a database but coding horrors made manifest

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