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 - "synchronous"
-
IF PROGRAMMING LANGUAGES WERE DRUGS:
JavaScript = Methamphetamine:
Anyone can cook some up at home but only pros can make the good stuff without blowing everything up.
Under the influence it tries to do everything at once, in seemingly no specific order before running off and making plenty of promises - but you have no clue if it kept any until it returns.
C = Heroin:
It takes some prep before you can take a hit but when you do it's far more potent than expected. When prepped (compiled) correctly it will induce complete and utter ecstasy but any error or abuse may kill you, leave you on the floor, in a coma or wishing you were dead.
HTML = Paracetamol(Panado):
Some don't think it's a real drug and others do. Either way you should grow a pair and try something a little more hardcore.
--------------------------------------
I came up with these after I randomly explained asynchronous js to a junior as synchronous code on meth. These were just off the top of my head, please feel free to correct or expand on them :-)25 -
Manager: You can’t define an async function without using await.
Dev: Yes you can.
Manager: Well you shouldn’t, there’s no point!
Dev: Yes there is. It can turn blocking synchronous logic into work performed concurrently. In this case the perform—
Manager: It’s called async *await*. Async *AWAIT*! Did you hear the two parts to that? You shouldn’t ever have one without the other. THEY GO TOGETHER. Worrying about concurrency is for people who use callbacks which just goes to show how out of date your skills are. I’m reading a book on javascript and there are so many advanced techniques out there that I haven’t even seen you use ONCE!
Dev: …
*I looked at the book he’s reading, it’s from the < ES6 era… no wonder he doesn’t see me using any of those archaic patterns/hacks/workarounds…*13 -
PHP is my main language, but I haven't had a single problem with it yet.
Nodejs it is.
How can you possibly make it SO GODDAMN HARD to just implement ANYTHING synchronous. THERE ARE REALLY FUCKING GOOD REASONS YOU *WANT* YOUR CODE TO STOP EXECUTION WHILE DOING SOMETHING
EVER HEARD OF HARDWARE PROGRAMMING? YEAH, APPARENTLY NOT
GRAAAAH12 -
EoS1: This is the continuation of my previous rant, "The Ballad of The Six Witchers and The Undocumented Java Tool". Catch the first part here: https://devrant.com/rants/5009817/...
The Undocumented Java Tool, created by Those Who Came Before to fight the great battles of the past, is a swift beast. It reaches systems unknown and impacts many processes, unbeknownst even to said processes' masters. All from within it's lair, a foggy Windows Server swamp of moldy data streams and boggy flows.
One of The Six Witchers, the Wild One, scouted ahead to map the input and output data streams of the Unmapped Data Swamp. Accompanied only by his animal familiars, NetCat and WireShark.
Two others, bold and adventurous, raised their decompiling blades against the Undocumented Java Tool beast itself, to uncover it's data processing secrets.
Another of the witchers, of dark complexion and smooth speak, followed the data upstream to find where the fuck the limited excel sheets that feeds The Beast comes from, since it's handlers only know that "every other day a new one appears on this shared active directory location". WTF do people often have NPC-levels of unawareness about their own fucking jobs?!?!
The other witchers left to tend to the Burn-Rate Bonfire, for The Sprint is dark and full of terrors, and some bigwigs always manage to shoehorn their whims/unrelated stories into a otherwise lean sprint.
At the dawn of the new year, the witchers reconvened. "The Beast breathes a currency conversion API" - said The Wild One - "And it's claws and fangs strike mostly at two independent JIRA clusters, sometimes upserting issues. It uses a company-deprecated API to send emails. We're in deep shit."
"I've found The Source of Fucking Excel Sheets" - said the smooth witcher - "It is The Temple of Cash-Flow, where the priests weave the Tapestry of Transactions. Our Fucking Excel Sheets are but a snapshot of the latest updates on the balance of some billing accounts. I spoke with one of the priestesses, and she told me that The Oracle (DB) would be able to provide us with The Data directly, if we were to learn the way of the ODBC and the Query"
"We stroke at the beast" - said the bold and adventurous witchers, now deserving of the bragging rights to be called The Butchers of Jarfile - "It is actually fewer than twenty classes and modules. Most are API-drivers. And less than 40% of the code is ever even fucking used! We found fucking JIRA API tokens and URIs hard-coded. And it is all synchronous and monolithic - no wonder it takes almost 20 hours to run a single fucking excel sheet".
Together, the witchers figured out that each new billing account were morphed by The Beast into a new JIRA issue, if none was open yet for it. Transactions were used to update the outstanding balance on the issues regarding the billing accounts. The currency conversion API was used too often, and it's purpose was only to give a rough estimate of the total balance in each Jira issue in USD, since each issue could have transactions in several currencies. The Beast would consume the Excel sheet, do some cryptic transformations on it, and for each resulting line access the currency API and upsert a JIRA issue. The secrets of those transformations were still hidden from the witchers. When and why would The Beast send emails, was still a mistery.
As the Witchers Council approached an end and all were armed with knowledge and information, they decided on the next steps.
The Wild Witcher, known in every tavern in the land and by the sea, would create a connector to The Red Port of Redis, where every currency conversion is already updated by other processes and can be quickly retrieved inside the VPC. The Greenhorn Witcher is to follow him and build an offline process to update balances in JIRA issues.
The Butchers of Jarfile were to build The Juggler, an automation that should be able to receive a parquet file with an insertion plan and asynchronously update the JIRA API with scores of concurrent requests.
The Smooth Witcher, proud of his new lead, was to build The Oracle Watch, an order that would guard the Oracle (DB) at the Temple of Cash-Flow and report every qualifying transaction to parquet files in AWS S3. The Data would then be pushed to cross The Event Bridge into The Cluster of Sparks and Storms.
This Witcher Who Writes is to ride the Elephant of Hadoop into The Cluster of Sparks an Storms, to weave the signs of Map and Reduce and with speed and precision transform The Data into The Insertion Plan.
However, how exactly is The Data to be transformed is not yet known.
Will the Witchers be able to build The Data's New Path? Will they figure out the mysterious transformation? Will they discover the Undocumented Java Tool's secrets on notifying customers and aggregating data?
This story is still afoot. Only the future will tell, and I will keep you posted.6 -
When your egghead boss (who is a dev, BTW) fails miserably in understanding that JavaScript fetch does not behave like the default synchronous nature of requests in Python.
After failing to make him learn about the asynchronous nature of JavaScript promises, he ends the discussion by saying "that's why python is better than js"
*facepalm*2 -
Most successful? Well, this one kinda is...
So I just started working at the company and my manager has a project for me. There are almost no requirements except:
- I want a wireless device that I can put in a box
- I want to be able to know where that device is with enough accuracy to be able to determine in which box the device was put in if multiple boxes were standing together
So, I had to make a real time localization system. RTLS.
A solo project.
Ok, first a lot of experiments. What will the localization technique be? Which radio are we going to use?
How will the communication be structured?
After about two months I had tested a lot, but hadn't found THE solution. So I convinced my manager to try out UWB radio with Time Difference Of Arrival as localization technique. This couldn't be thrown together quickly because it needed more setup.
Two months later I had a working proof of concept. It had a lot of problems because we needed to distribute a clock signal because the radio listeners needed to be sub-nanosecond synchronous to achieve the accuracy my manager wanted. That clock signal wasn't great we later found out.
The results were good enough to continue to work on a prototype.
This time all wired communication would be over ethernet and we'd use PTP to synchronize the time.
Lockdown started.
There was a lot of trouble with getting the radio chip to work on the prototype, ethernet was tricky and the PTP turned out to be not accurate enough. A lot of dev work went into getting everything right.
A year and 5 hardware revisions later I had something that worked pretty well!
All time synchronization was done hybridly on the anchors and server where the best path to the time master was dynamically found.
Everything was synchronized to the subnanosecond. In my bedroom where I had my test setup I achieved an accuracy of about 30cm in 3d. This was awesome!
It was time to order the actual prototype and start testing it for real in one of the factory halls.
The order was made for 40 anchors and an appointment was made for the installation in the hall.
Suddenly my manager is fired.
Oh...
Ehh... That sucks. Well, let's just continue.
The hardware arrives and I prepare everything. Everything is ready and I'm pretty nervous. I've put all my expertise in this project. This is gonna make my career at this company.
Two weeks before the installation was to take place, not even a month after my manager was fired, I hear that my project was shelved.
...
...
Fuck
"We're not prioritizing this project right now" they said.
...
It would've been so great! And they took it away.
Including my salary and hardware dev cost, this project so far has cost them over €120k and they just shelved it.
I was put on other projects and they did try to find me something that suited me.
But I felt so betrayed and the projects we're not to my liking, so after another 2-3 months I quit and went to my current job.
It would've so nice and they ruined it.
Everything was made with Rust. Tags, anchors, RTLS server, web server & web frontend.
So yeah, sorry for the rambling.5 -
C# developer: static typing and precompilation make my language really fast! *writes service that makes 50 synchronous database calls for every request*1
-
You want to know what shit is?
Go use Alibaba cloud service!
Trying out the service and luckily for me i only paid a few bucks.
-- Poor documentation which seems like it was written by the team from sales.
-- Poor github code samples... If i had written similar code while in college, it would be far better than their code samples... no exaggeration, It literally has 0.1% comment.
See for yourself
https://github.com/aliyun/...
-- Its Object Storage (OSS) C# APIs are all synchronous (Who fucking wrote this piece of shit deserves 10,000 punch in the face). You just killed the whole essence of netcore with oss.
-- Error logs are in Chinese (This was expected but seriously Ali you sold your product in English. WTF you got no English dev)
Coming from an Azure world, i would say Alibaba cloud is still in its infant stage (Cheap to use and Expensive to manage).
Make use of it at your own risk!3 -
Reintroducing you to online chat that we have open since July, dR Community Channel. Let me start by showing you a thread about "Synchronous software for devRant people". It has common questions and answers to them, to get you going with this social avenue.
There are 17+ people on our Matrix room plus 14 more through Discord bridge. These numbers keep growing! 🥳
🧵 Read on Fediverse: https://kbin.melroy.org/m/drbboard/...
Boost, leave your suggestions and write-ups there, just so more of us could help and respond. Thank you and have a whale of time!
💬 Chat: https://matrix.to//...9 -
Front end developer is still getting a ticket even though the security flaw lies in the back-end.
Today, every click of the UI has an overlay of circular progress indicator indicates that there will be a synchronous actions in an asynchronous requests.
1 click = 1 loading state -
I have a nightmare project that I will probably be ranting about quite a lot in the coming weeks, but I don't want SEO to pick up the specifics on the off chance my peers Google the issues we're facing and my profile comes up.
Let me set up the scene by describing the predicament, and then I'll get to the most outrageous thing I've heard while working at this job. It gives you a CLEAR idea of why we're in this situation in the first place.
Anyways, the nightmare project only runs in IE with compatibility mode set to version 6. So it only runs in IE 6 at the latest.
And it is massive. I'm talking real, real enormous.
The most recent roadblock I ran into while Chrome-ifying it is the extensive use of a browser API that was removed 8 years ago.
It involves synchronous data input and I know for a relatively certain fact there's no way to fix it without combing through every single reference to this API and converting the ones that need sync data (not all of them do) to callbacks. How big of an issue is that?
Well, just one of that 15-ish modules has over 900 references to it. Even just creating a spreadsheet of "commented out / doesn't need a fix / needs fix" for each reference in 1/15th of this project would take days of manual labor.
Here's the rant.
So after discussing this issue in the meeting (we ended on "they don't believe me that we can't just replace it with jQuery") I brought up the next issue. One of our 3rd party libraries is so old it doesn't work anymore and we can't modify that code (it's compiled).
They said that even if it was backwards compatible (no fucking way. This version is like, at least 10 years old, I guarantee it) they can't simply replace it because we don't have a subscription to this product anymore (suggesting we find an alternative).
And I fucking kid you not, this is what happened next.
They then began discussing how this is why you shouldn't use 3rd party code. Because it becomes obsolete and you can't even fix it yourself because it's not yours to edit.
Yes. They said this DIRECTLY after we discussed our 900+ references to a browser API >>REMOVED<< 8 years ago. Yes, they said this about a 3rd party library that receives regular support but is totally FUCKED because we NEVER updated it after adding it and we never even renewed the LICENSE.
What the FUCK2 -
A normal day on my CMS as a Service...
URL: https://go to CMS
> Login screen: enter credentials, check checbox "remember me" (which doesn't remember you)
> redirected to SSO (single sign-on welcome page)
> Re-enter URL to go to CMS
> Fires up second browser on second screen, do the exact same things as above
--- Code editing
As it's a very modern CMS, you have to edit the code via the CMS using a bulky and honestly shitty editor (or rather: they didn't spend time configuring it to be at least semi-decent).
Plus default white horrible theme.
> Go to "/themes"
> Scroll all the way down the page
> Enter filename in search box
> Click the "Edit" button, which is a small button located right next to a much bigger red "DELETE" button. When you middle click (as I always open files in new tabs) on the DELETE button, it DELETES without confirmation. In such cases, you lose up to three days of work asking the providers to set it back up for you via their backup - and charge you for that. So sorry for deleting an *important* file
> Edit the file.
> Save the file - it takes 3 seconds. Upon saving, rescroll again to where you were in the code.
> On the other screen, refresh dev view of current template
> Wait 5 seconds
> If there are any special blocks, they all load via a semi-synchronous AJAX request (it's async, but they load one by one), the same time you waited to refresh your page.
> Notice you forgot adding some markup
> Re-edit the file, save...
> OH NO - I'VE BEEN BACKGROUNDEDLY DISCONNECTED. Back to Login page.
> Enter credentials.
> Am not on the CMS, but on the SSO
> Navigate back to file
> Re-write new changes
--- Manager comes in:
I need to you edit XXX objects in DB Manager (a big PHPMyAdmin if you will)
> New tab, go to https://DB
> Although still connected on CMS, I have to re-enter credentials
> Am redirected to SSO
> Re-enter https://DB
> Find the object (20 seconds of loading)
> Find the appropriate field
> Find out the field is in fact another object located elsewhere
> Uff, thank goodness, there's a shortcut button to directly edit said elsewhere object
> Operates on elsewhere object + save
> Re-edits original object + save
> ERROR 500, APPLICATION UNEXPECTEDLY CRASHED
:') painful much?
(for those who ask: yes i've got plenty of mind-reflexes in order to minimise losses)2 -
I love Mikrotik. Just fucking love them. I also love my residential fiber service. Small company. Synchronous 125M service. No caps. Bandwidth is always there.
BUT... They use PPPOE (seriously guys?), and the IP changes on *every single re-connect*. Also: no IPv6 support. I know. I don't need it. But I want it.
Enter DNSMadeEasy's DDNS, Hurricane Electric's 6to4 tunnel service, and my Routerboard AH100x4. I wrote a script that runs on the router whenever my IP changes. It updates my DDNS record, updates my 6to4 tunnel IP using HE's API, and updates my local 6to4 interface's IP.
It just works. My public IPv4 may change, but the /48 IPv6 networks on my LAN side stay fully routeable.4 -
lol you can get now synchronous 25gbit fiber internet for home use from a swiss local provider. For $60 per month. That means you could transfer a whole M2. 1tb Samsung 970 EVO in 32 seconds.
The future is now. 😄
What would you do with that 25gbs up and down?32 -
Our time recording software (based on SAP) triggers a blocking synchronous web service call every single time you do *anything*. Imagine having to wait 10 seconds every time you:
- put a number in a cell
- select a row
- press anything on the screen
Oh and when you lose connection nothing is saved and you have to start again (wtf was it even sending to the server)2 -
Spent 4 hours working with a buddy before realizing our failing code stemmed back to using sqlite3 Npm package, which is asynchronous. Switched to better-sqlite3, a synchronous sqlite package, and alls good.
What's the purpose of an async DB anyway? Seemed like it made storing and retrieving data a huge hassle. -
TL;DR: don’t use Array.forEach use
for … of … instead.
Array.forEach is synchronous, but pass it an async function and the bastard does not await it.
I was so sure that it was sync….
Wasted 2h14 -
Just had a cross training where the presenter kept pronouncing asynchronous and async as "awe-synchronous" and "awe-sync".
Nice job, but not awe-some.1 -
>new feature in application uses external API
>external API has unreliable response times, requires polling to get results, no way to set up webhooks or whatever
>tech lead proposes asynchronous system which will queue up user requests for processing and use websockets to warn frontend clients of finished query results
>higher ups say it will take too much time, make tech lead cut back in scale and treat external API like a regular synchronous REST API
>team dutifully implements feature within the constraints of the new smaller scope
>higher ups try out the feature, find the usage experience is extremely shitty, but don't back down, they only let tech lead scale back to original scope in small increments that still allow new problems to show up
>feature takes up same time or longer, but with more damage to the mental health of developers
At least I'm not in that team1 -
Anyone have experience / opinions on Kafka? We currently don't have a messaging system like this, and I'm thinking it would be the best choice for things like providing webhooks because its persistent nature, instead of having a "synchronous" message queue that I push into and hope it gets handled. Might also want to store attempted webhook calls in a db but I don't know if that's overkill and could be done with just transforming messages (if they fail) and trying to handle them again.3
-
Dealing with React's setState and looking through all the possible lifecycle methods was so frustrating today.
It should have been a simple thing to disable a button, via the disabled prop, on click. I thought it would be enough to say
this.setState({ disableButton: true });
someSynchronousCode();
this.setState({ disableButton: false });
in the handler ... but it wasn't. The button would still be active for about a second after clicking. I tried several things like converting the synchronous code to a promise, trying componentDidUpdate with a comparison. It all failed. Interestingly enough removing the 2nd setState immediately disabled the button, though making it permanent.🙄
I've found a solution which seemed a bit hacky, changing the state back depending on another variable in the render method.
It seems so wrong, but it was the only solution I found after several hours.3 -
The feeling when eventual consistency is unacceptable for your use case and you suggest making a call synchronous only to be told it can't be synchronous and the clients need to introduce an arbitrary wait time.
Apparently our latency metrics are more important than being correct.2 -
Something annoying about the Node.JS and express stack: no way to globally catch errors using middleware.
I mean, you can try. There's even specific middleware designed for it. However, it only catches synchronous errors. So basically only controllers that don't fetch or upload any sort of data and just return some static view or whatever.
ASP.Net middleware chain is so much more robust :(5 -
I can't google jargon, what do you call it when you "flip" a function call, such that the call becomes an event in some dispatch system and return becomes a call on the event? I had to implement five such APIs this week with surface level differences and I'm starting to feel like it has to have a name if it's this popular.
For the pedantic, I mean async calls in JS in particular, I know you can't just invert a synchronous function call that uses a stack without peek.5 -
Ugh trying to refactor a Node.js MUD codebase to use mongodb. It currently accesses/stores it's data in json files via synchronous FS operations. Callback and/or .then hell, here I come!undefined callback hell async mongo javascript async hell node asynchronous promises muds mongodb nodejs