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
baquerd
Jul 2, 2007

by FactsAreUseless
That reminds me of the time where I had to fix a compiled binary using only sed and io redirection.

Adbot
ADBOT LOVES YOU

tef
May 30, 2004

-> some l-system crap ->

rrrrrrrrrrrt posted:

How many of the people claiming to "only" use a text editor have enough plugins loaded up to effectively make them IDEs? Even when I'm using Sublime or Emacs I usually have enough features loaded in (incremental compilation, REPLs, syntax highlighting, goto def, snippets, tags, etc.) that they're effectively mini-IDEs.

I'm really lazy and I use a stock text editor, usually configured with the indentation settings of the language i'm using. I'm too much of a curmudgeon to use syntax highlighting. If I'm using something like Java though, I will use an IDE. I tend to write very small programs, in smaller discrete chunks, so I thankfully haven't had to use bells and whistles to navigate around a project.

Other peoples code makes we wish I had an IDE, well wish I didn't have to deal with it.

npe
Oct 15, 2004

Thermopyle posted:

I'm open to being talked out of this, but my position is that people who think dynamic language IDE's don't do Feature X from their favorite static language IDE just haven't surveyed the field very well.

IDE's for dynamic languages can be 99% as good as ones for static languages. It's just not as easy to create such an IDE and thus a larger portion of the IDEs available for dynamic languages don't do what you want.

I was going to say "just look at PyCharm", but I'm not sure I want to go down the rabbit hole of figuring out how exactly to compare whatever abilities you think a static language gives to an IDE for that language to whatever ability you think is the equivalent for a dynamic language.

There's not really a way to have this discussion without turning it into a static-vs-dynamic shitfest, sadly. The main thing I use an IDE for in C#/Java, is for that instant feedback that the thing I just typed will actually compile. And "it compiles" in perl is kinda worthless, because misnamed methods in perl compile just fine. So now you're forced to try and use on the fly eval of code to guess if something is legit, but this isn't always possible - what if I'm relying on loading in some external resource to determine the name of that method?

Anyways - this was a real problem I had and I just gave up. There wasn't any way to guarantee that when I typed $obj->do_thing that it was a method that existed, and that's really all I want out of an IDE. All the other refactoring tricks are just gravy built on top of that one basic feature.

FlapYoJacks
Feb 12, 2009
My first ide was MPLAB which is a horrible, terrible program, and the person (people) who made it should commit Seppuku because of the dishoner they brought their families.

Then I moved on to MPLABX which was way better.

Now days I program in C/C++ mainly, and Eclipse-CDT is quite nice, especially with remote GDB. Sure I like VS, but Eclipse is more simple and gets the job done easier in 99% of my cases.

Zaphod42
Sep 13, 2012

If there's anything more important than my ego around, I want it caught and shot now.
Java code:
if(cursor != null)
    while(cursor.hasNext()){
        //do stuff
    }
//other stuff
Its not exactly a horror, but it just feels ugly.

E: here's another, even worse

