[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: 44
File: 1450727871328.jpg (46 KB, 306x523) Image search: [Google]
1450727871328.jpg
46 KB, 306x523
Previous thread: >>52649919

OBJECT-ORIENTED PROGRAMMING ÜBERMENSCH

NO MULTIPLE CLASS INHERITANCE

STATIC TYPING

RESTRICTED TYPE INFERENCE

NO USER-DEFINED OPERATOR OVERLOADING

PASS-BY-VALUE ONLY

JAVA ÜBER ALLES

SIEG HEIL
>>
Daily reminder that mutable variables are just a function of time

a pure function
>>
J A V A
A
V
A
>>
Threadly reminder that OCaml is the only good programming language.
>>
File: 1443623959566.jpg (39 KB, 510x624) Image search: [Google]
1443623959566.jpg
39 KB, 510x624
>>52652503
>NO USER-DEFINED OPERATOR OVERLOADING

That was always dumb. Just make your own function and leave the operators alone.
>>
>>52652503
import faggot
print op is a faggot
goto kill you're self
>>
>>52652561

>user defined operators are bad
user defined functions are fine<
>>
>>52652519
That's deep
>>
>>52652593
>unused import
>print doesn't work
>gotos in python
>kill
>you're self
>>
dpt help I need a word that means 'in order' or 'front to back'. Like the opposite of 'reversed'

Its for an option I have on a list. The list can be normal or reversed... dunno what to call the two options though
>>
>>52652620
>only python has import and print
>>
>>52652624
1.) faggot
2.) straight
>>
>>52652503
>single inheritance
>static typing
>potato-powered inference
>no overloading
>pass-by-value

>literally the sum of everything that is wrong in ALGOL-family "OOP languages
>mfw Common Lisp Master Race
>muh CLOS
>muh multiple inheritance
>muh dynamic typing
>muh inferences
>muh generic functions
>muh references

COMMON LISP ÜBER ALLES, DU LUMPENPROLETAR
>>
>>52652646
yes.
>>
>>52652624
Sorted
>>
>>52652624
monotonic is probably not what you're looking for but i thought i'd mention it anyway
>>
File: mfw.jpg (11 KB, 200x200) Image search: [Google]
mfw.jpg
11 KB, 200x200
>>52652624
>crossword puzzles literally make you a better programmer
>>
import classname as c

i fucking hate when people do this, especially when the original classname was something short and simple

we're not typing on mechanical keyboards that need ten pounds of pressure per keypress anymore, you don't need to shorten everything
>>
>>52652624
ascending vs descending?
>>
>>52652713
>not knowing that one guy that thinks mechanical keyboards are better
>>
>>52652503
img soruce?
>>
>>52652653
>literally the sum of everything that is wrong in smalltalk-family "OOP languages
>mfw OCaml Master Race
>muh Object
>muh multiple inheritance
>muh static, capability-based typing
>muh inferences
>muh row polymorphism AND column polyphormism
>muh references
>>
>>52652503
Fuck... Now that's a real woman... 10/10 would marry.
>>
>>52652561
>can't + vectors because some babbies might abuse them
>>
>>52652738
could you pls explain what row and column polymorphism are for us lesser plebs
>>
So why isn't it spelled like JΛVΛ?

Because no one who made java is that creative
>>
Why do people argue about inane languages differences? Don't you guys have better uses of your time like learning new languages or things?

Just use whatever is best for the job.
>>
>>52652738
>claims Common Lisp has everything wrong
>proceeds to list almost all of the capabilities of Common Lisp as right

dat column polimorphism tho
>>
>>52652808
>not arguing about programming on the internet

get a life loser
>>
>>52652766
Row polymorphism is when any class with the same minimal set of requirements implemented can be used. For example, if you call some_instance.x, then if the inferred type is of the form Class{x : some_type; ...}, that's row polymorphism.

Column polymorphism is "classical" polymorphism. If class X is a descendent of class Y, then class X can be used anywhere class Y is required.
>>
>>52652808
>static vs dynamic typing
>inane
kill yourself
>>
>Pass by value only
>Java
But in Java, objects are passed by pointer. You can invoke a method on an object parameter that would mutate the object, and have that mutation stay after the end of the function call. In C++, you have explicit control over whether objects are copied, passed by reference, or by immutable reference. Rust is the same way, but we don't call it object oriented.
>>
>>52652807
√∧∨∧
>>
>>52652834
the reference is the value
>>
Why can't I into OOP? Should I just switch to C++
>>
>>52652827
thank you

when C++ gets concepts it'll get row polymorphism (well in a more formal way than just guessing)
>>
>>52652808
Because they have nothing else to do.
Certainly not stuff like actually programming
>>
>>52652834
As expected of a tripfag: being retarded is the only thing they know to do.
>>
Can we just take a moment to appreciate how absolutely perfect the women in the OP is
>>
>>52652848
see https://archive.rebeccablacktech.com/g/thread/S52476540#p52479462
>>
>>52652847

So Java can't say it passes objects by value. It passes object pointers by value.
>>
>>52652894
pointers are objects
>>
>>52652894
there is no object variable. the variables are object references. you pass those as values, you don't pass a reference to the object reference.

http://javadude.com/articles/passbyvalue.htm
>>
Is functional programming a meme?
>>
>>52652938
Programming is a meme
>>
File: maxresdefault.jpg (74 KB, 1440x1080) Image search: [Google]
maxresdefault.jpg
74 KB, 1440x1080
>>52652873
>can only isolate code in OOP
>>
for example

Nigger nigger = new BitchNigger();
Nigger bitchNigger = nigger;
kill(nigger);
assert(nigger == bitchNigger);
>>
>>52652925

