• 4 Posts
  • 39 Comments
Joined 1Y ago
cake
Cake day: Jun 19, 2023

help-circle
rss

She was a lua girl, he was every other programming language guy. It was not ment to happen.


Found too yesterday on F-Droid. Absoutley glorious, even runs perfectly smooth on a almost 10 year old Galaxy S6 Edge.


Why typescript? It allows you to make typesafe compositions


Sounds better than coming up with the most mindfucking ways to please the borrowchecker in a large rust codebase

(Skill issue probably, i know)


How does nobody of these morons understand that phones are in reality at least 80% pocket entertainment and content consumption machines. Yeah you can text, call and browse the web for answers I guess, but I bet that tiktok, instagram and youtube eclipse anything else in terms of time spent in these apps. Its not surprising that our phones are 6"+ pocket screens.


This was my exact setup for years. I had a J3455 NUC and increased its memory to 16GB and installed Proxmox. It worked really well.


*the libraries that are made for python


Very cool. Thats in a way the beauty of Java. It offers you just enough Tools for Object Oriented Programming to get everything done in some way (maybe not the most elegant or efficient way, but in a way).


A lot people compleatly overrate the amount of math required. Like its probably a week since I used a aritmetic operator.


Running as a fullscreen PWA through Brave on a Xiaomi Mi 10T, hosted on in a Linux VM. Its pretty fast for the most when doing for example Angular for the most part and the UI is butter.


I for a long time thought VS Code was an Atom fork because of how simmilar they were


VS Code at least on my 144Hz Android phone supports High refresh rate. No idea why this is a “special feature”.


For jvm stuff definitley yes. For other things I often prefer VS Code.


You NEED to be good be in math to program.

Whilest for some highly specialist fields you definitly do, but for a lot of jobs things don’t get more complex than calculating averages.


Agree, also just in general I find many things Python very odd and syntactically isolated to some extent. Constructors, lamba, dictionaries in particular are extremly whack.



Essentially a function that doesn’t produce side effects, like modifying variables outside of its scope or modifying the function parameters. This something you should always try to incorporate into your code as it makes it much easier to test and makes the function’s use less risky since you don’t relay on external unrelated values.

To give you an example in JavaScript, here are two ways to replace certain numbers from an other list of numbers with the number 0

first a way to do it with a non pure function :

let bannedNumbers = [4,6]

const nums = [0,1,2,3,4,5,6,7,8,9]

function replaceWithZero(nums){
    for (let i = 0 ; i < nums.length; i++){
        if (bannedNumbers.includes(nums[i])){
            nums[i] = 0
        }
    }
}
replaceWithZero(nums)
console.log("numbers are : ", nums)

here the function replaceWithZero does two things that make it impure. First it modifies its parameter. This can lead to issues, for example if you have Second it uses a non-constant variable outside of its scope (bannedNumbers). Which is bad because if somewhere else in the code someone changes bannedNumbers the behavior of the function changes.

A proper pure implementation could look something like this :

const nums = [0,1,2,3,4,5,6,7,8,9]
function repalceWithZero(nums){
    const  bannedNumbers = [4,6]
    const result = []
    for(const num of nums){
        result.push(bannedNumbers.includes(num) ? 0 : num)
    }
    return result
}
const replaced = replaceWithZero(nums)
console.log("numbers are : ", replaced)

Here we are not modifying anything outside of the function’s scope or its parameters. This means that no matter where, when and how often we call this function it will always behave the same when given the same inputs! This is the whole goal of pure functions.

Obviously in practice can’t make everything 100% pure, for example when making a HTTP request you are always dependent on external factors. But you can try to minimize external factors by making the HTTP request, and the running the result only through pure functions.


For new code I’m writing I’m using mostly JsDoc function headers on public methods of classes and exported functions. With one or two sentences explaining what function does.

Also try to explain what to expect in edge cases, like when you pass am empty string, null, … stuff of that nature - for which I then create unit tests.

I also always mention if a function is pure or not or if a method changes the state of its object. On a sidenote I find it odd that almost no language has a keyword for pure functions or readonly methods.

If I add a big new chunk of code that spans multiple files but is somewhat closed off, I create a md file explaining the big picture. For example I recently added my own closed off library to my angular frontend that handles websocket stuff like subscribing, unsubscribing, buffering, pausing,… for which a created a md file explaining it.


I don’t know if these are uncommon but I have a few cool usecases besides the regular 1:1 folder syncing, maybe someone else finds them useful.

Also you should know that the way I have all of this setup is that I have a container that hosts a bunch of SMB Network drives and a syncthing container that stores all of the fodlers on that drive. Having them also easily accessible through smb is great when I just wanna quickly copy something or back the folders up.

So here are some of my maybe unorthodoz usecases :

  • Music - As a fan of offline music, I have it setup that music I acquire gets synced onto the server and re-encoded as opus through a script into a second folder which then through syncthing gets sent out my mobile devices. There I rather have smaller files than lossless quality. Said script also sorts the music into folders based on artist and album metadata.
  • I also sync my Newpipe Subscriptions between phones (unfortunately by manually exporting my settings and re-importing them)

