[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: 315
Thread images: 35

File: DPT.png (389KB, 934x1000px) Image search: [Google]
DPT.png
389KB, 934x1000px
Old thread: >>56826959

What are you working on /g/?
>>
Rewriting the linux kernel in Scratch
>>
>>56829315
>arbitrarily defining what "inverting a binary tree" means all by yourself
>even if it's the intuitive definition
I have problems with this
>>
>>56831367
the least kawaii trap op image

please use himegota next time
>>
>>56831398
I'm not divulging the company name here.
Yes. Their email to me started with how impressed they were with my handling of the company bots on codefights.

Hope that helps. I am off to bed.
>>
>>56831443
>I'm not divulging the company name here.
Why not? If it's big name there's no risk.
>>
>>56831469
He's probably one in like, two or three people that got scouted via that website.
It's pretty obvious.
>>
>>56831367
Still working on my metronome.

I have problem where i sometimes want to start playing a sample again before it has ended playing, but it wont let me.

So now i probably have to make an ugly solution where i have the same sample in several audio objects and fire them off sequentially. Maybe that'll work.

This is what you get for listening to /g/ and using a high level API.
>>
>>56831481
A big name company is going to be scouting more people than that m8.
>>
>>56831435

The dictionary definition of invert is to "put upside down or in the opposite position, order, or arrangement."

It's not an arbitrary definition if it works with the dictionary definition.
>>
I just thought of something -- since Image/Bitmap just wrap GDI+, you could also skirt the whole 65kx65k res limit from GDI if you wrote your own parser and used a simple FastImage class. That'd give you a lot more latitude in working on huge files (scanned maps, etc).
>>
>>56831500
But what does it mean to put a graph upside down?
>>
enum format_tag {
CODE_L, CODE_R,
SPOILER_L, SPOILER_R,
/* ~~ */
SUPPORTED_TAGS /* total enum count (should be 4) */
};


Is this undefined behavior?
>>
File: invert.gif (26KB, 385x279px) Image search: [Google]
invert.gif
26KB, 385x279px
>>56831500

But what if they want the tree to be upside down?

Observe!
>>
>>56831555
Nope. That should map to zero through four.
>>
>>56831568
That's the same graph, it's not changed.
>>
>>56831605
SURPRISE
>>
My random image generator program works with big ol images. I'm going to cum on the fucking floor if I don't figure out why it can't produce anything smaller than 210x210 without segfaulting
>>
>>56831617

Post yer source fag
>>
>>56831630
I'm on mobile and my wifi adapter isn't working :^(

I'm going to rewrite the broken stuff tomorrow morning
>>
>>56831662

Likely story. We won't bully unless it's really bad.
>>
>>56831662
Tether your phone to your computer over usb and use your phone's wifi anon-senpai.
>>
>>56831605
Flipping left and right is also the same graph.
>>
>>56831555
Not at all.
It's completely well-defined, and I've even seen several libraries do that.
>>
>>56831568
Accshually, formally you havent put the graph upside down; just the embedding of the graph. So *nyeh*
>>
>>56831696
>>56831693
it's too late I've already broken out gdb and I'm gonna get to the bottom of this
>>
>>56831367
why does she have one of those turkish hats
>>
>>56831876
Computer Science was invented in Ottoman Empire.
>>
>>56831876
One of the authors of SICP, Hal Abelson shows up in the SICP video lectures wearing that hat.
>>
>>56831900
nice try lol
>>
>>56831900
WE
>>
Trying desperately to drown my emotions in alcohol.
I don't want to go back to work and keep having to write powershell scripts.
I really, really don't want to.
They're so obtuse.
>>
>>56831928
polish up that resume this weekend anon
>>
>>56831970

That's what I've been working on. Going to go to some of the career fairs this year and see what's out there.
>>
>>56831568
I once had to rotate a binary tree 360 degrees
>>
>>56832084

Incredible.
>>
>>56832140
I couldn't do it so I turned 2pi radians and walked away
>>
File: l8AIynb.png (65KB, 655x722px) Image search: [Google]
l8AIynb.png
65KB, 655x722px
So this needs an adjacency list of includes right?

main.cpp -> Class1.hpp, Class2.hpp
Class2.hpp -> Class1.hpp, Class2.cpp
Class1.hpp -> Class1.cpp

I currently implement it like that but my algorithm to detect it only detects -PAIRS- of redundancy and not more than two. It just compares the includes of one file against that includes' includes.

Another Idea I thought about involves having the adjacency list being a list of the includes and its "includers":


Class1.hpp -> Class1.cpp, main.cpp, Class2.hpp
Class2.hpp -> main.cpp, Class2.cpp

but i dont know the algorithm to detect a redundancy that doesn't involve some crazy as hell recursion that could potentially cycle into infinity.
>>
>>56832207
And then you learn about include guards, and header file pollution is no longer.
>>
>>56832279
pragma once
>>
>>56832300
#
>>
>>56832300
 P
NOT
R
T
A
B
L
E
>>
>>56832315
You're doing it wrong


>>56832300
  P
N O T
R
T
A
B
L
E

The power of C compels you!
>>
>>56832315
>>56832335

POT NORTABLE!
>>
>>56832335
    P
O
R
N O T
A
B
L
E
>>
>>56832349
That's not a proper cross
>>
File: 1474332652795.gif (88KB, 10000x10000px) Image search: [Google]
1474332652795.gif
88KB, 10000x10000px
>>56832349
>>56832345
>>56832335
>>56832315
>>56832310
>>56832300
>>56832279

pls help
>>
>>56832352
C
R
N O T
S
S
[/core]
>>
File: excellent pape.jpg (103KB, 700x700px) Image search: [Google]
excellent pape.jpg
103KB, 700x700px
>tfw building a web frontend for your project

I am either going to kill the creator of CSS or myself
>>
>>56832363
>frogposter
>webdev
It all makes sense now
>>
>>56832207
would an adjacency matrix make this easier i forget
>>
>>56832368
not a webdev this is just for fun :^)
>>
hey /dpt/ rate my 1337 hacker code
#include <stdio.h>
#include <superHack.h>
main()
{
printf("Hack world y or n?\n");
hackEngage.Start();
)
>>
I think I just went retarded with my pointers, I just don't get why it works most of the time
>>
i love my waifus so much...

>>56832368
webdevs are the only solo devs that can make money
>>
Tips for learning pointers in C? I'm reading the holy book right now but it just isn't clicking 100% for some reason, what else should I look at.
>>
>>56832386
Doesn't compile
>>
>>56832405
git gud it's easy you fucking scrup
>>
File: megumin.jpg (339KB, 1029x850px) Image search: [Google]
megumin.jpg
339KB, 1029x850px
How do I become a 4 star programmer, /g/?
>>
>>56832414
You must vibrate higher and transcend this dimension
>>
>>56832207
pls help
>>
File: Seingrips flag.jpg (2MB, 2000x2000px) Image search: [Google]
Seingrips flag.jpg
2MB, 2000x2000px
>>56832421
>>
>>56832414
#define ptr(a) a*

Now you're a one star programmer
>>
>>56832405
A pointer is just a variable that holds a memory address.
Dereference it with * or [] to see the data that address points to.

You can go pretty deep with pointers, especially when working with structs made of multi-dimensional pointers.
>>
>>56832431
I saw death grips live they were cool
>>
>>56832442
I guess I'm just not grasping when to use them
>>
>>56832454
You can pass pointers into a function instead of just a value
>>
In C, is there any library or function that lets me change the color of characters onscreen? I don't want to do this with syscalls because it would be really long and add a ton of lines to the code.

What I'm trying to do is:
- make a simple system that shows four rows of seats
- seats that are taken are shown in yellow
- seats that are free are shown in green
>>
>>56832479
see>>56832335
>>
>>56832479
Why not syscalls?
>>
>>56832207
Why not make your adjacency list contain only a files includers? Then each file that has an adjacency list larger than 1 is a problem file.
>>
>>56832479
there is probably some library that will try to do the right thing depending on the system
>>
>>56832454
I'll give an example.
char *str = (char *) malloc(sizeof(char) * 6);
memcpy(str, "hello", 6);
str[5] = '\0'; /* null terminate */
/* or */
*(str + 5) = '\0'
/* or */
char *p = &str[5];
*p = '\0';

All of the above do the same thing.
Literally everything and everything in C is an abstraction built around pointers and pointer arithmetic.
>>
>>56832506
system ("color 0A")

Now everything is green. I only want to make certain characters a certain color, like the extended ls does in linux.

Btw, I'm using windows.
>>
>>56832454
When you need to use them, you'll know it.
>>
>>56832527
windows.h
>>
>>56832479
https://en.wikipedia.org/wiki/ANSI_escape_code
#include <stdio.h>

#define YELLOW "\033[33m"
#define RESET "\033[0m"

int main()
{
printf(YELLOW"test\n"RESET);
}
>>
>>56832526
Thank you so much for the example, that actually helps a lot.
>>
>>56832527
windows.h

SetConsoleTextAttribute()
>>
>>56832555
Wow, how does this work on black and white only monitors?
>>
>>56832527

Use ncurses. Yes it works on Windows. No, you shouldn't use the system() function at all.
>>
>>56832511
is this really it?

Wouldn't you need to resolve/trace some directional stuff to detect upwards?

else it would be "Class1.cpp, main.cpp, Class2.hpp"
when it should just be "main.cpp, Class2.hpp"
>>
>>56832555
>>56832533
>>56832566
Thanks for the answers.
>>
>>56832570
It would presumably do nothing.
>>
>>56831568
This is actually an interesting problem, now that I think about it.
Turn a binary tree "upside down", by making link lists for each of its leafs that lead to the root.
e.g.
; binary tree:
4
/ \
2 5
/ \ \
1 3 6
; represented by:
(tree (tree (leaf 1)
2
(leaf 3))
4
(tree #f
5
(leaf 6)))
; upside-down:
((1 2 4) (3 2 4) (6 5 4))
>>
>>56832570
It depends on the behaviour of your terminal.
>>
>>56832586

That's one of the solutions that people have come up with for what it means to "invert" the tree. That is, each leaf becomes a parent and leads down to the original root.
>>
>>56832580

ANSI escape codes actually don't work on Windows, IIRC. You basically have to use the windows.h stuff. Libraries like ncurses abstract all of this behind portable function calls. On Windows, it might use the Win32 API to handle console manipulation, while on Unix-like systems, ANSI escape codes might be used.
>>
>>56832635
According to the Wikipedia article, BotnetOS 10 supports ANSI escape codes.
>>
>>56831367
How would you go about simulating a NFA in C? I'm using linked lists to represent sets but it feels like I'm being very inefficient
>>
>>56831433
A masochist I see.
>>
>>56832586
btw here is a solution
(struct tree (left val right))
(struct leaf (val))

(define (upside-down t)
(cond
[(false? t) '()]
[(tree? t)
(map (lambda (x) (cons (tree-val t) x))
(append (upside-down (tree-left t))
(upside-down (tree-right t))))]
[(leaf? t) (list (leaf-val t))]))

goodnight
>>
>>56832644
I tested this on Windows 7, and it doesn't work on Command Prompt. I was curious because I remember my teacher from 7 years ago teaching this, but I believe he said it was based on the terminal emulator implementation. I remember he showed it to us using a really old hardware text terminal.
>>
>>56832646
Generating is not the problem. Its detecting the redundancies.
>>
for each file f in files:
for each include i in f:
adjacency[i].add(f);

Fixed a typo. Now i don't see a problem.
>>
>>56832653
Efficient simulation of nondeterminism -> P=NP.
>>
>>56832672
As i said: each file that is included more than once will have an adjacency list larger than 1. I still don't see the problem.
>>
im starting a c# book, so I downloaded project rider from jetbrains, would anyone tell me if im beter off using mono or net core? im on debian
>>
>>56832704
>else it would be "Class1.cpp, main.cpp, Class2.hpp"
>when it should just be "main.cpp, Class2.hpp"

given the adjacency list:

Class1.hpp -> Class1.cpp, main.cpp, Class2.hpp
Class2.hpp -> main.cpp, Class2.cpp

just going by "more than one" wouldn't really be accurate would it?
>>
>>56832704
>>56832765
how about if it's an odd amount.

or something-something detecting if its directional vs undirectional
>>
/*Calculate the hypotenuse of a right triangle given a and b using the Pythagorean theorem a^2 + b^2 =c^2*/ 

#include <stdio.h>
#include <math.h>


int main()
{
float a;
float b;
float c;

printf("Please enter the first side of your triangle: ");
scanf("%f", &a);

pow(a, 2);

printf("Please enter the second side of your traingle: ");
scanf("%f", &b);

pow(b, 2);


c = (a * b);


printf("The hypoteneuse of your triangle is %f ", c);

}

>>
>>56832859

Can someone show me how to fix this in C? I have to use the pow and sqrrt function. I would sqrt the c and the left side to simplify, but not sure how to go about it.
>>
>>56832859
Congratulations. Babbys second program.
>>
>>56832875
c = sqrt( pow(a,2) + pow(b,2) ); 

Just like math.
>>
>>56832859
>c = (a * b);
what are you doing m8
>>
File: cryingJ.jpg (182KB, 900x900px) Image search: [Google]
cryingJ.jpg
182KB, 900x900px
>>56832878
Peterr?!?
>>
>>56832765
Lets ignore reality for a bit and just consider the problem of a file being included by multiple include files. Then my solution would work, right?

What would happen if you did that and then consider yeah compilation unit (.cpp file) as a separate project?
>>
>>56832859
>c = (a * b)
Please tell me where are you going with this.
>>
>>56832926
>and then consider yeah compilation unit (.cpp file) as a separate project?
boy wat
just ignore cpp files?

wouldnt that not let main.cpp detect its redundancy then? This is for an assignment yoy
>>56832207
>>
>>56832527
The system function is not a syscall.
>>
Whats a better "First' language Java or C#? How hard is it to learn syntax/basics of making shit and how long does it take you guys to transition over to a new language? I jsut want to make neat, shitty little programs and feel like I'm doing something with my life.
>>
>>56832960
>yeah compilation
wtf, how did i typo 'each' this badly?

I mean dividing the the problem into several independent sub problems. Ignore cpp files for one sub and only consider one cpp file at a time for the other sub.
>>
>>56832998
C#
>>
>>56832998
>I jsut want to make neat, shitty little programs
Haskell
>>
File: 1454281255483.jpg (123KB, 400x525px) Image search: [Google]
1454281255483.jpg
123KB, 400x525px
So will you guys help me understand something, or do I need to go to /sqt/ for that?
>>
>>56833018
If it's programming related, then probably
>>
>>56833010
>>56832998
>>56832734
mono or net core!?!?!?
>>
>>56833018
I dare not answer this question, for fear of having to eat my words.
>>
>>56832998
Common Lisp or Racket.
>>
>>56832207
pls
>>
>>56832998
I don't know, but i think C# is a better investment of time.
>>
>>56833024
It is. I'm having a hard time grasping classes and how to set one up.

>>56833033
I'm not trying to make anyone eat their words here.
>>
File: le m8 face.jpg (216KB, 1080x1920px) Image search: [Google]
le m8 face.jpg
216KB, 1080x1920px
>>56833034
>>
>>56833054
>le
>m8
Fuck off
>>
>>56833053
>>56833018
/dpt/ is not averse to helping noobs, but sometimes the questions are just too stupid
>>
>>56833095
What have you seen before that qualifies as such?
>inb4 mine
>>
File: gematria1.png (504KB, 1600x1540px) Image search: [Google]
gematria1.png
504KB, 1600x1540px
Trying to make a homebrew Hebrew gematria calculator. There are several on the web but I wanted to test myself after a month of learning C++. What can I improve? Most importantly, how do I finish it?
>>
File: 8754132.jpg (36KB, 300x360px) Image search: [Google]
8754132.jpg
36KB, 300x360px
>compile java project
>can't find class files for library
>fiddle with class path and crap for hours
>still doesn't work
>>
>>56833125
why wouldn't you use a language that favors parentheses in this case
>>
>>56833124
Oh, there was this one earlier today that couldn't make herself understood because she didn't understand the difference between a class and an object, and refused to read a book.

Actually, come to think, that might have been you. Was that you?
>>
tfw no programming anime gf
>>
File: ed.gif (835KB, 450x246px) Image search: [Google]
ed.gif
835KB, 450x246px
>>56832207
>>
I just pucked up c and wew memory apis make me so very not happy.
>>
>>56833162
I'm two semesters into my Comp Sci Major (first semester this past winter fml) and all I know how to work with is a little JavaScript, C++, and HTML.
>>
>>56833125
those are illegal variable names in c++
>>
>>56833210
Shiet
>>
Does C preprocessor abuse count as metaprogramming?
>>
>>56833125
Do it in Python for unicode support and easy peasy text handling.
>>
>>56833175
I'm not a grill.

Odd coincidence though.
>>
>>56833175
>>56833236
How many threads behind? Kind of want to see it.
>>
>>56833125
Also, lines 16 and 17 are fucked.
>>
>>56833232
I believe Python is next semester. I'll put this project on the back burner for now then. Thx anyway!
>>
>>56833276
If you have the time it's no harm learning it now and doing the project.
It should be really easy to learn enough Python to at least get started and it will give you a headstart on your classes next semester.
>>
>>56833264

>>56825751
>>
>>56833305
kek
I like to think I'm a bit more competent than that at least.
>>
File: poo faints.jpg (150KB, 594x396px) Image search: [Google]
poo faints.jpg
150KB, 594x396px
>>56833305
>>
File: fwU06aX.png (14KB, 840x360px) Image search: [Google]
fwU06aX.png
14KB, 840x360px
>>56832207
Here's what I got so far using the adjacency list of includes.

It only does pairs for w/e reason
>>
C in 2016 LUL
>>
File: 1467835392609.png (263KB, 532x320px) Image search: [Google]
1467835392609.png
263KB, 532x320px
>>56833389
>>
>>56833521
what do you use then?
>>
drumpf or killary
>>
>>56833560
not him but I use HTML
>>
>>56833646
i use css
lets make videogamez
>>
>>56833590

Johnson. Or Stein. Either is a better choice, to be honest.

>>56833521

Why not?
>>
>>56833667
johnson is retarded
>what is a leppo
and stein is a commie
>>
>>56833677

I would rather someone who knows literally nothing about foreign policy than either Hillary or Trump. We need someone to restore all of the civil liberties the past several presidents ripped away from us anyways.
>>
>>56833677
hes not retarded, he's just high
>>
I want to start learning about drivers. Specifically, webcam drivers. I'm going to man up and actually do that shit.
Where do I start? I know a bit of C++ but,

Today I actually googled "how to write a write driver in python"! Please kill me.

Any links/books would be appreciated.
>>
File: 2016-09-29-022511_1911x935_scrot.png (231KB, 1911x935px) Image search: [Google]
2016-09-29-022511_1911x935_scrot.png
231KB, 1911x935px
can somebody tell me what's going wrong?
>>
>>56833879

>how to write driver in python
You can't. There's no Python interpreter in the kernel of any major OS.
>>
>>56833910
Could you write python driver?
>>
>>56833879
>implying anyone on /g/ has ever interfaced with hardware directly
>>
>>56833910
>>56833938
You can write a C module for python that is a driver.
:^)
>>
>>56833901
For a record you want

Date { day = ..., month = ..., year = ... }
or

Date x y z
>>
>std::string is now considered "raw"
The fuck? what's the "modern" string type in C++ now?
>>
>>56833973
can you remind me how to reverse pattern match?

like
Just n = lookup something list
is that the sytax?
>>
>>56834041
That works

Just think of a pattern as like an identifier.
In any situation where you could be using an identifier / a variable name, you could also be using a pattern
>>
>>56833952
>using the smiley with a carat nose
>>
>>56834053
I see, then, how come, my shit doesn't work?
>>
>>56832998
Java is obviously better but I wouldn't take it as a first language. Do c or something
>>
>>56834076
You literally want

Date { day = read (take 2 d')
, ...

or
You don't actually "reverse pattern match" anywhere
>>
>>56834097
by or I was about to say

Date
read (take 2 d')
..
..
>>
>>56834097
no sorry, I mean that when I do
Just n = lookup x xs
>>
>>56834106
You can only define top level bindings that way

Do you mean to do a let binding, a where binding, a lambda abstraction, etc?
>>
>>56834114
im doing in in a let
I would show code, but I'm super embarrased
it looke like very pajeet
>>
>>56834130
Post the code pajeet
>>
>>56831367
>install GSL
>everything is in order
>call gsl_sf_hypergeo.h in code
>get "undefined reference to gsl_sf_hypergeoU" error in compiler
>literally have no idea how to link library to code
>the manual is absolutely useless
>mfw
>>
What's a good C exercises book

I know all the syntaxes but they are useless if I can't apply them
>>
>>56834137
be mercy
>>
>>56834160
What's the error you're getting?
>>
>>56834171
hold on
im still fixing i
>>
>>56833938
You might be able to write a driver that is a python interpreter and runs python code in the kernel, but that would be beyond retarded.

>>56833952
Err... no. C modules are just dynamically loaded libraries. The Python application is still just a user process. There is no way to elevate a user process to run as a kernel module in pretty much any major OS.
>>
>>56832363
What's wrong with CSS?
>>
File: 1382980467427.gif (139KB, 250x250px) Image search: [Google]
1382980467427.gif
139KB, 250x250px
>>56832207
help!
>>
File: 1474206696056.png (52KB, 657x527px) Image search: [Google]
1474206696056.png
52KB, 657x527px
>>56834256
>but that would be beyond retarded.
n-no it not
>>
>>56834344
>what i said is not retarded
>frogpost

You couldn't make it up
>>
>>56834344

Just imagine a type error taking the entire operating system down with it.
>>
>>56834412
Are you telling me you've never needed to use
for (...)
elif (...)
when writing an OS?
>>
>>56834412
Every language can have errors.
>>
i am an idiot and have this "undefined reference class::member" problem using gcc/make. i know it's a linker issue. i'm in the middle of this huge multi-tiered make project and i'm trying to use some of the classes. i am using code::blocks.

i have a dozen or so #include lines and code::blocks can easily find the function declarations in the .h files and lets me do autocomplete stuff just fine. i know i am missing something stupid and simple, but what? the .h files and the .cc files are in different dirs, but the project compiles fine with ./configure; make; make install.

this project is so complex. they overloaded bool and cout and implemented their own streams for file handling so i can't just fopen() if i want to use their parsing member functions. this is the exact kind of stuff that made me hate c++.
>>
>>56834467
Some more than others
>>
no /wdg/ so i'll ask here

whats the difference between a controller and model? why is it if i'm routing a request from a post method i should ssend it to a controller as opposed to a model?
>>
>>56834638
OOP is bad
>>
>>56834638
Controllaz are just request handlers.
Models mirror what is kept in yo data base
>>
I'm a dev, but I have to interview a PM joining our team, what questions should I even ask..?
>>
>>56834734
>Controllaz are just request handlers.

ah so thats why it handles the post request? i still don't really understand what models do though. i imagine if you have a lot of processing which needs to be done on the data in your DB you'd do that in the model?
>>
>>56834743
What's a PM?
>>
File: 1473859533547.png (563KB, 773x960px) Image search: [Google]
1473859533547.png
563KB, 773x960px
>>56834743
A modified trolley problem to make it sound relevant to pm's job.
>>
>>56834743

why is a dev interviewing a project manager?
>>
>>56834747
Models are for ezpz json to c# data binding.
Largely pointless. Most server-side logic is done in the controller.
>>
>>56834638

controller is middleman for model and view. the model handles data, the view handles pretty gui, the controller handles matching the two together. any request from the view needs to be interpreted in the controller so the model can understand it and give the correct data. think of it as a language translation where the view speaks japanese and the model speaks english, but the controller speaks both.
>>
>>56834845
Why not have everybody speak same language lol?
>>
>>56832998
Definitely C into Java.
>>
>>56834929
node.js would like to have a word with you
>>
>>56834759
project manager dumby
>>
>>56835077
could've meant anything
>>
What do project managers even do?
I knew some people getting interviewed for PM positions at Microsoft straight out of undergrad.
Shouldn't a manager have more industry and business experience?
>>
>>56835109
Shill oop
>>
>>56834144

>undefined reference to gsl_sf_hypergeoU"

Your problem all along is not knowing how to link libraries in GCC? What exactly are you typing into GCC to compile your application with GSL?
>>
strcpy_s((char*)cText, 4, (char*)p4);


cText has 8 elements + null terminator and p4 has 4 elements + null terminator.

i want to get all the elements in p4 except null terminator and put them into the first 4 elements in cText. running the above line doesnt work and gives me an error.
>>
>>56835149
>strcpy_s
>_s
Please no.
>>
>>56834717
Ebin
>>
>>56835178
but microsoft tells me it's SAFE :(
>>
>>56835193
C11 annex K is a fucking joke, and Microsoft can go fuck themselves for shoehorning it into the language.
>>
>>56834929

no one wants to write sql queries just to look at a menu
>>
>>56834607

never mind, i included too many of their header files.
>>
Is there such a program that will go through all of my source files, see what each file is including and generate a Makefile that isn't a retarded mess?
>>
>>56834429

Of course you use for loops and else if statements in operating systems... but the language of choice is typically C or C++. Python would be atrocious.

>>56834467

Yes. What I am talking about in specific, however, are runtime errors. There is no such thing as a runtime type error in C.
>>
>>56835445
Neither C nor C++ has for else
>>
>>56835453

I thought you were referring to them as two different concepts. Honestly... I've never had to use a loop+else combo, and anywhere that it might be more convenient would not be enough to justify the use of Python in a kernel module.
>>
>>56835445
What's the difference between runtime type error and any other runtime error?
>>
>>56835453
It wouldn't be hard to do for else in C.
>>
>>56835367
gcc -M
>>
>>56835498
totally not retarded
seq.o: seq.c /usr/include/stdc-predef.h /usr/include/stdio.h \
/usr/include/features.h /usr/include/sys/cdefs.h \
/usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \
/usr/include/gnu/stubs-64.h \
/usr/lib/gcc/x86_64-pc-linux-gnu/6.2.1/include/stddef.h \
/usr/include/bits/types.h /usr/include/bits/typesizes.h \
/usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \
/usr/lib/gcc/x86_64-pc-linux-gnu/6.2.1/include/stdarg.h \
/usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h seq.h
seq.o: seq.h /usr/include/stdc-predef.h

>>
>>56835513
gcc -MM will not output any system headers.
https://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html
>>
>>56835526
nice thanks
>>
File: large_1427_rk61aa1.jpg (144KB, 1200x537px) Image search: [Google]
large_1427_rk61aa1.jpg
144KB, 1200x537px
Anything crucial missing on this keyboard when I want to program?
>>
File: control structure.png (26KB, 871x312px) Image search: [Google]
control structure.png
26KB, 871x312px
>using a language that doesn't allow you to define your own control flow structures
>>
>>56834810
Team culture and fit

>>56834795
Hmm, I like that.
>>
>>56835484

Nothing. They were just being used as an example of the myriad of runtime errors that can be tossed around in Python. Python is a dynamic language and has a strong focus on the runtime. C and C++ get most things detected at compile time. Generally speaking, you don't want to go tossing around exceptions in a kernel module, or doing anything that could at all cause a crash.
>>
>download a texture off the internet
>try and include it in a project
>error : missing asset "C:\Users\Silliman\Documents\Tutorials\Textures\Metallic_Texture.png"

ok who the FUCK thought it was a good idea to make assets not have relative paths?
you can't even edit these finished textures in either as far as I can tell
>>
senior software engineering student. I NEED personal projects. I have exactly..zero.

languages:
proficient in -> Java, C
novice in -> Ruby, PHP, Rust
complete noob in -> C++, Python

other:
I also know HTML, CSS, and SQL

any ideas?

inb4 make your own operating system, kernel, design your own relational DBMS, other troll answers
>>
>>56835579
>proficient in Java
There's no hope for you
You only get 1 soul
>>
>>56835561
is the _ like a default in a switch?
>>
>>56835579
Python is pretty easy, though it's not that good. I would suggest you put your efforts on C++, right now.
>>
>>56835600
Yes, exactly
It's a pattern that matches anything
>>
>>56835611
>Python is shit
>Suggests C++
So going from shit to different shit.
>>
Started CS50x, finally going to do it /g/
>>
>>56834607

i don't fucking get this at all. now i get "file not found" except when i right click and select Open #include it will open the file. wtf?
>>
I'm building a webservice for a client and I have the backend going
He wants iOS and android app, I have zero experience in any of those
What's a good and quick way to build something that works on both? Xamarin?
>>
>>56835625
At least C++ is a language for people over the age of 12
>>
>>56835659
And under the age of 14
>>
>>56835677
Not at all
>>
If I nest two for cycles I pretty much select a rectangle
for(int i=50; i<100; i++)
for(int j=50; j<100; j++)
...

In this case I selected all the elements from (50,50) to (100,100).

But what if I want to do the opposite and exclude a rectangle from another rectangle.
Do I have to do something like the collision detection between two rectangles or there's a simpler way to implement it.
>>
>>56835654
react native
>>
Functional programming is the future. Lower memory cost and increase in threads suits the functional paradigm which is pure.

Best of all we all get to not fuck around with the crappy overcomplicated mess that is OOP programming. If someone just made Monads a bit easier I'd be really happy.

Also I understand Monoids in theory, it's basically a group (Algebra) without the inverse property, I just can't see how that is applied to programming.
>>
>>56835834
>lower memory cost
not in Haskell

>it's basically a group without the inverse property
that's a monoid
monads are a specific kind of monoid
>>
Is there any reason to use Ruby over Python?
>>
>>56835834
for applications of monoids to programming:

a magma has a closed binary operation
you can think of this as any kind of way of combining two pieces of data (that gives back the same type), e.g. adding numbers, appending vectors, combining updates

a semigroup is an associative magma
this means that
a + (b + c) = (a + b) + c
this has a few uses - one is incremental updates
(((a) + b) + c) + d
e.g. saving transaction logs rather than the entire new state
the other is parallelism
(a + b) + (c + d)
run a + b and c + d on seperate threads, then combine the results

a monoid is a semigroup with an identity element
a + 0 = a
0 + a = a
this lets you fold over lists, and can be a sort of empty state

the traditional example of a monoid is a list, where appending is the operation and an empty list is the identity
"" + a = a
a + "" = a
(a + b) + c = a + (b + c)
>>
>>56835845
it looks like monads in a category C are monoid objects in End(C)
the wiki says godement introduced these in his book which i thought i had read carefully; i guess not. i've really never had to use them for anything
>>
>>56835900
you can use them to describe effectful computations in a pure fashion
>>
>>56835912
i'm speaking as a mathematician. i sometimes have to use stacks and topoi and stuff; i thought the 2-category stuff there that was about as exotic as it got

you would think that people in this field would be all over haskell but even the ones who do theoretical computer science are pretty awful at computers in my experience. it's just interesting
>>
>>56835948
I wish i'd done a degree in mathematics or even computer science proper

Category theory is beyond me, other than some of the simplified uses in Haskell
>>
>>56835896
I get it. I really get it. I've worked with group theory and know abstract algebra. I know what a unit/identity element is. I also know associativity and closure.

Working with Integers, lists, etc. That's just natural I don't get what we monoids is supposed to help you understand.

Thanks for the answer though. I appreciate you taking the effort.
>>
Can anyone help me on assembly programming? I need to add two 128 bit signed numbers together, but the word size is 32 bits. wtf do I do. :>
>>
>>56836016
look at the instances of https://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Monoid.html
for example
>>
>>56835979
i think the problem with category theory is that it's boring. most people need a good reason to wade through the definitions (and it is mostly definitions) and then something interesting to practice them on. just sitting down and reading mac lane cover to cover does not work

always happy to chat about it here. it's not over your head, really

there's always something you wish you had learned earlier. i'm thinking of "getting out" so in the evenings i'm cramming algorithms for whiteboard interviews. many regrets
>>
>>56836028
32 * 4 is 128
>>
>>56835689
"collision detection" makes it sound hard! it's four quick tests. i think whether there's something better depends on what you're actually doing inside the loops
>>
File: 1474720746796.jpg (65KB, 400x290px) Image search: [Google]
1474720746796.jpg
65KB, 400x290px
>>56832386
A hacker is someone who enjoys playful cleverness--not necessarily with computers. The programmers in the old MIT free software community of the 60s and 70s referred to themselves as hackers. Around 1980, journalists who discovered the hacker community mistakenly took the term to mean "security breaker."

Please don't spread this mistake. People who break security are "crackers."
>>
>>56835561
>he can't define macros for control flow
>being a filthy blubfag
(defmacro confirm (&body body)
`(prog (input)
start
(princ "Are you sure you wish to do this? Y/N ")
(setf input (read))
(case input
(Y .,body)
(N (princ "Cancelled."))
(T (go start)))))
>>
>>56836118
better
(defmacro confirm (&body body)
`(tagbody
start
(princ "Are you sure you wish to do this? Y/N ")
(case (read)
(Y .,body)
(N (princ "Cancelled."))
(T (go start)))))
>>
>>56836115
white people can't program for shit
>>
File: 1465297400484.jpg (100KB, 500x500px) Image search: [Google]
1465297400484.jpg
100KB, 500x500px
>>56836118
>>56836128

>choosing to use macros over regular functions
>>
File: IMG_2018.jpg (2MB, 3000x2000px) Image search: [Google]
IMG_2018.jpg
2MB, 3000x2000px
just doing this and that for learning purposes
>>
>>56836209
where should one get started with hardware
are these meme microcontrollers good
>>
>>56836240
You could go directly the 'hardcore' way and start directly with atmel/pic and C or just go for arduino first.
Arduino is pretty easy to learn and you can do lots of nice stuff with it
>>
C Primer Plus
or
C Programming a modern approach
>>
>>56836240

Do arduino like everybody else. Then gradually work your way out of the atmel/babby IDE setup towards TI's MSP430 platform if you actually want to impress people.

I was able to spin my experience enough to get hired as an electronics technician in a factory. No more open office hellholes, feels fucking great.

If you're
>>
>>56836288
k&r
>>
why are global variables in C set to extern by default?
>>
>>56836260
>>56836321
thanks guys; i'll try it out. it's just for fun really
what sorts of things have you done with it?
what's your opinion on the other options that are really little linux boxes?
>>
File: dpt kill yourself.png (459KB, 796x913px) Image search: [Google]
dpt kill yourself.png
459KB, 796x913px
In functional programming, how would you say "either a string or an int"?
>>
>>56836440
Its all strings in fp
>>
>>56836440
Maybe type?
>>
If I put a 16-bit int into a register
Then for each 8-bit register it has, I divide by 2, will the whole 16-bit value be divided?
>>
>>56836559
why not put a 16bit int into a register and divide the upper and lower halves by 2 and see if it works
>>
No.
>>
thinking of making an apple newton like PDA using a Cortex M board, wifi module, and a touch screen, it'll have mango reading, erotica reading, maybe pdf reading thru an online pdf to image service, news reading, maybe even a tiny irc client
>>
>>56836422
why?
>>
>>56834144
I feel you. Installing open source Fortran/C/C++ libraries and then actually calling them from any language is a huge PITA.
>>
Hey guys, in Python, how would I convert a string that spans multiple lines like this:

values 1, 2, 3,
4, 5, 6,
7, 8, 9;


to an array [1,2,3,4,5,6,7,8,9], remove 2 and 5, then write it to a file in the same manner:

values 1, 3, 4,
6, 7, 8,
9;


I'm trying to figure out file manipulations.
>>
Now that genymotion is pay to use, which phone emulator people uses?
>>
>>56836138
This. Why would you need macros for this when you have lazy evaluation?
>>
How do i add class in laravel, wtf is this shit
>>
>>56836948
is there any reason for the 2 and the 5, or do you just want those values removed?

generating an abstracted solution for you is impossible if we don't know the underlying logic you're trying to automate.
>>
>>56836965
nox
>>
>>56836948
what would you do if it were on one line?
>>
>>56837030
>>56837025

The string is in a file. I want to read it, remove the values and write the new string into a different file.

Removing 2 and 5 is just a scenario off the top of my head.

If the input string was written in one line, I would want to print the output the same way I described, at most 3 values per line,
>>
>>56837098

The better question would be what is the best way to capture the numbers between the word "values" and ";" ignoring the number of lines on which they are spread out?
>>
I've come to the conclusion that Mathematica is really, really awesome.

>> Prolog tier awesome pattern matching.
>> Extremely concise syntax for when you want to hash function values to make branched recursion palatable.
>> Very good support for both functional and procedural programming.
>> Ridiculously huge standard library of useful functions.
>> Compiled (unlike Matlab, Python), i.e. for-loops are not 100x slower than C.
>> Fizzbuzz is a one-liner.
>>
>>56831367
is there anything wrong with just knowing python if you're a hobbyist and does knowing python make me a programmer?
>>
>>56837228
Wolfram?
>>
>>56837256
Right. Wolfram Mathematica/Wolfram Language.
>>
>>56837299
I used it for Symbolic Computation/Algebraic Computation, shit is crazy.
>>
>>56831367
I'm having trouble understanding X.509, do I need to supply a client certificate in order to verify a server certificate?
I'm trying to write an IRC bot and I want to verify freenode.

My shit code won't even fit here:
https://ghostbin.com/paste/5ktg7
>>
>>56833879
Read the LKMPG.
>>
>>56837228

It's cool, and great for mathematicians who don't want to use Matlab, but it's also not really a general purpose programming language.
>>
>>56837228
it's pleasant to use. i refuse to do serious mathematical work using something closed-source though. that seems to go against everything we're taught

i hope will stein really gets sage (>python) off the ground now that he's left academia. i would rather feed his ego than stephen wolfram's
>>
File: haskell-logo.png (17KB, 500x353px) Image search: [Google]
haskell-logo.png
17KB, 500x353px
What's the state of Haskell FRP libraries at the moment? I used to write Haskell some years back and always thought it would be cool to make a game in it but never got around to attempting it, what are my options right now?
>>
http://degoes.net/articles/modern-fp-part-2

haskell fags only
>>
File: boom.gif (14KB, 71x100px) Image search: [Google]
boom.gif
14KB, 71x100px
>>56832207
>>
>>56832207
Higher education everybody.
>>
>>56837562
>(ah yes!! this is my chance to use a smug anime girl!!!!!)
>>
>>56836138
Macros allow for you to wrap any code you want within the control structure you want and operate on the contents of the code freely. While the former might be possible to a limited extent with regular functions, the latter is not, unless you redesign the entire architecture of the code to accommodate the structure you want to operate on as a return value.
>>
new thread when ? :3
>>
>>56837649
Whenever you make one, pussy.
>>
File: 1458679968630.jpg (293KB, 389x326px) Image search: [Google]
1458679968630.jpg
293KB, 389x326px
>>56837598
You're boring, you have no ironical intelligence, I can post whatever I want.
>>
>>56837562

Pretty much a non-country.
>>
>>56837420
Eh, I just wrote a fairly non-trivial program in Mathematica and Clojure (compute all Dyck paths with a given area below them, apply that to a stat. physics problem I had). The Mathematica solution ended up being both more concise (due to pattern matching, easy hashing) and faster, which spooked me out enough to write that post.

I agree that its scoping rules limit it for large general purpose stuff, but it's still way more useful for general-ish programming than I first gave it credit for. Especially when you go back to it after having played with Haskell and Prolog, so that you are familiar with the techniques you'd use there. It's way more than a simple toolbox for solving equations and plotting.

>>56837453
Eh. It would definitely be nice to have an open source alternative to Mathematica, but I'm really not a big fan of Python as the alternative.

Tbh I'd rather have a language that supports multiple programming paradigms and with a syntax designed from the ground up to be good for mathy stuff. Julia seems really promising, though due to its focus on speed it does have some C-like gotchas.
>>
File: confused screaming.jpg (9KB, 342x342px) Image search: [Google]
confused screaming.jpg
9KB, 342x342px
>>56836934
>Trying to compile podofo on Windows
I JUST WANTED TO CONCATENATE SOME PAGES IN C++
>>
>>56837245
bump, willing to learn another language but want something CLI only
>>
>>56837648
While that might be true, the confirm macro does not do that, so again: what's the point?
>>
>>56836948
look for values to start recording nums into array, when you reach a EOL start at the beginning of the next line

do this until you reach an empty line, at that point just stop looking for nums

then you can go through the list and use something like filter to remove all nums that are not so in [2, 5]

then just write it back, the formatting you can figure out since it only appears you're writing back at max 3 per line should be more or less the reverse of reading it
Thread posts: 315
Thread images: 35


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