>There is no object variable
The problem with Java in a nutshell.
>>
>>52652519
What happens at a certain time in the future is not deterministic.
>>
>>52652716
Yeah I like that
thanks anon
>>
>>52652938
You're a meme.
>>
>>52652977
Prove it, faggot
>>
File: thiskillsthekiko.jpg (4 KB, 125x124) Image search: [Google]
thiskillsthekiko.jpg
4 KB, 125x124
Let me preface this by saying I'm a complete and utter dingus.

I do have a Neopets-tier understanding of html, but that's about it.

I have an idea for a website, but I'm not really sure where to start.

I want to make one of those charity websites with the one click to donate button, but have one button donate for multiple causes.

That, and have it so petitions are way easier to fill out and require less datamining and no spam emails.

pls no bully
>>
>>52652938
yes

pure FP fags will tell you that state isn't state if you pass it as function I/O
>>
>>52652998
GET THE FUCK OUT YOU FUCKING WEB DEV WANNABE
REEEEEEEEEEEEEEEEEEEEEEEEEE
>>
>>52652998
>>>/g/wdg
>>
>>52652503
Why wont this code replace every line starting with "var"???

a = a.replaceAll("^var", "");
>>
>>52652998
Use OCaml.
>>
>>52653020
>>52653035
Sorry, wrong thread.

>>52653100
I'll take a look at it, thanks for the recommendation!
>>
Guys, if I wanted to make something like a synth, what should I know?
I'm thinking about using this as an opportunity to learn C++, anyone knows any good resources for writing synths?
>>
>>52652690
>it take longer to think of a decent function name than it does to write the function
Just
>>
relatively speaking how hard is it to maintain/setup a server on a raspberry pi?
>>
>>52653176
for music theory i can recommend the video series
>TTC - How Music and Mathematics Relate

a few of the videos were somewhat off-topic for what i wanted but still a bit interesting

i'm also interested in synthesizing music and i haven't been able to find much useful information

you can try taking a pure sine wave and multiplying it with a square wave of half the frequency or a saw wave of the same frequency to get a very basic sound using ring modulation. listen to it and plot the spectrum of the recording in audacity to check out the harmonic frequencies
>>
>>52653204
Ask your SJW overlords on >>>/reddit/
>>
Where would I find the regular unix lint tool? There's splint but I don't want to litter my code /*@@*/ all over the place.
>>
>>52653237
>harmonic frequencies
harmonic overtones i mean
>>
>>52652525
>>52651139
Try interfacing with libs made in any other fucking language.

Char is (in a sane language) unsigned so you can make full use of ASCII or whatever encoding you like for byte buffers.

The lack of such a F U N D A M E N T A L feature in Java to makes things "simpler" means you are forced to fucking bitshift and cast on a per byte basis, exactly the kind of thing you want to avoid in a high level language.
This isn't just a case of "muh memory" and using smaller types to save space, the JNI doesn't give you a fucking choice in the matter, block data is moved around in byte buffers. SIGNED byte buffers, whether you want them or not.
>>
Array1=(int*)malloc(5*sizeof(int));

i get an error when i free(Array1), however it doesnt happen if i change 5 to 10 or something else why does this happen?
>>
>>52653344
just use a native ByteBuffer (literally a pointer to a malloced buffer), you shouldn't need to operate on a buffer in java anyway, you can just use a JNI method for that
>>
>>52653365
Please learn how to ask questions. It'll do you a lot of good.
>>
>>52653344
>char
>unsigned
>in sane languages
Guess C is insane then. Well, not like it ain't but.
>>
>>52653237
I know a fair bit of music theory, but how does it help in making a synth?
For example, how would I go for making just a sine wave? Should I write something that returns me samples continuously? And how to make these numbers into sound? And what about things like filters? I'd like to know if there was something to guide me there
>>
>>52653420
>JNI
Nobody wants an aneurism. Do you?
>>
>>52653365
'code is kill'
'no'
>>
>>52653365
>not ocaml
Found your problem!
>>
>>52652950
but it is the most sane way to do it
>>
>>52653449
>>52653466
My question is fine.
After doing the malloc I posted, at some point I do free(Array1); and I get crash on run.
If I change that 5 on malloc to something like 10 or 9 or whatever, there's no problem on run.
>>
>>52653420
>you shouldn't need to operate on a buffer in java anyway

Who are you to tell people what they should or shouldn't need to use?

>just use a native ByteBuffer
That's literally what I said I've been doing, the problem is java has no fucking way to store 8-bit values unsigned.
You have to bitshift and cast everything up into an int array.

Then if you want to send anything back to the native lib, you're gonna do the same thing in reverse.

Making things "simple" by lacking basic features and forcing people to do menial tasks by hand is not actually simple, its retarded.

>>52653452
It can default to unsigned, implementation dependant. If you know you're gonna use values <0 or >127 you have to specify signed or unsigned.
>>
>>52653527
'what is crash?'
'no'
>>
>>52653533
Well you don't """have""" to, but enjoy your undefined behaviour if you don't.
>>
>>52653237
scratch that

for a 440 Hz sound use a 220 Hz sine * 220 Hz square or 440 Hz sine * 440 Hz sawtooth

>>52653457
use the sin function or a sine wave table lookup function. like if you have a 44100 Hz sample rate, if you increment t by 0.01/(2*pi) for each sample then sin(t)*volume will give you a 441 sine wave. use something like opensl so you have something to write samples to.
>>
>>52653533
lol k tard i'm not here to tend to your silly little issues
>>
>>52653344
http://stackoverflow.com/questions/16809009/using-char-as-an-unsigned-16-bit-value-in-java
>>
>>52653578
>Accessing block data from native language through JNI
>"""Silly little issue"""

