/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?


Previous thread:

Other urls found in this thread:

google.com/patents/US6506148
en.wikipedia.org/wiki/Perfect_number
phrases.org.uk/meanings/a-little-knowledge-is-a-dangerous-thing.html
pastebin.com/WWeQuj6Z
pastebin.com/kbz8TjQE
twitter.com/AnonBabble

Threadly reminder that dlang-chan is not dead, and she's super duper cute and fast! Say something nice about her, /dpt/!

learning bash. the syntax is ass but it's fun to be able to run little scripts without having to leave the shell. seems useful to know

Give me a random project to do in a scripting language

Write a bash script to prove that P != NP.

sum of all prime numbers under 2000000

make cron change your text editor's theme from light to dark when it's dusk, and back to light when it's dawn

Daily reminder that if you use sublime or atom you are a faggot.

>Frogposter
Take a look in the mirror.

t. assblasted JS fag

also, not an argument. Go back to your meme editor.

Is the mouse the worst invention in the history of computers?

not government surveillance?

no, the keyboard is

i imagine the recent patent for manipulating peoples nervous systems through monitors will be worse

google.com/patents/US6506148

Trying to understand Binary Decision Diagrams.I haven't been able to figure out how they are different from just sparse binary search trees.

any androidfags here
is it possible to make two LinearLayouts scroll together
i.e, scroll one and the other one scrolls along with it as if they were the same thing

>tfw too brainlet to understand cache memory

i know nothing about them but the name seems to imply decision diagrams are able to apply to arbitrary decisions, not just comparing it to the node by ordinal position

>What are you working on, Sup Forums?
>Actually working on something for once
>Don't really feel like talking about it

