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 - "stdout"
-
When you stare into git, git stares back.
It's fucking infinite.
Me 2 years ago:
"uh was it git fetch or git pull?"
Me 1 year ago:
"Look, I printed these 5 git commands on a laptop sticker, this is all I need for my workflow! branch, pull, commit, merge, push! Git is easy!"
Me now:
"Hold my beer, I'll just do git format-patch -k --stdout HEAD..feature -- script.js | git am -3 -k to steal that file from your branch, then git rebase master && git rebase -i HEAD~$(git rev-list --count master..HEAD) to clean up the commit messages, and a git branch --merged | grep -v "\*" | xargs -n 1 git branch -d to clean up the branches, oh lets see how many words you've added with git diff --word-diff=porcelain | grep -e '^+[^+]' | wc -w, hmm maybe I should alias some of this stuff..."
Do you have any git tricks/favorites which you use so often that you've aliased them?50 -
in python script; a for loop inside a recursive function to slow down stdout. i don't know time.sleep(n) back then4
-
Windows troubleshooting:
- Works on my system, therefore it's not an issue.
- Must be a hardware error.
- Obviously it's just cheap hardware.
- Have you tried turning it off and on again?
- Here's some obscure error code that leads nowhere.
- Have you tried "sfc /scannow"?
AS IF SFC IS A FUCKING SILVER BULLET!!!
- Our Indian support chap from answers.microsoft.com will help you.
RRRREEEEEEEEEEEEE!!!!!!!
Solution: quietly weep and reinstall your system.
Linux troubleshooting:
- There are good quality log files.
- You can run the program from the command-line and read both stdout and stderr from it.
- You can usually run the program with high verbosity options to help you track down the error.
- Even daemons can have their commands spawned from a dedicated shell, to see why they failed.
- Usually it's a configuration error and you can easily edit the configuration file.
- More often than not, the program will tell you why it failed.
Solution: usually easy to find.
I fucking love Windows. Because you know, it's so easy to troubleshoot and the support is so great!!!2 -
I started programming 7 years ago, but I downloaded my first tutorials on programming in C++ already back in 2000. I had read maybe 4 pieces of literature, didn't understand anything, because it taught things in this order 1, "So, say you want to create a cat?", no I don't. I want to make a useful program.
2, "then you have make a constructor and a destructor", makes sense since that perfectly replicates nature, not,
3, "then you can define a method in the class that enables your cat to meow", eeeh no it doesn't make a sound, what it does however is print a series of characters even less useful than "Hello World" to stdout.
Then I found assembler and it all made sense! 😀 -
What features would you want in a logger?
Here's what I'm planning so far:
- Tagged entries for easy scanning of log file
- Support for indenting to group similar sequential entries
- Multiple entry types (normal, info, event, warning, error, fatal, debug, verbose)
- Meta entries, so the logger logging about itself, e.g. disk i/o failures.
- Ability to add custom entry types, including tag, log-level, etc.
- Customizable timestamp function
- Support for JS's async nature -- this equates to passing a unique key per 'thread'; the logger will re-write all the parent blocks for context, if necessary. if that sounds confusing, it's okay; just trust that it makes sense.
- Caching, retries, etc. in the event of disk i/o issues.
- Support for custom writers, allowing you to e.g. write logs to an API rather than console or disk.
How about these features?
- Multiple (named) logs with separate writers (console, disk, etc.)
- Ability to individually enable/disable writing of specific entry types. (want verbose but not info? sure thing, weirdo!)
- Multiple writers per log. Combined with the above, this would allow you to write specific entry types (e.g. error, warning, fatal) to stderr instead of stdout, or to different apis.
- Ability to write the same log entry to multiple logs simultaneously
What do you think of these features?
What other features would you want?
I'm open to suggestions!18 -
I'm currently taking another dive into haskell. I didn't know you needed a masters degree in theoretical something to print text on stdout.
Note to myself: make dog-emoji-based language huskyell2 -
I fucking hate online editors for recruitment challanges!!
2 fucking hours I spend on developing a architectural problem but nothing came up on stdout!!
Why? Because the runtime added some functions to HELP me with stdin and stdouts. They were being called by the driverscripts and reading everything up beforehand!!
I was reading empty stdin from there!!!
Worst part is the code was kept at the last of the editor space hidden as a gray shade with no indication that there was code minimized.
After fucking my brain so long, realised the issue when I had 2 mins left!
Ended up with a compilation error while hurrying to change!!
I hate the hackerrank platform!!🤬🤬🤬😡🤯1 -
My company decided to reinvent the wheel by writing its own queue system instead of using the existing message queue service.
And it uses plain PHP with exec() to run the workers.
Where do we store the job? We use mongoDB which is already used in our existing projects. We can query the collection/table each time the queue service start, execute the jobs, and let it exit if there's no job anymore. Don't worry, systemd will start the queue service again once it exits.
How to monitor the workers? Yep, we use ps and grep to check if the worker's PID still exists in the OS.
What about error stack traces? Nice question, we redirect the stdout and stderr when exec()-ing into a file.
What about timeout? We don't need it, let's just assume no one is going to write while(true).
It works flawlessly! /s8 -
You mother fucking piece of shit.
Whoever taught you programming should be removed from history.
And whatever form of intelligence you claim to possess, let me assure you: breathing is the limit of it.
--
Some of the projects I'm working on are really the epitome of "YOLO let's turn the poopomat machine on in diarrhea mode".
The worst: I cannot really give examples.
I've seen the last days everything.
(bash scripting, docker, services like nginx /haproxy/...)
Eval as an template generator in bash...
Declaring an whole environment in an Dockerfile, that should never be used as it is only necessary for building... But not checking if an env file is provided, so the whole thing can blow up spectacularly.
A nearly 1k long bash calculator for system limits, reading out all kinds of stuff from /proc and /sys, seemingly partially stolen from NGINX Docker.
Declaring and starting an own DNS Server to bypass the Docker DNS service inside an docker container.
Mkfifo fun for creating several stdout and stderrs for seemingly no reason...
Actively not using bash, instead of creating shell only functions to emulate bash...
I could go on.
But really. I'm getting too old for this shit.3 -
Random thought: directing stdout to /dev/null is the programming equivalent of screaming into the void.4
-
just quit my job, and the last push i do is changing all the literal string contained in variable and/or stdout to base64 encoded string. and change it to call my secretely placed decoder function.
Everything is working normally guys! *walks away into darkness*10 -
[No spoilers, Mr. Robot, I hope] I saw this screen, and I'm truly curious about one thing:
What does line 21 and 22 do (double print statement)?
Is it an error or is it actually doing something that I don't understand?
I saw he is redirecting stdout to the file, but why the "print out" and "print(out)", does it make anything different that I'm not aware of??19 -
ZNC shenanigans yesterday...
So, yesterday in the midst a massive heat wave I went ahead, booze in hand, to install myself an IRC bouncer called ZNC. All goes well, it gets its own little container, VPN connection, own user, yada yada yada.. a nice configuration system-wise.
But then comes ZNC. Installed it a few times actually, and failed a fair few times too. Apparently Chrome and Firefox block port 6697 for ZNC's web interface outright. Firefox allows you to override it manually, Chrome flat out refuses to do anything with it. Thank you for this amazing level of protection Google. I didn't notice a thing. Thank you so much for treating me like a goddamn user. You know Google, it felt a lot like those plastic nightmares in electronics, ultrasonic welding, gluing shit in (oh that reminds me of the Nexus 6P, but let's not go there).. Google, you are amazing. Best billion dollar company I've ever seen. Anyway.
So I installed ZNC, moved the client to bouncer connection to port 8080 eventually, and it somewhat worked. Though apparently ZNC in its infinite wisdom does both web interface and IRC itself on the same port. How they do it, no idea. But somehow they do.
And now comes the good part.. configuration of this complete and utter piece of shit, ZNC. So I added my Freenode username, password, yada yada yada.. turns out that ZNC in its infinite wisdom puts the password on the stdout. Reminded me a lot about my ISP sending me my password via postal mail. You know, it's one thing that your application knows the plaintext password, but it's something else entirely to openly share that you do. If anything it tells them that something is seriously wrong but fuck! You don't put passwords on the goddamn stdout!
But it doesn't end there. The default configuration it did for Freenode was a server password. Now, you can usually use 3 ways to authenticate, each with their advantages and disadvantages. These are server password, SASL and NickServ. SASL is widely regarded to be the best option and if it's supported by the IRC server, that's what everyone should use. Server password and NickServ are pretty much fallback.
So, plaintext password, default server password instead of SASL, what else.. oh, yeah. ZNC would be a server, right. Something that runs pretty much forever, 24/7. So you'd probably expect there to be a systemd unit for it... Except, nope, there isn't. The ZNC project recommends that you launch it from the crontab. Let that sink in for a moment.. the fucking crontab. For initializing services. My whole life as a sysadmin was a lie. Cron is now an init system.
Fortunately that's about all I recall to be wrong with this thing. But there's a few things that I really want to tell any greenhorn developers out there... Always look at best practices. Never take shortcuts. The right way is going to be the best way 99% of the time. That way you don't have to go back and fix it. Do your app modularly so that a fix can be done quickly and easily. Store passwords securely and if you can't, let the user know and offer alternatives. Don't put it on the stdout. Always assume that your users will go with default options when in doubt. I love tweaking but defaults should always be sane ones.
One more thing that's mostly a jab. The ZNC software is hosted on a .in domain, which would.. quite honestly.. explain a lot. Is India becoming the next Chinese manufacturers for software? Except that in India the internet access is not restricted despite their civilization perhaps not being fully ready for it yet. India, develop and develop properly. It will take a while but you'll get there. But please don't put atrocities like this into the world. Lastly, I know it's hard and I've been there with my own distribution project too. Accept feedback. It's rough, but it is valuable. Listen to the people that criticize your project.9 -
This rant is about myself and anyone whos like me: using logs over a debugger
So, sometimes when I wanna quick check something or make sure, if and when something get's executed or I've ran into a Problem, I add a few log/print statements to check in console.
But I don't think about proper and helpful messages, since they aren't supposed to stay in code. So I often type what comes in my mind, like memes or song lyrics.
The last time this became a huge act, was Code review/ Prototype demonstration with Clients (which I didn't knew about, otherwise I would have removed them, I swear) and Boss and my Code printed "show bob and va...", "send nudes" and stuff... in loop... to stdout2 -
I built my first web server literally from scratch (standard socket lib) today! In Python <3.
It is able to execute php and get the stdout to use it in the Python script afterwards and make use of parallel connections.
Now to the real rant...
I am using HTTP/1.1. I want to use h2 (aka HTTP/2) tho. I am stuck on this. Found the papers to the specs of the h2 and spdy protocols, but they are not really helpful.
Is anyone good in this field? Please let me know :/3 -
everytime i see posts of code humor of doing ordinary things (for example while hungry eat) i wished i was dead.
they are too lazy and beginner. and they exist because the internet gives everyone some chance of exposure.
while this may seem like a positive and democratic thing, it results in too much low quality and everyone's standards getting lowered.
i don't mind people telling bad jokes to friends and family, because at least then even though sometimes people laugh, a frown will surely happen.
while in the internet, you don't get that reaction. In fact, the shittier the thing you post, the more points you get!
this is my version expressing how i feel about the matter:
while !is_dead()
eat_excrement_from(corpse)
bile_and_shit = vomit()
eat(bile_and_shit)
while it is true that most things online are garbage, that also means that some isn't.
for example, code-poetry.com has very clever code poems that actually does run and has some interesting STDOUT. and those do are worthwhile.
let me also do a preemptive comment to the first fucking idiot that posts a "you must be fun at parties". fuck parties and fuck you too.1 -
Does somebody know how to send data to the PHP CGI executable directly and how to receive it (stdin/stdout)?
Or point me to a useful resource?
In a side project (just for fun) I try to implement the interface on NodeJS so I could process PHP through ExpressJS (long story).
I've been able to send and receive stuff, but the PHP CGI always tells me that I am "not allowed" to use this interface...
Docs/mailinglists seem reeeally old and don't want to go through the Apache source code 😅
Or does Node not have enough privileges for communicatig with PHP CGI exe?8 -
I am making a GUI wrapper in C# for a CLI tool written in Python. Obvioisly, the python exe is launched with the Process class and the output streams are redirected so I can process the console output. The problem is that some of that output is only printed if sys.stdout.isatty() returns True. Is there a hack that would allow me to launch the process in a way that python thinks that there is a console/tty attached?
I really don't want to touch the python source files, because that would be a messy solution. I also don't want the process to spawn an actual console window.1 -
Every once in a while, I find myself having to redirect both stdout and stderr to a file (or to stdout) in bash. Every time I have to Google it.2
-
Okay I got a genius/exceptionally stupid idea.
Some of you may know Xi. If not, it's an, in development, text editor backend, written in Rust.
It does all the heavy lifting and communicates changes with the Frontend over an rpc-api, typically on stdin/stdout.
Now, why don't we do this, but for other kinds of applications, that have been reinvented a million times, because a feature is missing or the ui has been shit.
Cross-Platform backends for file-managers, web browsers, password managers, media players,...2 -
I don't understand how I/O streams work. I mean as a userspace developer i saw the stdin/stdout streams as magical objects that i could read or output infinetely in a continuous way, without caring how much data i write or read (ok, not entirely true because overflows)... But now i'm making an os kernel and i really don't know how i'll implement them..... :(1
-
Does anyone by any chance know how to pipe binary data out of Python? I digged through the first 10 pages of Google, but none of that did what I needed. I know how to pipe things between subprocesses, but not to the stdout of Python.7
-
section .data
msg: db "ASM, Love Or Hate?",10
msglen: equ $-msg
GLOBAL _start
_start:
mov rdx, [msg]
mov rdi, msglen
call print_stdout
mov rax, 0x3c
mov rdi, 0
syscall
print_stdout:
mov rax, SYS_WRITE
mov rdi, STDOUT
syscall
ret5 -
So I have somehow created schrödinger's cat in my program. If you observe what is happening, it works. But if you stop observing it, it starts corrupting.
If I put any print statement in it, it works. But if I have no print statements at all, it produces corrupted data. Doesn't matter what or when I'm printing.
I'm guessing its there's some fuckery going on with stdin/stdout and buffers. Even though the data coming to and from stdin/stdout should not affect the output.10 -
Dumb question time!
I'm writing a bash script that outputs some progress info to stdout (stuff like "Doing this... ok", "Doing that... ok") before outputing a list of names (to stdout too).
I'd like to be able to pipe this list of names to a second script for processing, by doing a simple :
~$ script1 | script2
Unfortunately, as you may have guessed, the progress info is piped as well, and is not displayed on the screen.
Is it considered a bad practice to redirect that progress info to stderr so it is not sent into the pipe ?
Is there any "design pattern" for this kind of usecase, where you want to be able to choose what to display and what to pipe to a program that accepts input from stdin ?16 -
```
section .text
global _start ;must be declared for linker (ld)
_start: ;tells linker entry point
mov edx,len ;message length
mov ecx,msg ;message to write
mov ebx,1 ;file descriptor (stdout)
mov eax,4 ;system call number (sys_write)
int 0x80 ;call kernel
mov eax,1 ;system call number (sys_exit)
int 0x80 ;call kernel
section .data
msg db 'Hello, world!', 0xa ;string to be printed
len equ $ - msg ;length of the string
```
I've never seen such a terrible way to print "hello world"8 -
I'm asking for your help, once again, because I couldn't find any similar problem online.
I've written this neat thingy here, in Go
https://github.com/thosebeans/wento
And i try to integrate the wren-interpreter with it (is written in C).
All compiles and works, but I can't print to Stdout from the C-Code.
Any of you know what could cause this?1 -
Shit is getting more and more weird.
Context updating hooks inside useEffect is just icing on the cake especially the comment about how putting that hook in useEffect dependecies would cause infinite loop. No 💩, Sherlock!!!
No dumb components in this project except maybe buttons.
Every fucking component has tons of business logic and you can't simply tear it apart as data structures are all over the place. Prop drilling with every drill-step recieveng data of a different type.
We are using Context. For just one value. One. That's it.
Fuck this shit! This shit beats every anti-pattern approach I saw in my whole life, and this is my 40-ish project!
Over engineering by stdOut playing in the backround while I curse at this POS code.
The product is cool though. And it works™ -
For my bachelor thesis I'm working with Snort (an Intrusion Detection System). Running it on some test pcaps I get X alerts. When I switch the alert output from stdout to a file I get a different number of alerts. When I re-run it, I get yet another number of alerts (on stdout the number is always X)
Wtf?!3 -
It seems they mistaken me for italian giving me spaghetti all over the product. Go to frontend to check the app, react with weird jQuery, no routes, pages summoned by the templates that have concatenated values and html in vanilla js, changing screens/pages with jQuery, no router... ok lets see the other app, react, redux, offline capabilities and tought myself niicee hut nothing work as intended with clusterfuck of hacky workarounds that makes app look like it is working but with hardcoded data. Offline means automatic sync when you get the network back, right? Oh backend never developed any sync, so you guys can do it, we have to fix and patch some important stuff! I don't like php but whatever, let's see what is going on there... So much spaghetti bolognese there that Bologna actually called to ask if they can buy some, they are out of stock because of us!
This is just like that song mess.css from stdout, but in any file you open!
Living on deserted island eating grass and coconut for the rest of the life doesn't seem so bad atm!4 -
I hate Pull request system!
Plot twist: I just put it in place in my organization because I see the benefit.
Just spent 4 hours (Note : delay was because git refuses to write to stdout and writes everything in sdterr. And couple other things) developing a helper “powershell” script for “small tasks”. It sits directly in the project and as of 30 mins ago available to all devs.
Let’s say you need to change a typo.
Normal process:
• Create a branch
• Fix problem
• Commit/push
• Create pull request (This one was NOT easy. I’ll explain why if someone is interested)
• Switch back to master to fix second bug
Script does exactly that now. ./CreatePullRequest.ps1 <tmpbranchname> <Comment>. (The target for pull request will be the original branch, not limited to master)
Now I’m trying to find what I missed. Because I missed something, 100% guarantied.14 -
## Learning k8s
Okay, seriously, wtf.. Docker container boots up just fine, but k8s startup from the same image -- fails. After deeper investigation (wasted a few hours and a LOT of patience on this) I've found that k8s is right.. I should not be working.
Apparently when you run an app in ide (IDEA) it creates the ./out/ directory where it stores all the compiled classes and resources. The thing is that if you change your resources in ./src/main/resources -- these changes do NOT reflect in ./out/. You can restart, clean your project -- doesn't matter. Only after you nuke the ./out and restart your app from IDE it will pick up your new resources.
WTF!!!
and THAT's why I was always under an impression that my app's module works well. But it doesn't, not by a tiny rat's ass!
Now the head-scratcher is WHY on Earth does Docker shows me what I want to see rather than acting responsibly and shoving that freaking error to my stdout...
Truth be told I was hoping it's k8s that's misbehaving. Oh well..
Time to get rid od legacy modes' support and jump on proper implementation! So much time wasted.. for nothing :(9 -
Why cant every server-application have a feature like openssh AuthorizedKeysCommand?!
So pretty much a command-hook for authentication.
You pass username, password and additional stuff to it, and its STDOUT and exit-status determine the authentication result.
No, instead of something so simple,
You're forced to use MySQL,LDAP...4 -
I did some of the front-end and whole backend. build and manage the SQL + elasticsearch database. After all of this, only 17 lines of mother fu**er code ruined my life. The client is asking for code. And.... And... Can't say anymore.
input {
file {
path => "/home/rsa-key-20200528 /aslogger.log"
type => "java"
start_position => "beginning"
}
}
output {
stdout {
codec => rubydebug
}
elasticsearch {
hosts => ["localhost:9200"]
index => "aslogger"
}
}