>>52653660
Yes you can use bitmasks, but isn't Java supposed to jest werk™?

All these fluff helper methods, but something as simple as accessing native memory is made convoluted because "nobody needs unsigned bytes".
>>
>>52653713
how is it remotely difficult to do (b & 0xFF)? are you the same butthurt retarded faggot that's been whining about this for literally like a year or more?
>>
>>52653204
Shitty idea in terms of maintainance because bumping into it could dislodge the AC cable.
>>
>>52653732
>>52653713
what are you even using the bytes for and if you're already getting the bytes from JNI why can't you use JNI to process them?
>>
>>52653750
>>52653713
you have to admit that this is really an edgy use case and the solution is simple.

high-level languages don't need unsigned bytes if they have two's complement signed bytes.
>>
File: CoputerSC.png (546 KB, 873x573) Image search: [Google]
CoputerSC.png
546 KB, 873x573
https://www.youtube.com/watch?v=5jmN_tBS0t4

what do you think of this /g/ ?

tl;dw:
computer science is boring but you need to major in it for the money
>>
>>52653793
fucktards, fucktards everywhere
>>
>>52653793
>computer science is boring
Not to everyone.

Admittedly, it is boring to the average male, and even more boring to the average female,
>>
>>52652653
>ALGOL-family "OOP languages
OOP in ALGOL-family languages is primarily about coroutines and message-passing concurrency (Simula, BETA, Ada).

Lisp shills can't seem to understand concurrency. It reminds me of the time when they read up on the Actor model, which is all about concurrency, and created Scheme, which has no concurrency at all.
>>
>>52653793
>bitch so dumb, she think CS is programming
Ayo
>>
>>52653793
Retarded, if you find it boring and only do it for the money gtfo
>>
>>52653839
>scheme
>no concurrency
>actor model
>related to scheme
>lisp
>not the paragon of proper concurrency
You're hilarious, kiddo.
>>
>>52653309
kill yourself idiot. you need to mask off individual bytes anyway, just that the compiler does it for you implicitly. and the bit representation is exactly the same.
>>
Can anyone help me to install the SDL- and SDL_mixer libraries and use them?
>>
>>52653843
i don't. i'm still in high school and CS subjects are already my favourite
>>52653793
also says CS doesn't require math
>>
>>52653793
everyone please downvote this fucktarded video
>>
>>52653732
It's not difficult, but it's low level. Everything else has a layer of abstraction, so why not this?

>>52653750
>>52653779
>this is really an edgy use case
So what, the only argument I've seen for Java not having unsigned types is "nobody needs them". Clearly people do on the odd occasion, so why restrict them?
>>
File: 134257380020.jpg (34 KB, 288x499) Image search: [Google]
134257380020.jpg
34 KB, 288x499
>Making something
>Want to use a JSON API
>It's JSONP
>That's fine, I can work with that
>No documentation
>>
>>52653968
It's Javafags' arguments for everything
>Why doesn't Java gave X
>lol who needs X
>>
>>52653865
>Java is a high level language :^)
>Except when it makes you go low level due to baseless restrictions
>>
>>52654015
*have
>>
>>52653985
Fuck it, I'm done with this project, good job IMDb API.

Go fuck yourself.
>>
>>52653968
TELL ME YOUR USE CASE RETARD I BET IT'S RETARDED AS SHIT AND TOP KEK AT BEING TOO LAZY TO TYPE (b & 0xFF) AND YOU *ARE* IN FACT DOING A "LOW LEVEL" PART OF JAVA BY USING JNI SO FUCKING KILL YOURSELF RETARD

>>52654017
>& 0xFF is too difficult to me and a high level language should cater to my specific needs and create a whole type just for me which i don't even need but i demand it because i'm special

OK I'M SURE THE JAVA DESIGNERS WILL HEED YOUR REQUEST... NOT

AHAHAHAHAHA RETARD
>>
>>52652503
>OOP masterrace
functional is better
>Java
kek , no
>sieg heil

yes
>>
>>52654051
What problems are you having?

What's so hard about reading JSON into data objects?
>>
>>52654148
>No documentation

They want me to sit here reverse engineering a URL construction method and then guessing what data I'll be served from different queries to then create a data object for each type of query.

For an application that is only for the practice, I don't have any plans to actually use the damn thing even.
>>
>tfw finally got around to vimtutor
God damn, I can see why people love vim so much. Any recommended extensions, specifically for C++?
>>
File: djNzA2Q.png (72 KB, 732x841) Image search: [Google]
djNzA2Q.png
72 KB, 732x841
>>52654198
Have you considered using http://www.omdbapi.com/ instead?
>>
>>52654221
The only plugin I really use is ctrlp. https://github.com/ctrlpvim/ctrlp.vim
>>
>>52654251
Yeah but the whole "We're in beta give us money if you want to request posters" thing put me off, mainly because the posters thing was what I was most interested in.
>>
File: convex_or_concave.webm (1 MB, 720x720) Image search: [Google]
convex_or_concave.webm
1 MB, 720x720
Ask your favorite programming literate anything.

>>52654126
oop and functional are not exclusive to each other
>>
People that can't program always blame the language.
>>
>>52654287
i can't program and i never blame the language desu but i know what you mean
>>
>>52654287
yes like this insufferable faggot: >>52653968

