/dpt/ - Daily Programming Thread

What are you working on, /dpt/?

Previously

Other urls found in this thread:

github.com/rust-lang/rust/pull/25640
github.com/rust-lang-deprecated/rust-buildbot/issues/2
github.com/rust-lang/rust/issues/41646
github.com/rust-lang/rust/pull/25585
en.wikipedia.org/wiki/Argumentum_ad_populum
blog.rust-lang.org/2018/02/15/Rust-1.24.html
freebsd.org/internal/code-of-conduct.html
en.wikipedia.org/wiki/Netpbm_format#PPM_example
github.com/bloomberg/bde/wiki/BDE-Allocator-model
git.volatile.bz/krustykrab/achlys/
twitter.com/AnonBabble

CoC doesn't affect the quality of Rust as a programming language at all.

>dpt is sperging out over how to write a simple OR function
Jesus fuck, is this what it's like working with other programmers?

But it affects the quality of my experience while using it.

IRL people would just solve the problem as quickly as possible so they can get home to do whatever it is they want to do.

for(int i = 0; i < args.length; ++i)
if(args[i])
return true;

Is this legal syntax? Why do you hate brackets?

Actually, it certainly has the power to bring down discussions related to extending or changing the language. Theoretically, this only affects pull requests to the reference implementation, but community splitting isn't ideal.

It's fine.

I mean I prefer throwing some curly boys in there, but meh. at least it's legible.

Yes it is. You can throw in a bunch of single-statement if-elses and a single-statement else, all without brackets, and it will still work.

So I got accepted for a free bootcamp to get into prog and turn myself into a .net pajeet.
Shit includes:
HTML ( DOM), CSS3, semantic markup, Bootstrap (or Materialize), Javascript + Jquery
Control flow, Events, Validator(Bootstrap), Dynamic components, SQL, MVC, ORM (modelling, OOP intro), Layers, IDE, Debugging, Deployment.
6hs a week from the upcoming Monday to mid May.

What am I in for? Any supplementary resource that you guys can recommend?
I really want/need a job ;_;
btw this is in Argentina so I doubt I can help anyone here to get into this course.

thanks.

There's only one guy sperging about it, and he's clearly a mental cripple.

Trying to combine refinement types with mutation without resorting to special rely-guarantee reference types. Basically, I need to add binary relations between "before" and "after" values to the refinements, which already include unary relations (predicates) over "current" values. Would it be too offensive if it looked like this?
x: T | p(x) && r(before(x), after(x))

Bikeshedding is appreciated. Symbols instead of "before" and "after", maybe?

>Trying to combine refinement types with mutation without resorting to special rely-guarantee reference types
Why, though? Do you even have a girlfriend?

>without resorting to special rely-guarantee reference types.
Why though?
No one wants to write shit like that in any language.

Note that you would be able to do something like this:
prop monotonic(i: Int) = before(i) = the last observed value. You could then implement a (probably or mostly automatically) verified, lock-free channel using types depending on counters to track the producer and consumer ends.

*I* want to write shit like that, and maybe others do, too.

How can I jquery based on multiple criteria?

Sample

id
name
time
condition


None of the td's have a class name

I want to change css based on time value, and if second condition is a particular string value


Came up with
$("td:nth-of-type(5):contains('Dog')").parent ().css("background","red");


But I dont know dates in javascript too well and I imagine since it's printed as 00:10:00 it'll be interpreted as a string.

I just realized that I would require the relation to be a partial order (to account for non-deterministic thread interleaving). Maybe that's a clue.

hello friend.
Webshit should be posted here

thanks friend.
I figured userscript based crap would fit. Will post there.

If behaving like a decent human being affects your experience so hard, then you should maybe consider killing yourself.

This. Rust is a fine language. There are very smart people working on it, and very smart people using it as well.
Even if the CoC were a bad thing, it shouldn't affect anyone's decision to use it.

>CoC doesn't affect the quality of Rust as a programming language at all.
Of course not. What affects the quality of Rust is the common factor of being conceived and maintained by autistic numales who live to shove their retarded opinions down other peoples' throat. The CoC simply reflects that in a more overt way than the language.

github.com/rust-lang/rust/pull/25640
github.com/rust-lang-deprecated/rust-buildbot/issues/2
github.com/rust-lang/rust/issues/41646
github.com/rust-lang/rust/pull/25585

What do you think is bad about Rust?

>What do you think is bad about Rust?
There's just nothing good about it. Every feature ranges from mediocre to retarded. Its idioms are verbose and obnoxious, and its philosophy is pure autism.

Being a decent human being isn't just an "opinion", m8.

>Being a decent human being isn't just an "opinion", m8.
Like clockwork...

Being in favour of homsexuality and transexualism makes you not just a bad person, but an awful person.

What's up with this recent trend of software devs thinking that it's legal to force people into waiving their rights in order to use some kind of platform? Imagine if you couldn't purchase food at Whole Foods because you sent someone a virtual hug while you were in Wal-Mart. It's the same logic, and these types of people can be sued, or if they themselves can't be sued, these "codes of conduct breaches" would not hold up as legitimate torts /contracts in court. Absolutely mind boggling how these people have no concept of contract / tort law, and I'm not even in the legal field. This is the contract/tort equivalent of sovereign citizens

>haha g-guys rust is ridiculous, j-just look at the appearance of their developers h-heh...
Mocking people based on their appearance makes you a literal child. Grow up.

>What's up with this recent trend of software devs thinking that it's legal to force people into waiving their rights in order to use some kind of platform?
Participating in a community and receiving some service is not a "right".

󠇦 󠇦 󠇦 󠇦E
E D G E
󠇦 󠇦 󠇦 󠇦G
󠇦 󠇦 󠇦 󠇦E

>Mocking people based on their appearance
That's not even the point, user. It's just ironic how you attempt to "refute" my post by literally confirming the observation it outlines.

>Webshit should be posted here
>this thread is for circle jerk only!

It is though. If you don't like that, make your own thread. Faggot.

How is that edgy? Are you a 12 year old girl who's just got out of social science class in some American uni? The majority of the world would agree with me.

en.wikipedia.org/wiki/Argumentum_ad_populum

