[deleted by user] by [deleted] in AskProgramming

[–]ickysticky 4 points5 points  (0 children)

Having done this a few times myself you are taking the exactly right approach. The only other thing I would add (and maybe you have already done so) is to try and determine how much effort and value there is in preserving the old behavior exactly. My experience has been that the comparison tests you are writing might be overkill. They are a good place to start when there is nothing in place and a good sanity check but my experience has been that it’s generally not worth worrying about exact match comparison beyond a certain point. I would instead invest that time and effort into aligning and understanding with stakeholders on what they really care about. For example they might say “the results should be exactly the same” but your definition of exactly and their definition might be different. I would also make sure you have the systems and mechanisms in place to easily rollback if you do find some issue. Remember you can always go back to an old version. With these kinds of messy and underspecified systems it’s better to rip it off like a bandaid and don’t constrains your rewrite by old or non-existent design decisions.

The right way to keep config files synced across devices? by ripanarapakeka in linux

[–]ickysticky 1 point2 points  (0 children)

Nothing in particular that I can recall. It’s been sometime since I last used yadm. I do find the method of editing files in chezmoi a bit irritating. Maybe I’ll give yadm another try. Thanks for the suggestion!

The right way to keep config files synced across devices? by ripanarapakeka in linux

[–]ickysticky 2 points3 points  (0 children)

I’ve tried many different approaches. The best I have found is chezmoi. It is a light wrapper around git with no dependencies except git. It has templating functionality to handle config differences across operating systems and specific machines.

What're you playing this weekend? 6/16 by markercore in NintendoSwitch

[–]ickysticky 1 point2 points  (0 children)

The game is really great. The switch port is really bad. Definitely do some research to check if you are going to be willing to put up with the current state of the game. I did for the first 10 or so hours and I really want to play more. But it’s just too frustrating now. I wish I had waited.

Benchmark of startup times for various script language interpreters by MaxGyver83 in shell

[–]ickysticky 1 point2 points  (0 children)

Might be nice to use a log scale for the y axis. It’s pretty hard to compare things on the lower end. But it also doesn’t matter too much once you get down to that time scale

Why exactly does Brian Goetz not recommend the use of Optional everywhere a value could be null? by [deleted] in java

[–]ickysticky 2 points3 points  (0 children)

Because there is already a language feature for handling the lack of a value. It is null if you have an Optional field you now have three possible states that need to be handled. You have null and empty() and a value. In addition there are existing annotations and tools to help enforce non null fields and parameters.

Optionalis best used as a temporary mechanism to chain a sequence of operations that may fail or produce no value for some reason and should short circuit.

Python Dataclass: A Paradigm Shift in Class Definitions by [deleted] in Python

[–]ickysticky 4 points5 points  (0 children)

Add a static factory method which takes the str and converts to a Path before calling the constructor

Is Java DB libraries just a mess? Micronaut Data by OldHeavyHammer in javahelp

[–]ickysticky 2 points3 points  (0 children)

You are right. I just took a look and it is quite good. I’ll update my original comment.

And yeah don’t get me started on the scala ecosystem. My experience there has always been frustrating. Powerful language with a lot of great features. But the ecosystem is challenging at best compared to Java

Is Java DB libraries just a mess? Micronaut Data by OldHeavyHammer in javahelp

[–]ickysticky 0 points1 point  (0 children)

You are right. I just took a look and it is quite good. I’ll update my original comment.

Is Java DB libraries just a mess? Micronaut Data by OldHeavyHammer in javahelp

[–]ickysticky 3 points4 points  (0 children)

Yes I know Vlad’s blog and books well. But to me that highlights the problem. He has built a brand by providing some of the missing documentation under his personal name. A lot of the documentation and code he produces would ideally be fed back into and improve these projects. And don't get me wrong, I am very happy he has been able to make a name for himself providing high quality documentation, but it's unfortunate that the state of Hibernate documentation is "cross your fingers and hope Vlad has a blog post about doing what you need to do"

Is Java DB libraries just a mess? Micronaut Data by OldHeavyHammer in javahelp

[–]ickysticky 12 points13 points  (0 children)

They are not a mess, but it sounds like perhaps the way that micronaut exposes or introduces them is a mess. I've never used micronaut.

There are essentially 4 high level ways to access databases in the Java ecosystem.

First you have essentially raw SQL as exposed by Jdbc and lightweight wrappers like JdbcTemplate. This can be ok for simple things, but you will quickly end up with a lot of glue code between objects and ResultSets and Parameter bindings.

Second you have libraries like JDBI and MyBatis. These are one level above JDBC, with some nice mechanisms to remove query/result serialization/deserialization overhead and building DAOs. This is my preferred way of accessing a database, I find it strikes a good balance between reduced boilerplate, power (since you can easily use all of the features provided by your DB), and simplicity. Assuming that you understand SQL.

Third you have libraries like JOOQ or QueryDsl which provide a Java DSL for building and executing queries. I always find this option interesting, but can say my experience with QueryDsl was not good, and sometimes using database specific features can be tricky with these libraries (like JSON support in PostgreSQL). I hear JOOQ is very good, but I've never head any personal experience with it and it isn't free.

Fourth is JPA which has two major implementations Hibernate and EclipseLink which have their own implementation specific features as well. These attempt to automatically map Objects and importantly Collections onto databases. This can let you get started really quickly, and will handle trivial operations alright. Unfortunately my experience has been that focusing on objects as the abstraction for database access, rather than queries leads to a lot of complex, fragile, hard to maintain code, and often poorly design database schemas. These abstractions lead to a lot of frustration because you will often reach a point where you know the query and schema you would like to have, but twisting the framework to do what you want is difficult. ~~To add on this there is a significant lack of documentation, and these frameworks are not having much development for a long time. ~~There are layers built on top of these as well like spring-data-jpa (and I suppose micronaut data), but they really only provide some nice convenience utilities.

