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
Doom Mathematic
Sep 2, 2008

Maw posted:

I'm convinced that's so they can index into it with 1 as January

This is absolutely correct. The alternative is for e.g. Christmas day to be Date(2020, 11, 25) or something. There are no winners here.

Adbot
ADBOT LOVES YOU

redleader
Aug 18, 2005

Engage according to operational parameters

Carbon dioxide posted:

Years divisible by 100 are not leap years. Years divisible by 400 are. Except when you use the Julian calendar. Also, in every single data format that needs to be compatible with Microsoft Excel, 1900 actually is a leap year because of backwards compatibility with an ancient Excel version where that was introduced as a bug.

yeah but i tested it and it worked on my machine and that's not the most egregious issue (e: assuming the context of something like a web server)

redleader fucked around with this message at 13:16 on Aug 28, 2020

zergstain
Dec 15, 2005

Soricidus posted:

Oh is that why the Mac excel epoch was 1904 instead of 1900?

Wasn't the classic Mac epoch Jan 1, 1904?

more falafel please
Feb 26, 2005

forums poster

zergstain posted:

Wasn't the classic Mac epoch Jan 1, 1904?

Yes, but the date on some old macs would reset to 1956 if the PRAM battery was dead. I always heard this was Steve Jobs' birthday, but apparently he was born in 1955.

Eugene V. Dubstep
Oct 4, 2013
Probation
Can't post for 8 years!

New Yorp New Yorp posted:

I know I've been bitten by leading 0s on numeric strings getting truncated because Excel decided to convert it to a number. I think it bit me when doing some sort of integration between two software systems where someone was emailing datasets around in Excel. I know, I know: The horror was doing data interchange using Excel. Agreed.

As a newbie with this exact problem (also 'converting long numeric strings to scientific notation'), I'm wondering what would be a good alternative editor to open CSV files with

DELETE CASCADE
Oct 25, 2017

i haven't washed my penis since i jerked it to a phtotograph of george w. bush in 2003
the thing you do with a csv is import it into postgres so you can query it with sql

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

xtal posted:

Should have used 'bool count_knuckles(int m)'

i swear i remember there being an npm package for that

Eugene V. Dubstep
Oct 4, 2013
Probation
Can't post for 8 years!

DELETE CASCADE posted:

the thing you do with a csv is import it into postgres so you can query it with sql

The process this company wants me to use is importing a CSV file to SQL Server using a Python script, but not the whole thing, only certain columns. It would have been helpful in this specific case to just be able to open the 1.5 GB CSV directly and delete the superfluous columns to keep the script simple, but I can't do that with Excel because it automatically and irreversibly fucks up the data.

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

IIRC DBeaver can straight up "connect" to a CSV file and run simple queries against it

QuarkJets
Sep 8, 2008

If you need to import data into a database and your process at any point includes opening Excel then you are doing something wrong and horrible

Eugene V. Dubstep
Oct 4, 2013
Probation
Can't post for 8 years!

QuarkJets posted:

If you need to import data into a database and your process at any point includes opening Excel then you are doing something wrong and horrible

So I gather.

QuarkJets
Sep 8, 2008

I think if you use pandas the entire script is 3 lines to read the csv and write it to SQL with a predefined schema, probably 5 tops. Removing the unwanted columns adds 2 more lines, assuming you're just iterating over an iterable of either predefined column names or user-defined arguments

Ask in the Python thread if you want more help there are a lot of pandas experts in there

QuarkJets
Sep 8, 2008

In fact here's a postulate: if you you use any Microsoft product before, during, or after interacting with a database then you're doing something horrible and wrong. Microsoft Access is not excluded from this rule.

Macichne Leainig
Jul 26, 2012

by VG

QuarkJets posted:

In fact here's a postulate: if you you use any Microsoft product before, during, or after interacting with a database then you're doing something horrible and wrong. Microsoft Access is not excluded from this rule.

100% agreed, in the time it takes me to process any data in Excel I could just write a few-liner pandas script and do whatever the gently caress I need to do, and then it's easily rerunnable for the next time I have to do That Thing.

FlapYoJacks
Feb 12, 2009
How to write your own time/date keeping class:

code:
rm -rf my_time_keeping_class.${extension}
Then use a standard library.

Finito

Space Gopher
Jul 31, 2006

BLITHERING IDIOT AND HARDCORE DURIAN APOLOGIST. LET ME TELL YOU WHY THIS SHIT DON'T STINK EVEN THOUGH WE ALL KNOW IT DOES BECAUSE I'M SUPER CULTURED.

QuarkJets posted:

In fact here's a postulate: if you you use any Microsoft product before, during, or after interacting with a database then you're doing something horrible and wrong. Microsoft Access is not excluded from this rule.

I am torn between defending the "it's fine I guess, at least it's not Oracle" nature of SQL Server, and not really wanting to defend SQL Server for much of anything, here