You don't seem to understand how rights work. In my post, I'm not concluding that there is a positive right to participate in a particular community (although some would argue that it is against the 5th & 14th amendments to exclude people from the first amendment right of freedom of association, funny enough this being the argument that prohibits privately owned banks from racially discriminating in housing loans, I am concluding that if such participation removes rights that are protected by the government, namely the right to free speech, that the individuals who try to enforce these codes may be open for criminal liability, if we take the interpretation of the constitution to be that the government ought to actively protect rights through use of force and law against private entities who try to take away rights (this being the argument of civil rights advocates and a rather authoritarian interpretation of the government, as started by individuals such as Lincoln) rather than merely not jeopardizing those rights (the more archaic view of government)

We have a whole general for it, and they could use the new users anyway.

>The majority of the world would agree with me.
The majority of the world consists of low-IQ shitskins, so I find it funny you would make that "argument".

>github.com/rust-lang/rust/pull/25640
PR wasn't made by someone on the Rust team. PR was rejected either way. And the example isn't even in the docs anymore.

>github.com/rust-lang-deprecated/rust-buildbot/issues/2
Someone random made a suggestion and was promptly ignored.

>github.com/rust-lang/rust/issues/41646
Discussion led nowhere. And judging from comments, the reaction to it was mostly negative.

>github.com/rust-lang/rust/pull/25585
That's is a valid point. Also, see the PR 25640.

It seems to me that you have a childish grudge against some of the people who post on the Rust GitHub page. How is that detrimental to the quality of the language itself is unclear, do you mind clarifying your point?

>Its idioms are verbose and obnoxious
I would like to see how you would solve what Rust is trying to solve, while being less verbose and obnoxious.

>the most fervently pro-homosexual states are democratic states, aka argumentum-ad-populum states

>In my post, I'm not concluding that there is a positive right to participate in a particular community
Then what's the point of your post? Is anyone holding you at gunpoint forcing you to forfeit your rights? Blackmailing you? Threatening you in some way? No? Then nobody is "forcing" you to do anything. If you don't agree to the terms, you don't get the service, and that's it. No rights are being violated.

It actually is. It all revolves around on the collective definition of what constitutes a "decent human being", and is not based on any objective truth.

...

obvious bait

It is interesting that you said "participating in a community and receiving some service is not a 'right'". If we just take this without the context, you're completely wrong. The first amendment was drafted in particular for the right for freedom of association to exist. Take the case of the many fraternal organizations that existed during the revolutionary war, most of those organizations were outlawed by the King of England to prevent the revolutionary war from occuring. Hence, the government (and, abridged after the civil war and increasing authoritarian government power, private groups), cannot deprive you of the right to associate with whatever group you would like to associate with, at least in the United States.

>I would like to see how you would solve what Rust is trying to solve, while being less verbose and obnoxious.
Nice arbitrary goalpost you're setting there, but it doesn't refute anything I said. I don't care about solving exactly what Rust is trying to "solve" under the same self-imposed constraints, and Rust doesn't solve anything I actually care about.

It seems to me that you have a childish grudge against some of the people who post on the Rust GitHub page. How is that detrimental to the quality of the language itself is unclear, do you mind clarifying your point?

Also, do you have a sense of humor?

The use of force isn't necessary to deprive someone of rights. Is a bank using force when it refuses to loan a black person a mortgage based upon their skin color only? No, but the penalty for that kind of behavior can be greater than someone who uses force or threat of force to commit a crime

>the government (and, abridged after the civil war and increasing authoritarian government power, private groups), cannot deprive you of the right to associate with whatever group you would like to associate with, at least in the United States.
Nobody is depriving you of the right to associate with anyone. The group you want to associate with simply doesn't want to associate with you.

Rust 1.24 has incremental compilation now!

blog.rust-lang.org/2018/02/15/Rust-1.24.html

>rust programs can now gradually tansition into executables

>Is a bank using force when it refuses to loan a black person a mortgage based upon their skin color only?
No.
>No, but the penalty for that kind of behavior can be greater than someone who uses force or threat of force to commit a crime
I don't give a fuck about the US and its laws. As far as I'm concerned, a bank is fully within its right to refuse to give loan to anyone, for any reason.

Yes, this is exactly the point I'm trying to make. Many government institutions and workplaces, as well as increasingly private associations, are BY LAW, expressively prohibited from not associating with people without due process of law. In legal theory, the KKK BY LAW is not permitted to disallow a black, agendered transsexual from joining their association, unless said person is disallowed as a result of DUE PROCESS OF LAW

If the CoC makes you feel like you're not welcome, it's working. Just saying. Don't sperg out on the GitHub issues because someone is being progressive. If they're potentially getting in the way of actual technical discussion (e.g. a perpetually offended trannykin disputing a pull request), be the better man and logically attack their arguments.

>In legal theory, the KKK BY LAW is not permitted to disallow a black, agendered transsexual from joining their association, unless said person is disallowed as a result of DUE PROCESS OF LAW
Again, I don't give a fuck about your ridiculous laws. As far as I'm concerned, any group is fully within its rights to reject you from its ranks for any reason.

It depends, then, if the Rust community can be considered a workplace or club or whatever that "private association" weasel phrase suggests.

That's great, and I'm not sure I disagree with you - I'm playing the devil's advocate. However, it doesn't really matter what you or I think. The law is the law, and the position that the government takes towards these kinds of things ultimately is backed up by immense force and power. An army, coastgaurd, FBI, justice system, federal reserve system, etc, etc. So, if you live in the US like a decent percentage of the users of this software, you may want to care about making people sign contracts that stand on iffy tort / contractual ground.

the CoC is reaching other projects too

freebsd.org/internal/code-of-conduct.html

This.
Can we move to a more worthwhile discussion now?

My suggestion still applies.

The supreme irony is that this prohibition on rejection from groups based upon their standards stems from leftist, authoritarian legal precedent.

Did you even read what he wrote?

get out of here with your logic

>The law is the law, and the position that the government takes towards these kinds of things ultimately is backed up by immense force and power
It's arbitrary tyranny maintained by force, with zero moral legitimacy, so people should (and do) violate these laws whenever they can get away with it. What are you even arguing? That the anti-discrimination laws which apply to various institutions should also apply to private individuals managing their own private communities? You're saying you'd be happier if the scope of government overreach was increase by several orders of magnitude just to get back at some faggots on the internet? Do you suffer from some kind of brain damage?

>You're saying you'd be happier if the scope of government overreach was increase by several orders of magnitude just to get back at some faggots on the internet?
It's a sad fact that these people actually exist.

Is Python a useful language to learn? I only know one HTML code.

If you actually think that the scope of government overreach needs to be increased by several orders of magnitude to do what I'm describing then you're wrong. It's already here. Thank 9/11 and the patriot act, along with global FACTA, etc, etc. No matter where you are, the US government can and is monitoring you. I'm on your side, but you don't seem to understand that the way things work =/ reality

the way things should work*

depends what you want to do.
Python is a glue/hack-together language.

We're not arguing about what the current state of reality is, we're arguing about what we think the state of reality should be.

>If you actually think that the scope of government overreach needs to be increased by several orders of magnitude to do what I'm describing then you're wrong
I'm saying that if the government starts actually doing what you're saying it legally can, government overreach will be increased by several orders of magnitude. I don't know if you're right or wrong in claiming it, but what's fucking bizarre is that you seem to be looking forward to it.

No one asked for the American opinion.

>How about "gun" and "shovel"?
>"You see in this world there's two kinds of people, my friend. Those with loaded guns, and those who dig. You dig."
I can get behind this actually.

What is this gutter level philosophy?

The government started doing this a long time ago. What I’m saying isn’t my own ideas

whatever you say, these issues have existed and show how lunatic the rust community is.

>Someone random made a suggestion and was promptly ignored.
It wasn't actually ignored, it was just unfeasible for Rust because it was buildbot that used it. Apparently someone paid like $10k for buildbot to change the notation.

>The government started doing this a long time ago
Can you give me examples of privately organized communities being forced to accept members they didn't want?

What is a privately organized community?

What are you talking about?
It's a movie quote.

I hate how more and more nu-male redditors are infecting Cred Forums.

>github.com/rust-lang/rust/pull/25640
>steveklabnik
>So, what I suggest is this:
>Leave Hoare in.
>Change all pronouns to they, and use [they] in the quotation.
>Swap Spinoza for Judith Butler.
SPINOZA FOR JUDITH FUCKING BUTLER

That whole comment chain... is Rust a containment language?

You mean people who didn't come here during the 2016 elections like proper Cred Forums patrons did?
Really just fuck off if you find this offensive.

Someone makes a step into the right direction and you are mad 'bout it?

At least here you can have an open discussion.

What are you even talking about?

>What is a privately organized community?
Here we go with the sheer autism... Tell me, user, when was the last time you had to register your "organization" with the government when you opened some discussion group, or a local poetry-reading club, or an open source project, or got together with a bunch of friends, or whatever the fuck. Are you telling me all of that is regulated by the US government? So if I, as a literal kike, get banned from Cred Forums (which never happened, you guys are so tolerant!), can I sue chinkmoot for discrimination?

Python has a time and place. Usually tasks or one off stuff. No boilerplate, powerful standard methods/libraries, very small code.

All residential neighborhoods
All schools
All workplaces
All rotary clubs
Most fraternities but not the Freemasons

I'm not him. I'm curious what a privately organized community is.

You don’t register with the government because the creation of an organization cannot be regulated by the government. But if a private person petitions the government against a private group, then the government can regulate. There has to be an actual proven deprivation of rights (aka due process of law) proven to the court for the government to regulate an association

>I'm not him. I'm curious what a privately organized community is.
not him but Scientology? Freemasonry?

Analysing an intelligently designed signal from space.

The hardest part is ruling out literally everything else...

>All residential neighborhoods
>All schools
>All rotary clubs
Those are publicly-funded.

>All workplaces
Those have been heavily regulated for ages in all aspects.

>Most fraternities
Again, universities are publicly-funded. Can you give me examples more relevant to what we were actually talking about?

If aliens were transmitting using some hefty crytpo, would we be able to discern it from noise?

Could I tell the difference between a SHA-256 stream and random output?

Refuse to talk to poster: 64781727

Reason: Retarded

Are you sure you would like to list the reason 'Retarded' this appears to be discrimination due to a health handicap or physical disability. If you list the reason 'Retarded' you may be fined or penalized.

Yes/No

Yes.

Reason for override: User is so retarded, that I accept all fines and penalties and die happy and fulfilled in life, for paying them.

I don’t understand why you think that a private university or a privately developed, maintained, and owned gated community is publicly funded. Legally, both of those institutions are considered private and if you were to for example file suit against those two things you would not be filing a lawsuit against the government. If you sue a state university you are suing the government, and a lawsuit against a government entity is an entirely different beast than a lawsuit against a private entity, because you currently have more rights when dealing with the government than you do against a private individual or association

>I'm curious what a privately organized community is.
A bunch of private individuals getting together for whatever purpose, without being regulated or having to register in any form. This includes most things, excluding publicly funded organizations and businesses.

>t. black man who didn't get his loan

Also, I’m not talking about university fraternities (although you have that too)

>I don’t understand why you think that a private university or a privately developed, maintained, and owned gated community is publicly funded.
Can you give me any examples of legit "private universities"? Most of them receive government funding, and all of them agree to bend over to be officially recognized as universities.

>owned gated community
Not a lot of niggers to be found in those, user.

MENSA would be an example

What the fuck are legitimate examples then? A fucking men's barber shop? Some random group on a gaming platform?

A privately owned community is something legally equivalent to but not necessarily the same as a private association. That is, it’s not a government entity, and the scope of rights that you have relative to a privately owned community may or may not include the rights you are given by the constitution. By this I mean that although the constitution specifies that you have certain rights that the government cannot take from you, the constitution does not specify that these rights cannot be taken from you by a privately owned community or a private association or in general any thing that is not controlled by the government. This view of rights was the view that was dominant in the south before and during the civil war, and is modern day libertararianism. This view of rights entitles people to own slaves, and it does not permit the government to take away your property (slavery). Around the time of increasing federal expansion, it was taken that not only do you have rights that the government cannot take from you, but that the government must increase its power to protect you from private associations also depriving you of these rights. Hence, we can see that the northern victory of the civil war, civil rights and modern federal power all link to this shift: the rights that you have with respect to the government are the same rights that you have with respect to private associations and private individuals, and that the purpose of the government is not to stay out of your business, but to prevent other people from depriving you of rights. Do I agree with this interpretation? No. I do not think that you have the same rights against private groups as you do the government. However, this is the dominant view in constitutional law and is the view espoused primarily by Democrats and liberals. But the right wing is just as bad, they want to have all of the federal power while also none of the rights part.

>A fucking men's barber shop?
I think you can still get in trouble for being a racist barber...

>Some random group on a gaming platform?
Yeah, that would be a more relevant example to what guy was originally talking about:
>software devs thinking that it's legal to force people into waiving their rights in order to use some kind of platform
Actually, looking at it now, I don't even know how we got to where we are.

No user, both of those are publicly funded so they are government entities
That’s besides the point, whether any of this regulation does or does not achieve its aim, the fact that a private community is considered private and therefore not publicly funded still stands

If you language police your enemies, they win.

>the fact that a private community is considered private and therefore not publicly funded still stands
"Residential neighborhoods" isn't synonymous with "private gated communities" (as far as my understanding of English goes). You were making general statements, so I was giving you general responses. Are you telling me now that private gated communities have to answer to the government for why they rejected this or that guy?

>government entities
No you fucking brainlet, merely being funded and/or regulated by government is not enough to make something a government entity. Stop using this term.

I think he was being sarcastic, brainlet.

I really wonder why I keep coming here. /dpt/ at this point is literally just about politics.

Yes, of course they do. That’s the point, wholly private associations cannot deprive people of the right to associate because the fifth amendment against deprivation of property without due process of law applies equally to private associations as it does to government agencies in modern legal precedent

I am working on hooking Visual Studio code-completion lists into CUE SDK, so I can highlight all potential keys within VS C++ without looking at the screen. It should be a very enlightening project.

Is sicp really worth reading?

>Actually, looking at it now, I don't even know how we got to where we are.
We were (and are still) trying to determine whether the government should listen to butthurt snowflakes who either 1) weren't allowed to participate in a community or 2) are assmad that someone else wasn't kicked out because they violated some arbitrary "code of conduct"

