[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: 31
File: 2343435435453.png (593 KB, 950x1335) Image search: [Google]
2343435435453.png
593 KB, 950x1335
Old thread at >>51675104

What are you working on, /g/?
>>
anime
>>
File: itsopen.webm (2 MB, 640x640) Image search: [Google]
itsopen.webm
2 MB, 640x640
Ask your beloved programming literate anything.
>>
>>51680301
What's the best book to learn java?
>>
>>51680337
introduction to java ,9 for swing and awt ,10 for java fx.
>>
Every daily programming thread is more of a help me program kind of thread
>>
>>51680061
data mining

just built this PC that I'm on, first time building a pc. Hard as fuck.

final exams soon

hope to learn gpu coding by the end of January
>>
Daily reminder that xcode is to be bashed, OSX coders to be shamed, swift to be burned and objectiveC to be trashed.
>>
I don't understand why at the beginning of the recent American shooting people elsewhere were often posting "Just call it terrorism, that's what it is" and now the same places are posting "It's workplace violence. Don't be so quick to call terrorism".

Can some Ameriburger explain this?
>>
im working on a little enigma machine inspired prog to mess around with my friends
one of them suggested that it should encode/decode the message as you type it and that works pretty well now
only problem is that i wrote it very inefficiently and it starts to lag whenever the character count is above 15 or so

https://drive.google.com/file/d/0B-NiVsIcXFqtM2NjWGJkQmhfSjA/view?usp=sharing

(add root.mainloop() at the end and change it to .pyw)
>>
>>51680451
how is this tech related
let alone programming reated
>>
How would you implement a binary tree with an array (or some other structure that allows for locality) with the assumption that it probably isn't a complete binary tree and more levels of nodes can be added?

Been obsessed with locality lately after reading this one article.
>>
File: treearray.png (37 KB, 643x369) Image search: [Google]
treearray.png
37 KB, 643x369
>>51680554
>>
>>51680562
what if a node has only one descendant
>>
>>51680451
not an ameriburger but it is terrorism. it's war against americans and western culture. muslims shooting up a christmas party... sounds like a normal thing to do in a workplace to you?! people are so clueless about what it means to be a muslim. these people are primitive savage beasts who are on a mission to spread their retarded religion. they think they're "winning" by breeding lots of children... white people don't care, it's not a competition for fuck's sake, it's perfectly fine to have 0-2 kids so the family can have a much higher standard of living than their fucking third-world shit holes.
>>
>>51680562
but that's a complete tree.
what if there's, lets say, no 5 node.
>>
>>51680596
Set it to some sentinel value indicating that it's not valid.
Maybe INT_MIN.
>>
>>51680485
I only go on these threads so I post what I want because they're my home threads
>>
>>51680606
they you let the array slot empty
>>
>>51680633
that implies references or pointers which im trying to avoid for locality
>>
File: 1448380553493.jpg (203 KB, 900x506) Image search: [Google]
1448380553493.jpg
203 KB, 900x506
>>51680601
and as for why people are toning it down... they want the same thing to happen to burgerstan as what is happening to europe. please vote for trump, it's your only hope.
>>
>>51680646
Realistically, you'll want your binary tree to be balanced, meaning that you won't have any "gaps" in your array.
>>
>>51680451
The ones incite the calls for terrorism are likely a part of a culture that needs it revered as such. Likely the families of military personnel. The others are just people that can assimilate information without the need for it be structured for them so that they can just accept it as it is without ever "analysing" the info as it's processed.

I used to live in that city that the shootings occurred. The people there aren't exactly nice. Especially not to non-hispanics or non-whites and there are a lot of veterans in the area too. I wouldn't doubt it was all incited by micro-aggressions after all of it just went a tad bit too far. You've got to understand that all the rules and regulations are connected. There is a reason military veterans are cited explicitly in the Equal Opportunity Employment guidelines.

Maybe the 2 middle eastern folk that are being mentioned in the news were persecuted and couldn't think of anything else to do to make themselves feel like proper parents. Maybe they weren't being persecuted and they happened to be part of a sleeper cell or something. Maybe none of it really happened. Who's to know really?
>>
>>51680646
it's an array of nodes, not an array of integers. also, have you ever heard about optional types ? i mean, common, we can't hold you hand forever. try to find a solution by yourself some time.

https://en.wikipedia.org/wiki/Option_type
>>
bet you morans can't even explain what this does

#include <iostream>
using namespace std;
typedef int* IntArrayPtr;

void function1(int *m, int i, int d2)
{
for (int j=0; j< d2; j++)
m[j] = i+j;
}

void function2(int *m, int d2)
{
for(int j=0; j<d2; j++)
cout << m[j] << " ";
cout << endl;
}

int main()
{
int d1 = 3;
int d2 = 4;

IntArrayPtr *m = new IntArrayPtr[d1];

for(int i=0; i<d1; i++)
m[i] = new int[d2];

for(int i=0; i<d1; i++)
function1(m[i], i, d2);

for(int i=0; i<d1; i++)
function2(m[i],d2);

for(int i=0; i < d1; i++)
delete[] m[i];

delete[] m;

return 0;
}
>>
>>51680672
Do your own homework.
>>
>>51680672
at least i can spell moron
moron
>>
>>51680685
Should have taken a few of them out
>>
bash -c "$(xxd -r -p <<< "626173653634202d64203c3c3c20226545513d223b206563686f0a")"


:DD
>>
>>51680646
So then you just create a new array that is size+1, store the old array up to your node in the new one, add your new node and finish adding the other array.

Locality's sake sounds like a terrible reason to use so much memory so redundantly. I'm not trying to dissuade you from whatever it is you're trying to learn but it really sounds like you aren't aware of what's happening in the background yet so I'll leave you to it. Maybe you could time your processes and then compare afterwards?
>>
>>51680668
Err I meant to say that the others can assimilate info without the need for it be structured for them so that DON'T ever just accept it .... yadda yadda.

The distinction there is pretty much "Murrica" and educated folk.
>>
>>51680688
pretty sure he did that on purpose, anon...
>>
>>51680728
bait is evolving
>>
>>51680672
it creates and displays a 3d array of integers?
>>
>>51680672
>>51680688
https://www.youtube.com/watch?v=C_Kh7nLplWo
>>
I'm designing a particle simulator.

Assuming no air resistance, and a surface has no friction, would a ball bouncing on said object bounce forever?

>0 frict, 0 air, medium gravity
Ball bounces seven times.
>0 frict, 0 air, high gravity
Ball bounces four times.
>0 frict, 0 air, low gravity
>Ball bounces forever.

Does the last bit make sense?
>>
>>51680826
it should only bounce forever if there is no gravity but at that point its not really bouncing, just floating
>>
File: 1448474986516.jpg (16 KB, 225x255) Image search: [Google]
1448474986516.jpg
16 KB, 225x255
>>51680668
>micro-aggressions
>>
>>51680061
Going through and looking at the Swift lexer. Pretty interesting stuff. https://github.com/apple/swift/blob/master/lib/Parse/Lexer.cpp
>>
>>51680844

If friction is 0, the ball bounces forever only when gravity is very small. I've designed friction as momentum lost when it hits the surface, and a bounce is just negation of speed.

I just don't know why it bounces forever only under low gravity: it should bounce forever under all gravity.
>>
>>51680845
They are really just picking apart a lot of asian stuff that is too "occult" to be treated as a problem.

It's a lot like when people agree to disagree with any particular individual. And why LTG still gets views somehow.
>>
>>51680865
>written in C++
>not swift or objective c
I guess even apple don't like those languages.
>>
>>51680868
If it's bouncing on a surface there's really no saying that the ball reverts to its original state before the force has been absorbed and released by the surface quick enough for the ball to carry it back up.
>>
>>51680844

https://www.youtube.com/watch?v=aKIdPP7kR0k&feature=youtu.be

Sorry for bad cropping, I don't know how to use OBS.

Second particle = low gravity, 0 friction. It bounces forever. Next is high gravity and it doesn't bounce forever.
>>
File: 1428407707492.png (350 KB, 975x820) Image search: [Google]
1428407707492.png
350 KB, 975x820
>>51680672
>
typedef int* IntArrayPtr;
>>
File: file.png (873 KB, 487x740) Image search: [Google]
file.png
873 KB, 487x740
>>51680879
IT JUST WERKS.
>>
>>51680895
maybe it just looks like its bouncing infinitely because the gravity is so low?
i have no clue, im spitballing ive never done physics simulation
>>
>>51680826
if there is no friction it should bounce forever regardless of the gravity. no friction means that there is no energy lost. you should be asking this in >>>/sci/sqt instead
>>
>>51680879
I guess they figured it'd be easier to write the front-end compiler in C++. The front-end compiler only generates LLVM IR anyway. LLVM takes care of the rest.
>>
>>51680845
wow can we not be racists here
>>
>>51680892
if the surface is completely rigid and doesn't move then the ball will retain all energy
>>
>>51680917
>I guess they figured it'd be easier to write the front-end compiler in C++.
Yeah, i guess so. That's doesn't say much for Swift though.

Swift is highly influenced from F#, a lot of people from the F# team were hired by Apple to work on Swift. The F# compiler for the record is written in F#. Also the C# compiler is in C#.
>>
>>51680895
are you using a physics engine? what does the code look like?
>>
>>51680959

I'm building one in OpenGL. Very rudimentary at this point and will likely never go beyond simple simulation. I'm just practicing C.
>>
>>51680672
it does nothing useful. and do your own homework
>>
>>51680943
I assume at some point someone will make a self compiling Swift compiler
>>
>>51680982
Will it be Apple though? They could have at least written in in objective-c and then ported it easily to Swift some day.
>>
>>51680966
it could be some programming mistake. like if you're not correctly accounting for the distance that the particle digs into the surface on the frame that it collides with the surface, then the particle will lose more height when gravity is higher since it moves faster with higher gravity and thus digs in deeper, increasing the rate of error accumulation
>>
>>51680928
so it's not bouncing?

gravity attracts the ball and the surface field repels it?
>>
>>51681022
see https://www.youtube.com/watch?v=PNHSIEO-KOQ

it's bouncing but no momentum gets transferred to the surface since the surface is perfectly rigid and non-moving so all the momentum involved has to remain in the ball
>>
>>51680892
there could be energy spent deforming the ball but if the ball is perfectly spherical and doesn't deform it will keep all its energy
>>
>>51681107
actually i dunno lol you should ask a physicist.

but to the anon who's programming the simulator, you should probably account for restitution too, i recall it being used in box2d too. a restitution of 1 means it's perfectly elastic (no momentum lost on each bounce) and 0 means perfectly inelastic (like a pancake splat)
>>
>>51681107
See what you said is what I was describing when I said the ball reverts to its original state but then the only way for it to never change shape is for it to never actually "touch" the surface and instead just interact with the field.

I made some ascii art to kind of show what I'm imagining:
                #####
###########
## ^ ##
## | ##
# | #
# | #
# | #
# ^ #
# O #
# | #
# | #
# | #
# | #
# | #
# | #
# | #
# | #
# | #
# | #
# | #
# | #
# | #
# | #
# | #
# O #
# v #
# | #
# | #
# v #
#O#
__________________#_____________


the # is the gravitational field, the O the ball the arrows on the ball showing where the ball goes and why it never actually touches the surface. It's "trapped" within the confines of that gravitational field's effect on space. So instead of colliding with the surface and then being pushed back out, the particles "splash" against the field which then causes the momentum to shift upward and then when the ball reaches "wing" of the gravitational field its velocity is not great enough to penetrate the field and instead gets pulled back down.

Sorta make sense?
>>
>>51680395
After a few builds u will b quite the master. But I did feel the way u do now.
>>
>>51681192
>>51681184

You guys are going way ahead of what I want to achieve lel

It's a very simple program, here's the gist:

>floor located at -15y
>cube spawned at 0,15,0
>cube initial speed is -0.1
>gravity adds 0.1 per cycle
>when it hits the floor with zero friction, speed = -speed (ie. the speed of impact vector is reversed so it climbs instead)
>>
>>51681192
on the quantum scale, the particles don't physically touch, it's just the fields interacting. not sure if that's what you mean though. i'm talking about a theoretical situation for anon's simulator where you have 0 friction and perfectly rigid bodies (1 restitution) and with the surface completely stationary. in real life you have friction and you don't have perfect elasticity
>>
>>51681237
when the ball bounces, it has probably moved into the surface, so you need to account for that. that's probably why the ball loses more height with higher gravity since it digs deeper into the surface on each bounce.
>>
>>51681237
Yeah but your logic is derived from particle interaction not some high level explanation of the effect as it was outlined by a simple sequence of functions to describe the ball's position at any particular time.
>>
at work so cant really test this shit right now, but what would be the more efficient operation using directx:

1 vertex buffer containing the base structure of an element that needs to drawn on screen dynamically at different locations
x number of draw calls (1 per element that needs to be drawn, all using the same vertex buffer but different matrices)
vs
1 vertex buffer which contains all the vertex points of all the gui elements that needs to be drawn (preprocessed instead of processed in the shader using matrices)
1 draw call, BUT but the vertexbuffer needs to be modified every frame

i guess this comes down to whether or not vertex rebuilding is more efficent than extra draw calls
>>
>>51681291

That's the thing, I have collision detection that prevents the ball from going into the ground. I'm working with numbers such that the position is never below the floor, even taking into consideration the radius of the particle.

I'm not yet to the point of elastic bodies or cloth floors or what you might think would affect this. It's a rigid floor, a rigid object, no compression or elasticity.

>>51681298

All I have coded thus far is gravity, air resistance, and friction of the floor and ball. My testing environment is only gravity at this point. No energy should be lost at the point of impact.
>>
>>51681273
That is what I mean. I'm trying to describe why the ball appears to be bouncing infinitely. It isn't actually bouncing, it is being repelled by the surface's field and then it is being repelled toward the source of the gravitational field, over and over.
>>
>>51681273
>you don't have perfect elasticity
i guess you do with small particles, not sure. again i'm not a physicist
>>
>>51681301
The first one on input and the second one on static draws...
>>
>>51680601
Wrong. Having less than two kids is detrimental for the future society as there's not enough working people to pay for pension.
>>
>>51680896
Please explain what is wrong with that.
>>
>>51680927
wow I so agree this was supposed to be my safe space but now I am so triggered. Next time they should atleast post "triggerwarning"
>>
>>51681192
>I made some ascii art to kind of show what I'm imagining:
your imagining a pussy?
>>
>>51681377
Everything.
Literally everything is wrong with it.
>>
>>51681448
>this is wrong
>why
>because it's wrong

k
>>
>>51681412
You have to be 18 to post on this board.
>>
File: 1448444442113.png (132 KB, 295x242) Image search: [Google]
1448444442113.png
132 KB, 295x242
>>51681237

Here's a new video with better cropping, perspective, as well as directional vectors.

https://www.youtube.com/watch?v=9yFTacgsSXA
>>
>>51681516
you have to be a programmer to not understand that you drew a vagina.
>>
>>51681361
many jobs will get automated and many countries have a high rate of unemployment. it's often very difficult as it is for young people to find employment. if you take in quality immigrants, sure, they can be beneficial for the country. but taking in limitless numbers of literal human garbage calling themselves "refugees" for "muh humanitarian" reasons... with no passports, or fake passports, people who are straight up your enemy... it will cause a lot more harm than good to the future society.
>>
>>51681412
kek
>>
>>51681591
also, most of these "refugees" are men. if you want more kids, and perhaps a bit less rape, you should be taking in women too.
>>
>>51681192
l-lewd
censor that ascii bussy
>>
>>51680646
>that implies references or pointers which im trying to avoid for locality
This sounds like bullshit.

You will get nowhere without using pointers in machine code.
>>
>>51681538

Is this easy to program? Looks cool.
>>
>>51681709

It's pretty straight forward. I've invested maybe two hours on it. I'm not good at physics so it'd likely take others less time. I only began learning C last week, so it's good practice.
>>
I don't program enough to earn the lexicon of a full time programmer, so excuse me for my ignorance.

I know what a macro is in the definition that it is
>Something which allows someone to define a set of keystrokes to be input, so that they may be executed at any time without having to input them manually usually for convenience and time saving

but what is a macro in the scope of programming? Is it a function? Something like a function?
>>
>>51681551
If that's what you're vagina looks like, no wonder you're always projecting it onto other things...

Also, that wasn't me. This is me. And I just made one of those waves you see popping out of the sun that also happen to hold some of the plasma in palce during bursts. And then I drew a ball stuck between that and the surface.

Are you with the army? I can't imagine the other agencies would come up with that kind of response.
>>
>>51681815
It's a text substition in languages like C.
>>
>>51681823
so somewhat like how #include works? It just replaces the keyword with a selection of text?
>>
>>51681835
Yep, except that optionally you can also pass arguments along.
>>
>>51681815
It could be a function but considering that you can still define a shit ton of variables within a function and still not manage to use them... a macro might also be a variable.

And then a function would be a macro for existing macros , in that the variables would be treated as single calls and a macro of them would utilize them to amount to something more meaningful.


I believe this week the feminists and V girls are working on lexicon, so I think that's as much as you get out of me today.
>>
>>51681815
>>51681869

Oh shit, you meant like a macro as it's used in C. It's what >>51681823 said. Though my reply still kind of fits.

Macros, unlike the other parts of your code to be compiled, though, only replace text. They are not meaningful between the linking process and the static read. That means that when you compile code for your C program, the compiler reads in the macros and places them on a separate layer made specifically for macros, then it reads in the code as it normally would. Then when it finds that you've called your macros it applies the rules you've put in place for it aaaaaand then runs it at C code which then prompts your macro to output according to your rule. It's like when you are speaking to someone and then mention something rather new by using "quotation marks" as a gesture. FIRE THE "LASER" BEAM.. Please stop using sonic weapons on children.
>>
Alright, I started working on accessing screen memory in my linux build by using c++ to call the xlib functions. Hope that by tomorrow I have something to show for it. I'm going to sleep now.

Night /dpt/
>>
File: 1445133759360.jpg (144 KB, 708x664) Image search: [Google]
1445133759360.jpg
144 KB, 708x664
>tfw you keep coming up with new features and improvements
>tfw you will never finish your project
>>
Can any anons help?
if you have:
void function(x/y)
what is the x/y doing? as in what purpose does putting something inside those brackets serve?
>>
>>51682187
Really now?
>>
>>51682187
it's like if you have a math function f(x) = y

you give the function some input and it uses that for some calculation or whatever
>>
>>51682187
?!
This some basic shit tbqh.
<return type><function name><arguments it takes>
say you have:
int sum (int a, int b) {
return a+b;
}

and you pass
int butts = sum(1,6)

butts now holds 7.
>>
>>51682208
>>51682207
>>51682207
Apologies for incredibly basic question, couldn't find the answer on google and im just trying to start to learn how to program my arduino.
Thanks very much for the help though
>>
>>51682208
>sum(INT_MAX, 1)
ishyggydiggy
>>
>>51682251
If he doesn't know what a function is, I don't think I need to explain exception handling.
>>
>>51682259
>C
>exception handling
m8...
>>
>>51682345
Go look up the definition for "exception", print it out, pound it up your ass.
>>
>>51682236
Get a random programming book if you have trouble with such basic things. You can also google for a language specification document
>>
>>51680826
With 0 air resistance and no friction, a ball would bounce forever. The amount of gravity would determine the peak (max height) of the trajectory.
>>
>>51682129
just freeze the code.
Put the keyboard down. Just do it.
Bugfix and release what you have.
Then, add more features.
>>
My Algorithms final project is on "machine learning" which was introduced to us by a bunch of TED talk scifi buzzword videos. I get the rubric and all I have to do is program a bot that plays Blackjack...
>>
>>51682639
grab one of the trendy neural network papers and make it fun
>>
I'd like to search an array for a set of the four individual characters, and return the earliest position any of those characters can be found.

Say the set of characters is ("+", "-", "*", "/"), I'd like to find the earliest position in the string "abc+d/ss*" any of those characters could be found - so that would be index number 3, as "+" is located there.

I'm trying to do this in Javascript - is there any native methods that could do this? Would regex work in this context?

Any help would be greatly appreciated bros
>>
>>51682719
Er I guess you could do something like...
char *characters_you_want_found = "+-*/";
char *yourstring = "abc+d/ss*";
for (int i=0; i<strlen(yourstring); i++) {
for (int j=0; j<strlen(characters_you_want_found); j++) {
if (yourstring[i] == characters_you_want_found[j]) {
printf("Found at index: %d\n", i);
}
}
}
>>
what do you people think about Swift?
>>
>>51680451
Republicans
>>
>>51682826
It looks pretty good to me.
>>
>>51682719
>>51682773
...
http://www.w3schools.com/jsref/jsref_indexof.asp
>>
>>51681591
Do you know how many refugees the US has excepted since 9/11? And How NONE of them have committed any terrorist crimes?
>>
>>51680451
>tfw you're american and literally eating a burger right now
Not even mad, burgers are fucking awesome.
>>
>>51680601
>not an ameriburger but it is terrorism. it's war against americans and western culture
that's why they attack one each other? it's why they don't even touch israel, and it's the reason they want to make a bigger muslim state?

fucking hypocrite retard, do you even know how your own state/government was created?
>>
File: TEdhugu.png (470 KB, 2190x1376) Image search: [Google]
TEdhugu.png
470 KB, 2190x1376
>>51682826
Pretty good, I've been using for a little over a year. It's evolved really quickly. I'm compiling the compiler right now
>>
>>51682978
which distro is this
>>
>>51682923
I'm using indexOf to do so, but it only accepts one item at a time but:

>>51682773
a for loop might do the trick.

Thanks for the help dudes
>>
>>51682992
OS X, I haven't tried compiling on linux
>>
>>51682826
It looks cool but I don't use anything in the Apple environment. If they do a good job with the Windows and Linux port I'll take a look at it.
>>
>>51682993
foreach loop with a dictionary if you want to just reference the characters by name afterwards
>>
>>51680301
see, dogs are retarded
>>
I'm trying to have my method
public static void xmlModuleInfoGenerate()
run when a button on my form is pressed.

I'm trying also to pull the name of a textbox from the main form as well so I can use it's value

if i use
public static void xmlModuleInfoGenerate(MainForm formInfo)
I can get the value over, but I can no longer seem to call it because I can't pass that argument.
>>
>>51682826
My opinion will be correlated with the support for it in Visual Studio.
>>
>>51683051
You're passing a string to a MainForm object?
>>
>>51680061
java:

what's the difference between static and non-static ?

I cant grasp the concept behind this
>>
>>51682826
>>51682914
>>51682978
>>51683016
>>51683055
what do you think about Go?
>>
>>51683079
Pretty good looking language that has no real world practical application.
>>
>>51683079
No Intellisense in VS/10
>>
>>51683095
There is is the latest VS Code afaik... i might be mistaken. But Go support there looks impressive.
>>
>>51683068
public static void xmlModuleInfoGenerate(MainForm formInfo)
Is the method I want to call, within it I have a need for a variable contained within MainForm, so I used formInfo to call it.

But I then need in MainForm for this method to be run when a button is pressed, how do i make the method run when i can't pass the correct argument to it.
>>
>>51682923
I obviously don't know JS so I gave an example in a language I do know, in hopes he could convert it, or provide him with ideas.
...
>>
>>51683079
I highly enjoy Go and have been using it for over two years now.
I can hold this opinion and being interested in Swift at the same time without mental gymnastics.
>>
>>51683075
non-static: aka "instance", belongs to an instance of a class.

static: does not belong to an instance of a class.

public class Foo {
public int bar;
}

Foo foo1 = new Foo();
Foo foo2 = new Foo();
foo1.bar = 5;
foo2.bar = 10;

Each foo* is a new instance of the Foo class. Since bar is non-static, each foo* has their own bar field, so now foo1.bar == 5 and foo2.bar == 10.

public class Foo {
public static int bar;
}

Foo foo1 = new Foo();
Foo foo2 = new Foo();
foo1.bar = 5;
foo2.bar = 10;

bar here is static, so it always refers to the same one, Foo.bar. foo1.bar == 10 and foo2.bar == 10 because both foo1.bar and foo2.bar are the same variable.
>>
>>51683127
That's like me telling a C-fag to just use .Sort() or .CreateDirectory(x)
>>
>>51683140
I made a mistake. was hoping for someone to tell me "Go has no future, because google!" while telling me that Swift was the future... because Apple.
>>
>>51683161
You are truly an idiot.
>>
>>51683201
I'll shoot. Though Go has no future in spite of Google, it has no future because it's not very useful for much stuff, and takes a meaningful amount of time to learn to use effectively. Might as well use something decent like F# if you're going to be learning something very new. I'm sure Go will be around, but I never see it getting big.

Swift has a future not just because of Apple, but because it is kinda good. It will always have a presence on Apple devices. Maybe not anywhere else though.
>>
>>51683156
thanks a lot
>>
Okay so I asked a question poorly.

Let me ask the question better.

I have a method in a new class, I want within this method to pull the value of a textbox from another class, how do I do this in C#?
>>
>>51683312
>it has no future because it's not very useful for much stuff, and takes a meaningful amount of time to learn to use effectively
are you retarded or just pretending?

>It will always have a presence on Apple devices. Maybe not anywhere else though.
http://www.phoronix.com/scan.php?page=news_item&px=Apple-Swift-Open-Source
>>
>>51683498
>are you retarded or just pretending?
neither

>http://www.phoronix.com/scan.php?page=news_item&px=Apple-Swift-Open-Source
Yeah I know. Doesn't mean anyone else will use it for anything on other platforms. Could happen, I'm just a bit doubtful. A lot of the language is about covering up all the object-c shit that it's meant to be replacing.
>>
File: H0VZLqO.png (105 KB, 1170x620) Image search: [Google]
H0VZLqO.png
105 KB, 1170x620
>>51683556
It's also important to note that the Foundation they released as open source isn't complete yet.

So if you're on linux you'll have to wait a while for things like NSURLSession and NSRegularExpression.
>>
>>51683556
>neither
if there is anything about Go that users love about it, is that you can learn it fast, at least the basics. there is a shitload of documentation and guides.
also, not very useful... how? there are lots of companies using in their backends, and they love it because of the less resources it uses and the features it supports.

>inb4 erlang
sure thing m8
>>
>>51680337
>>51680352
The internet's the best book and it's never out of date.
>>
>Go
>interface{}
>>
Would it be really difficult to make a simply UI for ffmepg in visual studio? I am learning C# and I would like to do something like that as my first real program
>>
Working on a script to sort my images. How would I get it to send the filename to iqdb if I wanted to look it up in python?
>>
>>51683663
>is that you can learn it fast, at least the basics
Same thing for JS. But learning best practice for structuring a large project takes a lot longer. You can't simply take what you learned coding Java, C# or C use that here because Go has it's own special version of OO concepts and learning the right way to use all of them takes time for new programmers.

>there is a shitload of documentation and guides.
As most languages have.

>also, not very useful... how? there are lots of companies using in their backends, and they love it because of the less resources it uses and the features it supports.
It doesn't really have much of a use case. It's basically a significantly more productive version of C. Though not as productive as Java and C#, two extremely mature and popular languages with large highly talented labour pools. Go is faster them them, but not to a degree that is going to make a big real world difference. In reality a Go project is likely to be slower than a C# project because the company running the project had a much much smaller pool of talent to hire from, so the ones they did hire might not be nearly as suitable as the best C# coders they could have gotten. Because Go is less productive to work in, there's less project time for optimisations or adding more features. In this way the small speed benefit is easily completely wiped out so many factors: less mature tooling, smaller library ecosystem, smaller labour pool, generally less productive language than what's already popular.

Just wait a couple of years before a few prominent Go advocates write blog posts to the tone of: "Why we are no longer using Go". And they explain that over the past 5 years, even though they love using go and the speed benefits it provides, the issues i mentioned overwhelm the advantages, and instead they switch to a slower more productive languages instead. They'll probably switch to some meme language too, because anyone who adopts Go today has to be pretty naive.
>>
where have all the haskells gone
how many days have passed since fp has been shilled
>>
>>51683837
I'm right here.
>>
>>51683837
>F#
>>51683312
>>
>>51683861
>F#
>Funcional

this is bait right
>>
>>51683837
Haskell is completely useless, FP is a meme

if you unironically use either of these you should choose another profession
>>
>>51683876
What do you think it is?
>>
what is the point of try/catch blocks and exceptions when i can just (gdb) backtrace
it uglifies my code
>>
>>51683954
>2015
>hating monads
>hating monads in imperative code
>>
>>51683954
try/catch is meant for retards who can't into proper error handling.
>>
File: normiesunwanted.jpg (464 KB, 1131x1600) Image search: [Google]
normiesunwanted.jpg
464 KB, 1131x1600
>>51683837
contrary to FP haters, we are too busy to actually programming something, that's why we comment little.
>>
>>51683978
no idea what a monad is

>>51683979
Can I write C++ fine without every using them?
>>
>>51683991
come home functional man

haskell pride world wide
>>
>>51684002
You can disable exceptions with a compiler flag, though I'm not sure if that'll break libraries.
>>
>>51684002
>no idea what a monad is

a monoid in the category of endofunctors.
>>
>>51684017
you're doing this on purpose gtp
C didn't have all these crazy terms
>>
>>51684017
would i be right in saying a monoid is something that operates on functions, while an endofunctor returns a type in the the same set of types (e.g. some monad with type parameter T -> same monad with type parameter S)

i can't into monoids
>>
>>51684026
wait, wiki says monoids just map to other monoids and have a unit operation

what's the difference between them and endofunctors
>>
>>51683817
well, I'll assume you are right. I don't really have much experience with programming. still, I wish more people used Go, the basic stuff is already there and Go is, in general, very good, IMO.
>>
>>51684017

What is a monoid?
What are endofunctors?
>>
>>51684017
This is true, but in practice, monads are not necessarily monoids in functional programming because of categorical limitations. For example, you can't define a monoid in Haskell in terms of the monadic operations, because Hask is not a category of endofunctors.
>>
>>51684074
why do you care?

there's literally only one language that uses them, and you can't do anything with it.
>>
>>51684074
A monoid is an extension of monads to non-endofunctors
An endofunctor is an extension of monads to non-monoids
>>
>>51684074

I honestly haven't got a fucking clue.
>>
>>51684074
A monoid is a set with an identity element and an operation that fulfills the monoid laws.
class Monoid a where
mempty :: a
mappend :: a -> a

(x `mappend` y) `mappend` z = x `mappend` (y `mappend` z)
mempty `mappend` x = x
x `mappend` mempty = x


An endofunctor is a functor from a category to itself. All Haskell functors are endofunctors, since there is only one category, Hask.

>>51684085
Fuck off.
>>
>>51684090
>worthless
>tripcode

pick both and only both
>>
>>51684085

I asked the question to trip up GTP. If you say "I know what a monad is," you need to back that fucking claim up.

>>51684088

So we have recursive definitions of "monoid", "monad", and "endofunctor" with no base case.

>>51684090

Knew it.
>>
>>51684133

Well yeah, but you already knew that.

>>51684144
>Knew it.

I know, I just think it's a entertaining.
>>
>>51683791
I think it would be more the difficulty of working with the ffmepg library than building the GUI.
I don't know much about ffmepg apart from just doing a quick google, seems like a pretty big thing
>>
File: fizzbuzz.png (10 KB, 671x730) Image search: [Google]
fizzbuzz.png
10 KB, 671x730
Programming noob here, is fizzbuzz supposed to be hard. I took an introductory programming class for my physics major this semester; we learned pseudocode and a bit of python, really basic stuff. I saw this article (https://css-tricks.com/tales-of-a-non-unicorn-a-story-about-the-trouble-with-job-titles-and-descriptions/) posted a few days ago and decided to see if I, with my limited knowledge, could puzzle out fizzbuzz in Python. 10 minutes later I had this:

def main():
for num in range(1, 101):
if float.is_integer(num/3) and float.is_integer(num/5) == True:
print("fizzbuzz")
elif float.is_integer(num/3) == True:
print("fizz")
elif float.is_integer(num/5) == True:
print("buzz")
else:
print(num)

main()


and most of that time was spent digging around in the docs for float_is.integer because I didn't want to use any online resources.

What's the point of asking something so trivial in an interview? Are there actually a lot of people in programming like Laura Schenck who don't understand basic math and logic and need to be weeded out?
>>
>>51684144
To be fair he didn't say he knew what a monad was, and he's a tripcode so nobody would believe him if he claimed to know anything anyway
>>
>OOP tards will say that FP and monads are useless while proclaiming that asynchronous programming with futures is awesome
>>
>>51684179
>is fizzbuzz supposed to be hard
If you need to ask this question, you are a shit programmer

>python
>10 minutes for fizzbuzz
confirmed
>>
I don't lik Go's syntax.
C# for lyf
>>
>>51684198
>liking any small part of Go except the code of conduct
why live?
>>
>>51684179
>not dividing by 15
>refusing to use online resources
You failed your interview anon, I'm sorry.
>>
>>51684183
In what sense are those the same thing.

Also
>friend classes in c++
The fuck is this shit. Why would anyone use these other than to make c++ codebases harder to maintain than they already often are
>>
>>51684181
>he's a tripcode so nobody would believe him if he claimed to know anything anyway

I know a few things.
>>
>>51684219
I don't believe you
>>
any ideas on why the capital letters are disappearing when i convert it from an array of integers to a priority queue?
tracing is on.
trace level is 2.
Character Frequencies:
newline: 1
space: 68
,: 4
.: 4
D: 1
E: 1
L: 1
U: 1
a: 29
b: 3
c: 16
d: 18
e: 37
f: 3
g: 3
h: 1
i: 42
l: 21
m: 17
n: 24
o: 29
p: 11
q: 5
r: 22
s: 18
t: 32
u: 28
v: 3
x: 3
187: 1
191: 1
239: 1
Printing initial queue:
1 newline
3 x
3 v
3 g
3 f
3 b
4 .
4 ,
5 q
11 p
16 c
17 m
18 s
18 d
21 l
22 r
24 n
28 u
29 o
29 a
32 t
37 e
42 i
68 space
>>
>>51684228
they all have a frequency of 1 and aren't the first character (newline)
>>
File: starry3.png (380 KB, 320x386) Image search: [Google]
starry3.png
380 KB, 320x386
>>51684227

I did a thing once.
>>
>>51684213
Futures become instantly more useful when you add the monadic bind to them. Async/await are essentially just an alternative to monad syntax.
>>
>>51684242
so i have to go back and completely rework my priority queue implementation don't i
>>
>>51684179

>float.is_integer
Well I'll be, integer division in Python leads to a float... more reason for me to stick to other languages.

But in all seriousness, lemme give you some advice for the future: use the modulus operator (the % character)
>>
My image sorting script will be complete but I can't figure out how to search a file on iqdb through python pls spoonfeed me /g/ I'm new at this
>>
>>51683745
I disagree. I have seen too many people who rely on using google to do everything. Anytime they are faced with a challenge they fire up google and specifically type "how do I solve challenge X". These are shit tier programmers as they can never use their own intellect and are unable to create anything novel. On the other hand, books tend to be way more in depth ( Just look at the thickness of the average technical book compared to a series of shitty only articles) , more correct as they have been peer reviewed, and tend to be authored by respected individuals in their field who are more knowledgable than some hipster blogger. From books you get a deeper understanding which allows you to build a solid base which you can leverage to create programs which are unique.
>>
File: 1436580208695.jpg (59 KB, 500x375) Image search: [Google]
1436580208695.jpg
59 KB, 500x375
>tfw you ended up being a code monkey that just glues shit together

I feel like I've solved a lot of problems but nothing has been really complex. Most of it being basic CRUD shit.

How do I not becoming a Senior Software Wanker?
>>
What language is best for "type-oriented programming" (ability to overload operators like in C++ and to specify valid ranges and properties for my types, sort of like in Ada, as well as devise new opeartors if possible).
>>
it fucks up when there's multiple things with a priority of 1, any idea on where the issue might be? i don't want to start changing things blindly and make it even worse

struct PQCell
{
PQItemType item;
PQPriorityType priority;
PQCell* next;
};

// Function isEmpty returns true if priority queue q is empty.
// Otherwise, it returns false.
bool isEmpty(const PriorityQueue& q)
{
return q.ptr == NULL;
}

// Function insert inserts a new item x with priority p into priority queue q.
void insert(PriorityQueue& q, const PQItemType& x, PQPriorityType p)
{
PQCell* newCell = new PQCell;
newCell->item = x;
newCell->priority = p;
if(isEmpty(q) || (p<q.ptr->priority))
{
newCell->next = q.ptr;
q.ptr = newCell;
}
else
{
PQCell* leaderCell = q.ptr;
PQCell* followerCell = NULL;
while(leaderCell != NULL && p > leaderCell->priority)
{
followerCell = leaderCell;
leaderCell = leaderCell->next;
}
newCell->next = leaderCell;
if(followerCell != NULL)
{
followerCell->next=newCell;
}
}
}

// Function remove removes the item with the smallest priority from priority queue q.
// It stores the removed item into x, and its priority into p.
// If q is empty, remove does nothing.
void remove(PriorityQueue& q, PQItemType& x, PQPriorityType& p)
{
if(!(isEmpty(q)))
{
x = q.ptr->item;
p = q.ptr->priority;
PQCell* tempPtr = q.ptr;
q.ptr = tempPtr->next;
delete tempPtr;
}
}

// Function printPriorityQueue prints the contents of priority queue q in order from lowest priority to highest to the standard input.
// Prints the priority first, then a tab, then the item, then a newline character.
// If q is empty, the function does nothing.
void printPriorityQueue(const PriorityQueue& q, ItemPrinter pi, PriorityPrinter pp)
{
PQCell* scanCell = q.ptr;
while(scanCell != NULL)
{
pp(scanCell->priority);
printf(" ");
pi(scanCell->item);
printf("\n");
scanCell = scanCell->next;
}
}
>>
>>51684321
Agda. It has dependent types as well as custom mixfix operators.
>>
>>51684313
unless you're a modern ahmed mohammed, it's hard as fuck to learn your first language from a book. OR the internet. it's way easier to have someone teach you in person
>>
>>51684321
Idris or Agda
>>
>>51684255
could you explain how implementing monads in functional languages differs from doing so in languages with templates like D and C++?
>>
>>51684207
Whoa whoa you're putting words in my mouth buddy.
>>
>>51684319
>be in college
>70% of projects are CRUD stuff
>30% are the projects I come with my own idea
Thank god for self-teaching
>>
File: ahmed mohammed.png (1 MB, 928x847) Image search: [Google]
ahmed mohammed.png
1 MB, 928x847
>>51684350
i'm nowhere near as smart as ahmed and i taught myself java
>>
>>51684341
>>51684368
Thanks.
>>
>>51684370
It doesn't, really. Once C++ has concepts, it will be just like Haskell's type classes.
>>
>>51684319
>how do I not earn an easy 150k+ a year
>>
>>51684388
did you solder your own JVM
>>
>>51684390
Just be warned that Agda and Idris are even more "useless" than Haskell, at this point. Agda is only an interactive proof checker. Idris sells itself as a general-purpose programming language, but it's too immature right now.
>>
File: corgi vaccuum.gif (757 KB, 490x276) Image search: [Google]
corgi vaccuum.gif
757 KB, 490x276
I have no degree and I'm a neet. Just started coding literally yesterday having done no coding ever before. I've learned about variables, constants, loops, conditional statements, arrays, classes, segues, structs. My only program is a shitty image viewer that runs on iOS. I still have no clue what I'm doing but I'm having fun. I've put a legit eight or so hours into it.

I guess I'm just wondering--how long would it take to become proficient enough to get some kind of entry-level job as a software dev? Is that even possible?
>>
>>51684403
almost
>>
>>51684196
>>51684211
I would use the google in any real world scenario, but I was trying to test myself. I guess I discovered it wasn't much of a test.

Another question:
I've talked to some people at the college I intend to transfer to. They said they like their physics students to be familiar with C, C++, and Python. What books should I pick up to learn those languages? And are there any good books about programming for scientific purposes?
>>
>>51684409
try looking for internships and other shit like that
if you got some friends in college, you may ask them to forward you some info about internships
getting an internship is usually easier than getting a job, since well, the whole idea is that you're not really able to work fully independently
after having an internship, it' easier to get a job, because:
a) the company may want to keep you after the internship
b) it shows other companies that you actually have some kind of professional experience
>>
>>51684391
You can do concepts with SFINAE and std::enable_if, it's just really ugly code