tell us :(

Java has faster performance than C#.
Have a nice day.

If I go into specifics I imagine it would be pretty easy to identify who I was, but that's not really the end of the world.
Anyway, it's some Wayland compositor related shit.

Now I just look like an attention whore.

how bad is cobol? first day at my new job and they program in cobol. what should I expect?

They're just a representation of Boolean functions with canonicity to make it easy to test for equivalence and satisfiability.

i think i know who you are

just put the two linear layout inside one scroll layout,

What purpose would there be to use that over a sparse binary tree with some other traversal function? I might be over thinking it, but it seems like the BDD acts like a sparse tree with a different function to determine how to traverse the nodes.

I don't see how a binary decision diagram is similar to a binary tree at all.

Well done!

Now find the 10th perfect number.

6 is a perfect number. 1+2+3+6 (the sum of multipliers) = 12 (double of 6)
8128 is a perfect number.
8128's multipliers add up to 2*8128

a cache is just storage you can refer to so you don't have to redo a computation.

do you need an example?

All /dpt/ posters are women pretending to be men, some of whom pretend to be women

>1+2+3+6 (the sum of multipliers) = 12 (double of 6)
1+ 1 + 2 = 4. 2 is a perfect number, 1 * 1 * 2 = 2, 4 = 2*2

stupid problem

I ironically want to become a cute loli

[citation needed]

>2 is a perfect number
1+2 = 3 != 2*2

Cache is memory on the CPU that mirrors a small fraction of main memory. It's fast to access a memory location mirrored in the cache, so you want to do that as much as possible. The interesting part is how the CPU decides which locations to mirror and how to write programs with memory access patterns that use cache as efficiently as possible.

Wrong cache.

Atom, I agree. Sublime, no.

Is it true that Lua has version incompatibility issues?

t. sublime user

That's because I'm not very smart and don't get the concept. To me it seems like they are similar in the sense that you apply some function to an input until you reach some leaf state. Once you hit that leaf state then you get your value. It might just be the way the implementation is in my head, but again I'm not that bright.

In a loop like
for(int i = 0; i < strlen(s); i++) putchar(s[i]);
can I safely assume that the compiler will store strlen(s) somewhere so it doesn't recalculate it every time through the loop? Or should I explicitly store the result of the strlen call in a variable so it doesn't have to recalculate it every time?

>can I safely assume that the compiler will store strlen(s) somewhere so it doesn't recalculate it every time through the loop?
Assuming you're not changing s at all in the loop, yes, this is the type of optimisation you can expect a compiler to do.

You can assume the compiler will optimize that for you, or you can stop being a little shit and put that outside of the loop.

Most trees (and directed acyclic graphs in general) are used that way.

1+1+2 = 4 = 2 * 2

you're stupid if you don't understand why every number is "perfect". put some effort into creating your problem and i'll put effort into solving it

Yep. Sublime is lightweight. Atom is bloated, from what I remember. I use Sublime for most things, and Vim for small edits.

You are repeating 1 twice. 2 is not a perfect number.
Educate yourself
en.wikipedia.org/wiki/Perfect_number

Also read phrases.org.uk/meanings/a-little-knowledge-is-a-dangerous-thing.html

shell scripting is incredily useful and a productivity booster. i prefer zsh to bash, but either one is much better than tcsh

>when it's dusk
where can you find this information? is there a rest service or something that takes a day and a location and returns sunrise, sunset, etc.?

>eval e =
Unsafe code.

the clock

piss off and formulate your little riddles better then

So edgy

I've been getting overflows, must be something going wrong
import std.stdio;

void main(string[] args)
{
int current_perfect_number = 0;
const int limit = 2;
for (int i = 0; i < limit; i++)
{
int sum_of_multipliers = 0;
for (int j = 0; j

Oh I see what's wrong

how to Django?
how much time will it take to learn it?

>"the multipliers have to add up double the number and then its perfect uguu" anime.jpg
>point out that your question's shit
>edgy
hmm

inb4 who are you quoting autistic shitposting

...

>what do i say?
>i can't think of anything!
>better post a meme

Web dev gen is down the road punk

import Data.Numbers.Primes (isPrime)

perfs = perfs' 1
where perfs' k | m take 10 perfs
[6,28,496,8128,33550336,8589869056,137438691328,2305843008139952128, ...

might take a very long time for 9 and 10

It's okay, user. All newbies get bullied at least once.

i imagine you'd have PTSD by now then

At least my butt doesn't hurts

It's okay to be noob, it's not okay to be a brainlet though

you've yet to defend your question as being well-posed

about to learn java, any tips?

Don't.

Don't shit in the streets

why? (serious)

it's a shit language

it's the most verbose language in use today

if you don't know, don't answer

wrong

the main advantages to java are ubiquity and availability of libraries, frameworks, and services. if you're learning to program, it's a poor choice. if you already know how to program and you want to know java to increase your chances of getting a job that pays the bills, it's not such a bad choice.

10th number is pretty big, here's one that prints the 5th
import std.stdio;

void main(string[] args)
{
int result;
for (int i, current_match, number_current_matches = 0; number_current_matches

counterexample?

>public static private implementation
>public static private class
god damn pajeets

...

how

I guess if he's trying to understand specifics of memory caching hardware thats one thing but its more important to understand what a cache in general is. Let's you figure out other cache systems quickly.

Allocation part:
int ** mMemRes(int R,int C)
{
int it,** matrix;
matrix = malloc(R*sizeof(int *));
for(it=0;it

Learning python currently. This is pretty comfy desu

Get out

No

I just finished the second version of the Python recursive directory traversal program I posted on here a couple days back.

It now uses instances in a list to store the data for each Python file as opposed to the shitty list-value total system I was using before.

Is there anything I can improve?

Keep in mind that the class I'm doing this for basically has us treat Python as a lower-level language so I can't use much in the way of built-in functions beyond the bare minimum.

The improved traversal program:
pastebin.com/WWeQuj6Z

The class I made for the Python files:
pastebin.com/kbz8TjQE

I need a simple html webpage that plays a random video from a folder

Tried looking online and i couldnt find anything that doesnt require me manually inputting every filename

Don't forget that the loo is where you must poo. Other than that, just make sure to write clean, efficient code that doesn't use a gorillion gigabytes of memory.

How do I post code?

>

your mom

>begging for cryptocurrency is against the rules
is it saying you can beg for regular currency?

You need to use PHP or some server-side language to get all the files in the path; from there you can make a script inside the html to do it all for you rather than trying to make a javascript function to try and iterate through all the files in the folder and randomly pick one and reassign it to a video element or something.

No

Again, I fail to see the joke here. 'haha poo in the loo, all indians are bad programmers!'. Is there any serious criticism or just memespeak?

It's pretty much just a meme although there is some truth to it.

i was joking

Oh, hehehe

Pascal.