[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 26
File: DPG.png (39 KB, 180x193) Image search: [Google]
DPG.png
39 KB, 180x193
What are you working on /g/?
>>
>>54432088
Link back to the previous thread you dumb fag: >>54424400
>>
>>54432127
No one needs to know it ever existed.
>>
File: DMUX Before the pre alpha_019.png (187 KB, 642x509) Image search: [Google]
DMUX Before the pre alpha_019.png
187 KB, 642x509
>>54432088
Trying to get Irrlicht to render this vehicle properly, trying to get it to work with Bullet physics which is a pain but it will be pretty awesome when I am done.
>>
>>54432088
This thread's the older new thread, so I guess it's legit
>>
>>54432127
Thanks.

>>54432088
QT thread is best thread.

Was working on a toy HDL. Should pick it up again.
>>
>>54432127
Why when there is nothing of value in it?
>>
>>54432088
>>54432110 was up first and anyways...

the gamer is already here >>54432161
>>
>>54432180
No it wasn't, check the times.
>>
>>54432180
Sorry that I enjoy programming
>>
>>54432088
Please do not use an anime image next time, thanks.
>>
#!/usr/bin/env python3

from string import ascii_lowercase as z
z += " "
a = [8, 10, 18, 12, 22, 24, 22, 18, 13, 7, 9, 21, 19, 26, 19, 24, 24, 14, 10, 8, 23, 7, 108074, 27059, 86943, 27017, 12, 8, 8, 26, 18, 15, 14, 3, 20]
b = [22, 17, 17, 26, 2, 2, 22, 13, 26, 1, 4, 9, 12, 18, 7, 22, 10, 13, 9, 18, 12, 19, 81882, 27009, 54882, 54068, 14, 16, 6, 21, 8, 18, 6, 21, 25]
g = ""
for i,j in zip(a,b):
g += z[(i+j)%27]
print(g)
>>
>>54432161
fuck off to >>>/vg/agdg stupid smug ass shitkid
>>
>>54432202
Did I hurt your feelings? I apologize that you are incapable of creating anything involving a 3D world and are limited to two dimensions (and an HTML canvas if I had to guess)
>>
>>54432177

I'll second this. CoC threads are cancer, and the thread was shit up by drama surrounding this guy: >>54432161

>Hurr too many libraries, make shit yourself
As long as he's not using Unity, Unreal Engine, or Game Maker, who cares what libraries he uses? Just, like, make game.
>>
>>54432217
kill yourself idiot, and i'm making 3d games myself, 4chan isn't one person

fucking delusional arrogant cunt
>>
>>54432199
Okay?
>>
>>54432180
>I don't understand how time works :^)

>>54432177
So people know which thread is meant to continue when fuckbois make duplicates, and then reuse those duplicates 4 hours later pretending they're weren't being extremely new.

>>54432188
It could be a lot worse tbqh. If you have a problem, maybe make the thread yourself after the bump limit instead of complaining like a bitch when nobody else bothered at 330 posts.
>>
>>54432249
Woops, last reply meant for: >>54432197
>>
>>54432235
dumb tripfag cancer
>>
>>54432188
oh now i feel dumb
>>54432249
i just saw the link to the new thread to the other first and assumed it was created before
>>54432217
i hope you realize you're not even talking to the guy who made that game. btw it's C++
>>
File: [tilting increases].png (27 KB, 500x500) Image search: [Google]
[tilting increases].png
27 KB, 500x500
>>54432217
>i can (barely) use a pre-built engine
>this means i'm better than everyone else
>this is all new to me so it seems more exciting to me than it really is
>>
>>54432239
http://static.truetrophies.com/customimages/009714.jpg
2.5D indie platformers do not count, it is as easy as 2D
>>54432235
Mah nigga
>>
>>54432276
stupid fuccboi, the joke is on you anyway, your game will be complete shit
>>
>>54432276
>>54432239

2.5D has even less physics than 2D, you might as well be making a 2D platformer.
>>
>>54432276
Nah, we are making something in 3D and not another 2D platformer :^) Bullet physics does not have the best community but it is an awesome physics engine better than anything I can make from scratch
>>
I love the constant salt in /dpt/
>>
I'm not that familiar with databasing, but I need to write an application that accesses data which is stored from a web client or desktop application.

I've been told to use Django rest framework for this, is it better than node.js?
>>
>>54432295
kill yourself stupid sperg, i'm not making a 2.5D or 2D game, it's just your idiotic imagination that's playing tricks on your retarded sperg brain

>>54432307
it's not even hard to make a physics engine fucking arrogant dumbfuck

http://mollyrocket.com/849?node=849
>>
>>54432324
Why is /g/ the board that seems the most stressed out and up its ass all the time?
>>
>>54432343
>not 2D
>not willing to post a code repo
Holy shit I did not even write any code and there is a physics engine
www.bulletphysics.org/
It's like, already made and shit
>>
game fags, you're not interested in programming, you just want to make a fucking game, so kindly fuck off to >>>/vg/agdg

>>54432362
because of insanely idiotic delusional millennial shitkids (especially around this time of the year and december) that are the most abrasive arrogant spergs you could imagine
>>
>>54432331
Sure whatever. It all works. Do you not know python, but know JS? Is the rest of your site in Node? If you answered yes to BOTH of those questions, persuade them otherwise. Otherwise, sure whatever.
>>
>>54432362
newfags and nwofags
>>
>>54432404
It's actually the opposite. I know python but don't know JS so I'll Probably go with Django.
>>
>>54432362
We have a sense of superiority and are deeply misanthropic.
>>
>>54432399
Is this a picture of the dev team for your 2D puzzle platformer where you run over kids? It is probably called PretentiouslyEdgy.js
>>
>>54432425
Then do django. gl m8erade.
>>
>>54432439
kill yourself