D has concepts (contracts)
>>
>>51684434
Thanks for the tip, I'll look into it. Is it normal for people who are kinda older (mid 20's) to apply for internships? Also, what if I have a legit Github or something with a lot of code on it? Can that ever get someone a job on its own?
>>
File: _.png (298 KB, 600x512) Image search: [Google]
_.png
298 KB, 600x512
>>51684378
What are some of your projects anon? I feel like I am getting bored.

Last cool things I did were reading from Coinbase's websocket API and building a really shitty order book for trading.

>>51684401
>tfw make 55K with senior in my title

I mean the title is bullshit. I'm not a senior by any stretch of the word.
>>
>>51684319

99.99% of programming is CRUD
>>
>>51684445
I know you can already do it in C++, you just don't get descriptive error messages.

So really, the only advantages that functional languages have over multi-paradigm languages in terms of implementing things like monads is that they have the special syntax.
>>
the advantage go has over languages like java and c# is that the code is easier to understand because go doesn't give you the tools for overengineering like java and c# do
this isn't the only thing important in a language but many have noted that it's pretty easy to jump into go projects and start getting productive, while with other languages you take longer to learn the set of abstractions each project uses
>>
File: goth high test.jpg (111 KB, 855x750) Image search: [Google]
goth high test.jpg
111 KB, 855x750
>>51684329
halp
>>
>>51684510
interface{}
>>
>>51684494
I was planning on making a small D file that would let me write macros in other D files, but it turns out D compile time regexes can't actually be /used/ at compile time. (They're just optimised to work twice as fast.)

