/dpt/ - Daily Programming Thread

Previous thread: What are you working on, Sup Forums?

Other urls found in this thread:

bits-please.blogspot.com/2016/05/war-of-worlds-hijacking-linux-kernel.html
github.com/chvrn/Sup
twitter.com/SFWRedditImages

nothing tbqh

how come you fags never post stuff related to infosec?
things like this: bits-please.blogspot.com/2016/05/war-of-worlds-hijacking-linux-kernel.html

because meme popsci is autistic

i don't find it interesting at all, i'd rather create my own software without limitations instead of trying to find some tiny loophole in someone else's software

reposting because no1 replied:
im implementing behavior trees in Java right now and want to use a non-specific class as the data context, is using generics to pass the type of data context on each individual node the way to go? or is there some more elegant way to achieve this, or is it a bad idea altogether?

If you want to share links then go to reddit

I'm finallly going to graduate.

story?

O SHIT WADDUP!

6 long years of high school

el test

Trying to get my image viewer to properly display gif images. The gui library does not do this natively, so displaying animated gifs is a real ordeal. I'm probably going to have to write a lot in the mailing lists because most of the time displaying a gif is nowhere near this easy/smooth.

what does your picture (raytracer ?)have to do with it?

What's the problem?
Deconstruct the gif into frame delay/ogl texture pairs and just play those.

that's not me.

Redesigning C++ 3D engine core in C.

Fucking hell I forgot how fun C really is. The lack of safety measures like protected, private and constructor/destructor was intimidating at first but you just feel free in this language. I was even able to drop my shitty inheritance system to an understandable struct system.
Probably gonna make the full switch.

When you won't be scared by allocated space, you will shit on C++.

How do you develop on Windows?

Do you install all the needed shit locally and deal with the Windows environment or use Virtual Machines or something like Vagrant?

What about the command line? Powershell? Cygwin? or just something like Cmder that makes cmd less painful?

Are you retarded?

what should i make?

I'm splitting the gif into its frames, grabbing the delay for each frame, and then looping the canvas draw call, sleeping for seconds. The problem is when it comes to gifs that have been optimized to have a lot of transparencies and expect the background to still be displayed so the other frames and be displayed on top of that. If I always display the background, expecting those kinds of gifs, then the Sif gif will look funny because the background frame will always be displayed.

There's also a problem with grabbing the frames of the large gifs and loading them into a bitmap% object - something about LZW compression being out of bounds, I have no idea what's going on with that. There's also a gif or two that have an "unexpected EOF" error when loading into the bitmap% object, but they load just fine in Firefox or Eye of MATE.

a android podcast app that ACTUALLY fucking works

calm down pajeet

make this do what she intended it to do in a language of your choice

Do you just have a pointer to a parent in your child struct? ie
class Child : Parent {
//....
};
// becomes
typedef struct Child {
Parent *parent;
//...
};

?
It's not exactly the same though, because then the child gets everything in parent, not just protected/public stuff, but that honestly doesn't matter/make a difference

github.com/chvrn/Sup Forums-whose-post-is-it/

Fixed it up

Adds guessing game looking like pic related to Sup Forums, Sup Forums and Sup Forums catalogs

...

Working on a RPN calculator.

#include
int main(int argc, char **argv) {
FILE *in = fopen(argv[1], "r");
FILE *out = fopen("out.cpp", "w");
char c;

while (!feof(in)) {
c = fgetc(in);
fputc(c, out);
if (c == '=') fput(c, out);
}
fclose(in);
fclose(out);
return 0;
}

>safety measures like protected, private
those are not as much safety measures as they are a useless pain in the ass

>recreating inheritance

System.out.println("Block.");

Is there an issue?

>undeclared identifier

#include

int main()
{
if ((strcmp(Tweeter,"Gamergater") == 0) ||
(strcmp(Tweeter,"Negative") == 0))
printf("Block\n");

return 0;

}

Looks comfy

Pretty much. In C the Parent class would have to have allot of stuff in it to have multiple Childs with different needs, though. But nothing a little pointer magic cant fix.

It really seems like a "fix" for the weak base class problem that comes with inheritance, but inheritance has ended me up with a clusterfuck more times than I care to imagine.

Isn't it composition at that point?

I wrote it in the reply box, heh, but which one? I've read it like 4 times now and feel retarded. Unless you're referring to the Tweeter, Gamergater, Tweet, Negative, etc.

It is. I have to implement variable and it will start to kick ass.

>not just !strcmp
Block

fput

Ah, that's a typo for fputc, nice catch

also, "c" should be "int"

>!strcmp
So what if strcmp returns a value less than zero? Faggot.

>tfw gets compiled to the same thing in assembly and improves readability

goto reddít;

not necessary pal

>she

char can be implicitly cast to int on function call

anyone here do primary development in Linux? I've been working in a VM but holy damn has it been slow.

yes why

Most of us do, I think

is...is it any better?

You have no idea.

Is there any difference regarding overhead between

static const int decent_penis_length = 12;
int my_penis_length = decent_penis_length;

