/dpt/ - Daily Programming Thread

web devs LITERALLY fuck off to previous:

Other urls found in this thread:

youtube.com/watch?v=Gbx9p1KQydo
pastebin.com/3t0WiT2q
pastebin.com/SeTBae95
docs.oracle.com/javase/tutorial/
twitter.com/SFWRedditVideos

first for pythonistas

ironic shitposting is still shitposting

>tfw no pajeet gf

Too early. faggot.
Delete this thread and kill yourself.

If you're gonna go out of your way to tell people to "literally fuck off", would you care to tell the class how one would actually complete that action?

U MAD FAGET

click here:

>ayy.jpg
ffffffuuuuuuuuuuuuu cannot unsee

you seem frustrated
thats understandable
now move along peasants

>being this angry
come on op

retarded much

im sorry, what programming language do you know?

>be a web dev
>should i post in the web dev thread
>nah i'll post in the big boy programming thread, pretending to be a programmer

>____ much

I'm working on a package for Atom.

C, C++, Java, Haskell, Racket, Python

Programming for 15 years including emulators, graphics and games

and you???

What should I work on?

Nice quality contribution to the thread there, retard.

It's 2006, don'tcha know?

>im sorry, what programming language do you know?
Stuck in the one language is all you need mentality?

sex with women

shut up fucking retard, you're not any better

that's not a programming language, nor a feat

i hope it doesn't have smooth/kinetic scrolling

>Programming for 15 years including emulators, graphics and games
...aaaand still broke

you seem frustrated
that's understandable
now move along peasant

The property is enabled

kill yourself fag

Nope

net worth

you seem frustrated
that's understandable
now move along peasant

Probably, haven't been keeping track of my properties' values, but still not broke

>repeats his reply verbatim
you seem frustrated

Nice strawman, retard.

>he can't stop replying

So how about dat dere programming?

This is what happens when OP shitposts in his post.

>he can't stop replying

>5 insertions, 27 deletions
>tons of new functionality
good feel

>he can't stop shitposting

>i farted

>his text is all emerald quoted

Android studio is complete garbage

>kek

It's not though

anything by intellij is garbage, i can't believe the goddamn shills, apparently if you have the arrogance to make an "ambitious" product like an IDE, programming language or a game engine or whatever you're entitled to jew people out of their money or get bought up by an even bigger jew

s/intellij/jetbrains

>being this retarded

>being this gay

another example of the garbage that they produce is scala, it's a bastardized version of java, they lack any understanding of the qualities of java, scala is complete shit, heck even C# would be more relevant for developers to use

What's the best way to learn about sockets? Are there any good books or tutorials?

British sockets > American sockets

Australia/New Zealand sockets > British sockets

Come on m8.
Who you fooling?

>definition of shitposting
Here's a decent tutorial:
youtube.com/watch?v=Gbx9p1KQydo

Gave me a hearty chuckle m8.

Thanks, I was gunna watch that but I didn't want to waste my time.

The Aus/NZ plugs are not landmines, as in, the pins do not point up when the plug is dropped.

shill harder

Don't watch that.

Look up beej

shitpost harder

I have a prototype of this web project running
you just have to post in this thread
precede your comment with a ';'
it only accepts mostly 5 or less character 1-word phrases and you can use parenthesis like take(lamp).
The outpust show up here: pastebin.com/3t0WiT2q

I made my first program in C++ yesterday. It's a simple gas calculator. Here is code.

#include
#include

using namespace std;