Might do it again but without using regexes. Kinda sucks desu
>>
>>51684491
Yeah but I need some interesting stuff to talk about too. Most team leads with a clue know that but they want people who also have solved at least a few problems that require more thought
>>
>>51684405
Oh, that's bad. Is there anything like them but more developed then?
>>
>>51684513
SEMEN
D
E
M
O
N
>>
Daily reminder that Haskell is 25 years old and still has no library/API support

When will Haskellfags give up?
>>
>>51684535
Not really. Dependent types and mixfix operators have only very recently become as popular as they are. As well, since they're really only relevant in the functional sphere, most people either have never heard of them or take the usual stance against "functional things".
>>
>>51684449
As a self-learner, you have way bigger chances applying to start ups and small software houses. Corporations often don't even have their own HR departament and outsource the job - and even if they do, the fact remains that they get a shitton of applications, so there's a lot of automatic filtering going about. If you don't much some set of buzzwords, no one will even bother looking at your resume/CV. If you apply to a small company, there's much bigger chance that there's actually a human on the receiving end of the jobs@company email, and they may actually bother going to GitHub and giving it a quick peek.

I think mid-20 isn't too bad, since there are some people who changed their mind during college, or had to get some money first, or wanted to travel, or whatever.
>>
>>51684479
where do you live? 55k euro would be a lot in euroland, 55k dollars in ameriland seems pretty low from I've been told
>>
>>51684521
buttmad
>>
>>51684479
For my own projects I like to do more stuff with machine learning. One of my projects started in a course, failed the course because I didn't deliver any documentation, but still continuing development. I wish I had more time for those projects. I like to focus on solvers for card games.

