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 - "debug string"
-
LPT: NEVER accept a freelance job without looking at the project's source first
Client: I have a project made by a company that is now abandoning it, I want you to fix some bugs
Me: Okay, can you:
1) Give me a build to test the current state of the game
2) Tell me what the bugs are
3) Show me the source
4) Tell me your budget
Client: *sends a list of 10 bugs* Here's the APK and to give you the project I'll need you to sign an NDA
Me: Sure...
*tests build*
*sees at least 20 bugs*
*still downloading source*
*bugs look quite easy to fix should be done under an hour*
Me: Okay, so, I can fix each bug for $10 and I can do 2 today
Client: Okay can you fix 8 bugs today for $40??
*sigh*
Me: No I cannot.
Client: okay then 2 today for $20 is fine, I want a refund if you can't fix them today
*sigh*
Me: Look dude, this isn't the first time I am doing this, aight? I'll fix the bugs today you can pay me after check they are done, savvy?
Client: okay
*source is downloaded*
*literal apes wrote the scripts, commented out code EVERYWHERE
Debug logs after every line printing every frame causing FPS drops, empty objects in the scene
multiple unused UI objects
everything is spaghetti*
*give up, after 2 hours of hell*
*tfw averted an order cancellation by not taking the order and telling client that they can pay me after I am done*
Attached is an image of a level object pool
It's an array with each element representing a level.
The numbers and "Final" are ids for objects in an object pool
The whole string is .Split(',') into an array (RIP MEMORY BTW) and then a loop goes through each element in the split array and instantiates the object from an object pool5 -
Hello, world!
Soo.. I am half way done with Pre-Release 10!
Woohoo!
However.. The update log is already as long as the full update log for the last update.. Which was twice as long as the log for the update before..
I'm Starting to notice a pattern.. XD
This is all good and well, but I feel as if I'm overworking myself. I'm getting stressed out, and I'm not spending near as much time with my girlfriend. 3: But, I'm having fun. I'm genuinely enjoying myself, and I'm making a ton of progress in such a short amount of time. I also have a new team member!
Idk.. I haven't done anything the past two days really. Work nor spending time with my girlfriend. I'm stressed, and I'm not sure what I should do. I'm sooper modivated to keep working, but I feel that my situation will only get worse.
---
Because I'm sure some of you will be interested ('cause my game is very popular in this community <3), here is the update list so-far. Do note that this is not the final list, and things will be added, and may be removed.
As you can see below, this update is mostly focussed around API's. Specifically Modding, and the new FileSystem. On top of this, I will *try* and tinker with the official Patreon API for Java and see if I can't intergrate that into my game. I'll also work on a ModManager, but I'm not sure if either of these will make it into this release. I also have plans for new Apps and Commands for this release, as well as working and polishing up existing Apps and Commands.
---
* Closing the game with X button (and other ways) now also calls preExitTasks()
+ Added AddonLoader. It's literally a Mod-Loader. (Your welcome :3) A tutorial coming soon, but just know that it's standard Java codeing and you simply need to drop the mod.jar into the game's addons/ directory.
++ Added "API" - This is a bunch of methods that are added for the Mods to use. These Methods likely wouldn't of been added othewise.
+ Added in-game FileSystems (Folder, files..)
++ Added FileNavigator API for traversing the in-game FileSystems
* Fixed a major bug with the "debug" command where you could no longer run any commands after enabling debug mode.
+ Added GameSave creation
+ Added System creation
+ New Save + localsystem are generated on startup
++ Added WindowBuilder API for creating Apps. This makes creating Apps much, much simpler, and is intended for not only us, but use in Mods.
* We re-wrote the Console Class from scratch, and turned it into an API for creating custom Terminal Apps. (Commands are now created using the Command Class and are then passed to Console and registered as either a Local or Global command)
++ Added Command API for creating commands. These commands execute Java code, much like a JavaFX Button would, on each call. You also get everything after the first [space] of the command that was passed, as a String.
* Re-wrote ALL previously implimented Apps.
* Re-wrote ALL previously implimented Commands.
+ Added "debugtest" command to test debug mode. (This just prints a totally boring random message, and you shouldn't try it.) [Note: This "command will not exist" when debug mode is false.]
+ Added "cd" command. ("cd ~" "cd .." "cd /home/folder" "cd etc" "cd /")
+ Added "cat" command. ("cat file" "cat /folder/file")
+ Added "mkdir" command.
+ Added "rm" command.
+ Added "dir" command.
If you're new and you have no clue what I'm talking about, here's the info page: https://trello.com/b/0bH2SjQf1 -
When you are trying to debug Android apps and need to find small string in that huge spam logcat is giving you...2
-
I love javascript, but sometimes it's just an incredibly stupid language, such as when undefined variables get interpreted as string literal "undefined" when concatenating strings. I like it better how, for example, PHP handles undefined values, that nulls just turn into "". Better still: typed languages, where most stupid mistakes are caught already at compilation, instead of having to spend hours to track down where that mysterious "undefined" comes from. As I said, I love javascript - because it is easy to code, flexible and forgiving in many ways. But I hate it for the exact same reason, for being such a sloppy fluffy...thing, and a bugger to debug. If javascript would be an animal, it would be a cute and cuddly cat that you instantly find adorable, but it's actually quite fat and lazy, plus its fur is littered with ticks and other bugs.12
-
Dude what the fuck with C#'s code style?
Pascal case variable names and classes? Don't we do this so we can differentiate between variables and classes??
Newline between parentheses and brackets?
Retarded auto get/ set methods that serve no purpose than to make code difficult to read and debug?
And after all that shit, string, which is a class, has a lowercase s and is treated as if a primitive?
I really have no idea why this language is so widely praised. The only thing I like about it is that it's the only major bytecode language that has operator overloading and reference parameters.19 -
Ladies and gents, it was a 🍺 day, today.
I spent more hours than I care to say today tracking down an issue in our web workflow, even looping in our only web dev to help me debug it from his side. There ended up being multiple bugs found, but the most annoying of them was that the json data being pulled back was truncated because a certain someone, in their migration script, set their varchar variable to a size of 1000 and then proceeded to store a json string that was 2800+ characters in length.
C'mon man!
I got nothing productive done today. Hate, hate, hate days like this!
Beer me.3 -
Ah, the little subtle things we have to iron out as we progress from Junior Developer to Medior Developer.. things like:
- knowing the difference between a carriage return and a line feed (although having worked with analog typewriters helps) and later knowing that Unix-based systems and Windows NT-based systems implement it differently..
- knowing that serialization is important because not all computers interpret data the same way and some computers allocate 4 Bytes for a construct, others 16 Bytes.. and then we get the funkiness of transferring character sets between machines..
- knowing that a whitespace character is not only an actual space (as is known in ASCII as code 32). This one can cause even medior developers a headache, as in: why the fuck does this string function say that "hello I am a duck" and "hello I am a duck" are not the same?! Turns out then in the debugger that when you expand every character in the string you see that string1 contains 32 32 32 32 as usual.. but then string2 contains -96 -96 -96 -96 and you're like.. what the fuck..? Then you know you have to throw \\h regex at it. Haha.
- finalizing our objects and streams (although modern languages do that for us).. otherwise we have to do funky shit like trying to find what's locking a file, which is not so easy to figure out.
- figuring out why something won't work often requires you to not only break down the problem in smaller steps, to use a debugger, but sometimes it's even better to just create a proof of concept, slap some minimal code in there and debug that.. much easier.
- etc.
:)7 -
Hiii devRanters, I have a TypeScript question for you...
How do I dynamically import classes?
I have a class like this:
export default class Foo implements Bar {
...
....public getName(): string {
........return this.name;
....}
}
and then I have another file with this:
import(`./class-cmd/${file}`).then((command) => {
....winston.debug(command);
....winston.debug(command.getName());
});
the first command spits out something like this:
debug: default=class Foo {
....constructor() {
........this.name = "foo";
....}
....getName() {
........return this.name;
....}
}
and I would expect that the second command will work, however it throws this:
UnhandledPromiseRejectionWarning: TypeError: command.getName is not a function
Any idea what I might be doing wrong?18 -
I've been dreaming about an eat() method in, I guess, Javascript. It would accept a string as parameter and set the cursor position further by the width of that string in the current font and size without displaying the string. A bit like a span with FG == BG.
But the best was the debug mode: the characters would be printed, but a yellow duck would appear from the left and eat them in Pacman style.1 -
Oh Shit! Here we go again!
print(request_permissions)
>> [ ]
if request_permissions:
//some if shit
else:
raise 404
It was supposed to raise 404 for empty array, but continue to exit if.
Me: What the fuck?
**printing request POST data**
**empty, nothing wrong here**
**double checked print statement output**
** still printing [ ] **
**restart server and again checking print statement**
**still same**
Getting mad over myself, for failing to debug simple if else.
Wait....
print(type(request_permissions))
>> <class 'str'>
Me: What the actual fuck??
Fucker literally dumped empty array to JSON causing array to convert into string "[ ]" and still using if else based on array instead of string length.
Thanks to our Product Manager who approved our request to revamp this part of code and also revamping the whole shitty project developed by 3rd party in upcoming quarter.22 -
Thank python. Thank you , you just waste a hour of my life. The function is silently fail and spend a hour trying of to debug it.After a hour you know what a problem is? The parameter type.
The function expect a string but I am putting non-string type in the parameter and it just silently fail with no exception thrown. Great!12 -
StackOverflow locked my account. I'm hoping someone here might be kind enough to help me with a bash script I'm "bashing" my head with. Actually, it's zsh on MacOS if it makes any difference.
I have an input file. Four lines. No blank lines. Each of the four lines has two strings of text delimited by a tab. Each string on either side of the tab is either one word with no spaces or a bunch of words with spaces. Like this (using <tab> as a placeholder here on Devrant for where the tab actually is)
ABC<tab>DEF
GHI<tab>jkl mno pq
RST<tab>UV
wx<tab>Yz
I need to open and read the file, separate them into key-value pairs, and put them into an array for processing. I have this script to do that:
# Get input arguments
search_string_file="$1"
file_path="$2"
# Read search strings and corresponding names from the file and store in arrays
search_strings=()
search_names=()
# Read search strings and corresponding names from the file and store in arrays
while IFS= read -r line || [[ -n "$line" ]]; do
echo "Line: $line"
search_string=$(echo "$line" | awk -F'\t' '{print $1}')
name=$(echo "$line" | awk -F'\t' '{print $2}')
search_strings+=("$search_string")
search_names+=("$name")
done < "$search_string_file"
# Debug: Print the entire array of search strings
echo "Search strings array:"
for (( i=0; i<${#search_strings[@]}; i++ )); do
echo "[$i] ${search_strings[$i]} -- ${search_names[$i]}"
done
However, in the output, I get the following:
Line: ABC<tab>DEF
Line: GHI<tab>jkl mno pq
Line: RST<tab>UV
Line: wx<tab>Yz
Search strings array:
[0] --
[1] ABC -- DEF
[2] GHI -- jkl mno pq
[3] RST -- UV
That's it. I seem to be off by one because that last line...
Line: wx<tab>Yz
never gets added to the array. What I need it to be is:
[0] ABC -- DEF
[1] GHI -- jkl mno pq
[2] RST -- UV
[3] wx -- Yz
What am I doing wrong here?
Thanks.17 -
NULL and '/0' are two different things. NULL is a null pointer. '/0' is a null byte. C handles those two differently enough to introduce some interesting issues. Helped a friend debug his code, execvp() was freaking out because he had tried to terminate his argv array with a null byte instead of a null pointer. As far as the system was concerned, that doesn't mean anything more than "oh look there's no string here." Big big difference.3
-
A CASE AGAINST BLUE PRISM
Let's review one of the worst weeks I had with Blue Prism
Monday: Yay! Solved one of the problems we've been carrying around for a week before.
One of the robots suddenly became slow. Like, REAL slow. A process that would take 3 minutes per record now takes 45, and that broke apart all the following schedule.
There were no updates on the application server, the production machine, the robot, it just became slow. And not always slow; a process manually run from console room would work, a process in debug room would work, it's just the scheduled part that caused problems.
It turned out, BP didn't seem to like that particular combination of schedulation + process + machine. Moving the process to a different machine seemingly fixed that. IDK why.
Tuesday: One of our processes waits for a code to appear in the page, and when that happens, it memorizes this code. However, now it is always returning blank. Worked for months, now it breaks every single time.
After half a day of debugging a bug which DIDN'T HAPPEN IN DEBUG MODE YET AGAIN, at 11pm I decided to just place a nonsensical timeout in page before reading and call it a day.
WEDNESDAY: a scheduled process didn't start. "No sessions created". Thanks Blue Prism, very cool.
THURSTAY: This time, schedulation did start, but the process is "waiting". As in: it's 9:30 am, the process has been stuck in the same step since 6:00 am. Turns out, it blocked during a navigate stage; you need to send a string to clipboard using the standard BP action for that, then paste and click "enter", but for some reason the standard BP object sent "ORRCO" instead of "ORRICO" to clipboard, which obviously returned no results and then... the process just didn't feel like doing things anymore. No errors, no logs, nothing: just sitting on its ass. Because fuck you that's why.
Friday: another process uses a very moderate amount of scripts to work. Nothing really fancy, just a couple of lines of code to place in page some IDs and selector to help BP do its thing, otherwise selecting these elements would be a nightmare.
But
Failed while invoking javascript method:Exception from HRESULT: 0x80020101-> at mshtml.HTMLWindow2Class.IHTMLWindow2_execScript(String code, String language)
The same script -it's not dynamically generated-worked yesterday, the day before and the day after. But sometimes it will not. Why? The answer, my friend, is blowin'' in the wind -
(I'm not completely sure of what I'm saying here, so don't take this too seriously)
Settling on a language to write the api for ranterix is hard.
I'm finding a lot of things about elixir to be insanely good for a stable api.
But I'm having a lot of gripes with the most important elixir web framework, phoenix.
Take a look at this piece of code from the phoenix docs:
defmodule Hello.Repo.Migrations.CreateUsers do
use Ecto.Migration
def change do
create table(:users) do
add :name, :string
add :email, :string add :bio, :string
add :number_of_pets, :integer
timestamps()
end
end
end
Jesus christ, I hate this shit.
Wtf are create, add and timestamps. Add is somehow valid inside the create, how the fuck is that considered good code? What happens if you call timestamps twice? It's all obscure "trust me, it works" code.
It appears to be written by a child.
js may have a million problems. But one thing I like about CJS (require) or ESM (import) is that there's nothing unexplained. You know where the fuck most things come from.
You default export an eatShit() function on one file and import it from another, and what do you get?
The goddamn actual eatShit function.
require is a function the same way toString is a function and it returns whatever the fuck you had exported in the target file.
Meanwhile some dynamic langs are like "oh, I'll just export only some lang construct that i expect you to specify and put that shit in fucking global of the importing file".
Js is about the fucking freedom. It won't decide for you what things will files export, you can export whatever the fuck you want, strings, functions, classes, objects or even nothing at all, thanks to module.exports object or export statement.
And in js, you can spy on anything external, for example with (...args) => debugger; fnToSpyOn(...args)
You can spoof console.log this way to see what the fuck is calling it (note: monkey patching for debugging = GOOD, for actual programming = DOGSHIT)
To be fair though, that is possible because of being a dynamic lang and elixir is kind of a hybrid typed lang, fair enough.
But here's where i drop the shit.
Phoenix takes it one step further by following the braindead ruby style of code and pretty DSLs.
I fucking hate DSLs, I fucking hate abstraction addiction.
Get this, we're not writing fucking poetry here. We're writing programs for machines for them to execute.
Machines are not humans with emotions or creativity, nor feel.
We need some level of abstraction to save time understanding source code, sure.
But there has to be a balance. Languages can be ergonomic for humans, but they also need to be ergonomic for algorithms and machines.
Some of the people that write "beautiful" "zen" code are the folks that think that everyone who doesn't push the pretty code agenda is a code elitist that doesn't want "normal" people to get into programming.
Programming is hard, man, there's no fucking way around it.
Sometimes operating system or even hardware details bleed into code.
DSLs are one easy way to make code really really easy to understand, but also make it really fucking hard to debug or to lose "programming meaning".7 -
Why is assigning something to a variable then returning it a code smell?
Simple example:
double makeNumber(String[] numbers)
{
StringBuilder sb = new StringBuilder();
for (String n : numbers)
sb.append(Double.parse(number);
double result = Double.parse(sb.toString());
return result;
}
Why is this bad?
double result = Double.parse(sb.toString());
imagine is a more complicated assignment or calls another function that does some other weird stuff?
If i'm going to debug an issue, i m going to have to unwrap it anyway. So what's the cost of leaving it there?23 -
I'm at college and I was learning Java. While we were practicing in class, one of my friends was having a problem with his code, it was printing that he needed to use java.lang.String.
Because he only told us after class, we didn't have the teacher to help us, so we tried debug it. After a long time, we realized that he was trying to create the class String...
We still talk about it. -
Somewhere in out application backend we generate a simple bullet chart. But in the most complicated way possible.
We call a web service to retrieve it(yes, a simple bullet chart). The service requires some parameters, and the code that generates them is hidden behind a wall of interfaces and abstract methods (the best and apparently only way to get to the actual code is to debug it).
However, one of these parameters is very well visible and it is a string with (uncommented)javascript function that manipulates the resulting chart, adding some final touches. With hardcoded values etc..
Dear programmers, I know we should avoid reinventing the wheel, but sometimes we should stop and consider the possibility, that we are using the wrong wheel and in completely wrong/obscure way. Thank you.
Yours WhoeverWillMaintainTheCode3 -
Another hours wasted on debugging, on what I hate most about programming: strings!
Don't get me started on C-strings, this abomination from hell. Inefficient, error prone. Memory corruption through off by one errors, BSOD by out of bound access, seen it all. No, it's strings in general. Just untyped junk of data, undocumented formats. Everything has to be parsed back and forth. And this is not limited to our stupid stupid code base, as I read about the security issues of using innerHTML or having to fight CMake again.
So back to the issue this rant is about. CMake like other scripting languages as bash have their peculiarities when dealing with the enemy (i.e. strings), e.g. all the escaping. The thing I fought against was getting CMake's fixup_bundle work on macOS. It was a bit pesky to debug. But in the end it turned out that my file path had one "//" instead of an "/" and the path comparison just did a string comparison without path normalization.
Stop giving us enough string to hang ourselves!rant debugging shit scripts of death fuck file paths fuck macos string to hang ourselves fuck strings cmake hell12 -
Terraform + helm-chart ... I really ned a break. Who the fuck invented this shit.
The HCL format sucks
The documentation sucks
The dev tools suck
The debug output sucks
But I'm ok with that, I can manage.
But today really it shot the bird ... I can't have a fucking comma in a string? Because idk why the fuck helm-release tries to parse that fucking string and wants to make an array or whatever out of it? Why, you fucking abomination?
Something in the docs? Nah, who reads them anyway.
Because you know it's totally not strange that a string is analyse and oh wait there's a comma in it, the dev surely wants me to make an array out of it, because you know ...
So now I have to escape my fucking comma to prevent it to parse my fucking string. I just want to have a fucking string you hideous monstrosity ....1 -
Relatively often the OpenLDAP server (slapd) behaves a bit strange.
While it is little bit slow (I didn't do a benchmark but Active Directory seemed to be a bit faster but has other quirks is Windows only) with a small amount of users it's fine. slapd is the reference implementation of the LDAP protocol and I didn't expect it to be much better.
Some years ago slapd migrated to a different configuration style - instead of a configuration file and a required restart after every change made, it now uses an additional database for "live" configuration which also allows the deployment of multiple servers with the same configuration (I guess this is nice for larger setups). Many documentations online do not reflect the new configuration and so using the new configuration style requires some knowledge of LDAP itself.
It is possible to revert to the old file based method but the possibility might be removed by any future version - and restarts may take a little bit longer. So I guess, don't do that?
To access the configuration over the network (only using the command line on the server to edit the configuration is sometimes a bit... annoying) an additional internal user has to be created in the configuration database (while working on the local machine as root you are authenticated over a unix domain socket). I mean, I had to creat an administration user during the installation of the service but apparently this only for the main database...
The password in the configuration can be hashed as usual - but strangely it does only accept hashes of some passwords (a hashed version of "123456" is accepted but not hashes of different password, I mean what the...?) so I have to use a single plaintext password... (secure password hashing works for normal user and normal admin accounts).
But even worse are the default logging options: By default (atleast on Debian) the log level is set to DEBUG. Additionally if slapd detects optimization opportunities it writes them to the logs - at least once per connection, if not per query. Together with an application that did alot of connections and queries (this was not intendet and got fixed later) THIS RESULTED IN 32 GB LOG FILES IN ≤ 24 HOURS! - enough to fill up the disk and to crash other services (lessons learned: add more monitoring, monitoring, and monitoring and /var/log should be an extra partition). I mean logging optimization hints is certainly nice - it runs faster now (again, I did not do any benchmarks) - but ther verbosity was way too high.
The worst parts are the error messages: When entering a query string with a syntax errors, slapd returns the error code 80 without any additional text - the documentation reveals SO MUCH BETTER meaning: "other error", THIS IS SO HELPFULL... In the end I was able to find the reason why the input was rejected but in my experience the most error messages are little bit more precise.2 -
Is there a debug tool in Visual Studio that acts like a global HashMap<String, object> that you can add random objects to so that you can verify which objects are the same instance between breakpoints and view the state of an object that you had access to but is not in scope at a given breakpoint? I'm debugging a GUI app right now and it's an enormous pain in the ass to track identities, I resorted to adding random properties and statics to classes just so I can express this basic ass persistent debugger state6