/dpt/ - Daily Programming Thread

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

Other urls found in this thread:

go.googlesource.com/go/ /go1.7
twitter.com/mattetti/status/763913903600349184
github.com/metakirby5/codi.vim
twitter.com/SFWRedditGifs

if it haskell it ain't haskell

A wild pajeet appears!

Nothing right now, although I am starving for an idea. Really racking my brain trying to come up with something.

Reading The Practice of Programming, so far shit I already know.

>interface{}
>GC

I want to work on several source files at once.
Should I be opening several screen/tmux windows with a nano instance in each of them, or should I be looking at something else?

Go (golang) 1.7 has been released!
go.googlesource.com/go/ /go1.7

People are reporting big performance/binary size/compile time improvements:
twitter.com/mattetti/status/763913903600349184
>.@rakyll Go 1.6 vs 1.7rc6
>Test suite from 3:34 => 1:48
>Docker image building 3:05 => 1:50

Can't wait for those sweet, sweet benchmarks, Go vs C/C++ :^)

u mad bro? ;-)

>C/C++
Why are you grouping two completely different languages together?
Also:
>Garbage collected

Go doesn't has GC.

...

If it had GC, it would collect itself.

>code giving weird ass results
>turned out it's due to a typo in one of the functions defined and machine error is obfuscating the actual calculations
>mfw spent 3 days mulling over this problem that's resolved by closing a parenthesis

A cute vim plugin
github.com/metakirby5/codi.vim

>One of the biggest sources of bookkeeping in systems programs is memory management.
>One of the biggest sources of bookkeeping in systems programs is systems programming.
>Go developers

Vim or emacs

EMACS
M
A
C
S

Super neat.

import System.Environment(getArgs)
n = read . head getArgs
main = mapM_ putStrLn . plot cross = :load cross.hs
[1 of 1] Compiling Main ( cross.hs, interpreted )
Ok, modules loaded: Main.
*Main> :main 5
* *
* *
*
* *
* *
*Main> :main 8
* *
* *
* *
**
**
* *
* *
* *
*Main>
-}

Pls gib next page

#define pi 3.14
What variable type is that? Could I possibly run into rounding errors if I use it with floats, doubles, ints, etc.?
C++ by the way.

Yo Sup Forums I'm a lowly tier II shit desk technician and I'm looking to get into programming and stop being a shitter. I've been looking into C# partly because I wanted to make a game in unity and because a senior tech/buddy suggested it. He says C# is a very capable language and worth learning over java. I've already installed VS and about to pull the trigger on 2 books from Amazon. Any tips Sup Forums?

CuteSharp is pretty good senpai, read Visual C# step by step.

Does anyone else enjoy doing pointless shit like this?
int main(void) {
int number = 5;
int guess;
puts("Enter 5: ");
int correct = 0;

do {
guess = get_int();
match_compare(guess, number,
less, puts("that's too low"),
greater, puts("that's too high"),
equal, puts("you've got it!"); correct = 1;);
} while (!correct);

return 0;
}

time to fix parametric polymorphism

It's a literal.

I'm learning C right now. As practice, I'm making a super simple window manager based off TinyWM that has buttons, groups windows and can tile. I'm going to be using it in the custom DE for Gentoo on my OPO.

Thanks bossu!

learn Go: you can become very productive easily and fast. it supports many OSes
C# is good too, though.

That's pretty ambitious, I hope you're at a point where it's challenging but still doable. Have fun!

That's hideous.

Thanks user!
I feel like I have enough skill to take it on but still learn new things. TinyWM is written in like 30 lines of C so it shouldn't be too challenging. I'm hoping to aim for RAM usage

That's not a real program. You can't program.

It's literally C with garbage collecting.

What? I've defined the match_compare macro, it works fine.

Obviously I'd never do anything like that in a real program, it's just for fun

Post the macro.

There's nothing to it dude.

#define match_compare(l, r, op1, op1_do, op2, op2_do, op3, op3_do) \
if ((l) op1 (r)) {op1_do;} \
else if ((l) op2 (r)) {op2_do;} \
else if ((l) op3 (r)) {op3_do;}

Seek psychiatric help.

Some other cool ones:
int main(int argc, char **argv) {
char ch = argv[1][0];
int i = 10;

r_switch(ch) {
r_case('a', 'z') {
puts("lowercase");
break;
}
r_case('A', 'Z') {
puts("uppercase");
break;
}
} r_end;

with (FILE *f = fopen(argv[1], "r"), fclose(f)) {
if (!f) break;
for (char ch = fgetc(f); !feof(f); ch = fgetc(f)) {
putchar(ch);
}
}

until(i == 0) {
printf("%d\n", i);
i--;
}

interval(i, 100, 150, 2) {
printf("%d, ", i);
}

printf("top %d\n", getpid());

detatch {
printf("child %d of %d\n", getpid(), getppid());
detatch printf("grandchild %d, child of %d\n", getpid(), getppid());
printf("child %d again\n", getpid());
}
printf("top again %d\n", getpid());

int input;

puts("Enter a number greater than 5.");
do {
scanf("%d", &input);
} until_valid(input == 5, puts("try again!"));

return 0;
}

syntastic + hlint/hdevtools is really awesome

LMNFAO

Go fuck yourself.

Hey brahs the first anniversary of my friends unfortunate passing is coming up and I wanted to program something helpful for a community or anyone in general in his memory.