Last CRUD project I did and liked was a web API with front-end for managing virtual machines in Azure for ALM stuff. It's so multiple development teams could work on the same Azure subscription without deleting another teams VMs
>>
File: sweating.jpg (27 KB, 300x300) Image search: [Google]
sweating.jpg
27 KB, 300x300
>>51684591
Give it to me straight--if I have a few apps on the app store, a decent-ish github demoing some basic stuff like working with RESTful APIs and demoing my understanding of Big O etc., do I have a real shot at landing a real job with some tiny startup or something?

I read into this a bunch before I bothered starting and I'm just overwhelmed and nervous about the whole thing. I need to get a move on with regard to a career and I don't want to just fuck around and waste my time

jesus christ
>>
>>51684621
>guys look at this awesome new safe systems programming language!
>garbage collector
>no generics/templates/type quantification
>error codes that you just have to trust the caller to check
>>
File: high test sjw.jpg (109 KB, 960x1428) Image search: [Google]
high test sjw.jpg
109 KB, 960x1428
>>51684329
pls brehs...
>>
>>51680061

private void button1_Click(object sender, EventArgs e)
{
int tableSize = int.Parse(textBox1.Text);
int[,] timesTable = new int[tableSize, tableSize];

listBox1.Items.Clear();

for (int i = 0; i <= tableSize; i++)
{
for (int j = 0; j <= tableSize; j++)
{

timesTable[tableSize - 1, tableSize - 1] = i * j;
listBox1.Items.Add("Position: " + i + "," + j + ": " + timesTable[tableSize - 1, tableSize - 1]);
}

}

}