Java code:
if(thing){
//lots of code
//from way before
    if(cursor!=null) while(cursor.hasNext()){
        //do stuff
        if(...){
           //other stuff
    }
    cursor.close();
}
//other code
Eclipse really doesn't like that formatting. The first } looks like it closes the if(cursor != null) and it looks like the if(...) is unmatched, but nope! Second } matches the while and the if has an implicit one-line. The actual closing brace for the earlier if is way down out of view. :barf:

Zaphod42 fucked around with this message at 23:54 on Nov 19, 2013

Pythagoras a trois
Feb 19, 2004

I have a lot of points to make and I will make them later.

Zaphod42 posted:

Eclipse really doesn't like that formatting. The first } looks like it closes the if(cursor != null) and it looks like the if(...) is unmatched, but nope! Second } matches the while and the if has an implicit one-line. The actual closing brace for the earlier if is way down out of view. :barf:

The Zen of Python posted:

Explicit is better than implicit.
This may not be true, but horror cases like yours leave me constantly adding crap to bare returns and exceptions. Sure it seems like a bare return is basically the equivalent of return None, but what next? Will start using bare exceptions? Will I stop using my directional when I'm in the turn only lane?!

Pythagoras a trois fucked around with this message at 05:39 on Nov 20, 2013

Master_Odin
Apr 15, 2010

My spear never misses its mark...

ladies
So the horror is people don't know how to indent properly (move both } over a tab and then they align properly?)? Just checking here.

Pythagoras a trois
Feb 19, 2004

I have a lot of points to make and I will make them later.
The implicit if statement is the horror, brackets just muddy the waters. I think.

FamDav
Mar 29, 2008

BigRedDot posted:

You'd be amazed what you have to resort to when you are forced to code in a locked room on an airgapped network.

are we talking the government "this room hasn't been cleaned in a decade because NOTHING comes out" type rooms.

Plorkyeran
Mar 22, 2007

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

Master_Odin posted:

So the horror is people don't know how to indent properly (move both } over a tab and then they align properly?)? Just checking here.

It's trying to be clever and treat the if/while as a single thing but fails to do that correctly, and it's completely pointless to begin with since you could just write while (cursor != null && cursor.hasNext()) and eliminate the if entirely.

Freakus
Oct 21, 2000

Plorkyeran posted:

It's trying to be clever and treat the if/while as a single thing but fails to do that correctly, and it's completely pointless to begin with since you could just write while (cursor != null && cursor.hasNext()) and eliminate the if entirely.
That's an interesting strategy. I don't think I've ever seen code that checked invariants in a loop guard that didn't have a chance to change in the loop body.

TheSleeper
Feb 20, 2003
This is a snippet from an 800+ line file full of jquery I recently had to refactor at work: https://gist.github.com/justin-edwards/bbb85413c18dea60a5b5

Yes, that is a nearly 100 line switch statement on the value of true.

edit: I should point out that part of the tragedy of this is it was written by a coworker of mine about a month ago. This isn't some years old file written by an intern or something, the guy has a masters.

I replaced the 800 lines of jquery with ~400 lines of angular.

TheSleeper fucked around with this message at 05:28 on Nov 20, 2013

Volmarias
Dec 31, 2002

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

TheSleeper posted:

This isn't some years old file written by an intern or something, the guy has a masters.

I've found that people with Masters degrees in CS are actually worse than people with just their Bachelors. Just because he has his Masters doesn't mean he's not just as competent as an intern.

Pythagoras a trois
Feb 19, 2004

I have a lot of points to make and I will make them later.
code:
default: // If nothing is invalid and nothing is valid, then everything is empty.
Your coworker's pretty deep, man.

HORATIO HORNBLOWER
Sep 21, 2002

no ambition,
no talent,
no chance

Plorkyeran posted:

It's trying to be clever and treat the if/while as a single thing but fails to do that correctly, and it's completely pointless to begin with since you could just write while (cursor != null && cursor.hasNext()) and eliminate the if entirely.

I hate this idiom because I see this all the time:

Java code:

rs = ps.executeQuery();

while(rs != null && rs.next()) {
    // ...
}

By contract, Statement#executeQuery never returns null.

Opinion Haver
Apr 9, 2007

code:
for (rs = ps.executeQuery(); rs.next();) {
    // ...
}
:shepface:

Plorkyeran
Mar 22, 2007

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

TheSleeper posted:

This is a snippet from an 800+ line file full of jquery I recently had to refactor at work: https://gist.github.com/justin-edwards/bbb85413c18dea60a5b5

Yes, that is a nearly 100 line switch statement on the value of true.

edit: I should point out that part of the tragedy of this is it was written by a coworker of mine about a month ago. This isn't some years old file written by an intern or something, the guy has a masters.

I replaced the 800 lines of jquery with ~400 lines of angular.

I'm not a fan of it, but this isn't really a crazy-unusual thing to do in languages that support it.

redleader
Aug 18, 2005

Engage according to operational parameters
I'm baffled as to why anyone would want to find the maximum value of an integer by counting until you can count no more. The comments are full of good suggestions too!

Jewel
May 2, 2009

redleader posted:

I'm baffled as to why anyone would want to find the maximum value of an integer by counting until you can count no more. The comments are full of good suggestions too!

Some Guy posted:

Some Other Guy posted:

For a 4 byte int, if you insert a million records everyday, you can keep doing it more than 5 years ;)

Actually, we exceeded int’s max on primary keys of two tables in one of our projects production DB in less than 18 months, so it’s not as unreal as you think ;)

:gonk:

Who in their right mind is inserting ~3.75 million records into a DB every day? That's ~150,000 an hour. ~2500 a minute. ~43 a second.