your game is shit, it's not good just because it's 3D, you're the pretentious edgy faggot
>>
>babby's first 3d "game"
>can't even into shading or using a physics engine properly
>i'm so fucking good i'm the best programmer in the world because mommy told me so
>>
>>54432468
No, but is not just ANOTHER 2D puzzle platformer, that is what 3D gives it. There is nothing pretentious about the game
>>
http://researchblogs.cs.bham.ac.uk/thelablunch/2016/04/so-what-is-a-pure-programming-language-anyway/
>>
>>54432514
so it's just ANOTHER amateur 3D shitter game, WOOOOOOOOOOW

you're 1 step above pygame, you're still shit
>>
>>54432530
You may not realize that even pyGame is still better than your HTML canvas; so by your own definition you are two notches below me, and that is being overly optimistic of your own situation
>>
>>54432557
you're fucking delusional
>>
>>54432565
>thinking that 3D is better than indie puzzle platformer with pixel art makes a person delusion
Color me delusional then.
>>
>>54432557
http://www.playfuljs.com/a-first-person-engine-in-265-lines/

even this is better than what you have now lmfao
>>
>>54432587
where is my pixel art puzzle platformer?
>>
>>54432590
>js
Is this part of your project? (edgy.js that is); I see you brought up the HTML canvas; your tool of choice.
>>
File: 1461226306431.gif (48 KB, 2034x1491) Image search: [Google]
1461226306431.gif
48 KB, 2034x1491
>>54432610
http://lostallhope.com/suicide-methods
>>
>>54432606
So you did not even make a 2D puzzle platformer with nostalgic pixel art? So you make nothing but shitposts?
>>
File: association graph.png (41 KB, 716x482) Image search: [Google]
association graph.png
41 KB, 716x482
So I'm trying to build a network of associations between concepts for my lolis. To see what things a loli associates with other things I could do a few things. I thought about shortest-path, but that seems to get a less intuitive notion of weight, since I was thinking of 1=fully related, 0=not related, then you could do multuiplicative weighting, unfortunately that's longest path not shortest path which is NP-hard. I could probably do some retarded shit like turn weights from 0 < w <= 1 to 1/w which would a) let me do the log-transform to get multiplicative weights (ie do e^{loga + logb + logc +...} to get abc...etc), and would also kinda let me use shorted path. Wouldn't that work? It'd give you the smallest weight sequence of 1/(ab..c), which would give the largest sequence of ab...c, right? And the log-transform would even work there since all weights are >=1, so no negative weights (breaks dijkstra) (thus no negative cycles(breaks bellman ford / everything)).

If not, any other ideas how I should do this association-graph-traversal? Or any other approaches for computing associations given a graph like this?

..I started this just since I wanted to give the lolis a favourite colour, then then to decide that colour i wanted to base it on what kinds of things they associate with that colour, then you could take the association of each colour for everything within a cutoff then multiply that by their opinion of that thing to get their overall association of the colour I guess.
>>
>>54432633
http://www.w3schools.com/html/html5_canvas.asp
Time to get to work then! (since you have not made your puzzle platformer yet)
>>
>>54432399
>game fags, you're not interested in programming

I sincerely hope that you're talking only about that one guy and not in general.
>>
>>54432640
i'll let you believe that

you're fucking pathetic you made a huge fool of yourself and your project
>>
>>54432646
>So I'm trying to build a network of associations between concepts for my lolis.

This is literally the most /g/ thing I've ever read.
>>
>>54432667
At least I am not making web pages in my free time (since you are yet to deny your love for the HTML canvas)
>>
>>54432666
yes he and his team

i'm making games myself and i'm 99% of the time in /dpt/ because i do actual programming
>>
>>54432684
So you consider HTML to be programming. Interesting.
>>
this is part of why i don't post my projects

any time this game >>54432161 gets mentioned anywhere someone can post the archive of this thread or the previous where the dev was being a massive faggot
>>
>>54432727
You do not post them probably because you do not have any
>>
>>54432736
and you have the masterpiece right there >>54432161
>>
>>54432743
Yes I do c: At least I am proud enough of it that I can post it here and not care about what people think (regardless, at least I am not using an HTML canvas)
>>
>>54432778
>and not care about what people think
you're pretty butthurt for someone who doesn't care what people think
>>
>>54432798
:^)
>>
>>54432727
lol people still call me pizza from that first time i posted one of my projects
anyways, as long as you dont derail a thread complaining about how "/g/ will never be happy with my code because it doesnt sort anime in C WAAAAAAAAAAAAAAAAAH" it'll mostly blow over after a day or two
>>
File: apartments.png (14 KB, 640x480) Image search: [Google]
apartments.png
14 KB, 640x480
>>54431923
>Nigga you gonna insult our project when you are making just ANOTHER FUCKING indie 2D platformer?

Actual dev of that game you called an indie 2D platformer. Do you think my game is a simple 2D game? Is your 3D game more complex? I want your actual opinion.
>>
>>54432646
One option to find the preferences of your adorable lolis:

Represent the associations between k as a directed graph. Represent this directed graph as a matrix. We'll use the strengths of these associations as a Markov chain - we wish to find the steady state vector for this Markov chain. But in order to associate it with a particular idea, multiply it with a matrix that moves 5% (or some other fraction p) towards our "idea" node each iteration.

Now multiply for a bunch of iterations (you can use repeated squaring), feeding it an original probability of 1 specifically for our original idea node. Our end result matrix will be representative of how ideas "flow outward" from our original one.

We can do n iterations of this flow in O(k^2.8*log(n)) time.

To select the idea that is most closely related to our original, for example, one of a set of colors, simply iterate through the colors and find which one has the highest probability (or, "strength").

How about it? If you have any questions I can answer.
>>
>>54432979
whats your entity system

are you using a component system or are you hard-coding your objects and they all inherit from some entity base class
>>
>>54433066
between k ideas*
>>
>>54432161
That's a nice ray tracer anon, keep up the good work!
>>
>>54433090
>muh meme buzzwords
fuck off
>>
>>54433090

I'm not using an entity-component system.
>>
>>54433151
>what ____ system are you using
>i'm not using ___

thanks
>>
>>54432684
>99% of the time in /dpt/
>actual programming
I'm sorry, but if you can't average 2 numbers you're not actually a programmer.
>>
>>54433066

