/dpt/ - Daily Programming Thread

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

Other urls found in this thread:

isis.poly.edu/kulesh/stuff/src/klist/test_list.c
github.com/torvalds/linux
en.wikipedia.org/wiki/Botnet
github.com/Dako300/RPI_BTC_ATM
stackoverflow.com/questions/9623114/check-if-two-unordered-lists-are-equal
github.com/NecronomiconCoding/NecroBot
twitter.com/SFWRedditGifs

First for D

LINKED LIST STACK IMPLEMENTATION

read this
isis.poly.edu/kulesh/stuff/src/klist/test_list.c

>Draw a girl
>Call it a boy
Why is this allowed?

This calls for someone to secretly replace the linked list allocator to take from a sequential memory pool.. So in reality it is a stack implemented on a linked list implemented on a plain old array or vector.

That's how the a linked list implemented in the Linux kernel

yes, and it is a very good way of having a general linked list

can I always pass parameters as references in c++?

You can do whatever you want user

all anime characters look like girls anyway

thanks

You should.

except for when you shouldn't

oh hey, another thread about people programming shitty lists of anime and basic conversions

have fun talking about languages that don't matter and programs a child could make

References are ultimately memory addresses, which are values.

I want to make a program that writes it's own code by trying every single combination of characters until it compiles.
It WILL eventually create the greatest program of all time.

sorry, i forgot about scripts that make your homescreen glitter too

References are just retarded const pointers

have fun with that

just know that there is really no way to know if your program will terminate

it will take trillions of eons

you do realize you haven't set a standard for what it does.

so in theory if it tried enough combinations it could end up just printing something random and since it executed it would then stop.

it has no reason to continue once it has successfully run.

>isis
I'm not opening that link. It's not even a HTTPS address, so anyone can see what I'd be opening.

I fear I've already being watched because of this thread. Posting this comment is dangerous too.

I did this.
After an hour it produced a subtracting function, and somthing that printed out powers of 13, with about 55 lines of junk.
Don't bother.

Only the type of anime you watch.

I just tried it and got a working kernel, suck it fags

That's actually pretty surprising results.
I would've expected it to be 100% garbage that segfaults at runtime anyway.

Do employers not care about non-trendy-meme-technology works in a prospective hire's portfolio?

>2016
>using SQL bloat

why do people put huge amounts of code after
if __name__ == '__main__'

?

Also, should we import the modules at the beginning or after
if __name__ == '__main__'

?

that is pythons int main()..

and imports should go at the top of the file.

Go read the pep guides

it actually printed something? damn

What's up guys

i'm writing a kernel in C and Assembly, does anyone want to see?

Sure

okay. here's my github:

github.com/torvalds/linux

if you have any question, just ask

>tfw I can't finish anything bigger than a few thousand lines
How do you do it senpai-tachi? I just get bored of working on the same program as soon as I figure out the general structure and whatever gimmick I set out to make. For example, if I want to make a pokemon GO clone I'd just get to the point where it queries google maps for data and uses the GPS to place you on a virtual map... And then I'd quit and never re-open that project because it feels like from there on it's just filling in a bunch of boring shit. How do I fix this so that I can actually make something of note, something interesting beyond short "project euler"-like programs?

Linked lists are better than array lists.

>you will never inseminate hime's boipussy
why live

I have a similar problem. I can't get myself to actually write anything. Once a year or so I get completely into some book / whatever, then finish a bunch of their problems and get completely bored.

Decide I want to write something actually useful (for me) and then... I have no idea what. Everything I can think of already exists somewhere.

why don't you kill yourself then?

Yeah, it really does feel like anything useful has already been made, and anything fun (video games for example) I can't make to a satisfactory degree solo. I've been desperately looking for a way to make programming fun again. I tried taking a look at getting into open source programming, but all the OSS I use myself (linux, various frameworks) already has a thousand contributors, the barrier to entry is high and kind of intimidating...

