[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: 321
Thread images: 34

File: 1474950435300.jpg (156KB, 934x1000px) Image search: [Google]
1474950435300.jpg
156KB, 934x1000px
Old thread: >>57084400

What are you working on, /g/?
>>
File: 0723ll.jpg (147KB, 700x1050px) Image search: [Google]
0723ll.jpg
147KB, 700x1050px
Is there any use for Prolog?
Any guides for retards?
>>
>>57087452
Thanks for using an image.
>>
When I try to compile GLM in code::blocks It can't find <cmath>

the fuck?
>>
Is there anything more pathetic than a catfag?

Dogs:
>Evolved side by side with humans for thousands of years, some of our traits were literally gained from dogs
>One of the most important tools that allowed us to succeed as a species
>Intelligent, the supreme companion
>Utilitarian, can do a multitude of jobs

Cats:
>Do nothing
>Essentially just a breathing teddy bear for depressed NEETs and middle aged women

If you're a catfag instead of a dogbro then you are a failure as a human being. Cats aren't even domestic animals.
>>
File: 1476538476120.jpg (52KB, 742x720px) Image search: [Google]
1476538476120.jpg
52KB, 742x720px
>using C for the first time

this feel is a really comfy feel family, i like u
>>
File: 1475849072010.gif (2MB, 272x200px) Image search: [Google]
1475849072010.gif
2MB, 272x200px
>>57087471
If by use you mean something you'll get money out of then I don't know. But I had much fun programming in Prolog at my university - implementing a simple expert system and applying the logic paradigm in general (in contrast to imperative programming) was very refreshing.
>>
File: golden retriever.jpg (257KB, 1280x960px) Image search: [Google]
golden retriever.jpg
257KB, 1280x960px
>>57087508
>catfags literally trying to say "g-greentext n-not being a loner, l-lol normie"

how can someone be this pathetic
>>
File: BYShwSK.jpg (149KB, 625x838px) Image search: [Google]
BYShwSK.jpg
149KB, 625x838px
>>57087508
a true dogbro wouldn't be this mean to another person.
>>
daily tip: coding isn't thre same as programming
>>
I went back to a random image generator that segfaulted when the image had less than 44101 pixels.

It drove me crazy but I went back to it and my loops were going one cycle more than they should have.
>>
>>57087513
you should try FP

>>57087537
catfags aren't people
>>
>>57087508
>Cats
>Do nothing
My cat hunts mice around my house.
>>
>>57087586
Cats are soulless, like chinese people
>>
>tfw coding on the couch with my doggie
>>
>>57087605
Comfy
>>
File: file.png (1MB, 1024x685px) Image search: [Google]
file.png
1MB, 1024x685px
>>57087586
Why do you have an army of rodents roaming around your house? Is this an American thing? It's exceedingly rare to get mice where I live and when you do you just kill them and they're gone forever.

>>57087605
>tfw trying to figure out a bug in your code and your doggo fixes it for you
>>
haven't studied pointers yet, is there a way to get an array such as
 char letters[3] = {'a','b','c'}; 

to print the actual characters and not the ascii values, other than initializing the array with a pointer?
>>
>cats vs dogs

Another useless argument courtesy of the dpt peanut gallery.
>>
>>57087674
haven't touched C in months , but printing this shit with %s should work
>>
>>57087688
OOP has set the industry back 20 years.
Haskell is useless.
>>
>>57087688
>they're the same because they both inherit from pet

Fuck off OOP faggot
>>
>>57087688
you can alway argue that dog fags are actualy haskellers, other than vegans.
>>
File: smartneko.webm (2MB, 720x404px) Image search: [Google]
smartneko.webm
2MB, 720x404px
/dpt/-chan, daisuki~

Ask your much beloved programming literate anything (IAMA)

>>57087674
char letters[] = {'a', 'b', 'c', '\0'};
puts(letters);


>>57087558
>cycle
Iteration.

>>57087555
How so ? Also, coding is death
https://medium.com/@loorinm/coding-is-over-6d653abe8da8#.h7leg55wh

>>57087510
>buffer overflow for the first time
>string without \0 for the first time
>null pointer for the first time
>by-one error for the first time
>...

>>57087471
Prolog is obsolete.

https://en.wikipedia.org/wiki/Mercury_(programming_language)
https://mercurylang.org/

>>57087452
Thank you for using an anime image.
>>
>>57087593
So am I.
I've died inside.
>>
>>57087720
Dogs or cats?
>>
>>57087699
Except that it's missing \0 and it's going to print garbage
>>
all pets are disgusting

especially dogs, they're dirty as hell
>>
>>57087720
Ye I realized cycle was the wrong word there I just couldn't think of the right one. I'm no silly billy, honest
>>
>>57087720
Why haven't you killed yourself
>>
>https://www.fsf.org/about/staff-and-board
>ctrl + f "dog"
>1 result
>ctrl + f "cat"
>0 result

huh
>>
anyway lets not let the catfags distract us from programming

what is your favourite programming language and why? (3 reasons)
>>
>>57087720
Apper detected
>>
>>57087699
That was giving me a core dumped error, because of what >>57087730 said I guess.
>>57087720
This works, ty.
>>
>>57087513
>implementing a simple expert system
Oh wow, so you did the same.
What dialect did you use?
What book?
>>
Is there any justification for a software company made between friends to buy office space? Anything beyond "it's easier when we are in the same place". I personally just think it's a really appealing idea to own somewhere to work.
>>
>>57087828
main()
{
...
}


or

main() {
...
}
>>
>>57087797
F#
>>
>>57087846
anyone who joins this is a fucking idiot, discord mines data
>>
>>57087891
not really until you're making enough money to justify the expense and you're hiring people that you need space for
>>
>>57087905
that is less than 3 reasons
>>
>>57087906
Oh no they're gonna take your valuable text strings that you volunteer to their server.
>>
>>57087904
main() {
...
}
>>
>>57087929
Python, because I chatted with a girl last week that studies physics and uses it too, it is comfy and i like cats
>>
>>57087929
eh.. hmm
functional shit
terse expressive syntax
.NET framework
>>
>>57087941
Fuck off, kike shill.
>>
>>57087971
Guess who else "mines data" you retard? The website you typed that into.
>>
>>57087904
// hey guys xD
// this is my code LOL lmao

main which could return a number
takes nothing
start {
// it does nothing, prank!! xDD
give back 0
done


im a grill btw xD lmao :3 ;-; x33
>>
>>57087941
I'm just saying there's better, more secure alternatives, like the DPT irc that already has users
>>
>>57087904
second for nestable only.
>>
File: ywontitwerk.png (29KB, 889x238px) Image search: [Google]
ywontitwerk.png
29KB, 889x238px
I have source code which includes a Makefile (.mk)

I'm trying to run it in VS cmd, but I can't get it to work

Link is the file, pic related is my error
>https://github.com/finnstr/gdx-liquidfun-extension/blob/master/jni/Android.mk

What am I doing wrong, and how do I fix this? Pls help
>>
File: data.png (132KB, 256x240px) Image search: [Google]
data.png
132KB, 256x240px
I noticed that Xviewer spits out random data when you open a malformed bmp file. By malformed I mean a file that consists only of valid header and no image data. It outputs an image with random data from ram, leftovers of previous images. When you save that image and open it in hex editor, you can for example see scrambled exif data and so on. Pic related, if you convert it to 24-bit bmp and open with hex editor, you'll see some exif data of a previous image.

How could it be fixed? Calculating valid file size and comparing it with actual file size could be an option.
>>
I'm trying to rotate a number given by the user by x amount. Is it possible to place the given number into an array and have each digit as an element, then just increment the element of the array by 1 and placing this in a for loop by x times??
>>
How do I implement logistic loss?

This is seriously bugging me.

1. The formula on Wikipedia has a factor 1/ln2, that doesn't exist in literature.
2. I can't find out for the life of me what goes in f(x) of ln(1+exp((-1|1)*f(x)) - I mean it's clear that it's the probability, but for what exactly?

Let's say I have 3 classes, and I want to calculate logloss given class 3:
case 1: the annotated class is class 3, then I think it should be: -1 * <my probabilty result for class 3> so far, so clear.
but:
case 2: y * <what> if it isn't originally class 3? 1 * <probability for class 3> or 1 * <my probability for the other classes>?

I got a reference implementation in a library, but I can't read the code to it. and the result for either case is different, no matter what I try. I'm losing my mind over this.
>>
>>57088043
yes
>>
>>57088032
open source, guys. It's amazing.
>>
>>57088017
Install Gentoo.
>>
>>57087846
would like to join but not sure if i have the required level
>>
I just managed to play back a wave file.
This is a personal milestone!
>>
>>57088128
Niced
>>
>>57088128
Congratulations! I'm serious.
>>
>>57088128
wave-data = data(PCM)
>>
>>57088150
Yes. That was me.
>>
Halp! DehPeeTee! Why am I so retarded that I cant figure out this simple problem?


If object obj has property prop, it removes the property from the object.
If the property has been removed, it returns true; otherwise it returns false.

Here is my code:
function removeProperty(obj, prop) {
if (obj.prop === true){
delete obj.prop;
}
if (obj.prop === undefined){
return true;
} else {
return false;
}
}
;
removeProperty(new Object(), 2);


What did my pleb ass do wrong?
>>
>>57088128
cool

now synthesize some sounds like sine waves and sawtooth waves etc
>>
>>57088175
No.
You don't get to tell me what to do.
>>
>>57088196
Well what's the next step of your master plan
>>
>>57088196
you're a big guy
>>
>>57088172
function removeProperty(obj, prop) {
if (obj.prop === true){
delete obj.prop;
return true;
}
return false;
}
>>
>>57088172
Why are you trying to write Javascript before learning any Javascript?

function removeProperty(obj, prop) {
var hadProp = prop in obj;
delete obj[prop];
return hadProp;
}
>>
>>57088221
>>57088217
oh man
>>
>>57088172
>What did my pleb ass do wrong?
used javascript
>>
>>57088235
I don't know how that happened
>>
>>57088175
Oh, i did that before.
I wrote a tinnitus simulator and a DualToneFrequencyModulation randomizer.

Transforming a sine wave to a square wave of sawtooth didn't seems like a terribly intersting problem, so i haven't bothered with that.
>>
>>57088032
And that exif data is scrambled in a funny way. Three characters right to left. If we start at address x, then to recreate original file we should read bytes x+2, x+1, x, x+5, x+4, x+3 and so on until the end of file. Example:
ptt//:.snoda.ebmocac/remr-a-watesnit/sg0.1
ttp://ns.adobe.com/camera-raw-settings/1.0

Isn't it interesting?
>>
>>57088286
Pretty cool
>>
File: ss (2016-10-15 at 09.32.44).jpg (283KB, 920x696px) Image search: [Google]
ss (2016-10-15 at 09.32.44).jpg
283KB, 920x696px
Friendly reminder that you can interpret lambda calculus in the internal language of any elementary Grothendieck topos.
>>
>>57088032
>>57088286
Very /cyb/
>>
>>57088232
I learned some JS, but it was from shitcademy, which prepared me for very little.
>>
>>57088286
padding is my guess. I had a same shift by 3 byte while working with bitmaps, because I forgot the padding.
>>
>>57088172
>>57088342
Why are you even deleting properties? It's pretty useless. Just assign them to undefined or null if you want to explicitly get rid of them.

function K() {}
K.prototype.test = 1
var k = new K()
console.assert(k.test === 1)
k.test = 2
console.assert(k.test === 2)
delete k.test
console.assert(k.test === 1)
>>
>>57087846

discord is bloated to hell

also i'm not making an account
>>
>>57088327
>tfw currying resembles more like tensor contraction, but I think that's because I'm physicist
>tfw no face
>>
>>57088370
you are free to join or not but you miss great discussions on computation theory, software engineering practices, cold hand optimizations, ...
>>
>>57088232
Also this didn't work. The problem is on testdome if you want to try it out for yourself.
>>
>>57088398
>muh haskell
>muh dogs
>>
Which of these two styles is more readable?

>option 1
result <- runMaybeT $ do
scope <- MaybeT $ Scope.querySingle scopeName
(Entity _ album) <- MaybeT $ Album.querySingle id
originalTitle <- return $ albumTitle album
originalTags <- return $ intercalate "," (albumTagNames album)
title <- lift $ optionalParam "title" originalTitle
tags <- lift $ optionalParam "tags" originalTags
result <- lift $ Album.update (Entity id album { albumTitle = title
, albumTagNames = tags })

return (Route.album scope id, result)

case result of
Nothing -> notFound
Just (Valid) -> success
Just (Invalid e) -> failure e


>option 2
result <- runMaybeT $ do
scope <- MaybeT $ Scope.querySingle scopeName
(Entity _ album) <- MaybeT $ Album.querySingle id

let originalTitle = albumTitle album
originalTags = intercalate "," (albumTagNames album)

lift $ do
title <- optionalParam "title" originalTitle
tags <- optionalParam "tags" originalTags
result <- Album.update (Entity id album { albumTitle = title
, albumTagNames = tags })

return (Route.album scope id, result)

case result of
Nothing -> notFound
Just (Valid) -> success
Just (Invalid e) -> failure e
>>
>>57088368
testdome problem
>>
>>57087797
c++
1. free sex
2. free heat
3. actually it's not a language but a zen doctrine
>>
>>57088418
top looks nice
>>
>>57088403
I copypasted it into there, pressed run, and it says the tests passed.
>>
Generally Not Used, Except Middle Aged Computer Scientists.
XDDD
>>
>>57088349
I supply a header of 256x240 24-bit bitmap. This way no padding is required, because row size is divisible by 4.
Maybe it's because of endianness. It's possible that this viewer stores ARGB pixel info in a 32-bit variable. On a little-endian machine this would be stored in memory as BGRA, and there is no alpha channel so its BGR, BGR, BGR and so on. I should download source code and try to understand it.
Now I'll write an unscrambler.
>>
File: 1418486965424.jpg (54KB, 479x498px) Image search: [Google]
1418486965424.jpg
54KB, 479x498px
>>57088418
Top looks better.

Tho
>lift
>>
>>57087904
int main(argc, argv, envp)
int argc;
char** argv;
char** envp;
{
puts("hullo!");
}
>>
it's me or dpt is very slow since that discord thing started
>>
>>57088439
Ughhh...wtf I feel even dumber now...

Why did you make a new var and why did you not have to call the function?...I'm so fucking confused right now
>>
File: 1474202730675.png (29KB, 200x200px) Image search: [Google]
1474202730675.png
29KB, 200x200px
>>57088484
>this is valid C

>>57088489
Just you.
>>
>>57088489

It's only slower because we've shifted the shitposting there.
>>
>>57088528
Good. Keep it there please. And take your trips with you.
>>
>>57088398

> c go fast like rabbit
> python slow baby language for little man
> webdev are weak like little worm
>>
File: Untitled.png (63KB, 1920x1080px) Image search: [Google]
Untitled.png
63KB, 1920x1080px
Need to make a Christmas tree using this triangle sub in Visual Basic for a college assignment but not sure how to do it cos I'm an actual retard.. Could someone help a bit please? would be really appreciated
>>
>>57088623
Maybe if you had some specific questions one could answer. But no one's likely to do it for you.
>>
>>57088623
>>57088654
also
>.vb
>>
>>57088623
>Windows 10
>Visual Studio
>Visual Basic

Welcome to /g/ you fit right in.
>>
>>57088623
Just add spaces m8.
>>
>>57088654
well considering the picture already shows the triangle sub working I assumed people would realise that I meant how to make the tree..
>>
>>57088686
There's no point in roasting him for just using the program they told him to.
>>
File: Failure.jpg (49KB, 666x331px) Image search: [Google]
Failure.jpg
49KB, 666x331px
>>57088700
this.

>>57088623
been where you are, bud.
>>
>>57088503
>Why did you make a new var
You're right, I'm just used to Javascript having an inexpressive value language.

function removeProperty(obj, prop) {
return prop in obj && delete obj[prop];
}
>>
>>57088727
Reminds me of when I tried to make a sierpinski triangle
>>
>>57088681
>>57088686
Only doing vb cos I have to for college I thought it was a strange choice as well.
and windows 10 cos couldn't find shit to do this on in linux that actually worked for me
>>
>>57088748
Still though, windows 10 is beyond silly.
>>
>>57088741
pics or it didn't happen
>>
File: Untitled.png (5KB, 974x504px) Image search: [Google]
Untitled.png
5KB, 974x504px
>>57088700
How was that supposed to help?
>>
>>57088718
Well, in that case >>57088700
>>
>>57088735
OKay thanks, this actually made sense to me.
>>
File: IMG_5161.png (1MB, 750x1334px) Image search: [Google]
IMG_5161.png
1MB, 750x1334px
>>57087452
This is what a programmer looks like.
>>
>>57088783
Now you're just being obtuse.
>>
>>57088766
I don't have the code anymore, but it was basically just a really skewed shitty triforce
>>
>>57088799
Is that the chick who made Candy Crush?
>>
>>57088783
You're going to want to start in the center of the tree
>>
>>57088799
What's his name?
>>
>>57088741
>>57088766
>>57088812
I've done this also. I wonder if i still have the code somewhere.
>>
File: CLgm1XqVEAAQRzT.jpg:large.jpg (80KB, 1023x682px) Image search: [Google]
CLgm1XqVEAAQRzT.jpg:large.jpg
80KB, 1023x682px
>>57088799
>>
File: v34qb64.png (2KB, 120x230px) Image search: [Google]
v34qb64.png
2KB, 120x230px
>>57088623
#include <stdio.h>

void print_n(char c, int n) {
for (int i = 0; i < n; i++)
putchar(c);
}

int main(void) {
int n = 10;
for (int i = 1; i <= n; i++) {
int spaces = (n / 2) - (i / 2);
print_n(' ', spaces);
print_n('*', i);
putchar('\n');
}
return 0;
}

yikes
>>
>>57088735
Strange, when I try to reference the property with a period instead of brackets, I get an error. I thought they were the same syntactically?
>>
Randomly generating haikus
>>
>>57088858
It's gonna be a dark fucking christmas this year
>>
>>57088799
dog people confirmed shit
>>
>>57088103
Is this just a meme, like when I ask java questions I get "use c#" as an answer.

I don't want to learn a new OS, reinstall drivers etc, if it's not going to help
>>
>>57088855
Arab girls are pretty but why she isn't in hijab?
>>
>>57088880
>he thinks there are drivers for gentoo
>>
>>57088880
Trying to use makefiles on windows. You seriously need to install gentoo.
>>
File: ndev.png (429KB, 600x1066px) Image search: [Google]
ndev.png
429KB, 600x1066px
>>57088799
kek
>>
>>57088895
>Arab
>she
>girl
>her
>>
>>57088855
>@ISIS
I fucking knew it.
>>
>>57088868
That's completely wrong, why would you think that?

obj.prop === obj["prop"]

propName = "foo"
obj[propName] === obj["foo"] === obj.foo
>>
File: 1375168631922.jpg (57KB, 600x556px) Image search: [Google]
1375168631922.jpg
57KB, 600x556px
>>57088913
holy shit, that's beautiful, it's like pottery
>>
>>57088916
>ISIS
>not Arab
I mean, come on
>>
>>57088858
>>57088810
I'm completely new to this btw and my teacher hasn't taught me that what that shit is so I don't even understand how it works. and how do I start it in the middle of the triangle I can't see how to do that in my code (I know I'm an actual fucking retard)
>>
>>57088925
Because I've been looking at walls of code for the last 24 hours and my brain feels like mush.

I see the difference, one is for the value of the property and the other is the expression.

Thanks, anon.
>>
>>57088912
Make exists for windows.
>>
>>57088970
The output you want is
  *
***
*****


Think about it m8.
SPACE SPACE STAR
SPACE STAR STAR STAR

You've got the stars. You just add spaces.
>>
>>57088970
You don't start at the middle of the triangle. You calculate the appropriate number of whitespaces to add before the stars, for every line. More stars means fewer spaces, and vice versa.
>>
>>57089009
oh, I was getting confused about where to put the code, thanks for the help!
>>
>>57088982
obj.prop === obj["prop"]

This fact is literally the most basic of Javascript basics. The dot syntax is shorthand for indexing on strings. There's no excuse to not know this.
>>
>>57088970
don't think about what you need to type in, think about the problem first.
you get a number x and you need to print a christmas tree that is x lines tall and at the bottom x characters wide. you start at the top and increment the number of symbols for each line until you end up at x lines (which you've already done).
but you have to "center" the tree. so at the top, you have to print the symbol in the middle, which is half of x. you print x/2 whitespaces, before you print the first symbol. for each subsequent line, you have to print one whitespace less. so in the end you have two things going on: one number that increases each line (for all the symbols you print) and one number that decreases every line (for all the whitespaces you print).
>>
>>57089065
>indexing on strings
absolutely disgusting
>>
File: new.png (135KB, 256x240px) Image search: [Google]
new.png
135KB, 256x240px
>>57088466
It works, at least in this specific case. If text was shifted one or two bytes, results would be incorrect.
>>
>>57089079
That's Javascript for you.
>>
>>57085965
DELETE THIS AND DON'T EVER POST MY WAIFU AGAIN
>>
C++ sucks dick

C is a language of art
>>
I use unchecked exceptions instead assert.
Oh yes, i'm a bad boy. I'm a rebel. I'm the guy your mom warned you about.
>>
>>57089143
No
C++ has everything you ever need
>>
>>57089143
>no namespaces
>no constexpr
>no classes
it's trash
>>
I want to make software that's CLI only and runs on Windows mac and linux what do I learn?
>>
>>57089206
You have tons of options. Something interpreted like python would be simplest to get working on all 3 platforms.
>>
>>57089182

you really don't need classes though
>>
>>57089143
you probably don't know anything about c++. the sheer complexity of c++ is a blessing in itself. it's like studying a mystical, highly intellectual language.
https://www.youtube.com/watch?v=wQxj20X-tIU
>>
>>57089206
rust
>>
>>57089221
goddamn it I fucking love scott meyers
>>
>>57089221

both c and C++ have very similar compilers so they both are retardedly complex
>>
>>57089221
>>57089149
>>57089182
>complexity

...

>I don't know what I'm doing but there must be a reason. I mean, obviously.
>>
>>57089253
you can write compilers for c that do complex optimizations, but c itself is a fairly simple language compared to c++.
>>
>>57089143
This. C is drawing with a fine brush. C++ is like trying to draw with the shape tool of paint.
>>
>>57089143
>Dealing with preprocessor shit
C and it's derivatives are a mess
>>
>>57089307
>Dealing with pajeets shitty stack of framework/libraries and so called "higher level" languages
>>>/g/wdg/
>>
>>57087452
A USB device authentication tool for linux in Python.
>>
>>57089306
C is like drawing with a fine brush. Even when what you really want to do calls for the fill tool.

With C++, both the fine brush and the fill tool is available to you.
>>
>>57089336
>Lol, if it's intelligently designed out must be Java or some script kiddy shit
Time to come out of 1978
>>
>>57089362
And just to complete the metaphor. Assembly is pixel art.
>>
File: _85264665_mourinho.jpg (40KB, 640x360px) Image search: [Google]
_85264665_mourinho.jpg
40KB, 640x360px
what the fuck is a 'Success Engineer'?
>>
>>57089478

>>> he /doesn't/

I can't even
>>
>>57087508

Dogs:
>obiedient little creatures
>need you to walk them every day
>need you to play with them every day
>killer mode constatly
>stink

Cats:
>have their own minds
>do exactly what they want
>don't give a shit about what other people do
>play for themselves
>jump though gardens the whole day, no need for a human baby sitter
>cute as fuck
>>
>>57089478
Not a thing, just a meme, buzzword, etc.
>>
Its not really coding but I'm trying to build a website using WordPress, PHP, IIS, and My SQL for the first time ever.
Which means I have to set up a server for the first time ever, along with maybe a domain name.
I'm really overwhelmed.
>>
>>57089362
>>57089391
I disagree. The fill tool behaviors are predictable. C++ classes just add hidden bloating and complexity which is unnatural to deal with and too far from mathematics.
>>
>>57089553
yes
>>
>>57089555
You think classes is what makes sepples complex?
>>
what is devops? is that the new call of duty?
>>
>>57089381
>non-C derivatives
>intelligently designed
kill yourself
>>
>>57089553
>sudo yum install httpd mariadb php
kek
>>
>>57089530
Thank you for confirming the point that cats are not domestic animals and so shouldn't be kept as pets.
>>
Tomorrow i fix a crash and refactor the solution.
Now time for play and sleep.
>>
My web server can't go past 30k/s. Any idea how to improve?
>>
A few weeks ago I posted my first program, an electronic diary script written in python. I've since upgraded it to a diary manager that can create and use multiple diaries, each with their own directory and entry list.

http://hastebin.com/yawonebacu.py
>>
>>57089553
>devops shit
I feel your pain anon.
>>
>>57089768
I'd try it out, but i can't be arsed to remember how to Python.
>>
>>57089832
you can just save it as a file and run 'python /path/to/file' in the terminal
>>
aren't there libraries in C++ that will turn it into java with C++ benefits?
>>
>>57089657
>>57089712
>>57089792
made a comic

>>>57089870
>>
>>57089891
Accurate enough. Right now webdev is like trying to assemble a bunch of reused junk until it makes a working car. Don't fell for this meme, learn C. It's simple, elegant and has everything you will ever need.
>>
>>57089880
"C++ benefits" are actually "no garbage collection benefits". C++ is more advanced in every other way, too.
>>
>>57089880
Are you talking about jni?
>>
>>57089761
stop using gay languages and meme frameworks
>>
>>57088970
>>57088858
I was going to write you psuedocode with an explanation when you posted in the previous thread, but I assumed the problem was harder than this and I was missing something obvious
>>
>>57089880
C++ is already java with C++ benefits
or C with java benefits
>>
File: programiskill.png (22KB, 1243x551px) Image search: [Google]
programiskill.png
22KB, 1243x551px
>>57089855
>>
File: ywontitwerk.png (41KB, 791x334px) Image search: [Google]
ywontitwerk.png
41KB, 791x334px
I have source code which includes a Makefile (.mk)

I'm trying to run it in VS cmd, but I can't get it to work

Link is the file, pic related is my error
>https://github.com/finnstr/gdx-liquidfun-extension/blob/master/jni/Android.mk

Am I doing something obviously wrong?
Is 'nmake -f' what I should be using?

>>57087688
Austin, pls help me
>>
>>57090022
b---but ... It's in C
>>
I think i might host a github-esque site. Definitely meant for the use of whateverthefuckyouwill. There won't be code of conduct BS either. Would anyone use it? I have the money to serve it for at least a few years. Just would like to have some help with pen testing it.
>>
>>57090097
alternatives already exist
>>
>>57090097
Think Neetco.de just done with proper maintenence
>>
>>57090065
it's written in python 3. Also it's not designed for windows you'll have to change the line that defines the directory.
>>
>>57090109
such as? Bitbucket is the only one i can think of.
Might also throw some CI servers towards it.
>>
>>57090109
What do you think is the best alternative? I don't want to host my project on github (a.k.a I don't need a job).
>>
>>57090136
What good is using a scripting language if you don't make your script portable?
>>
Hi all

I'm trying to create an asynchronous set of utilities for a project I'm working on, in Java.

Is there anything wrong in terms of design with using an atomic boolean as a way to not only track the state of a type, but also to act as somewhat of a mutex?

Sorry for messy psuedo-ish:

public class Example {

// say list is just one of many members that we don't want to have to synchronize
private final List<SomeType> list = new ArrayList<>();

// this field will
private final AtomicBoolean doingSomething = new AtomicBoolean();

public void doSomething() {
if (!doingSomething.compareAndSet(false, true)) {
throw new IllegalStateException("Already doing something");
}

start new thread {
// * some thread unsafe operation on list here *
// now that we're done we set synchronizing back to false
doingSomething.set(false);
}
}

public void addSomethingToList() {
if (doingSomething.get()) {
throw new IllegalStateException("Cannot modify list while doing something");
}
// * some thread unsafe operation on list here *
}

// probably a good idea to let the caller avoid unchecked exceptions in situations where they
// cannot track the state of the type through any other means
public boolean isDoingSomething() {
return doingSomething.get();
}

}



Sorry if I articulated this poorly, I have been awake for 26 hours. I would really appreciate some input here since I feel like I can easily be doing something stupid here what with java's "nuanced" concurrency.
>>
>>57090162
I just started doing this a few weeks ago. I'm not very good at it.
>>
Do any of you guys use OpenGL in development?
>>
>>57090171

Sorry about post being riddled with errors. I would also just like to say if anybody thinks they could help but need me to elaborate please speak up.
>>
>>57090147
>>57090152
gitgud.io gitlab.com or go pro and setup gitlab on a VPS
>>
>>57090171
>Is there anything wrong in terms of design with using an atomic boolean as a way to not only track the state of a type, but also to act as somewhat of a mutex?
I'm not sure what you mean by state of a type, but the mutex part should be the right idea.
>>
>>57090088
stop being a terrible programmer i bet you use malloc excessively instead of doing proper memory management
>>
>>57088050
Found out I got it right. Reference implementation's logloss meant actually "logarithmic loss", both work now.
>>
>>57090223
Tracking the state in the example I provided basically means just storing whether or not we are currently "doing something".
>>
File: hmm.png (19KB, 1243x551px) Image search: [Google]
hmm.png
19KB, 1243x551px
>>57090183
Fair enough. I don't expect other systems are a priority for a beginner.
>>
what are the flaws of lisp?
>>
I wrote a haskell function that outputs another function that, when used can output an absurdly big number that ends in the same number of zeros as the exponent.

let nilus x = (\y z -> (y + (sum [(-x) .. x ^ z])) ^ z)
let davus = nilus 5

> davus 10 5
2779987067717764747720730595700000

Try it.
>>
> /dpt/:
> furious shitposting about dogs vs. cats for some reason

> stack overflow:
> post has 10 votes and 6 replies after 2 minutes
>>
>>57090290
Exiting the diary takes you back to diary selection. I should maybe make that more clear. I should clear up redundancies like (type help to see a list of commands), since seeing it once should be enough.
>>
>>57090308
And yet this is the site you decide to post on
>>
>>57090301
davus will always end in 5 when you do
>davus 5 (whatever)
>>
>>57090338
I noticed that now. I didn't even realize just pressing enter opens an unnamed diary.

You could maybe rename the exit command for diaries to close or close diary, and let exit work as i expected it.

The redundancies seem to be fine like they are, i think.

You've actually done a pretty god job on the parsing. Especially for a beginner.
>>
i'm learnung ruby because i'm a shit-fag i was using rubymonk to learn but that closed up shop, i switched to code academy but that feels too dumbed down. is there a better resource?
>>
>>57090231
Ehhhhrrmmm.... I'm not even allocating anything between requests... I'm already using senffile for zero-copy writes :/

How the fuck do some are able to achieve 1 million r/s on a singe core? (._. )
>>
lmao the unnamed diary thing isn't supposed to happen. I'll have to fix that. Thanks for your suggestions
>>
File: ay95895977ada-lovelace-engl.jpg (840KB, 2205x2400px) Image search: [Google]
ay95895977ada-lovelace-engl.jpg
840KB, 2205x2400px
I want to learn Ada (2012).

Can you recommend one (1) good book?
>>
>>57090480
meant for>>57090433
>>
>>57090485
You can find it on library Genesis
>>
So I'm try to do this project for class of encrypting messages passed between a client and a server, and at one point I'm generating an HMAC with some strings through OpenSSL


// "Auth key for the client" and "Enc key for the client"
const unsigned char authKeyClient[] = {'A', 'u', 't', 'h', ' ', 'k', 'e', 'y', ' ', 'f', 'o', 'r', ' ', 'c', 'l', 'i', 'e', 'n', 't'}; //Awkward, but the string can't be null-terminated
const unsigned char encKeyClient[] = {'E', 'n', 'c', ' ', 'k', 'e', 'y', ' ', 'f', 'o', 'r', ' ', 'c', 'l', 'i', 'e', 'n', 't'};
const unsigned char preKey[] = "8nv2u4enwj9f"; //Preshared key

encKey = HMAC(EVP_sha256(), preKey, KEY_LEN, encKeyClient, ENC_KEY_LEN, NULL, NULL);
authKey = HMAC(EVP_sha256(), preKey, KEY_LEN, authKeyClient, AUTH_KEY_LEN, NULL, NULL);


Issue is that encKey and authKey both end up being the same thing. Anyone know what the issue would be exactly?
>>
>>57090671
// "Auth key for the client" and "Enc key for the client"
const unsigned char authKeyClient[] = {
'A', 'u', 't', 'h', ' ', 'k', 'e', 'y',' ',
'f', 'o', 'r', ' ','c', 'l', 'i','e', 'n', 't'
}; //Awkward, but the string can't be null-terminated
const unsigned char encKeyClient[] = {
'E', 'n', 'c', ' ', 'k', 'e', 'y', ' ', 'f',
'o', 'r', ' ', 'c', 'l', 'i', 'e', 'n', 't'
};
const unsigned char preKey[] = "8nv2u4enwj9f"; //Preshared key

encKey = HMAC(
EVP_sha256(),
preKey,
KEY_LEN,
encKeyClient,
ENC_KEY_LEN,
NULL,
NULL
);
authKey = HMAC(
EVP_sha256(),
preKey,
KEY_LEN,
authKeyClient,
AUTH_KEY_LEN,
NULL,
NULL
);
>>
>>57090485
Learned basics with Watt/Wichmann/Findley - Ada.
learned well from it and it covers the basics, but it's dated, I dare say outdated - it surely doesn't cover Ada 2012.
>>
>>57090663
package body Mersenne_Twister is

procedure Set (Seed: in Long_Integer) is
begin
Index := N;
Twister_Array(0) := Mersenne_Number(Seed);
for Iter in 1..Twister_Array'last loop
Twister_Array(Iter) := Mersenne_Number(F *
(Twister_Array(Iter - 1) xor (Twister_Array(Iter - 1) / 2**(W - 2)))
+ Mersenne_Number(Iter)
);
end loop;

end Set;

function Extract_Number return Result_Subtype is
Y: Mersenne_Number;
Value: Result_Subtype;

begin
if Index >= N then
if Index > N then
Set(5489);
end if;
Twist;
end if;
Y := Twister_Array(Index);
Y := Y xor ((Y / 2**U) and D);
Y := Y xor ((Y * 2**S) and B);
Y := Y xor ((Y * 2**T) and C);
Y := Y xor ((Y / 2**L));

Index := Index + 1;
Value:= Result_Subtype(Y mod Mersenne_Number(Result_Subtype'Last - Result_Subtype'First + 1)) + (Result_Subtype'First);

return Value;

end Extract_Number;

procedure Twist is
X: Mersenne_Number;
XA: Mersenne_Number;

begin
for Iter in 0..N-1 loop
X:= (Twister_Array(Iter) and Upper_Mask) +
(Twister_Array((Iter+1) mod N) and Lower_Mask);
XA := X / 2;
if X mod 2 /= 0 then
XA := XA xor A;
end if;
Twister_Array(Iter) := Twister_Array((Iter+M) mod N) xor XA;
end loop;
Index := 0;

end Twist;

end Mersenne_Twister;
>>
>>57090800
why would someone learn Ada in 2016?
>>
>>57090838
I learned it in 2008, it was mandatory in our CS101. I learned to understand why: it's hard to break something and it covers any concept that you can wish for in education - pointers, threads, classes, etc.
And it's a fun language, not kidding.
>>
>>57090838
Why would you not?
>>57090818
>>
File: Sif.gif (35KB, 230x200px) Image search: [Google]
Sif.gif
35KB, 230x200px
>>57090671
Nevermind, figured it out
>>57090798
T-thanks I guess
>>
I'm learning about inheritance, polymorphism, and interfaces in Java.

I have a Car class. How do I make multiple Car objects that include information or variables like brand, model, and year?

I feel like I should be using and object type as a parameter for some method that would work for every new Car object, or something I don't know.

I feel like the answer is simple, but I just don't know how to do it
>>
So is functional programming the new thing edgy kids are into these days?
>>
>>57091166
A constructor taking those as parameters.
>>
>>57090085
nmake and unix-like makes are not compatible, you probably need GNU make to run that one.
>>
>>57091166
import java.util.*;
import java.lang.*;
import java.io.*;

class Ideone
{
public static void main (String[] args) throws java.lang.Exception
{
Car volvo = new Car("Volvo", "idkm8", 2013);
System.out.println("Brand: " + volvo.getBrand());
System.out.println("Model: " + volvo.getModel());
System.out.println("Year: " + volvo.getYear());

}
}

class Car {
private String brand;
private String model;
private int year;

public Car(String brand, String model, int year) {
this.brand = brand;
this.model = model;
this.year = year;
}

public String getBrand() {
return this.brand;
}

public String getModel() {
return this.model;
}

public int getYear() {
return this.year;
}
}



Something like this?
>>
>>57091238
I was hoping that I wouldn't have to do this, but thank you.

So, if you were to summarise what I had to do, would it just be
>Partition SSD
>Install linux
>make in cmd
>?????
>profit

Am I missing anything?
>>
>>57090671
>//Awkward, but the string can't be null-terminated
If you specify the array size exactly, and not leave space for the null terminator, it won't be added to the array.
const unsigned char authKeyClient[19] = "Auth key for client";
const unsigned char encKeyClient[18] = "Enc key for client";

Neither of these arrays are null terminated.
>>
>>57091428

You can run GNU Make on Windows, you know... Any decent package of MinGW-w64 comes with it.
>>
>>57091166
typdef struct { char brand[15]; char model[15]; int year;} car;

car *
mkcar(char *brand, char *mode, int year)
{
...
}
>>
is it advisable to do lisp on vim?
>>
>>57091623

This example proves it: C is object oriented.
>>
>>57091703
no
>>
>>57091170
its like they dont want to be productive
>>
>>57091759
I know that you're not serious, but it pains me to think that some people actually believe that.
>>
>>57091777
but FP makes you productive!

[spoiler]except in haskell[/spoiler]
>>
>>57091774
why not
I just installed sbcl
is it really bad to write in vim and compile with sbcl?
>>
>>57091778
almost any large program uses OOP to some extent
>>
>>57091815
A struct is not OOP.
>>
>>57091834

good thing too because OOP is a cancer
>>
>>57091834
you're usually using structs as if they were objects
>>
>>57087508
cats are kuudere. i like them
>>
>>57091872
You OOPfags really try to subsume every feature as "yours" don't you?
A struct and functions that work on that struct is not OOP. It's simple procedural programming.
>>
>>57091872

Yet, you still avoid the baggage of OOP languages -- wantonly structured object hierarchies, hidden vtables, etc.

With a plain structure, what you see is what you get.
>>
>>57091872
>Using object-like structures is OOP :^)
>>
>>57091902
>object-like structures
>object-like
>object
>not object-oriented programming
>>
>struct
>aggregate of values laid out closely together in memory

>object
>abstract thing that can send and receive messages

Ah yes they're the same.
>>
>ANSI-C is a full-scale object-oriented language
https://www.cs.rit.edu/~ats/books/ooc.pdf
>>
Breaking news lads, Assembler is an OOP language!!!
>>
>>57088224
You can probably just shorten that to
if (obj.prop)


>>57088342
If you want to learn about making simple algorithms like that / using basic functions of the syntax then you should try something like Codewars.

>>57088172
A new Object is empty - as in it will not have the property 2. Also, this thing will never return false.

I don't know what code academy's sandbox is like but you should try repl.it
>>
http://www.cs.ecu.edu/~karl/3675/fall16/Assn/Assn5/assn5.html

please send help
>>
function objects best
>>
>>57088172
>>57088172
>testdome
You're getting it wrong because it's not asking you to return true at all.

Also obj.prop will never equal true unless the object literally included
{prop:"true"}

So instead, just put
if (obj.prop){delete obj.prop}


Objects are 'mutable', so there's no need to return it, it'll mutate (in this case, delete) accordingly
>>
>2016
>the web is still the only platform to treat the UI as data
>you will never be cable to modify a desktop application's UI at runtime or embed one desktop application with another using a single external script

Why?
>>
How do you iterate over 2 lists in python?

I have a list of links and I want to download them and name them using a list of filenames.

I want to do something like:

for link in links, filename in filenames:
do some nonsense

can this be done? should I ask over at /webdev general/?
>>
>>57092156
Because the web has sufficiently proven that it's a bad idea.
>>
>>57092190
https://docs.python.org/3/library/functions.html#zip
>>
File: cuzz i feel.png (701KB, 1280x720px) Image search: [Google]
cuzz i feel.png
701KB, 1280x720px
>>57092248
ayy, that's exactly what I needed senpai.
>>
>>57092190
You can use a regular while loop and use i to reference both of them.
>>
How the fuck do you convert 32-bit numbers to octal?

I can do hex and binary just fine because 4 and 1 divide equally by 32, but I can't for the life of me figure out what to bitshift so I don't end up with 2 leftover bits.
>>
>>57091914
>object-like
>like

A cat-like structure is not the same thing as a cat
>>
>https://en.wikipedia.org/wiki/C10k_problem
>10–12 million connections (MigratoryData, 12 cores, using Java on Linux)
b--but... how?
>>
>>57092377
Octal is 3 bits, and 32 isn't divisible by 3, so naturally, you're going to have 2 bits left over.
Just add an extra zero to the front, so the most significant 2 bits becomes 3 bits.
>>
>>57092216
In what ways? Implementation-specific issues like using JavaScript don't invalidate the idea.
>>
>>57092416

Java haters btfo
>>
>>57092418
I know how I would do it in theory, but I don't know how to add the extra zero when I'm programming.

It's not like C lets you just make a 33 bit int does it?
>>
>>57092411
A cat-like creature is likely a cat
>>
>>57092484
are you currently trying to save it somehow or just print it?
>>
masturbating to 2d girls with penises being fucked by dirty mature perverts
>>
>>57092411
Under univalence, yes.
>>
>>57092416
Read the blog post that's linked?
>>
File: codesnippet.png (11KB, 287x216px) Image search: [Google]
codesnippet.png
11KB, 287x216px
>>57092530
Save it as a string

for reference, this is how I did hex,
optimally I would do octal in a similar fashion.
>>
>>57092411
if it looks like a cat and meows like a cat then it's probably a cat
>>
When would you ever change the copy constructor.
>>
>>57092564
Rule of zero/three/five. If you have a destructor, i.e. the object's responsibility is to manage a resource, you 99% need your own copy constructor, and you should also have a move constructor.
>>
>http://pastebin.com/4JVjS02b
kek
>>
>>57092564
Or simply use C and don't waste your life
>>
Hey guys, I'm building a script to extract book titles from sentences. This isn't homework.

For example, my list of books are:
>I Recommend
>The Cat in the Hat
>Green Eggs and Ham
>How The Grinch Stole Christmas
>Horton Hears A Who
>Oh The Places You'll Go
>Fox in Socks
>Hop on Pop

An input sentence would be:
>"if you liked that book, I recommend the cat in the hat, green eggs and ham, and how the grinch stole christmas."

The output would be:
>I Recommend
>The Cat in the Hat
>Green Eggs and Ham
>How The Grinch Stole Christmas

I do not want it to extract "I Recommend". Is this even possible? In both "I Recommend" and "...I recommend the cat...", "I" is a personal pronoun, and "recommend" is a present verb, so it would be difficult to use part-of-speech tags to identify them as different bigrams.

Thanks in advance.
>>
>>57092484
I would do it like this:
#include <stdio.h>
#include <limits.h>

int main()
{
unsigned n = 0xdeadbeef;
unsigned bits = CHAR_BIT * sizeof n;

unsigned extra = bits % 3;

putchar('0' + (n >> bits - extra));
bits -= extra;

for (; bits > 0; bits -= 3)
putchar('0' + ((n >> bits - 3) & 07));

putchar('\n');
}
>>
>>57092636
You would need the equivalent in C if you ever wanted to copy something.

>>57092564
>>57092593
You can also delete the copy constructor if you don't need to copy the object. You can always implement it later. That said, it does mean you need to implement a move constructor in its place.
>>
>>57092561
void print_uint_as_oct(unsigned int number)
{
unsigned int shift = 30;
for(unsigned int i = 0; i < 11; ++i)
{
printf("%d", number >> shift & 7);
shift -= 3;
}
printf("\n");
}

it isn't great, but you get the idea
>>
>>57092655
sounds like homework, what language?
>>
>>57092558
I did. is it worth to tune the kernel for performance? Why is the default like that though
>>
new to C++

i have
while(std::cin >> val1){
sum += val1;
}


if I input something (3 4 5 9) and hit enter the loop doesn't end, and it still asks me for an input

book says otherwise, maybe its windows
>>
>>57092655
use regex and when you find a match print out the string. This seems trivial. What am I missing?
>>
>>57092675
Not homework, but it's in Python. I'm using NLTK for part-of-speech tagging. I know that it's not the most accurate (see: http://stackoverflow.com/questions/30821188/python-nltk-pos-tag-not-returning-the-correct-part-of-speech-tag), but for this project I figured that it's not going to be the end-all-be-all if it's that inaccurate since the emphasis isn't on part-of-speech tagging. This seems to be in the area of named entity recognition, but I'm not exactly training anything.
>>
>>57092735
I'm new to python so can't be much help, what're you making the script for?
>>
>>57092709
hit ctrl+d to send end of file
>>
>>57092716
A regex would print
>I Recommend
>The Cat in the Hat
>Green Eggs and Ham
>How The Grinch Stole Christmas

It's correct for the most part, but I don't want it to print "I Recommend".
>>
>>57092752
it inputs ^D instead
>>
>>57092679
Its only worth it if you're getting that many connections. The default kernel parameters are "Good enough" (tm) for a lot of workloads.

But that doesn't mean that, like a lot of companies, you should just leave the settings alone when you're scaling up.
At work we got a system up from 2 TPS to 30 TPS using some JVM tuning alone.
>>
>>57092673
>>57092657

Thanks guys, I think I understand now.
>>
>>57092763
Oh I get it. Check for a subject before it in the sentence. if there is one, then "I recomend" will most likely be the book. (SUBJECT).*(I Recommend). That's what I would call "good enough"
>>
>>57092764
and what happens when you send it?
>>
>>57092800
*JVM and application parameter
>>
>>57092750
No worries. No specific reason, I just want to write a script that extracts titles of books from sentences. It's just something I want to work on.
>>
>>57092823
it ends the program since my val is set to int

its weird because according to this book it is supposed to just end the while loop (if it reaches EOF or wrong input), and go to the next line which isn't suppose to terminate

windows 10 and compiled with VS command prompt, also not using english locale
>>
>>57092882
isn't that what you want? you break out of that while loop
also try to hit ctrl+d twice
or simply create input file and place your input data there and redirect it, like program.exe < input.txt
>>
>>57092874
mods delete threads just for having an innocuous nazi pic?
>>
>>57092946
>>57092946
>>57092946
>>
>>57092950
No, I deleted because I forgot subject.
>>
>>57092950
No, I think OP deleted that thread because /dpt/ wasn't in the post.
>>
>>57092971
>>57092975
ah
Thread posts: 321
Thread images: 34


[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.