1
46
2
63

I've encountered this many times where I simply don't understand the context and use of an API based of the API documentation unless I can find an example that already utilizes it in a working project. The first thing that comes to mind is Py Torch. I've tried to figure out how some API features work, or what they are doing in model loader code related to checkpoint caching but failed to contextualize. What harebrain details are obviously missing from someone who asks such a silly question?

3
30

A new ADP Research Institute report shows employment for software developers has declined from January 2018. Data elsewhere show fewer opportunities for people to fill software development and tech roles after the US labor market is no longer as hot as it was a few years ago.

"The tech job market has undeniably slowed since the end of 2022, cooling after a few years of rapid hiring during the pandemic recovery," Daniel Zhao, Glassdoor's lead economist, said in a written statement. "Rising interest rates, the end of pandemic-era trends and a slowing economy overall has crimped demand for tech workers."

4
62
submitted 3 days ago* (last edited 3 days ago) by alphacyberranger@sh.itjust.works to c/programming@programming.dev

How do people find out or know whether your repo which is having MIT or apache or AGPL license is being used by a corpo and profiting from it and not making the code open source or paying license fees?

5
434
submitted 4 days ago* (last edited 4 days ago) by ch00f@lemmy.world to c/programming@programming.dev

I originally told the story over on the other site, but I thought I’d share it here. With a bonus!

I was working on a hardware accessory for the OG iPad. The accessory connected to the iPad over USB and provided MIDI in/out and audio in/out appropriate for a musician trying to lay down some tracks in Garage Band.

It was a winner of a product because at its core, it was based on a USB product we had already been making for PCs for almost a decade. All we needed was a little microcontroller to put the iPad into USB host mode (this was in the 30-pin connector days), and then allow it to connect to what was basically a finished product.

This product was so old in fact that nobody knew how to compile the source code. When it came time to get it working, someone had to edit the binaries to change the USB descriptors to reflect the new product name and that it drew <10mA from the iPad's USB port (the original device was port-powered, but the iPad would get angry if you requested more than 10mA even if you were self-powered). This was especially silly because the original product had a 4-character name, but the new product had a 7-character name. We couldn't make room for the extra bytes, so we had to truncate the name to fit it into the binary without breaking anything.

Anyway, product ships and we notice a problem. Every once in a while, a MIDI message is missed. For those of you not familiar, MIDI is used to transmit musical notes that can be later turned into audio by whatever processor/voice you want. A typical message contains the note (A, B, F-sharp, etc), a velocity (how hard you hit the key), and whether it's a key on or key off. So pressing and releasing a piano key generate two separate messages.

Missing the occasional note message wouldn't typically be a big deal except for instrument voices with infinite sustain like a pipe organ. If you had the pipe organ voice selected when using our device, it's possible that it would receive a key on, but not a key off. This would result in the iPad assuming that you were holding the key down indefinitely.

There isn't an official spec for what to do if you receive another key-on of the same note without a key-off in between, but Apple handled this in the worst way possible. The iPad would only consider the key released if the number of key-ons and key-offs matched. So the only way to release this pipe organ key was to hope for it to skip a subsequent key-on message for the same key and then finally receive the key-off. The odds of this happening are approximately 0%, so most users had to resort to force quitting the app.

Rumors flooded the customer message boards about what could cause this behavior, maybe it was the new iOS update? Maybe you had to close all your other apps? There was a ton of hairbrained theories floating around, but nobody had any definitive explanation.

Well I was new to the company and fresh out of college, so I was tasked with figuring this one out.

First step was finding a way to generate the bug. I wrote a python script that would hammer scales into our product and just listened for a key to get stuck. I can still recall the cacophony of what amounted to an elephant on cocaine slamming on a keyboard for hours on end.

Eventually, I could reproduce the bug about every 10 minutes. One thing I noticed is that it only happened if multiple keys were pressed simultaneously. Pressing one key at a time would never produce the issue.

