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 - "break loop"
-
Once I forgot to break a loop that was supposed to send 100 email to a colleague in the middle of the night.
She did not get 100 emails, she got alot more11 -
tl;dr
A former colleague of mine, who used to suck at web development is now a kick-ass who knows how to get things done.
We are of the same age. We got hired on this company at the same time. He was a front-end guy, and I am a full-stack. So, we were like a yin and yang in development roles.
Initially, we have this big gap of skillset. I was solely assigned on a project which I worked on from ground up, while he was barely able to make an HTML table look properly on a separate existing project. My impression of him that time is that he's kind of a simpleton. But, I was wrong.
Few months passed, our seniors left the company, and I was promoted to be a team lead. Eventually, I was teamed up with this guy. I had a hard time working with him, but I was able to share him some of my knowledge.
Every time I teach him something new, he's exploring more. From proper indentation, writing SASS, using streaming build system (GulpJS), etc., he's making sure that he applies it on every project he's assigned to — even practicing it on his personal projects during break time. I can see him improve each day.
After a year in the company, he became so much better. I even ended up teaching him more than just front-end stuff. I shared the gospel of Jesus of PHP community (Jeffrey Way), tought him how to set up his own server, how to configure DNS, etc.. Again, it's tough for him even to write a simple for..loop statements. But, after a lot of consistent practice, he became better and better. We've done quite a number of projects together. He's fun to work with because of his "hungry" spirit.
Unfortunately, he was laid-off from the company, and I worked on the company til the very end. We parted ways.
He went back to his hometown to launch his own e-commerce business — apparently, this was the "practice" project he was working on the whole time during breaktimes.
Another year has passed, that project worked out and got a funding. And now, he's launching his second project. The best thing is, when I lookup his projects on builtwith.com, every damn stack I tought him, he used it. It's like a project built by me.
To be honest, I am a little jealous of him, but at the same time, I am so proud of him. I thought him how to make things work, he thought me how to get things done. He's my inspiration now.5 -
Okay, story time.
Back during 2016, I decided to do a little experiment to test the viability of multithreading in a JavaScript server stack, and I'm not talking about the Node.js way of queuing I/O on background threads, or about WebWorkers that box and convert your arguments to JSON and back during a simple call across two JS contexts.
I'm talking about JavaScript code running concurrently on all cores. I'm talking about replacing the god-awful single-threaded event loop of ECMAScript – the biggest bottleneck in software history – with an honest-to-god, lock-free thread-pool scheduler that executes JS code in parallel, on all cores.
I'm talking about concurrent access to shared mutable state – a big, rightfully-hated mess when done badly – in JavaScript.
This rant is about the many mistakes I made at the time, specifically the biggest – but not the first – of which: publishing some preliminary results very early on.
Every time I showed my work to a JavaScript developer, I'd get negative feedback. Like, unjustified hatred and immediate denial, or outright rejection of the entire concept. Some were even adamantly trying to discourage me from this project.
So I posted a sarcastic question to the Software Engineering Stack Exchange, which was originally worded differently to reflect my frustration, but was later edited by mods to be more serious.
You can see the responses for yourself here: https://goo.gl/poHKpK
Most of the serious answers were along the lines of "multithreading is hard". The top voted response started with this statement: "1) Multithreading is extremely hard, and unfortunately the way you've presented this idea so far implies you're severely underestimating how hard it is."
While I'll admit that my presentation was initially lacking, I later made an entire page to explain the synchronisation mechanism in place, and you can read more about it here, if you're interested:
http://nexusjs.com/architecture/
But what really shocked me was that I had never understood the mindset that all the naysayers adopted until I read that response.
Because the bottom-line of that entire response is an argument: an argument against change.
The average JavaScript developer doesn't want a multithreaded server platform for JavaScript because it means a change of the status quo.
And this is exactly why I started this project. I wanted a highly performant JavaScript platform for servers that's more suitable for real-time applications like transcoding, video streaming, and machine learning.
Nexus does not and will not hold your hand. It will not repeat Node's mistakes and give you nice ways to shoot yourself in the foot later, like `process.on('uncaughtException', ...)` for a catch-all global error handling solution.
No, an uncaught exception will be dealt with like any other self-respecting language: by not ignoring the problem and pretending it doesn't exist. If you write bad code, your program will crash, and you can't rectify a bug in your code by ignoring its presence entirely and using duct tape to scrape something together.
Back on the topic of multithreading, though. Multithreading is known to be hard, that's true. But how do you deal with a difficult solution? You simplify it and break it down, not just disregard it completely; because multithreading has its great advantages, too.
Like, how about we talk performance?
How about distributed algorithms that don't waste 40% of their computing power on agent communication and pointless overhead (like the serialisation/deserialisation of messages across the execution boundary for every single call)?
How about vertical scaling without forking the entire address space (and thus multiplying your application's memory consumption by the number of cores you wish to use)?
How about utilising logical CPUs to the fullest extent, and allowing them to execute JavaScript? Something that isn't even possible with the current model implemented by Node?
Some will say that the performance gains aren't worth the risk. That the possibility of race conditions and deadlocks aren't worth it.
That's the point of cooperative multithreading. It is a way to smartly work around these issues.
If you use promises, they will execute in parallel, to the best of the scheduler's abilities, and if you chain them then they will run consecutively as planned according to their dependency graph.
If your code doesn't access global variables or shared closure variables, or your promises only deal with their provided inputs without side-effects, then no contention will *ever* occur.
If you only read and never modify globals, no contention will ever occur.
Are you seeing the same trend I'm seeing?
Good JavaScript programming practices miraculously coincide with the best practices of thread-safety.
When someone says we shouldn't use multithreading because it's hard, do you know what I like to say to that?
"To multithread, you need a pair."18 -
First rant: but I'm so triggered and everyone needs a break from all the EU and PC rants.
It's time to defend JavaScript. That's right, the best frikin language in the universe.
Features:
incredible async code (await/async)
universal support on almost everything connected to the internet
runs on almost all platforms including natively
dynamically interpreted but also internally compiled (like Perl)
gave birth to JSON (you're welcome ppl who remember that the X in AJAX stood for XML)
All these people ranting about JS don't understand that JS isn't frikin magic. It does what it needs to do well.
If you're using it for compute-heavy machine learning, or to maintain a 100k LOC project without Typescript, then why'd you shoot yourself in the foot?
As a proud JS developer I gotta scroll through all these posts gushing over the other languages. Why does nobody rant about using Python for bitcoin mining or Erlang to create a media player?
Cuz if you use the wrong tool for the right job, it's of course gonna blow up in your face.
For example, there was a post claiming JS developers were "scared" of multithreading and only stick in their comfort zone. Like WTF when NodeJS came out everything was multithreaded. It took some brave developers to step out of the comfort zone to embrace the event loop.
For a web app, things like PHP and Node should only be doing light transforms between the database information and HTML anyways. You get one thread to handle the server because you're keeping other threads open to interface with databases and the filesystem. The Nexus.js dev ranting on all us JS devs and doesn't realize that nobody's actual web server is CPU bound because of writing HTML bodies, thats why we only use 1 thread. We use other worker threads to do the heavy lifting (yes there is a C++ bridge look it up)
Anyways TL;DR plz respect JS developers we're people too. ES7 is magic and please don't shit on ES3 or we'll start shitting on the Python 2-3 conversion (need to maintain an outdated binary just cuz people leave out ()'s in their print statements)
Or at least agree that VB.NET is an abomination and insult to the beauty that is TI-84 BASIC13 -
!dev
Ffuuuuucckk
This day just sucks.
Got a speeding ticket, went to pay it first thing in the morning. To renew insurance I had to call the bank to update my phone nr for 2FA. In this endless loop of „for this, press 1, for that, press2“ I pressed the wrong number and it invalidated my e-Banking password.
After a while got my number updated, after that called the insurance, after waiting for like 20min got that sorted and wanted to check my bank balance but I couldn’t log in. Now I can’t reset it either because it’s locked.
Need to call then again but needed a break and wanted to cook something but now my FUCKING SINK is clogged.
Have to uninstall half of the kitchen to get to t he pipes..
And it’s only noon.5 -
Wow i must have been brain dead when i wrote this code. Needed to exclude certain elements from response for the the list of objects.
for (obj : objects) {
If (obj.skipFromResponse()) {
break
}
add obj to response
}
I used break instead of continue at the if condition which meant it would break out of the loop at the first instance of condition being met.
This went through qa and has been in production for 4 weeks so how did this not break before. Well little did i know the list of objects was sorted and all the test data, qa data and everything so far in production coincidentally only had the last element with matching condition. This meant it returned everything correctly so far.
Today was the first time there was a situation where this caused incorrect output. Luckily as soon as I heard the description of the issue I remembered to check the merged PR and hung my head in shame for making such trivial error. I must have written way more complicated code without any problem but this made me embarrassed to even admit. 🤦♂️4 -
Honestly, nothing kills your brain cells faster than doing the same repetitive tasks at work, day in and day out. It’s like I'm just on autopilot—pushing buttons, running scripts, rinse, repeat. At some point, I start wondering if I’m a dev or just a glorified robot.
And to keep my sanity intact? Competitive programming. Yeah, that’s how I free my mind—throwing myself into algorithmic problems during my break time, just to remind myself that there’s more to life than the mundane loop of tasks at work. I’ll take an NP-hard problem over this any day. At least that makes me think.6 -
Today on "How the Fuck is Python a Real Language?": Lambda functions and other dumb Python syntax.
Lambda functions are generally passed as callbacks, e.g. "myFunc(a, b, lambda c, d: c + d)". Note that the comma between c and d is somehow on a completely different level than the comma between a and b, even though they're both within the same brackets, because instead of using something like, say, universally agreed-upon grouping symbols to visually group the lambda function arguments together, Python groups them using a reserved keyword on one end, and two little dots on the other end. Like yeah, that's easy to notice among 10 other variable and argument names. But Python couldn't really do any better, because "myFunc(a, b, (c, d): c + d)" would be even less readable and prone to typos given how fucked up Python's use of brackets already is.
And while I'm on the topic of dumb Python syntax, let's look at the switch, um, match statements. For a long time, people behind Python argued that a bunch of elif statements with the same fucking conditions (e.g. x == 1, x == 2, x == 3, ...) are more readable than a standard switch statement, but then in Python 3.10 (released only 1 year ago), they finally came to their senses and added match and case keywords to implement pattern matching. Except they managed to fuck up yet again; instead of a normal "default:" statement, the default statement is denoted by "case _:". Because somehow, everywhere else in the code _ behaves as a normal variable name, but in match statement it instead means "ignore the value in this place". For example, "match myVar:" and "case [first, *rest]:" will behave exactly like "[first, *rest] = myVar" as long as myVar is a list with one or more elements, but "case [_, *rest]:" won't assign the first element from the list to anything, even though "[_, *rest] = myVar" will assign it to _. Because fuck consistency, that's why.
And why the fuck is there no fallthrough? Wouldn't it make perfect sense to write
case ('rgb', r, g, b):
case ('argb', _, r, g, b):
case ('rgba', r, g, b, _):
case ('bgr', b, g, r):
case ('abgr', _, b, g, r):
case ('bgra', b, g, r, _):
and then, you know, handle r, g, and b values in the same fucking block of code? Pretty sure that would be more readable than having to write "handeRGB(r, g, b)" 6 fucking times depending on the input format. Oh, and never mind that Python already has a "break" keyword.
Speaking of the "break" keyword, if you try to use it outside of a loop, you get an error "'break' outside loop". However, there's also the "continue" keyword, and if you try to use it outside of a loop, you get an error "'continue' not properly in loop". Why the fuck are there two completely different error messages for that? Does it mean there exists some weird improper syntax to use "continue" inside of a loop? Or is it just another inconsistent Python bullshit where until Python 3.8 you couldn't use "continue" inside the "finally:" block (but you could always use "break", even though it does essentially the same thing, just branching to a different point).19 -
The worst part of being a dev
My social dilemma
In a fast paced world where the average human spends at least 6 hours a day with technology, deriving basic entertainment, pleasures and engaging in various activities.
Here we are the developers that have to engage with technology for longer hours for a living , having to keep up with deadlines, immersing our minds in complicated algorithms and then the endless possibilities of entertainment from the machine in so few human hours a day , you wonder how you’d get off, and to top it up, I personally work from home.
And then the dilemma of overcoming different suggestions from various parties in taking a break off, a break off to what you later ask yourself, thus creating the shadow of doubt, splitting the fragile programmer’s mind , trying to solve this imaginary puzzle, “this bug of the mind”.
Then the challenge often arises in creating a balance, telling yourself, just catching up with people with this same technology takes a whole day, or then again quitting my Job, but from my little experience of life, nobody likes a poor visitor, this is actually worse than a “bug” and as I bask in this quagmire, “a little voice in my head keeps singing keep doing what you love doing”.
Like an infinite loop of crazy, spiralling back to these machines, trying the find and fix the balance of normalcy. Always remembered the cool years of college tho, with so much people around and then again that was college.
An then the thought arises, maybe something else might be worth doing, but after so much time spent in building your skills and the enormous joy of programming even typing without looking at the keyboard is a real pleasure, and yeah sure the days are short with the reality of a constant need to survive, remain sane, compete and make the best of life in such short time.
Then how do we know if we have fallen off the so-called “social track”, when we have only lived so little to really comprehend the most parts of life? with such constant stream of unanswered question, you’d realise you shouldn’t have burdened the mind creating such questions in the first place
But then again maybe it gets better, one of the above, the disturbed mind or the situation as whole and yes I try oh I try, I place calls, do some visiting, no relationship tho but with a good perspective in mind.
In this race of life, you sometimes ask yourself would you rather be in a different position, or maybe already put exactly where we belong. For this illusionary fight with self is a fight with reality as a whole and true bliss comes from actually letting go as time and people pass you by.
And my greatest achievement to date aside family and my work is getting into the 1000 club on devRant.2 -
La me working on a new chrome extension:
- ok, this page has some hidden divs, I need to tell the extension to make windows scroll to the bottom while there are still elements with a hidden class
- creates a while(1) loop with a condition inside it to break if no elements with hidden class are longer there.
- happy with the code
- uploads the extension
- goes to page
- brings out developer tools
- goes to console
- clicks on extension on chrome
- right clicks the extension and then inspect
- ok here we go: la me click on button inside extension popup
- console shows some logs
- nice it's still looking.
.
.
.
- wait! Why is the page not scrolling ???
- looks at logs, WTF nothing changes in logs .....
- OMMMMG a infinite loop .... infinite loop inside chrome ....
- OMMMMMG my pc's gonna crash .
-stop please stop stop.
- wait! how do I stop this?
- tries CTRL+C ... nothing
- tries CTRL+Z ... nothing ...
.
.
.
.
Abort abort Aboooooort.
.
.
.
- Deletes extension from chrome.
-..... loop still running
- clicks on X to close Chrome.....
- not closing O_o
- Oh God, i need to do something before Chrome sucks all the RAM left.
- remembers the savior...
.
.
.
- Task Manager heeeelp me.
- opens Task manager
- chrome is consuming ~ 2 GB of RAM.
- WTF! Kills chrome.
Thanks for reading my lil adventure 😅5 -
Tech Lead: We need to exclude logged in user from our all users API as we don't want to show user's self card on the frontend with other users.
Me (Backend dev): This should be handled by the frontend and they should exclude it by a condition in their loop:
If (user.id != loggedUser.id)
{
// Add card
}
We also need self user at several other places.
Tech Lead: Create a query param filter for that.
Me: We should keep our APIs as generic as possible.
(Real thing starts)
Tech Lead: Which has more processing power frontend or backend?
Me (confused): Backend
Tech Lead: This will add a break to our loop and Do you know how much processing power it will take because of this condition?
Me (dead): WHAAAA....?18 -
Just spent an entire night eaning up my codebase...
I optimized some of the functions got rid of unnecessary global variables and changed up the whole file hirearchy so it would be easier to read. After spending all night doing this I went to run the program and for once it seemed everything worked right the first time! However a portion of my application that is supposed to happen at a certain date and time never would run. After spending all night comparing each and every line for what I changed versus my last commit I couldn't find the fallacy in my logic. Everything should still work like it did before. After spending more time looking for bugs I finally realized I didn't break anything when I switched over to this new structure it was the old code that was broken. I went through the old code and after some debugging eventually found the culprit an extra continue statement that prevented my loop from fully executing. Lesson learned sometimes the biggest bugs can spawn from one line of code.4 -
Julia is a smelly pile of steaming shit.
https://discourse.julialang.org/t/...
Jesus fucking christ would you look at that pile of pure utter shit. The dumbfuck dev somehow managed to break WHILE loops for devs coming from python, and I speak for myself and probably others when I write most of us python developers are functionally braindead. If you can somehow fuck it up for python devs, a significant portion of the people you're trying to attract (owing by the syntax), then you should probably just go head and delete your whole git repo now.
Julia is a prime example of why you don't listen to your users on fucking github about the direction of language development.
What a bunch of fucking booger eating retards.33 -
3 straight days with less than 3 hours of sleep per night. If something or someone wakes me in the first fifteen minutes as I'm drifting off, that's it, my wired for however long.
Previous two nights I just barely slept at all. Last night got awakened twice as I was drifting off. To start with, its ettypre for me to be able to fall asleep at all a second time.
Last three nights I'm not actually sure I even slept. I blinked and it was morning and I woke up exhausted. Only thing I can remember is racing thoughts, as I fell asleep, and the very same exact thoughts *as* I woke up, as if my brain had been thinking the same thing on a loop for a few hours, while I was catatonic and unable to fully shut down, stuck in 'on' mode all night and not realizing it.
Not a single fucking job I work honor's their god damn promises, let alone my repeated requests for night shift.
Was so exhausted yesterday my chest hurt.
How am I supposed to drive to work on less than 9 hours asleep spread out across three days? Cant catch a fuckong break lately, and when I do it's like the universe fucking sabotages me with shit like this.6 -
Amazon mturk. Job was to rate grammatical corrections.
First of all, it's surprising how often people forget commas. That's like, the #1 error with these things.
People just keep going on and on and on and on and on and never break their sentence even if there was supposed to be a comma and it really makes the voice in my head fell like it's running out of breath but it can't stop because the sentence is still going and [...]
The corrections are generally okay. I took many more college-level English classes than I think I needed to, so my English is fairly decent. For this reason, I might be a bit more of a stickler than I need to be for this job.
But this one threw me for a loop, because it's just such a bad correction. Not only does it miss the obvious errors but creates a new, equally obvious error.
This is one of the reasons mturk is interesting to me. Sure, I don't make.... practically anything. But you come into such a variety of work that it's almost addicting in a sense.18 -
Fuck pep8 in general. Fuck harder anything to do with line limits. Fuck with a rusty spatula those who tie it into their git precommits or CI tests.
What's that, it's 2018 and even the shittiest walmart-tier computers have 1080p OR BETTER at a 16:9 aspect ratio?
"lol, 80 character line limit."
Eat a bucket of rancid dicks.
Oh, and since we're forcing you to be so economical with your characters, we're going to force four space tabs. Yknow, rather than simple single tab characters, which could mean everyone can set their preferred level of spacing without bloating the code with whitespace.
Because, yknow, it's entirely reasonable to chew up 1/8 of a line because you're editing a function inside a class definition. God Almighty forbid you try to do a for loop inside that function! Fuck you!
"Oh but you can't have two editors or terminals open side by side without that limit!"
BULL FUCKING SHIT. Here's my shitty 1280x1024 display on my shitty computer with two Sublime editors open side by side. You'll notice the break is at 100 characters. You'll notice I don't have to scroll horizontally to do two things at once. You'll notice I even have room for COMMENTS!
If your code standards require you to make your code *less* readable and *less* clear and take up *more* space to accomplish the same tasks, YOUR CODE STANDARDS SUCK!
Enough with this stupid meme. We're not in the 80s anymore and it's high time to start fucking acting like it.7 -
i was hired to join a team of old devs (40+) in an unnamed European country "yay goodbye 3rd world it's time to enjoy the quality of life" assist with enhancing already existing software and creating new solutions.
prior to my arrival most things were slow and super buggy, looking at the code base it shouldn't be a surprise, amateur hour everyone, logic implemented that is not needed, comment driven development, last time code review was done back in 1996. lots of anti patterns.
i swear there is a for loop that does nothing but it loops through a 100+ elements list, trunk based development with tfs since git is "not really needed"
test projects are not there.
>enter me an educated fool, with genuine passion for the craft and somehow a decent amount of knowledge.
>spent the last year fixing stuff educating people on principles and qualities.
> countless hours of training and explaining. team is showing cooperation, a new requirement comes in to develop with react.
> tear my ass creating reusable shit and self explanatory code with proper naming etc using git with feature branching, monday is first deployment day.
> today a colleague was working on an item submit a pull request and self approve it
> look at the code..... WTF the dumb fuck copied and pasted the whole code from different kendo components but somehow managed to refractor the name to test component, commented out all the code that he didn't use did the api call directly from the component, has 2 useeffects that depends on the a fucking text box changes for no reason, no redux implementation, the acceptance criteria is not achieved, and it doesn't work it just look right.
> first world country shit cannot scold, cannot complain, lead by example.
>asked him why you did this, the response was yeah probably i shouldn't have done that, i really didn't understand anything in the training but didn't want to waste time!!!!
> rest of the team created a different styled disaster with different flavors they don't even name their shit the same way.
fellow developers I'm stuck in a spaceship with a bunch of imposters, seriously i never cried in my entire life now I'm teary and on the verge of a break down.
talk with management "improving needs time" and offers me to join a yoga session to release the stress as if reaching nirvana would deliver shit on monday.
i really don't know what do is this a rant, is this a cry for help, I'm not sure, any advice is welcomed.7 -
The worst infinite loop of all.
while(hasPoopOnTP( )){
if(goodEnough( )){
break; //it's never good enough
}
ass.wipe( );
}1 -
Yesterday, I was perf testing my small app (my first NodeJS app). I thought I'd do a small, ghetto test: bash forloop with curl and payload to be saved.
My favorite is "for i in {0..100}; do ... ; done". I start firing these bad boys in separate tabs. Everything works fine. I check the DB... Saved results: 303.
I break into sweats. Do I have a race condition? Holy shit, is my DB layer unsafe? Fuck fuck fuck.
I fire the forloop only once. Saved results: 101. FUCK.
I run the for loop for 0..10. Saved results: 11. Huh?
I promptly realize 0..10 runs 11 times. I'm a dumbass.
/Me proceeds to deploy my code to a kubernetes lab instance with https://youtube.com/watch/... playing in the back of my mind.6 -
Somehow, a continue instead of break in a switch-case looks weird. Although it makes perfectly sense with regard to the outer for loop.8
-
The more problems I encounter with Windows the more I have the impression these infested chimps never implemented a real system repair/restoration feature but just faked it with randomized error messages.
Now Windows 10 can't even rollback updates anymore but lands in an infinite boot loop that even a reset to an earlier restoration point won't fix.
And the Windows repair option lists two Windows installations even though there's just one.
Somehow the roles of Linux and Windows have switched nowadays, by now I had to reinstall Win10 5 times on three PCs in the last 12 months.
Windows 8 was shit too but at least it didn't fucking break within a week.3 -
I went down a rabbit hole of code changes to try and delete a stupid for loop with a break in it.
It was super stupid and I gave up and submitted to the fact that some battles are not worth the time and stress.
OK... But seriously, It was returning multiple entities from the database, but we only always want the first one. My logic is that we should just go in there and fix the LINQ so we are explicitly getting one entity out.
But fuck that logic. No I'll have to change fucking everything that's tied to that method and expects a list from it. Every fucking thing. That includes error handling, parsing, for loops..... Nevermind...
You can have your foreach and your break. I'm taking mine, now.rant break my back on this stupid code what do you want on the frontend last minute changes did this to me they couldn't decide1 -
TLDR; College group projects suck, not because the work, but the people in your group will make or break you. Fuck having 1 week to do this assignment.
Sometimes working with other students on group projects is great, they actually know how to create a merge a git branch. I've had a decent partner once during my 3 years at university so far. This last project takes the cake on idiots I've worked with...so far at least... It was me and two others, we'll call them Thing1 and Thing2 for now. Anyway so the 3 of us had a week to implement a very rudimentary Invoice system; fine, easy enough. We divided up the work and 'started'.
All seemed to be going well, no complaints or cries for help all week. Until 4 hours before we submit the assignment; Thing 1 sends me a DM saying all of Thing 1's work is useless full of bugs and just shouldn't be integrated with the rest of the code. Umm fine? I guess? wtf?! why did this have to come out last minute?! We could have explained to Thing 1 what's going on and gotten him/her up to speed on everything. Believe it or not, I was sorta ok with this? I mean thing 1 hadn't pushed anything to the repo yet. I mean literally nada, Thing 1 is a collaborator on the repo that has contributed nothing. Seeing as how Thing 1 was contributing nothing I had already started to cover our ass a began Thing 1's work.
That's not even what's pissed me off... at least thing 1 had the gall to message me to say "idk..wtf is going on...continue without me". Thing 2 arguably made my time with the project worse. His code was nothing but garbage...every time...literally spent more time deciphering his incoherent bullshit more than I did rewriting his mess. I shit you not he wrote out this method, and tells the group he's "finally got it fixed and working":
public static float updateTotal(float newValue)
{
total = updateTotal(newValue);
return total;
}
How tf did he test this to see if its working?! I'm a novice and can already see the infinite loop here. You called your method within that method's own definition, what did you expect to happen.
I managed to get things 75% working and turned in 5 mins before the cut off.
Thankfully Thing 1 emailed the Proff as well, hopefully he won't tank my grade too bad. I'm so glad to be done with this assignment, fingers crossed there's no more group work.4 -
After learning a bit about alife I was able to write
another one. It took some false starts
to understand the problem, but afterward I was able to refactor the problem into a sort of alife that measured and carefully tweaked various variables in the simulator, as the algorithm
explored the paramater space. After a few hours of letting the thing run, it successfully returned a remainder of zero on 41.4% of semiprimes tested.
This is the bad boy right here:
tracks[14]
[15, 2731, 52, 144, 41.4]
As they say, "he ain't there yet, but he got the spirit."
A 'track' here is just a collection of critical values and a fitness score that was found given a few million runs. These variables are used as input to a factoring algorithm, attempting to factor
any number you give it. These parameters tune or configure the algorithm to try slightly different things. After some trial runs, the results are stored in the last entry in the list, and the whole process is repeated with slightly different numbers, ones that have been modified
and mutated so we can explore the space of possible parameters.
Naturally this is a bit of a hodgepodge, but the critical thing is that for each configuration of numbers representing a track (and its results), I chose the lowest fitness of three runs.
Meaning hypothetically theres room for improvement with a tweak of the core algorithm, or even modifications or mutations to the
track variables. I have no clue if this scales up to very large semiprime products, so that would be one of the next steps to test.
Fitness also doesn't account for return speed. Some of these may have a lower overall fitness, but might in fact have a lower basis
(the value of 'i' that needs to be found in order for the algorithm to return rem%a == 0) for correctly factoring a semiprime.
The key thing here is that because all the entries generated here are dependent on in an outer loop that specifies [i] must never be greater than a/4 (for whatever the lowest factor generated in this run is), we can potentially push down the value of i further with some modification.
The entire exercise took 2.1735 billion iterations (3-4 hours, wasn't paying attention) to find this particular configuration of variables for the current algorithm, but as before, I suspect I can probably push the fitness value (percentage of semiprimes covered) higher, either with a few
additional parameters, or a modification of the algorithm itself (with a necessary rerun to find another track of equivalent or greater fitness).
I'm starting to bump up to the limit of my resources, I keep hitting the ceiling in my RAD-style write->test->repeat development loop.
I'm primarily using the limited number of identities I know, my gut intuition, combine with looking at the numbers themselves, to deduce relationships as I improve these and other algorithms, instead of relying strictly on memorizing identities like most mathematicians do.
I'm thinking if I want to keep that rapid write->eval loop I'm gonna have to upgrade, or go to a server environment to keep things snappy.
I did find that "jiggling" the parameters after each trial helped to explore the parameter
space better, so I wrote some methods to do just that. But what I wouldn't mind doing
is taking this a bit of a step further, and writing some code to optimize the variables
of the jiggle method itself, by automating the observation of real-time track fitness,
and discarding those changes that lead to the system tending to find tracks with lower fitness.
I'd also like to break up the entire regime into a training vs test set, but for now
the results are pretty promising.
I knew if I kept researching I'd likely find extensions like this. Of course tested on
billions of semiprimes, instead of simply millions, or tested on very large semiprimes, the
effect might disappear, though the more i've tested, and the larger the numbers I've given it,
the more the effect has become prevalent.
Hitko suggested in the earlier thread, based on a simplification, that the original algorithm
was a tautology, but something told me for a change that I got one correct. Without that initial challenge I might have chalked this up to another false start instead of pushing through and making further breakthroughs.
I'd also like to thank all those who followed along, helped, or cheered on the madness:
In no particular order ,demolishun, scor, root, iiii, karlisk, netikras, fast-nop, hazarth, chonky-quiche, Midnight-shcode, nanobot, c0d4, jilano, kescherrant, electrineer, nomad,
vintprox, sariel, lensflare, jeeper.
The original write up for the ideas behind the concept can be found at:
https://devrant.com/rants/7650612/...
If I left your name out, you better speak up, theres only so many invitations to the orgy.
Firecode already says we're past max capacity!5 -
About 14 hours. From 10 AM to 12 PM.
It was a difficult problem on one of those algorithm practice websites, which I just couldn't let go of. I spent most of the time trying to micro-optimize and do the same (wrong) thing in different ways.
The next day, I managed to finish the problem in 2 hours using a different approach.
I learned a bunch of things from this:
- Algorithm analysis matters.
- If you spend too much time on a problem without taking longer breaks, you get stuck in a loop repeating the same mistakes.
- A fresh mind is significantly more productive and creative. Take a break, think about other things and let go of that mental baggage, you'll be surprised. -
Too many people seem to think that "goto" in C is the worst thing you could do. It's an abomination, never use it! (Not something I've seen here per se, just generally around)
Challenge:
Break out of a loop inside a loop without using goto, and make it look pretty. Seriously, I don't think it can be done, and goto just makes it so clean!7 -
So I'm writing a function in Unity3D that walks a rectangular grid. At one place in the code, I got the x+y coordinates backwards, which caused the function to infinitely loop between two coordinates.
Not seeing a way to kill the loop, I looked it up on Google. The suggestions I get are. . .
1. You need to kill the Unity3D task and lose your edits because the environment and the player run on the same thread.
2. You can pay ten bucks for an extension that lets you break out of infinite loops.
3. You should really avoid writing infinite loops. That's just bad form.
SERIOUSLY?1 -
I just came home from opening of the fiscal year of a small drivers' club and it was quite an amazing life experience.
I got about a 5-times "rise" for a first, small, post-due-time project.
All of the members were so relaxed in one of the most serious moments of an association. We ate, drank beer and had as much fun as possible without break the law and other rules.
The story goes like this:
I was an intern in a website development company as students tend to do. In middle of the internship my teacher asked me if I'd be willing to develop a website to the before mentioned organization.
School will help with the money by being as a middle-man. It wasn't going to pay much, about 120€ or so, it's nothing really for the job, but I said yes for the experience. We organized a meeting, school provided the space, and went straight to the business.
The development went quite well: I got the final design requirements late (there weren't too much), research a lot about CMS:s, ended up with a beta version CMS (a risk), learned it, developed some plugins (not published yet), kept copyrights for most of the work and so on.
I was done _relatively_ quickly with the project and was quite happy with it. Only things still pressing my mind was bugs of the beta CMS, support for the plugins and my somewhat inexperienced graphical design.
Then it hit me, the world. Hosting, domain transfer, certificates, registry agreements. Arrgh. Most of things were fine, I know them. I had luck that I had a technical contact for the club. It would have been a nightmare of it's own otherwise.
We had problems transferring the domain, again, as you do. The other hosting company was to blame. They were the n00bs here. I went trough the law, technical guidance, etc. I was having heavy messaging with my technical contact about it, who was a middle-man for me and the hosting firms.
After a long while loop of waiting, reconfiguring, researching and messaging, until he transfer was finally over.
We had a long while of radio silence after some bug fixes. Until the Christmas came and I was invited to a Christmas party in a cottage, third Christmas party that year. It was great fun. We ate, drank, talked, went to sauna and had a playful adult stiga or sledging competition, etc.
I updated the site yet again, a stable version of the CMS were published. Yess!
Another radio silence came and year changed. It was broken off by a call to the opening of the fiscal year, the same day. This is today, or yesterday by now. This was just after my current company's board game night. I was really busy that day. A whole afternoon of second-hand shopping around the city with a bike. I counted 35 kilometers. Yes I go by bike, don't own a car or have an driving license... Yet.
I wasn't horribly late, around 30 minutes. I started eating and drinking. Free food and beer! They was also late, they should've got trough the business before I got there, before eating. So I ate and listened. Learned more about having business or an association in general. Until my matter came to be heard. They thanked me of the co-operation and made public the change of my reward sum, I WAS GRANTED 500€ REWARD for the work. It's still not an amazing sum in a larger point of view, but I can imagine that it's big deal for a small non-profit organization, which was loosing money. Everybody applauded, every 25 members of the club. I was greatly pleased. I will have to update their site a bit still, but they are going to pay the reward ASAP.
Did I mention that the school works around the taxes, legally. Taxes for the reward, if it were assumed as a wage would be 15%, for me, at the worst case scenario, only for getting the money to my hands.
I was offered another gig at the event, but didn't promise anything yet. I left before sauna, so we didn't get to change contact details. He will find a way to reach me if he really wants so. I'm a busy free man.3 -
Someone just explain me why. I really can't figure other reason that beeing too lazy to think a condition while writing a "while loop".
At university, a colleague asked me what i think of his code. I see something like that:
while ( 1 ){
...
if (condition)
break;
...
}
Am I a fucking genius thinking that just moving condition into while will improve readability, or am i a fucking stupid ? Really not the first time seeing this, maybe i am missing something.4 -
life becomes sulking when you have no support.
1. bought a new car. finally everything went good and i was able to get out of the infinite loop of anxiety : "where would i park?" "fights with neighbour" , "how to become confident after learning to drive in driving schools?" , efc
2. on delivery day, a friend helped park the new car near home. the plan was that from next day , we will start taking classes on self car with a car trainer
3. this morning, i took a class with car trainer alongside my mom as she wanna learn too. she used to drive somewhat shakily 10 years ago.
She got scared seeing me to drive. i was driving fine as the trainer hmmself didn't scolded me anything. i was driving at 30kmph on empty roads, while she is trained to drive at 10-15kmph. whe she drove, her driving was full of jerks and sudden break/clutch release, but i remained mum
4. later on, one of my friend also rejected going with me for driving. and the car trainer is also citing some time issues for next few days. i am now stuck with:
- a brand new car wrapped under sheets with no future for getting out
- a driving license in my wallet that will keep on taking dust as i would rarely be allowed to ever take my car out for a 60km drive to office.
-some overly anxious parents trying to take out my morale
- a sad me. when will the life give me a chance to fuckin grow up?
i have cracked the IT for fuck's sake. i started from peanuts salary, and worked my way to a great package, i am a person who understands how to live. why the fuck can't i learn this skill5 -
So part of my ok assignment was to Code a simple quize game. So I used a while loop to initiate the quiz. One of the constraints was that after 6 questions answered wrong the quize ends and if you make it to the end of the quize it gives you the number of questions you got wrong. 🤣 The damn code always ran to the end despite having gotten 6questions wrong.
The problem ? Turns out I needed a break. 😂😂😂 Pun intended. -
"There are people so important to maintaining code that the internet would break if they were hit by a bus. (Computer security folks literally call this the “bus factor.”) "
https://hbr.org/2017/07/...
What do you all think of these ?
(Personally I think there is fluff to what he says. But there are loop holes to his argument. Not entirely true. And HBR should run stories through experts in field before publishing tho)3 -
I have just learnt that you can label for statements and break them in an inside loop
Wakanda crazy crap is this?
fyi here is an example:```js
outerLoop:for(let i = 0; i<5; i++){
for(let j=0; j<5; j++){
console.log(i*j);
if(i*j === 8) { break outerLoop;}
}
}
```
Why do we even set a label with a colon, why?6 -
Is inserting a break statement anywhere but in a switch statement a horrible idea and results almost always in bad code? Why? My lecture notes say so. lol.
e.g.:
loop(someJsonDataSet){
if(company.getName().equals("xyz")){
break; // don't process records of this
company
}
}14 -
Been 6 months at this one company and still don't have a good grasp on many things, I'm also almost absolutely useless in oncall and always loop in someone else, it's like my brain just afks.
I'm sure everyone has that one dumb Dev on their team, guess it's me this time, I can sense the annoyance from my teammates by my stupidity so far, there's just so much to learn about domains and specific things that only come up when things break, idk how to gain proper knowledge without someone babysitting me and Its shit for someone to do that (I'm not a junior Dev)12 -
Am I the only one who want to learn programming and can't stop overreading about it and other connected stuff?
I feel I'm in deep darkness with my learning. I'm still writing those sample codes from books/video courses and can't motivate myself to come up with a piece of software to write myself.
It's some kind of loop which I can't break and move on.
I quit my electrical engineering studies after two years, to start IT studies, because I felt IT stuff is something I want to do rest of my life. Now, after first semester, I feel I'm in the same place I was before starting IT studies...
I'm lost devRant... Any ideas for helping me changing my life?question hello darkness my old friend lost learning programming halp overreading hilfe electrical engineering help java2 -
Not a rant but...
Yo momma is like a while loop, she just keeps on going and going until you tell her to break.1 -
there it goes again
rip my college access, i'm in an infinite loop of this and can't break out
i have to wait for the server to deauth me on its end, should take 48 hours or so2 -
so.
i had a stupid idea that'd let me do a project i had planned and abandoned a while back after getting experience with the new project.
problem: detect and manage empty space in a massive file, allow adding data to those empty spaces from files, and fill in a table in a designated empty space with where dynamically-loaded things are. In Python.
I tried JUST detecting empty space, and Python would break out of loops for no reason at all just at random. "run bottom to top through this file until a non-00h byte is found" would either break out of the loop way earlier than should be possible (8 or 9 bytes into a 32KB empty file) or run way into non-zerofill areas before breaking the loop.
Am I just retarded? Is this more Python conditional fuckery? i'm so lost that it's just on hold for now (and i think i lost that script too) -
lol rust has no early return from a match statement
continue to skip rest of loop
break to exit a loop
return to exit a function
they put in let Ok(response) = request.send() else { return None };
then you can use response like normal after
but let's say I wanna know what the error was (Ok being a variant of Result::Ok or Result::Err, and the above allowing you to destructure and go on or exit early because can't destructure)
let response = match response.send() {
Ok(response) => response,
Err(err) => {
// log error to file or whatever
eprintln!("{err:#?}");
//????? HOW DO I BREAK OUT OF HERE
return None //whole function shits itself instead of just exiting match
}
}
//does some stuff with response
actually in my case the result will be wrapped in a Ok again so I'm not doing justice to explaining this problem, fux
but basically I need to exit the match without ending the function
come on, match is a loop. let me break, fuckers.17