[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: 27
Old thread >>54128623

What are you working on/dpt/?
>>
>>54137762
3 1 0
1
0
>>
as op, nothing
>>
Crosspost from old thread

I'm having some trouble with reflection in C#.

Say I have a whole bunch of classes where every method inside them is private except for one, and all are argless with the same title.
The easiest solution would be to make them all derive from a base abstract class and then use reflection to call the override methods in each one. But I'm stuck at telling it which one specifically to call.

Is there some way to utilize reflection to determine derived class names so I can just parse out the one I want based on input?
>>
File: rustle.webm (119 KB, 848x480) Image search: [Google]
rustle.webm
119 KB, 848x480
>before bump limit
>>
>>54137672
>have an unwanted pregnancy.

I know understand the crossdressing and taking hormones memes.
>>
>>54137762
Now this animey shit has gone out of control.
It has absolutely nothing to do with programming.
>>
>>54137871
http://kissmanga.com/Manga/SE
>>
>>54137906
Not the general animey, but Death Note in particular.
>>
>>54137933
I don't care. Anything but trapshit.
>>
C is utter shit

Prove me wrong. Protip: You can't
>>
>>54137993
This.
Assembly is the only way to go if you want to be a programmer-pro.
>>
ask a 10x programmer anything
>>
>>54137993
Here we go, actual b8. Assembly is the king of languages, he can only control his kingdom and does it uniquely to all the other kingdoms. C is the guy who said, "fucking hell why are all these similar kingdoms being ruled differently but essentially work the same?"

C brought together all the kingdoms and established universal rules of law to follow. Now what's bad about that?
>>
>>54138028
do you write unit tests?
>>
>>54138071
>C brought together all the kingdoms and established universal rules of law to follow. Now what's bad about that?
it wasn't good enough. thankfully c++ saved us
>>
>>54138085
I don't. They are way too much of an hassle for what they do. We also use tests that actually opens application and do larger tests and I think that is enough.
>>
>>54137993
C was made in the 70's and hasn't evolved since then. even at that time it was considered to be a shitty PL. The people who acclaim C are PLT illiterate.
>>
File: Selection_005.png (57 KB, 985x283) Image search: [Google]
Selection_005.png
57 KB, 985x283
spamming more halp with emscripten on 'buntu

>>54138180
don't fix what isn't broken
>>
/dpt/ joke of the day:

why do programmers only drink canned beer?
>>
i want to make a script that scrapes a website and returns a rss-format file

is there a better way to do this?
>>
>>54137816
Okay so I've got it where I can pull in the derived classes and get info about them
I cannot, however, run the override method in question.

var methods = Assembly.GetExecutingAssembly().GetTypes().Where(t => typeof(Problem).IsAssignableFrom(t)
&& t != typeof(Problem)).ToArray();

Console.WriteLine("Please enter the problem number you wish to run");
var input = Console.ReadLine();
var method = methods.Where(t => t.Name == "Problem_" + input).First().GetMethod("Run");
object o = Activator.CreateInstance(method.ReflectedType);


this will create me an instance of the object I asked for, but it's only displaying some private static variables I defined within the class itself. I don't see any methods.
>>
>>54138207
why?
>>
File: 324235332.jpg (34 KB, 1280x720) Image search: [Google]
324235332.jpg
34 KB, 1280x720
>>54138207
>>54138266
because they hate bottlenecks!
>>
>>54138283
decent/10
>>
>>54138117
>actually opens application and do larger tests
arent those kinds of tests unmaintainable?
>>
File: 1333231610142.jpg (37 KB, 288x424) Image search: [Google]
1333231610142.jpg
37 KB, 288x424
>>54138330
You're the entire fucking reason every codebase I've had to work with at every job is an unintelligible mess riddled with regression bugs.

Every codebase is maintainable. It's just shitwits like you who think it's okay to skip writing tests that make large projects "unmaintainable" for testing
>>
>>54138194
>don't fix what isn't broken
non sense. it's not about fixing things but about new technology.
>>
>>54138372
new technology that's supposed to fix the shortcomings of old technology
>>
>>54138352
I'm specifically referring to UI tests, where mouse clicks are done on specific elements by an automated agent. I've had terrible experience with those kind of tests.
>>
>>54138283
air through nose/10
>>
>>54138461
Because you've probably never had to specifically work at that 8 hours a day. Blackbox and UI testing is certainly incredibly fragile, but if your test engineers wrote everything smartly (namely using a page-object-model for easy maintenance) then the exact same goes for it.
Short of complete and total UI overhauls, those test bases should remain usable and valid for a long time. They require closer inspection on failure and also require very strict success thresholds, but that's why "Test Engineer" is it's own, separate job.

That being said I've worked those jobs too, and the asshole who skip unit tests, even just here or there for one tiny thing, made my life a living fucking hell because the blackbox testing would intermittently fail shit and it takes god damn eons to determine whether it's the test code fucking up or if it's some dipshits undocumented red code bugging up
>>
>>54138094
This is true, but C provided the foundation
>>
File: Haskell.png (30 KB, 647x599) Image search: [Google]
Haskell.png
30 KB, 647x599
Programming Challenge:
Reverse an array's elements. Cannot use code similar to any posted before you and it has to be an array. Can't be Vector, list, etc..
Let the programming begin.
>>
File: pushit.jpg (31 KB, 432x392) Image search: [Google]
pushit.jpg
31 KB, 432x392
>>54138643
int Arr[] = {1, 2, 3, 4, 5};
int n = sizeof(Arr)/sizeof(Arr[0]);
int temp,i,j;

for(i=0,j=n-1;i<n/2;i++,j--){
temp=Arr[i];
Arr[i]=Arr[j];
Arr[j]=temp;
}

cout<<"\nReverse array"<<endl;

for(i=0;i<n;i++)
cout<<Arr[i]<<" ";

return 0;
>>
>>54138372
You are wrong. Tearing down a computer, it still works with bits and bytes. The fundamentals don't change, so why should a language that works so closely with the fundamentals change?
>>
>>54138643
void reverse(elem_t* array, size_t length)
{
for (size_t pos = 0; pos < length / 2; ++pos)
{
elem_t temp = array[pos];
array[pos] = array[length - pos - 1];
array[length - pos - 1] = temp;
}
}
>>
>>54138643
We webdevs have it easy.

https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse
>>
>>54138643
const int arrSize = 5;
int arr[arrSize] = {1,2,3,4,5};
int cpyArr[arrSize] = {0};
for(int i = arrsize; i > 0; --i){
cpyArr[arrSize-i] = arr[i];
}
arr = cpyArr;


lame as fuck, but simple
>>
>>54138704
Noob questions, what is elem_t and why use it?
>>
>>54138180
>>54138372
There's nothing wrong with pointer arithmetic or any of the things found in C (or any programming language) from a theoretical perspective. You could even use lambda calculus and/or set theory (or whatever your favorite formalism is) to describe C if you wanted to.

A programming language is just a formal system. Parts can be nondeterministic or undefined. There's nothing wrong with that.

If a language was wrong in a theoretical sense, it wouldn't be able to exist. We wouldn't even be able to describe or talk about it.
>>
>>54138745
make those c++11 arrays like
array<int, arrSize> arr;
>>
>>54138568
>Test Engineer
no one competent or sane wants this position
>>
>>54138832
It sounded cool until I started learning about unit testing.
>>
I've got the basics down for python

Is C/C++/python a good combination?

Is C worth learning today compared to learning C#/C++? It seems like most jobs in my city are looking for people to work in C# and everything webdev
>>
>>54138885
>learning python first

oh man I hope you don't hold on to those fundamentals. START LEARNING C++ NOW. Yes right now. Like, read this right now http://www.learncpp.com/
>>
>>54138885
C++ and Python are definitely a potent combination.

C is a very niche language and has been practically superseded by C++. There are very few areas where C is useful. That said, if you are a student I would recommend learning it. It will teach you a lot, even if you don't end up using it in production.
>>
>>54138942
It will teach you a lot, but learning C might encourage bad habits when getting to write C++. Learning C++11 first will give you a taste of actual programming. Going to C make the two language seem separable. That's important... imo
>>
>>54138832
if your code is only tested by sane people, it's not ready to be released into the Real World
>>
>>54139032
Beta testing is a thing
>>
>>54138918
Don't worry. I learned 2.7 about six months ago then I've forgotten pretty much most of it.

When I relearn I'm going to learn 3.

>>54138942
That's what I was thinking. Ideally jobs don't interest me as much as research positions so I'm thinking doing C just to wrap my head around a bit of history that could lead into a better understanding of other languages would help unless I'm just wrong in thinking like this.

>>54138984
What bad habits? Is it an accepted standard that C++ should be learned before C?
>>
>>54139032
true
>>
I'm flabbergasted. When executing the query on it's own, it works fine. But when executing the stored procedure, it keeps going and going until it reaches maximum nesting level.
The workplace is a many to many table that keeps track of the people who have a job.
GO 
drop PROCEDURE peopleInCompany
GO
CREATE PROCEDURE peopleInCompany AS
SELECT * FROM person As p
WHERE EXISTS (select * from workplace as w where w.cpr = p.cpr)

EXEC peopleInCompany


Any clues to why the procedure shits itself?
>>
>>54139186
Learning order doesn't have an accepted standard, although I strongly recommend if you want to develop programs (careful wording) you should learn C++ first. It will help you develop programming intuition and will be a platform for you to be able to learn new languages more seamlessly. After experience with C++, go to C if you want to interact with more low level elements. At that point, it's not as much about developing programs as it is about having the fastest code (careful wording) on the block. Decide for yourself, but in either case, I would still recommend learning c++ first. Keyword is, "I".
>>
>>54139186
>What bad habits?

C++, especially C++11, makes a number of significant improvements over C. Things you shouldn't do in C++ include

>using C-style arrays
>using C-style strings
>using raw pointers
>using C's random number generator
>abuse the preprocessor
>etc.
>>
>>54139253
Figured out why. It includes the EXEC in the procedure.
>>
>>54139300
yeah, no
>>
File: 1461037040340.jpg (32 KB, 432x657) Image search: [Google]
1461037040340.jpg
32 KB, 432x657
All these objects represent bank accounts with a balance and a name. How do I add all of these up together in a function for my main class Bank_Account? Using python 3

italian = Bank_Account(1000, "Mario")
filipino = Bank_Account(200, "Deeno")
american = Bank_Account(900, "Tim")
>>
>>54139443
wew is this a homework assignment or some cuck academy?
>>
>>54138071
Centralisation destroys diversity destroys potential differences destroys creativity.
>>
>>54139442
Yeah, yes.

Don't be a retard
>>
>>54139490
but muh control and autism
>>
>>54138746
Generic array element for the sake of the example, anon didn't specify type.
>>
>>54139300
Can one even use _raw_ pointers in C++?
>>
>>54139487
Of laws? No

In society? Yes.

This is computers we are talking about. The rules stay the same, the universalization expressed with slight abstractions. Creativity comes from an operator's ability to manipulate these rules.
>>
>>54139524
yes, but you shouldn't. Smart pointers should be used, even in ISO it says don't copy that floppy and don't use raw pointers dummy.
>>
>>54139524
yeah
you can make a pointer variable, call new (or even malloc if you wanted to) and get a pointer back into the heap and manipulate the pointer, do address arithmetic etc
its just bad practice in C++ because the language abstracts it all away
>>
Ive started to develop android apps
>>
>>54139572
here's your pajeet trophy of participation
>>
>>54139572
No you haven't
>>
>>54139524
A common case where I use them is when I have a factory object that keeps a list of the objects its made and I know that once created the object will last the entire length of the program.

unique_ptr is really just fully awesome though and should be used as often as possible.
>>
what does it mean ** when is used to declare a data type?
>>
A text based adventure game.
>>
>>54138071
>>54139487
A lot of 70s graphical workstations and capability-based architectures wouldn't be able to run C. Many of them were built around the notion of making language-level objects available system-wide.

For example, instead of a text file, you would have a text object, which is like a string with some metadata. On a lower level, you would just be reading from pointers and the virtual memory would handle everything. The Classic Mac resource manager was inspired by one of these systems.

This is a big difference from the "disk operating system" model used by Unix and Windows.

This kind of technology might show up again in the future. It would be a pretty good fit for the various features provided by HTML5.
>>
>>54139690
int** x; //pointer to a pointer of ints

it's a common way of implementing C-style matrices, it's a real fucking pain to manage though and should be avoided.

for instance:
int** x;
int** x = new int*[3];
x[0] = new int[3];
x[1] = new int[3];
...

now you have to remember to delete all the inside arrays, then delete the outside array. requires keeping track of how many inside arrays you have. total pain in the ass and not worth it.
>>
>>54138643
public int[] reverse(int[] arr) {
List<Integer> temp = Arrays.stream(arr).mapToObj(Integer::valueOf).collect(Collectors.toList());
Collections.reverse(temp);
return temp.stream().mapToInt(Integer::valueOf).toArray();
}
>>
>>54139475
>wew is this a homework assignment or some cuck academy?
yes
>>
I'm trying to implement the boyer-moore-horspool algorithm in Java by following the pseudocode on wikipedia, but i dont understand what 'exclusive' means in the code. Can anyone explain it to me?
function preprocess(pattern)
T ← new table of 256 integers
for i from 0 to 256 exclusive
T[i] ← length(pattern)
for i from 0 to length(pattern) - 1 exclusive
T[pattern[i]] ← length(pattern) - 1 - i
return T
>>
>>54139826
doesnt include 256?
>>
>>54139841
it's 256 integers, excluding from 0-255
>>
>>54139869
meant to type excluding 256
>>
>>54139869
>>54139841
Thanks, that makes sense now.
>>
>>54139959
there's also a video on youtube that explains clearly how it works
>>
What are some good beginner books on assembly?
>>
>>54139826
wikipedia has a very strange style of pseudocode. I dont like it. I'd rather see real code so I know what its actually doing.
>>
>>54140123
all the good wikipedia articles use C instead of psuedocode because
>>
>>54140087
the one with blue gears on the cover
step by step assembly i think?
>>
>>54140114
k
>>
>>54140114
>asking your boss what he's doing to fix tech debit
no anon, its your job to fix the tech debt
>>
File: 1430680124768.png (103 KB, 506x662) Image search: [Google]
1430680124768.png
103 KB, 506x662
>>54140087
>>
working through Cracking the Coding Interview
its good practice I guess
>>
>>54140149
Thanks, I'll check it out.
Also noticed that the /g/ library on IPFS was down for legal reasons.

But I found the book anyway.
>>
>>54140232
g.sicp.me is the new
>>
>>54140249
Ah cool, thanks.
>>
>>54139761
beautiful
>>
Who do you think would be better coming into learning programming, someone with experience in web development or someone with experience in networking?

What's more practical, to understand networking and programming or web development and programming?
>>
>>54140563
depends on what you want to do obviously
>>
>>54140563
if you want to do network programming then it will be useful
if you want to do web dev then that will be useful
if you want to do neither it wont matter at all
>>
>>54140577
I want to get into programming and eventually computer science but I'm coming off mental health issues and need to take a small course just to pass the time so my dad stops bullying me
>>
>>54140971
>computer science

Do you like math?
Because it's basically computer math.
Think probability and worst case time complexity for a search algorithm given a data set. It's the "science" of computation.
>>
>>54141033
I've lurked enough to understand that and I like both math and programming so computer science or software engineering seems like a valid option.

That's all in the future though so right now I'm just wondering if there's any merit to learning networking over web dev. Both courses seem to be VERY basic and primarily about learning how to function in a workplace environment and it seems like at least web dev is more actual work with dealing with markup languages compared to being a systems admin

I'm just looking for any advice I can get.
>>
>>54141215
sysadmin stuff is cooler than webdev
it would hinder you to learn JavaScript before learning any other programming
just do sysadmin pls
>>
>>54141215
if you like maths, you're better off in backend webdev or sysadmin, it's deeper than frontend shit

same for mental health problems - sysadmin/backend is more about dealing with machines, while frontend is more of a, uh, normieland, with all that it entails
so you're again better of in sysadmin/backend area
>>
I'm trying to draw a function stack from a matlab program.

Never done this before.
>>
>>54141299
>>54141260
This really helped make my decision. Thanks
>>
>>54141576
welcome :)
>>
is this the only way to check for equality between two floats/doubles