Using a fancy cable that is only available to Apple hardware developers, I was able to interrogate the USB traffic going between our product and the iPad. After a loooot of hunting (the USB debugger could only sample a small portion, so I had to hit the trigger right when I heard the stuck note), I was able to show that the offending note-off event was never making it to the iPad. So Apple was not to blame; our firmware was randomly not passing MIDI messages along.

Next step was getting the source to compile. I don't remember a lot of the details, but it depended on "hex3bin" which I assume was some neckbeard's version of hex2bin that was "better" for some reasons. I also ended up needing to find a Perl script that was buried deep in some university website. I assume that these tools were widely available when the firmware was written 7 years prior, but they took some digging. I still don't know anything about Perl, but I got it to run.

With firmware compiling, I was able to insert instructions to blink certain LEDs (the device had a few debug LEDs inside that weren't visible to the user) at certain points in the firmware. There was no live debugger available for the simple 8-bit processor on this thing, so that's all I had.

What it came down to was a timing issue. The processor needed to handle audio traffic as well as MIDI traffic. It would pause whatever it was doing while handling the audio packets. The MIDI traffic was buffered, so if a key-on or key-off came in while the audio was being handled, it would be addressed immediately after the audio was done.

But it was only single buffered. So if a second MIDI message came in while audio was being handled, the second note would overwrite the first, and that first note would be forever lost. There is a limit to how fast MIDI notes can come in over USB, and it was just barely faster than it took to process the audio. So if the first note came in just after the processor cut to handling audio, the next note could potentially come in just before the processor cut back.

Now for the solution. Knowing very little about USB audio processing, but having cut my teeth in college on 8-bit 8051 processors, I knew what kind of functions tended to be slow. I did a Ctrl+F for "%" and found a 16-bit modulo right in the audio processing code.

This 16-bit modulo was just a final check that the correct number of bytes or bits were being sent (expecting remainder zero), so the denominator was going to be the same every time. The way it was written, the compiler assumed that the denominator could be different every time, so in the background it included an entire function for handling 16-bit modulos on an 8-bit processor.

I googled "optimize modulo," and quickly learned that given a fixed denominator, any 16-bit modulo can be rewritten as three 8-bit modulos.

I tried implementing this single-line change, and the audio processor quickly dropped from 90us per packet to like 20us per packet. This 100% fixed the bug.

Unfortunately, there was no way to field-upgrade the firmware, so that was still a headache for customer service.

As to why this bug never showed up in the preceding 7 years that the USB version of the product was being sold, it was likely because most users only used the device as an audio recorder or MIDI recorder. With only MIDI enabled, no audio is processed, and the bug wouldn't happen. The iPad however enabled every feature all the time. So the bug was always there. It's just that nobody noticed it. Edit: also, many MIDI apps don't do what Apple does and require matching key on/key off events. So if a key gets stuck, pressing it again will unstick it.

So three months of listening to Satan banging his fists on a pipe organ lead to a single line change to fix a seven year old bug.

TL;DR: 16-bit modulo on an 8-bit processor is slow and caused packets to get dropped.

The bonus is at 4:40 in this video https://youtu.be/DBfojDxpZLY?si=oCUlFY0YrruiUeQq

6
14

I’m starting as data analyst (roughly bachelor level). My responsibility will be to analyze time series data and classify agents and write reports. I won’t be responsible for the database management. It’s likely that I have to use R because my colleagues use R. I guess I may use python if it’s more appropriate.

Which books and other things can you guys recommend? What should I avoid?

7
271

Organizations that do not consider themselves Oracle customers, but who use Java, can expect a call from the Big Red in the next three to nine months, according to a software licensing specialist.

House of Brick, which has spent years advising clients on how to manage their commercial arrangements with Oracle, said it had noticed an uptick in organizations seeking advice after being contacted by the tech giant about their Java use.

"Even if you are not an Oracle customer, they are tracking product downloads and matching the IP addresses to your organization. Oracle has deployed a whole team of people in India that are contacting organizations worldwide with claims of non-compliant Java SE usage," the company said in a blog, referring to the runtime environment.

While most Oracle and Java users have become aware of the changes, those who have never dealt with Oracle for their applications, database or middleware software might be new to the arrangement.

"They don't have a relationship with Oracle. But Oracle has tracked Java SE downloads to their company. And then Oracle approached them saying 'We see that you've been downloading our Java SE product, it requires a licence.' This might be an email coming from a person that has an audit or similar title in their signature," said Nathan Biggs, House of Brick CEO.

For example, Oracle is likely to ask for the installation date and ask whether the customer also deploys on VMware.

But Oracle will be leading towards an "offer" to overlook earlier unlicensed software if they agree to sign up to the new subscription model, Biggs said.

Organizations should be careful before they take up the offer, he said. Users with legacy Oracle agreements face more than 100 percent — even 1,000 percent — cost increases when moving to the new terms. Bills going from tens of thousands of dollars to more than a million have been confirmed by multiple licensing specialists.

He said Oracle is entitled to ask for backdated payments for people already using Java since the paid-for deal was announced. But whether they should be forced to adopted the 2023 per employee arrangement is a moot point.

To start with, Oracle will limit the back-payment to three years. But it will also try to charge users under the Universal pricing arrangement introduced in January 2023.

"This is absurd because the universal pricing has only been around for a year. We always then push back on Oracle," he said.

8
9
submitted 3 days ago* (last edited 2 days ago) by maximalian@sopuli.xyz to c/programming@programming.dev

I have a server (S-1) with HAProxy and a number of residential proxies (PR-s) as login-passwords-port. There're multiple users who will connect to the internet via S-1.

I want to have HAProxy to forward incomming traffic of the users via a random proxy amoung PR-s with 2 conditions:

  1. only when there's certain, pre-defined keyword in the URL, traffic must be routed via a proxy.
  2. In all other cases, it must go to a requested resource directly as is, without a proxy

How would I implement this?


(1) client -> HaProxy -> if keyword --> sub-proxy (random) -> website

(2) client -> HaProxy -> if no keyword --> website

9
54
A Rant about Front-end Development (blog.frankmtaylor.com)

Too good NOT to share.

My brothers and sisters in Christ I want you to know that I care about your souls enough to share these truths with you:

  • You don’t need JavaScript to make a web page.
  • You don’t need JavaScript to write styles.
  • You don’t need JavaScript to make an animation.
  • You don’t need JavaScript just to show content.
10
21
11
96
12
26
Sun Clock (sunclock.net)

(I did not make this project.)

I love this website. It helps me visualize time with regards to the sun very well. If I could get my FitBit to display this as a clock face I definitely would. It's such a beautifully simple site.

I'm sharing it in honor of the solstice today. It's (roughly) solar noon on the east coast. I think I found this site on Reddit prior to the Lemmy Exodus, so I'd like to share it here for everyone to enjoy. Happy solstice. Happy summer (or winter for our friends in the southern hemisphere).

Also, based on the community info panel I believe this is on topic here, but if there is a better community for "cool site I found" let me know. ❤️☀️

13
23
submitted 5 days ago* (last edited 5 days ago) by onlinepersona@programming.dev to c/programming@programming.dev

I'd basically like to run some containers within a VPN and some outside of it. The containers running within the VPN should not be able to send or receive any traffic from outside the VPN (except localhost maybe).

The container could be docker, podman, or even a qemu VM or some other solution if need be.

Is that possible? Dunno if this is the right place to ask.

---Resolution-------

Use https://github.com/qdm12/gluetun folks.

Anti Commercial-AI license

14
25

GitHub Copilot Workspace didn't work on a super simple task regardless of how easy I made the task. I wouldn't use something like this for free, much less pay for it. It sort of failed in every way it could at every step.

15
-9
16
-34
17
31
18
39

Martin Kleppmann sets out a vision: "In local-first software, the availability of another computer should never prevent you from working."

He describes the evolution of how to classify local-first software, how it differs from offline-first, and proposes a bold future where data sync servers are a commodity working in tandem with peer-to-peer sync, freeing both developers and users from lock-in concerns.

19
42

So how do you guys test visual programming languages? These languages include Labview, Simulink, Snaplogic, Slang, etc. I ask because I'm working on improving the testing suite we use at my job for Snaplogic. The way we currently lest is we have a suite of pipelines that have certain snaps and we just run those pipelines and look for errors in a testing environment every release.

What I'm really trying to figure out is how to run Functional Tests (unit, integration, system) and Non-Functional Tests (security, performance). In a language such as Python this can be straight forward but in a visual language or a service offered by another company then it is a bit more difficult.

I am thinking of creating a custom test suite using the modules used in our pipelines and using Python to generate JSON and SQL data. Does anyone do something similar?

20
16
21
79
22
34

I'm sure most of us have had to deal with issues reported by end users that we ourselves aren't able to reproduce

This video is an extended case study going through my thought process as I tried to track down and fix a mysterious performance regression which impacted a small subset of end users

I look at the impact of acquiring mutex locks across different threads, identifying hot paths by attaching to running processes, using state snapshot comparisons to avoid triggering hot paths unnecessarily, the memory implications of bounded vs unbounded channels, and much more

23
57

I hope some people here enjoy reading these as much as I have

If you know of anything similar, I would love to hear them

24
22

A list of major Java and JVM features since JDK 17 to 22,

New language features JEP-409: Sealed Classes (17) JEP-440: Record patterns (21) JEP-441: Pattern matching for switch (21) JEP 456: Unnamed Variables & Patterns (22)

API changes JEP-306: Restore Always-Strict Floating-Point Semantics(17) JEP-382: New macOS Rendering Pipeline(17) JEP-400: UTF-8 by Default (18) JDK-8301226 – Clamp method for java.lang.(Strict)Math (21) JEP-439: Generational ZGC JEP-444: Virtual threads (21) JEP-454: Foreign Function & Memory(FFM) API (22)

Security JEP-452: Key Encapsulation Mechanism API (21) JDK-8275252: keystore file Features JEP-408: Simple web server (18) JEP-423: Region pinning for G1 (22) JEP-458: multi-file source-code programs (22) JEP-423: Region pinning for G1 (22) JEP-458: multi-file source-code programs (22)

Documentation JEP-413: Javadoc code snippets (18)

Deprecations

Lookahead Scoped values + Structured concurrency Module import declarations

25
15
submitted 1 week ago* (last edited 1 week ago) by QuazarOmega@lemy.lol to c/programming@programming.dev

I was looking to implement a year column and while researching I stumbled on the YEAR data type which sounded just right by its name, I assumed that it would just be something like an integer that can maybe hold only 4 digits, maybe more if negative?
But then I noticed while actually trying it out that some years I was inputting randomly by hand never went through giving an out of range error, so I went to look at the full details and, sure enough, it's limited to years between 1901 and 2155, just 2155!
In terms of life of an application 2155 is just around the corner, well not that any software has ever lived that long, but you get what I mean in the sense that we want our programs to be as little affected by time within what's reasonable given space constraints.
So what will they do when they get close enough to that year, because you don't even have to be in that year to need it accessible, there could be references that point to the future, maybe for planning of some thing or user selected dates and whatnot; will they change the underlying definition of it as time passes so it's always shifted forward? If that's the approach they'll take, will they just tell everyone who's using this type that their older dates will just not be supported anymore and they need to migrate to a different type? YEAR-OLD? Then YEAR-OLDER? Then YEAR-OLDER-BUT-LIKE-ACTUALLY? Or, that if they plan to stay in business, they should move to SMALLINT?
Or will they take the opposite approach and put out a new YEAR datatype every time the 256 range is expired like YEAR-NEW, YEAR-NEW-1, YEAR-FINAL, YEAR-JK-GUYS-THE-WORLD-HASNT-COLLAPSED, etc.?

So I wonder, what's the point of this data type? It's just so incredibly restricted that I don't see even a hypothetical use.
There exist other questions like this (example) but I think they all don't address this point: has anyone from MariaDB or MySQL or an SQL committee (I don't know if that's a thing) wrote up some document that describes the plan for how this datatype will evolve as time passes? An RFC or anything like that?

view more: next ›

Programming

16146 readers
153 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 1 year ago
MODERATORS