he literally doesn't need unsigned bytes when he has two's complement signed bytes with the exact same bit representation, and he can always operate on the native buffer with his native unsigned chars in native code anyway.
>>
What's the best modern C resource to learn from, if I already know how to program?
>K&R is boring and slow
>>
>>52654071
In the first post I explained that I was bitmasking (and casting) to get around the issue.
I've repeated multiple times that I already have the "solution" to the problem, but that it seems like a dirty hack and really there should be an layer of abstraction around this.
Instead, all you faggots can reply with is "HURR JUST USE & 0xFF".

Use case doesn't really matter, byte buffer comes in, java thinks it's signed but it's not, data needs to be offset (absolute and scaled) and then put back on another byte buffer.
Oh, and the only fucking reason we have Java doing this instead of the original native lib is because libusb and Java do not play together nicely on Android.

>& 0xFF is too difficult to me
Projecting this hard. Bitmasking is the least of my worries trying to mangle C and Java together with the abomination of the JNI.

The point is, are there any actual arguments as to why Java SHOULDN'T support unsigned types, like the large fucking majority of languages?

>B-but nobody needs it!
>Your use case is silly!
>Do it the Java™ way :^)
>>
http://www.ffconsultancy.com/ocaml/ray_tracer/languages.html
Why haven't you switched to ocaml yet? It's slower than C++ but it is significantly faster to develop in and is significantly faster than other options.
>>
Should I a Scala?
>>
>>52654492
My gf uses Scala, you shouldn't
>>
>>52654285
If I continue to use C# will my penis gradually increase in size?
>>
>>52654539
no, use D for that
>>
>>52654539
Yes.
>>
File: 1364902899779.jpg (35 KB, 640x480) Image search: [Google]
1364902899779.jpg
35 KB, 640x480
>>52654562
>>
>>52654418
a high-level language doesn't need unsigned bytes

java has two's complement signed bytes which have exactly the same bit representation as unsigned bytes

java also has chars which are unsigned

>Use case doesn't really matter, byte buffer comes in, java thinks it's signed but it's not, data needs to be offset (absolute and scaled) and then put back on another byte buffer.
the use case does matter you fucking retard because i'm pretty sure you're "solving" it in a retarded and inefficient way

>libusb and Java do not play together nicely on Android
l2jni retard
>>
So if I have an Nth-Order Markov chain, I have N different datasets, right?

So let's I have an input of X length.

After updating all X > 0 chains, do I pull from the X-order chain exclusively? Or do I consult the X-1, X-2, etc chains also? If so, how do I choose between them?

I'm self taught and haven't taken math above a high school level, so everything online on the subject is super confusing to me.
>>
File: le jacksonvillian reaction man.gif (2 MB, 236x224) Image search: [Google]
le jacksonvillian reaction man.gif
2 MB, 236x224
http://web.cs.ucla.edu/classes/winter16/cs35L/assign/assign4.html

>this is my assignment
>>
>>52654539
No, only if you use OCaml.
>>
>>52654667
This is an absolutely fantastic assignment, because it's just as retarded as real world tasks are, and sounds like something that might actually have happened somewhere at some point.
>>
>>52654667
tl:dr;?
>>
>>52654592
>I don't need unsigned bytes so nobody does :^)

>java has two's complement signed bytes which have exactly the same bit representation as unsigned bytes
Woks great for simple addition/subtraction, not so great for multiplication/division scaling.

>java also has chars which are unsigned
So I can bitmask and and cast to chars instead of ints, great

>the use case does matter you fucking retard because i'm pretty sure you're "solving" it in a retarded and inefficient way
I'm not giving you the details because they're going to go way over yoru fucking head, as evidenced by your last sentence.
Java reads from USB device, needs to mangle the bytes, then put them into native memory.
Yes, what I'm doing is inefficient, because Java does not have an efficient way of fucking doing this shit.

>l2jni retard
You've never actually tried have you? The way file descriptors (and permissions) are handled in Android is completely fucking incompatible.
If your lib requires libusb, it won't work with Android, end of story.
>>
>>52654715
yeah but then you get all the "muh GNU" "muh emacs" stuff so it ends up being annoying

I had trusted /g/ and thought CS classes at university were easy stuff that wasn't relevant :(
>>
>>52654667
Glad to see they're still teaching useless garbage in school
>>
File: 3mLydMU.png (70 KB, 243x200) Image search: [Google]
3mLydMU.png
70 KB, 243x200
>>52654747
KILL YOURSELF RETARD YOU ARE BAD AND YOU SHOULD FEEL BAD

JUST MANGLE THE BYTES ON THE NATIVE SIDE THAT'S THE PERFECTLY LOGICAL SOLUTION
>>
Or you could just use a better language than Java a.k.a. D
>>
>>52654667
enjoy being tens of thousands of dollars in debt and having wasted years of your limited time on this planet to "learn" this fucking useless garbage
>>
>>52654847
>2016
>paying for university
>not getting a full ride because you're poor
>>
>>52654872
i just assumed you were an average american pleb

if you're poor then going to college is a good shot at improving your economic status if you work hard desu senpai
>>
>>52654915
in the US if you can't actually pay you won't have to assuming you're not going to one of those ITT Tech or University of Phoenix style schools (those are the ones that build up useless debt for most people)

im fine with this program because the average starting salary is $95k or something like that which isn't that bad
>>
>>52654452
>but it is significantly faster to develop in
[citation needed]
>>
>>52654747
Why won't you just describe what you're doing?
>>
>>52652918
pointers most certainly are not objects.
>>
>>52654960
It's all in the source.
>>
>>52655040
Where?
>>
I only know C.
Give me a project to do, I'm sick of doing hackerrank-style tutorial shit.
>>
>>52655027
he's been insufferably buttblasted about this "issue" for like more than a year, i don't think he'll ever spill the beans

