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 - "inputstream"
-
Anyone else developed a habit to structure verbal allday Argumentations in your head in Code syntax? Helps me alot to follow ones logic. Except when I'm arguing with my girlfriend. Sometimes setMood(angry) gets randomly called (bug?) and then every if statement seems to be valid, eventhough it should return false. An inputstream that contains my outputstream is initialized but .readLine() is never being called. Instead, the outputstream to my inputstream is being overly abused. Once we get dive deeper into our if-statement we will find a while loop with a mysterious flag. Noone knows it's origin. The while loop keeps printing out random concatenated strings until it overflows your own capacity. I would have said its while(true) but in fact there must be a timer in another very hidden thread or something that sets our flag to false. The other and only way I know to exit that loop is to call apology() 100 times (maybe a variable sets the boolean that could be deeply buried in her projectstructure like this CONST.VALUES.getMood().getRealMood().getTrueMood().TRUTHCONTAINER.angryMode=true)..
I wish I could get a stressball so I can continue theorycrafting and debugging. Its 4.30 am now, my better side is snoozing next to me. I bet making this a pseudocode would be fun.
Ps: I love my lady but I had to rent3 -
I hate how the Java File I/O api works.....
I was developing a little noSQL database in java, just for fun.
The basic was: every entry was a json object, separated by \n.
Every entry started with the length in bytes, so i could perform a easy read of the entry with a inputstream, followed by the entry its self..
The problem?
If i had a big file with more than like 50000 entries, to alter a entry with acceptable perfomance, i had to read every entry for matching with search, than using RandomAccessFile to mark the old entry as deleted and adding the modified one at the end.
The same for delete, it was only possible to mark the entry as deleted, so the read/alter would just not read it by reading the length(which i wrote earlier) and than use inputstream.skip with the length.
To actually delete not needed entries, i created a new file and than reading the old one and writing at the same time to the new one, with skipping the not needed entries and at the end rename the new file to the old and re creating all the streams.
Why cant i just replace a specific part of the file? WTF JAVA2 -
Me, taking a coding class in uni:
Purposely cramping everything in as few lines as possible, making the code barely readable, just to screw with the guy who had to correct this mess.
In my defence, the assignment they gave us was garbage. The task descriptions were often ambiguous or even contradictory to what actually was the case ("The InputStream will contain a string of csv data, each element starts in the next line" -> was a malformed single line string) and the automated tests they wrote to check our output where either completely unhelpful because of their meaningless error messages, or sometimes even plain wrong, telling us our output was wrong, even though it definitely wasn't.