>wholly private associations cannot deprive people of the right to associate because the fifth amendment against deprivation of property without due process of law applies equally to private associations
Forcing members of a private association to associate with someone they don't want to associate with is defending their right to associate? Refusing to sell or rent your property to someone is depriving them of their property? You honestly sound like you're having a psychotic episode, and I don't think it's going to get better from here.

I'm guessing this guy is one of those fags who complains that the GPL is not free because it doesn't let you violate your users' freedoms.

>We were (and are still) trying to determine whether the government should listen to butthurt snowflakes
But you said we were discussing things as they are, rather than how things ought to be? Or are you a different autist?

right to associate is not a right to deassociate

>right to associate is not a right to deassociate
"Right to associate" is the right to associate with exactly who you want to associate with, which naturally includes refusing to associate with some people. I'm not surprised that I'm having this discussion on /dpt/ of all places. Most of you are mentally damaged.

The confusing part is that both are happening simultaneously.

>BAKE
>THAT
>CAKE

>The confusing part is that both are happening simultaneously
I only see arguments (albeit asinine ones) being made about how things allegedly are.

Look for help in the dpt, because I'm a degenerate.

I have a list of numbers

1394058763 etc...

I need to make or find something that will convert these numbers to pixels, that are colored based on the number. I need it to parse a row of pixels for every 10 or every 20 numbers.