Anons give me a very small command line game to make for practicing my C. I have gotten all the way to understanding how to do bubble sorting of arrays. Pic related I am reading the beginner's guide to c before K&R.

How did you get that many contributors?

Blackjack is a very nice exercise imo.
Make a deck (array of all the 52 cards), make a function to shuffle, a function to draw and so on. You don't have to bother with the weird rules like doubling, but you should at least keep aces as 1 or 11.

Learning Java now

Any tips?

Switch over to C#

Get a job

this desu

This is the best advice when it comes to Java.

It's for work, I already know a bit of C#

Then learn more of it and get a job in C#.

But I like my job

I tried to get a job in c# but it didn't happen

I just got told today to drop everything and learn Java because they want to put me on some project

I'm working on a little Python malware - basically a reverse shell. I'm connecting the victim's machine to mine through a socket, and it works fine. The thing is - the code must have my IP adress, but then the victim could have my IP. How can I hide my real IP?

>Python malware
Write it in a compiled language you dipshit.
I really hope this is a troll.
You must be 12 years old.

This is literally the only reason why Java is being used over C#. You're forced to at your job.

Get a cheap VPS

Are you my mom?

Ok, so I'm writing a fucking chat, or whatever the fuck you want. The problem is the same.

I think there are more, better implementations of the JVM than .NET. You can even run java on some embedded systems. And I say this as a total C# fanboy, but it looks like improving on this is the current focus of the .NET team.

Yeah, I think I'll have to do that.

You'll find it easier to write more if you are paid/forced to do it

That's because java is much more aggressively optimized, isn't it? That could definitely be solved with a better jit/compiler There's a big talk about this on the roslyn github..

The fact that the language itself is much better still stands.

With a reverse shell, inevitably you will have to connect to something. There's no two ways about it. Hiding your IP in this case is not different from how you'd normally do it... tor, proxies, whatever. A safer approach is having your malware read from a certain twitter account where you can give it commands, however that only allows for one-way communication and you would still need to hide your IP when connecting to twitter. Of course you can replace twitter with any other online service that lets you post shit.

I have this idea of how to do a password system in a python scripted video game I'm making, I'm sure there is a function that will pull it all together but I don't know what that is.

There will be a grid where you checkmark boxes for you on screen. On the backend, checking these boxes appends integers to an array. In the end, when you've finished the password, I need a function that will check if your password array contains specific integer variables AND have the correct number of array items total.

Like, say the password is [1, 7, 9, 13]. What do I use to check if my array contains those numbers and that there are only four of them there total? Order doesn't matter. If you checked the boxes in a different order and got [13, 1, 9, 7], it should be exactly the same. I can do everything else.

How do I solve this?
Backjump limit reached (currently 2000, change with --max-backjumps or try to
run with --reorder-goals).


--max-backjumps=-1 or --reorder-goals together or by itself does nothing.

I tried connecting to a VPN and using the IP from the VPN, but it didn't work. The Twitter ideia is interesting, maybe I'll work on that.

It's partially an optimization issue (java has filthy hacks like storing all integers up to 128 as static objects, using primitives that aren't actually objects etc.), and partially just that java was first, became more popular and so people started writing JVMs for everything.

It's called command and control, en.wikipedia.org/wiki/Botnet

If there 64 boxes or less, you could always use a ulong with bitmasking. Otherwise what's stopping you from iterating over the 2 arrays?

Raspberry Pi based Bitcoin ATM
Currently working on error detection and correction with the JSON RPC

github.com/Dako300/RPI_BTC_ATM

The appropriate data structure is a set (unordered collection, duplicates discarded), take a look at the first answer here stackoverflow.com/questions/9623114/check-if-two-unordered-lists-are-equal

Any haskellfag knows?

Where do I learn about manipulating 2d arrays and using relational data to interact with them?
I tried to look it up and found some examples for Conway's Game of Life but I didn't see one that actually explained in depth how they manipulated the date.
Help? I've never done anything like this before.

Well, you could just sort both arrays before checking:
def is_equal(array1, array2):
if array1.sort() == array2.sort():
return True
return False

