[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 326
Thread images: 26

File: 1485400515381.png (499KB, 800x415px) Image search: [Google]
1485400515381.png
499KB, 800x415px
http://www.strawpoll.me/13008444

Previous thread: >>60502997

What are you working on, /g/?
>>
Ban C
https://github.com/torvalds/linux/commit/657831ffc38e30092a2d5f03d385d710eb88b09a
>>
https://www.youtube.com/watch?v=jXhXDzyRH_A
>>
>>60506490
Obot is ANGRY (No pronouns). What the fuck is this train wreck?
>>
>>60506490
Shes anti-black? But she is black!
>>
File: yukari_disgust.png (29KB, 287x201px) Image search: [Google]
yukari_disgust.png
29KB, 287x201px
>>60506490
So this is the power of diversity... wow...
>>
anyone have any good resources to recommend for an in-depth look at python for programmers? ie not teaching hello world, but more about the language itself from a higher level
>>
I don't understand this

void update() {
static auto startTime = std::chrono::high_resolution_clock::now();

auto currentTime = std::chrono::high_resolution_clock::now();
float time = std::chrono::duration_cast<std::chrono::milliseconds>(currentTime - startTime).count() / 1000.0f;

// ...
}


The startTime doesn't change after the first time the method is called?
>>
>>60506827
Local variables declared as static are only allocated once and retain their value for the duration of the program unless it's changed.
>>
/dpt/ if I wear a cute black shirt will I program good?
>>
>>60506827

startTime is static, so it should be initialized when the program starts, and never again.
>>
>>60506866

Clothes do not make the programmer. Where whatever is comfortable.

If you want to become a good programmer, write programs, and read the source to other people's programs.
>>
>>60506911
don't listen to this troll, thigh-highs are a MUST if you want to kode anything good.
>>
>>60506911

>Where
WEAR*

Fuck I hate typos. Also, fuck cooldowns for posting, and cooldowns for deleting posts. I was having a good day and then I misspelled a word on the Internet.
>>
>>> for i in range(1, 101):
... if i % 3 == 0: sys.stdout.write('fizz')
... if i % 5 == 0: sys.stdout.write('buzz')
... if (i % 3 != 0) and (i % 5 != 0): sys.stdout.write(str(i))
... sys.stdout.write('\n')
...
11

1
21

1
fizz4




uhh guys
>>
>>60506922
I thought it was the cross-dressing aspect that was important? In which case thigh highs are no good for me.
>>
>>60506927
You have to understand how this is for me. I've written every bug, I've fixed every bug. I've designed every language, I've ruined every language.
>>
>>60506669
>But she is black
Ummm, no sweetie, just beaceuse zxe looks like an african-american doesnt mean zxe identifies as one, i mean i know that this is literally /gpol/ now but can you like not just assume things like that, its not helping anyone and your probably going to die alone
>>
>>60506859
>>60506886
nice. thanks.
>>
>>60506970
emem obot doesn't have pronouns you shitlord, you refer to emem obot as emem obot
>>
>>60507018
meme robot
>>
>>60506928

Hrm... if I type this into a python3 repl, I can duplicate this behavior. However, if I save this to a file and run python3, I get the correct behavior. If I run it on repl.it, whether I run the script or one line at a time, the correct behavior occurs.

Sounds like a bug in the python3 repl then?
>>
>>60507106
i guess so. is there any other way to print without new lines?
>>
root.grid_rowconfigure(2, weight=1)
root.grid_rowconfigure(3, weight=1)
root.grid_rowconfigure(1, weight=1)
root.grid_columnconfigure(1, weight=1)
root.grid_columnconfigure(2, weight=1)
root.grid_columnconfigure(3, weight=1)
root.grid_columnconfigure(4, weight=1)
root.grid_columnconfigure(5, weight=1)


Is there a less verbose way of doing this
>>
Some of my functions return an error code, and return variables through passed reference variables. Is this bad practice?
>>
>>60506970
obvious bait is obvious
>>
>>60507087
>meme
>>>/v/
>>
>>60506928
Shit tier fizzbuzz

not

for i in range(1,101):
if i % 3 == 0 and i % 5 == 0: print('fizzbuzz')
elif i % 3 == 0: print('fizz')
else: print('buzz')
>>
>>60507286
Python3 with Tkinter btw
>>
>>60507310
nice meme you've got there
>>
>>60507352
>meme
>>>/v/
>>
>>60507362
nice meme you've got there
>>
>>60506928
>>60507323
Receive communion my children, as I present: The Fizzbuzz of the Christ

for i in range(1,100): print("fizzbuzz"[i*i%3*4:8--i**4%5] or i)
>>
>>60507293
no, unless you're intentionally going against the standard language/project way of reporting errors. That's a pretty typical way of reporting errors in languages like C.
>>
>>60507369
see >>60507362
>>
>>60507286
for i = 1; i <= rowcount; ++i
root.grid_rowconfigure(i, weight=1)

for i = 1; i <= columncount; ++i
root.grid_rowconfigure(i, weight=1)
>>
>>60507395
see >>60507369
>>
>>60507406
second should have been columnconfigure
>>
File: .jpg (16KB, 300x300px) Image search: [Google]
.jpg
16KB, 300x300px
I think I want to write a bittorrent tracker but, I only know python and my implementation would be slow as ass because python.
Should I learn C first or what?
>>
>>60507323
don't call us, we'll call you
>>
Redpill me on Google Amp, /dpt/
>>
>>60507352
you missed the joke
>meme robot
i impersonated the meme robot specifically to reply to you
ask and ye shall receive
>>
>>60507419
Does this whet your appetite any?

#include <stdio.h>
#include <stdbool.h>

int main(int whatever, char **fuck_you) {
for (unsigned int i = 1; i <= 100; ++i) {
bool printed = false;

if (i % 3 == 0) {
printf("Fuck");
printed = true;
}

if (i % 5 == 0) {
printf("Butt");
printed = true;
}

if (!printed) {
printf("%u", i);
}

printf("\n");
}

return 0;
}
>>
>>60507436
I'm still missing it
>>
>>60507447
i'm not saying your code wasn't tryhard enough, i'm saying you're an idiot and it doesn't even pass the eyeball test to be a functioning fizzbuzz program
>>
File: Screenshot.png (21KB, 976x379px) Image search: [Google]
Screenshot.png
21KB, 976x379px
Someone must really like rust.
>>
>>60507495
I'm not the Python poster.
>>
void set_int(int* var, int val) {
while (*var > val) ++*var;
while (*var < val) --*var;
}
>>
>>60507498
hey man rust is a fun game
>>
>>60507498
nah you just came across like an aspie, and people knew that answering that way would make you lose your nut. see the similar poll i made minutes before you made yours with the opposite results
http://www.strawpoll.me/13008435/r
>>
Write your own Sin and Cos in the language of your choice
>>
>>60507415
do it in python first retard. If you cant do it in python there is no way you will do it in C.
>>
>>60507528
prove it
>>
File: 噗.jpg (56KB, 408x491px) Image search: [Google]
噗.jpg
56KB, 408x491px
r8 me fizzpuczy
int[2] euclidean(int x,int y)
{
int q = 1;
loop:
int r = y - x*q;
if(r > x)
{
q = q + euclidean(x,r)[0];
goto loop;
}
else
{
return {q,r};
}
}


int truncate(int x)
{
int n = 1;
while(euclidean(x,n*10)[0] > n*10)
{
n++;
}
return x - euclidean(x,n*10)[1]
}

int coprime(int x, int y)
{
if(x < y)
{
int r = euclidean(y,x)[1];
coprime(x,r);
}
if(x == 1 || y == 1)
{
return 1;
}
else
{
return 0;
}
}

void fizzbuzz(int x)
{
double pi = 4.0 * atan(1.0);
int n = truncate((int) (pi * 10)) / 10;
double sum = 0.0;
for(int s=1;s<10000;s++)
{
sum += 1/s^2;
}
int m = truncate(((int) sum ) * 4) - 1;
if(euclidean(x,n*m)[1] == 0)
{
print "phyzze-boughczy";
}
if(euclidean(x,m)[1] == 0 && not(euclidean(x,m*n)[1] == 0))
{
print "boughczy";
}
if(coprime(n,m) == 1)
{
if(euclidean(x,n)[1] == 0 && not(euclidean(x,m*n)[1] == 0))
{
print "phyzze";
}
}
else
{
if(euclidean(x,n)[1] == 0 && (not(euclidean(x,m*n)[1] == 0) && not(euclidean(x,m)[1] == 0)))
{
print "phyzze";
}
}
}
>>
>>60506490

isometric voxel engine, every pixel on screen is 1 voxel. everything is inter-sectional and has full 3d geometry, dynamic normal/depth mapping and a tool to take 2d pixel art and turn it into 3d voxel geometry

just trying to get some motivation to write a physics engine for it, and see if i can render at 1920x1080 without many issues. currently rendering at 960x540 and scaling by 2 due to render/data limits
>>
>>60507293
Its the convention on c, although some libraries will have the error code as one of the parameters passed as pointer. The opencl standard api does it both ways.
>>
fizzword = fn
(0, 0, _) -> "FizzBuzz"
(0, _, _) -> "Fizz"
(_, 0, _) -> "Buzz"
(_, _, n) -> n
end

fizzbuzz = fn (n) ->
fizzword.(rem(n, 3), rem(n, 5), n)
end

IO.inspect Enum.map(1..100, fizzbuzz)

>>
>>60507559
Sounds like reasonable advice.
Thanks, anon.
>>
Anm I a Pointer?
>>
File: .jpg (9KB, 238x251px) Image search: [Google]
.jpg
9KB, 238x251px
>>60507550
>with the opposite results
>>
Just going through with the Theano logistic regression tutorial
>>
>>60507648
Did you learn anything useful? Or are you another one of those "I want to learn ML because it's the hottest new fad" fucking tryhards?
>>
>>60507414
thank-you desu
>>
>>60507195

Assuming Python3...
print("hello", end="")
>>
>>60507692
I want this only in Malbolge.
>>
>>60507679
No, Theano is so much more than ML, been thinking of writing a NLP optimizer later
>>
File: googleio.png (283KB, 673x425px) Image search: [Google]
googleio.png
283KB, 673x425px
Is Google basically an overhyped and overblown ad network? Everyone is talking about how hard it is to get a job here, but what do those geniuses actually do? They couldn't even make a new modern language for their OS, JetBrains made it

Wave, Glass, +, Go, Dart etc. Everything turns out to be a shite, yet google is still rich af, what kind of jewery is that?
>>
>>60507754
well at-least their phone battery is charged, i was prepared to give an autistic REEEEEEE
>>
>No pronouns
Nah, you've got pronouns. I'm not talking to you like I'm a cat monster from fucking oblivion
>>
Nice little things about Rust: easy handling of endianness built-in with from_be, to_be, from_le, and to_le methods on integral types. These get inlined, so it's effectively equivalent to a bswap or nop operator in the language.
>>
>>60507754
Don't forget the absolute most important and useful thing about them, and their defining feature: you can type in almost anything on their website and get like at least 60% of all the times anyone has ever brought that thing up.
>>
Is there a word for inability to complete a project?
>>
>>60506928
>>60507323
>>60507375
Is this the fizzbuzz thread?

for n in {1..100}; do
fb=
(( n % 3 )) || fb=fizz
(( n % 5 )) || fb=${fb}buzz
echo ${fb:-$n}
done
>>
>>60507876
Why would endian matter? Just do stuff how Plan 9 does it.
>>
>>60508088
It's very important when dealing with networking or any binary files in general.
>>
File: 1446375648303.png (463KB, 1070x601px) Image search: [Google]
1446375648303.png
463KB, 1070x601px
>Project leader fell for the rust meme
>>
>>60506490
I go to American University and let my tell you that this doesn't surprise me. This campus is filled with so many entitled piece of shits that want their safe space.
>>
>>60507998
cucked
>>
>>60508202
kek
>>
>>60508088

Host byte order and network byte order may (note: almost always) differ.
>>
never programmed before. what do?
>>
>>60508315
continue not programming
>>
>>60508324
what if i want 2 start pr0gramming?

23 btw
>>
>>60508332
then start programming
>>
>>60508139
>meme
>>>/v/
>>
>>60508346
how
>>
>>60508350
>>>/v/
>>>/trash/
>>
>>60508359
start by opening your text editor
>>
File: SHOW ME THOSE TEETH.png (278KB, 470x440px) Image search: [Google]
SHOW ME THOSE TEETH.png
278KB, 470x440px
>>60508359
Read a book
>>
>>60508359
Download a book
Read it
>>
Anybody has experience with ENet? I am trying to decypher what ChannelLimit means here, but the only pieces of information I have are:

>size_t ENetHost::channelLimit
>maximum number of channels allowed for connected peers

>channelLimit the maximum number of channels allowed; if 0, then this is equivalent to >ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT

I am trying to port the old Cube Engine code base to the newest libraries for fun, but this documentation is not helping.
The old definition of the function enet_host_create did not have the channelLimit parameter.
http://enet.bespin.org/group__host.html#ga5567a95d7a45521dc9cba93a9066c940
>>
>>60508359
Good luck :)
>>
Tabs > spaces.
>>
>>60508332
http://ddili.org/ders/d.en/
>>
File: asuit.jpg (113KB, 634x968px) Image search: [Google]
asuit.jpg
113KB, 634x968px
Camel case was a mistake underscores are superior
>>
>>60508491
muh keystrokes
>>
>>60508315
Study Machine Learning. If you cannot understand Machine Learning, then you are not cut out to be a programmer.
>>
>>60508520
>muh
>>>/v/
>>
File: 1485064170884.jpg (218KB, 1280x960px) Image search: [Google]
1485064170884.jpg
218KB, 1280x960px
just paid $77 i don't have for an arduino started kit and a separate book on arduino

