Old thread: What are you working on?
/dpt/ - Daily Programming Thread
Other urls found in this thread:
gnu.org
twitter.com
Can someone recommend me a simple lightweight text editor or IDE for Python. I am a complete beginner to programming. The only thing I ask is it be in the Debian repository and it be easy for me to change to a dark theme
cyber vegan
data pagan shodan
The C++ Programming Language 4th Ed.
My vpn provider doesn't have a linux application so I'm writing a script in bash that scrapes all the OVPN addresses from a directory, tests latency and bandwidth and then provides the option to connect to whatever is fastest. Really basic stuff but I'm doing my linux+ and thought it would be good motivation to get to grips with bash scripting
>simple
>lightweight
>text editor
>ide
Vim is all of these things
IDLE
emacs with anaconda.
Jow Forums is dead
first for not being able to complete beginner interview question algorithms.
This shit is hard ; _;
herp durr hurf
what where the questions
If I'm capturing STDIN with fgets, what's the best way to capture arrow-key inputs?
Should I disable canonical mode and just read everything byte-for-byte? That seems like a pain in the ass to deal with, especially for echoing output and waiting for \r before trying to parse the line
gnu.org
Okay, sorry, am I reading this correctly?
Does the FSF think Debian is a nonfree distribution not because it has any nonfree software but because... it has the OPTION to install nonfree software if the user deliberately selects them?
They're apparently pretentious enough to call PureOS (none of these anyone's ever fucking heard of) a "GNU distribution" and drop the Linux all together.
yes
ok i need some help with this prolog function, i just need to understand really why the fuck the N is printing out garbage. the Y is able to take the info from the recursion, but not the N? i don't understand.
tower(N) :- move(N,left,right,middle).
move(1,_,Y,_) :-
write(move(N,Y)),
nl.
move(N,X,Y,Z) :-
N>1,
M is N-1,
move(M,X,Z,Y),
move(1,X,Y,_),
move(M,Z,Y,X).
.
Debian GNU/Linux
>Debian's Social Contract states the goal of making Debian entirely free software, and Debian conscientiously keeps nonfree software out of the official Debian system. However, Debian also provides a repository of nonfree software. According to the project, this software is “not part of the Debian system,” but the repository is hosted on many of the project's main servers, and people can readily find these nonfree packages by browsing Debian's online package database and its wiki.
Crossposting from sqt,
See image in other post, why would ping not like the url? I'm looking to grep the latency out of the ping results, it's for this . If I echo the adrLst contents they print fine, no indentations or prefixes, if I clear out the adrLst file and just place one url in there it returns the same error. I can copy and paste the url and ping it manually
cat * |grep ".com" > adrLst
sed -e "s/remote //g" -i adrLst
sed -e "s/80//g" -i adrLst
cat adrLst | while read output
do
ping -c 1 "$output" > pingRes
done
Stuff related to recursion. I answered the regular version quickly (like, 2 or 3 minutes), but couldn't do it using recursion in an "elegant" way. Here's the simple implementation:
/*5. Write a function 'recursiveMultiplier' that takes two arguments, 'arr and num', and multiplies each arr value into by num and returns an array of the values.*/
function ex05(arr, multiplier) {
var newArray = [];
for(var i = 0; i < arr.length; i += 1){
newArray[i] = arr[i] * multiplier;
}
return newArray;
}
console.log("ex05 = " + ex05([1, 3, 7, 4], 3)); //[2, 4, 6, 8]
The instructor gave a recursive alternative but it looked confusing and awful, and it "destroyed" the original array by popping the values during the recursion. Generally speaking I was having a hard time accessing the individual variables inside the array recursively.
I fucking hate GNUfags I support software freedom too but they're so fucking pretentious about it.
why would you ever do this recursively? is this just them making things hard on purpose? surely a simple for loop will be just as efficient as doing it recursively.
does anyone else spend a day working on a project, getting kinda far, and then never touching it ever again after that day?
mfw when C is usable now
If he wanted recursion and didn't tell you you could mutate the array, this isn't a fair question given two parameters. Otherwise there's no additional data available to keep track of the loop state
I think it's sad he blocked tivoization in the name of giving consumers control over what software they run, but dropped Debian for even allowing consumers to choose nonfree software after jumping through however many hoops
Not the interviewee but yes this is just retardation. JS doesn't even have tail recursion (it's in the standard now yes, but not implemented/enabled pretty much anywhere)
i hate this shit, i can understand it in school but at a job interview it makes no sense. They wouldn't want you to implement some crazy complex code, you would probably get yelled at for that, they really just want the simplest and most efficient way to do something. I get that its meant to test you and see if you are "creative" and "inventive" but give me questions where i don't have to fucking reinvent the wheel.
I agree with the sentiment, but to be fair many people work around the stupidity through clarifications. As in, you spend the first 5 minutes clarifying what exactly they want you to do, and once you know they really want you to implement tail recursion in JS it becomes an academic exercise again.
Give this script "remote google.com 80" and it will turn it into "google.com " (key thing being that space at the end.
It performs an nslookup on a domain with a literal space at the end, not being able to find it.
Your bug is on the third line of that script
is this i3
shameless self bump
but if I just put two urls in adrLst and run the while loop it gives the same unknown host error. bypassing all the sed made no difference
Could you paste that text file containing the two urls into a code tag here
vlus-af1-ovpn-tcp.pointtoserver.com
vlau-us1-ovpn-tcp.pointtoserver.com
I think you're right about the space but I'm not sure how to fix it using sed, thanks anyway though
Those lines each have the space I'm talking about at the end
ping "google.com " will fail with that "crazy" looking error. Thanks to the quotes, it won't throw out the whitespace and will include it in the argument passed to ping.
You use quotes when you do ping -c 1 "$output"
Oh, I misinterpreted, you already saw the space.
I'm kind of spoonfeeding here but to fix it with sed do sed -e "s/ 80//g" -i adrLst
>Doing OpenGL
>Change GLES20.clearcolor to
GLES20.glClearColor(0.1f, 0.1f, 1.0f, 1.0f);
>Screen turns blue
>Objects no longer load
>The game runs and plays, I just can't see it because constant blue
I want to die. How can I not figure out how to turn back time?
still getting the same problem, I'm thinking it's the while loop because if I ignore everything and just read output in a while loop it still fucks up.
I'm going to go to sleep, I know some python, I could have done it in that in a few minutes I bet. Just wanted to get some experience with bash scripting
Rewriting my personal website in c and common lisp.
Been fun so far. Using no libraries as well (lol). Learning tons abt the low level details. Normally a java/c#/javascript/go/php dev.
>c and common lisp
What parts do you use each for specifically?
Yeah bash scripting turns into string processing voodoo sometimes. There's probably something else I'm not spotting. If your script gets complex enough you might as well use python anyway
emacs
ez. this is Ruby. Same concept should apply in other languages.
def recursiveMultiplier(arr, multiplier)
if arr == []
[]
else
[arr[0] * multiplier] + recursiveMultiplier(arr.slice(1, arr.length - 1), multiplier)
end
end
Yep, and the ironic part is stallman is not strict enough when it comes to firmware. he literally says its a-ok for firmware to be closed-source as long as its on a ROM om the hardware itself, but having it stored on the HD then loaded into the hardwares RAM suddently makes it immoral.
look, im a freetard, but people bitching about things like debian and coreboot not being free are just plain wrong. focus your efforts on attacking closed-source hardware and firmware, not attacking fellow free software supporters
just want to point out, that's a naive solution. There are many things wrong with it. But I wrote it to demonstrate the concept. E.g. if your language does TCO, it should be "iter-ized".
As a last resort though, you might be able to fix that using either ping -c 1 $output > pingRes or ping -c 1 $(echo "$output" | xargs) > pingRes. But not sure on that
The bare minimum for c. Trying to do most of everything in lisp.
I'm paraphrasing the code but this is p much all the c:
void start_server(port, maxbuf, ptr-callback) {
/* a bunch of setup shit, get any mallocs out of the way */
while(1) {
/* read reqs into buf, pass to ptr-callback (lisp) */
/* read buf return from callback to client */
}
}
>Screen turns blue
that part makes sense
>Objects no longer load
>The game runs and plays, I just can't see it
- is depth testing enabled?
- are you setting the clear depth? what to?
- are you clearing the back buffer with the depth buffer bit set?
- where in your game/window loop are you clearing the back buffer?
whats a good C/C++ github project I can make some pull requests to on my spare time
stuff like ffmpeg or rpcs3 and shit are total monsters to try and contribute to
>writing kernel modules in C, coming from a heavily C++ background
shit's actually kind of comfy
getting my mind around writing PCI drivers for an "old" pcie ethernet card I have the data sheet for.
Wrapping my head around BARs and memory mapped IO Is fun as fuck.
Just be blog postin
thanks for reading bitch
//Set program and specific flags
GLES20.glUseProgram(_program);
GLES20.glDisable(GLES20.GL_BLEND);
GLES20.glEnable(GLES20.GL_DEPTH_TEST);
GLES20.glEnable(GLES20.GL_CULL_FACE);
GLES20.glClear(GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);
ClearColor on surfaceCreated, the code I just sent you in my OnDrawFrame.
That makes sense. Personally I wouldn't even count the C part, since you're basically just using it to bootstrap Lisp.
I'm not too familiar with easy-to-contrib C++ repos, but just off the top of my head maybe take a look at libpqxx's issues, there's been some interesting activity on a couple of those lately. It's not too hard to dive into because it's basically a libpq wrapper that adds fancy C++ stuff.
reminder that if you can write correct, readable, efficient, maintainable code you are so far ahead of practically everyone else it's not even funny. you're better than normies, pajeets, delusional C neckbeards, haskell fags etc etc
>What are you working on?
Connected my leds to python to display images through serial
ITS MOVING
ITS FUCKING MOVING WHAT THE FUCK
was adding that clear command legit the only thing you changed when this problem arose?
try adding these (they're supposed to be the defaults but it won't hurt to be explicit):
GLES20.glDepthFunc(GLES20.GL_LESS);
GLES20.glClearDepth(1.0f);
i'm assuming the GLES20 thing is a convention of the implementation you're using.
not sure if it matters but should there be a "GLES20." in front of GL_COLOR_BUFFER_BIT?
and your winding order / face culling is right, yeah? you can control it with these if you wanna be sure:
glFrontFace(GL_CW); // treat faces wound clockwise as front faces
glFrontFace(GL_CCW); // treat faces wound counter-clockwise as front faces (default)
glCullFace(GL_BACK); // cull back faces (default)
glCullFace(GL_FRONT); // cull front faces
glCullFace(GL_FRONT_AND_BACK); // cull all faces (still draws points/lines)
i left out the GLES20 parts this time but you get it
where do you even get an lcd array like that
They have WS2812B LEDs on a lot of stores. I made this on with those.
what are some good websites and ircs to meet some programmers that arent shitty webdevs
Vim or emacs
>leftpad
Be carefull, it might disappear
can you like, anti-alias that shit
Working on my libc. Just completed auxiliary values handling.
Just started on lisp and have no idea how to solve an error
(defun absolute (x)
(cond ((< x 0) (- x))
((= x 0) (0))
((> x 0) (x))
))
seems to not work.
what's the error
Here's the error sorry
; in: DEFUN ABSOLUTE
; (0)
;
; caught ERROR:
; illegal function call
;
; caught STYLE-WARNING:
; undefined function: X
;
; compilation unit finished
; Undefined function:
; X
; caught 1 ERROR condition
; caught 1 STYLE-WARNING condition
WARNING: redefining COMMON-LISP-USER::ABSOLUTE in DEFUN
Okay I'm retarded there's no need for parenthesis when I'm just returning 0 or x.
The parentheses indicate the application of the first element in the list (a function) with the rest as arguments.
You're trying to call x as a function. Actually it's more complicated because Common Lisp is a Lisp-2, but that's the gist of it.
Ahh that explains why it keeps telling me I have an undefined function X. Thanks!
>Actually it's more complicated because Common Lisp is a Lisp-2
?
>?
Translation: common lisp already went through so many modification from its original version in 1960
Give more details. What about calling a function is "more complicated" ?
The "x" that's being referred to is not the same "x" as the function's parameter because Common Lisp puts them in distinct namespaces.
Oh, that's what you meant. Well yes, CL does have that... characteristic. Gotta denote function symbols with # and everything.
Hobbyist here.
I'm trying to do few examples from a book without looking at the solution.
What is my mistake here?
#include //calculate pay
double hours_total,hours_overtime,rate_regular,rate_overtime,pay,gross;
main()
{
printf("Enter hours worked:");
scanf("%ls",&hours_total);
rate_regular=8.5;
rate_overtime=rate_regular*1.5;
if(hours_total
I don't even know where to begin.
>running an interpreter in C and making it backed by a fucking vm
kys yourself, abomination
lack of indentation
main method isn't void
lift out overtime calculation of the conditional parentheses
lift out gross pay out of conditional parentheses
lift out printing out of conditional parentheses
why are you declaring your variables outside their scope
then dont
makes sense
I'm comfortable with GNU/Linux, but not programming. I'm thinking of easing myself in by learning bash scripting, since I'm already comfortable with the command line, but haven't done much scripting. I can chain together commands with ; or &&, I understand pipes, but I've never done anything with if/then and such in bash. Anyone have a good book or tutorial for me to follow? I've done the codecademy command line course and it is frankly way too basic.
I've got "Bash, A Pocket Reference" and "Bash Cookbook" downloaded already. Haven't started them yet.
>main
>void
kill yourself my man
>GNU/Linux
>too dumb for shell scripting
kill yourself my man
>too dumb for x
>hasn't done x before
really makes you think
I've tried learning a few languages like Scheme and Python before, but I didn't think it was worth mentioning. I am basically never getting anywhere and starting over all the time. Trying to start smaller this time, and use something that I already have partial knowledge of.
>main method isn't void
Jesus, that's even worse. At least leaving it off was once standard.
main always returns int.
>scanf("%ls",&hours_total);
%ls is not the correct format for a double. %lf is probably what you're looking for.
>chains commands with &&
>doesn't understand if
>literally the same thing my man
Do you understand the fact that programs return a status code when they exit()? And that 0 status is considered successful/true while anything else is failure/false?
Yeah, I get all that. I just don't want to get ahead of myself. I'd rather go through a bit of review at the start of a book than assume I know something and jump into stuff that's too complex.
>%ls is not the correct format for a double.
I know,I made a typo
For example, I am fine doing something like
ls -hal | grep -i > blah.txt
but I want to be able to solve more complex issues, like making a script that uses the find command and has a variable for the directory to search, a couple keywords, and what file to output the stuff to, and then have the script prompt me for all this info in a row
Well, that's probably your problem then.
Otherwise if you didn't post the code that's actually causing the error, then there is no way be could help you.
your post was on point that indeed the program compiled with %ls not giving errors during compile time.
But i also seem to over complicate a simple calculation so that was also was causing false results.
everything is fine now
>tfw problem that was supposed to take 5 minutes took 5 hours and still not done
Can't wait
I am trying to solve a mystery.
So basically I have a sql table which has couple hundred K of rows and each rows has two columns with integers in it.
I always need to select a single row where the integer is in a range is specify. I saw that the query is taking .3s on average which is disgusting, if a large number of people comes at the same time it will bottleneck the shit out of it.
So I was like, no problem let's slap indexes on the two columns since the data never changes so it will make it super fast, yay
So i did that .. and now the query is actually taking .9s on average
the indexes actually made it slower
WHAT THE FUCK
an invite for the /dpt/ discord, please?
there isn't one
>discord
Fuck off back to /v/, mate.
...
>discord
get the fuck out of here you filty causal normalfag redditor
go back
(You)
Is relying on the SGI's rope implementation available in libstdc++'s ext/ a good idea?
I don't what the package management hell in C++.