/dpt/ - Daily Programmmmmmmmmmmming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

foldingforum.org/viewtopic.php?t=23630
stackoverflow.com/questions/28724322/detect-graphics-driver-information-in-python
github.com/fbcotter/py3nvml
mapeditor.org/
twitter.com/NSFWRedditImage

Reminder to use a diverse cast of philosophers, and to always use their proper pronouns!

TypeScript is the greatest language
VS Code is the greatest text editor

>VS Code is the greatest text editor
can agree minus the npm virus, and electron.

...

Employed Rust programmer here. AMA!

How do I get a gf?

>How do I get a gf?
Women aren't objects, user. You don't "get" one.

>having more than 2 indent levels
No wonder they've been removed.

show tits roasty

You are violating the Rust CoC right now, and it's making femanons feel unsafe. Please stop.

How should smaller C++ programs be organised?
I'm doing a code test and other than the class I need to use, all my methods are in the main .cpp file. They're not entirely related to one another, so how should these be organised?

Do the main .cpp files have free functions in them, or typically just main?

How large is the main .cpp?

Wait for modules.

Pretty short. Under 6,000 lines.

I never write tests

>I never write tests
Neither does 99.99% of the population. Why do you feel special?

Feel free to have free functions in every .cpp file. This is C++, not Java. You're not forced to put everything in a class, and doing so can be considered bad style.

population of what

Quite short.
At the moment not even 100 lines. It has four functions in it at the moment, and by the end at this rate it'll have about 6.

C is like the reliable friend a girl can come back to for support after a string of abusive new boyfriends (i.e. all these new buzzword marketed languages that are all the hype right now).

Currently in Physics (at least in several fields I'm aware of / associated with) the new "thing" is ridiculous amounts of Python - everything is being rewritten in Python. I do not believe this will continue, it's too slow by default and far less readable than C/C++ (imo) when using Numpy (which you have to do really).

C (and C++) will always be there, ready to co-operate with you in times of need.

programmers

Yeah but pretty much every function for the code test at the moment is in the main.cpp file. Is there any "conventional" way to clean it up?

>population of what
Oh the world.

rewrite everything in J ironically

Unless there's an obvious way to group and partition them, don't bother.

>C is like the reliable friend
>C
>reliable
Is this a satire?

...

Jai ftw, can't wait till it's open-sourced

>"don't be a dickhead"
>I can't do that! stop oppressing me!

user probably just finished fizzbuzz

It's just a shame neither of them go to the gym, eat healthily and are getting long in the tooth.
Taking them out anywhere always takes 5x longer than it should.

Reliable in that it isn't going away, not that you can trust it.

Group functions according to how they are used. Make static anything that only needs to be used with a handful of functions in one file. Employ namespaces if you must.

try not to worry about the harsh criticism, keep trying to improve :)

>Are you quite sure that all those bells and whistles, all those wonderful facilities of your so called powerful programming languages, belong to the solution set rather than the problem set?
>— Edsger W. Dijkstra

meant for

>t. picrel

Are modules not "finished" yet then?
When will they be?

t. coder afraid of gotos

level editor for a game I'm making

numpy and mpl were already very popular when i was working in physics labs, maybe seven years ago. i think there are several reasons for this, but the availability of standard repl and notebook interfaces seems key

observing the fact about physics too.. my guess is that it is used because physicists tend to be horrible programmers and python just lets you throw together a quick and dirty program without ever thinking about i/o and stuff like that.. + plenty libs...

but when it comes to numerical number crunching we run in astrophysics simulations in my department its still 1. Fortran, 2. C, 3. C++

Listen to us Dutches. We know best.
jwz ik neuk de rendier tabon yemek

Why not just use an existing tile map editor?