Can someone explain me why do you need to have a -1 in here?
timesTable[tableSize - 1, tableSize - 1] 
I know it's not necessary to make 2-dimensional arrays to make a times table but I just wanted to practice and this didn't compile until I looked up a similar example which included a -1 to both values in the array, sorry for being literally retarded
>>
>>51684639
Do some projects with other people. I think they would like to know how you work in a team instead of only independent projects.
>>
>>51684677
makes sense
thanks again
>>
>>51684639
If your apps are actually downloaded by people and have decent reviews, you have a pretty good chance. Most mobile dev companies will want to see your published apps. If all your apps are things like "My first tic-tac-toe!!!" or "Yet another to-do list" then you should keep working on your portfolio.
>>
>>51684665
holy shit, this code
and i'm not talking about the nested for loops
>>
>>51684594
Murica in the south east. It is good for the area (median income here is shit, like 30k or something) but not very good considering national pay for devs.

Another year and I think I can get jobs nationally. I basically took the first one I could get because no experience.
>>
>>51684510
I don't know if I agree with that. Java clearly has that problem, or we wouldnt have factory bean interface abstract beans (which reminds me, IObject is discouraged by Java documentation because it represents an object, yet the same documntation has AbstractObjects everywhere) but those kinds of porblems don't seem to appear in c# code bases.
Then again maybe I'm just biased since C# showed me the programming light after java at uni snuffed it out.
>>
>>51684682
I'm working on a clone of an old arcade game and a crime map type thing with some syncing functionality, implements databases etc.

I understand that super simple stuff won't garner much credit but I also don't want to spend much time on really complex projects that I'll never finish. Like I said, I'm really stressing out about this, lol. I just want a fucking (dev) job.
>>
>>51684700
would you rather be earning money on 30k a year or broke on 100k a year?
>>
>>51684639
Quite honestly you probably have an advantage over 70% of your fellow applicants if you have the confidence to ignore the "need 5 years experience and a MSC in computer science" that so manycompanies preface their roles with.
>>
>>51684639
You'll never know unless you try.

Also, like I wrote earlier, ask friends or try making connections (if you live in a bigger town, search the internetz for some conferences/parties with zero or otherwise low entry fee). It's always a lot easier if there's actually a person supporting you, instead of you just being some random-ass guy wanting to work at the company.
>>
>>51684655
>I'm buttmad
>>
might have been wrong about D not supporting compile time regex compile time evaluation
>>
File: sweating.gif (2 MB, 1920x1076) Image search: [Google]
sweating.gif
2 MB, 1920x1076
>>51684745
>friends
>>
>>51684665
indexes versus size. indexes start at zero s you have size - 1 as the final index
Thread replies: 255
Thread images: 31

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.