if (_x1 > x1 + 0.000005 || _x1 < x1 - 0.000005) {
//not equal
}


?
>>
>>54141741
Personally, I'd multiply the float by 1000 and cast it to an unsigned.
If both unsigned match, it's reasonably equal.
>>
>>54141741
defined delta constant

i f abs(x1 - x2) < delta
return true
>>
>>54141741
you could do (fabs(_x1 - x1) < .000005) too
but yeah
>>
>>54141784
>>54141789
was actually unaware of fabs(). neat little hack, thanks.
>>
>>54141978
I have never heard of fabs though it might just be the same as abs except in a typed language
>>
>>54142105
fabs apparently commonly does this (I didn't check my specific implementation, g++)

float x;
*(((int *) &x) + 1) &= 0x7fffffff;


and abs is just overloaded for it to work with non floats also.
>>
Anyone write "getting started with X language/framework" ebooks? Can I realistically make a worthwhile sum of money from doing so, assuming I'm good at it.
>>
>>54142203
glibc uses __builtin_fabs, using the fabs CPU instruction on x86 computers and probably emits something similar on other architectures.
Also, in that form, that code is undefined behaviour, as it violates the strict aliasing rule.
>>
>>54141299
Jesus Christ, what on Earth does monkeytyping Java code to embed databases in websites have to do with math?
>>
I've applied to nearly every available software dev job on indeed and monster.

I am now officially fucked
>>
>>54142542
Why are you fucked? Keep working on your portfolio. You'll get something eventually.
>>
>>54142410
not TOO much, yeah
but between frontend and sysadmin stuff it's the closest he'd get to maths/algorithms; it's deeper and has to do more with system design
>>
File: oy.png (9 KB, 452x420) Image search: [Google]
oy.png
9 KB, 452x420
WHO EMACS HERE????
>>
I've been doing great in class so far and then the professor drops SFML on us as if we knew what it was. What libraries am I supposed to use to plot and graph some coordinates?
>>
>>54142570
There's just not enough jobs out there and on almost every single application I've sent out I needed to lie about my qualifications

I have a BS in Computer Science dammit, I shouldn't have to lie to get a fucking job!
>>
>>54142740
SFML is literally the most common sense graphics library, ever.

Read the docs, you can get started in seconds.

>plot and graph some coordinates
SFML lets you draw a lot of primitive shapes and polygons really easily.
>>
File: Capture.png (24 KB, 1004x634) Image search: [Google]
Capture.png
24 KB, 1004x634
Does anyone know how I can move a circle along this grid one square at a time? I'm using
javafx.
>>
Can anyone help me? I'm trying to code in c++, coming from processing and python.

In java/processing i can declare, lets say, ImageClass foobar; and it's unitialized, but it seems in c++ that is equal to ImageClass foobar = new ImageClass(); which is not what i want. Is there a way around this?

Also, what do i include where? Say i have a class that references another class, and both reference a framework. Do i include framework.h in every header file? Is the rule "include what you use" for every file, or is it enough if i include a thing in main.cpp?
>>
>>54139300
>>abuse the preprocessor
Explain.
>>
>>54142815
you need an MS nowdays, kiddo.
>>
>>54139300
What is the best way to generate random numbers in C++ 11?
>>
>>54143163
>In java/processing i can declare, lets say, ImageClass foobar; and it's unitialized, but it seems in c++ that is equal to ImageClass foobar = new ImageClass(); which is not what i want. Is there a way around this?
Why is that an issue? The default constructor is the same thing as allocating memory on the stack but not initializing it. Maybe it costs you a stack frame at init time but a compiler should be able to optimize it away.

>>54143163
> Is the rule "include what you use" for every file
Yes
>>
>>54143228
I'm not >>54139300 but it's not unheard of to use the preprocessor to get hacky "parametric" typed functions (the more popular approach was to just pass void pointers and trust downstream to know the right cast at the right time. Templates solved that problem.
>>
>>54143294
Okay, that makes more sense, I thought they were saying that macros were a no-no or something.
>>
>>54143294
Plus when using a shit load of templates, readability goes down the drain, I mean look at this shit

#define begin {
#define end }


You can fuck your code up for you and everyone
>>
>>54143110
Do you mean how to animate the movement, or just how to render a circle in a given square?
>>
>>54143251
#include <random>

// Pick an engine. Mersenne Twistor is a good choice.
std::mt19937 eng(seed);

// Create a distribution.
std::uniform_int_distribution<int> dist(1,10);

// Generate a value.
int x = dist(eng);
>>
>>54143331
I meant to say preprocessors lol
>>
File: MaidGirlSmirk.jpg (338 KB, 1369x1183) Image search: [Google]
MaidGirlSmirk.jpg
338 KB, 1369x1183
>>54137762
>What are you working on/dpt/?
>>What were you working on/dpt/?
My ENTIRE group's code for Data Structs and Algs.

But
>MFW: My name goes on all the program files
>MFW: Which one of you is gonna do the write up?
>>
>>54143228
Using the preprocessor to inline functions is one example.
>>
>>54143228
Good C++ shouldn't use the preprocessor almost anywhere.
>>
>>54143349

feels good when everybody else gets no points, though.
>>
>>54143339
just to render the circle in a square
>>
File: vomit.jpg (90 KB, 650x650) Image search: [Google]
vomit.jpg
90 KB, 650x650
>>54143342
>>
>>54143309
They are, mostly.
>>
I'm thinking of starting to learn a new language and I'm not sure if Java is a good choice. What are /dpt/'s thoughts on it?
>>
>>54143393
lol, true true.

However, I think it's just distributed across the group.

Either way, though, I got so much better at Java, and even improved my skills with recursion, searching algorithms, and trees, as well as learned how to do file reads (never was familiar with Java before this semester; file handling's much different than C++).

So, if nothing else, just gotta learn how the web applets work and the Swing library, and I'm pretty close to ready to make games with it, while they still don't even know what's going on.
>>
>>54143294
>man queue
>Cfags need unsafe preprocessor bullshittery to (badly) emulate std::queue
>Cfags still don't have std::vector, std::array, std::map or algorithm.h

C++ is so comfy you'll wonder why you ever put up with C's bullshit
>>
>>54143400
Literally no other language offers anywhere near the power of C++'s random number facilities.

Also, I hope to God you aren't a C-fag. Because C's random number generation is literally cancer.
>>
>>54143461
>C++ is comfy
I assume that's the only language you know. Almost ANY other language is better than Meme++.
>>
>>54143454
what are your motivations for learning a language?
>>
>>54143461
>>Cfags still don't have std::vector, std::array, std::map or algorithm.h

Or smart pointers, or references, or templates, or lambdas, or decent random number generation, or RAII, or...
>>
>>54143481
lol you wish. the only thing that has the potential to replace c++ in the future is rust, and I'm not holding my breath on that one.
>>
>>54143487
Bored and already know C++. I've heard from some friends that Java's not too bad and wanted to see if it's worthwhile to learn
>>
>>54143477
If you truly gave a shit about the quality of your random numbers, you wouldn't be using shit from your standard library. Also, POSIX has a bunch of random number functions which are better than standard C one.

>>54143507
>replace c++
Replace C++ from what? It doesn't really have a niche to replaced from.
>>
>>54143528
>If you truly gave a shit about the quality of your random numbers, you wouldn't be using shit from your standard library.

Why? Maybe C programmers have a habit of dropping their standard library at the first sign of trouble, but C++'s random number facilities are first rate. You have the choice between several cryptographically secure random number generators, which can be implemented to form uniform, normal, Poisson, and other distributions.
>>
What are good books about responsive css?
>>
>>54143454
Java is ok.

If you know C++, you can probably get into it pretty fast. I learned a lot of it from my Data Structs and Algs class (because that's the language they decided to use).

Obviously, it has a lot of potential for web-based stuff and games (which I'm interested in).

On the other hand, it's also kind of annoying as hell...
It really cemented a lot of what I already knew about classes, inheritance, polymorphism, and interfaces, but it's COMPLETELY object-oriented. Like, to a fault.

If you don't mind OOPing every single thing you do, go for it.

It doesn't allow operator overloading though...
I can't tell you how many times I tried to compare class objects using regular operators, see an error, and "Oh yeah, just gotta ov-"
"never mind..."
>implements Comparable
>copareTo(Object that)[...]

Yeah, I liked operator overloading, and it just irks me that you gotta put the main() in a class...

Oh yeah, main is always
public static void main(String args[])

real weird.
>>
>>54143461
>>Cfags still don't have std::vector, std::array, std::map or algorithm.h

C FAGS ARE ON SUICIDE WATCH BCUZ NO DATA STRUCTURES
>>
>>54143542
It's C's job to be portable and easy to implement.
They wouldn't go and make all of the implementation need to implement a bunch of random number generators they don't need.
>>
>>54143528
The niche that d, rust and go are/were (lol go) trying to replace it from.
>>
>>54143522
My personal opinion is that Java is the tooled language in the world. That said, I dont think a human bored with C++ will find any novelty in Java. Why not learn something completely different, like lisp or haskell?
>>
>>54138643
arr = [5, 4, 3, 2, 1]
print(arr[::-1])
>>
>>54143309
From the Stroustrup C++ standard
>>
>>54143555
You probably are looking for /wdg/, but try the O'Reilly one here:
https://smile.amazon.com/gp/product/B00QUBHNFI/ref=oh_aui_d_detailpage_o03_?ie=UTF8&psc=1

It covers a LOT more than CSS, but it covers CSS, CSS3, and jQuery to use on CSS in a number of the chapters.
jQuery is fucking hot.
>>
>>54143522
If you are looking for personal enjoyment I would recommend against Java. It's not a bad, just very dull. I know I'm not alone when I say that I'm never excited to program in Java. The excessive, engrained OOP is annoying; it lacks expressiveness; the standard library is meh; no low level control; and who gets excited about portability.

That said, it's certainly a useful language to know, but others are more fun. Consider Python.
>>
>>54143591
>Jtooled
I mean best
>>
>>54143570
I understand the constraints that C is operating under. However, it's a fact that C's random number generation is really bad, and that's a problem with the language for most applications. Yes, if you are doing some embedded stuff you might be thankful that C offers and easy-to-implement standard library, but for 99% of cases it's really annoying that you have to rely on non-portable extensions to get high-quality random numbers.
>>
>>54143566
They don't have defined dynamic data types but you can make one. That's the beauty of it. Plus, C has Glib, it's like boost for C++ and has something like vectors in it.
>>
>>54143625
why do you need high quality random numbers?
>>
>>54143634
Monte Carlo simulations and cryptography are two examples.
>>
>>54143563
>>54143604
Thanks for the help
>>
>>54143639
those are highly specialized applications
>>54143655
>ignores my post
rude desu
>>
What should i know to create an android app that receive "posts" from a website and show it to client? I'm a Java developer but i cant do it.
>>
>>54143694
Java dev as well and can't figure the shit out.
>>
>>54143668
It's still good practice for any application to use decent random numbers. it's not that hard to invoke a function that returns a random number from Mersenne and random_device
>>
>>54143626
>They don't have defined dynamic data types but you can make one.

Just like you have to make everything else. Worse yet is that anything truly 'generic' has to be implemented entirely in macros.

kvec is good, but it shouldn't be necessary.
>>
>>54143602
>Use const proactively
Does anyone do this with basic type parameters?
>>
Does anyone else exclusively listen to kpop while programming?
>>
>>54143786
God no
Here's what I have going right now
https://www.youtube.com/watch?v=hweqMd5gDJw
>>
>>54143800
Fuck I like that
>>
>>54143786
When writing something that'll take a while, I tend to either listen to ASMR or 10-hour challenge vids, like Fukkireta, Miku's version of Ievan Polkka, or more recently Nya Nya Song. Sometimes, I try to find a decent techno mix, but all the Electro Swing I can find is remixes of fucking Disney songs, and the Nightcore mixes often include serious dumbass shit.

I'd say, though, 75% of the time, ASMR, 20% anime songs and/or 10H challenges, and the remaining is whatever, sometimes techno
>>
>>54143835
what the fuck's wrong with you
>>
>>54143827
Glad to hear
Be warned, the rest of the songs on that album are nothing like that one (8/10 album imo though)
https://www.youtube.com/watch?v=3BLzM7GbFEY
>>
>>54143840
lol, why you think there's something wrong with me from that?
>>
>>54143786
Who the hell can listen to kpop? I get a headache at the beginning of any popular anime

This shit
https://www.youtube.com/watch?v=EbFUL4MprBY
>>
>>54143883
>who can listen to kpop?
>posts huaaaaaaaaaaaaaaaaaaaaaaa duin dund udn dududu ahhhhhhhhhhhgjjjhghg music
>>
>>54143917
Kpop is fucking autistic, at least I can relax with my music.
>>
>>54143917
my thoughts exactly, lol.

>I get a headache at the beginning of anime popular anime
>Makes me feel a headache in less than 20 seconds
>>
>>54143883
>I get a headache at the beginning of any popular anime
>anime
>Jpop openings (usually)
>Question is about Kpop

https://www.youtube.com/watch?v=U7mPqycQ0tQ
>>
>>54143952
Sounds the same to me
>que butthurt
>>
File: 1441842960110.jpg (29 KB, 600x375) Image search: [Google]
1441842960110.jpg
29 KB, 600x375
>>54137871
Yeah i agree it's getting totally out of hand. Wish we could go back to 4chan before all these animefags were shitting the place up, right?
>>
>>54143835
>ASMR
>10 hour challenge

Just kill yourself actually
>>
The vocals aren't distracting because you can't understand the shit
https://www.youtube.com/watch?v=11Zwe8b1rwI
>>
>>54143694
>I'm a Java developer but i cant do it.
>but i cant do it
>but
Being a Java programmer is a sufficient explanation for being unable to do almost anything
>>
>>54143952
Intolerable.
>>
>>54143986
Hey, there ain't nothing wrong with ASMR. It's relaxing and not distracting.
>>
>>54143952
That was pretty good, but it'd be way too distracting for me.
>>
>>54144049
>nothing wrong with listening to a guy fuck a microphone with his 5 o'clock shadow for hours on end
>>
>>54144069
bro, bro, you got it all wrong. I listen to Ephemeral Rift most of the time.

He taps lightbulbs, bathes potatoes in sinks, and taps the camera with his plague doctor mask.
Also, brutally murders pineapples with a hand axe.
All for your relaxation.
>>
>>54144095
I like ASMR but the way you describe it makes it sound fucking stupid
>>
>>54144095
>link related
https://www.youtube.com/watch?v=eeBUF09jFVw
>>
>>54144095
You must have been diagnosed with autism.
>>
>>54144115

This is some mega autism shit. I admit, I'm fairly into autistic shit, but this is on a whole other level.

Even ANIME is better than this, and I fucking hate it.
>>
>>54144166
kek
>>
File: 1459994210678.jpg (39 KB, 268x265) Image search: [Google]
1459994210678.jpg
39 KB, 268x265
>>54144115
>>
File: 1452403462016.png (79 KB, 307x400) Image search: [Google]
1452403462016.png
79 KB, 307x400
>>54144166
>Filthy racemixer trying to talk down on others
>>
Today I have done some Flex and Yacc programming. I think the only real challenge was dealing with nested comments for my professor's custom programming language that we have to build a compiler for. And that wasn't even really a challenge. Most everything else was reading documentation on Flex and Yacc.

How are you guys doing?

>>54144049

Considered binaural beats?

https://www.youtube.com/watch?v=xGvs6uekFnM

Just plop in some headphones and listen to that the next time you need to focus on something. Granted, it's not much better sounding than white noise, but it does have some evidence to suggest it's good for focus and relaxation (and a number of unsubstantiated claims about other benefits)
>>
>>54144166
https://www.youtube.com/watch?v=8McfZxMcuiA
https://www.youtube.com/watch?v=BwW1095Na3c
https://www.youtube.com/watch?v=icUgu4RiG3k
https://www.youtube.com/watch?v=yuTJ_l2XhNI
https://www.youtube.com/watch?v=KGN5j99Njjo
https://www.youtube.com/watch?v=PpDAztwyt_g
https://www.youtube.com/watch?v=H6_d3AaNCCg
https://www.youtube.com/watch?v=nIGLgcqEceY
https://www.youtube.com/watch?v=HbGG7UjLZEU

You think THIS is Autistic?
There is nothing autistic about this at all!

And how can you hate anime? I love anime; I've completed 170 different anime. You just don't understand...
>>
>>54144209

Look anon, it's a miscege-nation and I'm the prime minister.
>>
>>54144224
>170 different anime
Lightweight.
>>
>>54144224
very
>>
Dealing with UML garbage. I spend more time trying to figure out exactly what little arrowhead/diamond I should be using for the relationship between two classes than I do actually designing the damn program.

Advice on aggregation/composition has ranged from "use the black diamond if the first class completely owns the second class" to "the black diamond is useless, always use the white one" to "the white diamond is not defined in UML" to "don't bother with arrows at all."

There's tons of "don't do this" with no actual suggestions about what to do.
>>
>>54144212
A lot of ASMR actually uses binaural tracks for the audio.

It's pretty good, but I don't usually like to listen on headphones, so I don't get the full benefit of binaurals.
>>
>>54144224
This is autism on a whole nother level
>>
>>54144239
I'll be doing more over the summer.

I only got into anime less than 3 years ago.

With college, though, I don't have as much time to fuck around as I did in high school, when I could 12h on RuneScape over the weekends, and always catch about 3 hours every night.
>>
>>54144283
damn you must be getting a retarded degree to have that much free time
>>
File: 1443755804367.jpg (5 KB, 184x184) Image search: [Google]
1443755804367.jpg
5 KB, 184x184
>http://www.aliexpress.com/item/Best-prices-high-quality-UNO-R3-MEGA328P-for-Arduino-UNO-R3-NO-USB-CABLE/32612797755.html

>mfw 2 bucks

literally how is it so cheap
>>
How the fuck do I make generic algorithms in Java?

Say I'm trying to write a sorting algorithm. The logic is all done but I need to make the sorting algorithm work with generic object arrays. This means making generic arrays, which means everything is fucked.

I can:
>Make a wrapper class and wrap and unwrap the array before and after the sorting (gay)
>wrap array up as arraylist, not sure how I would get that back to a generic array safely
>fuck it, just make the function take a list and deal with the performance hit
>>
>>54144357
>aliexpress
It's a fake you dip
>>
>>54138643
is this what you mean?
array.reverse<-function(A){
B<-A
for(i in 1:length(A)){
B[i] = A[length(A)+1-i]
}
B
}

## EXAMPLES:
#
#
# > myarray <- array(1:10)
# > myarray
# [1] 1 2 3 4 5 6 7 8 9 10
# > array.reverse(myarray)
# [1] 10 9 8 7 6 5 4 3 2 1
#
#
# > myarray <- array(1:10, c(10,1))
# > myarray
# [,1]
# [1,] 1
# [2,] 2
# [3,] 3
# [4,] 4
# [5,] 5
# [6,] 6
# [7,] 7
# [8,] 8
# [9,] 9
# [10,] 10
# > array.reverse(myarray)
# [,1]
# [1,] 10
# [2,] 9
# [3,] 8
# [4,] 7
# [5,] 6
# [6,] 5
# [7,] 4
# [8,] 3
# [9,] 2
# [10,] 1
#
#
# > myarray <- array(c(LETTERS,0:9),c(6,6))
# > myarray
# [,1] [,2] [,3] [,4] [,5] [,6]
# [1,] "A" "G" "M" "S" "Y" "4"
# [2,] "B" "H" "N" "T" "Z" "5"
# [3,] "C" "I" "O" "U" "0" "6"
# [4,] "D" "J" "P" "V" "1" "7"
# [5,] "E" "K" "Q" "W" "2" "8"
# [6,] "F" "L" "R" "X" "3" "9"
# > array.reverse(myarray)
# [,1] [,2] [,3] [,4] [,5] [,6]
# [1,] "9" "3" "X" "R" "L" "F"
# [2,] "8" "2" "W" "Q" "K" "E"
# [3,] "7" "1" "V" "P" "J" "D"
# [4,] "6" "0" "U" "O" "I" "C"
# [5,] "5" "Z" "T" "N" "H" "B"
# [6,] "4" "Y" "S" "M" "G" "A"
>>
>>54144357
This is the programming thread, mate.
I'm pretty sure there is a whole thread for your consumer whore ways.
>>
>>54144329
No, it's Business with Information Technology.

Next year, I'll be taking course in Discrete Maths, Infor Assurance, HCI, and Software Engineering.
I took almost all my business courses in my Associate's degrees, so I was able to take almost all IT courses for my upper levels.

My 2 favorite courses so far were probably Web Systems Development (my final project is gonna be similar to this website), and Systems Analysis and Design. Sys A&D was relaxing, but also fun.

I enjoyed it more and more the more complicated the diagrams got.
>>
>>54144361
Looks like the last. Lists actually aren't that costly of an abstraction as I just found out.
>>
Friendly reminder to filter all tripfags.
>>
File: frame.png (14 KB, 791x820) Image search: [Google]
frame.png
14 KB, 791x820
was pretty tired today so i didnt do much, but i did get about 20 minutes of work done just now
>>
How to start contributing to a FOSS project?
>>
#include <stdio.h>

int main(){

int c = 5, d;
d = ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c;

printf("%d\n", d);

return 0;

}


How much is d?
>>
>>54144498

it starts a nuclear war with russia
>>
>>54144498
138
>>
>>54144498
Launches a nuclear missile at russia
>>
>>54144509
>>54144536
Am I missing a meme here?
>>
>>54144545
It's well known the codes for nuclear missiles back in the 60's were calculated in a similar fashion
>>
>>54144566
Sauce me up brotha, I'd like to know more
>>
>>54138643
That's kind of a retarded restriction, since arrays are implemented with vectors.

#lang typed/racket
(require math/array)

(define arr (array #[9 10 11 12 13] : Real))

(for/array ([i (in-range (array-size arr))])
(array-ref arr [vector (- (sub1 (array-size arr)) i)]))
;-> (mutable-array #[13 12 11 10])
>>
I heard Java is better than C++ and C#.
>>
>>54144604
you heard right
>>
>>54144604
you heard wrong
>>
>>54144604
>>54144610
>>54144616
somebody get out a strawpoll
>>
>>54143454
Lean Lisp. Either Scheme/Racket or Common Lisp
>>
>>54144573
I think you are being rused.
>>
>>54144545
I assume that they're referencing war games or some shit.

>>54144498
Stop posting your stupid shit, faggot.
I've already told you that it's undefined behaviour and the result is completely meaningless.
>>
File: download.jpg (6 KB, 225x225) Image search: [Google]
download.jpg
6 KB, 225x225
>>54144498
>How much is d?

Completely free.
>>
File: 1461011038295.png (850 KB, 600x919) Image search: [Google]
1461011038295.png
850 KB, 600x919
i want to program a maki
>>
>>54144449
Looking good. Keep it up, anon!
>>
>>54144628
this, Lisps are great regardless of whether you prefer imperative programming, functional programming, or OOP
>>54144660
thanks senpai~
>>
>>54144653
all the new software in Facebook is C++
like their new webserver and http library

kinda sad this retard didn't do Dlang properly
>>
>>54144640
Order of operations is well defined. Prefix increment occurs before addition and goes right to left.
>>
>>54144673
Good for me. If facebook is switching you know every cuck executive officer will but chomping at the bit to get theirs to C++ as well.

I know a lot of c++
>>
>>54144673
>kinda sad this retard didn't do Dlang properly
>retard

Please, share with us your great C++ contributions.
>>
>>54144680
You're completely wrong, idiot.
>>
File: java.jpg (221 KB, 1024x768) Image search: [Google]
java.jpg
221 KB, 1024x768
>>54144680
Don't mind him. He's a retard.
>>
>>54144498

Why does this print 14? Shouldn't it be 6+7?
int c = 5, d;
d = (++c + ++c);
printf("%d\n", d);
>>
>>54144735
the ++c are calculated before they are added together
>>
>>54144708
He's right and you suck.
>>
>>54144691
facebook has always used C++
but D was suppose to be the next thing for them, since Andrei worked there as well and used his experience on the pitfalls of C++ there to help develop D
>>
>>54144739
Not that guy, but I still don't get it.
>>
>>54144773
its broken down to

inc c
inc c
add c, d
add c, d
>>
>>54144735
Returns 13 in Java
Thread replies: 255
Thread images: 27

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.