my stomach is literally growling as i type this, my internship money doesn't come in until june
>>
>>60508531
>Machine """Learning"""
>>>/v/
>>
>>60508520
muh strokes
muh--
m--
.........
MUH STROKES
..............
MUH STROOOKES
MUH STROOOOOOOOOOOKES
MUUUUHHHHHHH
STROOOOOOOOOOOOOOOOKES
>>
@
>>>/b/
>>
I just finished writing a webscraper in pure C, AMA. Also shoutout to the guy in the last thread that said it wasn't possible
>>
r8 muh m8kefile
.RECIPEPREFIX = >
.PHONY: clean

CC := g++
CFLAGS := -c -g
LDFLAGS := -lSDL2 -lSDL2_image -lSDL2_ttf -lSDL2_mixer

PROJPATH := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
SRCDIR := $(PROJPATH)src/
OBJDIR := $(PROJPATH)bin/
DEPENDFILE := $(SRCDIR).depend
EXECUTABLE := $(OBJDIR)main

HEADERS := $(shell find $(SRCDIR) -name \*.h)
SOURCES := $(shell find $(SRCDIR) -name \*.cpp)
OBJECTS := $(patsubst $(SRCDIR)%.cpp,$(OBJDIR)%.o,$(SOURCES))

all: $(EXECUTABLE)
main: $(EXECUTABLE)
objects: $(OBJECTS)
depend: $(DEPENDFILE)