Taking any suggestions (I have my own projects but they're not very useful to anyone other than me). If a specific language is necessary I'll pick it up too.

Code a security alarm for your friend's grave.

Last one:

int main(void) {
pthread_t foo = thread("foo") {
char* str = (char*) arg;

printf("Thread #%u says: %s\n", pthread_self(), str);
return NULL;
} endthread;

pthread_join(foo, NULL);

return 0;
}

Reminder if your code hasn't been unit tested, it's already legacy code

Hi i hope you can help me guys, i'm doing a basic alarm from an API

I have this datetime format "2016-08-16T04:11:30.000Z"and this will be the "expiry"

how can I convert this into a long to subtract it into the current time?

thank you

that was quick

wow, that's purely coincidental user.

Deep learning algorithm, this project is getting out of hand. Been working on it for three years now, this is the eighth (?) iteration. Getting pretty good at debugging though.

I thought deep learning algorithms were supposed to learn the best feature sets themselves. What's all that paper for?

Planning out the modules and the dataflow for a prediction assembly.

Can you elaborate more on your project? Post pics of paper and stuff, this is interesting.

just use vim and use the viewports and buffer features

Keep it simple and make it a library or api, something like todo.txt in such a way that it just has an organic and constant grow.

help me please

To elaborate, you cannot just make one giant net and throw all the data into it. Each input has its own modules depending on the data type, dimensions, and purpose. For example, your eyes have their own processing center which is then connected to the multisensory constructs in you mind that work with abstractions from the lower tier raw sensory constructs. Depending on what you are doing the modules interact in different ways, in my program chrono constructs store lower tier constructs from past iterations and link then with current ones. In this way you can search chronologicaly, whereas a raw construct can do simple object recognition.

I am going to be cautious as to what I post for pics, I plan on building a business when I finish and do not want to expose the inner workings. I hope you understand.

Also, these are my personal notes, they get messy.

>using sepples comments in handwritten notes
Don't be a Pajeet.

My algorithm uses a type of artificial neural network to process data. Each blue circle is a construct, a class containing a network and the tables for input and output. This allows for easy programming of them without rewriting the whole damn thing for each application like earlier versions.

You need to pick you up a high polymer eraser and a drafting pencil.

One time I took notes with parentheses as if it were a lisp.

is there any way to convert this format to long 2016-08-16T04:11:30.000Z?

If there's a way from long to that format (there is), then there's a way back.
Figure it out.

I want to impress muh gf by making a memory card game for Android with politicians.

But in the same time I learn web dev so it's hard to make multiple things happen.

This is why we make fun of web devs

Among other reasons

Paper is cheap, when it gets to a certain point I just grab a new piece and pick out the pieces that still need work. The images I posted are a progression of the current part I am working on.

They are my notes, I can use whatever convention I please.

I have to learn web development, internship wants it and I can help out around the uni and dorm, cause their pages is beyond Hell. Only thing I hate about it is the designing part, I am autistic and not acoustic I don't give a shit about how a page looks and layed out, I just want to write code behind it.

Also t. Ungarn, web devs make a lot of money here as well as other programming related jobs, shit our sys admin back at highschool made around $1100/month

Are you learning to program or not?

Yes, I am, what are you talking about? I have mentioned that I do Android apps as well.

My major is Software Information Technology(Szeged, Hungary).

That motherboard looks pretty gross, senpai

Yes, you can poo in whatever street you please.

The joys of coding

How exactly does that commenting style relate to Indians? Is it common among them? I am American, always have been, always will be.

(not him) No idea, especially because it's from C++, and pooinloos are known for Java and C#.

Then why can't you program games?

i found the answer, i parse the date string back to DateTime object and used the duration class of JodaTime.

Yeah, that's why I do it, been programming in c++ for years now and I relate those to a comment.

because he cannot program anything that wasn't explicitly taught to him

college education doesn't encourage independent learning at all

That's nsfw...

>purely applicative, nonmonadic parsers

explain what part of that is NSFW

It's a crossdresser masturbating.
That's it.

Now fuck off

Just finished a thread scheduler based around a fixed set of threads and a priority queue of N tasks. I managed to get the worst-case start-to-finish latency of a task down to about 30000 CPU cycles, and about half of that being overhead to the calling thread.

Also did a simple generic object pool system for fast allocation/deallocation. Features are auto-expansion, thread-safety, arbitrary memory alignment, and memory leak-resistance.

Language is C11.

The fuck are you talking about?

Doesn't matter actually, here is your (you).

Hello my friend across the Atlantic! Things are different here in Europe, education is actually working here.

Especially in CentralEU, many unis are company dependent so they train student to be able to work in company environment.

My uni(SZTE) is supported by Nokia, we have to do our internship there. Also they usually hire students to actually work there even if you haven't got your degree yet. It is very easy to find jobs and be able to do future jobs.

>The fuck are you talking about?
>Doesn't matter actually, here is your (you).
Are you fucking retarded?
If you can program you can program games

>It's a crossdresser masturbating.

No it isn't. He's just showing his monitor.

Look up my original post.

I never fucking said I cannot program games, just I do not have the time to invest into the project which was mentioned in my post.

Fucking peasant

You mean you can't invest time in learning to program while learning to pretend program

Here is your another very own (you) pal.

It's all yours :^>

That's not education, it's training. Like a monkey.
You're just confirming what the guy you replied to said.

An EDID parser but I don't fucking know hexadecimal...

>not knowing hexadecimal
what

I will explain this further.

The edu here requires and encourages us to be creative and come up with our ideas.
This is why most of us get a job immediately after and during uni.

Are you using C11 threads or no? I seriously have not used them in any projects I've done so far since support is sparse and OpenMP/pthreads are just more familiar and has better support.

Nope. Pthreads is what I use at work, so I use it here too.

>Windows
>uBotnet
>Chrome
>foobar2000

Im not too familiar with c++ threading. Whats the difference between pthreads and std::thread?

I have never used std::thread; it's been years since I've done serious programming in C++. I use C, Java, Python, Tcl, and a few others.