BI-YEARLY PROGRAMMING THREAD Working on code? Post it here! Not working on code? Open your sh-compatible shell and type `echo $(( ( RANDOM % 145 ) + 1 ))` to choose a challenge. If you have any more of these programming challenges images, please do share.
What the fuck is POSIX even useful for if it doesn't have the most basic shit
Henry Roberts
Made a bash script that takes a list of handles, gets all of their tweets, sorts it by date, and converts it all to a neat XML that doesn't make newsbeuter shit its pants. Was pretty difficult debugging because I didn't know about "set -x" until I was already done (and that I've never used bash). Took me about three days of non-stop (NEET) programming (figuring out REGEX and the clusterfuck of sed/awk/grep/egrep/gawk/gsub) to finally get something I'm proud of. Got a spiffy mandoc and some options. About 350-400 lines if you remove the mandoc and newlines. Was a pretty good experience.
/blog
Anthony Hernandez
seed=$(date +%H%M%S)i=1modulus=$((2
Cameron Johnson
Any accidental entropy-destroying flaws that cripple the random number generator and make it unsuitable for real world use were inserted in the spirit of unix by the way
Liam Kelly
Why use something so bloated? Try this one-liner that I discussed in my blog[0]:
This answer answered my original question pretty well. BUT, command prompt tells me head or cksum or whatever cut is don't exist???
Evan Lee
Why is this in the unix forum?
Lincoln Jackson
Install Gentoo.
Chase Mitchell
@863836 Moved to pozzers.united.anonymous.stackexchange.com/peepee-hurt%21 Thank you and remember not to necro bump or make duplicates ______________ Lebronious the Master Programmer For the new guys who know, sometimes you just need a hand. Blog | Skype | Myspace | Discord | AOL IF YOU CAN'T HANDLE THE HEAT, STAY OUT OF THE CODE SESSION!!!
Oliver Morgan
:below_the_waist_ok_hand:
The game
Logan Jones
Reply to this post or your mom gets dicked Thread derailed
Robert Jenkins
/dev/urandom is not POSIX. head -10 (as opposed to head -n 10) is not POSIX. cut -f1 (as opposed to cut -f 1) is not POSIX. And you're taking the first ten lines of random noise, which means you wait until there've been ten newlines, which is arbitrary and pointless and hard to reason about. Consider me triggered.
Am doing bullet hell engine (120) in sfml, will post code when finished
Noah Moore
Interesting one. I have given it a bit of thought but I'm not motivated for any kind of game programming. I have done the ones about music synthesis and MIDI, they are my cup of tea. Now I implement some audio effects out of the dafx book.
Brody Bell
lmao. stop using trash. use fish. it is the best shell btw, Zig Forums can't program. also all those challenges are shit
Jacob Turner
I'm making a web server to expand my language knowledge with shit that I don't use at work every day but I'm still fucking around with server tutorials in both Go and Python and haven't decided which one I should use for the full blown actual thing. They both have a lot of disgusting aspects, but Go has the slight edge for not being some retarded whitespace language. Python would be more professionally useful for me to know but it just feels so degenerate to not have brackets. Also the 2.7/3.3 split is a little asinine.
Python 2 is being phased out left and right, from Operating Systems to I forget.
Official End of Life of Python 2 is 2020.
Just start coding in Python, by which is now almost universally meant Python 3, and don't worry about the rest.
Forcing people to indent so that their code doesn't look like PHP coders' spaghetti is not retarded.
Austin Moore
And yet 2.7 is still critical to just about every Linux distro out there.
James Lopez
Python 3.3 is grossly outdated. I don't think it's supported any more. The current release is 3.6. Python 3 is a better language than Python 2 in a lot of ways, some of them backward incompatible. The split is asinine, but having to deal with Python 2's bad decisions even more so. Go has vague plans to do a similar incompatible new version at some point. Brackets don't matter. I think whitespace is a bit better but it's one of the least important aspects of the language. The reason people argue about brackets is that you don't have to know anything about the language to do so. It's bikeshed bait. Python is a bit more useful than Go in general. It's very versatile. Comparing them isn't very sensible, though, they occupy different niches.
If I uninstalled it right now it would only remove libraries and a few applications, no system parts. I'm running Debian. It's still used because upgrading takes effort. It's a bad idea for nearly all new code.
Noah Lee
I feel like the only people who actually believe this are the ones who use whitespace languages.
Jacob Nguyen
I write code in whitespace languages, bracket languages and ALGOL-style languages, among others, and I haven't found a reason to strongly care. All text editors I use are intelligent enough to make it nearly irrelevant.
Juan Davis
...
Wyatt Johnson
POSIX is UNIX weenies with political power. They get to force their "standard" onto vendors and users.
Heard in a talk by a vendor at a conference I was atrecently... ``The unix market has generally been more forgiving on quality aspects.''Gee, I always thought of the distinctive Unix level ofquality as unambiguously negative. But seen from the otherside, it has its advantage. First beat your customers intoa daze where they don't know good from bad, then lean backand enjoy the cash flow from putting out products that meetestablished expectations... Why didn't I think of that?
it *was* nice of British Telecom to force Sun to rename their white pages service to be something other than "yp") ...A crying shame too. After all, even though Sun's "yellowpages" service was really a white pages (name lookup)service, they should have been able to use whateverdeceptive name they wanted. Renaming things for marketposition is really a modern (not just unix) tradition:Build a presentation manager: call it Presentation Manager...Build a personal computer: call it The ibm Personal Computer...Build a machine with an 8-bit byte: Define "byte" to be 8 bits...Build a IO subroutine package: call it DOS (an OS).But the unix weenies have refined it to a high art.Everything must be "open" and a "standard." Why, my companyalready supports at least a dozen "standards!"The latest Sun entry is their new "free" window system.Their salesman called me proudly: all you need to do is sendthem a thousand dollars a copy, plus pay a royalty onprograms which use it, and you can use their new free openstandard window system (called "open look" of course).Hm, maybe I can add cons to C and call the result Lisp...
Jayden Baker
All the cool kids use printf(1). The echo(1) specification is full of implementation-defined behavior.
Ethan Richardson
I was writing a ZilogZ80 cpu emulator, need to get back to work on it though.
Ian Clark
post it on /byte/ when you're done I will populate the board with more posts later >>>/byte/
Blake Collins
It'll probably be shit because I've never wrote an emulator before, but sure I'll post it.
Ayden Diaz
Not taking the piss, how is this different from prog?
Sebastian Ortiz
Isn't /prog/ absolutely dead?
Logan Adams
Not much different from your board, eh? It gets close to 20 posts monthly.
Michael James
When I have time I plan to flood my board with a deluge of manufactured posts and perhaps a low-frequency bot
Aaron Kelly
Aight, I'll lurk and contribute where I can.
Logan Gomez
Take some advice from this thread: >>854752 If you want to get people to use your board you're going to need to build and foster the community. That is, hold community events and do small things to encourage participation like a tan-design or banner submissions or something. You could also do something like Zig Forums does and sticky important threads for awhile to get participation on big issues and such. Also consider ID's to curb the lowest-tier shitposters. Good luck with the board user.
Hudson Johnson
First semester of C++, my classes are pretty horrible and mostly consist of me working through sicp while listening to business majors talk about twitch and complain about how hard C++ is. I think I'm going to rewrite a podcatcher I wrote awhile back to handle youtube RSS feeds and use the curl library if I can figure it out. This is my first reasonable C++ program.
/* Adds a list of fractions and outputs the simplified fraction. */#include #include using namespace std;int main() {/* * Define variables for the number for the iterator, the input, the numerator, * the denominator, and the denominator and numerator from the last iteration. */ int i = 1; int input; double old_den = 1; double old_num; double numerator; double denominator = 1; cout
David Foster
Not a one line comment, not a two line comment, not even a three line comment, but a FIVE LINE comment. On a scale of "uses orthogonal in casual conversation" to "requires all assignments be turned in, in manually optimized binaries," how pedantic is your professor?
Andrew James
The best thing to do with C++ is use C-style syntax and C libraries.
Isaac Anderson
He's not bad tbh. I think it's mostly because it's the beginning of the course and he wants to make sure we understand what we're doing, although I'm not sure how we wouldn't considering he mostly just gives us a problem and tells us to figure it out.
My thoughts exactly, this really bugs my prof though :P I need to switch to cstdio, or I guess stdio.h to complete it then it should run in a c compiler I think.
Jayden Edwards
you're a fucking retard
Dylan Butler
C only handles full and floating point numbers fucking retard
William Ross
The entire point of programming is to make computers do things they didn't do before. It's absolutely possible to handle fractions in C. And that program isn't even written in C. Honestly, I'm not sure what you're trying to say.
Leo Rogers
This is nothing in the entire world to do with int or float. It has to do with your interface not being smart enough to accept a string "5/10" and parse out the 5 and the 10 instead of having the user type each one individually.
And then you have the user fucking type "done" to finish what the hell.
Brayden Cook
Aren't Game Boy emulators exactly that?
Nicholas Lewis
it adds fractions and simpilifies, I'd like to be able to enter fractions, but I don't know how to do that yet. read first semester c++
Brayden Harris
Pretty close. The Gameboy has a Z80/intel8080 hybrid sort of CPU.
Ryder Evans
After you add your fractions, you should use a normalization routine to put them in a canonical form. Hint: Use the GCD algorithm, both the recursive and imperative versions are dead simple to write, and it'll save you from that abomination at the bottom of your code.
Jordan Ramirez
I'm confused what you mean, isn't that what I did?
Hunter Morris
I wrote a hexdumper in Retro Forth, going to work it further later. I posted it at >>>/byte/8, you should check it out if you like concatenative languages, they're quite like functional languages but (I would reckon) more readable and more practical. look at Joy as an example.
Daniel Jones
result of guy spotting a horse in the distance and saying, huh, that's a good idea. Then that guy goes off, with no further experience or knowledge of horses than this one glimpse, to invent the Ride-able Gimp(TM) if you want a somewhat practical Forth-like language, at least go with Oforth: oforth.com/ The real thing is also available, and not that bad. My interest only waned when I found ATS - comparatively terrifyingly complex, but complexity wasn't my concern. My concern was always that the shittiness that most programmers deal with is actually non-beneficial. Languages like Python or Java only even exist because programming hasn't developed as a discipline enough to have good tools. Even when someone develops a straight metal hand-axe there are these apes who are completely sure that their bunches of twigs remain competitive. a language whose total worth is summarized as: "I got people to pretend that 'concatenative' is some kind of special, meaningful category of programming language."
Michael Brown
Retro is quite cool, it has the colours of colorForth implemented as prefixes and even conditionals are postfix. All implemented on a tiny MISC vm. Look at the docs, it's great.
WHy would I use Oforth over regular Forth (gforth or pforth or SwiftForth)
Kevin Fisher
Your post reeks of tryhard.
Camden Johnson
of course a real program would accept a single argument which is the URL of the JSON object that it should decode to get its input.
Justin Cox
nah that stench is "pent up with incomplete rants". Really the short story is just that I really hate Haskell.
Oforth has literal arrays and hash tables, and it offers explicit parameter passing in a language that is still otherwise very Forth-like. The arrays and hash tables you could graft on to Forth proper, but the parameterization you realy need another language for. This sounds like a small thing but Forth code tends to look like A B C D E F G where some of those words consume inputs and some of them emit outputs and you have to sit and study the code to reconstruct simple data flow. It's not for nothing that any Forth programmer you talk to will agree that some other Forth programmer's code is shit: any style variance interferes with how Forth programmers learn to intuit their own data flow. There's a lot of cool things about Forth but this is simply a burden and with Oforth you can avoid it.
Jaxson Kelly
How is the American Thoracic Society compare to C?
Liam Ross
All I want is a concurrent array-oriented meta semi-functional language with mutability, lazy evaluation, strong static flow sensitive type inference, and some sort of safe compile time memory management.
Why doesn't it exist.
Aaron Scott
Come up with all the reasons to use C.
Anthony Richardson
got it.
Jose Bailey
What happened to the prog fags? Board is dead. Only chan I know of that has a somewhat active board is lain. Is that it?
Easton Bennett
sup guys. NOOB here, I need YOUR help.
I am not new to programming, I programmed back in high school with c# and made little programs. I stopped for 2 years and now I want to get back to it, so I can prepare myself to enter a computer science degree in university. (right now i'm doing biology, and no, I don't want to do bio informatics)
Where should I go to learn? SICP looks pretty fucking old and heavy to me, is it really the only way or is it only a neckbeard meme?
Go is extremely bizarre. I'm really not sure if it's a troll. The error on unused import and variables followed by producing a giant binary has to be a joke. The constant forced error handling is clearly a joke about C programmers never checking return values. Interfaces are some weird OOP jab. Like the difference is instead of doing foo(object, val) you do (object) foo(val). That's like a zero cost abstractions joke.
Matthew Howard
I think the reason it feels so bizarre is because we're not the kinds of people it was created for. It was created for the kind of mouthbreathers that don't actually read the directions or attempt to understand what they're writing and just start copypasting shit into their code from stackoverflow. What the hell is "fmt"? Who cares, it'll automatically get imported when I save the file anyways. Code is spaghetti trash with orphaned crap lying around everywhere? Don't worry, just save it and it'll all be cleaned up!
96 - Generate a complimentary color from any input color - Common Lisp
(defun main (color) "Give the complementary of a hex color following " (rgbtohex (rgbcomplementary (hextorgb color))))(defun hextorgb (hexcolor) "string in, int list out" (format t "~% hexcolor: ~S" hexcolor) (list (parse-integer (subseq hexcolor 1 3) :radix 16) (parse-integer (subseq hexcolor 3 5) :radix 16) (parse-integer (subseq hexcolor 5 7) :radix 16)))(defun rgbtohex (rgbcolor) "int list out, string in" (format t "~% rgbcolor: ~S" rgbcolor) (concatenate 'string "#" (format nil "~2,'0X" (nth 0 rgbcolor)) (format nil "~2,'0X" (nth 1 rgbcolor)) (format nil "~2,'0X" (nth 2 rgbcolor)))) (defun rgbcomplementary (rgbcolor) "int list in, int list out" (format t "~% before complementary: ~S" rgbcolor) (let ((res nil)) (dolist (el rgbcolor (nreverse res)) (push (- 255 el) res))));; second method (floor (sqrt (- (* 255 255) (* el el)))) res))))
Hudson Richardson
Neither of those things happen, it's a programming language, not an editor
Aiden Phillips
I have a weird question, lads. I am thinking of making a package manager frontend (like Synaptic or Gnome Software) as a personal coding project, but I can't find any documentation on how to actually interact with the package managers with another program. I'm searching in the source code to these programs and I can't find the part where they actually query the installed programs, repos, etc. Do they literally just run the commands and then parse the output, or is there some buried API they're using?
That's good for apt, but I don't see an equivalent for DNF for instance. So do some package managers have a low-level API while others don't? For them is it still like this guy >>876411says?
John Ortiz
Trying out ATS2 today. Gotta say I don't get it at all. Getting the compiler working took a while and there are very few examples but whatever. I managed to get as far as trying to apply a function over a list before I got confused by types. The error messages are classic stuff though. 273(line=17, offs=10) -- 273(line=17, offs=10): error(3): unsolved constraint: C3NSTRprop(C3TKmain(); S2Eapp(S2Ecst(S2Eapp(S2Ecst(add_int_int); S2Evar(m(8767)), S2Eintinf(1))), S2EVar(5095->S2Evar(n(8768)))))typechecking has failed: there are some unsolved constraints: please inspect the above reported error message(s) for information.exit(ATS): uncaught exception: _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_error_2esats__FatalErrorExn(1025) As you can see it has a nice autistic minimalism that makes you feel like a haaaacker. So I'll give it a few more days.
My project isn't big enough to warrant its own thread, but I've been working on a BBS like software to be used over tor. Right now it only really support a chatroom, but I have plans to add some other features like mail, and customized user pages. The project is called Zyrod and it's licensed under the AGPLv3. You can find the source at: gitgud.io/zyrod/zyrod You can join my instance at: zyrod3akfrytejihgoofmarjhojorwxd6cvf55qyqr476e5msac7nhqd.onion:54706
Added new menus: [L]icense: View the AGPLv3 License [M]embers: View a list of registered members [W]arranty: View the warranty. I also set it up so that when I push my code to the remote repository the onion server automatically pulls the latest code down and restarts Zyrod.
Dylan Gutierrez
...
Colton Baker
Probably the last thing I'll add tonight to Zyrod. Fortune.
I just tried the "print number in binary" with python. def tobinary(n): binarystring = '' place = total = 1 while (n > total): # Get highest binary place possible for n place = highestplace): binarystring += '1' n -= highestplace else: binarystring += '0' highestplace >>= 1 return binarystringprint(tobinary(37))