Old thread: What are you working on Sup Forums?
/dpt/ - Daily Programming Thread
Other urls found in this thread:
weitz.de
github.com
twitter.com
learning gpu programming
any tips?
Thank you for using an anime image!
"While I love the power of Lisp, I am not a devotee of functional programming. I see nothing bad about side effects and I do not make efforts to avoid them unless there is a practical reason. There is code that is natural to write in a functional way, and code that are more natural with side effects, and I do not crusade about the question." -Richard Stallman
I have a question regarding console applications. I want to make a program, which upon first login asks to create an admin account. Then, that admin account can create new accounts and save data in a txt file. All encrypted of course.
Now, I have a problem; how do I change between accounts without using some sort of database? All account information will be in a single txt file, each in it's separate line. How do I switch between them? All of them will have ID's, with the admins being 0.
first to show off my pro code Ive been a python major for 7 years now
I made a cool ass digital clock
import time,datetime
a0 = ["00000"," 11 "," 222 "," 333 ","4 4","55555"," 666","77777"," 888 "," 999 "]
a1 = ["0 0","1 1 ","2 2","3 3","4 4","5 "," 6 ","7 7","8 8","9 9"]
a2 = ["0 0"," 1 "," 2"," 3 ","44444","55555","6666 "," 7 "," 888 "," 9999"]
a3 = ["0 0"," 1 "," 2 ","3 3"," 4"," 5","6 6"," 7 ","8 8"," 9 "]
a4 = ["00000","11111","22222"," 333 "," 4","55555"," 666 "," 7 "," 888 ","999 "]
def numap(w,x,y,z,f):
print(a0[w] + " " + a0[x] + f + a0[y] + " " + a0[z])
print(a1[w] + " " + a1[x] + f + a1[y] + " " + a1[z])
print(a2[w] + " " + a2[x] + " " + a2[y] + " " + a2[z])
print(a3[w] + " " + a3[x] + f + a3[y] + " " + a3[z])
print(a4[w] + " " + a4[x] + f + a4[y] + " " + a4[z])
while True:
print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n")
t1 = datetime.datetime.now()
da = int(str(t1.hour).zfill(2)[0])
db = int(str(t1.hour).zfill(2)[1])
dc = int(str(t1.minute).zfill(2)[0])
dd = int(str(t1.minute).zfill(2)[1])
if(t1.second%2==0):
ddd=" *** "
else:
ddd=" "
numap(da,db,dc,dd,ddd)
time.sleep(1)
Why are you using a text file?
Why are you reinventing the accounts/permissions system already on your computer?
I am about to shoot myself in the head due to lack of python documentation for QGIS. Someone save me.
Abandon ship. Unless you don't do it solo. You will never have the time to make a complete application on that low level solo.
Why not just use one multidimensional array?
why didn't you just use a dict to store all the letters?
>hitlerwasright[7]
>
BTW you can repurpose your solver as a random state scrambler. Most fags scramble with random moves but random moves does not guarantee a random scramble. Random moves make easier scramble show up more often. It's not as a big deal when working with 8 puzzles but when doing 15 puzzles it's noticeable and pain obvious on higher order ones.
For scrambling:
>generate random state
>check parity to see if it's possible to solve
>if impossible go to step 1
>else solve it
>print out the inverse of the solution as the scramble
Because it is for a school project obviously, it has it's limitations on what you're supposed to use.
I just want to apply for roles in machine learning that require GPU programming
was my first plan I didnt feel like doing it
? because appending a row would require thinking wich I cant do but as excuse I'll say that I didnt feel like thinking today
Machine learning GPU programming is very easy. It's all just parallelizing matrix math.
That's relieving to hear. Is the hard part in GPU programming game development stuff?
>>What are you working on Sup Forums?
saving enough money to give a proper thanks to this fella
Graphics are harder then just math.
Can I escape Python?
Where to run?
*than
Can I use languages besides p*thon?
sure, C -> Haskell -> Lisp
in this order.
C or C++
Just jump straight to Lisp.
only if you want brain cancer.
To lisp
come to lisp :) ()())))))))))))((((((())))))
btw I wasn't the same guy who gave the implementation advice. I just gave the info about random state scrambling since speed solving 15 puzzles is one of my hobbies.
I have three years coursework of Java with a sprinkling of perl and scheme; will an AI course taught in Python and a computer vision course taught primarily in C be survivable?
Yes, unless you're a brainlet
what should I use with C?
CUDA
You'll survive but they may do some autistic stuff with python you won't understand immediately.
Hey guys I'm just learning C now and what's everyone's obsession with pointers? I understand what they do, but why do people use them all the time? Why use pointers for adding 2 numbers?
What would give a person brain cancer if he went from python to lisp?
I did it and I feel fine
>but why do people use them all the time?
Pointers are absolutely vital in C. It would be very difficult to write a non-trivial program without using them.
>Why use pointers for adding 2 numbers?
That is a typical situation where you would use a pointer.
>That is a typical situation where you would use a pointer.
Fuck, I missed a vital word.
You WOULDN'T use a pointer for that.
please respond
I want to get into gamedev but I don't want to learn a meme language
Wat do?
>unity :D
>>I don't want to learn a meme language
>he doesn't have pointers to pointers of arrays of pointers pointing to pointers of pointers
>What would give a person brain cancer if he went from python to lisp?
the retarded thing they both have in common. he needs a cleansing which will be accomplished by C and subsequently haskell. then he should learn lisp for the macros.
/dpt/ answer: Roll your own engine. Actually, fuck the game: the engine is enough.
/agdg/ answer: Use Unity and slap some bought assets into your shitty "game".
lurk in /vg/agdg/ and try to understand basics before calling something a "meme"
Use existing engine (irrilich, ogre3d, openscenegraph, urho3d, gameplay3d) and program with c++.
Or use you choice of language, pretty much all of them have wrapper for sdl and opengl.
C# is a meme language no matter how you put it though
*
thats true, I didnt know unity uses C# as I dont develop games personally my bad
hello python noob back again
>>> for i in listb:
... lista.remove(i)
What can I do to stop it erroring out if listb contains something not in lista? Like a catch or an if contains or something like that
ex lista=[1,2,3] listb=[5,6,7] would make the above code crash and I just want it to do nothing and be like okay we tried to remove it and it wasn't there and that's okay
Is SICP still relevant?
>>> for i in listb:
try:
lista.remove(i)
except ValueError :
print(i)
...
are you seriously implying that c# is not a meme language
How does Sup Forums average two numbers?
#include
int main(int argc, char* argv[]) {
return ((atoi(argv[1]) >> 1) + (atoi(argv[2]) >> 1) + (atoi(argv[1])&atoi(argv[2])&1));
}
i am not makiing that argument, though i could.
i am pointing out that you are autism cuz you say it is a maymay language
>telling the truth is autism
nigger detected
>nigger detected
in yo mama's ass
>meme language
>a meme language
>"""""maymay""""" (?) language
Understandable, not everyone can handle the freedom of dynamic typing, and need to have the compiler hold their hands. That's why in Lisp, you can have this (quoting an example from the Hyperspec):
(defun equidimensional (a)
(or (< (array-rank a) 2)
(apply #'= (array-dimensions a))))
(deftype square-matrix (&optional type size)
`(and (array ,type (,size ,size))
(satisfies equidimensional)))
You can then use FTYPE and TYPE to declare your types in a DECLARE form. Need monads? There are macros for that. Currying isn't given by default, but that is a pretty simple function. Purity isn't too much of an issue, and the Hyperspec documents cases where side-effects occur anyway.
>C# isnt a meme language
>>>/reddit/r/programming
I'm so glad Lisp """programmers""" exist. I'm a pretty average programmer, but I look like a genius next to one of them.
>there exists an x such that it is a meme language
avg =: +/ % #
>disagreeing with the best
>>>/9/g/a/g/p/r/o/g/r/a/m/m/i/n/g/
Is that Chinese?
>that ugly garbage just to get a barely """typed""" program
no, thanks.
>Currying isn't given by default
of course, since lisp is trash. it can't even have auto-currying for every single function. is it even Turing complete?
I'm sorry, but you must be confused, redditor.
Never ever recommend usage of objects or OOP here.
Can I get some resources for C++ please.
I need to know when to use .h and when not to.
see
Of course it is, user. Not to mention, static type checking can be given by Lisp. But that's not really meaningful, as the compiler is available at any time.
Basically if you're not writing self-modifying Assembly, you should flip burgers instead.
what are those (((((( ))))) ?
prove it. also make it curry every single function by default.
Perhaps then I can agree that it isn't absolute garbage.
write everything in single header file
Quick question about linq. Can you use it to read specific text from a file? For example, in a file somewhere is written "cuck: value". I want to search for "cuck" and compare the value to user input.
Is it possible in C#?
>reading from a file
id regex that file personally
wow I got less negativity over me than I expected and probably deserved
Example of a TM: weitz.de
Currying by default I assume would involve extending the evaluator through a combination of *evalhook* and *applyhook*. I've never tried this before, but I'm interested now.
Proccesing Mess DATA to TIDY format for OLAP Cubes
>looked up for yandex jobs
>either junior python programmer with requiered 2 year experience or senior python programmer with 3-4 year experience
And /dpt/ told me python is useless shit
>inb4 what is yandex
I don't understand that, can you show me an example please?
Does the file have any specific format that it follows? Do you want to search for just cuck or all "keys" that go key: value?
Let's say it's a .txt file, but in reality it shouldn't matter. I want to search for all keys that have key: value, but for specific ones.
I was going to make a joke about OOP being the object of your anger but I couldn't think of how to make it sound good. Such is life as an OOPfag.
>What are you working on Sup Forums?
Still working on my userspace sysfs NVMe driver. Made a couple of functions for submitting NVM commands and polling for their completion (but more logic is needed for phase bit etc). I'm also extracting some data about the controller from the identify controller structure.
The next step is to identify namespaces. After that I will try to create (and delete) IO queues and host them on GPU memory.
>try to learn C
char (*(*f())[])();
char (*(*X[3])())[5];
void (*f)(int,void (*)());
char far *far *ptr;
typedef void (*pfun)(int,float);
int **(*f)(int**,int**(*)(int **,int **));
>give up learning C
>he can't read syntax
wtf I hate C now
>/dpt/ told me python is useless shit
/dpt/ also earns 300k starting working on top secret military projects in Haskell and Assembly
/dpt/ alternatively is too intelligent to be employed
>supporting capitalism
>char (*(*f())[])();
declare f as function returning pointer to array of pointer to function returning char
>char (*(*X[3])())[5];
declare X as array 3 of pointer to function returning pointer to array 5 of char
>void (*f)(int,void (*)());
declare f as pointer to function (int, pointer to function returning void) returning void
>char far *far *ptr;
syntax error
>typedef void (*pfun)(int,float);
syntax error
>int **(*f)(int**,int**(*)(int **,int **));
declare f as pointer to function (pointer to pointer to int, pointer to function (pointer to pointer to int, pointer to pointer to int) returning pointer to pointer to int) returning pointer to pointer to int
>not earning 7 figs working your highly classified algol variant
stay jelly nerds
>i'm gonna impress my n00b friends with my secret tool cdecl
Hello I am making a though tracker to track how mind state shifts. Here's my model, what do you think?
Thought
- id
- name
- time
- mood/feel
Mood
- name
Moods: hungry, sad, bad, good, satisfied, calm, angry
[1, "Craving junk food", timestamp, "hungry"]
[2, "Bad memory", timestamp, "bad"]
[3, "wanting to ejaculate", timestamp, "horny"]
So I spend about an hour a day just tracking my thoughts and will see over the week the patterns and how one thing leads to another.
>muh scary symbols
>muh scary pointers
>muh brain can't handle all of this complexity
fuck off poo
go back to java
typedef void (*pfun)(int, float);
Is completely valid syntax though. It defines a type pfun which is a pointer to a void function with an int and float argument.
@59267131
Who are you quoting?
where is anime?
please respond