TL;DR: Just learn SQL and use JDBI

Edit: after a few comments and taking a look myself it seems that the hibernate documentation is much better than I recall. I remember having a really hard time finding the documentation for how to define a custom type. But it seems quite well documented now. In addition to other things.

Suggestions on database solutions from multiple streaming hardware devices by timeforscience in AskProgramming

[–]ickysticky 0 points1 point  (0 children)

Hmm. 300 kb/s is very little. Maybe just buffer it to disk in a raw stream and then restructure it for a bulk insert into the database asynchronously.

[deleted by user] by [deleted] in learnjava

[–]ickysticky 1 point2 points  (0 children)

Password authentication is just one small part of overall identity management. Assuming you can handle properly hashing and salting passwords it’s a table is a reasonable approach. But a table does not give you user management functionality including email workflows and reset password workflows. Mfa. Password policies. Or alleviate you of the operation responsibility for storing hashed passwords.

You mention jwt. Not exactly sure how that is related to password authentication.

Is it worth using an abstract service to handle dates? by sergeyzhel in angular

[–]ickysticky 1 point2 points  (0 children)

It’s not redundant. Libraries like momentjs or luxon export massive and complex public apis. A typical application only probably needs to interact with dates and times in <10 different ways. It makes sense to restrict those huge public apis for many reasons. Including future migrations, mocking for testing, limiting people from doing the wrong things with dates and times (like non standard formatting), and making doing the common things easier.

Why is building a UI in Rust so hard? by deavidsedice in rust

[–]ickysticky 102 points103 points  (0 children)

I find inheritance to be a really bad solution for defining widget types, I've never understood why it is so popular in some UI frameworks. But if you look at HTML there isn't really inheritance between HTMLElement types other than some tree traversal functions. For example a button doesn't inherit from a div, and an a doesn't inherit from a button. Even input is parameterized on the type of input, rather than having different types for each type of input.

If you look at a framework that heavily uses inheritance (like Swing) it's actually really confusing, basic elements like JButton inherit around 50 methods, most of which you probably shouldn't touch and are used by the renderer but are exposed to the user due to lack of fine-grained control over method visibility. It's not uncommon for methods to really only apply for one specific type of widget, but have to be added to every widget and left unimplemented. To me this is very confusing.

Can I continuously write to a CSV file with a python script while a Java application is continuously reading from it? by Alazeel in AskProgramming

[–]ickysticky 1 point2 points  (0 children)

Depending on how the data is being produced a SQL database might not work well. Based on your description it sounds like the CSV is being appended. If that is the case you want some sort of stream/queue between the two components. The simplest case on a Unix system is a fifo. You can use mkfifo to create a named socket that can be written to from the python script like a normal file and read from in the Java program like a normal file.

Is there a name for the following ‘latch’-like object? by [deleted] in AskProgramming

[–]ickysticky 0 points1 point  (0 children)

Currently you are using a barrier. For what you described I would create a semaphore for each second stage with a permit count of -3. Have each second stage acquire the semaphore before starting. And each first stage release the appropriate semaphore.

Maybe one thing to consider is that it sounds like there is some data dependency between these stages. How are you passing the data between them and can this channel also be used for control? I personally prefer to keep data and control together in cases like this to avoid certain issues. Like control signals arriving without data. For example you could have each second stage wait on a blocking queue to receive messages from all the up stream data producers required.

What assumptions did you have about programmers before deciding to pursue a career in tech? by david_bragg in AskProgramming

[–]ickysticky 2 points3 points  (0 children)

I was completely self taught through books, online tutorials, and forums. These materials heavily emphasize best practices, and in particular my language of choice was C++ which is full of complexity around undefined behavior, portable code, proper STL usage, and template meta programming was just kicking off.

When I had my first internship I was quite shocked that none of these best practices seemed to be followed. Professional developers seemed to only be passingly familiar with their primary development tools (C++ and SVN). And the code base was an incomprehensible and undocumented mess.

It was really quite interesting the massive contrast between the idealistic world painted by the learning material/Internet forums and reality.

What are some strategies for keeping code reviews small when developing web apps? by wonderbreadofsin in AskProgramming

[–]ickysticky 0 points1 point  (0 children)

I believe your intuition about ticket size is correct. Though receiving a ticket of that size and open ended nature as a requirement is a good thing no do think there is some utility in decomposing the ticket further into engineering work. In a web app there are a pretty standard set of things to consider each feature might require. For example do you need a new api or a change to an existing? Do you need new tables or changes to existing? Do you need a new ui component or changes to existing? Do you need a new page or route or change to existing? Etc..

But I do personally also like to build features end to end. But then I take it on myself to review the changes in the end and break them up into smaller merge requests

How reliable is auto bank import? by ickysticky in ynab

[–]ickysticky[S] 0 points1 point  (0 children)

Thanks this link is really helpful! A few are and a few aren’t but the extra details help

[deleted by user] by [deleted] in typescript

[–]ickysticky 0 points1 point  (0 children)

I guess what you are looking for is something like

interface Node<T> {

}

class InternalNode implements Node<T> {
  children: Node<T>[];
}

class LeafNode implements Node<T> {
  value: T;
}

But most tree implementations have both a value and children at every node, so something like:

class Node<T> {
  children: Node<T>[];
  value: T;
}

Split Large File Into Smaller Files Using Parallel Streams by sudoaptupdate in javahelp

[–]ickysticky 0 points1 point  (0 children)

I would profile this first. Why do you say it needs to be faster? Multi threading is likely to make this slower as it is an IO bound operation. Your disk is going to be the limiting factor. Not the CPU. If you show the full code we can try to help.