[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: 30
File: fizz-buzz-dying-in-a-fire.jpg (128 KB, 1000x930) Image search: [Google]
fizz-buzz-dying-in-a-fire.jpg
128 KB, 1000x930
FizzBuzz edition

Old: >>55214118
>>
>>55226380
First for D
>>
File: learning wpf haha.gif (182 KB, 533x365) Image search: [Google]
learning wpf haha.gif
182 KB, 533x365
I'm learning wpf
>>
Easiest way to mess around with arc files?
>>
>>55226446
Why haven't you imported MahApps with Nuget yet?
>>
File: Train-Engine.jpg (89 KB, 600x350) Image search: [Google]
Train-Engine.jpg
89 KB, 600x350
The Rust game engine project Piston seems to be getting its own scripting language, called Dyon.

http://blog.piston.rs/2016/06/07/beware-dyon/

My gut instinct tells me it's shit.

Opinions?
>>
>>55226574
The syntax looks like Rust/Go abortion, I won't even bother looking into details.
>>
>>55226547
I just started with WPF, I'll check this out cheers senpai
>>
>>55226380
That's not even a proper fizzbuzz.
The useless webdev who wrote that stupid article couldn't even be bothered to learn fizzbuzz in all the time since the failed interview.
>>
>>55226380
Going into my Junior year of a Comp Sci program and have been learning Java and SQL both in class and in my own time.

What other languages will help me get an edge when applying for jobs?
>>
>>55226574
>My gut instinct tells me it's shit.
i didn't even visit the link and i know it's shit
>>
>>55226742
java and sql are all you need for most programming jobs these days
if you want to get into webdev/LAMP you need to know php
if you want to be a software expert, you need to know c or c++
>>
>>55226596
WPF truly is wonderful. Been using it for a couple of years with MVVMC pattern. It's insanely powerful.
>>
>>55226795
>you need to know php
NOPE

nope

fuck this shit

>>55226592
>>55226777
Rust is a good language but this scripting language appears to be useless.
>>
Actually while we're on the subject, C or Rust for some gamedev fuckery?

No C++ allowed and this is a hobby project for code nerd reasons so don't tell me to use Unity you cucks.
>>
>>55226855
use unity
>>
I have 3 months to develop some java program for university, but due to travel plans I'll have to make it in one week.
It should be fine because I already know how to do it, but it will still take long just because it's java
>muh oop
>>
>>55226855
Either program it from the start in c++ or if you're not doing that use unity. What the fuck are you smoking there is no substitute
>>
>>55226855
C with OpenGL
>>
>>55226574
>fn foo() -> { return = 3 }

>Dyon has a similar object model to Javascript.
>A variable with same name shadows the previous one:
>a := 0
>a := false
>println(a) // prints `false`
AYYYYYYYYYYY LMAO
>>
>>55226855
>this is a hobby project
then just use which ever language you want to use
>>
>>55226895
>Either program it from the start in c++ or if you're not doing that use unity
What's wrong with C or Rust?

>>55226910
but I'm pathologically indecisive
>>
>>55226901
>sjw webtards in charge of making a game engine
>>
>>55226855
Python. :^)
>>
>>55226922
Unity. If it's just hobby, there's no reason not to use the tools provided for you.
Now stop whining and code.
>>
>>55226922
what's wrong with C++? are you afraid you might learn some things?
>>
>>55226812
>NOPE
>nope
>fuck this shit
yeah, that's how everyone feels about it
>>
>>55226938
if it's a hobby, a programming hobby, there no reason to use the shitty tools for kids that try to avoid programming as much possible
>>
>>55226938
Backend engine shit is why I'm interested in the first place actually. That's the reason.

I don't have characters or an artstyle or even a game in mind I just want to noodle around with vertex buffers and shit.

>>55226945
I already know C++ and I'm trying to learn some things. That's the point yo.