0 blue 1 red 2 yellow 3 green etc...

so 33210301310222 would become

3321030131
0222

And be converted to an image consisting of 14 colored pixels

3321030131
0222

green,green,yellow,red,blue,green,blue,red,green,red

blue,yellow,yellow,yellow

Does anyone know anything even close to this?
Thinking of having the parsing get handled by a standard scripting language, py, batch file, etc... Then just running the properly converted output from the script through something like 'imagemajick' to variable match and create the pixel image.

Good programming discussion guys, keep it up.

>after 2 days of work finally manage to build ogre3d
>now work through the examples
holy shit. maybe I dont do them justice but it feels Im looking at java EE code. worst are all those inheritances for now apparent reasons. cant think how the engine itself looks like.
looking at open scene graph now.

>Thinking of having the parsing get handled by a standard scripting language, py, batch file, etc... Then just running the properly converted output from the script through something like 'imagemajick' to variable match and create the pixel image.
it'd be much more direct to use something like Python and PILLOW, but I like your approach better, feels comfy.
give it a shot, try generating P3 PPMs and converting to whatever you want:
en.wikipedia.org/wiki/Netpbm_format#PPM_example

>try out visual studio performance explorer
pretty neat stuff

Going to be taking a computer science principles AP class next year. I need to learn programming skills and the course offers either C++, Java, or Python. I think I want to pick python because its not a pajeet tier language like C++, or Java but is it more difficult for a beginner like me?

Want Do?

Reminder that there's only one argument in this expression: foo(1, 2, 3, 4)
Reminder that the phrase "the kth argument expression" implies that there's only one argument.
Reminder that a formal parameter and an argument are the same thing.
Reminder that implementation details and semantics are the same thing.

Python is not the best language for beginners. C++ would probably be your best choice as Java is pure pajeet programming

I'd use python

import Image
picture = Image.open("/path/to/my/picture.jpg")
ints = [1,2,3,4,5...]

for idx, val in enumerate(ints):
picture.putpixel( (idx/10,idx%10), color)


should be enough to get you started

The process of evaluating the argument list differs, depending on whether the
method being invoked is a fixed arity method or a variable arity method (§8.4.1).
If the method being invoked is a variable arity method m, it necessarily has n > 0
formal parameters. The final formal parameter of m necessarily has type T[] for
some T, and m is necessarily being invoked with k ≥ 0 actual argument expressions.
If m is being invoked with k ≠ n actual argument expressions, or, if m is being
invoked with k = n actual argument expressions and the type of the k'th argument
expression is not assignment compatible with T[], then the argument list (e1, ...,
en-1, en, ..., ek) is evaluated as if it were written as (e1, ..., en-1, new |T[]| { en, ...,
ek }), where |T[]| denotes the erasure (§4.6) of T[].
Thus foo(1, 2, 3, 4) does invoke foo with one argument if foo is declared as void foo(int... bar)

I was waiting for you.

I'd use python

import Image
picture = Image.open("/path/to/my/picture.jpg")
ints = [1,2,3,4,5...]

for idx, val in enumerate(ints):
picture.putpixel( (idx/10,idx%10), get_color(val))


should get you started

>
>I'd use python
>
>import Image
picture = Image.open("/path/to/my/picture.jpg")
ints = [1,2,3,4,5...]

for idx, val in enumerate(ints):
picture.putpixel( (idx/10,idx%10), color)

>
>should be enough to get you started
[beleeted]
Sorry m8, yer not getting away with posting brainlet code that easily.

I'm agreeing with you. All the following statements are true, just as you claim:
>there's only one argument in this expression: foo(1, 2, 3, 4)
>the phrase "the kth argument expression" implies that there's only one argument
>a formal parameter and an argument are the same thing
>implementation details and semantics are the same thing
Your second argument is especially strong. "kth argument expression" is irrefutable proof from the standard itself that k=1 in foo(1, 2, 3, 4); I got absolutely destroyed by you. ;)

just wanted to make it clearer. It's a stupid problem, why are you mad about a stupid solutoin.

lol
>you mad
brah?

good post

Pick Java or C++, they're better suited for learning the fundamentals.

C++ is not a pajeet language, Java is.
Python is babbys first language.

>I'm agreeing with you.
took you long enough. But seriously , kudos. Not a lot of people on here would admit they were wrong, usualy they just keep trolling after they realize it.

How many arguments are passed to foo in the following expression, which the standard insists is equivalent to yours?
foo(new int[]{1, 2, 3, 4})

Wasn't sure what you were saying. Is there a better solution?

>1
>2
>3
>4
Its a mystery

>the standard insists that foo(1, 2, 3, 4) is equivalent to foo(new int[]{1, 2, 3, 4})
I agree with this. It's clearly equivalent, despite the compilation errors. I think my compiler is broken. You should be leading the effort to fix this and create the first standards-compliant Java compiler.

>Is a bank using force when it refuses to loan a black person a mortgage based upon their skin color only?

Getting a loan isn't a right you imbecile.

>>there's only one argument in this expression: foo(1, 2, 3, 4)
No, the number of arguments in this expression depends on the parameters of the function that being called.

Quick reminder

>It's clearly equivalent, despite the compilation errors.
Show me the error then, because I can compile and run a program that calls foo both ways just fine.

>foo(1, 2, 3, 4)
>the number of arguments depends on the parameter

C++ compiler research is done using functional languages

Nah, was just shitposting, looks like a perfectly decent approach, as I mentioned in Though if we have to be pedantic
- wouldn't he need Image.new instead of .open?
- seems like he'd need the image dimensions too, before drawing the pixels, i.e. he'd need to 2-pass it unless the dimensions are given in advance.

...

right, I was just being lazy

>I can compile and run a program that calls foo both ways just fine.
void foo(int[] foo) {
}

foo(1, 2, 3, 4);

Hmm...

public class Variadic {
public static void f(int... a) {
System.out.println("f()");
}
public static void main(String[] args) {
f(1, 2, 3, 4);
f(new int[]{1, 2, 3, 4});
}
}

The specification states that this syntax sugar is only enabled for a variable arity method (i.e. one that uses a ... parameter).
Silly, can't you read?

void foo(int[] foo) {
}

foo(1, 2, 3, 4);
foo(new int[]{1, 2, 3, 4});
// they're equivalent. the standard says so

hello, i ask someone to help me, kindly give me an hand

in android, how to know if activities is too many?

kind thanks for needful help

shill:
using 4chanX (or similar), loving the "fold this comment and all descendants" feature of the little minus sign to the left.
Just a click or two, and all that shit disappears, leaving *my* preferred shitposting topics.
That way we can have (FEARLESS) concurrent multi-topic shitposting in the same thread!

>this syntax sugar is only enabled for a variable arity method (i.e. one that uses a ... parameter).
But I can quote you saying that int... x is syntax sugar for int[] x.