but really if he's reading from a USB device in java, mangling the bytes, storing them on the native side, he should really be doing the mangling on the native side too
>>
>>52654452
>and is significantly faster than other options.

http://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=ocaml&lang2=go
http://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=ocaml&lang2=rust
http://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=ocaml&lang2=gnat
http://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=ocaml&lang2=clojure
>>
>>52655065
Teach me how to get variables from a website.
>>
>>52655134
download the json and parse it
>>
>>52655069
I don't get what mangling the bytes means. I'm assuming he gets some data Java-side as bytes... then you send them C-side (heh) via JNI.

Then, if you want, you can cast them to unsigned chars... whether or not thats okay depends on what the values of the bytes from Java actually mean I think
>>
>>52655102
>4.02.1
>>
>>52654823
>>52655069
>What are checksums?
>What is validation checking?

It's reading from a USB connection. Maybe the data needs to be checked before it's merrily passed along as garbage.

Why the fuck would I give all the details to a bunch of NEETs on a Mongolian cave painting messenger service who don't even understands how the fuck USB connections "work" on Android?

Java is fine if all you do is Java and you never interface with other languages. It's a fucking shitstorm if you actually want to do something useful, unless you feel like rewriting numerous libraries because of subtle incompatibilities.
>>
>>52655245
>still beats the languages listed
>>
>>52655253
k tard
>>
>>52654452
Yes, a standard library and a package ecosystem stuck in 1990 really boost productivity.
>>
>>52655253
HERE'S HOW YOU DO IT YOU FUCKING TARD

PASS THE JAVA ARRAY TO NATIVE

YOU CAN DO IT WITHOUT EVEN COPYING THE DATA (IT'S JUST NOT GUARANTEED THAT IT WON'T COPY DEPENDING ON THE IMPLEMENTATION) SO THERE IS NO APPRECIABLE OVERHEAD INVOLVED, ESPECIALLY COMPARED TO THE CRAP YOU'RE DOING

DO THE CHECKING SHIT AND EVERYTHING ELSE IN NATIVE

SIMPLE AS THAT

FUCKING TARD
>>
>>52655314
>unironically trying to use compiler-only tools to build programs
>blames the language
There you have it, folks: OCaml comes with a retard filter built in. Does YOUR language?
>>
>>52654452
>no multicore
>dying community
>>
>>52655419
>https://github.com/ocamllabs/ocaml-multicore
>increasing community
>>
>>52655347
>modify the functionality of native library so it no longer works on other platforms
How about no?

What you're suggesting is to break the loose coupling, making a library that used to just take in clean data now have to worry about error checking.

I think I should just stop replying to CAPS CONTROL IS CRUISE CONTROL FOR COOL, clearly you're the best java guru™ here and cannot explain things at my level of understanding.
>>
>>52655370
Can you please stop? If you want to shill Ocaml, please post intesting code instead of shoehorning into every concersation.
>>
>>52655509
God this

I'm a FP fanatic and this guy makes me want to write fucking Java
>>
>>52655493
>compiling a shared object to 3-4 archs is hard
>>
>>52655509
>>52655535
I see the imperative shills are getting scared. OCaml stronk!
>>
>>52655493
I fail to see what any of this has to do with Java and signed bytes. You are being so confusing and when anyone asks you to clarify you just get mad and dismiss everything
>>
>>52655578
this. you're literally the only person i've ever seen who has expressed even the slightest buttmad about java not having unsigned bytes.
>>
>>52655596
Thank you pajeesh. Your 100 rupees have been deposited in your account.

Oracle. Make India Great Again. (tm)
>>
How do you get the accerelometer sensor data on Android emulator?

SensorSimulator seems to be out of development since 2014.
>>
>>52655628
Don't be a retard and use the SDK.
>>
>>52655624
you're the one being a ridiculously incompetent code monkey. if you want loose coupling just make a separate native method or an entirely different shared object to clean up the data
>>
>>52655572
No interesting code, then?
>>
>>52655649
I'm sorry Pajeesh, but we are all out of bonus Rupee. But don't worry, if you work hard, I'm sure you'll get a raise!

Oracle. Make India Great Again. (tm)
>>
File: 1453653438710.gif (101 KB, 940x613) Image search: [Google]
1453653438710.gif
101 KB, 940x613
It's been an incredibly fruitful day lads. As shown by the highlighted text, I've added python-like multi-var assignments on a single line, as well as multiple operations to 1 variable on a line

Additionally, I pretty much finished my entire gameplay algorithms at work today. All that's left is to detect if all goal spots are filled and go to win screen if they are.

I haven't taken full advantage of sound functionality either so I'll probably have that played upon pushing a box.

I'm also going to touch up my snake code so it fits my new high-level language as well as juice it with fireworks and fanfare when you win.
>>
>>52655624
You're so incredibly angry and refuse to listen to reason or explain your problem

It shouldn't matter that Java has signed bytes; all that matters is what the thing you are reading data from wants the bytes to be interpreted as.

Once you get to C-land you can just cast your byte buffer to signed or unsigned as you see fit and interpret the data however it should be interpreted.

