/dpt/ - Daily Programming Thread

youtube.com/watch?v=fPoq316yM40

O shit waddup

Previous thread: What are you working on, bois?

Other urls found in this thread:

pastebin.com/dLqmdp3j
csapp.cs.cmu.edu/
jimplush.com/talk/2015/12/19/moving-a-team-from-scala-to-golang/
twitter.com/NSFWRedditVideo

Do any of you contribute to GitHub projects? If so, could you tell us how you got into it.

have people started adopting swift for things other than iOS dev or was it DoA

How do you test client-side network code for a proprietary server? Do you implement the server's logic yourself?
>inb4 formally proving your Haskell code correct

Arduino/C++

From a for loop I got the int variable i. In this example it is 1.

String name = "Timer" + i;
Serial.println(i);
Serial.println(name.c_str());


Result is:

1
Timer

Why does this sheit not work?

>see bug
>fork repo
>make fix
>submit pull request

it's SHIT

What is the best freelancing platform?

What is everyone working on? I'm just curious on what other anons are doing

I didn't ask if it was good, I asked if it's being used

>Why does this sheit not work?

"Timer" is a string literal and *i* is an integer.
You can't add an integer to a string like that.

What do you guys think about Qt

>find reddit bug
>fork repo
>fix bug
>make pull request
>6 months later it gets accepted

you need to use itoa

An NLP library

Better than gtk

no one uses it

Reminder /dpt/

So I did an exercise for this algorithm book I'm reading, where I had to do a postorder traversal of a binary tree using a stack
Spent about 2 hours trying to get it to work before I stumbled upon the recursive method that didn't even need a stack
pastebin.com/dLqmdp3j

the only reason to learn C++

Which one is the one next to C#? And the one before R?

>mfw Sup Forums can't even average 2 ints in C

old meme

Digging further into the Arduino documentation I have found an easy but weird fix. From the website:

For example:

int sensorValue = analogRead(A0);
String stringOne = "Sensor value: ";
String stringThree = stringOne + sensorValue;
Serial.println(stringThree);

results in "Sensor Value: 402" or whatever the analogRead() result is, but

int sensorValue = analogRead(A0);
String stringThree = "Sensor value: " + sensorValue;
Serial.println(stringThree);

gives unpredictable results because stringThree never got an initial value before you started concatenating different data types.


So what I've done is:

name = "Timer ";
name += i;


Might look weird but works fine.

double average(int a, int b) {
return (a + b) / 2;
}


lmao ez kys

That makes sense because ""Sensor value: "" evaluates to a const char*, not a String which does overload the + operator.

Overflow, bubby

>applying for entry level engineering positions at Amazon, Expedia, and some other companies
>never been in big interviews like this
>feel like I am going to get destroyed by just the phone interviews

how do I prepare for this and not be a nervous shit?

You appear to be correct.

name = String("Timer ") + i;

Has the correct effect. Nice, thanks.

>how do I prepare for this and not be a nervous shit?
alcohol, xanax or both

Yeah drink a pint.

I guess I'll have to learn perl then, assuming it's not a dead language too

Expect failure. Learn from failure. After a while you know what questions they'll ask and how to win an interview. Patience is key

Next to C# -> F#
Before R -> Scala (JVM)

Cool, thanks.

You shouldn't take anything you see on here seriously. The warning doesn't apply just to Sup Forums. I mean Ruby is in the top tier, shit's obvious.

so I have applied to 4 positions right now and am going to apply for a lot more when I get home in 6 days.

basically I should assume that I won't get a job at Amazon or expedia?

is serial a file you can write to?
fprintf (serial, "Timer %d\n", i);

Serial is the terminal on my computer screen. Or a Bluetooth transceiver for all it matters.

I know. I was merely thanking you for helping me out. Those logo's I hadn't seen before and It wasn't obvious what they meant. I also disagree with the image, considering both C++ and C# are at the top.

OSHIT ITS DAT BOI WADDUP WAAADUPPPP

O SHIT OOS HIIIT


SOHO OSSHIT SHIT SHIT SHIT DAT BOI DAT OBI

DA

DAT BOI DAT BOI

IS THAT WHAT YOU WANTED ME TO SAY? FUCKING STUPID FUCKING STUPID PIECE OF SHIT FROGPOSTER, GET BENT

has anyone here read Computer Systems, A Programmer’s Perspective? does this book teach enough asm to write programs in it, or just uses some instructions here and there to help in explaining the architecture?

Yick fuck. C++ is evil.

'Serial' is a static object that contains methods for doing serial communication between the Arduino and a terminal.

Kid thinks Arduino development libraries are a special language. He can solve his problems by just learning C++, but he obviously isn't trying. Don't help him.

I learned a good amount of ASM in that book, but the book isn't for ASM. It's about low level stuff, as it also covers malloc, shells and I think it has a proxy lab. Also in the course I took with the book, we did buffer overflows, a little reverse engineering, and cache optimization.

>device
>not a file

smiley_with_caret_nose.jpeg

String literals are 'String' in C++11 and higher, but he's probably using the Arduino IDE which doesn't allow you easily change the language standard from the default specified by GCC (C++98).

carrot*

csapp.cs.cmu.edu/
Here's the book site. You can probably get a gist of the topics it covers. I enjoyed the course that was based on the book.

Java is a top tier programming language. C# fags can suck it.

Okay.

etsy

Blub programmers everybody!

this

found the nigger cattle pajeet

nice meme

Indian Microsoft certified C# technician pajeet detected

[spoiler]both are pajeet tier[/spoiler]

as if hasklel isn't garbage lol

Only 1 is used at Google, Amazon, Netflix, NASA, etc

there are many alternatives to C# and Java that aren't functional

