Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Search - "crate"
-
Difference n°538592 between developers and regular people:
"Do you listen music at work ? If so what app do you use ?
- (regular people) I don't / I use Spotify/Youtube.
- (me) I usually listen to my personal webradio server (running with icecast+liquidsoap on a little ubuntu DO droplet). Currently has a few funny jingles made by a friend and +3000 tracks (this number grows with time as I listen to new stuff), all crate-digged by myself for myself. Basically the the best radio in the whole world <3"20 -
OMFG I don't even know where to start..
Probably should start with last week (as this is the first time I had to deal with this problem directly)..
Also please note that all packages, procedure/function names, tables etc have fictional names, so every similarity between this story and reality is just a coincidence!!
Here it goes..
Lat week we implemented a new feature for the customer on production, everything was working fine.. After a day or two, the customer notices the audit logs are not complete aka missing user_id or have the wrong user_id inserted.
Hm.. ok.. I check logs (disk + database).. WTF, parameters are being sent in as they should, meaning they are there, so no idea what is with the missing ids.
OK, logs look fine, but I notice user_id have some weird values (I already memorized most frequent users and their ids). So I go check what is happening in the code, as the procedures/functions are called ok.
Wow, boy was I surprised.. many many times..
In the code, we actually check for user in this apps db or in case of using SSO (which we were) in the main db schema..
The user gets returned & logged ok, but that is it. Used only for authentication. When sending stuff to the db to log, old user Id is used, meaning that ofc userid was missing or wrong.
Anyhow, I fix that crap, take care of some other audit logs, so that proper user id was sent in. Test locally, cool. Works. Update customer's test servers. Works. Cool..
I still notice something off.. even though I fixed the audit_dbtable_2, audit_dbtable_1 still doesn't show proper user ids.. This was last week. I left it as is, as I had more urgent tasks waiting for me..
Anyhow, now it came the time for this fuckup to be fixed. Ok, I think to myself I can do this with a bit more hacking, but it leaves the original database and all other apps as is, so they won't break.
I crate another pck for api alone copy the calls, add user_id as param and from that on, I call other standard functions like usual, just leave out the user_id I am now explicitly sending with every call.
Ok this might work.
I prepare package, add user_id param to the calls.. great, time to test this code and my knowledge..
I made changes for api to incude the current user id (+ log it in the disk logs + audit_dbtable_1), test it, and check db..
Disk logs fine, debugging fine (user_id has proper value) but audit_dbtable_1 still userid = 0.
WTF?! I go check the code, where I forgot to include user id.. noup, it's all there. OK, I go check the logging, maybe I fucked up some parameters on db level. Nope, user is there in the friggin description ON THE SAME FUCKING TABLE!!
Just not in the column user_id...
WTF..Ok, cig break to let me think..
I come back and check the original auditing procedure on the db.. It is usually used/called with null as the user id. OK, I have replaced those with actual user ids I sent in the procedures/functions. Recheck every call!! TWICE!! Great.. no fuckups. Let's test it again!
OFC nothing changes, value in the db is still 0. WTF?! HOW!?
So I open the auditing pck, to look the insides of that bloody procedure.. WHAT THE ACTUAL FUCK?!
Instead of logging the p_user_sth_sth that is sent to that procedure, it just inserts the variable declared in the main package..
WHAT THE ACTUAL FUCK?! Did the 'new guy' made changes to this because he couldn't figure out what is wrong?! Nope, not him. I asked the CEO if he knows anything.. Noup.. I checked all customers dbs (different customers).. ALL HAD THIS HARDOCED IN!!! FORM THE FREAKING YEAR 2016!!! O.o
Unfuckin believable.. How did this ever work?!
Looks like at the begining, someone tried to implement this, but gave up mid implementation.. Decided it is enough to log current user id into BLABLA variable on some pck..
Which might have been ok 10+ years ago, but not today, not when you use connection pooling.. FFS!!
So yeah, I found easter eggs from years ago.. Almost went crazy when trying to figure out where I fucked this up. It was such a plan, simple, straight-forward solution to auditing..
If only the original procedure was working as it should.. bloddy hell!!8 -
After all those years, I finally understood what makes Half-Life 2 so immersive.
From the very beginning, as the game teaches you things about itself, you discover that every model is made with you in mind. The barrel is just tall enough to jump on it, but not taller. The big crate's size is calculated precisely for you to jump onto it from a small crate. Ladders are comfortable for you to climb on. Everything in this game world designed around you, the human.
…except for combine constructions.
They're awkward to walk around. You keep lowkey clipping into them. Half-transparent armor fence looks like you can jump over it, but you can't. It's just a bit taller than that, on purpose. Combine towers are hard to climb onto. You keep bumping into things. Once you locate the ladder and climb all the way up, you bump your head into the ceiling. You don't have much room for movement on top. Combine walls have an inconclusive, uncomfortable physics model that is very annoying to interact with. If you run into it and jump, you clip into it just enough to stop your movement instantly.
This hammers in the message — combines aren't human. Their constructions aren't meant for humans. This was my biggest discovery the last time I played Half-Life 2.
HL2 is a strong contender to be my favorite game of all time.11 -
Fucking experimental technologies. I feel like doing webassembly stuff is like buying a smart device, it's not worth any of the trouble for now.
I wanted to do some webassembly-stuff with rust and yew (basically react for rust). I was really hyped because it all looked promising and i found this cool band "heilung" whose music made me my coding feel like black magic with complex incantations and shit.
A basic webassembly setup did work, but everything afterwards was pure shit. Crate installation didn't go as expected, i get weird errors even though i simply copied the example (and checked the versions). The best i got was when i tried to compile and rust told me to go fuck myself because i cant use feature XY in a package in the stable environment. Why the hell would someone even publish said package then? After losing half a day because of this i give up for now. I don't feel like a badass magician anymore anyways, more like the guy that puts mentos into coke and gets hit by the foam. -
We have a three bedroom house that fits us perfectly, or did anyway. In the upstairs there is a master bedroom which my wife and I share, and two smaller bedrooms. One is my son's room and was his nursery when he was smaller, and the other is currently being used as my office.
We had a second child-- a little girl --in October. As she is still very small, she sleeps in a bassinet in our bedroom, but those days are numbered. She will need her own room within a couple months, for naps and for her to sleep all night on her own. That means my office will soon have a crib, dresser, and changing table in it, and I will be unable to use my computer after the wife and kids are in bed.
For this eventuality, I've been preparing what I call my, "table kit." Costco sells these really nice collapsible plastic crates. I have filled one with computer things, with the intention being that when my office is not available to me, I have a crate with everything I need in it, and can quickly set up at the dinner table. When I'm done, I can quickly tear down and pack everything up into that collapsible crate, so none of my equipment will "live" at the table.
My question is: what would you put in your table kit? I currently have a System76 Oryx Pro, a 23" LED display, displayport cable, power cables, mouse, keyboard, microUSB, and type-C cable, Bluetooth headphones, and I'm trying to decide whether I'll need a laptop stand. What would you pack?5 -
So I downloaded this game (to be fair, it is a preview version for a kickstarter project) and I had to crate an account with my mail address in order to sign in. Fair enough, I fill in this form and it says "invalid mail adress". It came to my attention that the form automatically put a space behind the mail adress so I had removed it. After I put back the space everything worked, but now I can't sign in because I didn't get the confirmation email (I assume because they sent it to [my email]+[space] instead of just my email). Currently chatting with the support guy, seems like a nice guy and I can't blame them because my mistakes are often even dumber, but before you post a preview version of your product online as a first impression, check if it even works. Please. Especially if the reason for posting it online is asking people for money.
-
If there's one problem with rust, it's that it expects you to know how to use it.
One of my first projects was to try and use the SDL2 crate to make something, and I got stuck wrangling the borrow checker about how long my textures live.
I try again a year later, now knowing intuitively how the lifetime system works, and I come up with a solution easily.
This sort of thing is probably very discouraging to new users of the language4 -
Holy shit I don't understand Rust's module system. Package I have not a single clue what it is... It "can contain one library crate and multiple binary crates". What? Okay so a crate is a collection of modules. Great, now how do you define modules? `mod whatever {}` probably. Then what the hell does `mod whatever;` do?? Import a module from a file with the same name (ignoring the fact that modules and files don't seem to have anything to do with each other). But why `mod` to import? How does that differ from `use`-ing a module? What is any of this??3
-
I'm hurtling down the Dunning Kruger slope in Rust datastructure design. The orchidlang crate has a struct that attempts to wrap and replicate a slice for no reason other than to attach some domain-specific methods and a custom Display implementation. I came up with 4 different representations for a file URI as provided by the language client. The most recent one holds a singular string in an Arc. I know that these are bad ideas but I don't know why I keep coming up with them.6
-
so anyhow is a rust crate used in like 1/3 of all repositories
but you could just not add a dependency and do Result<(), Box<dyn std::error::Error>>
🤔
probably I'm missing something2 -
Ok, @jestdotty , today, i give up on china.
I've been messaging with a rep who is taking the time to keep editing a contract... Im pretty sure she was genuinely trying...
As typing this we finally got to a 'correct enough' contract... so I could click the damn pay button.
Over the past 7 hrs.. at 3 back and forth exchabges and modifications at each issue:
1. Used previous PI from the dude i gave up on... so had a qty at 12 when only 11 exist a colour wrong for a crate of items, and listed the dude i refused to sign a contract under listed as the rep.
2. Now the item subtotals were off... just a few pennies or so... assumed she left the usd prices but calculated with ¥... didn't want alibaba to reject in a day so i checked if it was noted anywhere... Oh boy was it... VERY clearly, all caps, bold in the body of the total row... that the total was, exactly, 11680 (spelled out ofc) RMB aka ¥ chinese yen. I told her this, she sends me a cropped shot of the $ numeric total field... so i sent her the giant all caps bolded line, the one thatd typically be considered final say in most international courts... no clue where that value came from, it had zero relation to any actual values... and i was as curious as when chatGPT creates totally new, unique, lyrics for satirical german songs... i really tried.
3. Wrong incoterms (trade terms... abbreviated to a few letters... had it that I'd be physically going to the tbd port to accept/clear customs... no)
4. Technically it was accurate (well a few strange subtotals since she used ¥ half the time... told her it was fine as long as it had the company name on the label (gave 3 full examples to use whichever)
I get the contract ...shipping...
"To: Sara"
Then the right address (seriously wtf)
5. I point this out and carefully explain in mostly just examples and "the us government doesn't like anything being sent to just a first name, there's no legal way to sign for acceptance"
6. She gets stressed enough to tell me she doesn't have time to keep editing (since this horrid pile of poor formatting was just thrown at her a day ago... i dont point out the ridiculous irony)
7. Imo, the highlight of my night/morning... in her stress she promises me it'll ship right... sooo many issues there...
Even if it was delivered/allowed a signature for "sara" for 7ish large boxes just off a sea freight from china to a residence in the middle of a corn field (which tbh would be hysterical)...the IRS would have a valid reason to audit me... theyve done it w/o valid reasons several times, since I was 18 doing international trade and a contractual employee of a large gambling company, quarterly reporting, and ofc declaring more than my taxes in donating melted glass and crane game prizes...yea, they hate me and always do all that work to find the same thing... i underdeclare charity by 10%.
The entire concept of getting USA mail, even when pristine and you know logistics agents in every major company and port or distribution center, to properly deliver anything... ROFLOL ... and im already on some 'open and check everything' list with customs for a hysterical misconception they made years ago... cant/shouldn't get into detail publicly... but it was caused because 2 packages from different cities in China were both going to my address/through customs at the same time... package 1, 75 of those cheap af ball-pit hollow plastic balls for a 2yr old's bday(very delayed) package 2. 75 rechargeable batteries (the kind in power banks) 9600mah.
8. Told her to change "sara" to company name... glad it's registered to this address still.
It took me under 5min to type this... had to get the WTF out.
Dear AliBaba, please give an option to allow buyers to create the supply side contract for review, not just req modification... please?2 -
I wrote a small crate that does unsafe operations, please help me verify its soundness: https://github.com/lbfalvy/bound
(Also I think you'll like it, I'm solving a fairly abstract problem that's not possible in safe Rust)
It's essentially a struct that ties together a heap reference and a struct that's constructed from it. The main use case is to return lock guards derived from Arc<Mutex> but it's defined in a very abstract way intentionally because I'm using Marc from mappable-rc and async-std's RwLock and I didn't want this to depend on either crate.
It actually has no dependencies apart from STD (I think this one may be unavoidable) -
Did someone already thought about how color highlight can be better? It's been 4-5 years now that I'm coding on a virtual console that run on iPad with a monochrome code editor. Despite the fact that's remind me the old days when I was 8 years old, that doesn't stop me for coding with it.
I mean, is it really important to know that strings are red and numbers are yellow? How does that help me? They are both literal and behave to the user-content categories.
I was talking with my friend, and he says he likes to know if something is a keyword or an identifier. In C++, a lot of common keywords to define stuff and control the flow are often the first word and easy to spot.
A couple of months ago, I tried Flutter, and the editor can highlight ident blocks and give them different colors, but with Flutter, it's easy to get 10 or more ident levels, Does the color help? Splitting the code does.
I think, there is so much stuff that is more important than coloring the grammar of a language. For instance: knowing if an identifier belongs to which Rust Crate because, It's easy to stack 10 or more dependencies in one file that as better chances of names collisions.
Knowing if an identifier was recognized, if it used, if it's a local, a member, a global, a compiled value or a macro seems more important.
I would like to color block of code that is important or sensible. That will help my coworker about the severity of a particular place in the code.
What do you think?1 -
The Youth
How is the youth?
Pretty good question we don´t really like to communicate to older people well actually most of us have a mental issue, I know it´s kind of sad but when life gives you lemons you use them to make girls cry and that our way of thinking “I´m gonna die anyways lrts do something epic” cuz we aren't afraid to talt to the president of the united states of America like this but we are to scared to order mcdonalts of our self. I mean it´s a aspect that everyone knows we don´t know that person could be a murder of maybe that´s a little to over the top but like we just don´t like it OK.
You may ask what dose she mean with mental health issues?
Well we all know the good old depression its just that we life in a world in that you have to be perfect and when you are´t than you are a disappointment your parents want you to be a doctor or lawyer or something like that because it´s a well payed job but your generation wants to be creative we need our space to crate need things and do something amazing but this world is just a weird place were everyone has to be perfect and follow a ideal. Your appearance dosen´t describes how you are not everyone that has tattoos is a criminal or dose drugs nobody talks about the real problems.
What are the real problems?
Let me tell you we life in a world were nobody talks abou suicide nobody want´s to hear about it let me tell a fact.
Every 40 seconds somebody dies because of suicide.
Suicide is like a terror act when you were close to that person you got completely destroyed if you were far away than you got hurt but not as bad as the persons who were close. But nobody talks about this because it´s not “normal” that makes the persons who need help not reach out because they think its´s not okay.Stop the silence and help :)
But how dose it feel to have depression?
Well you can describe it as this:
it´s as you would lock yourself in a room with just a window but that window dose not have a handle but a curtain that closes every day a little more until there is no light anymore and the first days after that happens you will be scared and lonely and it will hunt you down but depressed people have to life like this every day and it becomes a normal state of mind until they decide they aren´t worth living anymore and they try to kill themselves. It hurts to see all those people die but it is the truth and truth is´t always fun.
Why am I writing this?
Honestly im asking myself that but it just feels right to tell wahts in my mind because a lot of people feel like they are tongue tied and can´t say what they are thinking and feeling and don´t express themselves. And also in my head is a lot wrong but at least I feel like I am doing something while writing this. I am one of the generation Z and I am proud that our generation has all this strength to fight for LGBT+ community and the black life's and I am proud that we understood that all this community's have to be respected because all people are on this earth and we all have to survive somehow and it dose not matter what skin color you have or sexual orientation.
But these are just my thoughts I hope everyone is doing well druing these times.
And to everyone I am proud of you and I love you.4 -
I could really do with HKT support in Rust right now. I need to somehow convert a
Marc<Task<Output = T>> into a
Task<Output = Marc<T>> where Marc is a Mappable Atomic Reference Counter from the mappable_rc crate. Nothing technically challenging in the whole operation, it's just not supported by the type system without those two types knowing about each other. -
need a random number
AI says just use system time and modulus it. I'm wondering if I can get performance down lower cuz I'm doing this maybe like thousands of times a second (im too lazy to do the math rn)
found a crate called fastrand. they're all like this isn't secure for cryptography and yada yada. peak inside curious how they do it. not too sure, seems like they have a predetermined hash and they do some bitwise or something. kind of a lot to read so I don't wanna. either case seems like they're not using system time
make a test to benchmark, 10k rounds how fast is it?
430 nano seconds for system time
460 nano second for fastrand
lol
all that typing and you end up slower than system time. I'm assuming system time can be guessed as well but what's the point of fastrand if it's slower 🤔
I mean maybe on some OS systems looking up the system time might be slower? no clue15