|
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.
|
# ? Aug 28, 2020 12:49 |
|
|
# ? May 25, 2024 09:23 |
|
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 |
# ? Aug 28, 2020 12:49 |
|
Soricidus posted:Oh is that why the Mac excel epoch was 1904 instead of 1900? Wasn't the classic Mac epoch Jan 1, 1904?
|
# ? Aug 28, 2020 13:25 |
|
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.
|
# ? Aug 28, 2020 20:19 |
|
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
|
# ? Aug 28, 2020 20:43 |
|
the thing you do with a csv is import it into postgres so you can query it with sql
|
# ? Aug 28, 2020 20:48 |
|
xtal posted:Should have used 'bool count_knuckles(int m)' i swear i remember there being an npm package for that
|
# ? Aug 28, 2020 20:56 |
|
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.
|
# ? Aug 28, 2020 21:12 |
|
IIRC DBeaver can straight up "connect" to a CSV file and run simple queries against it
|
# ? Aug 28, 2020 21:14 |
|
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
|
# ? Aug 28, 2020 21:16 |
|
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.
|
# ? Aug 28, 2020 21:16 |
|
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
|
# ? Aug 28, 2020 21:20 |
|
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.
|
# ? Aug 28, 2020 21:23 |
|
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.
|
# ? Aug 28, 2020 21:36 |
|
How to write your own time/date keeping class:code:
Finito
|
# ? Aug 28, 2020 22:33 |
|
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
|
# ? Aug 28, 2020 22:39 |
|
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.
|
# ? Aug 29, 2020 00:07 |
|
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
|
# ? Aug 29, 2020 00:13 |
|
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.
|
# ? Aug 29, 2020 00:31 |
|
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
|
# ? Aug 29, 2020 03:23 |
|
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?
|
# ? Aug 29, 2020 14:04 |
|
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.
|
# ? Aug 29, 2020 16:56 |
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
|
|
# ? Aug 29, 2020 17:04 |
|
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.
|
# ? Aug 29, 2020 20:33 |
|
Bruegels Fuckbooks posted:the vampire that's the rest of the microsoft ecosystem lol
|
# ? Aug 29, 2020 21:16 |
|
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.
|
# ? Aug 30, 2020 04:19 |
|
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.
|
# ? Aug 31, 2020 06:44 |
|
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
|
# ? Aug 31, 2020 06:45 |
https://twitter.com/Andy_Makes/status/1283403913035755522 I can't tell if this guy is joking.
|
|
# ? Aug 31, 2020 09:06 |
|
SimonChris posted:I can't tell if this guy is joking. Downthread it becomes very obvious he is, thankfully.
|
# ? Aug 31, 2020 09:14 |
|
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.
|
# ? Aug 31, 2020 13:20 |
|
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 |
# ? Sep 2, 2020 19:00 |
|
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
|
# ? Sep 2, 2020 19:58 |
|
Where Utils is not the suffix but the name of the entire class
|
# ? Sep 2, 2020 20:25 |
|
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.
|
# ? Sep 2, 2020 20:35 |
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
|
|
# ? Sep 3, 2020 07:10 |
|
TIL F# assignment operator = boolean equalscode:
code:
code:
|
# ? Sep 3, 2020 08:23 |
|
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 |
# ? Sep 3, 2020 09:12 |
|
I don't think = confused with == is that big a problemcode:
|
# ? Sep 3, 2020 10:03 |
|
|
# ? May 25, 2024 09:23 |
|
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 couldnt 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 and go deal with it somewhere else
|
# ? Sep 3, 2020 12:53 |