and

int my_penis_length = 12;?

you're missing out bro

Just dual boot, fambly.

it would be overflow error because the value is too big

Working with C is a dream on GNU+Linux. If you are missing a library, you can get it in a single command, while on Windows you have to open your browser, google the library, find the download link, click the download link, manually move the folders into the corresponding directories, pray that the windows download was for mingw and not visual studio or else you have to compile the library yourself.

i'm scared senpai~

He uses loonix in a VM so he should already know all of this.

Miles and miles better.

wasn't talking to you retards

dat boi

You don't know how logical negation works do you.

I am both of them, and the user you replied to

It's an int you retard.

>hur dur penis jokes XD
You're stupid joke failed and doesn't make any sense, fuck off.

Can someone call me retarded and help me with this issue?

for fileName in glob.glob(data_path + "/*.gz"):
record_data = None
with gzip.GzipFile(fileName, 'rb') as record_stream:
record_data = record_stream.read()

with open(fileName.replace(".gz", ".txt"), 'wb+') as write_stream:
write_stream.write(record_data)

I'm opening ~10k .gz files that contain a single file in them and extracting them as a txt file into the same directory, one by one.

I can't figure out why I keep getting exit code 137 (Killed due to memory consumption?)

Example GZ: ftp://ftp.ncdc.noaa.gov/pub/data/noaa/isd-lite/2010/010030-99999-2010.gz

*steps out of the shadows*

Heh... not bad, kid. Not bad at all. Your meme, I mean. It's not bad. A good first attempt. It's plenty dank... I can tell it's got some thought behind it... lots of quotable material...

But memeing isn't all sunshine and rainbows, kid. You're skilled... that much I can tell. But do you have what it takes to be a Memester? To join those esteemed meme ranks? To call yourself a member of the Ruseman's Corps? Memeing takes talent, that much is true. But more than that it takes heart. The world-class Memesters - I mean the big guys, like Johnny Hammersticks and Billy Kuahana - they're out there day and night, burning the midnight meme-oil, working tirelessly to craft that next big meme.

And you know what, kid? 99 times out of a hundred, that new meme fails. Someone dismisses it as bait, or says it's "tryhard," or ignores it as they copy/paste the latest shitpost copypasta dreamt up by those sorry excuses for cut-rate memers over at reddit. The Meme Game is rough, kid, and I don't just mean the one you just lost :^). It's a rough business, and for every artisan meme you craft in your meme bakery, some cocksucker at 9gag has a picture of a duck or some shit that a million different Johnny No-Names will attach a milion different captions to. Chin up, kid. Don't get all mopey on me. You've got skill. You've got talent. You just need to show your drive.

See you on the boards...

Why did you get so mad at him just for making a bad joke?

Retard.

Because it's not an overflow error.
12 fits in an int.

Retard.

It's too big to be your dick size, though.

How does that justify you getting mad like you have asperger's though?

Inheritance is just syntax sugar for a very limited form of composition & interface implementation.

Now that we have this out of the way, can anyone give me a hand?

its a good way to get rich, tough.

>baiting this hard
I SHIT WADDUP!

I just recently graduated, and I'm trying to make more programs to show off when I go to job interviews. I'm terrible with coming up with things though. Anyone have any ideas on what I could make to show i'm not completely retarded.

no i am

Here you go.

write a program that can average 2 ints in C

...

ideas guys are a meme

that's a big hand

Wouldn't I just use atoi? Seems like an easy feat. Thanks for the suggestion though.

for whom?

float *foo = fizz;
float *bar = buzz;

const unsigned int diff = foo - bar;

unsigned int piss = diff - 4U; // works fine
unsigned int shit = foo - bar - 4U; // fucks up

what's going on here?

>realize my mess up instantly after submitting the post
nvm i'm retarded

does that crash?

Could be system level limit of open file handles, or other system resource limit that you're crossing.

>I just don't know

...

>mental illenss

have you tried not reading the whole thing into memory?
for fileName in glob.glob(data_path + '/*.gz'):
with (gzip.GzipFile(fileName, 'rb') as record_stream, \
open(fileName.replace('.gz', '.txt'), 'wb') as write_stream):
while True:
chunk = record_stream.read(65536)
if not chunk:
break
write_stream.write(chunk)

Fuck off this isn't /bst/.

Any idea where to start looking to work around this? I'm using Ubuntu 14

never mind i was incrementing foo after diff = foo - bar

I assume the problem lies within glob that stores a gigantic list of paths, I could be wrong, but try using os.walk() which is a generator, something like this:
data = None
for root, _, name in os.walk(data_path):
path = os.path.join(root, name)

with gzip.GzipFile(path, 'rb') as r:
data = r.read()

with open(path.replace('.gz', '.txt'), 'wb+') as w:
w.write(data)


The caveat here is that the data_path will have to contain only the .gz files because you can't match just the .gz extension with os.walk() unless you add some extra check within the loop.

I'll give this a shot now.

I'm outputting the txt to the same directory so i will add the check if the above doesn't pan out.

Thanks, Anons.