I also used to have a setup that would sync Minecraft Bedrock and Stardew Valley saves between devices (where Windows and Android saves are compatible) but Android 11 introduced a stupid restriction that prevents synching from accessing the the saves are located on Android.



I’d say its more like the gas tank telling you that you aren’t allowed to pour in brake fluid as that could lead to runtime errors.


Typescript. I greatly prefer C-Style curly brace languages over Pythonese langs. Also the typesystem is incredible, as it allows you to be as precise or not as you want which is a huge boon.



not to mention that you have all the dotnet ecosystem at your fingertips. Wanna write a WPF application? Go ahead. You want to use ML.net? A bit clunky but doable.


My introduction or what got me intrested was Farming Simulator 2009 when I was 10.

The game had amazing mod support and I found out that each mod, like a new tractor, had a modDesc.xml file in it that contained values like in-game price, name of the tractor, fuel tank volume, … .And I found out that changing these values would change these values in game, which made me feel like an absolute hackerman.



Ok thanks, it then seems like some Software thing. Are your clock speeds also higher under linux when idle?


Any experience with Zen 1 idle power consumption running Proxmox?
Hi, I'm planning an doing an upgrade to my hardware and I'm eying a used Ryzen 1700 or Ryzen 1800 (they are dirt cheap now and have an excellent upgrade path once people sell of their Ryzen 5000 CPUs). I'm however a bit concerned about the idle power consumption of such a System. My plan in terms of Software is to migrate my existing Proxmox System which is running 4 VMs and 6 LXC containers at the moment. Most of which are at < 3% CPU Ut. 99% of the day. Has anyone got any numbers or rough estimates how big the idle power draw of such a System would be? For a graphics card (just to have some kind of display output) I plan to use a GTX 220.
fedilink

This isn’t any great C++ low level optimization but I have an Angular Project which contains a list that shows the live logs of various backend services and other things comming in through websockets (I keep up to 500K lines in memory). Essentially a extremly long scrollable list. First I obviously used lazy list which only renders the elements in view that are visibile instead of one that renders everything all the time. Secondly I removed as many html elements from each list element as possible, mostly divs that were just used to apply a css class.

When it comes to JS code I got a huge performance improvement by replacing a bunch of pure array.map, array.filter, array.toSorted, … method calls with a big ol for loop. These pure functions caused an insane memory churn because they create a shallow copy each time and doing that for an array with 500K entries caused the garbage collector to work overtime. Also the whole filtering and searching in the first draft was done every time new elements were added to the list via websocket for the whole entire list. I changed that so it only does it for new elements.

Overall this allowed me to increase the number of logs kept in memory from about 20K (because then performance would start to dip) to now 500K.


I got it working but curiously enough the server needed to add the clients as introducers. Then it worked and I got a message on all devices that a new folder has been added and showing a UI that easily allowed me to add the folder.


maybe, since its mostly XML files maybe I can make a script that scrambles the Device IDs for something new. But I was hoping for a built in solution.


I always added the “server” as an introducer but for some reason the server itsself gets a prompt to add all the folders from the client but the client doesn’t get a list of all the folders the server is sharing which is what I’m after. The introducer does however work by directly giving me a list of all the other devices the “server” has been connected to. I’m using syncthing version 1.20.1 on my server btw.


Thanks, I have tried method you described but in my case it led to a total mess since the device I exported from and imported from then were indistinctable for all other devices causing issues.

But thanks for telling me about syncthing fork! I will definitly check it out!


[Closed] Is there a easy way to share a batch of synchthing folder keys?
A few months ago I setup my own Synching Server and its been working great. I right now have 7 devices (server itself, phone, tablets, laptops, Desktops, ...) synching files from 5 different folders. The problem I have right now is that adding new folders / devices is a huge hassle since in order for EVERY device to properly be in sync I need to manually add for example a new folder to every device. If I were to add 5 new folders I would need to repeat this 5 times for 7 devices... I think you get the point. What I wanna know is if there is a simple way to basically share all the folder keys of a syncthing device with another device without manually copy pasting them? I don't really care if this would be by enabling some setting on the server or by copying around a file (I do this for example with my newpipe subscriptions and use syncthing for that). Also just creating one large folder is something I'm trying to avoid since not every device needs everything you loose the ability to fine control individual folders. I for example don't want my phone to start syncing my music library when I'm using data. EDIT : I played around a bit more and I found out that going into the server and marking all the devices add as introducers sends a notification to all these devices where you can easily share folders!
fedilink

No, I’m glad that “now that wasm exists I can do web development in any language” isn’t thing yet. The web would get even more clumsy than it already is. I’m glad that when I visit 5 links I don’t have to download 10 different runtimes each time.


Typescript. Its pretty good and feature compleate overall, but has by far the most flexible typesystem.


Just as today my brother went on a 30 minute rant on how terrible Jira and Confluence are. Hmmmmm…


You can use JS for almost anything, but nothing can be used where JS is mostly used.


luckily smaller process nodes and architecture refinements are a thing, my dude.


Bruh, I actually prefer the “Web 2.0” solution. That way the god damn editor can’t just start accessing all the shit on my drive.