What are you coding?

In anticipation and for lack of java programming at work… I’ve been fiddling with my advent of code “framework” and made a new repository with “release” branches for solutions for each year.

I have now added a class that downloads my daily input (via hardwired session cookies–thanks I am too lazy to actually do oauth when a session cookie is enough, it’s not like my github session dies all the time). And this time I remembered putting the properties file in .gitignore before accidentally pusing it to github. (I recently learned how to clean up passwords from github repositories–it was my private repo but yikes)

And I also added another class that parses the examples from the daily problem description because I always use those for testing my solutions and I am too lazy now to copy paste.

I can’t remember that java dependency management sucked so badly. Might be because I didn’t initialize this as a maven project originally and it is all handmade and therefore IntelliJ is sulking?

I mean something is wrong when I wish it were working like python dependency management.

3 Likes

I know there are many things to object to about cargo (for Rust) but it doesn’t half make dependency management relatively painless.

Unfortunately someone on Mastodon recently mentioned https://oort.rs/ (control a spaceship by writing Rust code) and, well, yes.

3 Likes

Someone mentioned https://everybody.codes/ on Mastodon.

It’s basically very like Advent of Code, but in November, and three parts per problem.

Restricting myself to one problem a day. :slight_smile:

3 Likes

Today at work.

I eventually found out that oracle actually has errors in select * from user_error which would have been helpful ages ago. Why oh why does IntelliJ (and Oracle Sql Developer) insist on giving me the shitty cryptic error codes?

It’s probably common knowledge among database programmers but I am just a simple fullstack java dev. How am I supposed to know that the database stores the error details in a database table? WTF.

Also database programming is just such a different paradigm…

4 Likes

When dealing with Oracle, my first guess is “what would be technically justifiable but maximally inconvenient”.

4 Likes

When dealing with Oracle, my first guess would be, “how best to monetize this?”

Larry Ellison is in the tech industry to make money; bringing technical excellence is a secondary consideration that follows, reluctantly, from that priority.

2 Likes

My first step with Oracle would be to ask my mum. :slight_smile:

(She used to be an Oracle DBA.)

3 Likes

where else should a database put error messages?

More seriously, putting the stuff into the database makes it possible to write software that intelligently reports errors, and lets the database apply db-level permissions on what gets to see them. those are both very real wins for large scale software.

3 Likes

You are not wrong that at the software level this might be useful.

But while developing I would like to see compile errors somewhere immediately not just “compile failed here’s a cryptic code, hope you know what you’re doing”. I did find the error eventually. And I will remember in the future. That said I was hired because database programming is a side skill (and I repeatedly said that all my experience with PL/SQL is from the last project and I would only qualify this as basic knowledge) I have in addition to my application programming knowledge which was the primary reason.

2 Likes

Once I worked with PL/Perl. It is dark and most of Perl doesn’t work. You may be eaten by a grue.

2 Likes

I once wrote lisp to write perl, which did the obvious thing. I no longer understand why this seemed like a sensible course of action, but at the time, it was only a 7 on the 11 point hairbrain scheme scale. The whole application was the reason the scale needed to go to 11, so 7 was comparatively sane.

2 Likes

Talk about a factory pattern

2 Likes

And Advent Of Code 2024 Day 1 solved. Not that it was hard. The hardest part was getting my example and input downloader to work properly.

3 Likes

Reused my downloading code from last year, which meant working out how to steal the session cookie again. Surprised to see a hash on day 1.

Also done Everybody Codes up to day 10. I’m not going to be able to keep up with AoC but I’ll keep going on EC when I have time after that.

2 Likes

I did not steal the session cookie: I opened the developer tools in the browser and copied it to my properties file :smiley:

{
  "tests": [
    {
      "input": "3   4\n4   3\n2   5\n1   3\n3   9\n3   3\n",
      "solutions": [
        "2",
        "1",
        "0",
        "1",
        "2",
        "5",
        "11"
      ]
    },
    {
      "input": "3   4\n4   3\n2   5\n1   3\n3   9\n3   3\n",
      "solutions": [
        "9",
        "4",
        "9",
        "9",
        "31"
      ]
    }
  ],
  "tagline": "Historian Hysteria",
  "day": 1,
  "url": "https://adventofcode.com/2024/day/1"
}

This is how my downloader formats the examples on the page. I still need to actually read the problem and decide which of the “solutions” (usually the last one) is the actual solution and I copy that to my code instead of automatically taking the one from the file. But it is super helpful for lazy me. Sadly, json doesn’t do multi-line formats but the linebreak works just as well. It is just not very human readable that way. But xml parsing in java sucks even more.

1 Like

Ah, I was thinking of… now where did it come from? This thing. I use it to download puzzle and input to local files and look at them in the terminal. It even handles answer submission and grabbing the part 2.

2 Likes

My solution for day2 took me way too long. well part1 anyway. (of course they are numbered part 0 and part 1).

What made me stumble was that java’s List overloads the remove() operation. Whenever I wanted to use the “damper” to remove an element from the Report by index, java decided instead to try and remove an Object equal to that index…

So this is the resulting code:

List<Long> newLevels = new ArrayList<>(levels);
newLevels.set(index, null);
return new Report(newLevels.stream().filter(Objects::nonNull).toList(), false).safe();

(Not a spoiler for a solution so I am not blurring it.)

1 Like

Thankfully, I was able to abuse python list comprehensions, per usual, so day2 was overall fairly easy.


In other news, I’ve returned to 2023 to pick back up on day17.

I may regret this decision. Something about this problem space has me completely lost.

2 Likes

Aoc 2: Rust can remove from a vector (flexible list structure, like an ArrayList). It means copying, but that wasn’t so bad; my “real” input was only 1,000 lines × maximum eight readings.

EC 11: it used single-character identifiers until part 3, when it switched to three characters. Indexing hashes on strings in Rust can be hard work, but there’'s a built-in to parse a string as a base-36 number (0-9, A-Z), so I just switched to that rather than a char or string type

1 Like

Oh. I was being dumb (as per my wont). Build the bespoke bespoked graph then pathfind through it

2 Likes