$(EXECUTABLE): $(OBJECTS)
> @echo Linking...
> @$(CC) $(OBJECTS) $(LDFLAGS) -o $(EXECUTABLE)

-include $(DEPENDFILE)

$(DEPENDFILE): $(HEADERS) $(SOURCES)
> @echo Checking dependencies...
> @rm -f $(DEPENDFILE)
> @$(CC) -MM -I $(SRCDIR) $^ > $(DEPENDFILE)

$(OBJDIR)%.o: $(SRCDIR)%.cpp
> @echo Compiling $(strip $(subst $(SRCDIR),, $<))...
> @mkdir -p $(dir $@)
> @$(CC) $(CFLAGS) -I $(SRCDIR) $< -o $@

clean:
> @echo Cleaning up...
> @rm -f $(DEPENDFILE) $(OBJECTS) $(EXECUTABLE)

>inb4 "he still has to use makefiles"
>inb4 "cmake is better"
>inb4 "sepplesfag"
>>
>>60508638
super jealous desu
man i can't wait to not be able to afford to feed myself, i'm way too fucking fat
>>
I'm creating a program that writes to and reads from a database, I want to force a particular value in my database to be one of a set amount of 3 character combinations, a state abbreviation.

Do I implement this in my sql or client side? And if so, how do I do it in SQL?
>>
>>60508871
Why do you make the dir in your compilation recipe?
>>
>>60508871
>.cpp
It's crap.
>>
>>60508906
You definitely want to implement that database side. There are a handful of ways to do it. If you already know what all your possible values are, and there aren't many -- which is what it sounds like -- then I'd recommend making your column an enum.
>>
>>60508922
>>inb4 "sepplesfag"
haha i already inb4'd you so ur fukt
>>60508917
so that if i make a new directory source-side i don't have to be arsed with manually making it object-side
>>
>>60508937
Jesus christ, how fucking new are you?
>>
>>60508833
for what fucking purpose, just use python or even electron lol
>>
>>60508952
>he doesn't know "inb4" means now you can't use that argument for some reason
how new are YOU?
>>
>>60506669
>she
triggered
>>
File: the buttmad.png (109KB, 416x451px) Image search: [Google]
the buttmad.png
109KB, 416x451px
>>60508988
>mfw this thread is more triggered about Emem Obot than Emem Obot is about anything
>>
>>60508931
I'll look into enums, I'm still learning database design and implementation so I haven't heard of them before.

I have eight possible combinations, six of which are 3 characters, the other two are 2 characters.
>>
>>60508997
An enum would be pretty good for that. It stands for "enumerated," and it's pretty much a way of defining your own type whose values are restricted to a small number of named constants you specify.
>>
whats the definitive guide to working with files on c? text, video whatever
>>
>>60509031
This PDF, starting on page 278
http://www.open-std.org/jtc1/sc22/WG14/www/docs/n1256.pdf
>>
>>60509031