was_just_saying.ino

You know it. :^)

>using the smiley with a carat nose

How much longer with Perl be a desirable language to know?

>update vuze
>it has ads
fuck off
what's next, pirating your torrent client?

What does that have to do with programming?

your mom

... also piracy is robbery on the high seas.
You're thinking of copyright infringement.

Is this less trashy now?

#include
#include

#include "../include/log.h"

typedef struct Entry Entry;

struct Entry {
Entry *prev;
Entry *next;
char *text;
};

struct j9_Log {
Entry *first;
Entry *last;
char *name;
};

Log *log_init(const char *name) {
Log *self = malloc(sizeof(Log));
self->first = malloc(sizeof(Entry));
self->first->prev = NULL;
self->first->next = NULL;
self->first->text = NULL;
self->last = self->first;
self->name = malloc(strlen(name) + 1);
strcpy(self->name, name);

return self;
}

void log_push(Log *self, const char *text) {
Entry *entry;

if (!self->first->text) {
entry = self->first;
} else {
entry = malloc(sizeof(Entry));
entry->prev = self->last;
entry->prev->next = entry;
entry->prev->prev = self->last->prev;
}

self->last = entry;
entry->next = NULL;
entry->text = malloc(strlen(text) + 1);
strcpy(entry->text, text);
}

char *log_name(const Log *self) {
return self->name;
}

char *log_list(const Log *self, const int newln) {
Entry *tmp = self->first;
char *ret = malloc(strlen(tmp->text) + (newln ? 1 : 2));
strcat(strcpy(ret, tmp->text), (newln ? "\n" : ""));

while (tmp->next) {
tmp = tmp->next;
size_t size = (strlen(ret) + (strlen(tmp->text) + (newln ? 1 : 2)));
(size >= (strlen(ret) * 4)) ? ret = realloc(ret, size / 4) : realloc(ret, size * 2);
strcat(strcat(ret, tmp->text), (newln ? "\n" : ""));
}

return ret;
}

void log_free(Log *self) {
while (self->last->prev) {
self->last = self->last->prev;
free(self->last->next->text);
free(self->last->next);
}

free(self->last->text);
free(self->last);
free(self->name);
free(self);
}

>self->first = malloc(sizeof(Entry));
>self->first->prev = NULL;
>self->first->next = NULL;
>self->first->text = NULL;
self->first = calloc(1, sizeof(Entry));

You're not checking malloc's return value anywhere.
If you think that all your reasonable thing your program should do is exit if malloc fails (malloc failing is usually a sign that something is REALLY wrong), you can write your own utility function to simplify the error checking logic:
void *xalloc(size_t size) {
void *ptr = malloc(size);
if (!ptr)
exit(EXIT_FAILURE);
return ptr;
}

>self->name = malloc(strlen(name) + 1);
>strcpy(self->name, name);
If you're fine with non-standard functions, use strdup, or you could implement it yourself.

>tmp = tmp->next;
>size_t size = (strlen(ret) + (strlen(tmp->text) + (newln ? 1 : 2)));
>(size >= (strlen(ret) * 4)) ? ret = realloc(ret, size / 4) : realloc(ret, size * 2);
>strcat(strcat(ret, tmp->text), (newln ? "\n" : ""));
This block of code looks horrible. Try to clean it up.

sperg

Yes
IBM are pushing it for their server stuff

It's a better Go, but I'd still rather use F#

why is golang an meme?

I'm for now busy with reading through Emacs Lisp's Reference Manual and still comparably far at the start. Would you say that an obarray is essentially just Elisp's technical implementation of name spaces? Or even better, how wrong would that statement be exactly?

It turned Pike queer.

that was just one picture, in all keynotes he looked and talked normal
and still married to his wife

you only need it if you are running a large company (>20 employees)

...

what was the deal with the picture then

maybe it was at an event or something

10 but it's horrible to write that way

What might you use in a smaller company? Why not Go?

Should I learn C++? It seems like a pretty commonly used language and I'd like to expand my knowledge. I am relatively new to programming, I know a significant amount of Java, Javascript, and HTML (I know its not a programming language), but not much else.

int avg =a/2+b/2;

>not using Scala instead of Java if you have to touch the JVM.

kys

Got caught wearing the outfit and had to play it off.

>eclipse

look up intellij idea

>10

It's 58.

>Made shaders update as I save the file.
This is great.

Go is simple, it works well in big companies because it makes adding new people to the projects easier. They can see what you are doing since the complexity of the language is very minimal.

Go can be used in a smaller company, but since you know the people well enough and you aren't bringing new people along, you can get away with using more expressive languages.

Have a read
jimplush.com/talk/2015/12/19/moving-a-team-from-scala-to-golang/

sure is a bit... shilly in here

Let x = 2
6 / 3x

That's 4 to you?

what is swift good for besides iOS?

>inb4 swift is shit and you're a fag

server applications, linux command line apps, OS X apps, etc

I recall watching some marketing content concerning a new profiler Intel (i think) had made. It looked pretty darn sweet.

I don't remember what it's called.

This is pretty dope. What resource are you learning to do shaders with? I need to upgrade to using opengl 3.

And how much of a performance bump should I expect in using shaders over the gl2 style texture coord VBAs?

there is no right answer because it's shitty ambiguous murriburger notation, you could make a case for 10 because 2(3) is written with parens instead of like 2*3 and because the spacing suggests that 2(3) is grouped on its own

>there is no right answer

There literally is, because pemdas (or bodmas, or whatever you'd like to call it) applies here as it does anywhere else.

2(3) = 2 * 3, and in the case of division and multiplication, they are done left to right.

So it can only render on apple products? that's fucking stupid, if entirely consistent with apple