Komunitas
kbin.earth
For Arch you run pacman -Qe which lists all installed packages that were not installed as a dependency. I output that to a location via golang script which is monitored by the pCloud client for automatic backup along with a lot of other configs from $HOME/.config. I then have a systemd service that fires the script and a timer to kick off that service periodically.
Komunitas
programming.dev
Big refactorings are a bad idea. IMO what is worst then big refactors are when people refactor and change behavior at the same time. A refactor means you change the code without changing its behavior. When you end up mixing these up it becomes very hard to tell if a behavioral change is intended or a new bug. When you keep the behavior the same then it is easier to spot an accidental change in behavior in what otherwise should be a no-op change. And if you can, try to keep your refactors to one type of change. I have done and seen many 100 or even 1000s of lines changed in a refactor - but was kept manageable because it was the same basic pattern changing across a whole code base. For instance. Say you want to change logging libraries, or introduce one from simple print statements. It is best to add the new library first, maybe with a few example uses in one PR. Then do a bulk edit of all the instances (maybe per module or section of code for very large code bases) for simply switching log instances to the new library. If you don’t know what an API should look like, write the tests first as it’ll force you to think of the “customer” which in this case is you. I think there is some nuance here that is rarely ever talked about. When I see people trying this for the first time they often think you need to write a full test up front, then get frustrated as that is hard or they are not quite yet sure what they want to do yet. And quite often fall back to just writing the code first as they feel trying to write a test before they have a solid understanding of what they want is a waste. But - you don’t need to start with a complete test. Start as simple as you can. I quite often start with the hello world of tests - create a new test and assert false. Then see if the test fails as expected. That tells me I have my environment setup correctly and is a great place to start. Then if I am unsure exactly what I want to write, I start inside the test and call a function with a name that I think I want. No need for parameters or return types yet, just give the function a name. That will cause the code to fail to compile, so write a stub method/class to get things working again. Then start thinking about how the user will want to call it and refactor the test to add parameters or expect return types, flipping back to the implementation to get the code compiling again. You can use this to explore how you want the API to look as you are writing the client side and library side at the same time. You can just use the test as a way to see how the caller will call the code. No need to start with asserting behavior yet at all. I will even sometimes just debug print values in the test or implementation or even just write code in the test that calls into a third party library that I am new to to see how it works. With no intention that that test will even be included in the final PR - I just use tests as a staging ground to test ideas. Don’t feel like every test you write you need to keep. Sometimes I skip the testing framework altogether and just test the main binary in a simple situation. I especially do this for simpler binaries that are meant to mostly do one thing and dont really need a full testing framework. But I still do the red/green/refactor loop of TDD. I am just very loose on what I consider a valid “test”. The second time you’re introducing duplication (i.e., three copies), don’t. You should have enough data points to create a good enough abstraction. This missed one big caviat. The size of the code being duplicated. If it is only a few lines then don’t worry so much. 5 or even 10 copies of a 2 line change is not a big issue and quite often far harder to read and maintain then any attempt at de-duping it. As the amount of code you need to copy/paste grows though then it becomes more advantageous to abstract it with fewer copies. if you find yourself finding it difficult to mock I hate mocks. IMO they should be the last resort for testing things. They bake far too many assumptions about the code being mocked out and they do it for every test you write. IMO just test as much real behavior as you can. As long as your tests are fast and repeatable then you dont need to be mocking things out - especially internal behaviors. And when you do need to talk to an external service of some kind then I would start with a fake implementation of the service before a mock. A fake implementation is just a simple, likely in memory, implementation of the given API/interface/endpoints or whatever. With a mock you bake assumptions about the behavior into every mock you write - which is generally every test you write. If your assumptions are off then you need to find and refactor every test you have that has that assumption. With a fake implementation you just update the fake and you should not need to touch your tests. And you can write a fake once and use it on all your tests (or better yet use a third party one if one is available (for instance I quite often use goflakes3 - a golang in memory implementation for aws s3 service).
Komunitas
lemmy.world
Hi, this is a great point and one that I’ve already given consideration to. I’ll address separately the issue of the primary datastore ,i.e. Postgres, and the Redis dependency: Postgres as the only option for the data store There are 2 reasons for this: Performance: while SQLite could offer a simpler/embedded data store, it simply doesn’t have the performance and features of Postgres. Bitmagnet has a faceted search engine and is write-intensive (it will be discovering ~5k torrents per hour and writing these to the database along with associated metadata). As such, its database may not be suitable for running on older hardware. A SQLite adapter, if it was developed, may simply not be up to the job (although as I haven’t attempted this I can’t say what the performance would be like). That said, Bitmagnet itself is not especially resource intensive, you could probably run it on a Raspberry PI but point it to a Postgres instance on some more powerful hardware. At this stage I’ve only been running it on a M2 Mac Mini with Postgres located on its SSD and so would be interested to know people’s mileage on other hardware. Development, support and maintenance overhead: I’m a lone developer and this project is already too big for one person. A SQLite adapter, if feasible performance-wise, I think could only happen if other contributors joined the project as my to-do list is already pretty long. It would have to achieve feature parity with the Postgres implementation which makes use of several Postgres-specific features and extensions. It would also mean a longer testing cycle and therefore probably a slower release cadence. That said, if there was enough demand and assistance then I’d be open to looking into the feasibility of this once the rest of the application is a little more mature and the current database schema more finalised. Redis dependency Redis is currently used only for the asynchronous task queue. I would like to have put this in Postgres, but there simply is not a good out-of-the-box solution that works well with Postgres and GoLang, and is actively maintained. I looked at quite a few queuing libraries and eventually settled on asynq (https://github.com/hibiken/asynq), which is a great library and does the job well - but could really do with support for non-Redis backends. Using Redis here was a pragmatic decision that allowed me to make progress, rather than an optimal one. I guess I could have built a simple Postgres-based queue myself but that would have been a distraction and probably sub-optimal compared with a mature/separately developed library. It remains an option. Since I looked into this a new project has sprung up which I’m keeping an eye on - https://www.tork.run/ - it has a Postgres backend and looks like it might be up to the job, but is very new. So yes, I’m very aware that the additional Redis dependency is not ideal and it may well disappear at some point.
Komunitas
lemmy.world
Their search service is banned but they still have ad (AdMob and Google Ads) and developer services (GoLang, Firebase, Android, Tensorflow, etc) there. and their last customer-targeted service remaining are Google Chrome (www.google.cn/chrome) and a website directory Google 265 (www.265.com)
Komunitas
lemmy.ml
Lihat kiriman asli pada platform media sosial terkait.
Komunitas
beehaw.org
I had a bunch of stuff typed here (probably too much), clicked a damn icon on this UI and POOF when my entire comment… These are my opinions, probably not shared with others and surely not the end all be all to ‘why not Rust?’ Rust is hard. Rust is slow to iterate with and compile. Here’s a highlevel overview of the things you’d need to learn to effectively understand Rust code; not even speaking to learning enough of that to write it. Rust gets touted as secure, and it is more secure than other low level languages like C/C++. That does not make it invulnerable to exploits. It gives a false sense of security to developers who think My app can’t be hacked, it’s written in Rust!!. While Rust is better at memory management and protecting against run time errors related to memory issues, that doesn’t make it 100% safe. That removes almost one class of potential exploits, not all of them, and can’t protect the developer against other developer created issues. Rust code is still written by people. People still write insecure code even in Rust. Computers are dumb as hell; but fast. People are smart as hell, but SLOW. Combine the two and you get stupid things faster; not smarter things better. Rust development is hard, hard to learn, very hard to do right Rust is not suited for a web application. Would you tell someone to go write the web application and web page in C/C++? Nope. There’s a reason for that. Not suited to it. Square peg, round hole There’s always exploits being discovered. Rust handles some things better, but uhhh… Go look at some Lemmy Rust code. Definitely still has vulnerabilities; Rust won’t save you from yourself. Something like Golang is much better choice for development of a web service that has sane API handling. By the time to add in more error handling, more type checking, more passing around of this function or that data, and more checking it on the sender and receiver side…etc. By the time you’re writing Rust safely and correctly; it is much slower than what you may be lead to believe. Go is primarily designed for speed of development (including compilation times), rather than speed of execution. Go programmers tend to value clear code over fast code. Why does a microsecond longer matter for a website? Maybe in some backend PLC land there’s a damn good use for that performance. For a networked web application; it’s a pointless metric. That is not going to be your bottleneck. Rust is hard to understand just reading it let alone determine why it’s doing something. Rust fn does_what(n: u64) -> bool { match n { 0...1 => false, _ => !(2..n).any(|d| n % d == 0), } } Golang func doesWhat(value int) bool { for i := 2; i <= int(math.Floor(float64(value)/2)); i++ { if value %i == 0 { return false } } return value > 1 } Not talking about the functionality merits of the two, but in comparing the _code itself. One of those is much easier to determine what’s going on and what it should be doing versus the other. I don’t feel like fighting my code. Programming is a tool to help. If it takes more work to use the tool to achieve your goal, it’s the wrong tool. Rust is the wrong tool for web development.
Komunitas
lemmy.world
Actually Google wasn’t that bad in the past. They did a lot of good, open sourced a lot of projects, made a lot of Linux contributions, gave us AOSP, Kubernetes, Golang, Tensor Flow, etc. They even had a moonshot program, working on a lot of emerging technologies, and were in general pretty cool. I think things started to go downhill when they announced Alphabet, back then they started to optimize their operations by minimising the costs and maximizing their profits. In general this made their shareholders pretty happy and the rest pretty sour.
Komunitas
lemmy.ca
I don’t know much about NPM (having avoided JS as much as possible for my entire life), but golang seems to have a good solution: ‘vendoring’. One can choose to lock all external dependencies to local snapshots brought into a project, with no automatic updating, but with the option to manually update them when desired.
Komunitas
feddit.de
Anything else? There is a whole array of devices between you and the target server daemon, so any of those can be slow. Usually it looks like this from your browser to the website: Browser Network Manager Operating System (OS) Network Card Cable / WiFi (aka WLAN) Switch or Access Point Router Modem Wall Plug box in basement (either active, like with most DOCSIS installations, or passive with VDSL) copper or fibre cable box on street containing ISP network devices fibre channel to local ISP backbone local backbone network devices more centralised peering point Central Internet Exchange (CIX) another CIX peering point data centre uplink data centre core modem core router core switch rack switch hypervisor’s (HV) network card HV OS and virtualisation software (e.g. XCP-ng) virtual machine (VM) network interface VM OS server daemon for reverse proxy on VM (e.g. HAProxy, Envoy) VM OS, network interface, HV, rack switch, another HV, another VM’s network interface and OS web server daemon (e.g. nginx, Apache2) backend server daemon (e.g. Apache Tomcat, node.js, PHP FPM, Django, Golang binary) the actual application’s routing library (e.g. Nio, Gorilla) usual suspects for slow connections highlighted.
Komunitas
lemmy.ml
Lihat kiriman asli pada platform media sosial terkait.
Komunitas
lemmy.ml
Lihat kiriman asli pada platform media sosial terkait.
Komunitas
lemmy.ml
Lihat kiriman asli pada platform media sosial terkait.
Komunitas
lemmy.ml
Lihat kiriman asli pada platform media sosial terkait.
Komunitas
lemmy.ml
Lihat kiriman asli pada platform media sosial terkait.
Komunitas
lemmy.ml
Lihat kiriman asli pada platform media sosial terkait.
Komunitas
lemmy.ml
Lihat kiriman asli pada platform media sosial terkait.
Komunitas
lemmy.ml
Lihat kiriman asli pada platform media sosial terkait.
Komunitas
lemmy.ml
Lihat kiriman asli pada platform media sosial terkait.
Komunitas
lemmy.world
I’m actually really impressed with the auto complete intellij is packaged with now. It’s really good with golang (probably because golang has a ton of code duplication).
Komunitas
lemmy.ml
Not a good programmer, but I’ve been writing documentation improvements for a few projects I use in my free time. I’m doing it for kopia currently as the documentation for that project is not great at the moment. Kopia is a deduplicating backup application similar to BorgBackup and Restic, written in Golang by a former google engineer. It creates infinite incremental backups, has encryption and compression, and works with S3, B2, SSH, or a local filesystem.