fopen
fread
fwrite
fclose

http://en.cppreference.com/w/c/io
>>
>>60509053
(Page 278 of the PDF itself, I mean. Page 266 if you go by printed page numbers)
>>
Daily reminder you can't do everything in C like some people said here.

Thanks but stop spreading lies.
>>
>>60508892
I'm in skelington mode because I'm too fucking lazy to go grocery shopping
I fucking hate that
>>
>>60509066
>can't
That's an exaggeration.
>>
>>60509066

Any program that can be made, can be made in C. You might not have access to certain higher level abstractions, but they aren't wholly necessary.
>>
>>60509053
If you're going to post a standard draft, you could at least post the latest one:
www.open-std.org/jtc1/sc22/WG14/www/docs/n1570.pdf
>>
>>60509071
This is another thing i'm counting on when i'm finally able to move out
If there's one thing i'm any good at it's being too fucking lazy to take basic care of myself, i mean that's how i got like this to begin with
Literally the only thing i do for myself is eat, can't wait until even that's too much of an ordeal to bother with
Pretty much the only thing i'm going on living for
>>
>>60509066
>you can't do everything in C
C is turing complete, so in principle you CAN do everything (that a program can do) in C.
>>
>>60509118
>you CAN do everything ... in C
>buying gf
>>
>>60509110
yeah but if you're just gonna order shit food it'll be worse. I like cooking good food and my gf just go by shit I tell her but when she isn't her I'm just not eating so much
>>
what personal project / professional experience / whatever elevated your skills to the next level? I'm sure at some point all the skilled programmers in here were shit, and then they weren't so shit.
>>
>>60509130
fuck i forgot ordering things is a thing
shit
ass

welp time to commit sudoku
>>
>>60506490

I am too old and dumb. I don't understand half of those words in OP pic.
>>
>>60509179
You don't need to, you just have to feel triggered.
>>
>>60509179
>I don't understand
>You don't need to, you just have to feel triggered.
4chan in a nutshell everyone
>>
>>60508871
> @$(CC) $(OBJECTS) $(LDFLAGS) -o $(EXECUTABLE)
I will never understand why not
> @g++ $(OBJECTS) -lSDL2 -lSDL2_image -lSDL2_ttf -lSDL2_mixer -o $(EXECUTABLE)
instead
>>
>>60509203
Why would 4chan be in a nutshell?
>>
>>60509224
It's so you can easily modify the variables later. All of the shit you might need to modify is at the top of the file. You don't need to modify the rules themselves, possibly in multiple places.
>>
>>60509179
Same. But I think that kind of shit only exists in burgerland.
>>
>>60509130
>>60509152
oh wait there might still be hope:
1) it's not like i can afford to just order things 24/7
2) i don't even want to, i want to just stop eating for as long as it takes even if it creates other health problems and/or kills me but i can't because temptations are everywhere all the time, moving out will fix that because i'll no longer be forced to be around them
3) if i can't do it at least i'll have the privacy to kill myself without anyone who cares much noticing
4) why the fuck am i thinking out loud about this here this is /g/
5) C is a meme language
>>
>>60509268
>meme
>>>/v/
>>
>>60509268
>listing 5 things
(You)'ve earned it kid.
>>
File: eggy.jpg (59KB, 500x526px) Image search: [Google]
eggy.jpg
59KB, 500x526px
>>60509289
> >>>/
>>>/trash/
>>
>>60509292
just ignore him. it's some gatekeeping autist that probably doesn't even program.
>>
>>60509290 (You)
>responding to a list of 5 things
>>
>60509299_(You)
>giving (You)s
Step it up
>>
meme
>>
>>60509268
>man admits to being a fatty and then threatens to kill himself if he can't muster the discipline to go ana
I'm out, this got too real too fast
>>
>>60509066
>Turing complete buddy
>>
File: 1460027108094.png (29KB, 300x300px) Image search: [Google]
1460027108094.png
29KB, 300x300px
What math should I learn if I want to create/program an anime girl?
>>
>>60509380
linear algebric
>>
>>60509380

Well, learning algorithms are based heavily on linear algebra and probability theory.
>>
>>60509380
Do you know how to program yet?
>>
How do I place a trap at the SSHFS mount command when Ctrl+C is invoked? pls halp!!!

#!/bin/bash

{ ping -c 1 192.168.1.1 &> /dev/null ; }
declare -x varPingCode=$?

{ mount | grep /tmp/SSHFS &> /dev/null ; }
declare -x varMountCode=$?

if (( $varPingCode == 0 && $varMountCode == 1 ))

then

{ mkdir -p /tmp/SSHFS && sshfs [email protected]:/ /tmp/SSHFS ; } ## place trap here

elif (( $varMountCode == 0 ))

then

{ fusermount -u /tmp/SSHFS &> /dev/null && rm -R /tmp/SSHFS ; }

elif (( $varPingCode == 1 ))

then

{ echo ϟϟ卐ϟϟ ; }

fi
>>
>>60509380
Graph theory to model the neural network
Graph theory also to synthesize language
Trig and physics to model the animation skeleton
Genetic algorithm to get it moving naturally and probably also to operate the neural network
>>
>>60509401
Already started learning that. But it can't be enough.
>>60509444
Yes.
>>60509460
Thanks.
Is there anything more specific I should learn to give her a high IQ?
>>
>>60509380
>Math
learn magic instead
>>
>>60509484
Math would be a prerequisite for that.
>>
Another MySQL question, I want to enforce only positive values for my data, I used unsigned but as 0 is neither positive nor negative then this won't work.
>>
File: dpt.jpg (185KB, 800x547px) Image search: [Google]
dpt.jpg
185KB, 800x547px
>>
>>60509482
Sorry, I can pretty much guarantee she won't have a high IQ. At best you'll get a convincing microcosm of sentience; she won't be as sentient as a human being, but the tiny degree to which she actually is sentient will be recognizable, and will be considered charming for its small scale attempt at imitation of real humanity.