(although if I actually used C++ 11 and newer features for once I'd be learning some things that way too)
>>
>>55226982
Then make your own engine instead of a game?

>>55226963
Sure, unless you actually want to finish your shitty projects.
Also
>Unity
>Shitty tools for kids
God damn man. Show me something of your creation.
>>
>>55226999
kys fag
>>
>>55226999
>Show me something of your creation.
it's like I'm really in agdg
>>
>>55226999
>Then make your own engine instead of a game?
That's the plan.

Perhaps I mis-stated my intentions.
>>
>>55227011
what's the next step of your master plan?
>>
>>55227011
2d?
use c + sdl
>>
File: this.png (24 KB, 618x272) Image search: [Google]
this.png
24 KB, 618x272
How to average two floating point values in C++, /dpt/? How do I fill in pic related?
>>
how fucking pathetic can you get, literally fuck off to >>>/vg/agdg, either you failed hard to program something "from scratch" because you're a pathetic idiot who gives up when encountering the slightest resistance or you didn't even try, you're just spouting dank memes and just decided ahead of time that you're a pathetic failure

opengl and graphics programming isn't even hard ffs
>>
>>55227025
Derailing this thread... WITH NO SURVIVORS

>>55227034
Yeah that'd be pretty legit.

Rust would be my first pick in a vacuum, but having hobby projects written in C is a good "hire me" kinda thing I think - plus C is compatible with fucking everything.
>>
>>55227063
I'd accuse you of having shit reading comprehension but I'm not even sure who you're responding to. What the fuck is going on in this post?
>>
>>55227089
obviously in reply to >>55226999 (You)

idiot
>>
unity is fucking shit it's like the python of game engines, it has horrible performance, shit tier design, retarded users etc
>>
>>55227140
UR SHIT U BASTERD
>>
>>55226574
>Traditional For loop:
>shows the C loop and not the counting loop from the 1940s (which influenced Fortran, Algol, BASIC, Pascal, OCaml, etc.) which is based on the "for i = 1, ..., n" notation found in mathematical texts and known to express only the primitive recursive functions
Put it in the fucking garbage!

https://en.wikipedia.org/wiki/BlooP_and_FlooP
>>
>>55227140
I'm
>>55226855
and I said
>so don't tell me to use Unity you cucks

so believe me when I say, some good games have come out of Unity. Verdun and Kerbal Space Program come to mind.

You appear butthurt against a piece of software you don't use and I don't know why..?
>>
I am doing a small project where I want some optional local software component to talk to a browser application written in javascript.
The local applications should be written in c++.
If it was c++ to c++, I would just use zeromq, What library should I use in website?
>>
File: 1354417696292.png (56 KB, 372x439) Image search: [Google]
1354417696292.png
56 KB, 372x439
I programmed compton.conf to fix AMD tearing.

backend = "xr_glx_hybrid";
paint-on-overlay = true;
vsync = "drm";
xrender-sync = true;
xrender-sync-fence = true;
>>
>>55227319
>programmed
>set some config
>>
>>55227319
Oy oy,

what's Compton?
>>
>>55227319
>programmed
>>
>>55227353
Hey boy, Lua began as a configuration language.
>>
>>55227472
Wouldn't have minded it staying that way.
But I suppose there was a gap to fill in that age.
>>
>>55226574
>>55227181
>4D vectors:
>a := (x, y) // same as `(x, y, 0, 0)`

Boy, what a lovely idea! I can't see any possibility for memory bloat here!
>>
>>55226804
How is winchan coming
>>
So I'm trying to generate a simple square & circle depth mask, like so:

    void init()
{
for(uint32_t x = 0; x < Size; ++x)
{
for(uint32_t y = 0; y < Size; ++y)
{
float dx = std::fabs(x - Size * 0.5f);
float dy = std::fabs(y - Size * 0.5f);
//float dist = std::sqrt(x * x + y * y); // circular
float dist = std::fmax(dx, dy); // square

float max = Size * 0.5f;
float delta = dist / max;
float gradient = delta * delta;

data[x][y] = std::fmax(0.f, 1.f - gradient);
}
}
}


It works fine for the square but if I use the circle one then the output is like 1/4th of the circle in the corner, what gives?
>>
>>55227902
I have no idea what you are talking about except to note that radius is squared and 0.5*0.5 = 1/4
>>
File: DIPswitch Demo 1.gif (1 MB, 640x480) Image search: [Google]
DIPswitch Demo 1.gif
1 MB, 640x480
Today I was paused work on the level editor and worked a bit on the actual game. I focused on simplifying the networking gameplay mechanic by adding a route button. When you hit R it shows the chain of devices connected to the one you clicked. Makes the game way easier to understand. Also made pretty dialog boxes :D

What do you think /g/? I am going for a kind of gameboy aesthetic but that may change.


>>55226446
What program did you use to make the gif? I have use GIFrecorder and as you can see it places a stupid watermark over it.
>>
File: kys.png (5 KB, 282x369) Image search: [Google]
kys.png
5 KB, 282x369
>>55227990
Naw it's cool I'm a fucking idiot, I used x & y in sqrt() rather than dx & dy.
>>
>>55228001
licecap, very easy to use but for some reason it fucked up the gradient
>>
>>55228041
dy = y1 - y2
dx = x1 - x2

Calculate that and then reduce each by some amount so they are in smaller increments, and then change coords by that much until you've reached your destination.
>>
>>55226574
>home-made dsl for game scripting
it's shit by definition
>>
>>55228001
Pretty nifty anon
>>
Hi /g/. I have considering getting into programming, but what programming language has the cutest syntax? this is all that matters to me.
>>
>>55228578
C has the most minimal and syntactically consistent syntax of any language.
>>
>>55228603
>syntactically consistent syntax

top bantz, lad.
>>
File: lolc.png (106 KB, 555x619) Image search: [Google]
lolc.png
106 KB, 555x619
>>55228578
Definitely not C.
>>
>>55228625
>intentionally hard to read code is hard to read

thanks senpai
>>
>>55228623
What?
It's all consistent.
There's no operator overloading and everything boils down to an abstraction on pointers.
>>
>>55228603
that doesn't sound very cute. I like my syntax to have some personality.
>>
>>55228662
You can write cute C code as well.
>>
Learning GoLang from previously working with Python. I really like it.
>>
>>55228677
Cutesie* code.
>>
is there anything wrong with this remove node function? I always feel like I'm missing something.

    void delete(struct Node *list, int data)
{
struct Node *conductor = malloc(sizeof(*conductor));
struct Node *previous = malloc(sizeof(*previous));

previous = list;
conductor = previous->next;
while (conductor != 0){
if (conductor->data == data){
previous->next = conductor->next;
free(previous);
break;
}
previous = conductor;
conductor = previous->next;
}
}
>>
>>55228578
programming isn't cute, fag
>>
typical haskeller """humor"""

https://hackage.haskell.org/package/acme-cutegirl-0.2.0.0/docs/src/Acme-CuteGirl.html
>>
>>55228603
>>55228660
>int (*f)(int *(*)(int (*)(int *(*)(int), int**)), int**)
>{ 001, 010, 100 }
>a = b /*p; /* division? */
>a, b = b, a

https://www.gnu.org/fun/jokes/unix-hoax.html
>for(;P("\n"),R--;P("|"))for(e=C;e--;P("_"+(*u++/8)%2))P("| "+(*u/4)%2);
>>
>>55228891
programming seems cute to me.
>>
>>55228891
programming is for cute lolis
>>
>>55228735
nodeT *ListDelete(nodeT *currP, elementT value)
{
if (!currP) {
return currP;
}

if (currP->element == value) {
nodeT *tempNextP;

tempNextP = currP->next;

free(currP);

return tempNextP;
}

currP->next = ListDelete(currP->next, value);


return currP;
}
>>
>>55228677
what makes it the cutest though? I want the girly cursive handwriting equivalent of code. is that C?
>>
>>55228967
When I say cute, I mean C can describe complex algorithms in just a few keystrokes, and if you make your variable names super short, you can come out with some very small and cute C code.
>>
>>55228960

I like this but it deletes the whole list. I'll use it for inspo though, thanks.
>>
>>55229013

oops no it doesn't, very good
>>
>>55228735
void remove_list_entry(entry)
{
indirect = &head;

while( ( *indirect ) != entry )
indirect = &( *indirect )->next;

*indirect = entry->next;
}
>>
File: kebab.png (2 KB, 66x51) Image search: [Google]
kebab.png
2 KB, 66x51
Trying to generate a number from 0-5 in java but then generate a new one excluding any number from 0-5 that I pick out.
Random tileType = new Random();

for (int i = 0; i < 12; i++)
{
for (int j = 0; j < 6; j++)
{
rowsByColumns[i][j] = tileType.nextInt(5);
}
}


that is what I have to generate a number but I dont know what to do in order to exclude a single number from 0-5 (any that I want)
>>
>>55229044
Maybe use a set data type and randomly select + remove elements from it.
>>
File: uhh.png (5 KB, 315x343) Image search: [Google]
uhh.png
5 KB, 315x343
>>55228029
Not sure where I'm headed...
>>
>>55227044
float buf = (float1/2);
return (float2/2) + buf;
>>
>>55229057
a set that can be indexed by position
>>
>>55229044
simply draw again until it's different thant the one exluced
>>
>>55229057
I get that, but what I'm doing in my program is filling a 2d array with randomly generated numbers from 0-5 and I'm writing a function that prevents the same number from occurring in certain places depending on what is around it.

For example, the first row in the array is:
0 2 3 1 0 0

The program generates the rows from left to right and columns from top to bottom. Before it generates the next number, it calls a function that checks what is to the left of it. If it's the same number, it needs to reroll EXCLUDING the number next to it.

After writing this I could potentially just have it get stuck in a loop and not leave until it generates a number other than the value that is next to it.
>>
>>55229044
generate a number from 0-4,
and if that number equals the excluded one set it to 5.
>>
>>55228578
Befunge
>>
So I'm reading on WPF, do people actually manually write XAML or do they use the designer?
>>
>>55228735
>I'm missing something
yes, you're missing common sense and the point of lists
>>
how do i make a program that takes no hard drive space and uses no ram
>>
>>55229034
if your removal is not O(1) you should rethink why you're using a list in the first place
>>
>>55229544
punch card
>>
>>55229547
That's actually just something I saw in some video Linus did, think he was talking about code readability or something.
He gave two examples
remove_list_entry(entry)
{
prev = NULL;
wak = head;

// Walk the list

while( walk != entry ) {
prev = walk;
walk = walk->next;
}

// remove the entry by updating the
// head or the previous entry

if( !prev )
head = entry->next;
else
prev->next = entry->next;
}


and
remove_list_entry(entry)
{
// The "indirect" pointer points to the
// *address* of the thing we'll update

indirect = &head;

// Walk the list, looking for the thing that
// points to the entry we want to remove

while( ( *indirect ) != entry )
indirect = &( *indirect )->next;

// .. and just remove it
*indirect = entry->next;
}


Where the bottom one was the good one.
>>
>>55229547
Can you give an example of list having O(1) removal?
As far as I know lists have search time + O(1) removal when deleting in the middle, which this >>55229034 is, however it doesn't keep track of list tail, so end deletion will be O(n)
>>
>>55229690
he was actually talking about knowing enough about pointers to realize the second one is the way you should naturally write C
singly linked lists are still shit if your use case involves random entry removal, regardless of using the worthless prev pointer or doing it idiomatically
>>55229820
double linked lists just have to update 2 pointers in order to remove an element; no search; that's what you should use when you need random entry removal
>>
has there been any studies done into whether dressing as a girl actually makes you better at programming?
>>
>>55229854
Yeah
>>
>>55229886
does it?
>>
>>55229904
Indeed
>>
>>55229854
Why don't you try it and report back?
>>
>>55229916
but I can't administer myself a placebo to compare to.
>>
File: notre-dame-console.jpg (1 MB, 2646x1763) Image search: [Google]
notre-dame-console.jpg
1 MB, 2646x1763
What is the right way to do certificate verification in OpenSSL?

http://www.ibm.com/developerworks/library/l-openssl/l-openssl-pdf.pdf
This says that all I need is:

if(SSL_get_verify_result(ssl) != X509_V_OK)
{
/* Handle the failed verification */
}


But the
SSL_get_verify_result
does not return with
X509_V_OK


This is how I connect:
int connect(bot_t *data)
{
int rv;

ERR_clear_error();
rv = SSL_CTX_load_verify_locations(
data->ssl_context,
NULL,
"../certs");

if (!rv)
{
fprintf(stderr, ERR_error_string(ERR_get_error(), NULL));
return 1;
}

//SSL_CTX_set_verify(data->ssl_context, SSL_VERIFY_PEER, NULL);

ERR_clear_error();
data->bio = BIO_new_ssl_connect(data->ssl_context);

if (!data->bio)
{
fprintf(stderr, ERR_error_string(ERR_get_error(), NULL));
return 1;
}

BIO_get_ssl(data->bio, &(data->ssl_connection));
SSL_set_mode(data->ssl_connection, SSL_MODE_AUTO_RETRY);
BIO_set_conn_hostname(data->bio, data->host);
BIO_set_conn_port(data->bio, data->port);

long result;
result = SSL_get_verify_result(data->ssl_connection);

if (result != X509_V_OK)
return 1;

ERR_clear_error();
rv = BIO_do_connect(data->bio);

if (!rv)
{
fprintf(stderr, ERR_error_string(ERR_get_error(), NULL));
return 1;
}

return 0;
}


And yes, that is the correct cert directory and I did hash my certs.
Wat do?
(besides using PonySSL)
>>
>>55229945
Of course you can.
Just take off the skirt and record your observations.
>>
File: code.png (24 KB, 620x398) Image search: [Google]
code.png
24 KB, 620x398
These four vectors are still full even after I run this code. Am I doing something wrong?
>>
>>55229967
Trying to SSL connect to freenode btw.
I do have the GandiStandardSSLCA.crt and I did convert it to pem.
>>
>>55229975
that's not a placebo. Since I expect crossdressing to make me better, it might make me better just from that.
>>
>>55227181
>>55226901
>>55226777
>>55226592
>>55227504
>>55228340

Do you guys just find the most random and shitty reasons to hate stuff without even trying to find out the motivation behind its design? It's actually very cringeworthy.
>>
>>55230056
I gave a reason
>>
>>55228001

pretty good for a flash game in 2007

also linear technology called, they want their logo back
>>
>>55230065
My post pointed out your inability to read and reason properly, and you have demonstrated that deficiency again. I never said you didn't have a reason, I called your reason blatantly ignorant.
>>
>>55230016
Then go get a friend and tell them crossdressing make you dumb and make them do fizzbuzz while dressed like a girl or something.
>>
>>55229982
I was able to fix it by calling clear() on all the vectors, but I'm still worried that the memory might not be getting recycled. Anyone know what's up?
>>
>>55230081
>My post pointed out your inability to read and reason properly
nope

>I called your reason blatantly ignorant
I gave a proper reason is waht I meant to say.
>>
>>55230099
>I gave a proper reason is waht I meant to say.
Then why don't you tell me what it was?
>>
>>55230056

yes

for 90% of languages, /g/ will just judge them based on syntax entirely
>>
>>55230110
This >>55228340
>>
>>55229982
that looks terribly wrong.
>>
>>55226480
Pls answer. I'm trying to make a program to automatically translate some files and I can't find the answer on google
>>
>>55230122
can you show me that definition? I've never seen it before but if it's really there then I will recant
>>
>>55230154
Autist
>>
Does anyone know of a good resource that goes over interacting with stuff on the heap in C++, how it's done, the underlying mechanics, etc?

I'm attempting to put an empty vector on the heap. I have a pointer to it, I've passed that pointer by reference to another function. Now I don't know how to write / read from the vector, if I'm right to expect it to be able to adjust its size, etc. I also don't quite know what "->" is.
>>
>>55230162
All right, so you accept that you lost this argument? Just say so so I can add it to my collection of internet arguments won.
>>
>>55230178
turboautist
a normal person would ask why but your autism didn't let you
>>
>>55230191
No, I saw that you had no valid arguments and insulted me (and therefore didn't feel the need to humor you for it), but I still need a written confirmation that I won this argument so I can document it, preferably before this thread 404s.
>>
>>55229982
why are you trying to erase the pointer and then delete it. it doesnt work that way, you are just leaking memory.
>>
>>55230204
I did not insult you, I simply stated a fact. (the fact that you are an autist)

>I saw that you had no valid arguments
Then you can't see well, I linked you to my argument above.
>>
>>55230126
>>55230219
What should I be doing instead?
>>
>>55230234
>I simply stated a fact. (the fact that you are an autist)
Fact or not, your post's negative tone makes it an insult.

>I linked you to my argument above.
Where? I still don't see a definition of domain specific language from a reputable source that claims that they're, using your words "shit".

The only thing you've done so far is make an ass out of yourself. Just say "You win this argument" and your misery will be over.
>>
>>55230256
delete pointers first, then remove it all from the vector.
for (auto &i : Q1CP)
delete i;
Q1CP.clear();


or use unique_ptrs so you dont delete things manually.
just removing it from the vector will do that for you so you can just call
Q1CP.clear()
>>
>>55230263
>Fact or not, your post's negative tone makes it an insult.
I do not think that calling someone an autist is in negative tone but instead simply informing them of their behaviour.
Moreover I find what you are saying as weird since I found >>55230178 and >>55230204 really insulting.

>Where?
Above

>I still don't see a definition of domain specific language from a reputable source that claims that they're, using your words "shit".
This is absolutely irrelevant to the current topic. Especially considering that you did not ask me about it in the previous post.

>The only thing you've done so far is make an ass out of yourself
Wow, this is truly insulting. Don't talk to me anymore ever!
>>
>>55230077
I'll take that as a compliment.
Its actually written in GML which is very similar to Java. I looked it up and I see what you mean, the logos do look very similar but the on in my gif is the default GameMaker:Studio icon.
>>
>>55230311
>for (auto &i : Q1CP)
> delete i;
>Q1CP.clear();

Don't think that's working. My memory usage isn't going down.
>>
File: 1459500980027.jpg (33 KB, 493x276) Image search: [Google]
1459500980027.jpg
33 KB, 493x276
>>55229013
Nice stack bloat there buddy! And you managed to pass the element by value recursively too! Bravo!

Maybe next time just use a fucking loop.
>>
>>55230175
pls halp
Scanning through Bjarne's book, but to no avail.
>>
>>55229113
Use rng to "flip a coin" to decide whether to generate a number in a range smaller than the number or a range larger than the number.
>>
Is the C Programming Language 2nd edition book still relevant?
>>
>>55230808
yes
>>
>>55230929
Cool. I'm going to make C my first programming language. It's going to be fun.
>>
File: banana.png (818 KB, 780x582) Image search: [Google]
banana.png
818 KB, 780x582
>mfw realizing that an anonymous inner class is a superior abstraction over lambda expressions

Java is king
>>
>>55230808
It teaches C89, which is an older C standard. However, the differences between C89, C99 and C11 aren't massive and you could pick most of that shit up from the wikipedia articles. K&R will teach you most of what you need to know.
>>
>Wasted days of work trying to write a script for work that does what would have taken ~2hrs if I just did it the dumb way
>now i'm down to the deadline and the script still doesn't work
>>
>>55231106
>>/pol/
>>
>>55226695
>learning fizzbuzz
It's literally high-school tier easy shit.
>>
recompiled an apk using advanced apk tool. Keep getting
"syntax of command is incorrect"

it worked a month ago. now its not.
>>
Something something programming
>those goddamn Scots
>>
File: temp.png (925 KB, 832x478) Image search: [Google]
temp.png
925 KB, 832x478
this guy kinda resembles bjarne
>>
>>55231559
don't fall for the jewish establishment propaganda, the economic effects of a brexit wouldn't be that bad at all
>>
File: 1460593249353.jpg (27 KB, 256x256) Image search: [Google]
1460593249353.jpg
27 KB, 256x256
> the language is ironically typed
>>
>>55231579
we'll have to see, wont we?

>>55231573
shut up
>>
>>55231579
The jews want you to leave m8
>>
>>55230574
>>55230175

use a debugger and learn to use it
>>
>>55231603
???
>>
>>55231618
How will this make me understand the language semantics?

I don't understand how to interact with the pointer returned by new when it comes to more complicated containers.
>>
Ruby, not sure if you're still planning on making a functional language backend, but this will probably be of interest to you if you are: https://github.com/stedolan/malfunction/blob/master/docs/spec.md.
anyways, this shit is kinda cool and im probably gonna make some language that compiles to it since it looks super simple to target anyways
>>
File: ok.png (65 KB, 355x328) Image search: [Google]
ok.png
65 KB, 355x328
>>55231623
>all of these shitty appeals to emotion
>>
>>55228001
You might want to think about another way to show the connections. What you have is pretty cool, but would quickly get annoying if you had to wait for it for the entirety of a game.
>>
>>55231618
don't ever use a debugger especially not for this purpose that's a preposterous idea
>>
>>55231664
>Thinks I'm making an argument
>Thinks I'd derive any value from engaging in substantive and meaningful dialogue with your sort on any topic whatsoever
>>
>>55230175
>I also don't quite know what "->" is.
sounds like you should learn the basics.
>>
my job is making me choose /dpt/, I have to use one of these three languages running on the JVM

>Groovy
>JS (doesn't have access to most js methods but can load js files from url)
>Python

We do AI shit. What do?
>>
>>55228960
Recursion in C should really only be used for things that you can't be added to do a better way. Lists seem to be a high use datastructures, so you might want to optimize it. Especially since your method will fail for long lists or lists with large elements.
>>
>>55231745
Python
>>
>>55231756
you sure? This job uses a lot of regex an python sucks at it
>>
>>55231745
all
shit

Go with JS or Python

>>55231785
most "modern" languages with regex suck.
>>
>>55231701
okay buddy, have a good evening :^)
>>
>>55231720
I just looked it up by calling it an arrow in a search.

I'll have to think about it. I don't understand why the . operator can't just do the right thing. The compiler knows the underlying type, and that it's a pointer. Well anyway, that's pieced in.
>>
>>55231814
Probably not, but thanks.
You too anon.
>>
>>55231813
>JS
>Python
>modern languages
nigga what kinda shit u on, better get me on some of that
>>
>>55231813
python is the only "modern" language that still has to compile regular expressions
>>
>>55231919
compiling regexes is literally a good thing
>>
If Ada is so great, how come it isn't popular?
Also: Verilog or VHDL?
>>
>>55231831
it's a remnant from shitty C
>>
>>55231930
This
>>
>>55231919
>Compiling regexes into very efficient state machines is a bad thing

And it's all about the moderate climates, you want to be cold and be hot, for sure. And it's all about the moderate climates, you want to be blessed, and be cursed, for sure.
>>
>>55231970
>pyturd
>very efficient
kek
>>
>>55231953
it's not great, it's horribly verbose and redundant, plus often misses the point when it comes to code safety (which is why so many government projects end up miserably). but anyways, good languages never become popular. quoting Bjarne Stroustrup: "There are two kinds of languages: those that people complain about, and those that people use"
>>
recompiled an apk using advanced apk tool. Keep getting
"syntax of command is incorrect"

it worked a month ago. now its not.
>>
>>55231930
how exactly is it efficient? It takes more time to type out and I don't see how it helps where speed is concerned
>>
File: 1461100247077.png (1 MB, 1066x800) Image search: [Google]
1461100247077.png
1 MB, 1066x800
>>55231584

> tfw the language is secretly typed
>>
>>55232047
https://en.wikipedia.org/wiki/Finite-state_machine
>>
>>55232047
the hell are you smoking?
>>
>>55232047
? how does it take more time to type out a compiled regex? they should be exactly the same...
anyways, regexes are really slow when interpreted and can be compiled into parsers, essentially, which will perform much better since the code is already there instead of having to keep going through the regex over and over directly and evaluating it at run-time
>>
>>55232080
Even C++ compiles regexes at runtime.
>>
>>55232093
>compiles at runtime
different than interpreting them (what you're describing is JIT compilation). anyways, C++ can do it other ways too (constexprs can probably be used to compile the regexes beforehand) and lots of fast languages do this (Rust, etc.).
>>
>>55232108
I know. Obviously.
>>

def foo():
def bar():
print 'hello'



how to print hello with this code?

foo().bar() ?
>>
>>55232160
I'd imagine you could probably only call it from inside foo()
>>
>>55231831
because that would make it harder to differentiate between pointers to structs and actual structs
>>
>>55232093
>>55232108
Implementations do this, not languages.
Faggot
>>
>>55232160

you would have to call it inside of foo and then call foo

only a class would have a function called like that.
>>
>>55232279
Okay, you got me. It's actually the STL and not the core C++ language.

By golly by gosh the fool I was not being more explicit.
>>
>>55232307
>It's actually the STL
No, implementations of the STL.
>>
>>55232318
The STL is part of the C++ standard. Conforming compilers have to include a functionally equivalent version, at least as far as behavior, interfaces, and guarantees.

eg, if the flag to spend more time optimizing regex compilation is omitted, your implementation of the STL is no longer standard conforming.
>>
>>55232318
the "library" of "standard template library" implies that it is the implementation.
>>
>>55232363
No, not at all. This is the most retarded thing I heard today.

>>55232346
>Conforming compilers have to include a functionally equivalent version, at least as far as behavior, interfaces, and guarantees.
Exactly

>eg, if the flag to spend more time optimizing regex compilation is omitted, your implementation of the STL is no longer standard conforming.
I am not aware of any flag that gives the command to the implementation to compile the regexes. But even if it existed and the implementation ignored it it would still be standard conforming.
>>
recompiled an apk using advanced apk tool. Keep getting
"syntax of command is incorrect"

it worked a month ago. now its not.
>>
>>55232387
>I am not aware of any flag that gives the command to the implementation to compile the regexes.
If you use the STL regex deal, to my knowledge they're always compiled at runtime. The optimization flag just has it better optimize that compilation, which might be worth the cycles if you're going to be search a very large dataset.
>>
>>55232418
>to my knowledge they're always compiled at runtime
Not guaranteed by the standard, it depends on the implementation.

> The optimization flag just has it better optimize that compilation, which might be worth the cycles if you're going to be search a very large dataset.
The optimization flag is just a hint to the implementation and is not guaranteed to do anything.
>>
File: 1451337320315.jpg (25 KB, 400x386) Image search: [Google]
1451337320315.jpg
25 KB, 400x386
O U T
U
T
>>
What's hap'nin /dpt/?


Nth for Wales
>>
>>55232807
>>55232944

The sun rises over an independent UK.
>>
>>55232997
Get cancer
>>
>>55233007
kys
>>
>>55233011
nice meme faglord
>>
>>55233098
EU is the meme, fag
>>
>>55233007
Not funny or clever.
>>
>>55233127
It's not supposed to be funny.

>>55233124
Nice ignorance, kike.
>>
File: Programming Shelves.png (952 KB, 2100x1400) Image search: [Google]
Programming Shelves.png
952 KB, 2100x1400
What's the best programming language and why is it Excel formulas?


>>55233007 >>55233011 >>55233098
>>55233124 >>55233127 >>55233148
>>>/b/
>>
>>55233148
you're fucking retarded, EU is pushing the jew agenda with the banking and mass immigration and race mixing etc, you've gotten this completely wrong, you have no reasoning for why the jews in the establishment would want people to leave the EU
>>
>>55233160
Scheme

>>55233164
Nice try kike.
>>
>>55233148
>It's not supposed to be funny.
Cancer sucks.
>>
>>55233176
not sure if trolling or just retarded

you're not saying much useful by just calling people kikes
>>
>>55233180
I wouldn't use it if it din't.

>>55233183
Either are you by memeing.
>>
>>55233190
*Neither
*didn't
I need to sleep.
>>
>>55233190
fuck off and die idiot, the EU is fucking cancer and anyone with a brain can see it, the leave side had a large majority outside of londonistan and scotland
>>
>>55233210
And the leave side was fucking stupid. No wonder why the Scottish people are liked everywhere in the world unlike the English.
>>
>>55233225
stay delusional queer
>>
>>55233226
Kill yourself carposter.
You are either a retarded American Trump supporter or a faggot and even more retarded Englishfag.
>>
>>55233255
lmfao stay buttmad fucking faggot spic

we got brexit

hopefully we can also get these:
>austrian re-election because election fraud/"mistakes"
>other countries follow suit in leaving the EU
>donald trump becomes the US president
>EU gets dissolved
>countries implement concentration camps to deal with illegal immigrants
>SJWs BTFO

feels good :)
>>
>>55233269
>spic
I am more European/White than you will ever be.

>donald trump becomes the US president
So, you admit being a homosexual normalfag. Why do you support NSA spying and the end of the individual freedom?
>>
>>55233291
you're either doing some very weak troll or you're really this stupid

you think shillary is better than trump for non-fags in any way?
>>
>>55233304
>you think shillary is better than trump for non-fags in any way?
Didn't imply that in any way.

>image
I know for a fact that many of these parties are by and for faggots. (not all of them though, at least one of these is actually good)

But you still did not reply to my question, Why do you support NSA spying anon?
>>
>>55233323
in the US, the only likely candidates that should be considered are trump or shillary, you have no other options unless something really surprising comes up which you have no reason to expect

and you're a fucking idiot, just calling the wrong people kikes and faggots, i'm done wasting my time on you
>>
>>55233333
Why do you keep refusing to reply to my one and only question? Maybe because you are an NSA shill?
>>
>>55233333

I feel as though these quints need to be checked, Anon.
>>
>>55230968
y tho
>>
>>55230968
tard
>>
>>55230968
1/10 Nobody is that retarded.
>>
>>55230968
>>superior abstraction
They're different things.
>>
File: floop.jpg (151 KB, 509x347) Image search: [Google]
floop.jpg
151 KB, 509x347
I'm back about my earlier post >>55229044

I've gotten to this spot in my program and at a complete loss.

        int[][] rowsByColumns = new int[12][6];
Random tileType = new Random();
int cnt = 0;
for (int i = 0; i < 12; i++)
{
for (int j = 0; j < 6; j++)
{
if (cnt == 0 || cnt == 1 || cnt == 6 || cnt == 7)
{
rowsByColumns[i][j] = tileType.nextInt(5);
}
else if (cnt != 0 || cnt != 1 || cnt != 6 || cnt != 7)
{
rowsByColumns[i][j] = tileType.nextInt(5);
if (rowsByColumns[i][j] == rowsByColumns[i-1][j] && rowsByColumns[i][j] == rowsByColumns[i-2][j])
{
while (rowsByColumns[i][j] == rowsByColumns[i-1][j] && rowsByColumns[i][j] == rowsByColumns[i-1][j])
{
rowsByColumns[i][j] = tileType.nextInt(5);
}
}

}
cnt++;
}
}


I have a 6 column by 12 row 2d array. I generate values from 0-5 (6 possible values) and assign them to each spot in the 2d array reading values in from left to right and top to bottom.

the first 2 rows ignore the [0][0], [0][1], [1][0], and [1][1] spots

a visual of this:
x x o o o o
x x o o o o

x being the ignored spots in the 2d array. They can be any number generated from 0-5.

The thing I want though is when it reaches one of the o's, I want it to randomly assign a number from 0-5 and then check what the two values to the left of it are. If the two x's are the same randomly generated value, it will reroll the o's value until it does NOT equal the two to the left of it.

Basically while it generates the numbers for each spot in the array I do not want 3 in a row horizontally. That is not allowed. It must reroll the value until it is different.

Can anyone spot why I'm getting an array out of bounds -1 when I start doing stuff like this rowsByColumns[i-1]
>>
Working on some GUI programming with Tkinter.
And it's ok...
Documentation is spotty but the library also seems sort of intuitive.
>>
>>55233457
Little paste error on
while (rowsByColumns[i][j] == rowsByColumns[i-1][j] && rowsByColumns[i][j] == rowsByColumns[i-1][j])
the last rowsByColumns[i-1] should be i-2.
>>
>>55233457
>
                    rowsByColumns[i][j] = tileType.nextInt(5);
if (rowsByColumns[i][j] == rowsByColumns[i-1][j] && rowsByColumns[i][j] == rowsByColumns[i-2][j])
{
while (rowsByColumns[i][j] == rowsByColumns[i-1][j] && rowsByColumns[i][j] == rowsByColumns[i-1][j])
{
rowsByColumns[i][j] = tileType.nextInt(5);
}
}

that outer if is pointless. you should use a do while() loop;
do {
rowsByColumns[i][j] = tileType.nextInt(5);
} while(rowsByColumns[i][j] == rowsByColumns[i-1][j] && rowsByColumns[i][j] == rowsByColumns[i-2][j])


else if (cnt != 0 || cnt != 1 || cnt != 6 || cnt != 7)

is always true. just make it an else.
>>
>>55233333
>>55233352
Waiting
>>
>>55233537
That's nice and all but doesn't solve the out of bounds issue
>>
>>55233537
also you could stick the first if into the while because it always calls nextInt.

>>55233572
thats because there was no checks to prevent that,
im guessing thats what cnt was trying to do, but it wasnt being reset and is just pointless. just use i instead

anyway the inner for loop should be
do {
rowsByColumns[i][j] = tileType.nextInt(5);
} while(
i >= 2 &&
rowsByColumns[i][j] == rowsByColumns[i-1][j] &&
rowsByColumns[i][j] == rowsByColumns[i-2][j]
);
>>
>>55233603
Well, cnt counts up to 72. 12x6 so there's 72 total numbers that need to be generated.

cnt is there to check for the first 2 spots in the first two rows. In the third row and all the way up to the last 12th row I want to be checking the two tiles above each spot to make sure there's no vertical 3-in-a-rows too.

x x o o o o
x x o o o o
p p i i i i

there's the entire board. x's are ignored and can be any generated value from 0-5. the o's in the first two rows with the x's will begin checking what the two blocks to the left of them are. If they are identical, this value must be rolled until it is NOT the same as the identical ones next to it.

Now, p's only check the two above them. i's check to the left of them AND on top of them.

I feel like I'm misunderstanding the layout of a 2d array or something.
>>
>>55233749
then you just check both ways, and check i/j if it will go out of bounds.
do {
rowsByColumns[i][j] = tileType.nextInt(5);
} while(
(i >= 2 &&
rowsByColumns[i][j] == rowsByColumns[i-1][j] &&
rowsByColumns[i][j] == rowsByColumns[i-2][j]) ||
(j >= 2 &&
rowsByColumns[i][j] == rowsByColumns[i][j-1] &&
rowsByColumns[i][j] == rowsByColumns[i][j-2])
);
>>
>>55233749
This is my understanding of 2d arrays.

if rowsByColumns is a [12][6] 2d array, you have this as a board to store values.

([0][0])([0][1])([0][2])([0][3])([0][4])([0][5])
([1][0])([1][1])... etc

is this right? is my double for loop incorrect with it's variables?
>>
>>55233774
that seems to have completely fixed the horizontal and vetical 3-in-a-rows from happening.

I really appreciate it, but may I ask for an explanation of what this snippet of code means?

still trying to wrap my head around modifying the spots in a 2d array using variables i and j
>>
File: in_the_rain_by_keapt.jpg (83 KB, 750x375) Image search: [Google]
in_the_rain_by_keapt.jpg
83 KB, 750x375
I need to make the jump to regular basic C programming and Data Structures programming. But I just can't begin, /g/. I need to be ready for an examn in a week. All the way from stacks to linked lists to trees and I know nothing.

I want to cry.
>>
>>55233878
to make the jump from regular C programming to Data Structures programming*

Jesus, I can't even properly write.
>>
>>55233333
Still waiting
>>
>>55226574
why do some game engines have their own languages? They're almost always shit. why not use lua, python, lisp, ...?
>>
>>55233966
>lua, python
Both shit

>lisp
Best solution
>>
>>55233972
>lua
>shit
>>
>>55233859
it just checks for 3 in a row/column and regenerates the number as long as there is one.

and i/j are just coordinates in a 2d array.
  0 1 2
0 a b c
1 d e f
2 g h i

arr[0][0] == a;
arr[1][0] == b;
arr[0][2] == g;
>>
>>55233980
Yes, it's fucking shit.
>>
Why is Java for the trash?
>>
Dudes, I need some help. I have this:

<div><img src="" /><p>0</p></div>

Every time I click on the div, I need to add 1 on p. One click = 1, two clicks = 2, something like that. I'm doing it with js, but I think my code is pretty shitty.


var ECONTADOR= contador.getElementsByTagName('div');
for(var i = 0; i < ECONTADOR.length; i++)
{
ECONTADOR[i].getElementsByTagName('img')[0].onclick = suma;
}

function suma()
{
d.getElementByTagName(img).getElementsByTagName('p')[1].innerHTML++;
}
>>
File: vcxccx.jpg (8 KB, 241x172) Image search: [Google]
vcxccx.jpg
8 KB, 241x172
>>55234023
It's 3 am, my brain doesn't work anymore.
Thread replies: 255
Thread images: 30

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.