If you have to do anything to do the data before you can 'read' it the way you want, thats probably the fault of the usb device for being weird.
>>
>>52655676
epic meme. i guess next year we'll have this same "discussion" yet again?
>>
>>52655648
Sorry, I don't understand?
>>
>>52655628
get a real device imo it doesn't have to be overly expensive
>>
File: 1447080353574.jpg (101 KB, 513x486) Image search: [Google]
1447080353574.jpg
101 KB, 513x486
>>52655676
I can understand being mad because JNI is really fucking horrible and exhausting to use but you're just acting like a straight up baby.
>>
>>52655473
ocaml multicore is only for the c interpreter. it has no support at all, there were just 2 guys working on it as a experimental project. it's dead and unusable.
>>increasing community
most of swiss banks have moved to haskell or f#
ocaml mailing list is dead
it's rare to see new libraries on opam
there are already more job offerings for f# than ocaml
the project for compiling ocaml to javascript is dead
>>
>>52655678
Sorry about last night. I was brutally raped and the bastards stole my poutine, so I tried to hitchhike back but I got kidnapped. I managed to escape because I'm skinny and ropes generally don't hold me for very long and I ran away as fast as I could. I found a local diner but they refused to serve me because I had no shirt, they just kept saying "no shirt no shoes no service", when clearly I had 1 out of 2 of those items. I angrily and hungrily left and tried the hitchhiking thing, but my reflective vest was torn off of me and I was hit by the first car I saw... They didn't stop. I started walking in the direction I thought was the correct way by following the stars, but it turns out I don't know anything about geology. Or terminology. I eventually found an abandoned greyhound tour bus parked in front of a museum so I sto-- made it unabandoned and drove until I found a highway. Some "onstar" bullshit started talking to me, I assume because I upset the geology gods, so I punched it until it stopped. I followed the signs and eventually made it back home.

Anyway, raincheck on the beers?
>>
>>52655578
>>52655596
Being used to unsigned data types is like being used to prefix and postfix increments.
It's not the biggest thing in the world to just manually increment with +=1 instead, but it's also such a well used feature you'd wonder why the fuck it's not just built in.

Yes there are workarounds, yes they are not actually very complicated, but they require you to think on a much lower level than you would if it jest werked™ like Java generally advertises.

>>52655624
>>52655676
Obvious shitposts are obvious
>>
>>52655739
Please don't talk out of your ass this much, the amount of nonsense you spout might rupture your anus.
>>
>>52655747
It's getting warm you cock. I can't keep the fridge on all night
>>
>>52655749
it's literally this one (RETARDED) use case where this is a "problem". not having unsigned bytes eliminates the shitfest that can occur when you have both signed and unsigned types at the same time.
>>
>>52655678
>Additionally, I pretty much finished my entire gameplay algorithms at work today
Tell me your secret.
>>
>>52655712
I do have a real device, but I also want to make a video of the app that uses accelerator data.

I guess I could use some phone screen recording software.
>>
How can I declare double space in C?
if (c == doublespace)
>>
File: 1451754656606.png (17 KB, 418x359) Image search: [Google]
1451754656606.png
17 KB, 418x359
>>52655792
m8 I'm only contracted, and I've got this target to finish 4 epos upgrades a day

some days I do 8 or 10, so I have all this dev time
>>
>>52655816
perhaps try recording the accerelometer data from the device and then play it back on the emulator?
>>
>>52655787
Default to signed, like you would anyway to not break existing code.
Make people use supr sekrit handshakes to activate the unsigned beast, I don't give a shit, just don't disable it completely because some people can't into unsigned.

Maybe it's more of a flaw with the JNI than Java itself, either way it shows that enterprise™ code isn't really that great for making high level wrappers for low level shit.
I was under the impression that was kinda the appeal to Java?
>>
>>52655774
>can't keep the fridge on all night
What kind of a poorfag are you?
>>
>>52655817
if c[i] == space && c[i+1] == space) {
}
>>
>>52655881
It's broken lad, now hurry the fuck over here
>>
>>52655874
you're the one who's flawed, not java or JNI in this case
>>
>>52655852
<.< ummm that sounds a bit too high for my current skill level, just being honest
>>
>>52655874
>>52655900
also this is some very obscure android+usb device shit you have to realize this. it's not a typical "enterprise" application.
>>
>>52655916
I don't think anyone is going to give you any sort of credibility unless you can actually explain what the problem is
>>
>>52655764
are you 12yo or something ?
>>
>>52655774
I'm not >>52655881 but that was pretty much my thought too.
Just unplug it, fridges are only meant for beer anyway, so plug it back in 20 minutes before you want a drink.
Better yet, just wrap your beer in a wet paper towel and put it in the freeze for 5 minutes. Ice cold beer.

Usually I just bring a couple in my room and put them in the window since I live in Canada where -40 temperatures isn't uncommon, but it's like +5c here right now, no idea who the fuck broke Canada. I blame refugees.
>>
>>52655896
>>52656011
forgot to clarify, but because it's broken, it goes incredibly cold, the fridge is almost like a freezer

those are good beer ideas though, thanks, and yes, chill out on the refugees
>>
>>52655825
So I assume you keep your GitHub account a secret.
>>
>>52656116
not at all, you can steal my code if you want:
https://github.com/vinheim3
>>
>>52656077
>chill out on the refugees
no.
>>
>>52655916
It's literally one small example of a lack of abstraction in what claims to be a high level language.

I'm not even going to bother talking about the real horrors of the JNI, like implementing C structs and unions (specifically anonymous unions).
Maybe you can blame that partially on C, but even so it's a fucking nightmare.

>>52655961
There isn't a problem, I never said there was a problem. Everyone has been asking for details to solve a "problem" that doesn't fucking exist, because the interface already works, just horribly inefficiently.
My point was that a lack of unsigned types means resorting to low level shit in what would otherwise be 100% high level code, with the JNI managing all the low level stuff for you.
I just expected the JVM would do a much better job internally than manually bitmasking in a for loop over an array. Obviously I expected too much.