I might argue this is more desirable in an anime girl than real sentience and intelligence would be, even if it could even be done at this time. Anime girls don't look entirely real, so why should they behave entirely real, either? Wouldn't it be more *cute* for her to be kind of stupid / not fully mentally human?
>>
>>60509516
mysql, being shit, doesn't support check constraints, so you should probably use a trigger
http://mysqlserverteam.com/new-and-old-ways-to-emulate-check-constraints-domain/
>>
>>60509460

Takes a bit more than graph theory to do neural networks and natural language processing.
>>
>>60509574
I'm using postgres which does support check, awesome.
>>
Anyone know of a good tool for spellchecking and autocorrecting a massive document? doing some nltk corpus stuff and am getting a little tripped up on this
>>
>>60509690
microsoft word
>>
Playing around with C#, apparently there's a websocket server built in .NET Core, going to make a cool chat and post for you guys to try to destroy
>>
>>6050969
vi doc.txt
:setlocal spell spelllang=en_us
>>
File: 1485262515835.jpg (76KB, 1065x859px) Image search: [Google]
1485262515835.jpg
76KB, 1065x859px
>>60509823
>spelllang=en_us
>>
File: test (6).jpg (212KB, 645x960px) Image search: [Google]
test (6).jpg
212KB, 645x960px
>>60509488
This. In order to break rules you need to learn how those rules work first.
>>
>>ERROR:  type "mytype" already exists
>>ERROR: type "mtype" does not exist


I'm getting both of these errors at the same time. wtf is this trickery
>>
>>60508491
>his language cares about case
>his language can't use dashes in function name

(fuck-your-shit-nigger)
>>
Common Lisp newfag here, what the fuck is the use of fill-pointers in arrays?
>>
>>60509926

Well, it means you both tried to redefine a type called mytype, and you tried to use a type called mtype that was never defined. Seems simple to me.
>>
>>60509926
mYtype vs mtype
>>
>>60509981
>>60509988

Didn't even notice the typo even after copying over here
>>
>>60509981
How's your thesis going, fag.
>>
>>60509974
It's just the number of elements currently stored in an array. To keep track of the current size and whatnot.
>>
>>60506490
that picture makes me feel dumber for even just having looked upon it
>>
>>60510080