public class Variadic {
public static void f(int... a) { }
public static void g(int[] a) { }
public static void main(String[] args) {
f(1, 2, 3, 4);
f(new int[]{1, 2, 3, 4});
// g(1, 2, 3, 4); //

Oh, sweetheart, so you mean x(1, 2, 3, 4) is not equivalent to x(new int[]{1, 2, 3, 4}) except under the very specific circumstances where int... a is used instead of int[] a? But int... a is syntax sugar for int[] a! You told me so yourself. ;)

week b8 m8

>syntax sugar only works when you use the syntax so it's not syntax sugar

>fold this comment and all descendants
Would be good if it had two modes though:
- foldConservative - only fold descendants that don't reference posts outside the DAG
- foldOneDropRule - fold every post that has even a single reference to the posts in the DAG
Looks like it's going full one drop rule ATM.

Autismo-note: the post graph is normally acyclic, but the code should be able to handle cycles, as it's trivial for some wiseguy to reference a future post with.

Well, as the OP of that problem, can't I just pre-specify the dimensions and cut/parse all of my number strings to match my pre-determined sizing? Assuming that I'm not required to have any specific order or sizing for my output. I decide the dimensions, some imaging guy can put the pictures together on his own.

>X is just syntax sugar for Y
>except typing X produces very different results from typing Y
>A and B are equivalent expressions
>except for every counter-example

So, where's the fuck up?

function findUniq(arr) {
for (i = 1; i < arr.length; i++){
if (arr[i] !== arr[0]){
return arr[i];
}
}
}


I tried using arr.find() and I get the wrong number on the same array.

Absolutely, both scenarios are easily implementable, the first one (knowing/specifying the dimensions before the input) being trivial.
Some clarifying questions:
- are all rows the same length (pixel-wise)? If not, what color should the pixels be when there is no number?
- do you know the number of columns in advance?
- do you know the number of rows in advance ?

What are you trying to do?

Either calculate the dimensions by the length of the array.

Either raise an error if it's not square or fill remaining pixels after the loop.

What exactly are you doing?

any other programmer who works with that code will hate you if you do that. it's just pointlessly complicated, how much time does not typing a few brackets save?

What is better and why?

#!/bin/bash
echo This is a test script for flags with a for loop.
for flag; do
case $flag in
-a) echo the -a flag works!
shift ;;
-b) echo the -b flag works!
;;
esac
done



#!/bin/bash
echo This is a test script for flags with a while loop.
while test $# -gt 0; do
case "$1" in
-a) echo the -a flag works!
shift
;;
-b)
echo the -b flag works!
shift
esac
done

I hope the formatting works...

Find the unique number from a fuckhuge array. It should return the only different number.

Codewars challenge, I pass 14/15 tests, I just can't wrap my mind about what's wrong here and the discussion on the website didn't help.

>fill remaining pixels after the loop
For that you need to keep track of which pixels are "unfilled".
An alternative is to calculate the number of columns in one pass, then fill as you convert in a second pass.
Space vs time vs code complexity, depends on OP's priorities.

>Find the unique number from a fuckhuge array.
Ah, I see
>It should return the only different number.
Does the problem state that there's exactly one different number?
>I pass 14/15 tests, I just can't wrap my mind about what's wrong here
Does it provide a hint as to what's the failure class (wrong answer, too much time/space used, crash, etc.)?

>for flag; do

Wait, does this work? I thought bash 'for' was always of the 'for varName in ' form.

Copy&paste or provide a link/screenshot of the problem statement? Might still missing some information.

Ok, I think I adressed the problem, now I just have to fix my code.

Given this function An array like
[ 0, 1, 1 ]
Should return 0, but with my code would return 1, they way I formated it, if the unique number is arr[0], you get a wrong answer.

that doesn't work if the first one is the unique entry.

If this what you are asking:
> Omitting the in [list] part of a for loop causes the loop to operate on $@ -- the positional parameters.

Yup, that's a good counter-example for the code in Got any ideas?

Neat!
Learned something new and useful today.
I'd still prefer it to be a bit more explicit (for flag in $@), but I'd have to check whether I need double quotes around $@, etc.

Yeah I just found it myself, was hard to find.

Do you prefer a 'for' or a 'while' loop in this case?

If I have a large single instance of a data container, on the order of 10 megabytes, that I will be reading and writing from, is it better to have it be contiguous memory in the stack, or broken up with pointers and floating around in the heap? I will have it's size determined at compile-time, so there will be no new memory allocations at run-time. I don't know if in today's age of computing, ~10 megs is a large chunk of contiguous stack to ask for, or if having 4 layers of dereferencing is going to be asking for an error.

'for', personally, but I'm biased towards python/pseudocode of the 'for x in xs' type.
It'd be handy to check with the potential audience of the code, and peeps that have more shell script experience.

WOW, so much for the TOLERANT left, am I right?

There's better ways to react to obvious bait.

10MB is literally nothing for a typical computer. You'll be fine. I can get away with allocating a 2GB vector.

He just couldn't find a good way to express his shock

/dpt/-chan, daisuki~

Exploring the deepest, darkest corners of Smalltalk; I am crafting a Minesweeper clone with Pharo.
Gameplay is now done. i still have to craft a window and a few buttons (new game, set difficulty, ...).

10 meg is trivial for server/desktops/laptops, not a big deal on mobile/raspi, unimaginable on arduino.
Depends on the expected deployments.
If the size/speed isn't of absolute priority, I'd recommend representing it in the way that minimizes code complexity - but do consider the trade-offs.
So what's the data, and what do you want to do with it?

What is /dpt/'s thoughts on katas?

>katas
Resident Turing Test failure here! I have this to say on the aforementioned topic:
>Why I Don't Do Code Katas - HackHands

Are humans Turing complete?

you? probably not.

Oh, I missed the part about using the stack. No, you don't want a stack-allocated buffer that big because stack space is always limited. Just use a heap-allocated buffer.

Make stuff, if you aren't theoratically gifted, JUST DO IT! Also people over at /wdg/ can help you more.
If you want to have an edge over everyone else read books like Clean Code.

>solving the same sets of programming problems over and over again won't make you a master programmer
This guy doesn't seem to understand what katas are. They come in all sizes and forms, you don't need to do them over and over again, you just need to think how to improve your code when doing them.

This is comfy tier underwater basketweaving. I might even make some games after I fix the bugs.

>doesn't seem to understand
Resident Turing Test failure here again!
Please note that any material referenced in our posts is not supported, understood, comprehended or even read.
Thank you for the understanding and have a nice day!

Is Kotlin/Kotlin Native any good? I want to give it a try.

If you enjoy Scala but think it isn't complicated enough, go right ahead.

I have the freedom to just make empty pixels be one continuous color, so I could just make them 000000 blue to fill whatever is leftover.

-I can decide the format, so columns and rows are my discretion.

that is pretty cool.

Lots of standard containers in C++ have templates with Alloc types. What are the purpose of these allocation parameters?

Cool.
So what's the source of the data?

To allow custom allocators.

No no no, you've got your stereotypes mixed:
- Scala started as Odersky's "FP, the sane parts - for the JVM!" pipe dream, but ended up the FP wankery "I wish I could get paid to write Haskal" haven
- Kotlin is the Russian half-baked, full of idiosyncratic special cases, corporate-supported, Java++