Volmarias
Dec 31, 2002

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

QuarkJets posted:

In fact here's a postulate: if you you use any Microsoft product before, during, or after interacting with a database then you're doing something horrible and wrong. Microsoft Access is not excluded from this rule.

You can be wrong and still stuck having to do it by immutable constraints on your job.

QuarkJets
Sep 8, 2008

Volmarias posted:

You can be wrong and still stuck having to do it by immutable constraints on your job.

Doing horrible and wrong things is a cornerstone of the software development industry

Walh Hara
May 11, 2012

Eugene V. Dubstep posted:

As a newbie with this exact problem (also 'converting long numeric strings to scientific notation'), I'm wondering what would be a good alternative editor to open CSV files with

Normally I'd say RStudio, learning the R syntax is very easy and it's just extremely convenient for this kind of stuff. However: since you're apparently already using python it's probably better to choose pandas instead, it's slightly more difficult syntax and as far as I know there's no equivalent for the data viewer (https://support.rstudio.com/hc/en-us/articles/205175388-Using-the-Data-Viewer) but it's just as powerfull.

redleader
Aug 18, 2005

Engage according to operational parameters

Space Gopher posted:

I am torn between defending the "it's fine I guess, at least it's not Oracle" nature of SQL Server, and not really wanting to defend SQL Server for much of anything, here

sql server is a legitimately good product tho

Hammerite
Mar 9, 2007

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

redleader posted:

sql server is a legitimately good product tho

Yeah I know that PostgreSQL is the Goon Approved™ RDBMS, but I guess I thought SQL Server occupied second place - is it not so?

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.

Hammerite posted:

Yeah I know that PostgreSQL is the Goon Approved™ RDBMS, but I guess I thought SQL Server occupied second place - is it not so?

sql server is like C# / .net core / typescript in that while some microsoft products are as good/better than competitor products in isolation (e.g. java, oracle), using those products allows the vampire that's the rest of the microsoft ecosystem in.

Jazerus
May 24, 2011


senrath posted:

I'm not sure you can really call it a bug in Excel, since they did it on purpose to ensure backwards compatibility with Lotus 1-2-3, where it was a bug.

wish i could see the look on the face of a dev in 2100 being told that excel 2098 maintains a bug that's over a hundred years old for backwards compatibility purposes

Presto
Nov 22, 2002

Keep calm and Harry on.

Maw posted:

I'm convinced that's so they can index into it with 1 as January

My guess (because I did something similar once) is that it's used to calculate the day-of-year. Sum the array from index 0 to month - 1 (where January is 1), add the day of month, if month > February && isLeapYear(), add 1.

senrath posted:

I'm not sure you can really call it a bug in Excel, since they did it on purpose to ensure backwards compatibility with Lotus 1-2-3, where it was a bug.

I don't think it was a bug. I think it was to be as fast and small as possible, because 1-2-3 came from the 640K era. If you ignore 2100, all you need to do to test if a year is a leap year is check if year & 3 == 0.

Hammerite
Mar 9, 2007

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

Bruegels Fuckbooks posted:

the vampire that's the rest of the microsoft ecosystem

lol

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

Maw posted:

I'm convinced that's so they can index into it with 1 as January

That's correct. The code was written by someone who is effectively a junior developer with zero oversight.

I was dismayed to discover this level of process breakdown. It's actually a strange scenario; we don't have a dedicated development team, it's a project that's worked on by people who are on the bench. This particular thing was written by the aforementioned junior guy when he was the only person on the bench. It existed in a repo with no policies in place so it never went through our standard PR process, otherwise I and several others would have failed it over and over until it was acceptable. Now it's too late as it's just a big ball of lovely spaghetti code that works well enough minus the dozen obvious bugs I immediately identified on a quick glance and the fact that it won't scale because it interacts with a database designed by the same person, who doesn't understand normal forms or primary keys or indexes.

Zopotantor
Feb 24, 2013

...und ist er drin dann lassen wir ihn niemals wieder raus...

Jazerus posted:

wish i could see the look on the face of a dev in 2100 being told that excel 2098 maintains a bug that's over a hundred years old for backwards compatibility purposes

Come 2100 (if civilization survives) there will be so many critical systems relying on this bug that everybody will just shrug and go, "welp, that's the rule for leap years now, guess we'll eventually adjust to the seasons shifting around the year".
That's essentially what was proposed for leap seconds.

xtal
Jan 9, 2011

by Fluffdaddy

Jazerus posted:

wish i could see the look on the face of a dev in 2100 being told that excel 2098 maintains a bug that's over a hundred years old for backwards compatibility purposes

When you think about it leap years are already for backwards compatibility

SimonChris
Apr 24, 2008

The Baron's daughter is missing, and you are the man to find her. No problem. With your inexhaustible arsenal of hard-boiled similes, there is nothing you can't handle.
Grimey Drawer
https://twitter.com/Andy_Makes/status/1283403913035755522

I can't tell if this guy is joking.

Moonwolf
Jun 29, 2004

Flee from th' terrifyin' evil of "NHS"!


SimonChris posted:

I can't tell if this guy is joking.

Downthread it becomes very obvious he is, thankfully.

Hammerite
Mar 9, 2007

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

Jazerus posted:

wish i could see the look on the face of a dev in 2100 being told that excel 2098 maintains a bug that's over a hundred years old for backwards compatibility purposes

https://docs.microsoft.com/en-us/office/troubleshoot/excel/wrongly-assumes-1900-is-leap-year

quote:

NOTE: Microsoft Excel correctly handles all other leap years, including century years that are not leap years (for example, 2100). Only the year 1900 is incorrectly handled.

Pulcinella
Feb 15, 2019
Probation
Can't post for 5 hours!

sunaurus posted:

At my current company, there's a common pattern of putting common logic in classes that have a "Helper" suffix, and it REALLY bothers me. Just did a search, we have A LOT of classes like that in our main repo:


Reviving this but I just moved onto a project that uses “Manager,” “Helper,” and “Handler” suffixes. So for example we have both “RouteManger” and “RouteHandler” classes in addition to just a stand-alone “Router” class. We also have a “RequestDataManager” and a “RequestErrorHandler.” As far as I can tell there is no difference between whether something is a Manager or Handler, my predecessors just couldn’t pick one. “Helper” is used when someone decided to “extend” a class or struct by making a new helper class instead of just extending. e.g. Making a StringHelper class with a static allCaps function that takes and returns a string instead of just extending String.

Pulcinella fucked around with this message at 19:03 on Sep 2, 2020

Volmarias
Dec 31, 2002

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

Pulcinella posted:

Reviving this but I just moved onto a project that uses “Manager,” “Helper,” and “Handler” suffixes. So for example we have both “RouteManger” and “RouteHandler” classes in addition to just a stand-alone “Router” class. We also have a “RequestDataManager” and a “RequestErrorHandler.” As far as I can tell there is no difference between whether something is a Manager or Handler, my predecessors just couldn’t pick one. “Helper” is used when someone decided to “extend” a class or struct by making a new helper class instead of just extending. e.g. Making a StringHelper class with a static allCaps function that takes and returns a string instead of just extending String.

Shameful to use a Helper instead of Utils

Sagacity
May 2, 2003
Hopefully my epitaph will be funnier than my custom title.
Where Utils is not the suffix but the name of the entire class

Ola
Jul 19, 2004

Sagacity posted:

Where Utils is not the suffix but the name of the entire class

Contains super useful function called sortOutDifficultThingReallyNicely, but which only works in one particular context and also has some business logic thrown in for good measure.

Jazerus
May 24, 2011


Ola posted:

Contains super useful function called sortOutDifficultThingReallyNicely, but which only works in one particular context and also has some business logic thrown in for good measure.

it has utility, therefore it is a Util

Ola
Jul 19, 2004

TIL F# assignment operator = boolean equals

code:
let isItFive = data.number = 5
Boolean does not equal is of course

code:
<>
or

code:
not

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

Reusing the assignment symbol as an operator is fine if and only if an expression can't be parsed as an assignment and an assignment isn't also an expression. Otherwise you get the classic C trap if (a = b) { ... }. Assignments aren't expressions in F#, and expressions can't be assignments because they don't have let, so the problem doesn't arise.

That said, I think I'd rather have a unique assignment symbol and just drop the let.

NihilCredo fucked around with this message at 09:14 on Sep 3, 2020

Tei
Feb 19, 2011

I don't think = confused with == is that big a problem

code:
if ( c = getch() ) {
    printf("%c" c)
}

Adbot
ADBOT LOVES YOU

beuges
Jul 4, 2005
fluffy bunny butterfly broomstick

Pulcinella posted:

Reviving this but I just moved onto a project that uses “Manager,” “Helper,” and “Handler” suffixes. So for example we have both “RouteManger” and “RouteHandler” classes in addition to just a stand-alone “Router” class. We also have a “RequestDataManager” and a “RequestErrorHandler.” As far as I can tell there is no difference between whether something is a Manager or Handler, my predecessors just couldn’t pick one. “Helper” is used when someone decided to “extend” a class or struct by making a new helper class instead of just extending. e.g. Making a StringHelper class with a static allCaps function that takes and returns a string instead of just extending String.

IME from working with codebases with Manager and Helper classes, the ThingManager is more related to "core" functionality of that thing, but a ThingHelper would aggregate a couple of ThingManager calls to perform a more complex operation or to make a call to ThingManager with some pre-set parameters as a set of shortcuts.
But then very soon after, core functionality will get added to the helper class and aggregated calls will get added to the manager class so it's all just a big mess and then you :sever: and go deal with it somewhere else

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