Inserting 43 records a second into a single database every single day for 18 months.

Edit: vvv Wouldn't adding to a database be for unique things like registration or per-user data? 3.75 million unique users every day? I can't think of what you'd need to store in a database that would require you to create a new row for data created that often.

Jewel fucked around with this message at 12:53 on Nov 20, 2013

pigdog
Apr 23, 2004

by Smythe
That's hardly an astronomical figure.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

Jewel posted:

Edit: vvv Wouldn't adding to a database be for unique things like registration or per-user data? 3.75 million unique users every day? I can't think of what you'd need to store in a database that would require you to create a new row for data created that often.

"Users" is the only unique thing you can think of?

How would go about storing, say, "Forum posts"?

Volmarias
Dec 31, 2002

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

Jabor posted:

"Users" is the only unique thing you can think of?

How would go about storing, say, "Forum posts"?

Flat files. Why do you ask?

dorkanoid
Dec 21, 2004

Jabor posted:

"Users" is the only unique thing you can think of?

How would go about storing, say, "Forum posts"?

Encode then into QR and store the jpegs

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
Don't store them at all because you are posting is bad.

kitten smoothie
Dec 29, 2001

Jewel posted:

quote:

Actually, we exceeded int’s max on primary keys of two tables in one of our projects production DB in less than 18 months, so it’s not as unreal as you think ;)

:gonk:

Who in their right mind is inserting ~3.75 million records into a DB every day? That's ~150,000 an hour. ~2500 a minute. ~43 a second.

Inserting 43 records a second into a single database every single day for 18 months.

At a past job, we had a production process where there were maybe two dozen steps done to an inventory item, from start to finish. Every step generated a database record recording who did what step to what item and when. Some of these were manually initiated by employees, and some were generated with automated equipment that ran 24/7. As we added more automation we were up to a throughput of about 8 million items a month going through the pipeline.

Every one of these items was physically unique and had to be treated as such, so it generated an individual record in the database for every item's step of the way. Which meant we were definitely pumping that kind of throughput into this database, just averaging out (8 million items * say 24 steps)/30 days in a month.

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
That schema seems kind of suspect.

jony neuemonic
Nov 13, 2009

Otto Skorzeny posted:

That schema seems kind of suspect.

No kidding. I'm trying to picture it and I just can't. What was the reasoning behind it?

kitten smoothie
Dec 29, 2001

fidel sarcastro posted:

No kidding. I'm trying to picture it and I just can't. What was the reasoning behind it?

The items were DNA samples; 90% of the steps represented bunch of chemistry-related work that was unique and specific to each sample (primers, etc) and would be used to schedule the robots to do the right thing downstream, so we had to track at that level.

npe
Oct 15, 2004

Jewel posted:

Who in their right mind is inserting ~3.75 million records into a DB every day? That's ~150,000 an hour. ~2500 a minute. ~43 a second.

The electronic discovery industry crushes this number. A company I worked for loaded more than that daily, and there was always pressure to get that number up.

Before anyone asks - it's because the entire process revolves around taking dumps of exported data (usually mail server archives and desktop images) and processing them into data that can be easily searched and accessed by a large number of lawyers. For legal reasons, the chain of custody within the company needs to be tracked, so every single email and every single document that gets transmitted gets at least one row in a database. We're talking multiple TB of email data at a time.

Our bulk data loaders were burning 24x7. We had legions of people working shifts to just keep the processing scripts running.

Maybe e-discovery is a horrors thread unto itself, though.

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

kitten smoothie posted:

The items were DNA samples; 90% of the steps represented bunch of chemistry-related work that was unique and specific to each sample (primers, etc) and would be used to schedule the robots to do the right thing downstream, so we had to track at that level.

The confusion wasn't about why you needed to store who did what and when, but about why each event was its own record rather than a pair of columns or something. e: or, you know, several tables rather than one

Blotto Skorzany fucked around with this message at 16:33 on Nov 20, 2013

Zaphod42
Sep 13, 2012

If there's anything more important than my ego around, I want it caught and shot now.

Otto Skorzeny posted:

The confusion wasn't about why you needed to store who did what and when, but about why each event was its own record rather than a pair of columns or something. e: or, you know, several tables rather than one

Yeah sounds like a case of using one big God table.