Can you give an example of a custom allocator?

>What is /dpt/'s thoughts on katas?
One of the dumbest things I've ever heard of. What you want to improve is your approach to problem-solving, not your ability to solve a specific set of toy problems.

That's it, I'm buying a gun

Edit, fuck up with the code.

Got a bit more imaginative and nailed it, so happy.

function findUniq(arr) {
var test = arr.sort();
if (test[test.length - 1] !== test[test.length - 2]){
return test[test.length - 1];
} else {
return test[0];
}
};


And it's actually much better performance wise, 1171ms compared to almost 6000ms with the for loop that was almost working.

C# is Java++
Kotlin takes it to an even more maddening degree.

Fascinating that an O(nlogn) algo ends up being faster than a linear one (with no hidden huge constants!)

Are you running your compiler with the --wild-card flag set?

C# is MS's "we couldn't EEE Java, so let's do vendor lock-in the good ole way"
Some tasty shit in there, but you've got to weigh it against the downsides (and upsides) of being an MS tech

Not running a compiler at the moment.

Check out this.
github.com/bloomberg/bde/wiki/BDE-Allocator-model

The examples they have is a "BufferedSequentialAllocator" which allows you to provide a buffer to allocate memory in (like just a fixed size array on the stack).

Thank you. I think I know too little about the C++ memory model to make sense of this, though.

basically the default one is just a general purpose one that is good for most situations. Some people might want to change it to have a different strategy for memory management because it can improve performance for their specific application.

Like everything else in standard C++, the default allocator is typically inferior in almost every use case, and anyone doing anything that matters ends up replacing it.

Wait, how does this work? You're only comparing the last 2 values of the array?

note the 'sort'

*hugs*

It's a 4d array of "tiles_class" instances, each tile instance being a floor tile of a dungeon. So I'll just be read/writing some integer and boolean values to each instance. It will be on desktop/laptop, so I guess I from your advice I shouldn't worry about how I store the data.

2 GB of contiguous heap wtf. And you made me google 'why is stack limited', and fuck it opened a can of worms.

Fucking computers

>tfw improving
or rather my knowledge base is getting broader. i still can't write programs above fizzbuzz-tier heh

2 GB of continuous heap isn't that difficult when you factor in virtual memory.

Just wait until you get into functional programming. About 1000 new worlds and topics open up.

What's the difference between MPIR and MPFR?

Python hides too many detail which can't be explained easily without referencing C/C++. Learn C++.

>1000 new ways to be smug about your fizzbuzz-tier code open up
FTFY

>computer science principles AP class
Doesn't matter what language you choose.
Python is probably a good choice because it doesn't have a lot of distractions.

>Just wait until you get into functional programming About 1000 new worlds and topics open up.
About 1000 new fizzbuzz variations and autismal shilling topics open up. If every piece of Haskell/Agda/Idris code ever posted on /dpt/ is anything to judge by, one should avoid FP at all costs.

seething

like clockwork.

Just pointing out some simple statistics, user. Does this offend you?

lol he's mad, am i right, guys? i bet it's a samefag

yeah, absolutely, he probably failed fp class in college

yeah, monads ain't easy, but they open so many possibilities, like pure I/O

I did. But why is it assuming that the unique number is either in test[0] or test[test.length-1]? What if it's literally anywhere else?

I'm working on a bioinformatics project for research right now. The code works but running on CPU it will probably take all week to finish.

Would hopping onto the GPU meme make the code go faster? If anything it could also increase the meme-ness of the project making it even easier to get funding since we need to justify buying gpus.

If it helps, the part that seems to take the most time is looping through all rows (each row containing a mutation found through sequencing) in each data file and incrementing some counters for each category of mutation.

decided to stop blatantly samefagging after the first two posts, huh?

>why is it assuming that the unique number is
I thought that too, for the first few seconds.
However, literally "think about it".
- only one element in the array is different
- it seems the array is 3+ elements
- the array is sorted
Where can the different element be?

Not sure who's claiming who's samefagging anymore.

What does that post have to do with mine?

If the algorithm is embarrassingly parallel and the overhead of shipping the data to/off the GPU can be compensated for, absolutely.
Depends on the algorithm and data access patterns, tho.

meant to link the one above you.

Wait, there's only 2 distinct values in the whole array? I was thinking of something like this:

0, 0, 1, 2, 2

which would obviously return the incorrect value, but this array has 3 distinct values.

I'm not a computer scientist. What do you mean by a parallel algorithm?

Right now all it's doing is literally looping through every line in a file and making a decision on what to do with each line based on the data present.

This is repeated for every file, some of which are about 1GB in size.

That sounds embarrassingly parallel to me, HOWEVER it also seems like there will be an I/O bottleneck if you do it naively. To get any real gains, you'll want to have the file in memory (RAM disk?)

First shitposter () here, if you meant to suggest samefagging between
(11:20) and
(12:24)
(I know I would!) I'm sad to inform you that there's actually at least one other shitposter, and, surprisingly, this was merely a conspicuous coincidence
/jerk.
Too lazy to continue shitposting, so I actually went ahead and made more productive use of the 60s post cooldowns elsewhere.

Each file is loaded into a pandas data frame before the whole counting thing starts, but one at a time since I don't have enough RAM to store all the files at the same time. That part doesn't seem to take too long.

>there's only 2 distinct values in the whole array
yup:

Depends on your algorithm

Doing CUDA for my Master's. Not all code can be parallelized in an efficient way, and it can be pretty complicated to parallelize even the code that can. Doing things naïvely on the GPU will probably get you even worse performance

If you just need this one off or for a single project, I'd say don't do it. If it's going to be used more than once or you will perform more research like it, then dive really deep

I'm not sure I get how "having the file in memory" is going to help with the IO bottleneck. He's still going to need to get the data loaded into memory at one point or the other, the only thing he needs to ensure is that he's not wasting time due to IO latency (which won't be an issue if IO is the bottleneck anyway).

Have you tried paralleling your C++ code?

I have a feeling it will be used a lot more in the future. This is the second large dataset we are processing with it.

I have an AMD GPU on hand so it looks like I'm temporarily stuck with OpenCL, but no nvidia one for now.

It's python.

>pandas
>python

>If it's going to be used more than once or you will perform more research like it, then dive really deep
I'd say do a timeboxed exploration of the different approaches, e.g.
- on-CPU parallelization ()
- on-GPU parallelization

How C handle big number arithmetic?
Is the behavior of this code well defined in C with 32 bit machine?
unsigned int a = 0xffffffff;
unsigned int b = 0xffffffff;
unsigned long long int o;
o = a + b;

where sizeof(unsigned int) == 4 and sizeof(unsigned long long int) == 8
if o in that snipplet is an unsigned int, the calculation will ends up overflowing and causing o contain unknown value depends on the overflow logic of the machine,
but o is big enough to contain all the value by standard.

If that code doesn't lead to any undefined behavior, is it okay to assume that integer calculation doesn't have any maximum limit so the next snipplet will be well defined also?
unsigned long long int a = 0xffffffffffffffff;
unsigned long long int b = 0xffffffffffffffff;
unsigned long long int o, p;
o = (a * b) & 0xffffffffffffffff;
p = (a * b) % (0xffffffffffffffff + 1);

