Programming

16781 readers
141 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 [email protected]



founded 1 year ago
MODERATORS
1
 
 

Really intriguing article about a SQL syntax extension that has apparently already been trialed at Google.

As someone who works with SQL for hours every week, this makes me hopeful for potential improvements, although the likelihood of any changes to SQL arriving in my sector before I retire seems slim.

2
 
 

I've read an article which describes how to simulate the close ports as open in Linux by eBPF. That is, an outside port scanner, malicious actor, will get tricked to observe that some ports, or all of them, are open, whereas in reality they'll be closed.

How could this be useful for the owner of a server? Wouldn't it be better to pretend otherwise: open port -> closed?

3
41
submitted 1 day ago* (last edited 1 day ago) by [email protected] to c/[email protected]
 
 

Direct link to the table, for those who block off-site scripts:

https://flo.uri.sh/visualisation/19114866/embed?auto=1

Some of the labels don't seem to show up unless you zoom out.

4
 
 
5
 
 

For Box2D version 3.0 I decided to finally try using SIMD as it is meant to be used for solving contacts. Making contacts solve faster could yield large performance gains so I decided it would be worth the effort.

But how can I gather 4 or 8 contact pairs to be solved simultaneously? The key is graph coloring. The idea is to have a handful of colors to be assigned to all the contact constraints. For example, suppose I have 6 colors and I want to assign all the contacts to one of those 6 colors. Contact constraints act upon two bodies at a time. With graph coloring the restriction is that within a single color a body can only appear once or not at all.

...

I did all this work to enable SIMD processing. Did it help? Box2D has a benchmarking console application to help answer this question. I implemented SSE2, Neon, and AVX SIMD instruction sets in the Box2D contact solver. I also implemented a scalar reference implementation. I have 5 benchmarks scenarios that push Box2D in various ways. See the benchmark results here.

The large pyramid benchmark with 4 workers has the following numbers:

  • AVX2 : 1117 fps = 0.90 ms
  • Neon : 1058 fps = 0.95 ms
  • SSE2 : 982 fps = 1.02 ms
  • scalar (AMD): 524 fps = 1.91 ms
  • scalar (M2): 679 fps = 1.47 ms

...

The bottom line is that making good use of SIMD can be a lot of work but it is worth the effort because it can make games run significantly faster and handle more rigid bodies.

6
 
 

Is the new #zed editor mostly hype rn?

I can believe it’s good and cool ( built in graphics and collab seem to me like good ideas).

But as someone who happily stayed with sublime (with LSPs a likely game changer) …

takes like “it’s fast!”, “LSP!”, “it now has snippets!” … along with people telling me it has a plug-in system, but doesn’t (cf python/lua runtimes of sublime/nvim) give me massive hype vibes and honestly just feels very “2020s-tech”.

#programming

@programming

7
8
 
 

A project I saw linked in the css post, and wanted to share, because I love the insanity.

9
31
Firewalling Your Code (lackofimagination.org)
submitted 3 days ago by [email protected] to c/[email protected]
10
11
submitted 3 days ago* (last edited 3 days ago) by [email protected] to c/[email protected]
 
 

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

Hello Lemmings!

I am thinking of making a community moderation bot for Lemmy. This new bot will have faster response times with the help of Lemmy webhooks, an amazing plugin for Lemmy instances by @[email protected] to add webhook support. With this, there is no need to frequently call the API at a fixed interval to fetch new data. Any new data will be sent via the webhook directly to the bot backend. This allows for actions within seconds, thus making it an effective auto moderation tool.

I have a few features I thought of doing:

  • Welcome messages
  • Auto commenting on new posts
  • Scheduled posts
  • Punish content authors or take action on content via word blacklist/regex
  • Ban members of communities by their usernames/bios via word blacklist or regex
  • Auto community lockdown during spam

What other features do you think are possible? Please let me know. Any questions are also welcome.

Community requested features:

  • Strike system

Strikes are added to a certain member of the community and the member will be temporarily banned within a time period if their strike count reaches a certain threshold

  • Post creation restriction by account age

If an account's age is lower than X, remove the post.

11
12
 
 

Hey all, I made a Firefox extension (signed by Mozilla) specifically to add Show/Hide Child Comments functionality similar to how RES had it (where the parent comment is still visible).

It's not very useful, but I could use some feedback on tightening up the Javascript. I'm not a JS beginner, but I know I can do better, so any tips are welcome!

EDIT: Also, if anyone has any suggestions for the extension, I'm open to those as well.

13
14
15
 
 

Namely, de-facto, or one of, in Linux. Mature. No GUI. Open-source and free.

What is it? GPG or anything else?

For a separate file(s), or directory(ies), and not for the entire disk or partition.

16
17
 
 

What is the CS / uni goto course for this, or what really clicked for you?

18
19
 
 

I know that pushing a commit with an API key is something for which a developer should have his balls cut off, but...

...I'm wondering what I should do if, somehow, I accidentally commit an API key or other sensitive information, an environment variable to the repo.

Should I just revoke the access and leave it as is, or maybe locally remove this commit and force-push a new one without the key? How do you guys handle this situation in a professional environment?

20
 
 

I was using SQL_CALC_FOUND_ROWS and SELECT FOUND_ROWS();
But this has been deprecated https://dev.mysql.com/doc/refman/8.0/en/information-functions.html#function_found-rows

The recommended way now is first to query with limit and then again without it selecting count(*).
My query is a bit complex and joins a couple of tables with a large number of records, which makes each select take up to 4 seconds, so my process now takes double the time compared to as I just keep using found rows.

How can I go back to just running the select a single time and still getting the total number of rows found without the limit?

21
 
 

I've been trying tmux and followed a video that showcases and offers a prebuilt config for styling and plugins. Something happended (guess I did something wrong?) the styling broke and I decided I'll go bare bones and customize to my needs when needed instead of using preconfigured stuff. I deleted all configs and caches I could find with fzf and even reinstalled tmux, but still some broken styling is present and makes it unpleasent to work with. Some of my configs seem to be present even after uninstall, as the prefix is still C-Space instead of the default. There are some oh-my-zsh subfolders that contain tmux. I don't know if those have been there before and I also don't know, if I can delete them without breaking the next thing.

I'm on a MacBook and installed tmux via brew.

22
23
24
25
 
 

On my work I’m always switching between databases, but I already tired because of UX differences between psql, mysql, sqlite3. So, I’m making a small set of tools for myself in tries to solve that. It’s kinda works for me already so I'm sharing it here :)

P.S. Already posted this in other places, sorry for annoyance

view more: next ›