We've got the opposite problem, people keep adding trivial things to the schema and now there's an absurd number of tables and relationships to keep track of.

kitten smoothie
Dec 29, 2001

Otto Skorzeny posted:

The confusion wasn't about why you needed to store who did what and when, but about why each event was its own record rather than a pair of columns or something. e: or, you know, several tables rather than one

To clarify, we had several tables. We didn't, say, have one bigass table that got a new row re-recording all sample data for every event.

Samples - things we have
Event Types - things we do, in general
Events - Things that happened; referencing an event type, who did it, when
Sample Events - Sample ID, event ID, and a couple fields for stuff that was specific to that combination of sample and event invocation. While some steps were a 1:1 relationship to samples, the majority happened where a person took a block of 384 of them and put them on a robot deck, and the robot dealt with the things that mattered for each individual piece. No point in logging the "who did it, when, where" 383 more times than you have to.

The sample event table was what grew at a rate of several million a day. The events table grew at a rate of ~1/384 that.

kitten smoothie fucked around with this message at 17:36 on Nov 20, 2013

Freakus
Oct 21, 2000

Jewel posted:

Who in their right mind is inserting ~3.75 million records into a DB every day? That's ~150,000 an hour. ~2500 a minute. ~43 a second.

Inserting 43 records a second into a single database every single day for 18 months.
640kb of ram is all anyone needs.

I was involved in an arcade-style gaming site that released 3 or so new games each day. Each game would have roughly 1.8 million unique users play it on their release day. We obviously stored people's high scores. So based on that alone we would be inserting ~5.4 million new high score records per day. We used a compound primary key though (game_id and user_id) so it was a non-issue.

ulmont
Sep 15, 2010

IF I EVER MISS VOTING IN AN ELECTION (EVEN AMERICAN IDOL) ,OR HAVE UNPAID PARKING TICKETS, PLEASE TAKE AWAY MY FRANCHISE

npe posted:

Maybe e-discovery is a horrors thread unto itself, though.

It is. At the intersection of the "Coding Horrors" and the "Started off Barrister, Ended Up Barista" threads.

Hughlander
May 11, 2005

Jewel posted:

:gonk:

Who in their right mind is inserting ~3.75 million records into a DB every day? That's ~150,000 an hour. ~2500 a minute. ~43 a second.

Inserting 43 records a second into a single database every single day for 18 months.

BI project I was on had 12 million rows an hour. I used to joke that one in a million things going wrong would happen 300 times a day. Of course we didn't use int32s as keys...

Hughlander fucked around with this message at 03:41 on Nov 21, 2013

Marta Velasquez
Mar 9, 2013

Good thing I was feeling suicidal this morning...
Fallen Rib

Jewel posted:

Who in their right mind is inserting ~3.75 million records into a DB every day? That's ~150,000 an hour. ~2500 a minute. ~43 a second.

Inserting 43 records a second into a single database every single day for 18 months.

Twitter

quote:

Recently, something remarkable happened on Twitter: On Saturday, August 3 in Japan, people watched an airing of Castle in the Sky, and at one moment they took to Twitter so much that we hit a one-second peak of 143,199 Tweets per second. (August 2 at 7:21:50 PDT; August 3 at 11:21:50 JST)

To give you some context of how that compares to typical numbers, we normally take in more than 500 million Tweets a day which means about 5,700 Tweets a second, on average. This particular spike was around 25 times greater than our steady state.

shodanjr_gr
Nov 20, 2007
I don't get why, in the era of social networks, micro trading and other "big data", people are surprised that some business might have to do thousands of insertions per second into a database...

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

Really any service that has a large amount of traffic that requires tracking as well... like advertising. We process ~12k requests a second on a single action that records every hit into a database.

Granted, the hits don't stay forever... maybe 3 months?

shodanjr_gr posted:

I don't get why, in the era of social networks, micro trading and other "big data", people are surprised that some business might have to do thousands of insertions per second into a database...

They've never worked on anything "at scale".

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
I know some people who think database transactions are "heavy", and think that the world will collapse if they do more than 500 a second or something.

Adbot
ADBOT LOVES YOU

Jewel
May 2, 2009

I kinda forgot about social media with that post, oops :shobon:

By the sound of the comment though, the commenter did not run Twitter or Tumblr or something of the sort, and I'm willing to bet what he was doing was horribly inefficient.

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