|
javascript haters like to say that js doesn't even have a standard library, and inevitably the first example they think of for something they want in a standard library is JSON parsing, something which has a very simple and good implementation built-in in javascript, but everyone uses a third party library for in .net and java
|
# ? Oct 27, 2018 22:50 |
|
|
# ? Sep 11, 2024 01:33 |
|
or as a conscientious library author, make sure to bundle and rename Jackson
|
# ? Oct 27, 2018 22:58 |
|
brap posted:javascript haters like to say that js doesn't even have a standard library, and inevitably the first example they think of for something they want in a standard library is JSON parsing, something which has a very simple and good implementation built-in in javascript, but everyone uses a third party library for in .net and java js is a dynamic language so inconsistent and unknown typing in json is ok. in c# you want real types so you need something capable of consistently and safely translating json
|
# ? Oct 27, 2018 23:02 |
|
brap posted:javascript haters like to say that js doesn't even have a standard library,
|
# ? Oct 28, 2018 00:16 |
|
Shaggar posted:the date sniffing in newtonsoft json only happens if you are using dynamic typing and have date sniffing on. you should not be using dynamic typing so it will never be an issue.
|
# ? Oct 28, 2018 00:47 |
|
never use javascript
|
# ? Oct 28, 2018 00:55 |
|
brap posted:javascript haters like to say that js doesn't even have a standard library, and inevitably the first example they think of for something they want in a standard library is JSON parsing, something which has a very simple and good implementation built-in in javascript, but everyone uses a third party library for in .net and java this is a historical accident. json seemed better than xml to idiot webdevs because you could eval it in js, with such dire security implications that the browser makers had no choice but to agree a standard json parsing api to protect users. meanwhile when you're writing interesting programs in a language like java or c#, you will often need more functionality than the basic javascript implementation provides. like the ability to process huge datasets as event streams, or the ability to read a number and get back the exact number that was in the data. it's hard to design a one-size-fits-all approach here so it's reasonable to leave this to libraries that are free to choose different tradeoffs or experiment with different interfaces. instead they concentrate on putting things in their standard library that people do actually expect to be there, like string formatting.
|
# ? Oct 28, 2018 01:42 |
|
pull parsing only matters for big boy datasets so I doubt any js devs have ever needed it
|
# ? Oct 28, 2018 03:29 |
|
CRIP EATIN BREAD posted:never use javascript
|
# ? Oct 28, 2018 09:21 |
|
my favorite json parser is the one that parses as little json as possible
|
# ? Oct 28, 2018 17:01 |
|
hey ya'll, I havent been posting here in a bit. Here's a relatively positive EN for those interested. Semi programming related. https://forums.somethingawful.com/showthread.php?threadid=3846735&pagenumber=1213&perpage=40#post489294687
|
# ? Oct 28, 2018 17:24 |
DONT THREAD ON ME posted:hey ya'll, I havent been posting here in a bit. Here's a relatively positive EN for those interested. Semi programming related. Glad to hear you are doing better! Congratulations and best of luck
|
|
# ? Oct 28, 2018 20:49 |
|
In java, what does this statement mean when you're creating a class?quote:public class Card implements Comparable <Card>
|
# ? Oct 28, 2018 20:54 |
|
white sauce posted:In java, what does this statement mean when you're creating a class? what part is giving you trouble? implementing an interface, having a generic interface, or the interface Comparable<T> specifically?
|
# ? Oct 28, 2018 21:00 |
|
NihilCredo posted:what part is giving you trouble? implementing an interface, having a generic interface, or the interface Comparable<T> specifically? It's part of one of the classes our teacher gave us to complete for a project. I've never encountered "implements Comparable <Card>" as part of a class declaration... What's the difference between this class declaration and a regular class declaration that would say something like quote:
I'm starting to fill in the code for the Card.java, then Deck.java, then Player.java, then Game.java.... I already have a tester class. white sauce fucked around with this message at 21:09 on Oct 28, 2018 |
# ? Oct 28, 2018 21:07 |
|
It implements an interface aka a required method that allows you to pass the class as an additional type i.e. public void takeComparable(Comparable <T>) { ... } would take in any class that implements comparable. The <Card> means that you are using that interface for a particular type of comparable.
|
# ? Oct 28, 2018 21:14 |
|
PokeJoe posted:It implements an interface aka a required method that allows you to pass the class as an additional type i.e. I see. I have the skeleton to this method: quote:public int compareTo(Card c){ Would this be the method you're referring to? Also, what is this called in Java, just "interface implementation"? I wanna read up on it in some place that isn't my horrible textbook.
|
# ? Oct 28, 2018 21:18 |
|
white sauce posted:I see.
|
# ? Oct 28, 2018 21:23 |
|
Yes, comparable is a common java interface that generally returns a negative value when an item is less than the one it's compared to, 0 if equal, and positive if more than. When in doubt, check the docs.quote:public interface Comparable<T> They're just called interfaces. http://tutorials.jenkov.com/java/interfaces.html The <T> is a generic. https://www.tutorialspoint.com/java/java_generics.htm
|
# ? Oct 28, 2018 21:25 |
|
mystes posted:Maybe you should try googling for java interfaces? Or ask your teacher who's getting paid to explain this stuff to you? Teacher is unapproachable so we are basically left to our own devices. I just needed a simple explanation from an actual human. Ive found that googling for poo poo I dont understand just leads me to places like Stackoverflow.com or other weird java websites that were obviously written by people who have no grasp of English. But your comment is appreciated.
|
# ? Oct 28, 2018 21:35 |
|
PokeJoe posted:Yes, comparable is a common java interface that generally returns a negative value when an item is less than the one it's compared to, 0 if equal, and positive if more than. When in doubt, check the docs. Thank you so much. Im just starting to learn to navigate the java docs and the api library.
|
# ? Oct 28, 2018 21:36 |
|
DONT THREAD ON ME posted:hey ya'll, I havent been posting here in a bit. Here's a relatively positive EN for those interested. Semi programming related. best of luck op, ull always be an honorary terrible programmer here
|
# ? Oct 28, 2018 21:40 |
|
i feel seen
|
# ? Oct 28, 2018 23:56 |
|
Arcsech posted:i feel seen last panel is fun times also flashback to arguing for months that the patch removing fsync was a bad idea and getting ignored until corruption took down a diy-AZ
|
# ? Oct 29, 2018 00:06 |
|
For years, I implemented compareTo() in Java using subtraction and never thought about what happens when one value is very positive and the other value is very negative haha. (If the subtraction overflows, you get the opposite answer from what you wanted.) I guess it never came up, because I was usually comparing two values that were almost certainly both going to be positive. There's a good reason why languages like Ceylon return "smaller", "equal", or "larger" from comparison operations, instead of (some negative number), zero, and (some positive number).
|
# ? Oct 29, 2018 01:04 |
|
Arcsech posted:i feel seen lol I'm working on an eventually consistent system right now for work
|
# ? Oct 29, 2018 01:43 |
|
CPColin posted:For years, I implemented compareTo() in Java using subtraction and never thought about what happens when one value is very positive and the other value is very negative haha. (If the subtraction overflows, you get the opposite answer from what you wanted.) I guess it never came up, because I was usually comparing two values that were almost certainly both going to be positive. I think most of us have done this at one time or another. doing it any other way is more typing after all 😀 I've sometimes wondered if it would be better to have a distinct NumericallyComparable interface with a method that returns the numerical representation of the object so the language can implement the compareTo optimally. then classic Comparable would be reserved only for classes that can't be compared via a single numerical value.
|
# ? Oct 29, 2018 01:48 |
|
is this like a java thing because i dont understand why subtraction would ever be necessary? don't all languages have greater-than and less-than built in? edit: i think this reads like i'm being snarky but i am genuinely asking because it seems like a weird thing for me to be confused about but i'm not understanding the discussion
|
# ? Oct 29, 2018 03:46 |
|
saves branches, makes programmers feel like they're writing fast code
|
# ? Oct 29, 2018 03:50 |
|
Corla Plankun posted:is this like a java thing because i dont understand why subtraction would ever be necessary? don't all languages have greater-than and less-than built in? comparable is an interface for classes to implement to allow them to be compared. in Java compareTo returns an integer. less than 0 means "sorts first" 0 means they're the same, and greater than 0 means "sorts after". when the comparison is just a numeric field on the class people usually implement it as "return thing1.num -thing2.num" in more complex scenarios you might instead use if then chains to return +-1 or 0. for the former it'd be nice to just have a way to flag the field that needs to be compared instead of having to implement the same thing all the time.
|
# ? Oct 29, 2018 03:54 |
|
just use ComparisonChain
|
# ? Oct 29, 2018 04:03 |
|
intellij generates all my compareTos, toStrings, and hashCodes
|
# ? Oct 29, 2018 04:04 |
|
Kevin Mitnick P.E. posted:intellij generates all my compareTos, toStrings, and hashCodes maybe autovalue should do that for you instead
|
# ? Oct 29, 2018 06:06 |
|
Corla Plankun posted:is this like a java thing because i dont understand why subtraction would ever be necessary? don't all languages have greater-than and less-than built in? Also java doesn't have operator overloading so < and > are on built-in numbers only
|
# ? Oct 29, 2018 09:00 |
|
jit bull transpile posted:comparable is an interface for classes to implement to allow them to be compared. in Java compareTo returns an integer. less than 0 means "sorts first" 0 means they're the same, and greater than 0 means "sorts after". why the heclk wouldnt you return self.num.compareTo(other.num)
|
# ? Oct 29, 2018 09:12 |
this is going to be fun. our new chad chief system architect firstly plans to take our gigantic legacy product and migrate it over to an entirely new codebase developed for it with a downtime of under an hour (neither the legacy product nor his system design have any documentation to show), and secondly he smugly proclaimed that he will take care of document storage question and we will be given a special sql interface to work with xml documents without storing them in rdbms sure champ, just let me know when i can reap that sick hn karma by publishing it revolution from the hairy anus of russia first
|
|
# ? Oct 29, 2018 09:50 |
to put document store query thing into perspective, the technical requirement is that documents and relational data are both accessible within a single sql:2011+ select cinci zoo sniper fucked around with this message at 09:53 on Oct 29, 2018 |
|
# ? Oct 29, 2018 09:51 |
the reasoning about lack of documentation for system architecture is that if it will be done in full then 90% of time will be spent managing the docs and only the rest for development
|
|
# ? Oct 29, 2018 10:01 |
|
horrific nested mvc view update status: it's bad bront after banging my head on this for a week I realised that what I was trying to do was dumb and required that the entire model state be represented in the display template in order to post back properly but at the same time that made an individual element impossible to edit dynamically because the ids for binding would reference the larger model and not just the sub element being used. so anyway, I realised that seeing as this is editing a list of Farts that all implement IButt I should stop dying on the hill of stateless pages and have the Fart Editor just add Farts to a list in the user session and return a flat display render, then on save just add a step to get all session Farts and save them instead of having to include them in the main nested List<IButt> model so yeah, that was a waste of my life. I did learn a lot about manipulating the way binding Id refs generate in mvc though so there is that. In particular, you can extend the BeginCollectionItem helper library to take a prefix from the session so you can dynamically change the prefix of list items to create nested lists. i mean, it's still a total pain in the rear end to do but you can do it. at one point I was 8 layers deep into nested element names lmao Powerful Two-Hander fucked around with this message at 12:03 on Oct 29, 2018 |
# ? Oct 29, 2018 12:00 |
|
|
# ? Sep 11, 2024 01:33 |
|
app team to us: we'd like an api to get this data please my team: sure here is a change-event avro topic on kafka you can materialise the view however you want it is literally:
|
# ? Oct 29, 2018 14:06 |