>hurr just do it native
Sure, but that still doesn't get around the point that Java is really struggling to perform a quite simple task without its hand being held.
Also the component it's meant to be replacing did all of this stuff just fine, so it would have been nice to have a 1-to-1 replacement, rather than 2 half-baked components.
>>
>>52655961
the problem is that he's too much of a baby to have a certain part of the code together with his other native code and he's also uncomfortable with writing (b & 0xFF) or u(b).

>>52656244
java keeps a fairly "minimalist" approach for being a high-level language. if you want countless high-level features then maybe C# or python is for you. you can use C# with xamarin.

>I just expected the JVM would do a much better job internally than manually bitmasking in a for loop over an array.
that's what compilers in other languages do anyway, at least on architectures that don't have single byte registers.

>Sure, but that still doesn't get around the point that Java is really struggling to perform a quite simple task without its hand being held.
literal asperger's

kill yourself.
>>
A rather lazy script for applying stack obfuscation and some jmp shuffling to fasm sources

i.e.
; Allocate scratch space
push 629
mov [esp+-248], 0x40
lea esp, [esp-240]
mov [esp+-492], 0x1000
mov [esp+-496], VM_SCRATCH_SIZE
push 6561
mov [esp+-504], 0
lea esp, [esp+508] ; reset
vm_virtualalloc_patch_location_1: ;control flow
push 7399
lea esp, [esp+4] ; reset
call dword [VirtualAlloc] ;control flow
push eax
push 3332



Super easy to clean up or just look past, but at least it generates different signatures
>>
File: 1453686234461.jpg (18 KB, 251x242) Image search: [Google]
1453686234461.jpg
18 KB, 251x242
>>52656448
>java keeps a fairly "minimalist" approach for being a high-level language.
>>
File: 1405149485604.gif (947 KB, 345x502) Image search: [Google]
1405149485604.gif
947 KB, 345x502
Beginner here. Why am I shit, where can I improve?

class StringReverse {

public static void main(String args[]){

String word = "Speghetti";
int len = word.length() - 1;
System.out.println(word);
int i = -1;
int c = 0;
String word2 = "";
while (i < len){
char cur = word.charAt(len);
word2 += cur;
//System.out.println("len = " + len + "\nc = " + c + "\nletter = " + cur + "\n");
len -= 1;
c += 1;
}
System.out.println(word2);
}

}
>>
How viable is freelancing? Anyone here does it professionally (instead of doing it when the opportunity arises)
>>
>>52656567
>Why am I shit
you're using a meme language
>>
>>52656567
"This is now your porno"?
>>
File: 1345661034056.gif (2 MB, 316x213) Image search: [Google]
1345661034056.gif
2 MB, 316x213
>text editor replaces all white-space-only lines with empty lines
>not sure if I like it better this way
>>
>>52656546
>hurr java "lacks" these and those "features"
>durr java isn't "minimalist"
java is actually every simple and elegant you retarded fucking memer. everything has been designed with great care and unnecessary features have been omitted. the syntax is consistent and clean.
>>
>>52652525
C++
+
+
>>
File: 1453681228232.jpg (18 KB, 251x242) Image search: [Google]
1453681228232.jpg
18 KB, 251x242
>>52656655
>java
>simple and elegant
>>
>>52656652
Unless you start using an editor that can't bring auto indent to the right level when you modify blank lines, why would you want white-space only lines ever?
>>
File: agdg wisdom on coding.png (94 KB, 809x651) Image search: [Google]
agdg wisdom on coding.png
94 KB, 809x651
>>
>>52656694
epic
>>
File: 1451792175635.png (44 KB, 253x271) Image search: [Google]
1451792175635.png
44 KB, 253x271
>>52654646
Please respond
>>
>>52656708
It could save me a second or two if I want to add some code to an existing pseudo-blank line. Otherwise i have to either add spaces to it or delete it, go to the previous line and then hit enter.

Either way, the benefits/drawbacks are so minuscule I'm not even sure why I'm so torn over it. Autism, I guess.
>>
>>52656448
>if you want countless high-level features then maybe C# or python is for you

I thought it was quite obvious I wasn't using Java because I wanted to, but more of a requirement of porting to Android.
>>
File: 1405428184845.gif (1 MB, 306x177) Image search: [Google]
1405428184845.gif
1 MB, 306x177
>>52656650
I dunno what she be saying.
>>52656600
what you recommend anon? I'm learning two memes at the moment. python and java. Would like to know everything from assembler to javascript but ya gotta start somewhere right?

I changed it to a function.

class StringReverse {

public static String wordReverse(String wordie){
String word = wordie;
int len = word.length() - 1;
System.out.println(word);
int i = -1;
int c = 0;
String word2 = "";
while (i < len){
char cur = word.charAt(len);
word2 += cur;
len -= 1;
c += 1;
}
return word2;
}
public static void main(String args[]){
System.out.println(wordReverse("Spegetti"));

}
}
>>
>>52656782
>what is xamarin
literally all the same android SDK shit just you get to use your even more retarded code monkeyer shit language with it
>>
>>52653004
>pure FP fags will tell you that state isn't state if you pass it as function I/O
nobody who properly understands pure FP would say that. the idea is about controlling the state/io/side effects, not about removing them from your program. by making their use an explicit part of the type of a function you make it clear how the function will or won't interact with the world or other data, makes it easier to understand what a function does just by looking at its type signature (which means the actual function can be inferred), and can aid immensely in optimization (for memoization/lookup tables, partial evaluation, inlining, removing dead code, changing order of function calls, etc.). better yet, with a dependent type system, types that show side effects tell the compiler that theorems can't necessarily be proved there, so a compiler can choose to insert runtime checks or make the user prove that they're handling all possible input (by use of total functions). while there's benefit to not using state or IO in general (easier to reason about how the code will run), pure FP is less about that than its other advantages
>>
>>52656777
If the editor is smart enough to wipe blank lines, it should be able to bring the cursor to the right spot if you hit "end".
I know jetbrains does this at least.
>>
>>52656786
Use an even memier language

