/dpt/ - Daily Programming Thread

Previous Thread: Next Thread: N/A

Final /dpt/ Edition

What are you working on Sup Forums?

Other urls found in this thread:

globeuniversity.edu/blogs/information-technology/how-is-discrete-math-relevant-to-it-and-business/
youtube.com/watch?v=HgX3aAd4rHE
en.m.wikibooks.org/wiki/Creating_a_Virtual_Machine/Register_VM_in_C
better-dpt-roll.github.io/
twitter.com/NSFWRedditVideo

what is wrong with her jaw
it is
nca
o v
c e

What is discrete math and why we need it?

hipster math we don't need it

Math that respects your privacy is always a good thing.

globeuniversity.edu/blogs/information-technology/how-is-discrete-math-relevant-to-it-and-business/

I believe this is a sufficient answer.

First for C.

I want to have sex with Retrofit+RxJava+OkHttp+GSON

someone know where i can find what positions in memory map to what letters in Brainfuck?

i can't find such a table for some reason

Use IDA Pro and reverse engineer it

It's ASCII.

kek

Doesn't sound a lot like math.

How many users do I need on the Play Store to escape NEETdom?

oh i see

6 gorillon

My father asked me to write a program that remotely controls other computers (cory) in the house. So he can able to take control the router settings w/o going to its "website" and be able to access to run commands in the other Windows machines from one program.

My idea is to make a server on my dad's PC and hide the client programs as Windows Services on the other computers.

But cause I need a plan I am using UML diagrams to do it but I hate drawing with a mouse so i do it "analog" with pen and paper.


How did you guys get use to drawing with a mouse?

Would it be a good idea to write an IRC bot that takes BNF grammar?
What could BNF be used for in a bot?

Azmaria a best.

Can someone think of good names for these functions?

takeDepth and takeBreadth don't sound right, maybe trimDepth and trimBreadth?

Why would you do that? What is its benefit to you?

I have a tablet

>My father asked me to write a program that remotely controls other computers (cory) in the house.
This program is called Remote Desktop and is already running on every windows machine.

pruneDepth/Width

>Width
Been working with textures. Forgive me dark lord.

Jesus Christ I'm an idiot.

Reply intended for

I don't think prune is explicit enough about the fact that it's just limiting the number of children or the number of nested branches

I fight for the user.

branchFloor

I'm trying to copy a bracket parser in python from this book I'm reading, but I'm fucking it up badly. Bully away
class Stack:
def __init__ (self):
self.items = []

def is_empty(self):
return self.items == []

def push(self, items):
self.items.insert(0)

def pop(self):
return self.items.pop()

Stack()

def par_checker(symbol_string):
s = Stack()
balanced = True
index = 0
while index < len(symbol_string) and balanced:
symbol = symbol_string[index]
if symbol == "(":
s.push(symbol)
else:
if s.is_empty():
balanced = False
else:
s.pop()

index = index + 1

if balanced and s.is_empty():
return True
else:
return False
print (par_checker('((()))'))
print (par_checker('(()'))

Does minecraft still do redundant texture uploads to the GPU every frame?

>What does this code do?
OpCapability Shader
OpMemoryModel Logical Simple
OpEntryPoint Vertex %1 "vmain"
OpEntryPoint Fragment %2 "fmain"
OpExecutionMode %2 OriginUpperLeft
%3 = OpTypeVoid
%4 = OpTypeFunction %3
%1 = OpFunction %3 None %4
%5 = OpLabel
OpReturn
OpFunctionEnd
%2 = OpFunction %3 None %4
%6 = OpLabel
OpReturn
OpFunctionEnd

print(int(float(float(tuple[2])/len(activeDocuments[int(tuple[0])][int(tuple[1])]))*int(chapterdata[int(tuple[0])][int(tuple[1])+1])-int(chapterdata[int(tuple[0])][int(tuple[1])]))+int(chapterdata[int(tuple[0])][int(tuple[1])])) //converts paragraph number to page number

He wants to run commands on them in the background without those 3rd party spywares.

The user cannot know about that hidden service I will create. He wants to scare the senpai that they did something wrong so he can take full control of them.

Soon he will be retired and he wants a hobby, monitoring people is a hobby.

Devilish?

>Vertex and Fragment

That looks like some kind of shader to me.

>take a look at libffi
>it's fucking useless

probably, people say MC hasn't been optimized since Notch left

No rigor, grasping at straws. Analysis is the only true, manly math.

Just finished my MP3 tags rename program. Naive way.
Samples :
sub release_by_dir {
my $path = shift;

my $release = {};
my @files = glob("$path/*.mp3");

die "Empty dir or dir not found at $path\n" if (!@files);

foreach (@files) {
my $mp3 = MP3::Tag->new($_);
push($release->{file}->@*, $_);
push($release->{artiste}->@*, $mp3->artist);
push($release->{album}->@*, $mp3->album);
push($release->{genre}->@*, $mp3->genre);
push($release->{annee}->@*, $mp3->year);
push($release->{morceaux}->@*, $mp3->title);
$mp3->close;
}

return $release;
}