Probably should have added I'm doing this with python.

Thanks, that was easy.

password_array = [5,4,3,2,1]
correct_password = [1,2,3,4,5]

if set(password_array) == set(correct_password):
print("you win!")
else:
print("LOSER")
#this works, as is. will always print "you win"


are there any nuances to set() that I should be aware of? It seems perfect. It doesn't care about order just like I wanted.

I've never touched haskell, but backjump limit reached sounds like you've created an infinitely recursing loop? Check your termination conditions.

password_array = [5,4,3,2,1]
correct_password = [1,2,3,4,5]
print ("you win!") if set(password_array) == set(correct_password) else ("LOSER")

That is slower than

What's the real definition of code monkey?

Someone who suck at coding but code for money.

u

It differes from lists/arrays in two major ways:
1. Order is non-existant in a set, and
2. Can't have duplicates

You already noticed the order-agnosticism, and then there's also set([1, 1, 1]) == set([1]).

So for data like this it's perfect. If you wanted to extend your code and turn it into a regular keypad, so that i could have passwords like 1337, you would have to use a different data structure because of the duplicate 3s.

This is an error in the default package manager.

Also specifically part of a large group of coding monkeys, that is it must be cheaper for a company (on short term of course) to have 3 weak coder than one good coder.
Also, see web devs.

Make a prgoram that creates a text file and fills it with a random amount of random characters, and then runs a compiler over it. Let it run for like a few billion years and then come back.

Cleaning up my fixed thread image saver, finishing my github demo (for potential employers), and if I have time, either giving Django a day in court (vs my current NodeJS setup) or finishing a use-cases doc/chart for my app.

You were born to be a software designer, not a programmer... but yeah, software design is hard for programmers and programming is hard for software designers, for different reasons. To programmers, software design is difficult because of math/logic/abstraction, and to software designers, programming is hard because it is boring. This is why programming is a dying profession in the states and is increasingly outsourced to indians and gooks.

Someone who can program but not necessarily design an algorithm or choose the right data structure for a job. Its like a software designer without a college degree.

Every WPF book I come across has a section on the 3D API.
But they never seem to answer my question:
For an API that is ostensibly used only for the GUIs of business-end applications, why the fuck would anyone use it?

You might want to draw some kind of 3d graph or implement doom and run it in the sub window.
Your userbase would love you.

>You were born to be a software designer, not a programmer
You're probably right desu, I hadn't thought of that. Software design does tend to require a background in programming though, and it's hard for me to take on a leadership role because I'm beta as fuck. I guess my best bet is to dredge through the boring parts of programming just to get it done and try to focus on the design aspects so that down the line I can eventually land myself a job with a fancy title such as systems architect... It's tough for now though, but such is life I guess.

2 words: three-dimensional pie charts, motherfucker.

Look up the definition of "Cargo Cult".
Essentially, code monkeys put the practice of cargo-culting into daily use as programmers.

It just so happens that cargo-culting as a programmer actually does give you satisfying results, as opposed to building a landing strip on an unmanned island. Not that the code monkey would ever be able to do more than just copy what other people have done.

Transistor programming.

>friend gets in on this stupid Pokemon Go craze
>make a Pokemon Go bot
>makes $90k in less than a week

Why can I never think of this stupid shit?

i dont think people are selling pokemon go bots

There are a lot of great money making ideas in the area of web automation.
The problem is identifying the audience, and identifying the path to automation.

For example, writing a bot that buys limited-edition shoes for niggers to gift to their 'baes' is actually quite difficult once you have to deal with emulating calls to the webshop's encrypted credit card APIs. (They do this to discourage botting)

They are seeking leveled up accounts to dumb people that can't into using a bot.

FUCK YEAH SEAKING

They are. $8 per license.

nice link there butty.

Link it so i can reverse engineer it and crack it so the fucker doesnt make money

all the better bots are free
github.com/NecronomiconCoding/NecroBot