>Currently in Physics (at least in several fields I'm aware of / associated with) the new "thing" is ridiculous amounts of Python - everything is being rewritten in Python. I do not believe this will continue, it's too slow by default and far less readable than C/C++ (imo) when using Numpy (which you have to do really).
Can I add some things?
>inconsistent documentation that is either autogenerated garbage or examples too specific to generalize without additional information
>googling for docs finds outdated docs first
>useful functions marked deprecated in favor of barely functioning 0.1 version in some other library that fails in some operating systems
>horrible C library wrappers that initialize something when first imported and can't be safely invoked with futures+threadpool without something breaking because of that
>stepping through complicated code 1 line at a time looking for that point where badly documented 3rd party library X leaves numpy array in unexpected shape

Rust BTFO.

What's a good way to get driver information with Python on Windows? I want to get the version number of my GPU driver.

NIH syndrome

Maybe you should just call a command and parse the output, something like
reg query "HKEY_LOCAL_MACHINE\SOFTWARE\NVIDIA Corporation" /s | find "Display.Driver" | find "Display.Update"

taken from foldingforum.org/viewtopic.php?t=23630

stackoverflow.com/questions/28724322/detect-graphics-driver-information-in-python

or maybe none of the existing ones fit the use case

I found github.com/fbcotter/py3nvml and used it. But thanks, user!

Look at the second answer

I didn't know of any, and I didn't think to look for one. Making my own wasn't too much work anyway

Beware programmers who would have you always reuse and never create.

>Making my own wasn't too much work anyway
I guess it depends on the level of functionality you want. I use this thing:
>mapeditor.org/
Duplicating it would be quite a bit of work, but maybe you don't need anything complex.

>Beware programmers who would have you always reuse and never create.
Beware retard "programmers" who never create anything new or original, opting instead of reinvent the square wheel eternally and tell others to do the same.

Stop trying to deskill him.

>Stop trying to deskill him.
See for an accurate description of yourself.

eight queens problem in ocaml
(* queens: int -> (int * int) list option *)

(* check that two squares are compatible *)
let comp (i1, j1) (i2, j2) =
i1 i2 && j1 j2 && (abs (i2 - i1) abs (j2 - j1));;

let compl p l = List.for_all (comp p) l;;

exception NoSol;;

let queens n =
let rec try_complete ((i, j) as p) solp =
if i > n then Some solp
else if j > n then raise NoSol
else if compl p solp then
try try_complete (i + 1, 1) (p::solp) with
NoSol -> try_complete (i, j + 1) solp
else try_complete (i, j + 1) solp
in try_complete (1, 1) [];;

Beware "programmers" who cannot program and insist that you not program because they cannot stand the fact that while they cannot program, others can.

hi

any good coder clubs to join online? just wanting people to talk to really

>coder clubs
What the fuck is a coder club?

/dpt/
r/programming
r/atheism
hackernews.com

You probably can't program your way out of the cardboard box. My suggesting he may want to use an existing tile editor says nothing about me. Your sperging out about it and making wild assumptions says everything about your mental capacity.

You losing your temper suggests that my assumptions about you are correct.

>You losing your temper suggests that my assumptions about you are correct
Another invalid conclusion based on another invalid assumption. You're mentally handicapped. Please don't attempt to give people any advice.

idk just a chat without people like you in it.

I suggest you take a deep breath and calm down, user. Your temper tantrum is clouding your judgment.

>spergs out incoherently
>makes completely retarded assumptions
>the retarded nature of his assumptions gets pointed out
>u mad bro???

I've never been involved in an open-source project where people misbehaved. No one ever called for violence against political groups or people of a specific race or gender... but there are at least two members of the Rust team who openly did.

Once you stop drinking soy you'll see why normal people have enough of this two-faced CoC bullshit.

You're clearly upset. Do you want to talk about it?

>none of them fit the use case of being able to place tiles on a square grid

Are you making sonic the hedgehog?

Keep deflecting.

Keep posting evidence of your meltdown.

can I be part of it ?

Have I upset you in some way, user?

>if you mention the possibility of using an existing editor, it means you never create anything
>if you mention the connection between my bizarre attitude and lack of productivity, it means you never create anything
>if you mention the lack of logic behind my assertions and call me retarded, it means you never create anything
>also u mad bro

I've clearly touched a nerve if I've managed to exhaust your brainlet image collection.

Python
Are there any SIMPLE python modules that can simple encrypt/decrypt with a password for a text file?

What are your programming snacks?

I'm afraid there aren't any, user. You're going to have to learn how to program.

>Can't encrypt/decrypt
How are you enjoying that CS degree user?

im not

Tell us more about how much there is to learn from making yet another tile editor, and how everyone who calls you retarded is so mad that they're probably dying from a stroke as you type your witty retort.

beans on toast, gotta get that energy

if I am at work I will have oatmeal

Why don't you make one yourself? That sounds like it'd be a pretty fun project

Bleh. I'm not surprised, I sympathize.
void main() {
import std.stdio, std.algorithm, std.range, permutations2;

enum n = 8;
n.iota.array.permutations.filter!(p =>
n.iota.map!(i => p[i] + i).array.sort().uniq.count == n &&
n.iota.map!(i => p[i] - i).array.sort().uniq.count == n)
.count.writeln;
}

...

probably not in stdlib, look at some libsodium bindings and some key derivation function (libsodium probably has one already)

obviously meant for

bend over and ill show ya a real coc violation

Fuck off trip fag

I want to finish something before the heat death of the universe, m8

The former is obvious to anyone who programs, and the latter may not be universally true but in your case it clearly is. I hope you get the help you need.

I use the trip __just__ to trigger you, bb

Just use subprocess to run 'openssh enc'

and it's three short readable funcs between 1-3 kloc each
self-documenting code, obviously

*openssl enc