sub modify {
my $release = shift;

die "Undef\n" if (!$release->%*);

print "Same ARTIST/ALBUM/GENRE/YEAR ? (y/n) ";
chomp(my $input = );
_same($release->{file}) if ($input eq 'y');

foreach ($release->{file}->@*) {
my $mp3 = MP3::Tag->new($_);
my $title = $mp3->title;
print "New TITLE: [" . $title . "] ";
chomp(my $input = );

if ($input) { $mp3->title_set($input); }
else { $mp3->title_set($title); }

$mp3->update_tags;
$mp3->close;
}
}

tokenize them
keep states to a minimum
compose your methods
array comprehensions

Alright guys so I know its late and Ill probably have to ask later in the day. But Im at my limit here. Does anyone have any experience with using windows common file dialog. I need a file dialog box to appear with multiselect multiple times, but I can only get it to work once then it throws an error. Except for the very first time I run the code.
#include
#include
#include

class OpenFileDialog
{
public:
OpenFileDialog(void);

TCHAR*DefaultExtension;
TCHAR*FileName;
TCHAR*Filter;
int FilterIndex;
int Flags;
TCHAR* InitialDir;
HWND Owner;
TCHAR*Title;

bool ShowDialog();
};

OpenFileDialog::OpenFileDialog(void)
{
this->DefaultExtension = 0;
this->FileName = new TCHAR[MAX_PATH];
this->Filter = 0;
this->FilterIndex = 0;
this->Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
this->InitialDir = 0;
this->Owner = 0;
this->Title = 0;
}

bool OpenFileDialog::ShowDialog()
{
OPENFILENAME ofn;

ZeroMemory(&ofn, sizeof(ofn));

ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = this->Owner;
ofn.lpstrDefExt = this->DefaultExtension;
ofn.lpstrFile = this->FileName;
ofn.lpstrFile[0] = '\0';
ofn.nMaxFile = MAX_PATH;
ofn.lpstrFilter = this->Filter;
ofn.nFilterIndex = this->FilterIndex;
ofn.lpstrInitialDir = this->InitialDir;
ofn.lpstrTitle = this->Title;
ofn.Flags = this->Flags;

GetOpenFileName(&ofn);

if (_tcslen(this->FileName) == 0) return false;

return true;
}


int main()
{
OpenFileDialog* openFileDialog1 = new OpenFileDialog();


openFileDialog1->InitialDir = _T("C:\\Windows\\");

if (openFileDialog1->ShowDialog())
{
MessageBox(0, openFileDialog1->FileName, _T("b"),
MB_OK | MB_ICONINFORMATION);
}
openFileDialog1->FilterIndex = 1;
openFileDialog1->Flags |= OFN_SHOWHELP;
openFileDialog1->InitialDir = _T("C:\\Windows\\");
openFileDialog1->Title = _T("Open Text File");

if (openFileDialog1->ShowDialog())
{
MessageBox(0, openFileDialog1->FileName, _T("h"),
MB_OK | MB_ICONINFORMATION);
}
}

If memory serves correctly I tried this about a month ago and didnt have any problems. But now I cant get it to open the second dialog box. And if I try to enable multiselect I get a weird box. Any help would be great. Im having a hard time even googling examples of the dialog box.

ok I fixed it I guess

def getPageNum(tuple):
book_number=tuple[0]
chapter_number=tuple[1]
paragraph_number=float(tuple[2]-1)

pages_in_chapter=int(chapterdata[book_number-1][chapter_number])-int(chapterdata[book_number-1][chapter_number-1])
print(pages_in_chapter)

starting_page=int(chapterdata[book_number-1][chapter_number-1])
print(starting_page)

max_paragraph_number=(len(activeDocuments[book_number-1][2]))
position=paragraph_number/max_paragraph_number
print(position)

return (int(position * pages_in_chapter) + starting_page)

When would you need to use a RPC framework? I can't think of a good use-case, but then I don't do a lot of microservices programming

on wednesdays

Thank you. I will rewrite following your advice.

What's a moderately sized project I can do in C?
I'm going to try and test out of an intro CS class from a school I'm transferring to.
(Last school taught Python, this school teaches Java/C)

Member initializer lists are a thing, user.

r8
j = \x y z t -> putStrLn $ x $ y map z t
f = (!! 20593)
m = \x y -> y x $ m x y
s = \x y z -> [] : (y z >>= (\t -> x (:t) z))
u = map toEnum [74..85] :: String

main = j f m s u

Recursion you say?

But user! Iteration is objectively superior!

>youtube.com/watch?v=HgX3aAd4rHE

why is this recursion meme a thing again?

A very simple virtual machine sounds like it's right up your alley.

en.m.wikibooks.org/wiki/Creating_a_Virtual_Machine/Register_VM_in_C

I feel like that's a bit much.
The midterm for this class is a Caesar Cipher, and the final is a bubble sort.

>Hasklel

>Bhambhani

Generate some files containing numbers, implement from scratch several sorting algorithms (merge, quick, heap)? and sort your files. Compare times.

