[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: 317
Thread images: 36

What are you working on, /g/?

Old thread: >>58752171
>>
File: spj.jpg (31KB, 224x223px) Image search: [Google]
spj.jpg
31KB, 224x223px
Thank you for using an anime image!
>>
File: part4_img.jpg (49KB, 300x440px) Image search: [Google]
part4_img.jpg
49KB, 300x440px
>>58756258
Thanks for posting
>>
quick, post a programing challenge!
>>
implementing tls with different hash and oneway functions
>>
>>58756368
oneway meaning oneway trapdoor
>>
>>58756258
Elm or Purescript?
Easy-to-understand oilerplate or mind-blowing haskellisms?
>>
>>58756367
write a parser, typechecker and interpreter for a good language
>>
>>58756367
Write a program which will accept any arbitrary program as an input, and determine whether it will complete a computation on some other input.
>>
>>58756389
Mind-blowing haskellisms

Honestly Haskell can be a lot simpler than people give it credit, it's just that it can also be complicated.
You can choose how complicated you want your code.
>>
How long does R take to learn?
>>
I'm cracking open the Tox source code and trying to set the Opus bitrate to be inversely proportional to the number of people in a group chat. The previous Tox groupchat died after a third person joined.
>>
>>58756389
Typescript or C/C++/Rust compiled to asm js/WASM.
>>
Man, we ded
>>
>>58756367
http://www.freevms.net/ ;^)
>>
What are your programming environments?
>>
>>58756673
Ubuntu Server 14.04 + Openbox
Vim or Sublime with GCC for programming.
>>
>>58756673
Ubuntu + Openbox
VS Code + Docker containers for CI tests
>>
>>58756673
>Gentoo
>i3
>emacs (-nw)
>gcc
>dmd
>gdb
>git
>>
>>58756673
OS X
Sublime
gcc
>>
I'm learning about semidefinite programming so I can crack quantum one-time-pad encryption ;)
>>
>>58756673
Ubuntu with i3
GCC
>>
>>58756826
How do you crack "One-Time-Pad" encryption if it is impossible
>>
>>58756846
The quantum version is supposed to have some extension that would allow it, some sort of "shield" that is a matrix and when you modify that matrix a bit it stops being a shield, but I don't actually know anything about it yet.
>>
>>58756858
good luck then
>>
>>58756876
Thanks, I'll need it.
>>
>>58756673
xfce
Vim
Gentoo
gcc
>>
>>58756673
Windows 10
VS Code
Git bash
cargo
>>
>>58756673
windows 10
vim
cl.exe
visual studio debugger
>>
File: 1482779833928.png (148KB, 645x772px) Image search: [Google]
1482779833928.png
148KB, 645x772px
I got called autistic today for using emacs.
:(
>>
>>58757165
dumb wojak poster
>>
>>58757147

>cl.exe
Girlinredshirtvomitting.png
>>
>>58757193
What's wrong with Wojak?
>>
>>58757329
>>>/r9k/
>>
Is it weird to put porn rippers and user stalking tools on Github? I've got it marked as 'Available for hire' too.
>>
>>58757339
But Wojak is a krautchan meme.

>>58757365
You know the answer.
>>
>>58757383
>>>/r9k/
>>
>>58757383
>krautchan

somehow worse than r9k
>>
File: 1463061905756.jpg (98KB, 620x520px) Image search: [Google]
1463061905756.jpg
98KB, 620x520px
>>58757165
Why do you care what populus say?
Emacs is a nice multitool, and people don't care what do you use if you have the job done.
>>
>>58757165
>>58757409
>Calling people autistic for using Wojak.
You're part of the problem not the solution.
>>
>>58757470
>>>/r9k/
>>
>>58757365
Considering there are even dildo drivers on github, no.
>>
>>58757365
Yes, it is weird.
Weird and immoral.
>>
What kind of coding would require a computer with good specs?
>>
300 tweets DPT!

twitter.com/dpttxt
>>
>>58757541
vidya manchild programming
>>
>>58757550
What about like big data/machine learning? I don't really know much about that kind of thing
>>
>>58757575
i suppose
>>
>>58757541
Coq
>>
>>58756731
Buttplug?
>>
>>58757365
Why the fuck would you do that when you can easily make a private bitbucket?
>>
>>58757365
>stalker tools
go on...
>>
I heard that the real way to get good at programming is watching The Rocky Horror Picture Show, not anime. Is this true?
>>
>>58757727
No, it's a lie.
>>
>>58757727
That's false.
The only thing to watch that has been proven to make your better at programming is anime that features cute girls doing cute things.
>>
coderlife
>>
>>58757779
Nice facebook image, fag.
>>
>>58756258

been fucking around with this program I built to generate a bitmap from a random sequence of bitwise/algebraic operations

Works suprisingly well, every 3rd or 4th image is unique and interesting

Pic related, it shat out what looks like a ruler function
>>
>>58757783
What did you just call me, you little twerp?
>>
File: background.png (43KB, 1280x800px) Image search: [Google]
background.png
43KB, 1280x800px
>>58757789
>been fucking around with this program I built to generate a bitmap from a random sequence of bitwise/algebraic operations
Pic related is something I made along the same lines. Any guesses to the algorithm?
>>
>>58756428
R, easy to learn.
But do you know stats already?
>>
File: 1486000532212.png (25KB, 1025x1023px) Image search: [Google]
1486000532212.png
25KB, 1025x1023px
>>58757789
Turn it 90°
Looks like a 3D landscape pointed at the horizon
>>
>>58756673
>whatever OS
>vim
>>
>>58757789

more
>>
>>58757813

obviously Xor
>>
>>58757789
what libraries and language did you use?
>>
File: 3fc5411a318e6e5a.gif (5KB, 460x340px) Image search: [Google]
3fc5411a318e6e5a.gif
5KB, 460x340px
>>58757822

I think it might be related to euclid's orchard
>>
>>58757817
On basic level, I just look for a language to print graphs.
>>
>>58757822
This picture gives me A E S T H E T I C feelings.
>>
>>58757838

SDL2 in C++

All that's important though is to get a window where you can draw pixels
>>
>>58757756
I know this is supposed to be a meme, but I actually HAVE gotten better at coding since I started watching more anime. What does this mean?
>>
File: 1311892369420.jpg (26KB, 293x400px) Image search: [Google]
1311892369420.jpg
26KB, 293x400px
Is there any sort of standard logic or well-known, accepted solution when you need to sync entries between 2 or more devices?

For example I have my device, I register people and their hobbies, and when I sync with your device I want both of them with the most updated data from both.

I was needing something like this when I was working like 2y ago but didn't manage to find much about this (not even discussions) on google, and I ended up writing one that I wasn't much confident on.
It worked though I think it could be better, anyone has any sources on this topic?
>>
>>58757890
time for war
SFML vs. SDL in current year, which one should you use?
>>
>>58757968
neither
>>
>>58757968
GLFW.
You don't need any of that other bloat.
>>
>>58757687

It's not really stalking. The one tool is for checking Reddit accounts for new posts and scraping them and alerting me as soon as they're posted.
>>
>>58757610

So I can have some good code in my portfolio to show friends and potential employers
>>
>>58757968

writing directly to video memory
>>
>>58758005
GLFW doesn't work well with i3 and i don't plan on changing window managers just to use it
>>
Hey /g/
I am working with a lot of 3d sampling algorithms and would love a way to paste a huge amount of x,y,z coordinates from one long string into some web app and see them plotted on a 3d graph. Does anyone have any recommendation?
I tried a bunch online but they all involve typing in the x,y,z manually.. I just want to paste one uber string with 100 point x/y/z coords in it.

Alternatively, some online web programming app where I can type code and see the points plotted automatically.
>>
CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT
BEGIN
RETURN (
SELECT Salary
FROM Employee
ORDER BY Salary DESC
LIMIT 1 OFFSET N-1
);
END


What can I substitute for N-1 so that this will actually run?
>>
>>58758039
>what is an operating system
>implying it will just let you
>>
>>58758005
>GLFW
>Calling others bloat

Did you mean: FreeGLUT?
>>
>>58758077
1 (pass 1 to the function)
>>
File: newfags.png (18KB, 1024x1024px) Image search: [Google]
newfags.png
18KB, 1024x1024px
hey there newfags
>>
File: 1482390845755.png (16KB, 521x396px) Image search: [Google]
1482390845755.png
16KB, 521x396px
>>58758232
Never mind, apparently OFFSET can't take expressions
>>
File: IMG_20170126_145605_221.jpg (3MB, 3120x4160px) Image search: [Google]
IMG_20170126_145605_221.jpg
3MB, 3120x4160px
What's wrong with this? It's supposed to be a hailstone sequence generator. It works, until it gets to 4, and then it starts going back and forth between 2 and 4, forever.
>>
>>58756673
Gentoo + DrRacket
>>
File: TOX.png (18KB, 1358x522px) Image search: [Google]
TOX.png
18KB, 1358x522px
I'm working on networking stats for BasicTV. I rewrote some of the network data request code to make it cleaner and make it not as interdependent on other parts of the code. I'm also making subscribing to a linked list for a set amount of data chunks possible to prevent redundant queries. TCP holepunching and UPnP are being implemented as well.

I also fixed the /dpt/ ToxBot. When you send an friend request to the bot, message 'invite 0' to join. You can find the ID at http://pastebin.com/3hWZmBn9
>>
9/11 truther here. What's the best language for me?
>>
>>58758312
Hebrew.
>>
>>58758064
I've written (simple) GLFW programs and they worked fine with i3.
>>
>>58758266

because when you get to 2 it divides by 2 to get 1 and then it checks the remainder of 1 and 2 to get 1 which it multiplies by 3 and adds 1 to producing 4
>>
>>58758335
I don't want to become a mindless puppet
>>
Woman (Male) here, what's the most appropriate language for me?
>>
>>58758371
C
>>
>>58758341
Why doesn't it exit the loop when it becomes 1?
>>
>>58758397

because after it becomes 1 it checks it's remainder with 2 again in the second if
>>
>>58758336
Were you able to get the windows to float and show the title bar? I tried unsuccessfully. It says it should start in windowed mode by default, which they technically do, but they start tiled which is not what I want. No matter what option hints I tried to set I couldn't get the window to float by default or show the titlebar. Other than that it worked and I got a triangle on the screen etc. but the tiling options were not looking very promising from my searches. SDL and SFML which I've tried as well just werk.
>>
>>58758371
Swift or Node.JS
>>
Black nigger here, what's the most appropriate language for me?
>>
>>58758438
ARM assembly to bypass icloud lock
>>
>>58758300
join us
>>
>>58757950
Without centralisation? Then gossip.
Otherwise you almost always need some sort of storage with more or less serializable state and history.
Or you could take the git approach with Merkle trees. In fact why not write it on top of libgit2?
>>
>>58758418
Yes, you're right, I see it now. These calculators really need a way of doing an else if statement.
>>
>>58758492

pretty sure they have one

you're supposed to do it like

IF ...
THEN
...
ELSE
...
END
>>
How does one generate strings in C?
I'm trying to write a code for an assignment that functions by bruteforcing with four-character strings and can't figure out how to properly create the strings.

I thought concatenating would work but it seems like a mess. I haven't actually found a function searching the library to generate strings, though.
>>
>>58758473
you'll need to suck my cock so we can benchmark
>>
File: 4k.jpg (584KB, 3840x2160px) Image search: [Google]
4k.jpg
584KB, 3840x2160px
>>58758546
>C
>dealing with strings
>easy
>safe
>>
I'm using a cluster of commodity VPSs to scrape Taobao (Alibaba), the results of which are fed into an SVM trained off known counterfeit goods.

The idea is to monitor and identify counterfeits of marketplace sites and automate the process of submitting takedown notices. End goal would be to license it to affected companies.

So far the results have been promising, getting pretty good rates of accuracy. Here's my little demo, would love advice or feedback: http://vinyrd.bayesop.com/demo
>>
>>58758580

Don't help the filthy capitalists
>>
>>58758546
Learning what's really happening with a string is like the first fucking thing you do when learning C
It's a char arr
Generate random 4-length char arrays
>>
>>58758527
Yeah, I got it working. The syntax is really weird, and for some reason I need 3 "END" statements.
>>
>>58758552
are you sure?
>>
>>58758612

because the while and 2 ifs both need 1
>>
>>58758546

Start with a char buffer with every character being \0, mutate from there.
>>
>>58758597
this xD
i'm a /r/rust user too btw!
>>
>>58758576
That's great and all but I'd appreciate help nonetheless.
>>
>>58758614
i'll let you do it in the name of science
>>
>>58758603
I just started learning C so it's among the first things I'm learning, yes.

>>58758630
Thanks, I'll give it a shot.
>>
>>58758650
Allocate a fuckton of memory and start slingin' them pointers lad
>>
Will shitting in my hand make me a better programmer?
>>
>>58756673
On my laptop:
Debian
XFCE
Emacs -nw
gcc/gdb/valgrind

On my school's computer (through my hard drive):
Windows 10
Vim
gcc
>>
>>58758773
>emacs -nw
>vim

do you use evil?
>>
File: khajit no understand.jpg (22KB, 500x342px) Image search: [Google]
khajit no understand.jpg
22KB, 500x342px
>>58758818
Emacs doesn't work at all on MSYS, so I have to use what pacman gives me and I choose to us vim over nano, just because I'm used to switching between modes in emacs.
>>
>>58758864
why not just include portable emacs (thats been compiled with mingw). or do you not like gui emacs?

or do you mean that you can't use mintty with eshell / shell-mode?

if its the later, mintty guys are working on it. (because people want to use emacs with WSL)
>>
Is it possible to write a lambda calculus interpreter in lambda calculus?
>>
>>58758973
Yes
>>
File: hackerman.jpg (181KB, 1920x1079px) Image search: [Google]
hackerman.jpg
181KB, 1920x1079px
Can /dpt/ hack time

https://youtu.be/ZTidn2dBYbY?t=1m10s
>>
>>58758908
I don't like gui emacs. I prefer to stay in terminal and use screen as often as possible.
>>
Does Haskell impose any gender stereotypes on its users?
>>
If i feel comfortable with C++, there's no practical reason i'd should learn any other language, right?
>>
>>58759027
Yes, the type system is pretty cis-normative.
>>
In Javascript how do I set innerHTML to a function? I keep getting a "Uncaught TypeError: Cannot set property 'innerHTML' of null" error if I try. Code for example.
document.getElementById('lemonClick(1);').innerHTML = lemonClick(2);
>>
>>58759032
>practical
that's a useless word. be more specific.
>>
>>58759050
<script> whatever
>>
>>58759071
I was just trying to pre-empt any arguments about >muh functional make you think good.
>>
>>58759085
That just gives me an unexpected token error. Thanks for your help regardless.
>>
>>58759114
What are you trying to do: Replace lemonClick(1) with lemonClick(2)? If so, use "lemonClick(2);" (as a string, not a function).
>>
>>58759050
You're calling getelementbyid on a function call
>>
>>58759049
I prefer defining my own type system.
{-# LANGUAGE DeriveDataTypeable #-}
module Smuggle where
import Control.Exception
import Data.Typeable
import System.IO.Unsafe

newtype Smuggle a = Smuggle a deriving Typeable

instance Show (Smuggle a) where
show _ = "Smuggle"

instance Typeable a => Exception (Smuggle a)

smuggle :: Typeable a => a -> b
smuggle x = throw (Smuggle x)

recover :: Typeable a => b -> a
recover x = unsafePerformIO $ do
val <- try (evaluate x)
case val of
Left (Smuggle x) -> return x
Right _ -> undefined

data Girl = Girl deriving (Show, Typeable)
data Boy = Boy deriving (Show, Typeable)

girlsWashroom :: Girl -> Girl
girlsWashroom x = x

main :: IO ()
main = let
trap :: Boy
trap = recover (girlsWashroom (smuggle Boy))
in putStrLn (show trap)
>>
>>58759151
>import System.IO.Unsafe
non-standard
>>
>>58759131
I tried that as well. Both with the single quote mark and the double quote mark. It still gave me the same error. And yes I'm trying to replace lemonClick(1) with lemonClick(2)

>>58759144
Oh. Thanks for catching that. What should I use instead?
>>
>>58759050
Read well the ERROR MESSAGE you're getting.

It's saying "cannot set property X of null", meaning the "document.getElementById('lemonClick(1);')" is returning null, that is, there's no element with that Id on the context document.

Also, think well in what you're trying to do, because for some reason I suspect you're not going to get what you really want...
>>
>>58759190
Well you could do something like:

<script id="cool">
</script>

<script>
document.getElementById('cool').innerHTML = "lemonClick(2);";
</script>
>>
>>58759222
Lemme bring up what I have in the HTML portion

<input type="image" src="lemon.png" width="200" onclick="lemonClick(1);">
.
>>
Trying to make rope data structure in C. This is just a bit to show you where I went wrong. I don't get string because I'm from C++, trying to pass through function to set. Then, print each node in order.


struct treeNode{

int i, length;
char *word;
struct treeNode *left;
struct treeNode *right;
}treeNode;

treeNode *insert(treeNode *node, int i, char word, int length){
//printf("Insert %s \n",word);
if(node==NULL){
treeNode *temp;
temp = (treeNode *)malloc(sizeof(treeNode));
temp->i = i;
temp->word = word;
temp->length;
temp->left = temp->right = NULL;
return temp;}
.........


void main(){

treeNode *root = NULL;
char word[256];
int length, a;
for(a=0;a<3;a++){
printf("Enter word: ");
scanf("%s", word);
length = strlen(word);
root = insert(root, a,word,length);
}
}
>>
>>58759179
Bah humbug. There will always be holes in the type system that the programmer will need to break.

Consider the following,

module Equal (Equal, equal)
import Unsafe.Coerce
data Equal a b = Equal
equal :: Equal a a
equal = Equal

reflex :: Equal a b -> Equal b a
reflex Equal = Equal

coerce :: Equal a b -> a -> b
coerce Equal = unsafeCoerce


How else would you implement this?
>>
>>58759245
So are you trying to modify the lemonClick function's body or change the onclick from lemonClick(1) to (2)?
>>
>>58759269
Change the html's onclick from lemonClick(1) to lemonClick(2)
>>
I am doing ex2-3 in k&r c, and I cannot figure out why this code doesn't work. I looked up the solution and I understand that but I don't understand how my code is all that different and why it produces random numbers.
#include <stdio.h>
#include <ctype.h>
#include <string.h>

int htoi(char s[]);

main(){
char a[10] = "1f";
char b[10] = "ff";
char c[10] = "2a";
printf("1f: %3d ff: %3d 2a: %3d", htoi(a), htoi(b), htoi(c));
}

int htoi(char s[]){
int i, n;
char c;

for(i=0; i<strlen(s); ++i){
c = s[i];
if(isdigit(c))
n = 16 * n + (c - '0');
if(tolower(c) >= 'a' && tolower(c) <= 'f'){
n = 16 * n + ((tolower(c) - 'a')+ 10);
}
}
return n;
}


Any tips?
pls help
>>
>>58759284
First, ID that thing.
<input id="myId" />


Then call it:
document.getElementById("myId").onclick = yournewfunction;

Note there's no parenthesis () meaning it's not CALLING the function, but assigning it instead. If you put () it'll call the function and expect unexpected behaviour.
>>
>>58759245
depending on how many inputs are on the page:
if you just have 1 then you can just do
document.getElementsByTagName("input")[0].onclick = function(){ lemonClick(2); };

(you have to wrap it with a function so it doesn't get executed immediately)

if you have multiple inputs then you need to iterate and find the one you want (probably by checking the src attribute)
>>
>>58759284
<input id="nice" type="image" src="lemon.png" width="200" onclick="lemonClick(1);">

document.getElementsById("nice")[0].setAttribute("onclick", "lemonClick(2);");
>>
>>58758546
char *str = "this string is a char array";
That made a string.

Because its an array, you access it normally.
str[0] == t
str[1] == h
str[2] == i
str[3] == s
str[27] == '\0'
str[28] is out of bounds, but c wont tell you that. so dont be a dumbass.

use strcat and strcpy and all that shit.
its simple and documented.
all they are is a couple loops and copies. nothing hard to do yourself.
>>
>>58759333
Forgot to wrap it in code tags, woops. You should also to do document.getblablabla.onclick = lemonClick(2); but I'm not sure if that works in all browsers.
>>
>>58759263
https://hackage.haskell.org/package/base-4.9.1.0/docs/src/Data.Type.Equality.html#%3A~%3A
>>
>>58758546
>>58759337
or to alloc the space for a string
char *str = malloc(sizeof(char)*4)
allocated 4 chars for you.
Make sure the last char == '\0' or many string functions wont work.
>>
>>58759284
What are you trying to do?

Is there a list of lemons in your HTML?

What is supposed to happen when you click on each one?
>>
Are you really still using Python or JavaScript? Are you honestly satisfied with using technologies that insult your intelligence?
>>
What maths books does /dpt/ recommend?
>>
>>58759345
GADTs are an extension and not standard Haskell.
>>
>>58759314
See though, lemonClick 1 and 2 are the same function, I'm only changing the number. How would I include the number in that code? Thank you for helping me through this.

>>58759363
Incremental game involving lemons. I'm trying to build a way to upgrade how much it increments when I click. Here's what happens when you click.
function lemonClick(number){
lemons = lemons + number;
document.getElementById('lemons').innerHTML = lemons;
};
>>
>>58759378
If you're not using GHC+extensions then you're basically Java tier.
>>
>>58759378
yet
>>
>>58759387
>>58759179
>>58759392
>If you're not using GHC+extensions then you're basically Java tier.
>>import System.IO.Unsafe
>non-standard
>yet
QED.
System.IO.Unsafe is acceptable as if you do not use GHC+extensions then you're basically Java tier and it is only a matter of time before System.IO.Unsafe is standardized.
>>
>>58759404
>it is only a matter of time before System.IO.Unsafe is standardized.
IO.Unsafe will never be standardised.
>>
>>58759414
GADTs will never be standardized.
>>
File: languages3.png (17KB, 522x384px) Image search: [Google]
languages3.png
17KB, 522x384px
Reminder
>>
>>58759374
If you hate JavaScript so much why do you have an ad block/ublock extension installed? Oh right, because it's the main language you can use inside a browser.

That's why people use JavaScript, not because they think it's a great language, but because it's the only fucking option to go with when creating stuff for the web without relying on third party software like Flash and Java Applets.

Now stop being autistic over what languages people use, it doesn't matter.
>>
>>58759423
Wrong.
>>
>>58759445
Wrong.
>>
>>58756258
Will I miss anything from SICP if I decide to go with HtDP?
If there are no big trade offs, I'd rather go with the easier and funner read
>>
>>58759442
>If you hate JavaScript so much why do you have an ad block/ublock extension installed?
Non-sequitur.

>That's why people use JavaScript, not because they think it's a great language, but because it's the only fucking option to go with when creating stuff for the web without relying on third party software like Flash and Java Applets.
Not true, there's a ton of languages that you can compile to JavaScript these days. They're not perfect but many of them are a lot better.

Now run along, JS babby
>>
>>58759311
Seriously guys, I know the solution that works but I cannot understand why when i run this code I get random numbers returned.
>>
>>58759438
That's... so much bullshit in one picture I don't even know where to begin.
>>
>>58759340
"Uncaught TypeError: Cannot read property 'setAttribute' of undefined"

I'm so sorry anon, you went out of your way to help me and it still didn't work. Thanks for your help regardless. I guess I'll shelving this project until I'm more adept at JavaScript.
>>
how do i force reevaluation of my file in the racket REPL?
>>
>>58759466
Begin at the beginning and go on till you come to the end. Then stop.
>>
>>58759463
whats the value of n before the for loop?
>>
>>58759509
Did you add an id to your input element and make sure you called getElementById on the right id?
>>
>>58759384
You can do this:
document.getElementById('myId').onclick = function() { lemonClick(2); }
>>
>>58759546
Here's the code.
<input id="upgrade" type="image" src="lemon.png" width="200" onclick="lemonClick(1);">


function testClick(){
document.getElementById("upgrade")[0].setAttribute("onclick", "lemonClick(2);");

};


>>58759559
THANK YOU SO GODDAMN MUCH. THAT ENDED UP DOING THE TRICK.
>>
>>58759537
Shit, thanks man. I was freaking myself out over that.
>>
How do I implement ODEINT on C++ lads?
>>
>>58759457
please respond
>>
>>58759679
Yes, you'll miss out on learning
>>
>>58759376
I recommend buying books which contain information you need at the time.
>>
>>58759376
>Tensors, Differential Forms, and Variational Principles
>>
>>58759735
what domain would this be?
>>
>>58759762
physics -- so when you write your waifu simulator her boobs will have the correct relationships to gravity (moments of inertia can be described with tensors, efficiently).
>>
File: solve (2).jpg (351KB, 1280x720px) Image search: [Google]
solve (2).jpg
351KB, 1280x720px
>>58759772
You don't need GR for boob physics
t. phys grad
>>
>>58759616

Dunno, maybe you should ask these guys
http://headmyshoulder.github.io/odeint-v2/
>>
>>58759788
I won't believe it because it's Rin saying and she doesn't need much physics.
>>
>>58759772
gods work fampaii
>>
>>58759795
I've read the documentation you nigger. I'm confused about the fact that it says that there's no need to link it.
>>
i coded an gitbucket backup downloader script,its very powerful and advanced concurrent scalable distributed functional OOP programming ( 500 lines shorter than Java solution); i am quite proud of script. it is python3. run with python3 script.py.

import os

LOO = [
"put",
"your",
"repo",
"names",
"here",
"nigger",
]

for poo in LOO:
os.system("git clone [email protected]:rajeshpatel/" + poo + ".git")


thank you Sirs,, enjoy
>>
>>58759857
>rajesh patel
DESIGNATED
>>
>>58759847

It's a header library. Pretty much the entire library is templates, so it can't be pre-compiled (at least not in a way that is portable between compilers). This will probably bloat up your compile times, but that is what templates tend to do.

A good part of the C++ STL is also header only.
>>
>>58759679
Youll learn better with htdp but there still might be insights in sicp
>>
>>58759788
B-but anon, haskell is a useless l-language
>>
>>58759820
Nice funbags
>>
File: thinking_hotaru.png (372KB, 954x768px) Image search: [Google]
thinking_hotaru.png
372KB, 954x768px
>>58759876
Thanks for the parroting faggot, now if you could explain how to actually use the package I'd be very grateful. I've used GSL before so if it's anything like that then it'd be easy.
>>
>>58759967
>frogposter
>cancer
Nobody is fucking surprised you avatarfrogging faggot
>>
>>58758682
>>58759337

The furthest I've gotten is setting an all \0 array. I'm trying to figure out how to loop it through every permutation now.

I can figure out how to make it go (A-z),(A),(A) then (A),(A-z),(A), then (A),(A),(A-z) but that doesn't work.
>>
how do you git gut at bash? other languages make sense but when i look at any bash script it just looks like a bunch of indecipherable shit
>>
>>58759997
Dood
char string[5];
for (int i = 'a'; i <= 'z'; i++) {
...
for (int h = 'a'; h <= 'z'; h++) {
string[0] = i;
string[1] = j;
string[2] = k;
string[3] = h;
string[4] = '\0';
if (is_solution(string)) {
return 1;
}
}
...
}
return 0;
>>
>>58759967

You #include the headers. That's it.
>>
File: asciifull.gif (27KB, 715x488px) Image search: [Google]
asciifull.gif
27KB, 715x488px
>>58759997
Well I didn't know you were a beginner. Let me give some tips then.

It would be better in this case to call a function with each permutation rather than generating new arrays with all the answers. The combinatoric explosion in the amount of possible answers will fuck your RAM someday. Let's practice proper problem solving of that nature now.

Treat each character like a number. Your text is likely to be ASCII/UTF-8 encoded. If you want to permutate them, you can change values in the array, one by one, and call a function that does something with that new permutation. Start from A, increment it until Z. Do the same for lower case characters.
>>
>>58760036
>>58759997
In haskell this is just
import Data.List(find)

isSoln :: String -> Bool
isSoln s = s == "abcd"

bruteforce = find isSoln $ do
a <- ['a'..'z']
b <- ['a'..'z']
c <- ['a'..'z']
d <- ['a'..'z']
return [a,b,c,d]
>>
>>58760037
So it's literally that simple? Thanks dude
>>
>>58760103
https://en.m.wikipedia.org/wiki/Header-only
>>
>>58760004
Just read lots and lots of man pages
>>
>>58760092
yes but can haskell play an orchestra?

https://www.youtube.com/watch?v=kRwhg7oTsPo
>>
>>58760138
unfortunately
https://www.google.co.uk/search?q=haskell+music&tbm=vid
>>
>>58760092

I notice you aren't making use of zygohistomorphic prepromorphisms.
>>
>>58760092
import Data.List (find)
import Control.Monad (replicateM)

bruteforce = find (== ['a'..'d']) (replicateM 4 ['a'..'z'])
>>
>>58760138
>you will never code a badass interface such as this one
>>
File: 47cf53de3e3302315edbc27987a6b168.jpg (195KB, 1207x833px) Image search: [Google]
47cf53de3e3302315edbc27987a6b168.jpg
195KB, 1207x833px
>>58760205
Also, those fucking electronic ship sounds man. Fucking amazing
>>
File: DynamicManipulation2.jpg (116KB, 650x496px) Image search: [Google]
DynamicManipulation2.jpg
116KB, 650x496px
What should be studied to get involved with programming for the type of robotics work that Boston Dynamics does?

https://youtu.be/-h5qpXO3isM?t=225
>>
>>58760261
computer vision
>>
>>58756258
I'm working on trying to get an internship for the summer. My portfolio is non existent. My skills are sub par. I'm meh candidate I know but I'm still going to try to make it

I can code in C, Java, C++(pretty rusty though), and a little assembly

Whats the fastest language I can learn in a short amount of time to make me stand out some more? Should I just shoot for IT internships what you guys think
>>
>>58760261
do you have electronics and low level programming down?
>>
>>58760138
>dat qt at 2:32

M A R R Y
>>
Hi guys. I have a simple(dumb) question. I am reading a C programming book, and I came across an exercising about generating prime numbers.
int main (void)
{
int p, i, primes[50], primeIndex = 2;
bool isPrime;

primes[0] = 2;
primes[1] = 3;

for ( p = 5; p <= 50; p = p + 2 ) {
isPrime = true;

for ( i = 1; isPrime && p / primes[i] >= primes[i]; ++i )
if ( p % primes[i] == 0 )
isPrime = false;

if ( isPrime == true ) {
primes[primeIndex] = p;
++primeIndex;
}
}
for ( i = 0; i < primeIndex; ++i )
printf ("%i ", primes[i]);

printf ("\n");

return 0;

}



Inside the program, we can find this for loop:
 
for ( i = 1; isPrime && p / primes[i] >= primes[i]; ++i )


What does this line mean?
>>
>>58760751
looping through possible factors and limits it to avoid duplicate checking
>>
>>58760751
it means that the section of code will loop for as long as "isPrime" is true and "p / primes[i]" is greater than or equal to primes[i]. The loop control variable "i" will increment by 1 for each repetition of the loop
>>
>>58760783
>>58760792

I get that, but my doubt comes from this part:
p / primes[i] >= primes[i]
It is more about the mathematical aspect, than the programming one. I just noted I worded my question really poorly, I apologize for that. 
I want to understand why

p/primes[i] >= primes[i]

is equals to

while primes[i] <= sqrt(p)

At least that's what the author implied in the book. Thanks in advance.
>>
>>58760828
It may be easier for you if you print
p/primes[i]
and
primes[i]
>>
ded
>>
>>58761275
you killed it
>>
Guys I'm not home and I really need to know something

What's the kind of T? Can you ask GHCi?

> :set -XTypeInType
> :set -fprint-explicit-kinds
> data T k (a :: k) = T
> :kind T
>>
>>58756258
A spider that crawls websites looking for the word "Linux". If found it'll check for an e-mail address and if that is found as well the GNU/Linux pasta will be mailed to them.
>>
Profile and pics scraper for dating sites. I'll use it to blackmail future presidential candidates
>>
>>58761328

Excellent project
>>
File: fuckyou.jpg (293KB, 1440x900px) Image search: [Google]
fuckyou.jpg
293KB, 1440x900px
Hello,
this here is for you, my weeb friends:
https://keon.io/cs/computer-scientists-trivia/

Good read imo.
>>
>>58761312
forall k -> k -> *
>>
>>58761447
I had never seen that syntax in Haskell. It's great, thanks!
>>
>>58761488
It's a pretty unique one, basically it means that it isn't implicit (i.e. you pass it a type)
>>
>>58761554
At least I think
>>
>>58761554
Indeed. I've been looking it up and apparently GHC cannot parse it yet: https://ghc.haskell.org/trac/ghc/wiki/DependentHaskell/Phase1
>>
>tfw Java8 has all the goodies
>writing balanced hashmap in c++.

or should I call it hashtree.
>>
Is it true that OOP was hip in 90s?
>>
Top 5 Meme Languages for meme programmers:
1. Python
2. Haskell
3. Rust
4. Go
5. Swift
>>
>>58761708
>python
>swift
>meme
0/8, made me reply
>>
>>58761760
How are Python and Swift not memes?
>>
>>58761762
Python and Go are both completely shit AND completely useless, while Haskell is just mostly useless, Swift is just a bit shit and moderately useless, and Rust is a little bit useless and semi shit with a bit of wee
>>
>>58761775
That doesn't dispute their status as meme-langs.
>>
>>58757311
why? it just works
>>
>>58760036
>>58760082

I've gotten it to compile without errors and run a hash. I have no idea how long it will take to crack but it's been a few minutes so far.
>>
Python:
Calling dict.popitem() on the same dictionary gives me the same result every time. Isn't popitem() supposed to randomly pick one?
This[0] comment on Stackoverflow says that dictionaries are now ordered in Python 3.6, but I'm getting the same behaviour in Python 2.

[0] http://stackoverflow.com/questions/4859292/how-to-get-a-random-value-in-python-dictionary#comment71060717_21723563
>>
File: fuck.jpg (2MB, 1500x1500px) Image search: [Google]
fuck.jpg
2MB, 1500x1500px
hi emacs people

I'm working on a 4chan browser for emacs (have been for a while but dropped it for a couple weeks) and the big stickler for me is thumbnailing posts. I've tried a couple rendering methods but they all seem to choke up in their own weird way.

I was hoping you guys could try a couple of them and see how it performs on your machine/connection.

The header comment in q4.el explains how to install it and use it, Pressing Shift + T in any q4 buffer will switch between the rendering methods.

Would appreciate any feedback about it aside from those as well.

https://github.com/desvox/q4/
>>
>>58762154
I don't really know much about memesnek, but I think I have a plausible answer.
If you think about the internals of a hashmap, it's likely that it's just returning the first/last/whatever element from the array/list it's implemented with.
Since a hashmap is unordered, it could potentially be anything, so the caller shouldn't rely on any particular value, but if you call the function on the exact same hashmap, you're going to get the same value.
>>
>>58762201

Thanks for the explanation.
I have settled for using the proper random module instead of the popitem() method.
>>
>>58756673
Win 10
Visual Studio
SSMS
Azure
>>
>>58756673
Xubuntu + vim + gcc
>>
extern int ror16(unsigned short, unsigned char);

int main()
{
return ror16(0x000Fu, 4u) == 0xF000u ? 0 : 1;
}


.text
.global _ror16
_ror16:
movb %sil, %cl
ror %cl, %di
movq %rdi, %rax
ret


Baby's first x86-64 intrinsic.
>>
>>58756428
How do you feel about vectors of floats?
Because whenever R thinks of vectors of floats, she will touch herself and moan lewdly.
>>
>>58756258
i just installed cmder on my win10 and it's awesome. So much faster than powershell or cmd.exe i can't believe it.
>>
>>58763100
>extern int ror16(unsigned short, unsigned char);
>rot16
>_ror16:
>_
Go home, winbabby.
>>
>>58763158
?? this is clang on MacOS

also I fixed a bug, had the wrong return type
>>
>>58763173
Ok, I suppose my guess was off.
I knew it was something that C compilers on windows still did. I didn't know MacOS still did it too.
I just felt like pointing out something incredibly minor in your example.
>>
>>58763188
curious, whats the linux ABI in this case?
>>
>>58756673
A Ubuntu 16.10 VM for CI, build, etc.
Eclipse for IDE.
Emacs for editing text that isn't java.

After a while, a LOT of shit has been moved out to property files.

Right now my web app must be launched with a property file that explains things like where static resources are located, what encoding to use for output, where the templates are stored, what ports to used, etc.

It also has to point to another file, sql.properties.

This thing allows you to specify what database you want to use.

It has to define the DDL statements, since those are different from vendor to vendor, and allows optional override for other queries.

So you can specify shit like
user.by.id=user/get_user_by_id.sql

And it will look for it in the subfolder where sql.properties is for that file.

That way you can specify things that makes your DB faster. Because SQL Standards are more like wishful thinking it seems sometimes.
(e.g. if you wish to use Oracle SQL, you have to replace varchar everywhere with varchar3.)

So now you CAN use any RDBMS, but I only really test it against postgres on linux and SQL Server on Windows.

>>58757541
Anything large would require you to get a decent CPU, lodsa ram, and an SSD.
There's a reason nobody complains about IntelliJ consuming 2gb of ram on startup. We all have 32gb anyway so that it CAN use that much.

>>58757575
If you just want to learn you don't need large computers. Look up Tom M Mitchell's book called Machine Learning.

>>58758077
OFFSET is vendor independent, so you need to use your vendor specific solution.

>>58762158
Could try later when I get home from work.
>>
>>58763188
you're a fucking idiot. no problem.
>>
>>58757541
Java, C#, Haskell.
>>
>>58756673
arch + lxde + geany
used vim for 5 month and emacs for 1 but I got sick of it
>>
>>58763195
It doesn't add a leading underscore to anything. The symbols appear without any modification.
$ cat test.c 
int rot16(unsigned short a, unsigned char b)
{
return 0;
}
$ gcc -S test.c
$ cat test.s
.file "test.c"
.text
.globl rot16
.type rot16, @function
rot16:
.LFB0:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
movl %edi, %edx
movl %esi, %eax
movw %dx, -4(%rbp)
movb %al, -8(%rbp)
movl $0, %eax
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE0:
.size rot16, .-rot16
.ident "GCC: (GNU) 6.3.1 20170109"
.section .note.GNU-stack,"",@progbits
>>
>>58763364
Thanks, interesting.

I'll probably finish this for some other shift functions I may need and then I'm done.

Honestly knowing to do little things like this is both really useful and quite easy, even if you're not a big time bit banger.
>>
>>58760004
>when i look at any bash script it just looks like a bunch of indecipherable shit
That's because bash IS a bunch of indecipherable shit.
>>
>>58763514
Tells a lot when folks invented Perl to replace it.
>>
>>58763532
Fucking truth.
>>
>>58760004
Learn awk, learn sed, learn curl, maybe learn about some other useful utilities.
Just use bash to glue calls to those programs together.
>>
What's the current fastest Python interpreter? Pypy?
>>
>>58760004
You don't make a bash script longer than say, 20 lines.

Bash scripts are for very simple commands one after another. If you need more than one loop consider writing it in snek 3 or later instead.
>>
Just learning C++ basics, am I doing this correctly?
int main()
{
int number = 0;
while (number != 100)
{
if (number % 3 == 0)
{
cout << "Fizz";

if (number % 5 == 0)
{
cout << "Buzz\n";
}
}
else if (number % 5 == 0)
{
cout << "Buzz";
}


else
{
cout << number;
}
number++;

}
system("Pause");

}
>>
>>58763839
So many times, this.

Christ, even camal 5 is preferable to shell.
>>
>>58763805
Pygay
>>
File: 1480771021637.png (1MB, 1920x1080px) Image search: [Google]
1480771021637.png
1MB, 1920x1080px
>>58763916
>allman style
>>
>>58763916
Looks good to me, I'm not that familiar with C++ but the logic seems to be in check.
>>
>>58763993
Adding to my first comment I guess the only thing I would change is, instead of a while loop I would do a for loop.
>>
>>58763916
The logic is not great desu.

If something is divisible by 3 and 5 that means it is also divisible by 15 (3 * 5). Your code isn't very clean.
>>
>>58756258
am looking into a way of automating my dragon dildo to cum whenever the name "Trump" pops up in my personal Twitter feed
>>
>>58763986
...is inconsequential to readability unless you're doing something pig simple like this? when you should be skipping braces altogether in the first place

I much prefer K&R but I still think you're an unemployable bikeshedder if you care about that sort of bullshit
>>
>>58763916
Almost, except:
- main shall have one of either signatures: "int main(void)" or "int main(int argc, char **argv)". The "void" type in argument is very important, as it insures that no data will be passed to main.
- main must return a value, 0 in case the program exits successfully
- drop "system("Pause")", as it is a portable statement
- I guess you used "using namespace std", but refrain from using it. Who knows if another cout is declared in the current namespace? At least, std::cout is unambiguous.
>>
>>58764040
>drop "system("Pause")", as it is NOT a portable statement
>>
>>58764032
right back at you, mate

kek you don't read or write code for a living do you? look how much space this little shit takes up.
>>
File: assembler.webm (1MB, 1920x1080px) Image search: [Google]
assembler.webm
1MB, 1920x1080px
The assembler works, somewhat.
>>
>>58764040
>>58764014
Thanks
#include <iostream>

int main(void)
{
int number = 1;
while (number != 100)
{
if (number % 15 == 0)
{
std::cout << "FizzBuzz";
}
else if (number % 3 == 0)
{
std::cout << "Fizz";
}
else if (number % 5 == 0)
{
std::cout << "Buzz";
}
else
{
std::cout << number;
}
number++;
}
return 0;
}
>>
>>58764106
why are you using braces if there is only one thing inside each loop?

that should work right
#include <iostream>

int main(void)
{
int number = 1;
while (number != 100) {
if (number % 15 == 0)
std::cout << "FizzBuzz";
else if (number % 3 == 0)
std::cout << "Fizz";
else if (number % 5 == 0)
std::cout << "Buzz";
else
std::cout << number;
number++;
}
return 0;
}
>>
>>58763986
Nothing wrong with Allman style. I find it to be more readable. Very visual clear where blocks start and end, and the space is of little consequence now that we're not programming on sub-600 vert pixel monitors.

In any case, if your autism makes you irrationally angry seeing it, it's trivial for a tool to automatically reformat the document to your preferences.
>>
>>58764023
Shouldn't be entirely too difficult.

Just set up a service that reads from the Twitter API and throws off a flag or signal when a tweet meets that condition.

From there, find a USB device that serves as an interruptor. That way, you can plug in a pump that performs the jizz whizz action and have the USB device make the electrical connection to the pump when those tweet occur.

I would test this outside of your butthole first, because otherwise you could end up with an irresponsible amount of fake cum in your butt.
>>
>>58764055
>when you should be skipping braces altogether in the first place
How about you learn to read yourself? I hope I'll never have to work a day with you.
>>
>>58764147
conistancy
>>
>>58764147
Easier to maintain in the future.

It's good practice.
>>
is there a better programming language than Go?
>>
>>58764262
C
>>
>>58764262
Generally speaking, yes, but that all depends on what your specific requirements are.

Poor question; not enough information to properly answer.
>>
>>58764162
I guess the problem isn't with the style itself but how the faggot decided to use it. He isn't even really conforming to that style; there isn't even full consistency.

And this has nothing to do with autism, no matter how much you want to believe. It's all about readability. When you finally move on from the trivial code you're writing at the moment, you no doubt will want people to conform to a certain consistencies, that is of course if you ever work on projects that require more people.
>>
>>58764274
it's my main programming language since 2007

>>58764276
for server side programming it's already the best, for general purpose programming i am asking

i've been using python for some automation tasks and they introduced grumpy, it's a full replacement of cpython(default interpreter) and source to source compiler from python to go. so you can convert your python codes to native go programs without external dependency. (it's fairly new and there are some modules missing tho)
>>
>>58764262
Go is a meme language. You can throw a rock and hit a better programming language (so to speak).
>>
>>58764286
>He isn't even really conforming to that style; there isn't even full consistency.
Where was that anon not consistent with Allman-style brackets?

>When you finally move on from the trivial code you're writing at the moment, you no doubt will want people to conform to a certain consistencies, that is of course if you ever work on projects that require more people.
Nice assumptions.

I'm employed as a developer, and I work with the other programmers here on projects.

We all use Allman, sans two people, and those two people aren't an issue because they either Allman-format it before a push or we just click literally one button to format it that way when we go to read that code.

Complaining about brackets is a complete non-issue. There are much more important things to focus on than the code's bracket style.
>>
>>58764316
>for server side programming it's already the best
What makes you believe this? Do you think this is an objective fact? If so, what can you provide to show that this is demonstrably true?

Keep in mind you'd need to show that it is the best for literally all cases of server-side programming, regardless of in-house developer knowledge, existing technical debt, and ease-of-integration with all manner of cloud services.
>>
gson or jackson?
>>
>>58764361
i use it myself for some very busy services (they used to work on C# and php), but i cannot prove that it's the best since i didn't try all the other candidates. but i am convinced that it's the best. many big companies are migrating from python, ruby, java or C# to golang for server side programming (not talking about web programming ofc.)

some of the links i've read and collected before

https://blogs.dropbox.com/tech/2014/07/open-sourcing-our-go-libraries/
https://www.iron.io/how-we-went-from-30-servers-to-2-go/
https://sendgrid.com/blog/convince-company-go-golang/
https://medium.com/@tjholowaychuk/farewell-node-js-4ba9e7f3e52b#.l0jysnclg
https://blog.golang.org/qihoo
>>
>>58764316
>>58764361
If something is better than python for server side programming, that doesn't mean much.

Try a managed language like Java or C#, which are far better.
>>
>>58764469
Go is really bad though
>>
File: 1482370104673.jpg (26KB, 350x437px) Image search: [Google]
1482370104673.jpg
26KB, 350x437px
/pol/ here

I need to learn programming for the coming race war. Here's my plan. Learn python, learn javascript syntax, learn SQL syntax, learn PHP syntax, learn ASP syntax and learn CSS syntax. Is this a good plan or should I revise it?
>>
>>58764807
learn C
>>
>>58764807
Ignoring the irrelevant parts of your post, that's actually not too bad a plan purely for job availability purposes.

I don't care for any of those languages, except I don't mind writing SQL.

Also, >>>/g/wdg
>>
>>58764807
haskell is for you
>>
>>58764789
Go is a like Plan 9 (the movie, not the OS). So hilariously bad it's good.

>>58764807
IT is a jewish industry. Stay out of it as far as possible.
>>
New thread:

>>58764819
>>58764819
>>58764819
>>
>>58764807
learn C, the first programming language is important, if you fuck-up your brain with python you'll never recover. don't be a pajeet
>>
Does this make sense?
http://pastebin.com/HCh3sShD
>>
>>58764807
>/pol/
Learn haskell, install Gentoo.
>>
>>58764189
>irresponsible amount of fake cum
>irresponsible
I've taken more cum in my asshole than this spits out, so it's all good lad; thanks for the advice, too!
Thread posts: 317
Thread images: 36


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