prisoner of waffles posted:did u know? canvas can get tainted https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image#Security_and_tainted_canvases Yeah, we ran into this a while back when we tried to render images from an R web worker on a different host into a canvas so we could have a 'save' button next to them. What a mess.
|
|
# ? Sep 19, 2018 18:35 |
|
|
# ? Apr 24, 2024 10:31 |
|
Shaggar posted:thats fine until you go to deploy it to the next environment at which point you have to pick out which individual objects you want to migrate since your checkin will contain objects from different applications/work in progress already got a solution to this: make the changes in a release specific branch then the deploy pack becomes a Git diff of the branch vs master. running parallel conflicting branches could still be an issue but 1)the app is small enough that this is manageable and 2) that really only affects running multiple change sets on the same environment which would get cleaned up pre-deploy i mean yeah it will still get hosed up somehow but that's just programming in general
|
# ? Sep 19, 2018 19:29 |
|
Shaggar posted:javascript is the worst thing the new safari release is caching arrays https://stackoverflow.com/questions/52390368/array-state-will-be-cached-in-ios-12-safari-is-bug-or-feature/52392901
|
# ? Sep 19, 2018 19:34 |
|
let's say I want to make a program that inputs the number of days, weeks, and years and outputs that time into minutes. I wrote this thing quote:import java.util.Scanner; The code runs, but I'm concerned that the result could be more accurate, since we know that there's 525,949.20 minutes in a year... should I worry about this decimal in the amount of minutes in a year? How can I fix my code so it works with that fraction?
|
# ? Sep 19, 2018 19:45 |
|
white sauce posted:let's say I want to make a program that inputs the number of days, weeks, and years and outputs that time into minutes. I wrote this thing
|
# ? Sep 19, 2018 19:54 |
|
mystes posted:Don't write your own date/time handling code. The number of minutes in a year varies. this is ignoring leap years and other things
|
# ? Sep 19, 2018 19:56 |
|
mystes posted:Don't write your own date/time handling code. The number of minutes in a year varies. specifically, use the java calendar api. it handles all of this poo poo for you: https://docs.oracle.com/javase/7/docs/api/java/util/Calendar.html your implementation is okay as a general approximation, but in practice "convert days/weeks/years into minutes" isn't an actual question you can solve, you can only really say "give me the minutes between date X and date Y", because like that dude said the # of minutes in a year will vary depending on which year you're looking at
|
# ? Sep 19, 2018 19:58 |
|
mystes posted:Don't write your own date/time handling code. i'm guessing the op's teacher won't accept that
|
# ? Sep 19, 2018 19:59 |
|
yeah if you are determined not to use a library your code is fine as a dumb programming exercise if you were interested in making your code more accorate you need to use a library. date time programming is really hard and not just due to leap years
|
# ? Sep 19, 2018 20:01 |
|
time is evil
|
# ? Sep 19, 2018 20:02 |
|
white sauce posted:let's say I want to make a program that inputs the number of days, weeks, and years and outputs that time into minutes. I wrote this thing when you say year, are you referring to a calendar year or the period of the Earth's orbit about the sun? if you're talking about calendar years etc-- the number of minutes in a calendar year depends on what year it is-- thanks leap years. if you want to always give the precise number of minutes in an interval of so many years, weeks, and days, you should require the user to say when that interval begins so that you may correctly calculate how many leap days are in your interval Re: handling fractional values, find some resources about the `float` and `double` primitive data types. You should learn that they are not perfect. code:
|
# ? Sep 19, 2018 20:02 |
|
The_Franz posted:i'm guessing the op's teacher won't accept that It's like trying to roll your own crypto.
|
# ? Sep 19, 2018 20:04 |
|
you might end up with a worse answer if you use floats to represent fractions of a minute because floats tend to round off larger numbers (read about it). most date/time APIs work in milliseconds, so if you really want sub-minute precision, use the long datatype and multiply all of your inputs by the # of milliseconds in each, and then divide by (1000 * 60) for you final answer in minutes edit: if you try to do this with the int datatype, everything will break if your # of milliseconds exceeds 2,147,483,647, because that's the maximum value an int datatype can be (approx 2^32). long solves this problem because its max value is approx 2^64 which is like infinitely bigger GenJoe fucked around with this message at 20:08 on Sep 19, 2018 |
# ? Sep 19, 2018 20:05 |
|
Yeah, milliseconds is the way to go, very few time representations deal with sub millisecond precision.
|
# ? Sep 19, 2018 20:09 |
|
prisoner of waffles posted:I'm sure the actual requirements for your task were way more concrete than your quick sketch description but yeah, push push push back hard its already been implemented. at the time, it seemed weird but manageable now it's been tested and I have to fix the bugs turns out just slamming arbitrary user-supplied javascript into the global context can cause weird phantombugs that are nigh-impossible to debug
|
# ? Sep 19, 2018 20:17 |
|
GenJoe posted:long solves this problem because its max value is approx 2^64 which is like infinitely bigger unless you are using c or c++ on windows, then it's always 32 bits Chalks posted:Yeah, milliseconds is the way to go, very few time representations deal with sub millisecond precision. (almost?) all of them do posix time functions deal with either timespec (seconds + nanoseconds) or timeval (seconds + microseconds). windows uses a clunk as the basic unit of time, each of which is 100ns
|
# ? Sep 19, 2018 20:18 |
|
mystes posted:OK, I guess if it's a homework assignment that's different, but this is one of those things that people should know that they shouldn't try to implement themselves in real life. Yea, this is just getting us to try out simple arithmetic and naming integers and stuff on Java, it's not meant to be actual code that will be used by people GenJoe posted:you might end up with a worse answer if you use floats to represent fractions of a minute because floats tend to round off larger numbers (read about it). most date/time APIs work in milliseconds, so if you really want sub-minute precision, use the long datatype and multiply all of your inputs by the # of milliseconds in each, and then divide by (1000 * 60) for you final answer in minutes thank you
|
# ? Sep 19, 2018 20:19 |
|
Main Paineframe posted:turns out just slamming arbitrary user-supplied javascript into the global context can do a lot worse than Main Paineframe posted:cause weird phantombugs that are nigh-impossible to debug
|
# ? Sep 19, 2018 20:20 |
|
Is there something about c that forces you to dump 40 some odd c and h files into a single directory, with vaguely cryptic names, and file lengths reaching to 5k lines (not generated) or are the people that wrote this broken I know enough c to be very dangerous but my work with other languages is telling me this is a pile of codesmell I've fallen into
|
# ? Sep 19, 2018 20:45 |
|
AggressivelyStupid posted:Is there something about c that forces you to dump 40 some odd c and h files into a single directory, with vaguely cryptic names, and file lengths reaching to 5k lines (not generated) or are the people that wrote this broken still better than node_modules
|
# ? Sep 19, 2018 21:01 |
|
necrotic posted:the new safari release is caching arrays web pages are for displaying information so this seems like a perfectly reasonable optimization to me of course a better optimization would be to just disable JavaScript entirely
|
# ? Sep 19, 2018 21:06 |
|
cZk posted:still better than node_modules ive barely had the pleasure but thats a real low bar to clear
|
# ? Sep 19, 2018 21:38 |
|
Maximum Leader posted:I’m still on my free student IntelliJ Ultimate but community really isn’t bad if you don’t need JavaScript let's face it no one needs jarvascript
|
# ? Sep 19, 2018 21:41 |
|
cZk posted:still better than node_modules that's more akin to ~/.m2 than the literal source dir of your project tho???
|
# ? Sep 19, 2018 22:12 |
|
prisoner of waffles posted:can do a lot worse than oh, absolutely. but that's the only part I actually have to give a poo poo about i don't think anyone is ever actually going to use this feature in its current form and the environment is somewhat limited, so I'm not really worried about the horrid risks to security, performance, etc. it just has to work well enough for demos if you've ever wondered why enterprise software sucks, it's because of people like me
|
# ? Sep 19, 2018 22:16 |
|
I guess they did want us to figure out the issue of leap years quote:A year with 366 days is called a leap year. Leap years are necessary to keep the calendar synchronized with the sun because the earth revolves around the sun once every 365.25 days. Actually, that figure is not entirely precise, and for all dates after 1582 the Gregorian correction applies. Usually years that are divisible by 4 are leap years, for example 1996. However, years that are divisible by 100 (for example, 1900) are not leap years, but years that are divisible by 400 are leap years (for example, 2000). Write a program that asks the user for a year and computes whether that year is a leap year. Provide a class Year with a method isLeapYear. Use a single if statement and Boolean operators. that single "if" statement lol
|
# ? Sep 19, 2018 23:14 |
|
don't forget leap seconds, or timezone changes, or historical timezone changes, or relativistic effects, or those 11 days everybody agreed didn't happen
|
# ? Sep 19, 2018 23:18 |
|
gonadic io posted:don't forget leap seconds, or timezone changes, or historical timezone changes, or relativistic effects, or those 11 days everybody agreed didn't happen
|
# ? Sep 19, 2018 23:34 |
|
time is probably the most difficult thing there is to represent computationally and it seems really dumb to be phrasing frosh comp Sci problems in terms of time. it just invites over or underthinking and will likely lead to them missing the point you're actually trying to teach.
|
# ? Sep 20, 2018 03:45 |
|
cZk posted:still better than node_modules i don't think this is true, you shouldn't ever have to look at your node_modules directory it's me, i'm the js cultist
|
# ? Sep 20, 2018 04:51 |
|
i don't think this is true, you shouldn't have to ever look at the visage of cthulhu it's me, i'm the fishman cultist
|
# ? Sep 20, 2018 05:06 |
|
Powerful Two-Hander posted:yeah this is what I've already done, I was just looking for a way to avoid having butts.table.sql, butts.table.v1.sql, butts.Table.v2.sql etc to capture the initial create and then incremental alters but whatever you use it basically ends up being that so I'll embrace it i think we've misunderstood each other. i'm suggesting that you use a sql server database project, which does *not* involve storing sequential alter scripts. Shaggar posted:thats fine until you go to deploy it to the next environment at which point you have to pick out which individual objects you want to migrate since your checkin will contain objects from different applications/work in progress no, database projects support this scenario just fine. if you have two logically disjoint applications living in the same database (which you shouldn't), then regardless each application gets its own separate database project. during deployment, ensure that "drop objects not in source" is disabled, and you can deploy changes to either application at any time. in another scenario, you have logically disjoint applications and, in addition, some stored procedures that aggregate data from both. here you can add a third database project that contains the stored procedures, and have that database project reference the other database projects in "same database" mode. in another scenario, you have applications that share some parts of the data model and not others. in this case the common parts of the data model can live in their own, unified database project, while the non-shared parts still each get their own sqlproj and reference the common sqlproj. contra your previous suggestion, the visual studio database tools team that created database projects was very well aware of scenarios involving multiple apps in one database.
|
# ? Sep 20, 2018 07:05 |
|
Fiedler posted:i think we've misunderstood each other. i'm suggesting that you use a sql server database project, which does *not* involve storing sequential alter scripts. What happens if you have non-.net users of the database. Or users accessing the db directly from their own sql. This sort of thing is great if you have a super structured and locked down development process, but for some (a lot?) of places the dbs are designed first for an unknown number of eventual consumers and it would just me much better if ssms /sql server supported that use case with versions, tracing, object reference paths etc. You can roll your own versions of some of those but it would be so much nicer if they were built in
|
# ? Sep 20, 2018 07:27 |
|
pointsofdata posted:What happens if you have non-.net users of the database. Or users accessing the db directly from their own sql. This sort of thing is great if you have a super structured and locked down development process, but for some (a lot?) of places the dbs are designed first for an unknown number of eventual consumers and it would just me much better if ssms /sql server supported that use case with versions, tracing, object reference paths etc. You can roll your own versions of some of those but it would be so much nicer if they were built in i'm not understanding your point. sql server database projects are not related to .net. in fact they're entirely unrelated to database access, and are just about defining and deploying the database schema.
|
# ? Sep 20, 2018 07:43 |
|
surely you're using the projects in your. Net solutions though, otherwise what's the point of splitting them up into n^2 different projects?
|
# ? Sep 20, 2018 08:04 |
|
Fiedler posted:i think we've misunderstood each other. i'm suggesting that you use a sql server database project, which does *not* involve storing sequential alter scripts. this doesn't work at all since you cant easily split a database across multiple projects both because the tool cant do it well and applications share objects in the database. Also the idea that multiple applications shouldn't use the same db is dumb as poo poo and its the core reason for the vs db tools being mostly useless for all but the most simple applications.
|
# ? Sep 20, 2018 15:22 |
|
also related to dbs and .net, why in the gently caress is the .net team still promoting entity framework? Its so loving awful. Is the vs/.net team just totally incompetent when it comes to databases?
|
# ? Sep 20, 2018 15:35 |
|
Shaggar posted:also related to dbs and .net, why in the gently caress is the .net team still promoting entity framework? Its so loving awful. Is the vs/.net team just totally incompetent when it comes to databases? afaik the teams at microsoft fight each other tooth and nail it might be incompetence through infighting.
|
# ? Sep 20, 2018 15:44 |
|
i tihnk its about time for mononcqc to dunk on everything
|
# ? Sep 20, 2018 15:59 |
|
|
# ? Apr 24, 2024 10:31 |
|
pointsofdata posted:surely you're using the projects in your. Net solutions though, otherwise what's the point of splitting them up into n^2 different projects? the point of splitting into separate projects is to allow different deployment cadences. i'm not talking about entity framework. you can't use a database project in your .NET code. Shaggar posted:this doesn't work at all since you cant easily split a database across multiple projects both because the tool cant do it well and applications share objects in the database. yes, you actually have to manually move files into the correct project when initially setting things up. the tools aren't magically able to figure out which parts are shared. shared objects, though, work fine and i mentioned the appropriate project structure above. and no, two logically disjoint applications (by which i mean two applications whose data models are entirely separate, as in no shared database objects) don't belong in the same database. multiple applications that share parts of their data model in the same database is, of course, fine.
|
# ? Sep 20, 2018 15:59 |