Wouldn't this be an issue if there's a lot of concepts? Like it might be a pretty sparse graph. Is the matrix the adjacency matrix, or a laplacian matrix or what? (I'm assuming adjacency).

I assume the weights would be 1 to 0 here too, right?

>>54433161

I've got an Entity base class.
>>
>>54433151
based

don't fall for the meme
>>
>>54433242
can we talk about entity systems because i got a game in mind and entity-management is shitting my ass up.

game engines keep falling for the component-meme and I dont hear of much else.

How do I get the "anything can happen to anything" to occur without having 3424234234 classes for one spec of variance.
>>
>>54433220
A weighted adjacency matrix. It wouldn't be sparse. Even if you made it sparse, the 5% "decay" I mentioned would fill every node of the transformation that happens once per iteration. But I'm pretty skeptical that you would have enough concepts for time complexity or memory to be an issue with dense matrices.
>>
I haven't been on /g/ in like 2 years

Are there any new meme languages to learn or books to read?
>>
>>54433299
If you don't know what meme languages to learn, have you not been keeping up with programming outside of DPT either?
>>
>>54433299
There's this hip new language called C
>>
>>54433332
>missed quints into dubs
>54433333
C has betrayed me
>>
>>54433327
Well I've been going to state school and learning generic things like math and shit

I haven't had much time for anything else
>>
File: nice.jpg (206 KB, 816x816) Image search: [Google]
nice.jpg
206 KB, 816x816
>>54433344

>matching exfix dubs over trips

I TAKE IT BACK
I LOVE YOU C
>>
>>54433299
Go is the only /g/ approved programming language for new projects.
>>
>>54433383
Don't lie, Satan.
>>
>>54433403
css is not programming
>>
>>54433352
Well, that's fair. Try spend like 15 or 30 minutes a day browsing hackernews or DPT or r/programming, though. It's good for your brain.
>>
i finally found the video i was looking for.
https://www.youtube.com/watch?v=JHGkaShoyNs
CQRS and event sourcing. has anyone seen this?
>>
Currently thinking up, typing out, coding and outlining a beginner's manual I am making for my close group of friends to learn programming and web design with me so we can get some work done.

My current "target", meaning I'm speaking at this person in this portion of the writing I'll be doing, is a friend that works in sales and marketing and has literally lost touch with his mind. He is all estrogen and bile but he has his old flare still, which I think means there's hope. This guy I used to talk books and math and all sorts of stupidness ( but it was more than boring ) and now it's pretty much we play asshats or we talk about things neither of us really gives a shit about. It's strange. I asked if he'd be interested in working on something like this and he said yeah.

I've got about 10000 words down and some minimal code examples. I'm trying to outline a structural pattern first and then suggest courses of action.

I'm going to be talking c and computer science then I'll be moving on to javascript and probably gui design and gui design alternatives.

Any tips for keeping it feeling legit while I keeps it casual are welcome. I'm afraid he may take my wording for prose rather than an adjustment to the lexical premise. I want it to come off naturally when he has the epiphany.
>>
>>54433484
>all estrogen and bile
What do you mean?

I can't really offer that much help, but it really depends on the attitude of your friends. Both LYAH and the Dragon Book are considered great books (for different subjects), and both have drastically different tone.
>>
Whats the difference between async and threading exactly? If I'm using node.js and run setTimeout isn't that functionally the same as a thread?
>>
>>54433484
and btw I only have three friends so if you do have any suggestions/recommendations please keep in mind my demographic is mostly that of retail associates that like cartoons/videogames/comics/sci fi/fighting games/women/team work/movies/etc. We are not rich, we are not smart, we do lose track of time, we also lose ourselves in our work and sometimes we don't do well with a black and white context.
>>
>>54433554
JS async is all happening in the same thread. It has a queue of actions that it needs to take, and it does /these/ actions synchronously (in order, one at a time), and waits when the queue is empty. A setTim3out adds a function call to the queue in x milliseconds.
>>
>>54433554
async:
when an event happens, it stops executing the main text segment and jumps to the specified function. it completes that function and jumps back. Usually in the callback function you would set a flag and deal with it later with the main program. (it's very limited)

multi-thread:
two things go on at once, you can do more things without fucking shit up, but you have to make sure one thread doesn't fuck with the other and create problems
>>
>>54433543
He spends all his days with gf and her friends. Because of that there is very little reasoning to his discussion points and it's usually I have to trust his judgement because intuition or I have to understand that he's right and he just knows it but I won't see that and now he's upset. I guess I'm meaning his girl is difficult and since he's out of school and working in retail his girl pretty much is something he's always got on his mind. Also, we're nearing 30.
>>
>>54433579
>>54433602

So why haven't I heard of a major threading library? I know it's possible, since node can import C++ code and wrap C++ objects
>>
>>54433543
Dragon Book! Totally forgot about that one. I don't remember if I still have a copy of it in here somewhere. Maybe you could link me?

Anyway, what about their tones is different? You mentioned them both so can I assume both are fairly casual in tone?
>>
>>54433635
just download the /g/entoomen library, it's got all the great programming books in it
>>
>>54433554
On JS timeouts once the timeout triggers, the related code is executed, all of it (basically inserted in the current flow). In threads two codes run kinda in parallel. If A is your normal code and B is your async/seperate thread code, then it looks like this for async:

AAAAAAABBBBBBBAAAAA

while for threads it looks more like this:

ABABAABABBABABBAABA

Hope I recalled that correctly
>>
>>54433627
openMP is literally a part of the gcc.
>>
File: bones.webm (706 KB, 378x543) Image search: [Google]
bones.webm
706 KB, 378x543
>>54432088
I wrote a Video to ASCII art kinda program in Processing recently. I had written one similarly a while back but it didn't look that good and was very slow. How does this one look?
>>
>>54433732
Is that just a shader of sorts, or can you run it in the terminal?
>>
>>54433666
I'm not talking about C++, I'm talking about Node.js

Why isn't there a well known node.js threading library if it can import C++ code
>>
>>54433758
It can't run in the terminal, but the algorithms simplistic enough that it probably wouldn't be hard to do using ncurses or something.

At the moment, it would be best described as a very very simple shader.
>>
>>54433786
You should try writing it for the terminal.

It would be a cool gimmick that would make its way to a lot of desktop threads
>>
>>54433760
is node.js just a software writtein in C++ or whatever that interprets javascript code or is it just the usual javascript VM we all have running on our browsers.

I always felt like node.js was something that sjws with red hair use on their macbook air
>>
>>54433843
Node.js is just a faceless web browser that is only used for running headless javascript

the idea was for the server and client programming to be identical.

sad that javascript is just a shitty language with no consistency
>>
>>54433843
it uses google's V8 engine, which is written in C++. It's pretty handy. For the record I am using it on my macbook pro and it's extremely fun to use.

>>54433859
Javascript is wonderful. It's great for realtime applications, has the best regex support hands-down, it uses Java syntax but doesn't care if you forget a variable declaration or semi colon, anonymous fucntions and objects, etc.

The whole thing is a blast to use
>>
Stupid question:

How do HTTP servers manage to send me information after I request it, despite the fact that my firewall has no open ports?

Does it have secret open ports? How does any information at all get to my computer? Can I use this information pathway to get around not having a TCP port open?
>>
>>54433978
most firewalls always have port 80 and 443 open

these ports won't be blocked unless you manually do so
>>
>>54432778
HTML canvas is way cooler than the gay ass shit you're doing faggot kill yourself
>>
>>54433996
>most firewalls always have port 80 and 443 open
No they don't.
>>
>>54433996
But I can't host things on either port 80 nor 443. So how does data get to my computer?
>>
>>54432439
Here's your (You), now kindly fuck off and never come back
>>
>>54433978
>How do HTTP servers manage to send me information after I request it, despite the fact that my firewall has no open ports?
Your web browser will open an ephemeral port (actually the OS manages them), which is a port on your computer which only that specific connection has and uniquely identifies that connection. The firewall on your computer wouldn't block those ports.
Once it gets to your home router, assuming you're using NAT, your router will change the source IP address and port and store that shit in its NAT table, and will forward any packets it gets to the new source port to your computer.
>>
>>54433383
kek
>>
>>54434072
>I don't know what the fuck I'm talking about
>>
>bashing canvas

Canvas is better then the unportable UNPLAYABLE bullshit you'll ever create.
>>
>>54434138
he's right though
>>
>>54433650
I couldn't find it in there.
>>
>>54434138
I think this anon is just a cia nigger trying to be austere like the sjws.
>>
I'm writing a rust macro that expands a list of 0 or more arguments into what is supposed to be a slice, but when there's only one argument, I get "(expected slice,
found array of 1 elements)"
What do I do to fix it?
>>
>>54434283
Is rust being embraced?

Or is it a dying meme?
>>
>>54434283
I watched a video on rust and nearly shit myself.

There is literally nothing wrong with C / C++ or their pointers.
>>
>>54434340
Not everyone is dumber than a 5 years old to be honest with you senpai.
>>
Hi /g/ im just starting C. I'm reading a book. I'm trying to finish it over the weekend. I'm looking for a place for a stream of questions to flow that I'll be asking and so i can recieve answers within at least 2 hours of time.
thanks. going to liquor store because it helps me relax. be bak in a bit.
>>
>>54434215
direct link: https://shodan.me/books/Programming/Compiler/Aho%20-%20Compilers%20-%20Principles%2c%20Techniques%2c%20and%20Tools%202e.pdf
>>
>>54434311
rust is a shitty meme
>>
Is Haskell good for mathing?
>>
>>54434711
it's not good for anything except for masturbating your fedora tipping ego
>>
Reposting from other thread.
Rev up that hate for me
What I want to do, is have a user input a 7 digit barcode, and then have that barcode correspond to a string. How would I go about doing that? I could make a .txt file, but i'm confused on how to proceed. The main thing I need to know is how I can have someone input one thing, then have it correspond to a string.
I'm using C++. by the way.
>>
Why I'm getting "Expected expression before "}" token in this little shit?
Isn't there a non-eye bleeding way to write pointer to structs?
struct equipamento sort(struct equipamento *ptr_eqp, int siz)
{

int i, n;
struct equipamento *ptr_temp;
for(i=0;i<siz;++i)
for(n=0;n<siz;++n)
if((*(ptr_eqp+1)).cons>((*ptr_eqp).cons)

}
>>
>>54434597
ask good questions and I may be here over the course of your two days, but I will also be stealing my answers for use in a blog or something. I really just need someone to talk at as I am writing an explanation of c over several topics including networking, oop and relating the c to computer function and then relating that middle concept in its relevance to the topic at hand ( networking, oop, etc. ).
>>
>>54434711
it's not really as math-oriented as what most people think. the math part is not referring to arithmetic/number-crunching, but rather the fact that much of the language is based on mathematical theories (type theory, category theory, etc)
that said, it's by no means a bad language for doing math and it has some pretty nice features, like arbitrary precision numbers
>>
>>54434782
Fucking hell. A fucking ) missing.
>>
>>54434782
missing semicolon
>>
>>54434601
thank ye kindly.

>>54434779
You set up a list of two columns per row

The first column is your 7 digit barcode
The second its string

or you could do
Row A is your barcode
Row B is your string

Then you read the list into ram using a regular vector table and offset your index by whatever amount is dictated through your barcodes. If you have barcode 1 - 1000, simply use +1 in your index notation. If you have 5000-10000 use -5000 in your index notation/pointer arithmetic.

If that didn't make sense, I'm sorry but I won't speak on programming using jargon just for the sake of it. It's better to learn it in a casual tongue for the sake of keeping practice going at a good pace.
>>
>>54433269

Yeah, it probably won't be an issue realistically, but it would just be heavily dependent on vertex count not edge count, and I was expecting the graph to be relatively sparse.

Also, the matrix are you sure it should be the straight adjacency and not one with also 1's on the diagonal? (or maybe you assumed this already since things are totally related to themselves)

Since rows don't sum to 1, won't this have an effect on the end probabilities, like they would be not necessarily between 0 and 1, right...?
>>
>>54434896
You can still implement this in O(n*(V+E)) time. Just represent it as a graph and do it naively. You simply lose the logarithmic speedup of the iterations that matrices give you, so it may take longer to converge nicely.
>>
>>54434955

Okay, but what about the other two questions?
>>
>>54434874
Yeah, that's what i'm planning to do, only add another array.
                double item_price[13] = {1.00, 2.50, 4.00, 3.00, 5.00, 1.75, 1.00, 6.00, 8.00, 1.00, 0.50, 3.00, 7.00};
string item_name[13] = { "cookies", "milk", "eggs", "tofu", "bread", "chips", "soda", "beef", "chicken", "candy", "gum", "juice", "pizza" };
long barcodes[13] = { 5658845, 4520125, 7895122,
8777541, 8451277, 1302850,
8080152, 4562555, 5552012,
5050552, 7825877, 1250255,
1005231};

(sorry if code comes out strange)
I'm basically having a "scanner" that gets the barcode (which user types in) which will be in a certain array slot, (like i = 1 etc.)
Next thing, you know how when you use a kiosk, you just scan thing until you're finished? I have something similar to that, (just a value that you press to break the loop) but i'm wondering how i'd put in the whole, "array without a set bound" in c++.
Thanks in advance.
>>
>>54434782
Okay I need to sort this array of Structs elements. I'm using pointers but the question is. I'm sorting them according to a
value elementx.elementpart1
. I want to move the elements. But what kind of data I set the temporary pointer to be? Or where do I store them before I swap?
>>
>>54434797
wow. thanks for being here.
I will get back to you soon. I am a beginner.
>>
>>54434967
Well, for it to be a valid Markov chain you need to normalize the strengths of the outgoing connections of each outgoing edge (including to itself) so that they add up to 1 per vertex. (like conservation of mass, so it doesn't explode). For stability's sake, you might want to add 1s on the diagonal (before normalization) to "soften" the changes made each iteration.

Anyway, once you have this matrix, you would multiply it by another one used for "decay" which almost looks like the identity matrix, but, for example, where p=0.2 (so 10% flows towards the main node), and the original "idea" node is the first one, it would look like

1   0  0  0
.1 .9 0 0
.1 0 .9 0
.1 0 0 .9


This way, you keep returning score to the original node, and you can see which other nodes are closely related to it rather than getting a flat set of probabilities like a traditional Markov chain.

Now that you have this resultant matrix, you can calculate the transformation which applies 2^n iterations by squaring this matrix n times.

Feed the vector 1 0 0 0 into that, and the 3 remaining scalars in that vector are, by this metric, how closely "associated" they are to vertex #1.

Obviously my example only uses 4 vertices but it can be extended to any number of vertices.

But the key thing is, I'm very careful to make sure the num of both of these matrices is the number of vertices (in this case 4), otherwise the values will explode.
>>
>>54435218
Sorry, p=0.1. I always make some typo in these sorts of long posts.
>>
>>54435218
Also, you could pick different metrics for normalizing, such as squaring.
>>
>>54434981
Sweet. Learned how to dinamically alocate memory and managed to sort it out. Computers are frustrating but fun.
>>
>>54434973
>>54434973
use a vector array. the vector type can grow dynamically, or profinitely which I think encompasses that idea of "array without a set bound".
>>
File: shy.png (263 KB, 364x432) Image search: [Google]
shy.png
263 KB, 364x432
>>54432088
What is Lua good for and what is a good book to learn Lua?
>>
>>54435359
nothing, Programming in Lua
>>
>>54435359
Appending an anime image to your post is bad etiquette within this community. This is your first and only warning; you'll be sanctioned if this happens again.
>>
>>54435399
But doesn't format of the data tables in the html dictate that, technically, he
pre-prended
that post?
>>
>>54434797
Ok. I'm on pg 5 of the book. I'll come up with a list of Q's and i'll write them out when i'm on page 50/600.

I'm doing this because I'm starting C next week in school, so I'm trying to get a head start.
>>
File: fug.jpg (235 KB, 1200x1200) Image search: [Google]
fug.jpg
235 KB, 1200x1200
>>54435359
Modding games, using it as a content scripting language for games you write, etc. I modded Cortex Command and a little bit of GMod with it. Some people are advocates for grander uses of Lua. As for the book, I learned it by example (I was already a decent programmer in a few languages before starting Lua) but I think the standard is PIL.

>>54435399
>pic related
>>
File: artifact.jpg (31 KB, 600x600) Image search: [Google]
artifact.jpg
31 KB, 600x600
Should I be programming if I can't come up with ideas for projects? All I do now is work on Project Euler and stuff from those noob project lists.
>>
>>54435420
Cool, the book I'm using is just a bit over 100 pages but I've been programming for more than a few years now.
>>
>>54435586
Exactly.
>>
>>54435245
>>54435218
>>54435287

So multiply the adjaceny (say A) by the decay (say D) then exponentiate that then multiply by the start state vector s? so s(AD)^n, right?

Thanks for the ideas.
>>
>>54435605
I meant the former, I didn't read far enough. Bad habit of mine. Yeah, it's s(AD)^n.
>>
File: nervous_twiddling.gif (208 KB, 354x534) Image search: [Google]
nervous_twiddling.gif
208 KB, 354x534
>>54435380
Why is it good for nothing?

>>54435399
S-Sorry, I'll try not to post any more anime pictures, senpai.

>>54435427
Thanks
>>
>>54435427
>>54435636
To add to that though, I heard it was good for embedded systems.
>>
>>54435659

if it's embedded and it isn't C throw that nigger shit in the trash
>>
>>54435673
>and it isn't rust*
FTFY
>>
>>54435636
I know it's more of a reward than punishment but you gotta suck everyone in the thread now you dirty faggot whore
>>
So I just spend the past 2 and a half hours with my face full of trees. How is everyone?
>>
>>54435716
What kind of trees
>>
>>54435632

If I wanted to get things associated with a group I could give a vector s like [0, 0.5, 0.1, 0.3, 0.1] with the values summing to 1 or something and define the decay matrix as D(r, c) = p(s_c) then add in (1 - p) * I with I being the identity matrix, or would it not generalize like that?
>>
What does "subscript" or "subscripting" mean in the context of an array? I've tried searching the term to no avail.
>>
>>54435659
It's good for embedding a language into a larger program, for instance video games use lua ALOT for stuff like monster/item functionality so you don't have to hardcode it.
Don't listen to /g/ misinterpret "embedded" and spout of C/C++/Rust bullshit. They have no idea what they're talking about, just jumping on the "C is the only good langauge! Programming anything that isn't kernel drivers is for plebs!" bandwaggon
>>
Σ O(k) = O(n^2)
Σ O(n) = O(n^2)
Σ O(2^k) = O(2^n)
Σ O(2^n) = O(n 2^n)
>>
>>54435846
>I've tried searching the term to no avail
If you google "array subscripting", nearly every entry has something to do with using [] on an array.
Array subscripting means indexing, like doing A[i] would be subscripting index i of array A.
Make any sense?
>>
>>54435777
You can create a decay matrix flowing toward the nth node by making taking I(1-p) (as you said) and then adding p to each row in the nth column.

Not sure what you're talking about with the vector s.
>>
>>54435953

Well, I was thinking about if you wanted flow from two nodes at once for some reason, you could do [0.5, 0, 0, 0.5, 0, 0..etc], right? I was thinking about mutli-source stuff if that makes any sense? Or would you only be able to just run the thing multiple times for each source then adjust the values after?
>>
>>54435997
Oh yeah, you definitely could. You could actually apply the formula to two different matrices and average them.
>>
>>54436012

Yeah but wouldn't you get it for free by doing it all at once? Or would the result be different from any kind of flow between start nodes?
>>
File: Untitled.png (29 KB, 592x422) Image search: [Google]
Untitled.png
29 KB, 592x422
When are we going to be free of header files? Shouldn't this have been done away with like 20 years ago?
>>
File: Screenshot_2016-05-07_21-16-47.png (46 KB, 529x94) Image search: [Google]
Screenshot_2016-05-07_21-16-47.png
46 KB, 529x94
>>54435924
So, is pic related saying that you can subscript (index as the first position) the address in memory of the first element of the array, and can then access the rest of the array because the next elements are exactly one "unit(??)" of memory after the address of the originally indexed address?
>>
Does xoring a bunch of random sources together give a new one with the best randomness of all the sources?
>>
>>54432088
>What are you working on /g/?
I'm working on installing an .AS to .SWF compiler so I can make elite flash games. Now come over to my thread and give me advice:
>>54436147
>>
>>54436153
You'll have to define "best randomness." It's a very tricky thing to define. In fact, mathematicians still don't really agree on a definition.
>>
>>54435739

A symbol table. Contains some binary search trees, and in some ways, resembles an abstract syntax tree in its overall structure.
>>
>>54436132
Most modern languages have done away with them in the sense that they use something like "modules" instead. It's pretty much the same thing but with a lot of the ugliness and hassle removed.
>>
>>54436186
If I have several random sources that may or may not be cryptographically secure and at least one cryptographically secure random number generator, and I xor the output of those generators together, do I get a cryptographically secure output?
>>
So why doesn't node.js have a threading library? It can use C++ code
>>
>>54435716
>>54436212
>the past 2 and a half hours
Sounds like a pretty mellow debugging session
>>
>>54436231
You should, because just performing an XOR with random bits can't "crack" your one secure source. If it does, then your secure source wasn't secure in the first place.
>>
>>54436214
I know, I was referring specifically to C++
>>
File: output.webm (2 MB, 1920x1080) Image search: [Google]
output.webm
2 MB, 1920x1080
plz no bully
>>
>>54436241

It's not done yet. I'm just taking a break.
>>
>>54436345
r u a haker
>>
>>54435848
>I don't know what embedded development means so nobody else must know what it means either!
>>>/reddit/
>>
>>54436136
Yes. That is what pointers are largely used for. You point them to an address in memory and then change to the next available element in memory at adress +1 unit of memory.
>>
>>54432088
What is wrong with this function? I am trying to overload * so I can multiply feed and inches objects.

friend Distance operator *(int d, Distance &ob)
{
//Complete the code for the multiplication
d = ob * ob;
if(temp.inches > 12)
{
temp.inches -= 12;
temp.feet++;
}
return(d);
}
>>
>>54436433
where do you declare temp
how are you multiplying distances with * in the function that defines * for distances
>>
>>54436455
I forgot to declare temp. It was declared in the other functions. This is the function that defines * for distances.
>>
>>54435324
Hm, never thought of that. Thank you anon!
>>
What's the shortest algo for writing a binary tree you have? Any language
>>
>>54436774
enum X<Y>{Z(Y),X(Y,X<Y>,X<Y>)}
>>
>>54436872
All X's beside the second should be W actually.
>>
>>54436774
Binary trees aren't algorithms, they're data structures.
data Tree a
= Node a (Tree a) (Tree a)
| Empty deriving(Show, Eq)

insert :: Ord a => a -> Tree a -> Tree a
insert x (Node y l r) =
case x `compare` y of
LT -> Node y (insert x l) r
GT -> Node y l (insert x r)
EQ -> Node y l r
insert x Empty = Node x Empty Empty

listToTree :: Ord a => [a] -> Tree a
listToTree = foldl (flip insert) Empty

treeToList :: Ord a => Tree a -> [a]
treeToList (Node x l r) = treeToList l ++ [x] ++ treeToList r
treeToList Empty = []
>>
So I have sort of a different question here.

I've been writing bash scripts for the majority of my life as I'm a sort of low level IT guy and usually all I really need to do is move some files, maybe check some other site small tasks etc.

What language should I learn that's actually a programming language?

I really don't want to do a compiled language because I always have issues with compatibility.

I really don't want to learn python because every time I install a python script from someone else I always spend a month and a half on dependencies, plugins, and the 9000 different versions of python that every developer writes in.

I just want a portable language so I can download my scripts and run on most machine with as little setup as possible, and bash was great for this but with some of my latest projects the limits of the scripting have really started to show.
>>
>>54432646

I'm a little confused how the concept of shortest/longest path relates to such an association graph.

If I understand your post, each edge in the graph represents the strength of association between two vertices. How is the strength of association determined? For me, the first thing that comes to mind is that the edge from trait a to trait b is the fraction of lolis that have both a and b out of the total lolis with trait a. This would give you that 1 means complete association (a loli that has trait a always has trait b) and 0 means no association (a loli with trait a never has trait b).

What are you actually trying to find?
>>
>>54436455
I changed it but it still doesn't work.

friend Distance operator *(int d, Distance &ob)
{
//Complete the code for the multiplication
Distance temp;
temp.feet = d * ob.feet;
temp.inches = d * ob.inches;
if(temp.inches > 12)
{
temp.inches -= 12;
temp.feet++;
}
return(d);
}
>>
>>54437076
try doing it out by hand and figuring out how the math is supposed to work
>>
>>54437076
>doesn't work
in what way?

also are you sure you want to be returning an int?
>>
>>54436212
Like a monad?
>>
>>54437076
'Distance& ob' should probably be 'const Distance& ob' since we're not actually modifying ob. This isn't a big deal but it's kind of important
Whenever you're writing any code at all ever, think about what kind of inputs might get passed in and think about what your code is going to do about it.
What if 'temp.inches' is 12?
What if 'temp.inches' is 24?
What SHOULD be the desired outcome, what does your code do instead, and what do you need to do to make your code work?
Finally, "return (d);"
Be conscious of the code you write. Why did you return 'd'? What is 'd'? What are you doing and what do you want to return?
A really talented programmer and engineer once told me, "you aren't flipping pancakes". You can't just slob out 15 lines of code and expect it to work by magic. think about what you wrote and what you want.
>>
>>54437053

No, it's more about what the lolis themselves associate. If you rape a loli with a red dildo she'll associate red and dildos with pain.
>>
>>54437112
I am not having a math problem here. It's a C++ problem. My code won't compile because I'm misusing datatypes. I need to multiply to Distance objects and return an integer.

>>54437128

Yes. The function was half finished and it originally returned an int.

>>54437153
>'Distance& ob' should probably be 'const Distance& ob' since we're not actually modifying ob. This isn't a big deal but it's kind of important

Not my code.

d is the product of feet and inches. If inches is over 12 it gets decremented and feet gets incremented.
>>
>>54437209
read the errors you buffoon
also read your code you buffoon
you say you're returning an int but the signature says otherwise
>>
>>54436037
Well, either way. Constructing the matrices is practically free compared to the cost of using them.
>>
>>54437223
I read the errors. It can't convert d to type int.
>>
Any one have a recommended source for learning ASP.Net as a beginner C# developer? I've built websites using Flask and Django but this will be my first foray into C#.
>>
>>54437209
'd' is what you're multipying BY.
For instance, "4 * (3 feet, 2 inches)" should become (12 feet, 8 inches). 'd' is 4. Your code would return '4' when it's supposed to return (12 feet, 8 inches). Nowhere close to correct.

If 'inches' is 12, then your code will not decrement anything. It SHOULD. Do you not understand this?
If 'inches' is 24, then you should decrease it TWICE, and add 2 feet. Do you understand this?

>>54437223
Knowing C++ and the goddawful "implicit constructors", it probably doesn't error.
struct Distance {
Distance (int feet)
{ ... }
};
Distance thing () {
return 3; // valid ;-)
}
>>
File: Capture.png (6 KB, 224x147) Image search: [Google]
Capture.png
6 KB, 224x147
So stupid as fuck question:

I'm fucking around with JavaFX and have some images in the src folder.

The following code works to access the files from main.java

Image earth = new Image("earth.png");


I want to put them in a folder outside src (inside test obviously)

I've tried every variation of relative and absolute and I can't get it to work. It keeps spitting out unknown source errors.

Wat do
>>
>>54437245
I didn't write any of the decrement code. The instructors did. They're fine with it saying something like 5 feet and 12 inches.
>>
>>54437228

Oh, I thought you meant take the average of the two after performing the exponentiation (ie doing that twice), not averaging beforehand.

I wonder if I should keep the shortest-path stuff I had before too, and use both and take some weighted average of the two?
>>
>>54437293
So what the hell DID you write?
And anyone should be able to write code that converts fucking inches into feet if you're more than a fucking week into CS 101
>>
Programming a login server
>>
I recently had to restore my hd and lost all of my Linux and Windows files. For right now I am not going to install Linux, just stick with Windows 7. What are some recommended IDEs for C dev?
>>
>>54437296
Oh, yeah. Since matrix operations are linear transformations, you can average the matrices beforehand instead of averaging the result of their transformations.

I would compare the results and see which works better. If one works better in certain situations, you could perhaps use a heuristic to choose.
>>
>>54437273
You can do it with absolute paths, but the proper way would be to use class resource relative pathing.

getClass().getResource("name")
>>
>>54437293
Stop making excuses to these guys and focus on your work.

You clearly don't understand what a signature is for and you don't seem to understand that although you need to return an int, you also need to figure out where that int goes and how it is then received.

Your signature shows that your operator will be returning an object, but you are return an int. You say the error states that the int cannot be converted. That is so because the object address is pointing to an address for type Distance and you are giving it an address for a value of type int. Return an object of type Distance to it *ahem*temp*ahem* or make a change to the signature so that it returns an int. And then make sure your object class can handle the information appropriately.
>>
>>54435438
my book says many Operating systems come with gcc available. It said go to a cmd or terminal and type:
gcc filename.c -o filename

(filename has some code the book wants me to compile)

but it didn't work and cmd just returned "gcc is not a recognizable internal or external....."

am i missing gcc or am i writing something wrong into the cmd (running windows 10)
>>
>>54437348
text editor + cygwin/whatever + gcc

are you learning C or do you know some C or are you a C wizard
>>
>>54437396
Windows has never come with gcc built in and probably never will.
Download mingw, it's pretty much the standard gcc port for windows.
Also I recommend cygwin for doing any real C development on windows.
>>
>>54437411
I am in the process of learning. I was reading a book called "Beginner's Guide to C" now I am going to transition to K&R
>>
>>54437437
I maintain and echo this
>>54437415
>>
>>54437437
K&R is outdated and not suited for beginners, it was originally written for other programmers at the time to be introduced to C as another language
Learn C with a modern introductory C book such as C Primer Plus or C Programming: A Modern Approach
>>
>>54437396
try typing bash first and then try using that code

if not, it probably means that you do not have what you need to compile c code. If that is the case, I could recommend looking for an online compiler ( you'll be limited to in ram, mostly, so no I/O for now ) or maybe googling around for a quick C compiler. I'm on a linux so gcc comes with the bash program I have on my terminal. But I remember hearing that Windows 10 now has a copy of bash available to it, or some form of the linux tool set anyway.

I'm sorry if I can't help you from here, I have never tried to work with C from a windows machine. I used Borland for c++ a bit and then decided to just download some flavor of linux so I'd have access to bash and gcc/g++.

The book should have some instructions on getting a compiler, but if you want to make sure you can at least get the most basic programs down, just use this website: http://www.tutorialspoint.com/compile_c_online.php
>>
>>54437396
You pretty much have to use Linux or maybe OS X if you want to do os dev
>>
>not having your brackets, braces, and parentheses aligned appropriately
christ mate
how do you unfuck yourself if you forget one
>>
>>54437384

absolute paths don't work :/

Thanks anon I'll try that
>>
In C# if you have a reference type with a value type in it (like an array holding an integer) and you assign that value to a variable does it get the value or a reference? What if it's a reference type?
>>
>>54437706
>you assign that value to a variable does it get the value or a reference?

"assign that value" would probably mean it gets the value, but honestly I don't have a clear idea what this part of your question even means

[c0de] us an example?
>>
>>54432646
>If not, any other ideas how I should do this association-graph-traversal?

You could use the A-star algorithm to transverse the network. The speed of the transversal determines the strength of the association. Stronger associations will have less "resistance" in the paths between the concepts and hence faster transversal.
>>
>>54437743

Sorry about that. I realize now that that was poorly described. Here's what I mean in code:

namespace HelloWorld
{
class Program
{
static void Main(string[] args)
{
int[] numberHolder = new int[2];

numberHolder[0] = 12;
numberHolder[1] = 24;

int someNumber = numberHolder[1]; // someNumber now equals 24

numberHolder[1] = 13; // Does someNumber still equal 24 or 13? If it was a reference type instead of a value type would it change?

}
}
}
>>
struct X {
something: Something,
else: Else
}

pub fn new(&self) -> X {
let s = Something::new();
X { something: s, else: s.get_else() }
}

...but borrowed value is only valid for the block suffix following statement [...]

How2fix? Boxes and RC don't work. Lifetime annotations don't work.
>>
+++++++[>++++++++++<-]>++++++++.[-]<[-]+++++++[>++
++++++++<-]>+++.[-]<[-]+++++++[>++++++++++<-]>+.[-]<
[-]+++++++[>++++++++++<-]>+.[-]<[-]++++++[>+++++++++
+<-]>+++++++++.[-]<[-]++++++++[>++++++++++<-]>++.[-]<[-]
>>
>>54437528
by using an actual IDE that auto-aligns that shit? Or at the very least, a hotkey that auto-aligns the entire document?

Missing brackets should never be a problem if your IDE is setup correctly.
>>
hello friends. i require some sort of direction on something.

i have two parts of code, both with void setup() and void loop () and im wondering where i begin taking snippets of one code and merging it with the other, ive trade placing the snippets directly after their twins and got undefined error.

any assistance greatly appreciated
>>
>>54437971
>dpt I'm copy-pasting two answers I found online and it's not working????
>>
File: 27-1452445041240.gif (2 MB, 450x253) Image search: [Google]
27-1452445041240.gif
2 MB, 450x253
>>54438109
not really, two sketches but thanks anyway asshole. bye~
>>
How do I pass a public variable into an enum in Java? I have a private member enum in a class.

    private enum State implements StateInterface{

Init{
@Override
public State next() {
switch((String) condition) {
case "use": return CheckForUsableEntity; break;
case "check": return CheckForCheckableEntity; break;
case "inventory": return Inventory; break;
default: return Fail;
}
}
},
CheckForCheckableEntity{
@Override
public State next() {
switch((String) condition) {
case "true": return CheckForFocusable; break;
case "false": return NoCheckableEntityFail; break;
default: break;
}
}
};

Object condition;

}


I want to define the condition variable externally but enum constructors are always private. Is there something else I can do?
>>
>>54438163
>two sketches
arduino babby
>>
>>54437850

somenumber is still equal to 24.
>>
>>54437850
Why would someNumber equal 13?

It doesn't matter what numberHolder gets set to, because someNumber isn't being updated at the end of the loop, therefore it will always be 24.
>>
Any CS/SE graduates here?
What were your courses?
>>
>>54435433

anyone?
>>
I want to like python so bad because it's so awesome but the syntax just bugs me. I want C syntax
>>
>>54437971
I'm assuming you're using Processing?

The code you are using is working on a data table that can change, and if your code is working on conditions in the data table and you make changes to that data table, the same code run twice but from a different place will probably function in an undefined manner.

What you want to do is assign one part of the code to always run before the other and make sure that you don't have the same thing happening in two parts of the code if you don't need to. So, if one part does setup, none of the setup code should be running in loop, because you're done setting up and now you only need to loop over the data after its been set up.

I think what you need to do is use setup to set your initial data and then use loop to do anything that needs repeating.

Is there maybe a more specific question?
>>
>>54437844

I was using dijkstra before. What would you even use for your heuristic? (which is the only difference between A* and dijkstra).
>>
>>54438297
I don't know what to tell you, but forcing yourself to program shitty things you're not interested in isn't going to go very far.

.
>>
>>54438292
How big of a list do you want, the full thing including basics or just the fancy ones
Thread replies: 255
Thread images: 26

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

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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.