reverse l =  rev l []
where
rev [] a = a
rev (x:xs) a = rev xs (x:a)
>>
>>52656837
>can aid immensely in optimization
>compiler can choose to insert runtime checks or make the user prove that they're handling all possible input (by use of total functions)
>[in theory]
>>
>>52656843
Tried it. Turns out hitting tab once will fill in all the spaces to align it.

Still feels like my code is going to be tied too much to the editor even though that doesn't really make sense.
>>
File: 1406974982907.jpg (82 KB, 500x647) Image search: [Google]
1406974982907.jpg
82 KB, 500x647
>>52656863
lol. i've only been learning for about a month but i think i'm getting the hang of it. is that python?
>>
>>52656988
no that's hasklel
>>
File: donkey kong development.gif (2 MB, 289x400) Image search: [Google]
donkey kong development.gif
2 MB, 289x400
My python is getting half-decent, so I'm thinking of learning a second language that would complement it.

I know a bit of SQL already for work, but I think I'd prefer to focus on something more building-focused than analytics-focused (so R doesn't interest me that much, for example).

I'm thinking of something like C, because I've heard it's ultra-versatile, and that if I know a high-level language like Python, I'd be better off learning something like C than another high-level one like Ruby.

Any thoughts?
>>
>>52657064
C is definitely the right choice. Python is a great supplement for external tools that aid your C programs. Additionally, you can make Python even more useful for your own needs by extending it with C
>>
>>52656894
An editor from this century, sure.
>>
>>52654452
note that this is very old and the performance gains will be pretty significant with flambda (and multicore, once that's out)
>>52655739
there are 3 popular, stable, and actively developed OCaml to JS compilers
F#'s popularity is still bigger on the web, but definitely not banking
new libraries get added to OPAM pretty much daily and multicore is coming with the next release
not saying OCaml is great, just please don't talk out of your ass about it (or any other language, for that matter)
>>52655535
same. any time I've mentioned something negative about OCaml he's fucking sperged out and yet I've never once seen him post a piece of code
>>52656880
I will admit optimization isn't quite up to par on many of these languages, although Haskell does extremely well for a lazy language. Hopefully Idris will get even bigger performance gains since it's strict
F* already inserts checks at runtime for code that interacts with IO, and nearly every dependently typed language has totality checking and enforced verification that values will match proofs in IO-facing code. ATS isn't a functionally pure language, but it uses dependent typing to improve on even (naive) C performance by using proofs as types
>>
>>52656593
>>
File: lerekt.gif (2 MB, 250x180) Image search: [Google]
lerekt.gif
2 MB, 250x180
>>52657064
I started on python and I'm finding learning Java is expanding on the basic concepts a lot. But I'm sure that would be the case for something like C as well. Being said, interested to hear other peoples responses as I'm pretty nubsta myself.
>>
>>52656567
Just


word = word[::-1]

>>
>>52657175
oh yeah. now that's python
>>
>>52657150
>has used ocaml for 3 seconds
>thinks he's an expert on the subject
LMAO
ocaml is slow as fuck and dead as fuck. haskell is more popular in banking. Stop pretending you're not >>52655370
>types exactly the same way
>thinks nobody will notice
L
M
A
O
>>
Does anyone know any beginner guides or where to look at for concurrency control mechanism using mySQL and java?
>>
>>52656802
Oh? What language is better than C# for app development?
>>
File: 1430616732404.jpg (69 KB, 800x770) Image search: [Google]
1430616732404.jpg
69 KB, 800x770
What's the difference between C, C++ and C#?

I don't get it
>>
File: J4D4lNr.png (721 KB, 1608x926) Image search: [Google]
J4D4lNr.png
721 KB, 1608x926
modified some old mandelbrot code I wrote before to render using pickover stalks
>>
>>52657347
C# is the "best" since it has muh unsigned bytes and all the "features" you could reasonably imagine
>>
>>52657369
They're 3 completely different languages.
There is nothing more to it than that.
>>
File: 3CZDePF.png (1021 KB, 1608x926) Image search: [Google]
3CZDePF.png
1021 KB, 1608x926
color pic
>>
>>52657380
unsigned bytes and other features of C# are good things. Do you actually think they aren't?
>>
>>52657369
>C
very simple, minimalist language that could be described as "portable assembly". almost only used for performance-critical applications such as real-time systems, embedded systems and hardware device drivers

>C++
C evolved

>java
C++ evolved

>C#
bastardized version of java
>>
>>52657414
>bastardized version of java
more like Java is a bastardised version of Java. And yes, I know Java came first.
>>
>>52657414
I'm this guy >>52657064

Any advice on which to go for?
>>
>>52657411
why bother with frankly unnecessary features like unsigned types, structs, raw pointers etc when you get as bad performance as java anyway? just use java and/or C++
>>
>>52657414
so C# is the bastardized version of the bastardized version of C++ then? makes sense
>>
>>52657162
Probably viable if you're not a poo in the loo or a slav. You might think you can't compete with $3/hour streetshitters but many people will gladly pay a lot more to hire a white guy in a Western country that has decent English and communication skills.
>>
>>52657443
>unnecessary features like unsigned types, structs, raw pointers
Because Prajeet, those are useful features.
Thread replies: 255
Thread images: 44

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.