submitted 5 days ago* (last edited 3 days ago) by ericjmorey@programming.dev to c/programming@beehaw.org

cross-posted from: https://lemmy.world/post/9117180

If you're writing Advent of Code solutions in Rust, then I've written a crate that can fetch the user input data directly from the main website.

Long story short, you provide it a login token copied from your browser cookies, and it can fetch the input data by year and day. Inputs are cached locally, so it'll only download it once for a given problem. This was heavily inspired by the PyPi advent-of-code-data package.

Unlike other AoC-centric Rust crates, that's all it does. The other crates I've seen all want the code structured in a specific way to add timing benchmarks, unit testing, and other features. I wanted something lightweight where you just call a function to get the input; no more and no less.

To use the crate:

  • Follow the AoCD instructions to set the AOC_SESSION environment variable.
    This key is used for authentication and should not be shared with anyone.
  • Add the aocfetch crate to your Cargo.toml [dependencies] section:
    aocfetch = { git = "https://github.com/ooterness/AdventOfCode.git" }
  • Import the crate and call aocfetch::get_data(year, day) to fetch your input data.

An example:

use aocfetch;

fn main() {
    let input = aocfetch::get_data(2023, 1).unwrap();
    println!("My input data: {}", input);
    println!("Part 1 solution: 42");    // TODO
    println!("Part 2 solution: 42");    // TODO

If this goes well I will submit it to crates.io, but I wanted to open this up for beta-testing first.

submitted 1 week ago* (last edited 1 week ago) by ericjmorey@programming.dev to c/programming@beehaw.org

cross-posted from: https://programming.dev/post/6660679

It's about asking, "how does this algorithm behave when the number of elements is significantly large compared to when the number of elements is orders of magnitude larger?"

Big O notation is useless for smaller sets of data. Sometimes it's worse than useless, it's misguiding. This is because Big O is only an estimate of asymptotic behavior. An algorithm that is O(n^2) can be faster than one that's O(n log n) for smaller sets of data (which contradicts the table below) if the O(n log n) algorithm has significant computational overhead and doesn't start behaving as estimated by its Big O classification until after that overhead is consumed.


Image Alt Text:

"A graph of Big O notation time complexity functions with Number of Elements on the x-axis and Operations(Time) on the y-axis.

Lines on the graph represent Big O functions which are are overplayed onto color coded regions where colors represent quality from Excellent to Horrible

Functions on the graph:
O(1): constant - Excellent/Best - Green
O(log n): logarithmic - Good/Excellent - Green
O(n): linear time - Fair - Yellow
O(n * log n): log linear - Bad - Orange
O(n^2): quadratic - Horrible - Red
O(n^3): cubic - Horrible (Not shown)
O(2^n): exponential - Horrible - Red
O(n!): factorial - Horrible/Worst - Red"



Preamble: I'm sure there's a better community to ask this question, comment below if you're aware of it.

Okay, for background I'm a bootcamp student, I'm still learning, but I'm almost done. I've been tweaking my LinkedIn as I go, trying to be more attractive for recruiters in the future. Well, last week I was contacted by a recruiter, and asked if I was interested in job opportunities. I did some brief research, and it looks like an actual company on Glassdoor. Anyway, I sent over my resume, and was on a call for maybe 5 minutes. We talk for a bit, and she asked me how I am in interviews and my experience. I tell her that I've been "technically" freelance, but I haven't done anything because of starting cost, but she seemed to ignore that concern. Towards the end of the call I asked her if this would be with her company, and she said yes, and then I said bye.

Now, the problem is that this company is specifically for interview prep, and helping students get hired at other companies. While she said I'd be with her company, I'm concerned that I'm trying to be sold something here. The company is called GigaMe, and there is barely anything online about them.

So, my overall question would be, "what would you do?" Or, what should I expect? I don't think i should get my hopes up, but any advice would help.

submitted 1 week ago by t_378@lemmy.one to c/programming@beehaw.org

A friend of mine is interested in the "sovereign artist" model, which basically means that you self publish and self release your own work on your own website, as opposed to using a publishing house or art gallery.

It's powerful because it gives everyone a platform to share "niche" art, but as a consumer, it can be difficult to find and "curate" high quality, interesting works of art. Is there a rating/voting system that exists that is resitant to internet vote tampering?

I'm talking about how 10 years ago, Amazon reviews were pretty helpful. But now they've been swarmed with paid and bot written reviews. Same with Slickdeals and many others.

I'd want a voting system that incorporates some ideas:

  • it would prevent one person from making multiple fake accounts
  • reviews wouldn't be suppressed or promoted by paid algorithims
  • the algorithm WOULD help connect people to items they are interested in. But maybe the workings of it would be open source, so it can be audited for bad acting.

Does a project like this exist somewhere? Rather than host that project in one place, it could be powerful to defederate and prevent the temptation to manipulate algorithms.

submitted 1 week ago* (last edited 1 week ago) by drailin@kbin.social to c/programming@beehaw.org

Hey there everyone, I am back with v1.1 of my Latex Template for making D&D Item Cards. I received one major point of feedback from multiple people in the fediverse: make an option for fixing the card dimensions for easier printing and distribution/storage at the table. So that is exactly what I did!

Now you can choose the (admitedly more user-friendly) option of letting the card length vary for digital distribution, or you can fix the card aspect ratio. The item art background and text backgrounds can also now be changed, and a number of options have been included for item art backgrounds, but you can use whatever images you want.

Example Cards

The fixed-size cards are 5:7 by default, the same as playing cards. They include a front and back side for longer item descriptions, but you will have to edit the text more carefully and decide where to split between front/back content.

For the printable card item art, I highly recommend using a PNG with a transparent background and modifying tcolorbox interior style to set your background. Ensure your backgound art is close to 7:5 for best results. You can also load your image as the background art if you'd like instead, again, making sure it is in 7:5.


cross-posted from: https://programming.dev/post/6470590

This looks like a great starting point for people with little to no experience with programming to learn to program using Python.

Everything taught by futurecoder.io can be used locally on your own computer. But futurecoder.io doesn't show you how to install Python on your machine but you can fill in that gap with the information provided @ https://wiki.python.org/moin/BeginnersGuide/Download

Other resources are provided on the python.org Beginners Guide if needed.


Hey there programmers, I know this is a more markup/typesetting deal, but I thought there might be people who are interested. After being dissapointed with many of the options out there for making ttrpg item cards, I made a LaTeX template for that exact purpose. I wanted it to be relatively easy to use, generate clean images, and be (semi) form fillable. The cards scale in height with the quantity of text given and image size, so users don't need to finagle with the box dimensions too much, and all card sections (generated by custom commands) can either be commented out or toggled off if they aren't relevant to the item.

If there are any people familiar with TeX who have thoughts or constructive criticism, I would love to get some more eyes on this. I have already posted this in the relavant ttrpg areas, but I am hoping people here might have more technical critiques. I have already gotten feedback that a setting for fixed dimensions would be smart in case players want to get card sleeves or a card binder, and want to make a back side for longer item descriptions, which I will work into V2.

Here is an example of a completed card with all the trimmings: Staff of the Jackal Lord

Thanks to anyone who takes the time to check it out, and if anyone uses it, please let me know what you think!


Hi. Is there some fully FOSS version of Intellij IDEA CE? Because the official download includes some proprietary bits.


I accidentally discovered that both "cd ..." and "..." work, and moreover, I can add more dots to go back further! I'm using zsh on iTerm2 on macOS. I'm pretty sure this isn't a cd feature. Is this specific to zsh or iTerm2? Are there other cool features I just never knew existed??

I'm so excited about an extra dot right now.

Everyday Use of GNU Guix (www.youtube.com)
submitted 1 month ago by mrh@mander.xyz to c/programming@beehaw.org
submitted 1 month ago* (last edited 1 month ago) by potterman28wxcv@beehaw.org to c/programming@beehaw.org

Cross-posting this here as I saw some misconceptions about Rust language

I think that blog describes well the pros of using a strongly-typed language like Rust is. You may fight the compiler and get slower build times but you get less bugs because of the restrictions the language imposes you.

The biggest con of Rust is that it requires learning to be used, even for someone who has already programmed before. It's not like Python or Ruby where you can just dive in a code base and learn on the go. You really need to read the Rust book (or skim through it) to get through the notions. So it has a higher entry level, with all the misunderstandings that come with it.

submitted 1 month ago by Paradox@lemdro.id to c/programming@beehaw.org
submitted 1 month ago by Five@slrpnk.net to c/programming@beehaw.org

I have a couple sites on Google and since they sold to square space I thought I'd try to keep my stuff there. But I can't figure it out. Square space is a site builder with a GUI and I can't find anywhere to just deploy my site to them as a react app. I have found a few areas where I can add some code, but they are for specific areas of the provided templates. I've even tried to use developer mode, but it looks like you still need to follow their template rules to get anywhere.

It's been a huge headache, Google made it so easy.

submitted 1 month ago by Vitaly@feddit.uk to c/programming@beehaw.org
submitted 1 month ago* (last edited 1 month ago) by shortwavesurfer@monero.town to c/programming@beehaw.org

Any ideas? I am attempting to write a script that uses sed.

If done this way it fails

  • rmdec="sed 's/..................$//'"
  • i1xmr=$(echo "$i1p/$apiresponse*1000" |bc -l |$rmdec)

But if i do it this way it works

  • i1xmr=$(echo "$i1p/$apiresponse*1000" |bc -l | sed 's/..................$//')

I’m an accidental DBA, but I still never quite got the hate for ORMs. I thought this article does a good job explaining the issue, and why they aren’t so bad.


Honestly all this world looks really overwhelming, there's too much stuff going on: each program uses its own languages, its own compilers, uses different tools, libraries, dependencies, package managers and frameworks. You need specific instructions and documentation to learn new stuff at every single thing you deal with.

Whenever i open a project on Github i just feel overwhelmed because there will always be something new and i'm afraid i won't ever get out of that way of operate that "somehow makes things work" and really understand my code and program interactions..

Honestly it's really complicated because you use a program you need and you just see it from the surface, you don't have the time to learn how things work in a slightly more linear way, it would take ages considering the fact you probably need other 10 programs like that. To me it looks just like modern programming is about grabbing different pieces of fragmented knowledge all around web forums, wikis (or chatbots, which for me are just the next way of giving up our ability to learn) and somehow making things work.

I just get overwhelmed even when i take a look to a github page sometimes, even the frontpage has so much stuff you won't ever learn.

Another thing is the online community is the most sparse thing, far from actual real communities there is, you can work with people who won't ever even talk to, and their contribute can be as sterile as just creating a pull request and then leaving forever. You are mostly on your own striclty speaking of human connections and ability to share ideas and feelings.

I'm very fought because i somehow feel like i really love how certain ideals and creativity can be expressed with programming: i love that you can use something practical to solve idealistic, creative and technical problems. I love stuff such as digital etic, cypherpunk movemenet and all the work that opensource devs do to make the industry just a bit better, sometimes even receiving donations for their work, which for me is the highest form of payment, i've never seen someone more happy to pay for something as in the opensource community. But at the same time i'm starting to loathe technology and the internet because, adding on top of everything i said above about the sterility of the community, the difficulty to concentrate on a single thing and the dispersion there can be, i'm also dealing with a 10 years porn addiction since 5 years ago, progresses happens but are really slow and using my computer or phone is a huge trigger even if i'm trying my best to make them as minimal and not addictive as possible. Trust me, in a world designed to get you addicted to your hardware and software, being grown up used to doom scroll every day, it takes a huge amount of time and effort to have your things all sorted up to guarantee yourself a bit more privacy and software that is actually useful and doesn't want to keep you hooked, and at the same time don't be too much of a social outcast. You actually have to re-learn computer, or better saying, to actually learn computer for the first time, because you realize you can't just rely on having everything ready, set up, and just working from scratch without paying in some way, and the price that most big techs set is even higher, and far more subtle than just paying with money.

The software industry right now is shit outside of the few developers that are actually building products FOR users, and not for money, and of course that does mean that if i follow my ideals, i won't nearly have these much economical opportunities as every "usual" developer gets. It's a huge headache having to deal with programs even when i do it for myself, i can't even think of doing that for someone else right now (with all the work and continuity that this requires) and i'm thinking if i should really put my efforts somewhere else.

submitted 1 month ago* (last edited 1 month ago) by Luka@beehaw.org to c/programming@beehaw.org

I've watched Bro code on YouTube for learning html and CSS and I enjoyed his explaining, teaching and such. After i completed his YouTube course I went onto numerous different sources to learn more. I found that he teached me most of the stuff that I found afterwards. When I was happy with my html and CSS skill to the point I can write some simple web page with the help of a few searches I decided to move onto js. I was looking to find what are some good places to learn and I found a ton of people talking about some net ninja so I checked him out. I am currently around episode 10 and I have grown to like his way of explaining and teaching. I haven't tried bro code's cource for js so idk if it's any better. That's why I am looking for help from you, have any opinions maybe watched both? Please let me know🙌

Bro code on YouTube: https://www.youtube.com/channel/UC4SVo0Ue36XCfOyb5Lh1viQ

Net ninja on YouTube: https://www.youtube.com/@NetNinja

Exercism (exercism.org)

Does anyone here use Exercism? I've started using it to learn Elixir, and it seems to be good. I'm thinking about having my kids use it as well for Python and JS/TS.

I'd be interested to hear if anyone's used it for a long time, and if there's any advantages or disadvantages to it. Or if there are other, better code exercise sites I should check out.

submitted 2 months ago* (last edited 2 months ago) by homoludens@feddit.de to c/programming@beehaw.org

Can anyone recommend a good introduction/book to TypeScript for people who already know some programming (e.g. Java, Python) but have no experience with JavaScript?

The only texts I've found so far assume prior JS knowledge (like The TypeScript Handbook https://www.typescriptlang.org/docs/handbook/intro.html) or seem rather unstructured to me (e.g. dropping a lot of different ways and shortcuts to do things without explaining concepts or making no clear distinction between basics/best practices and advanced use cases/edge cases).

Ideally it would explain core concepts (like functions, types, classes, ...) first, with their most common use cases. Later chapter would do deep dives into different topics.

Edit: when I'm talking about TypeScript I'm talking about the whole language, not just the "modifications" it makes to JavaScript.


Hello! In my Cordova android app I'd like to get the info (title, author, duration etc) of the currently playing song (in another application, like spotify or any mp3 player).
I didn't find any cordova plugin to do this directly, and on the web I only found android-only ways, but sadly I have 0 experience with java/kotlin. How can I do this in cordova?

thanks in advance!

submitted 2 months ago by lonewalk@lemm.ee to c/programming@beehaw.org

insomnia just enshittified itself and requires cloud login like postman, and force upgrades you from the old version even if you disable updates. this blocked me at work today.

this client looks great, wanted to boost it here in case anyone else got screwed by Insomnia this morning.

view more: next ›


2 readers
1 users here now

All things programming and coding related. Subcommunity of Technology.

This community's icon was made by Aaron Schneider, under the CC-BY-NC-SA 4.0 license.

founded 6 months ago