The (0xffffffffffffffff + 1) by itself will be an overflow even for the unsigned long long int, so is this going to cause any problem?

Yeah, never mind that.

In general, you'll need to make the choice between discrete hardware and unified (HSA) hardware. The former tends to have more raw power but higher latency because of the cost to transfer the data back and forth. BUT you only need to do this the number of times you have to split up the data to fit in memory. Probably OpenCL with your current GPU will be a big upgrade.

The key is to load as much of the file as you can into system memory, then transfer as much as you can into video memory (with HSA you skip this step because system memory = video memory). Then you run all your calculations on the data you have loaded, since each entry is independent of all the others. And repeat until you've finished.

Then you might want to look at organizing your dispatches and work groups to maximize branch coherence, which will probably be the bottleneck. GPUs perform best when their cores (which execute e.g. 16 threads at once) tend to branch uniformly.

Actually, even with a discrete GPU, you could try pinning the allotted 512 MB or 1 GB or whatever and only working on that much at once. That would also avoid the transfer latency.

In GO, when should i use
a := &myStruct{}

Instead of
a := myStruct{}

?

Just follow your heart.

>The (0xffffffffffffffff + 1) by itself will be an overflow even for the unsigned long long int, so is this going to cause any problem?
Yes, in that particular example you are dividing by zero.

Rewrite Descent 1 in D

So, is there any way to know the limit of integer arithmetic calculation for integer before I need to use partial calculation?

Radio telescope signal data

A fellow vidyanigger! I, too, am using an unpopular language to implement an oldschool-looking game. It's not D, though.

Interesting.
So would it be fair to assume this is a stream of "scan lines" (rows of pixels), each line having a certain native pixel count?

What are you doing that can possibly overflow a 64-bit integer?

working on a chat client
git.volatile.bz/krustykrab/achlys/
was going to write it in python3 until i remembered how shitty OOP is

another vidyanigger reporting in, my first game

some bruteforcing stuff.
Need to generate 512 bit value based on the other input value, so quite a few arithmetic is required
How do you know that the ALU will using 64-bit integer?
is it specific to any machine? If so, then how to know it?
In the end of course I need to do partial calculation, but If I know the size of the ALU, then I can maximize the calculation easily.

Programming socks are so 2017, 2018 belongs to programming hijab

>working on nontrivial project with no backup in 6 months because I feel invincible
>feeling good after recent progress
>get up and make a drink to celebrate for ~20 minutes
>return to find boot screen, but pc isn't booting
>soft power off and on
>"chillax while I install some shit" because that is how windows 10 conveys information to its users
>spinning circle of dots freezes at 100%
>don't turn off the power
>hd light solid white for 20 minutes
>don't turn off the power
>take a shower
>hd light still solid white
>don't turn off the power
>I turn off the power
>audible REEEEEEEE from inside case
>hd light flashing, cpu fan at 100%, mobo lights go on and off in their normal order, no output, no beeps
>no troubleshooting info in mobo manual
>try to remove graphics card and see if I get beeps but it the latch won't come undone
>can't reach it, poked it with a screwdriver
>use too much force and it dinks some tracks
>fuckfuckfuck
>still no beeps
>reseating memory in different slots works for some reason
>zero data loss
wtf was that

>using hand-drawn placeholder space-ships
>not simply ripping sprites from an existing game
Also, is that a phone game?

If I am trying to do x mod 32, shouldn't it just be
and r4, r3, #31?
where r3 is x

I don't know if I can help you with your specific problem, but I can say this. If you need to guarantee the size of your integers, use the header.

Suppose I have a huge array, like on the order of 100,000 members, and at each index is an instance of some class, class_A. The class_A only has ~10 members, all int/bool/int-enumerated, so the overall memory has not quite exploded to huge proportions yet. Now the problem is that I want to associate some other instances of a different class, class_B, with these unique array indices. Instances of class_B will be dynamically created and destroyed during runtime. I want to be able to associate as few as 0, and as many as ~10^3 instances of this separate class_B with a single tile. Total, there will only be ~10^4 instances of class_B, but the array index they will be associated with can change, and they can get highly concentrated on a single array index.

Obviously, I do not want to allocate memory for each array index to hold up to 10^3 instances of class_B, so I am thinking I will just include as a member of class_A a 2nd-tier pointer, which points to a 1st-tier pointer, which points to a dynamically allocated array (can change from NULL to [1000] during runtime) of instances of class_B.

My reasoning for this is:
A)it will reduce the memory needed for the overarching array by a few order of magnitude
B)it will allow me to use the overarching array's indices to reference instances of class_B that are associated with that index
C)it will allow me great flexibility in the number of class_B instances associated with each overarching array index.

Will this work? Is it a retarded roundabout way to solve my problem? Or is it something that people more proficient with pointers do often? Am I even making sense?

>poking your computer's innards with a screwdriver
>while it's still on

Have it contiguous on the heap, dummy.

I am tying to make simple platformer game and i made this two dimensional vector class for acceleration and velocity stuff. Did i miss anything?

float A = 35.74; //constant 1
float B = 35.75; //constant 2
float C = 0.6215; //constant 2
float D = 0.4275; //constant 3
float windChill = A + C * T - B * pow(V, 0.16) + D * T * pow(V, 0.16);
PFont font;

void setup() {
size(400, 250);
background(55, 155, 255);
font = loadFont("Gabriola-90.vlw");
textFont(font);
}

void draw() {
text("Wind Chill", 100, 150);
}

How do I output "Win Chill = windChill"? I feel like such a brainlet, been at this for 2 hours.

I didn't say or do that
in restrospect I should have used a chopstick