int main()
{
//vars
double mpg, gallons, distance, totalCost, pricePerGallon;

//Output
cout mpg;
cout distance;
cout pricePerGallon;

//Arithmetic
gallons = distance/mpg;
totalCost = gallons * pricePerGallon;

//FinalOutPut

cout

Is there a better cleaner way to set up the sprites in setupsprites:

#define MAX 15

Struct Things {
Sprite aliens[MAX];
} Things

main () {
Things things;

setupsprites(Sprites *sprites);
//lots of other shit be here
}

void setupsprites (Sprites *sprites) {
for (unsigned char i = 0; i

we dont give a FUCK

am I too drunk or are you using setupsprites(*sprites) and then using sprite instead of sprites? Does this even compile? Can I possibly drink more and still drive in 8 hours?

and here's the code

pastebin.com/SeTBae95
I couldn't do it any better, sorry. The permanent login sessions were just not fucking working because of the way functions are nested.

Get raped and kill yourself, you retarded fucking faggot sack of shit with down syndrome.

Well it's setupsprites(&game->aliens[0]); actually. All you needed to know for the question that it compiles but I want a better solution than 3 for loops.

>Any pointers on learning it faster?
docs.oracle.com/javase/tutorial/

Anyone got any book or online resource recommendations for learning C++?

this is fine, you could unroll it by hand I guess its only fifteen iterations but your compiler "might" be doing that already.

cppreference.com

You're going to have to post more code because I have no idea what setupsprites does.

You also have a lot of magic numbers.

why don't you go to class every once in a while?

Well how about this? More advanced for you?
public class PriorityQueueDemo
{
public static void main(String[] args)
{
PriorityQueue queue1 = new PriorityQueue();
queue1.offer("Oklahoma");
queue1.offer("Indiana");
queue1.offer("Georgia");
queue1.offer("Texas");

System.out.println("Priority queue using Comparable:");
while (queue1.size() > 0)
{
System.out.print(queue1.remove() + " ");
}

PriorityQueue queue2 = new PriorityQueue(
4, Collections.reverseOrder());
queue2.offer("Oklahoma");
queue2.offer("Indiana");
queue2.offer("Georgia");
queue2.offer("Texas");

System.out.println("\nPriority queue using Comparator:");
while (queue2.size() > 0) {
System.out.print(queue2.remove() + " ");
}
}
}


Just want some recommendations for books and stuff, no need for rudeness.

I'm trying to write an irc bot with unix sockets, but I suck at parsing.
In the function below I expect that, upon finding a a new line (crlf), I copy it to an array of lines, null-terminate it, then do what I want with it (check for commands, print it, etc).
If I do not do this, then strncmp will inevitably miss due to the fact that a command could be truncated between recv() calls with neither call actually receiving the complete command.


int loop(int sfd)
{
int k = 0;
char buf[513], (*message)[513] = malloc(513 * sizeof(char*));

const char *pass = "PASS password\r\n";
const char *nick = "NICK bot\r\n";
const char *user = "USER bot 0 0 :bot\r\n";

send(sfd, pass, strlen(pass), 0);
send(sfd, nick, strlen(nick), 0);
send(sfd, user, strlen(user), 0);

int len = recv(sfd, buf, 512, 0); /* I will check return value after I get it working :P */

for (int i = 0; len != 0; ++i)
{
for (int j = 0; j < 512; ++j)
{
if (buf[j] == '\r' && buf[j + 1] == '\n')
{
strncpy(message[k], buf, j + 1);
message[k][j + 2] = '\0';
printf("%s\n", message[k]);

++k;

if (k == 513)
message = realloc(message, sizeof(message) + 513 * sizeof(char));
}
}
len = recv(sfd, buf, 512, 0);
}

free(message);
return 0;
}

>docs.oracle.com/javase/tutorial/
See

Why take an extra class when you can teach yourself? That's what I'll end up doing in class anyway...

what a disgusting piece of spaghetti shit that is in desperate need of some enterprising.

Sup Forums, people say math majors get much more than computer science majors

Is that a meme? I thought math degrees were worthless

Teach me senpai.

you should probably just write your IRC bot in perl.

they never were

that being said, it shouldn't matter, programming is fun, and CS concepts are necessary

What do you mean by get much more? Money? Knowledge? Power? Sex?

Holy shit, you have no idea what you're doing.

Consider suicide

Most people I know have both, at least most of the people I go to school with will be finishing dual majors in math and CS. Most of the time a CS major can pick up a Math major for only a bit more work due to some overlap in major requirements, really depends on the school of course.

Jobs have higher wages in general.

Majors are meaningless. That's why the business degree exists. Companies don't care what your degree is because it won't matter: they just want that slip of paper that says
>I'm slightly above the shit they push through high school

Oh man I wish this was true where I'm at then I'd get a CS degree too. I'm not even getting a minor because I refuse to take the babby's versions of courses I've already taken: discrete math I & II.

All the function does is go through 15 sprite initiations. init_sprite (&sprite[i], xPos, yPos, length, height, bitmap); Said functions are from a specific library and the function currently works as intended.

unsigned char ayy[] = { 0b10000001,
0b01000010,
0b01111110,
0b11011011,
0b10000001,
0b10000001};


On the magic numbers side, that is what I wanted to avoid. j*8 is bitmap width j+5 is trying to make sure that it uses the next sprite in sequence.

>int len = recv(sfd, buf, 512, 0);
recv isn't going to null terminate the buffer for you. Also, the proper return type is ssize_t.
ssize_t len = recv(sfd, buf, 512, 0);
buf[len] = '\0';
>for (int i = 0; len != 0; ++i)
>{
>for (int j = 0; j < 512; ++j)
>{
>if (buf[j] == '\r' && buf[j + 1] == '\n')
char *crlf = strstr(buf, "\r\n");
if (crlf == NULL) {
// Handle "line too long" somehow
}

strncpy(message[k], buf, crfl - buf);
...

So you be tellin' me

If I was a history major
but my resume said I was proficient in x number of languages or have expertise in others
or have projects that are somewhat remarkable

Then your major won't matter that much if at all?

Essentially yeah. If you got some facts to back that up it wouldn't matter. I know a few HR type people and they don't really care about what is written on the degree.

I think I should probably say that there is a potential this doesn't apply to the entire US though. SE Texas reporting.

I wrote a smart contract.

I also thought through my design for an ASI some more. Yes, ASI, because AGI is for pajeets who work for Google.

/dpt/, I need some way of communicating with my laptop over the network (SSH is sadly out of the question, I would use it if I could).
Basically it should be a little bot in the background that receives commands from the server and responds to them.

Requirements:
>Encryption
>Doesn't matter if any ports are closed, it should just connect
>Hopefully file transfer, preferably with encryption
>Light and simple

I'm trying to get XMPP working and it's going pretty well, but I'm not 100% comfortable with it.
Any other suggestions?

Yea this is home work. A micro-controller class using the atmega32u4.

I have a LCD screen I wish to draw to at 20ms intervals using the ISR. If I have a draw function currently operational but it has arguments to call it. Does this mean that I cannot use ISR to call it on the ISR's overflow?

Why is SSH out of the question?

Okay but can you extrapolate a little?

Okay, so you don't want to shoot yourself. If you fuck up, you might just end up a vegetable. I would suggest taping the exhaust of your car to one of your windows and build up CO2 on the inside. It's painless, you'll just fall asleep. Listen to something comfy on the radio, like This American Life.