It's not a thesis, it's a research paper (although it is nonetheless what is going to get me a master's degree). I'd say it's been coming along rather well and should be ready to submit by Friday, which is the deadline.
>>
>>60510127
Post it here.
>>
>>60510127
What's it about
>>
>>60509943

Case insensitivity is a cancer.

>>60510132

1. It's not finished.
2. I don't want my real name to be known on /g/.
3. My advisor has also contributed some work to this paper, and I do not know how he would feel about my posting it around on 4chan.

I will be posting a picture of my master's degree diploma when I receive it, however, with the name blurred out.
>>
>>60510127
And then show us your dick
>>
>>60510147
What was the topic you finally ended up doing?
>>60510092
Yeah, but what about this.
(setq A (make-array 4 :initial-contents '(1 2 3 4) :fill-pointer 4))
#(1 2 3 4)
[3]> (fill-pointer A)
4
[4]> (setf (fill-pointer A) 3)
3
[5]> a
#(1 2 3)
[6]> (length a)
3
[7]> (setf (fill-pointer A) 4)
4
[8]> a
#(1 2 3 4)

Why isn't there a nil where the 4 is?
>>
>>60510147
Why do you need sensitivity?
You don't go around naming functions with the same letters but different cases, do you?
>>
>>60510141
>>60510168

A convincing ICS honeypot.

>>60510152

No.
>>
>>60510147
Stop being a pussy. Just post it.
>>
>>60510179

Not typically, no. That doesn't make case insensitivity a good thing. It allows for inconsistent usage of identifiers.

>>60510185

I have stated my reasons for not posting it, and I will not budge on them.
>>
>>60510196
Nobody worth respecting is inconsistent though.
>>
>>60510168
That index was already filled by the 4, but you just set that region of the array to be inactive. Thus, almost no array-related function will "see" the 4. Check https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node162.html.
>>
>>60510168
Continuing off of >>60510242 and your example,
CL-USER> (vector-pop *a*)
4
CL-USER> (length *a*)
3
CL-USER> *a*
#(1 2 3)
CL-USER> (setf (fill-pointer *a*) 4)
4
CL-USER> (length *a*)
4
CL-USER> *a*
#(1 2 3 4)
>>
File: lamportscreener.png (42KB, 525x690px) Image search: [Google]
lamportscreener.png
42KB, 525x690px
>tfw created a program for quantum-secure cryptographic signatures

https://pastebin.com/DgxccNih

Here are the functions:
>genKeys()
>sign(messageHash, PrivateKey)
>verify(publicKey, messageHash, signature)

Here is my public key:
0d5485c6fa55bbf397dec3bf90eb2da75007b748865a918b0407636935591e5f
>>
>>60510334
What I read from this is that vector-pop doesn't actually pop, but just changes the active region of vector.
>>
>>60510347
What do those buzz words mean?
>>
>>60510357
Yeah, that kind of surprised me. I guess it's just a synonym for (setf (fill-pointer vec) (1- length vec)).
>>
>>60510383
Wait, so (length vec) is O(1)?
>>
>>60510410
That seems like a natural conclusion, but I don't have any literature to back that up.
>>
>>60510410
Actually, found this: https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node142.html
Appears correct for vectors.
>>
Danm, the Scheme IEEE standard is only 70 pages.
>>
Common Lisp is to Lisps as C++ is to C senpai.
>>
fuck haze & his dumb language
captcha: Calle Calle
>>
File: 1471444989703.jpg (79KB, 600x720px) Image search: [Google]
1471444989703.jpg
79KB, 600x720px
>>60510673
>get the most common captcha twice

>post about it
>>
>>60510364
It's the "short public key" version of this:

https://en.wikipedia.org/wiki/Lamport_signature
>>
File: dlang_chan.jpg (139KB, 470x545px) Image search: [Google]
dlang_chan.jpg
139KB, 470x545px
Threadly reminder that dlang-chan is not dead; she's going to have her GC tumor removed (eventually); and she's super duper cute and easy to prototype in! Say something nice about her, /dpt/!
>>
File: tcpl_spin.webm (764KB, 1080x1920px) Image search: [Google]
tcpl_spin.webm
764KB, 1080x1920px
Is C the most autistic programming language?
>>
In an interview i was asked to create a memory leak in a c# app.
How the fuck do i do that? Garbage collector raped all of my holes so hard during that i won't be able to sit, swallow, or pee for a month.
>>
>>60510773
>Is C the best programming language?
yes
>>
>>60510961

P/Invoke malloc.
>>
>>60506490
Rate my fizzbuzz /10

double counter;
double upper;
double mod15;
double mod3;
double mod5;

states

start
print "Limit: ";
input upper;
jumpif upper < 1 err;
jump loop;
end

err
print "Limit must be at least 1\n";
jump start;
end

loop
counter = counter + 1;
jumpif counter > upper fin;
mod15 = counter % 15;
jumpif mod15 = 0 fizzbuzz;
mod3 = counter % 3;
jumpif mod3 = 0 fizz;
mod5 = counter % 5;
jumpif mod5 = 0 buzz;
printvar counter;
print "\n";
jump loop;
end

fizzbuzz
print "FizzBuzz\n";
jump loop;
end

fizz
print "Fizz\n";
jump loop;
end

buzz
print "Buzz\n";
jump loop;
end

fin
end

>>
>>60506490
Writing an ImageJ-like image processing application in C++ (Qt). I've got the basic stuff like blur and edge detection down, now I'm doing the sharpening filter and planning on doing the Fourier and Radon transforms later.
>>
>>60511155
>not declaring wariables like:
>double counter,upper,dmid13,mod3,desomorprine
Why?
>>
>>60511298
>C++
>Qt
>2017
It's not meme-technology thread. Go learn C11 and GTK3.
>>
>>60511336
>GTK3
I really wish there was a GUI toolkit that isn't complete crap.
I hate having to use anything which has a dependency on GLib.
>>
>>60511336
Qt is by no means pretty but suggesting gtk is just retarded. The gtk devs are incompetent. The only reason gtk survives is due to some reason people insist on using gnome.
>>
>>60511356
Ok, if you don't like GTK3, you can use anything else.
For example EFL - good GUI toolkit.
GLFW - tiny library - perfect choice for small app like yours.
>dependency on Glib
Everything depends on it.
>>
>>60511336
>not using SDL and C11 to create your own toolkit and using that
step it up, senpai
>>
>>60511371
GTK app are great, Qt on my system not only looks like shit, but performs bad.
>>
>>60511397
I wasn't the original anon. I was just saying that I fucking hate GLib. I hate all of the "do everything" libraries, really.
>Everything depends on it.
There is plenty of shit that doesn't. It just gets forced into all of the GNOME shit.
>>
>>60511409
SDL2 really will be much better than GTK or QT5.
But perfect choice - GLFW.
>>
>>60511420
Every CLI (command line interface) depends on it.
>>
>>60511436
Why not vxwidgets?
>>
>>60511446
Your sentence doesn't make sense. Also, I just want to make sure, I'm not talking about glibc, the GNU implementation of the C standard library, I'm talking about GLib, which is the OOP/bloat library that GNOME uses for all of their shit.
>>
>>60511447
It doesn't supports Wayland Display Sever Protocol. Deprecated library.
>>
>>60511459
Oh, yes. but Qt also OOP-bloat.
Perfect tool for your tiny app is - GLFW + C11.
You don't need full C++ toolchain for such simple task.
>>
>>60511478
Again, I'm not the original anon. I'm not currently making anything which needs a GUI.
>>
>>60511478
>>60511490
I'm the original anon. I don't care about your faggy special snowflake C library russian poster. Fortunately my employers don't either. :^)
>>
File: Clisp_snapshot.jpg (76KB, 909x617px) Image search: [Google]
Clisp_snapshot.jpg
76KB, 909x617px
>>60511506
>learn LISP /g/ said
>open clisp
>see menorah
>>
>>60511553
Clisp is dead. You should be using SBCL.
>>
>>60506490
Having no pronouns is incredibly inconvenient.

It forces everyone to refer to you using your name every time they talk about you. It's like asking everyone to address you as 'Mr. Anon'.
>>
>>60511553
Are you CIA-nigger or something?
>>
>>60511478
>GLFW
Tell me more. I have to know opengl to actually do something useful outside creating windows right?
>>
>>60511591
Yes, but you don't need to do so much for simple image editor. GLFW does great job, app development much easier than pure opengl.
GLFW is a small C library that allows the creation and management of windows with OpenGL contexts, making it also possible to use multiple monitors and video modes. It provides access to input from keyboard, mouse and joysticks. The API provides a thin, multi-platform abstraction layer, primarily for applications whose sole graphics output is through the OpenGL API. While GLFW is very useful when developing multi-platform OpenGL applications, single-platform developers can also benefit from avoiding having to deal with kludgy platform-specific APIs.
>>
>>60506945
It doesn't actually matter what part of the agenderqueer fluidity spectrum you identify with, the only thing that matters is that you dress like a cute anime girl.
>>
C++ is an unreadable piece of shit

D is way better
>>
>>60509083
Can you clear the direction flag in C?
>>
>>60511655
Sure, I can say that one pile of shit is better than another pile of shit, but at the end of the day, it's still a pile of shit.
>>
>>60506886
>startTime is static, so it should be initialized when the program starts, and never again.

This is slightly incorrect:

memory for static locals is _allocated_ or w/e when the program starts but _initialization_ is deferred until the first execution of the function the static local lives in.
>>
>>60510147
But we know your name; it's "Ruby".
>>
>>60511575
>>60511553
You would be better off learning scheme/racket
>>
File: ayylmao.jpg (59KB, 339x339px) Image search: [Google]
ayylmao.jpg
59KB, 339x339px
>>60511655
>D is way better
Correct!
>>
>>60511446
This makes no sense.
>>
>>60511553
Nobody here told you to use CLISP. If they did, they were tricking you.

SBCL is the only answer for CL.
>>
>>60511669
asm volatile("cld");
>>
>>60511748
That's assembly, though.
>>
Help depetee i can't into sorting..... wat do?
>>
>>60508871
> CC := g++
What are you even doing? Use CXX for that.
>>
>>60511789
inline void clear_direction()
{
asm volatile("cld");
}
>>
>>60511792
git gud
>>
>>60511792
In Lisp, this is just
(sort '(2 4 3 1) #'<)
>>
File: who is this.jpg (282KB, 548x409px) Image search: [Google]
who is this.jpg
282KB, 548x409px
I'm bored.

I need a new programming project to work on. Any cool suggestions, /g/?
>>
>>60511800
That's assembly, though.
>>
>>60511816
Neural net that controls your house
>>
>>60511816
Strong AI.
>>
>>60511816
there are a few anons working on /g/tetris
>>
>>60511669
That shit has nothing to do with Turing Completeness.
>>
>>60511816
Loli AI that insults my tiny penis
>>
>>60511845
That's pretty much my point:
>Any program that can be made, can be made in C.
He phrased it VERY badly.
>>
In POSIX, how do I wait till the semaphore is *locked* (zero)?
I need an equivalent of SystemV's semop() with sops->sem_op = 0.
>>
>>60506490
Looking at some functional programming.
Can anyone explain to me:
1. why the fuck do we need closures?
2. how can we implement persistence?
>>
>>60511958
Can you elaborate on the questions?
>>
>>60511816
g_tetris
>>
Hi guys, if I'm using the python3 pycopg2 library for working with databases.

I've set my connection and cursor up and now I want to insert my data:

mysql = """INSERT INTO reply VALUES()"""
cur.execute(mysql)


How do you insert variables in string literals? I read that you aren't meant to concatenate as this is how SQL injections occur.

Say my table has attributes:

id : int
poster : string
date: date
genre : which is an enum in my database
>>
>>60511985
I'm guessing pyshit sql lib has a bind function for that. Read the manual.
>>
>>60511968
What is a real-world scenario where a closure is needed, and why would I use a closure over a normal function?

How can I keep data in memory, like objects?
>>
> No pronouns
My mind is so full of fuck right now.
How would that even work
>>
>>60511841
>>60511973
I hope this is some very difficult ruleset and not just tetris.
>>
>>60512005
1) A closure is simply a function that captures data from its environment.
It is not unlike a partially applied function.
(And partial application is very useful)

2) Assuming you mean pure FP, you generally don't do that except in cases where you need performance or do work with some concept like a database.
In pure FP, it is done in much the same way as it would be done imperatively, but encoded in a monadic data type.

For instance, in Haskell, the ST monad. (or IORefs in the IO monad)
>>
Thoughts on puralsight?
>>
>>60512010
just tetris
>>
>>60512008
"Obot went to the store and Obot put Obot's pencil in Obot's ass. "
>>
>>60512060
How do you address obot the first time you meet obot?
>>
>>60511322
The language does not yet support such advanced features, but soon it will
>>
>>60511887
bump
>>
File: wayland-screenshot.png (2MB, 4500x2531px) Image search: [Google]
wayland-screenshot.png
2MB, 4500x2531px
>>60511816
Write gentoofetch in C.
>>
>>60512113
thank you for what you are doing but c is obsolete now.
>>
>30GB
visual studio 2017 is THICC
>>
>>60512010
>>60512037
see
>>60501451
>>
>>60512137
you can choose features though
>>
>>60512458
>would you like to be able to use the mouse? Y/N
>Y
>+10GB
>>
>>60512137
>Emacs with all packages available on melpa =10gb
>Visual studio 2k17=30gb
5 GB visual studio + 25 GB of bill gates pics that he took while on shitting on toilet
>>
>>60512534
>shitting on toilet
that's how he got promoted to CEO of microsoft
>>
>>60506490
>capitalistic cisgender heteronormative patriarchal white supremacist systems
using words that complicated is ableist and triggering
>>
>>60512551
no that's nutella
>>
>>60508491
Good taste, in women and style as well
>>
>>60511993
sql = "INSERT INTO movie VALUES(('%s','%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s'));"
cur.executemany(sql, (movie_id, movie_title, director_first, director_last, genre, media_type,
release_date, movie_studio, retail_price, stock))


Been playing with it and reading the manual a bit but the above doesn't work. And nor does just cur.execute()
>>
>>60512617
Is there are reason why you put another pair of parenthesis around the initial one in the insert statement?
>>
>>60511816
Prove
P = NP for N =/= 1
>>
>>60512137
CLion: 200 MB
>>
>>60506490
>http://www.strawpoll.me/13008444
LOL some butthurt fag spammed the "i like rust" option
>>
>>60512649
I initially had each %s in one because I saw an example like that. Removed them and removed each ' ' and it works.
>>
>>60506490

I just finished writing an audio frequency spectrum visualizer in C++ and using OpenGL.
>>
>>60512133
Go fuck youself, useless hipster.
All your software dies with your memelanguage (rust, c++, haskell, swift, java,) .
>>
>>60508638
>get paid less than $10K per month
Try poo in the loo.
>>
>>60512133
this
C is obsolete

thousand year cinnameg reich
>>
>>60512967
>No new posts
Why it's obsolete?
>>
Is it a bad idea to allocate big objects on the stack?
>>
>>60513141

Depends on the stack size
>>
>>60513141
depends on how big the objects are relative to the stack size. you can set the stack size according to your needs.
>>
Keeping my smoking habit in check

and learning GO at the same time. Tell me why Go is so damn comfy?

Any comments? I plan store them in a json file and just marshal and unmarshal things

package main

import (
"fmt"
"time"
)

func Index(vs []History, t string) int {
for i, v := range vs {
p(v)
if v.habit_id == t {
return i
}
}
return -1
}

var p = fmt.Println

type Habit struct {
description string
created int64
id string
}

type History struct {
habit_id string
fulfilled bool
date int64
}

var Ledger []History

func (Ledger []History) info() {
p(Ledger)
}

func (a Habit) info() {
p(a.description, a.created)
}

func main() {
a := Habit{"Hello", time.Now().UnixNano(), "23a"}
r := time.Now().AddDate(0, 2, 3).UnixNano()
t := time.Now().AddDate(1, 2, 3).UnixNano()
d := Habit{"Poop", r, "22a"}
g := Habit{"Pee", t, "22c"}

b := History{a.id, true, time.Now().UnixNano()}
x := History{d.id, true, r}
y := History{g.id, true, t}
Ledger = append(Ledger, b)
Ledger = append(Ledger, x)
Ledger = append(Ledger, y)
p(Ledger[1])

}
>>
I have a bunch of

variable = input("")


I just need to check if the input is empty and if so, ask for it again.

Each statement asks a different question so I can't use a for loop to obtain the data.

Do I have to just write

while item_one not = ""
item_one = input("What is item_one?")
if item_one == "":
print("Invalid data.")


And have this for each item?

Or do I do

def isEmpty(item):
if item =="":
print("Invalid data")
return false
else
return true

while not isEmpty(item_one):
item_one = input("What is the data?")


And repeat that while loop for each data item?

Is there a better way to do this?

I just wrote that code up in this post so apologies if it isn't very clean.
>>
>>60509446
>{ ;} everywhere
Why the fuck man?
As for traps (not himegoto), you mean signal traps? Since a shell can only have one trap per signal, the trick I usually use is to wrap it all in a subshell

mkdir /tmp/SSHFS
( # start subshell
trap "rm -rf /tmp/SSHFS" EXIT # Triggered when the subshell exits; doesn't matter if it's on success or failure
# ... do things ...
) # closes the subshell; from here down, you can consider /tmp/SSHFS gone

And it can nest.
>>
>>60513414
The second option won't work because it will immediately return Invalid data assuming you have item_one set to "" to run the loop once.
>>
>>60513414
>def isEmpty(item):
> if item =="":
> print("Invalid data")
> return false
> else
> return true

you don't need the else
>>
>>60506490
>her name spelled backwards is Meme
which she is, actually, she's a meme gone wrong.
>>
>>60513484
Ah yes, do you know a solution to this, the other piece of code just seems clunky.

>>60513491
That I do not, thank-you. Can you see a solution to the fact that my error message will always display once?
>>
>>60513454
>>60513484

Also you will have to set the variable name beforehand each time which almost uses as many lines at the other version

item_one = ""
while not isEmpty(item_one)
item_one = input("what is the data?")
>>
>>60513491
Yes xzye does

>>60513414
A perfect use case for tail-recursion IMHO but that's a ball that imperativefags will catch.

The isEmpty is a clever workaround to the limitation of the language. Personnally I'd do
while True:
data = input("whatever: ")
if data: break
print("please write something.")
# and then it starts again

Could wrap that up into a
nonempty_input("Whatever: ")
function too.
>>
>>60513414

Try this
#I just need to check if the input is empty and if so, ask for it again.

#I just need to check if the input is empty and if so, ask for it again.

def my_func(question):
q = input(question)
s = True
if q != "":
s = False
return True
else:
my_func(question)

# Ask a question

x = my_func("Who's your daddy?")
print(x)
>>
>>60513636
Oops this should be better

def my_func(question):
q = input(question)
if q != "":
return True
else:
return my_func(question)


x = my_func("Who's your daddy?")
print(x)
>>
What are some good resources for learning more professional web design?

Only time I've really touched web design is when I've been doing functionality and very basic testing layout, but I'm looking at expanding into freelance work and it seems like website/mobile stuff is absolutely critical for that.
>>
>>60513636
Maybe I don't know enough of the subtleties of python, but what's the purpose of s? are q and s global variables?
>>
>>60513675
s is nothing, q is just a variable to catch user input

that was a mistake. this works
>>60513657
>>
python a shit
>single-line nested loops considered good practice
>whitespace treated as meaningful
>pythonfags actually defend this by saying anyone who doesn't like it doesn't indent right
>as if that even had anything to do with why it's bad
>useless enforced difference between expressions and statements
>>
>>60513712
Not a python fag but I do wish more languages used whitespace(mostly tabs, using spaces for this is for faggots) for block scopes.
>>
>>60513707
Won't that just print "True" though? It doesn't seem to capture the input?
>>
>>60513766
he didn't want to capture input he wants to check if its not empty and ask again if empty.

code can be modified to return the input easily
>>
if I was writing an android app in java, that in the future I plan to port to iOs, is there anything I should do early to make the switch over easier? Or is it a complete new start in objective c/swift?
>>
>>60513657
That's way better. Cheers.

Recursive solutions never come to my brain intuitively.
>>
>>60513794
heres the code that returns the input if question is answered, else it asks again.

def my_func(question):
q = input(question)
if q != "":
return True, q
else:
return my_func(question)


answered, answer = my_func("Whos your daddy?")

if answered: # if true, print the answer
print(answer)
>>
>>60513744
https://nim-lang.org/
https://wiki.gnome.org/Projects/Genie/
>>
>>60513766
I just modified it to return q

def set_attribute(question):
q = input(question)
if q != "":
return q
else:
print("Invalid data, please try again.")
return set_attribute(question)

item_one = set_attribute("What is the data for question one?")
>>
File: image.png (114KB, 448x260px) Image search: [Google]
image.png
114KB, 448x260px
Okay I'm fluent with php and fairly knowledgable with c#. which world should I dive into; laravel or .net core/entity?

i've been planning to pursue laravel up til now but to be honest im tired of being scrutinized for using php. what does /dpt/ thing?
>>
new thread, though
>>60513923
>>
>>60513807
separate the UI from the other stuff
>>
>>60512087
No idea.

I don't think Obot realises that 'no pronouns' means no 'you' or 'your'.
Thread posts: 326
Thread images: 26


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.