I'm messing around with Emacs Lisp.
Empty list is nil, so this works:
(defun fizzbuzz ()
(interactive)
(let ((number nil)
(fizzbuzz-list (number-sequence 0 100)))
(while (setq fizzbuzz-list (cdr fizzbuzz-list))
(insert (cond ((= (mod (setq number (car fizzbuzz-list)) 15) 0) "FizzBuzz")
((= (mod number 3) 0) "Fizz")
((= (mod number 5) 0) "Buzz")
(t (number-to-string number)))
?\n))))

I'd like to make it look even better.

>implying that is an indian accent
kys

Common Lisp is better.
(defun fizzbuzz ()
(loop for n to 100
for res = (concatenate 'string
(when (zerop (rem n 3)) "Fizz")
(when (zerop (rem n 5)) "Buzz"))
if res do (print res)
else do (print n)))

How could I make a Grand theft auto mod that will run on my Ps4's ofw.

Would I need special programs?

I don't know much about this stuff, but I'm thinking about getting my game data, and finding a way to code a mod menu into it, putting the altered data on a USB, and overwriting the old on the Ps4. I don't know how that'd work, or if it'd even work.

But is it possible?

>second generation poo in loos
even worse

How to wrire baremetal C programs for x86 or x86_64 processor?

>(loop for n to 100 for res =
Disgusting. This isn't prefix. It looks more like English than Lisp.

>check out this faggot's channel
>liked videos: le current year man and college>humor

>
FFS, that is not an indian

also, you are not in the right thread
>>Sup Forums
>>Sup Forums

the faggot is making a good point tho

Fine.
(defun fizzbuzz ()
(do* ((n 1 (1+ n))
(res (concatenate 'string
(if (zerop (rem n 3)) "Fizz")
(if (zerop (rem n 5)) "Buzz"))))
((= n 100))
(if res
(print res)
(print n))))

Excuse me I have a question

>FFS
>can't link to other boards

Can you do a FizzBuzz in C++?
Until then fuck off

right right...

What I know how to do is irrelevant.

I asked a question about whether the basic method I have thought up is possible.

Elisp has wrappers for CL stuff, but I wanted to iterate through a list like that to use the properties of an empty list.

Never mind, doesn't work. res is never nil. Here's another approach, however ugly:
(dotimes (i 100)
(format t "~%~[~[FizzBuzz~:;Fizz~]~:;~[Buzz~:;~D~]~]"
(rem i 3)
(rem i 5)
i))

>tfw (format) in elisp has format strings just like in printf()

Hi guys,

Sorry to bother you with this, but (in/with Docker) is it better to:

>contain scripts (e.g the Rails skeleton) in "open" "volumes" so I can edit them from outside the container and edit them whenever needed
or
>contain scripts in the container image itself, inaccessible from the host and rebuild the whole image every time

Sure I can still access the files from the host both ways but the second one is a little harder.

Also, if the first one, how should I move around the separate volume if using dockerhub or github or something?

>write a program
Literally just use something like Comodo One.

Working on a semi-golfed, but not obfuscated Hangman.

An user was saying he had a goal of 25 lines, so I thought I'd shoot for close to that, without cheating and putting more than one statement per line.

Just need to get the stickman graphic in and work on formatting. I have a feeling that's going to blow my line goal away.

>no ascii hangman
dropped

Working on it, friend.

why are people hating on atom anyways?
downloaded it a few days ago and its honestly a better version of emacs

Atom is good, but VSCode exists.

>tfw I got the max possible score of my country (France) for my programming exams

tell us about the exams, jan pierre

Started to learn programming. Is there any website which gives you some programming assignments or some tasks to create small time programs?

rosetta code for example

meh
i feel like extension support is still too immature in comparison
but yeah, the debugger and better intellisense are pretty great
has potential but will take time

help guys

better-dpt-roll.github.io/

I am too ashamed to talk about it was JAVA. Basically it was multiple choice questions in the first part then create some bullshit programs in the second one (only pen and paper allowed). Hopefully I'll be able to go back to Haskell once I am done with this bullshit and I get a job.

>Haskell
>job

Possible, but not probable.

>some bullshit programs
like what

Create JFrame GUI with listeners, menu, layout and basic math operation (enough to confuse retards).

Implementing stack, queue, linked list from scratch

I/O operations on text files and error handling.

Basically all you need to become comfortable drone in a cubicle.

at least it's practice oriented and you should be happy about your perfect score

>Basically all you need to become comfortable drone in a cubicle.
oh boy, someones in for a rough wake up call

Well I am learning J2EE, servlets and Spring on my own. Enlighten me what else would be useful to learn?

Covariant return types

ASCII man added

he is not currently hanging, but his parts get removed as you fail

I'm actually curious what a C solution would look like.

Is the big dick playa here to enlighten us?

the solution is that you have all the states as strings and switch between them as the game progresses

much easier than removing parts

>download visual studio community 2015
>download c# e-books
What am i in it for?

>state

>you have all the states as strings
That's a fuckton of lines and extra data within the program.

I'm going for semi-golfed, without obfuscating.

>What am i in it for?
I don't know, you tell us.

It's an easy language to program in. What do you want to do with it?