if I make a 4d array of pointers as follows, I know that it's in the heap, but I don't know if it is contiguous or not? Is it better for it to be contiguous or not?
// makes blank 4d dungeon
tiles_class **** Dungeon_Map = new tiles_class *** [NUM_BRANCHES];
for (int i=0; i

Yes it's better on the heap, and no an array of pointers won't be contiguous (the pointers themselves will be though).
Why can't you use an std::vector?

Examples?

What is your access pattern? Are you retrieving a list of all class_B instances associated with a given index, or are you retrieving the index associated with a given class_B instance? Or both?

I was suggested to use std::vector, but then I was reading some forum posts that said that if you use std::vector, it uses contiguous memory, and that if your memory chunk is large, there's more chance of getting bad_alloc. I figured my map was gonna be altogether ~10 Mb, which sounds large to me, but I don't really have a frame of reference. I know computers nowadays have 4+ Gb of ram, but I don't know how fragmented it usually is after a few hours of the computer being on.

No my problem is, how to determine the maximum value I can have before assign it to a variable?

I tried this and it works with well defined behavior in a 32 bit machine:
uint32_t a = 0xffffffff;
uint32_t b = 0xffffffff;
uint64_t o = a + b;


But then is this going to be well defined assuming all pointer point to valid address:
void big_add(uint64_t * ret, uint64_t a, uint64_t b)
{
ret[0] = ((a + b) >> (sizeof(uint64_t) * 8));
ret[1] = ((a + b) & 0xffffffffffffffff);
}

Why does the entire 4d structure need to be contiguous?

what's a good way to externalize an enum that doesn't require recompilation when a type is added or removed but preserves some kind of integrity checking?

>how fragmented it usually is after a few hours of the computer being on.
Irrelevant.
Every process has it's own virtual address space. so even if physical memory is fragmented to fuck, your process still sees a fresh, clean, unfragmented address space on program start.
You will definitely have 10mb contiguous heap space available, bad_alloc is extremely unlikely and I've never even gotten one in C++ ever.

>Am I even making sense?
No you lost me. So let me try and make sense of this. You have one array holding instances of ClassA. You have instances of ClassB being created and want to some how associate them with indices of the ClassA Array.

Why not just have a member variable in ClassB which holds the index of the ClassA Array it is associated with? You can have a dynamic array holding ClassB instances and loop through that array asking the instances which index they're associated with to get that data. No idea how efficient this would be but you could try it.

Just pad the array with the modulus of the row length and do it in one pass.

I don't have a requirement on my end for it to be contiguous. I read some stuff saying that trying to allocate large contiguous chunks of memory was risking a bad_alloc, and I read some stuff saying that breaking up your data over many regions of memory was contributing to 'cache misses.' I googled 'cache misses' and started reading about CPUs and started getting a little overwhelmed. Feels like I'm having to learn metallurgy and botany when all I want to do is drive a nail into a board.

yes, both. I want to be able to look into the overarching array and see what instance(s) of class_B exist at that index, and I want to be able to look at my_instance_of_class_B.coordinates and find it in the overarching array.

Yes, that is what I meant. I was thinking about exactly what you're saying, but .... fuck me. For some reason it sounded too computationally inefficient when I was thinking about it earlier, but even if I have ~10^4 instances of class_B in a list, running through them and checking the coordinates is really fast, given that I only have to do it around 10^0 times a second.

You want a lazily initialized List as a member of Class_A. Why would you think that's retarded?
>Tile
RPG? List? Lazy initialization might not be a good idea if you cast gigaflare and wipe out 300 imps and need to instantiate and populate the lists all in one update cycle. Mass initialization on scene load would add marginally to scene load time but better that than unresponsive play time.

where might one go to find a "simple" tutorial for making and drawing a bsp tree in c/c++?

mass instantiation with a default size on load I mean

Extra:
My intention to know about the data width on the ALU is because I made this uint64_t multiplication function as a test, and it seems to works in well defined behavior, but I can't confirm whether it's really defined behavior, or it silently creating UB somewhere in the calculation and all my manual test did not notice it or it's just a coincidence that the UB creating correct value
void big_mult(uint64_t * ret, uint64_t a, uint64_t b)
{
ret[0] = ((a * b) >> (sizeof(uint64_t) * 8));
ret[1] = ((a * b) & 0xffffffffffffffff);
}

maximum of uint64_t (0xffff ffff ffff ffff) squared is 0xffff ffff ffff fffe 0000 0000 0000 0001, and it assigned to 2 uint64_t variable
But will this function always generate accurate result or it's silently failing unnoticed?

>drawing
This is a board for computers not art. But seriously, the wiki page for BSP trees states multiple people have written PhD theses. I don't think you're going to find a ""simple"" tutorial on it.

>But seriously, the wiki page for BSP trees states multiple people have written PhD theses. I don't think you're going to find a ""simple"" tutorial on it.
BSPs are actually dead simple and a quick google search will give you loads of tutorials.

That is a good solution for the problem I have stated. However, my apologies, I should have included more information. The instances of class_B are going to be game items, like swords and potions and all that. The problem with a member of class_A being a lists is that I want the player to be able to ctrl+F to search through all items he's seen in the game, and that will be much fewer operations if the members of class_B/game_item are altogether in a seperate container I can iterate through.

and on 2nd thought, when I'm writing monster AI, I will save a couple of orders of magnitude of operations if I can access members of class_B through the members of class_A(which is the map grid), compared to iterating through the entire list of instances of class_B and asking "are you at coordinates X,Y?"


Ok, I think then I will stick with what I originally planned: a member of class_A being a pointer to a pointer to an array of instances of class_B.

Another thing I'm trying to keep in mind is how I'm going to save the game state. Apparently a straight binary save of the game variables is susceptible to corruption across different OS's and hardware, and saving the game variables in a text document is gonna require a lot of fiddling around with personalized read/write functions for my game variables that use a lot of pointers that will be meaningless when the user tries to load a saved game.

Looks nice! What language are you using?

>Either calculate the dimensions by the length of the array.
>Either raise an error if it's not square or fill remaining pixels after the loop.
Here you're talking about the case where the dimensions are not known, including row length.
I made my comment working with that scenario.
>Just pad the array with the modulus of the row length and do it in one pass.
Here you suddenly assume the row length is known, which is a different scenario.

New thread:

well, more like a document or something that breaks down what a BSP struct should be like, how it should be written to/read from, and drawn.

there's stuff like that for tile maps, i was wondering if there would be something like that for the third dimension.

most of what i've found has dead results

>I don't have a requirement on my end for it to be contiguous. I read some stuff saying that trying to allocate large contiguous chunks of memory was risking a bad_alloc, and I read some stuff saying that breaking up your data over many regions of memory was contributing to 'cache misses.' I googled 'cache misses' and started reading about CPUs and started getting a little overwhelmed. Feels like I'm having to learn metallurgy and botany when all I want to do is drive a nail into a board.
I.e. you're falling into a classic case of analysis paralysis.
You're obviously too green at this stuff (everyone was at one point), so I'd recommend dialing down the worry factor, but keeping on asking questions - keep it balanced.

Thank you! I'm using Nim.

Dis

Are you using any particular DOOM implementation as a reference?

>most of what i've found has dead results
Look harder. Here's the basic idea: you pick a plane and use it to split space into two subsections: all the space behind the plane, and all the space in front of it; then, for each subspace, you pick another plane and repeat the process; keep doing this recursively until you reach some limit that satisfies you. When you're done, you're left with a binary tree of planes. You then take your polygons, and one by one, you "push" them through this tree: you check which side of the root plane the polygon is on. If it's behind, you push it through the (e.g.) left subtree. If it's in front, you push it through the right subtree. If it's on both sides (i.e. the plane splits it), you split the polygon into two, and push each one through the corresponding tree. Eventually you reach the leaf nodes, so you leave your polygons there. To draw it back-to-front, you start with the root plane and check which side the camera is on. You know that all the polygons on the opposite side have to be drawn before all the polygons on the same side as the camera, because any ray of light from the camera to the polygons on the other side would have to at least cross the plane to get to there, and it would sooner hit a polygon on the same side of the plane. So you draw the child node for the opposite side, then the child node for the camera side. The same logic them applies recursively until you reach the leaves, at which point you just render the polygons stored there. As for picking the planes in the first place, you have one for every polygon.

>Are you using any particular DOOM implementation as a reference?
No. It's fairly easy to figure out how to render levels from the WAD format specs.

I want to work at home, so I want to be a web dev. But the problem is I like Python too much and there are very few Django jobs. What to do?

Can someone explain what message passing is? I saw it while searching for Nim, which supports it, I read the wiki page but it looks identical to polymorphism.

Write a library that generates code in whatever language has jobs from python code, in python.