[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 30
File: 1450727871328.jpg (46 KB, 306x523) Image search: [Google]
1450727871328.jpg
46 KB, 306x523
DIE OBJEKTORIENTIERTE PROGRAMMIERUNG ÜBERMENSCH

NO MULTIPLE CLASS INHERITANCE

STATIC TYPING

RESTRICTED TYPE INFERENCE

NO USER-DEFINED OPERATOR OVERLOADING

PASS-BY-VALUE ONLY

JAVA ÜBER ALLES

SIEG HEIL

Die vorherige Diskussion: >>53497069

Was arbeiten Sie, /g/?
>>
File: K&R watashi kininarimasu.jpg (475 KB, 852x973) Image search: [Google]
K&R watashi kininarimasu.jpg
475 KB, 852x973
Friendly reminder that all programs should be compiled and linked to the target processor for optimal performance!
>>
What build agent for .Net?
>>
>>53505850
import faggot
print op is a faggot
>>
>>53505945
you're mom
>>
>Java
>uber alles

top heh m9
>>
>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
>>
>>53505850
>NO USER-DEFINED OPERATOR OVERLOADING
lol, java fags even defend this.
>>
>Tfw no /wdg/ thread
>>
>>53505945
.NET 3.5 will give you coverage of about 87% of all desktops in the entire world.

.NET 4.5.2 puts you at about 55-60%, likely much higher depending on your target audience.
>>
>>53506041
fucking retard lmfao

the benefits outweigh the disadvantages by far

you aren't even supposed to use operator overloading in languages that have them
>>
learning clojure because all the cool people are doing it
>>
>>53506041
Implying operator overloading is ever used
>>
>>53506062
those are not cool people
>>
Is Java a meme language?

http://strawpoll.me/7090814
>>
C# is literally a cargo-cult clone of java with massive feature-creep due to a load of dunning-kruger pythonesque "features" tacked onto it that you aren't even supposed to use

>many of the disadvantages of java
>many of the disadvantages of C++
>few of the advantages of java
>few of the advantages of C++
>>
File: 3DGyS.jpg (23 KB, 500x325) Image search: [Google]
3DGyS.jpg
23 KB, 500x325
>>53506091

You made this same exact post yesterday, and the previous day, and the previous day, and the previous day, and the..
>>
>>53506091
C# is great for unity it's just like Java
>>
>>53506106
same can be said about anti-java trolls

>>53506110
>unity
>>>/vg/agdg
>>
>>53506127
Why are you telling me to leave if I mention Unity seriously it has a large programming aspect to it which is good
>>
>>53506110
Doesn't Unity use a retardely outdated C# runtime that doesn't support modern features and also is slow as fuck compared to newer stuff?
>>
File: crying umaru.jpg (36 KB, 600x337) Image search: [Google]
crying umaru.jpg
36 KB, 600x337
Why do people make fun of me when they find out I write all my applications in C?
>>
>>53506153
s/programming/scripting
>>
>>53506068
Enjoy your shitty linear algebra/bignum libraries.
a.add(b).multiply(c).(e.add(d).divide(f))

So beatiful.

Java designers literally treats their users retards and they are happy with this, heh
>>
>>53506156
They updated Unity a lot it is still one of the best gaming engines out there and it will only improve

>>53506166
Scripting is programming too
>>
>>53506165
C is shit, at least use C++
>>
>>53506175
This is perfectly logical and easy to understand. It is simple, clean, and efficient code
>>
>>53506165
Because when you're going to use a shit language at least have some decency to use C++ instead.
>>
Anyone know how Boost's graph library works?
Let's say I've got an arbitrary graph, and I want to remove edges until it's planar. I then use the boyer-myrvold planarity test, and remove the subsequent kuratowski subgraphs from the original graph.

The original graph has metadata (specifically, they are labeled with indices).
If I copy the original graph and remove the kuratowski subgraphs, is this new planar graph still a subgraph of the original?

Essentially I want to ensure that all operations I'm making are reversible to the original arbitrary graph.
>>
>>53506206
C++ is too hard to understand
>>
>>53506175
i genuinely wouldn't use operator overloading, not for linear algebra or bignums either
>>
>>53506230
C++ is hard to understand if you love abusing pointer logic.

Keeping it simple keeps it easy.
>>
>>53506032
> bastardized

That is not how you spell better.
>>
Tried to do somewhat idiomatic F# Brainfuck interpreter.
type Instruction = 
| IncrementPointer
| DecrementPointer
| IncrementValue
| DecrementValue
| OutputValue
| AcceptValue
| StartBlock
| EndBlock

let interpreter (program : string) =
let Parser =
function
| '>' -> Some IncrementPointer
| '<' -> Some DecrementPointer
| '+' -> Some IncrementValue
| '-' -> Some DecrementValue
| '.' -> Some OutputValue
| ',' -> Some AcceptValue
| '[' -> Some StartBlock
| ']' -> Some EndBlock
| _ -> None

let rec interp (program : Instruction array) (memory : byte array) ptr ip block =
if ip >= program.Length then ()
else
match program.[ip] with
| IncrementPointer -> interp program memory (ptr + 1) (ip + 1) block
| DecrementPointer -> interp program memory (ptr - 1) (ip + 1) block
| IncrementValue ->
memory.[ptr] <- memory.[ptr] + 1uy
interp program memory ptr (ip + 1) block
| DecrementValue ->
memory.[ptr] <- memory.[ptr] - 1uy
interp program memory ptr (ip + 1) block
| OutputValue ->
memory.[ptr]
|> char
|> printf "%c"
interp program memory ptr (ip + 1) block
| AcceptValue ->
memory.[ptr] <- (stdin.Read() |> byte)
interp program memory ptr (ip + 1) block
| StartBlock -> interp program memory ptr (ip + 1) ((ip + 1) :: block)
| EndBlock ->
if memory.[ptr] = 0uy then interp program memory ptr (ip + 1) (block.Tail)
else interp program memory ptr (block.Head) block

interp (program
|> Seq.choose Parser
|> Seq.toArray) (Array.zeroCreate 4096) 0 0 []
>>
>>53506175
Still better than:
struct dick *a = bignum_something_create();
struct dick *b = bignum_something_create();
struct dick *c = bignum_something_create();
struct dick *d = bignum_something_create();
struct dick *e = bignum_something_create();
struct dick *f = bignum_something_create();

bignum_something_add(a, b);
bignum_something_multiply(a, c);
bignum_something_shitnigger(a, bignum_something_add(e, d), bignum_something_divide(e, f));


free(a);
free(b);
free(c);
free(d);
free(e);f
free(f);
>>
>>53506254
better in what way? java is good for its simplicity. if you don't need simplicity you may as well use C++ instead. the "low level features" in C# still give you shit performance.
>>
>>53505949
> import faggot
> print op is a faggot
"op is a faggot" cant be a variable imported with faggot so your syntax is wrong
> in python 2.x
print "op is a faggot"
> in python 3.x
print ("op is a faggot")
> conclusion
you are a faggot
>>
>>53506274
this
>>
>>53506237
you are using it for string, or primitive wrappers. I wonder what would java fanboys would thought if java didn't allow those. I guess they would just accept it and still chant 'operator overloading is evil!'
>>
>>53506206

C++ is even more shit with all the stuff that's constantly getting bolted on. No one can ever agree what "subset" of the language they want to use and unless the application you are building is 100% your code, it is guarenteed to have hackery surrounding problems interfacing between different ABIs and other stuff people shouldn't be dealing wtih.

C++17 is a disaster without even modules or any of the really good features that were "promised". Might as well learn Go or Rust, since they do the things C++ wants to do much more cleanly.
>>
>>53506284
C++11 and above can be considered simple.
It's not nearly as simple as say, C# because C++'s typing system is still terrible (otherwise we would have proper Intellisense for C++), but I have no indication otherwise to see idiomatic, modern C++ to be anything but simple.
>>
>>53506312
Can we all agree C++ is the most difficult programming language and then after that it is Java
>>
File: fromagnulinux.png (109 KB, 354x354) Image search: [Google]
fromagnulinux.png
109 KB, 354x354
>>53506237
Linear algebra, it can be argued, since matrix multiplication yaddi yadda. But WHY THE FUCK is it permissible for smallnums, yet not for bignums? They are basically the same thing and the language would provide operator syntax if it included them. Why restrict yourself? Think GNU/Free neighbor.
>>
>>53506284
Signed types, better interoperability with other languages with P/Invoke, pointers, LINQ. Basically treating the programmer as an human adult and not an irresponsible monkey.
>>
>>53506274
that looks like C anon, in C it would be like.

BigNum a(1);
BigNum b(4);
BigNum c("1231231231231231");
BigNum d = c / (a + b);
>>
>>53506308
"foo" + bar is obvious, there is no ambiguity with it in java. in languages with operator overloading it's a big deal because you can't tell at a glance what it does

for primitive wrappers it's simply autoboxing/unboxing, still obvious as fuck, and you should never use primitive wrappers except for super comfy enterprise work
>>
>>53506310
That's why I said he should have some decency if he's going to stick with shit languages and use the C upgrade. If he wated to stick with good languages I'd have suggested something different.
>>
>>53506339
*in C++ it would be like
>>
>>53506323
You wouldn't have this problem if you just wrote C with Classes like you were supposed to.
Don't use any C++ features that aren't classes, they're all the result of many years of feature creep.
>>
>>53506331
>unsigned types
lmfao k tard, i hope you aren't the LITERAL MONKEY who's still struggling with the usb shit in android
>>
>>53505907
Maybe if you're using a 80s workstation with 64kb ram
today that doesnt really matter
you still have source based linux distributions though
>>
>>53506394
and properly written java is fast, especially for long-running applications
>>
In which language new projects should be created ? Swift? Go?Rust? D? C++11/14 ?
>>
>>53506374
>>unsigned types
>lmfao k tard

This is low, even for you.
>>
File: 1453591702490.jpg (31 KB, 433x419) Image search: [Google]
1453591702490.jpg
31 KB, 433x419
>>53506206
>>
>>53505850
kek
>java
>not twice as slow as c++
>>
>>53506284
Performance differences between java and C# are negligible, Java is anything but simple. It is overly verbose and has alot of garbage that needs to be written for protocol for little good reason.

At least C# tries to hide most of it's annoying shit by offering syntactic sugar (see: LinQ), and actually has decent frameworks for rapidly developing web apps and services (see: Web Api, Entity Framework, WCF)

Visual Studio is a powerful IDE while Eclipse keeps getting worse, NetBeans is featureless and JDeveloper is just there to piss you off. There's IntelliJ I guess but it's not very flexible for certain frameworks.

I used to like Java but it just feels like a mess to me sometimes. C# has it's own batch of problems but in my opinion it has better docs and support and is consistently improving.
>>
I like to program on my mac it is a much superior operating system than Linux
>>
>>53506417
C++

>>53506425
a high-level language doesn't need unsigned types, it just makes things more complicated for no real benefit. if you need unsigned types just use C++
>>
>>53506437
>At least C# tries to hide most of it's annoying shit by offering syntactic sugar (see: LinQ)

Java tried to strike back with Streams. They're good, but nowhere near as simple as LINQ.
>>
>>53506437
>syntactic sugar
>simple
>web apps
absolutely epic
>>
File: guile-logo.png (14 KB, 399x232) Image search: [Google]
guile-logo.png
14 KB, 399x232
>>53506343
If you alter the semantics so much that it becomes that confusing, it's your problem, not the language designer's. I mean, how much totalitarian hubris must you have to think that you can decide what operators can and can't mean perfectly, but users don't and should be kept in line? GNU is Liberté, Égalité, Fraternité.
>>
>>53506444
>if you need unsigned types just use C++

Luckily, that won't be necessary because C# has unsigned types already.
>>
>>53506439
>decades old versions of GNU software because apple doesn't want to contribute to open source
>>
>>53506481
C# has everything under the sun. quality > quantity, less is more
>>
>>53506444
It may not need, but taking the choice to use it says pretty much of the language.
>>
>>53506444
>a high-level language doesn't need unsigned types
It does if it wants to communicate with the real world. Most hardware will communicate with bytestreams, and the bytes are intended to be treated as 0 to 255, NOT -128 to 127.

>it just makes things more complicated for no real benefit.
You're right, not including unsigned types does make things more complicated for no reason!
>>
>>53506501
>C# has everything under the sun.

Not really.
>>
you smug hipsters hate on java because it's the most popular programming language, it's accessible to anyone with 95+ IQ, because of how well it's designed
>>
>>53506529
>treated as 0 to 255
just use int you dip
>>
>>53506529
OH SHIT IT'S THE ANDROID USB NIGGER AGAIN

LMFAO YOU'RE A COMPLETE JOKE DUDE I CAN'T BELIEVE YOU'RE STILL STRUGGLING WITH THIS BASIC SHIT
>>
Survey Time!

http://strawpoll.me/7091051
>>
File: 1457983333895.png (48 KB, 1920x1080) Image search: [Google]
1457983333895.png
48 KB, 1920x1080
>>53506547
s/Java/Python/
Even truer
>>
File: 1457648517184s.jpg (4 KB, 208x250) Image search: [Google]
1457648517184s.jpg
4 KB, 208x250
>tfw fell for the meme meme meme meme meme
>>
>>53506547
>95+
Too high. It's comfortable for the 70-110 range. Above that it lacks features. And that is not the JVM fault, as other languages with it as a target can be very flexible.
>>
>>53506562
>>53506529
For hardware-software interfacing we already use C, and there's more than one reason we don't use high level languages. C still offers great versatility, runs faster, and is honestly not hard to master if you have medium knowledge about computers
>>
This subreddit is so shit I am thinking of switching over to /agdg/ atleast they accomplish something with their programming skills and have better discussions
>>
>>53506623
lmfao you delusional fuck, you aren't smart for choosing scala or kotlin or whatever TERRIBLE hipster GARBAGE you're using
>>
Why is OP speaking in Arabic?
>>
>>53506637
Go ahead.

Enjoy your no code tags, nerd.
>>
>>53506347

C is small enough as is and works well enough in its niche of being "portable" assembly for embedded applications and device drivers. C++ just isn't suitable in any niche with no alternatives.
>>
>>53506623
a programming language isn't supposed to be "flexible", we're dealing with cold hard logic and computation, fucking fag
>>
>>53506669

public class dptIsShit
{
public static void main(String[] args)
{
String memes = "All you guys do is shitpost";

System.out.println(memes);


}


}

>>
>>53506562
>just use 4 times the memory

>>53506564
Would you be defending Java if it didn't have ++ and -- operators too?
I mean you don't really need them, and it makes the language "simpler" if you don't have them.

>I CAN'T BELIEVE YOU'RE STILL STRUGGLING WITH THIS BASIC SHIT, JUST USE X += 1

>>53506629
For some reason all of the smartphone and tablet manufacturers decided it was a good idea to suggest people write hardware-level code for their devices in high-level languages.
>>
>>53506676
Logically the best thing to do is to make programming much easier so we have more people capable of programming software for corporations *rubs hands* it's all about the money
>>
>>53506676
Then we don't need a language, just mnemonics would suffice.

>>53506648
The difference on the garbage is just the hipster qualifier. Java could be better. Denying that is equally delusional.
>>
File: oij.png (474 KB, 1500x2050) Image search: [Google]
oij.png
474 KB, 1500x2050
Should I learn C# and get into making universal Window 10 apps or should should I learn Java and get into making Android apps?
>>
>>53506637
last time i went to /agdg/ they started arguing about whether pressing the F12 key in blender does a full render or a quick render

and they're mostly shitters who make shitty hobbyist hipster gaymes
>>
>be me
>post legitimate question
>nobody replies
>post somewhat interesting thing i did
>nobody replies
>say something stupid and inflamatory
>50 (You)'s

fuck this place
>>
>>53506731
make android and iOS apps

no one uses windows phones
>>
>>53506731
C# can be used for Android apps too, it's easier to code and has more features.
>>
File: average German school.jpg (378 KB, 1820x1213) Image search: [Google]
average German school.jpg
378 KB, 1820x1213
What happened to Germany, lads?
>>
>>53506738
Keyword being "make".
>>
>>53506750
Post your question
>>
>>53506784
wew lad it's the exact same API just more bloated
>>
>>53506712
I don't know much about phones, but I imagine it will have affected speed to a degree depending on the language java would be pretty shit, c++ not so much
>>
>>53506790
/pol/ please go we don't care about politics here only shitposting about why Java is so good or so shit. It's all about Java programming
>>
>>53506165
Compiler dependent trash lel

This is why Python is better where performance isn't priority
>>
Reminder that uniqueness types are NO substitute for full linearity.
>>
>>53506712
fucking idiot you can still use C/C++ through JNI

google doesn't suggest java for hardware I/O, just for apps in general because most devs are retarded fuccbois
>>
>>53506676
>a programming language isn't supposed to be "flexible", we're dealing with cold hard logic and computation, fucking fag

That's why assembly is the only choice.
>>
>>53506800
The way the permissions work on android, you pretty much are forced to do the I/O with Java only, so yeah it's pretty fucking slow.
>>
>>53506731
Java. More language development on the jvm. More open source. JVM is more mature. JVM is currently more portable but that may not last long. Java has some of the most mature frameworks out there and has been used in far more applications. You can also use all of these frameworks in any other jvm language relatively easily.
>>
>>53506815
>performance not a priority
lazy faggot a single cycle speed up is enough to justify not using pythoncancer
>>
>>53506799
Sure. But having the same codebase may outweigh the bloat. It can be used for W10, Android and iOS. Better than also learning Java and Objective-C and maintaining three different codes.
>>
>>53506850
java can be used for iOS too, fag. windows phone is completely irrelevant
>>

public static void main(String[] args)
{
int n = 2744;
String moo = n + "";

String distance = "";
System.out.println(moo);

for(int i = 1; i < moo.length();i++)
{
distance += Math.abs(moo.charAt(i) - moo.charAt(i - 1));
System.out.println(distance);
}

int num = Integer.parseInt(distance);
System.out.println(num);


}

>>
>>53506857
It may be, but you don't need to make apps that are mobile only. You can exploit the desktop market, where people usually are more comfortable paying anything above 99 cents.
>>
Does anyone have the 'you wouldn't sizeof a char' meme
>>
>>53505850
She can gas me anytime.
>>
>>53506910
what's wrong with sizeof(char)?
>>
>>53506833
https://github.com/libusb/libusb/wiki/FAQ#Does_libusb_support_Android

You can run as many leet hacker sanic speed modules in C/C++ as you like, but the hardware I/O will be in Java unless you only support rooted devices.

Do you really fucking think anyone, ANYONE would go to the trouble of rewriting low-level USB comms stuff in fucking JAVA unless it was absolutely necessary?
>>
>>53506919
It should be always 1.
>>
File: Screenshot_2016-03-12-06-30-42.png (506 KB, 1280x720) Image search: [Google]
Screenshot_2016-03-12-06-30-42.png
506 KB, 1280x720
i have a question
my retarded school gave me a project that aims to recreate the picture password in windowd 8
is the picture password in 8 open source is there anyway to implement it
>>
>>53506919
it's a verbose way to spell 1
>>
>>53506927
>should
m8...
>>
>>53506898
windows 10 apps are gay as fuck and your application should be adapted for desktop vs mobile because they have fundamentally different UX
>>
>>53506032
portable assembly,... what?
how is java c++ evolved? wat
comparing c# with java is like comparing swift with javascript
>>
>>53506934
post assignment I'll do your homework for you
>>
>>53506934
Thats the cutest hentaifu I've ever seen
>>
>>53506927
>>53506936
What if it's not one?
I don't like using magic numbers.
>>
>>53506921
lol gay faggot, the link doesn't say anything about java, the permissions are attached to the process not the language you fucking retard
>>
>>53506963
Implement a picture password program
Thats literaly the only thing they gave me
>>
>>53506934
Sauce pls
>>
>>53506985
>Implement a picture password program
https://blogs.msdn.microsoft.com/b8/2011/12/16/signing-in-with-a-picture-password/
>>
>>53506985
what's a fucking picture password
>>
File: NotInEveryLanguage.png (7 KB, 425x162) Image search: [Google]
NotInEveryLanguage.png
7 KB, 425x162
>>53506934
It should be straightforward. Save the clicks coordinates and have some range tolerance.

>>53506952
And that's how the universal apps works.

>>53506972
>>53506951
Well, some languages may use a different definition for char.
>>
>>53506952
Desktop apps don't have access to cool features like the Notification API and the Cortana API famalam.
>>
>>53506050
>.NET 4.5.2 puts you at about 55-60%, likely much higher depending on your target audience.
or much lower
>>
>Java shilling
lol, do you think Oracle is reading this thread and ready to spill their wallets out at you?
>>
>>53507033
>>53507039
so you can't just take your mobile app and put in on desktop, that's my point
>>
>>53507053
I get paid to shill Java on /g/
>>
>>53507028
a silly gimmick in win 8
>>
>>53506980
Do your parents still wipe your ass for you too?
Of course it doesn't say anything about Java on that page, libusb is written in C you tard.

https://github.com/libusb/libusb/tree/master/android

>Runtime Permissions:
>The default system configuration on most Android device will not allow
>access to USB devices. There are several options for changing this.

>If you have control of the system image then you can modify the
>ueventd.rc used in the image to change the permissions on
>/dev/bus/usb/*/*. If using this approach then it is advisable to
>create a new Android permission to protect access to these files.
>It is not advisable to give all applications read and write permissions
>to these files.

>For rooted devices the code using libusb could be executed as root
>using the "su" command. An alternative would be to use the "su" command
>to change the permissions on the appropriate /dev/bus/usb/ files.

>Users have reported success in using android.hardware.usb.UsbManager
>to request permission to use the UsbDevice and then opening the
>device. The difficulties in this method is that there is no guarantee
>that it will continue to work in the future Android versions, it
>requires invoking Java APIs and running code to match each
>android.hardware.usb.UsbDevice to a libusb_device.
>>
#define char int
int main(){
printf("%d\n", sizeof(char)); //4
}

where is your god now, C fags
>>
>>53506050
those are god awful percentages

android gingerbread gives you like 99%+
>>
Lets program an android application together guys I have my Android Studio open
>>
>>53507072
SO WHAT IF YOU CAN'T USE SOME RANDOM SHITTER LIBRARY ON SHITHUB

IF YOUR SHITTY CODE WORKS IN JAVA, IT WORKS IN C/C++ AS WELL
>>
>>53507063
Why do they payou
Its already really popular pajeet
>>53507073
lol it will show compile error faggot
>>
>>53507060
It's literally just UI changes. They encourage using MVVM for making the UI easier to adapt. Also, you could make something responsive as if it was a website. There's no need to have two different codebases.
>>
>>53507146
>something responsive as if it was a website
kill yourself retard

and it's the same with java, don't know about the universal windows 10 app meme, but you can run java on desktop of course
>>
File: 1416781030993.jpg (89 KB, 656x843) Image search: [Google]
1416781030993.jpg
89 KB, 656x843
>tfw converting javascript into typescript
>>
>>53507073
No.
:~$ gcc hhh.c -o hhh -ansi -Wall
:~$ ./hhh
1
:~$ cat hhh.c
#include <stdio.h>

int main (void) {
printf("%zu\n", sizeof(char));
return 0;
}
>>
>>53507073
I prefer
#define sizeof(x) 0


You can't have overflows if you never actually allocate anything :^)
>>
>>53507039
>the Cortana API
Wait. I can make Cortana talk like a dirty slut?
>>
a website is the LEAST responsive form of "application" for fuck's sake, even with CDN's and static content you still have network latency
>>
>>53507117
no it wont, faggot
>>
File: 1.jpg (28 KB, 284x322) Image search: [Google]
1.jpg
28 KB, 284x322
>>53507116
>SOME RANDOM SHITTER LIBRARY
>>
>>53507166
you didn't redefine char
>>
>>53507175
Fuck that dude.
Malloc often, free never.
Just reset your computer after.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main (void) {
int malloci;
char *mallocstring;
int *mallocreturn;
mallocreturn = &malloci;
for (malloci=1; malloci<=100; malloci++) {
if (malloci % 15 == 0) {
mallocstring = (char *) malloc((sizeof(malloci)+8));
strcpy(mallocstring, "MallocBuzz\n\0");
printf("%s", mallocstring);
} else if (malloci % 5 == 0) {
mallocstring = (char *) malloc((sizeof(malloci)+3));
strcpy(mallocstring, "mal\n\0");
printf("%s", mallocstring);
} else if (malloci % 3 == 0) {
mallocstring = (char *) malloc((sizeof(malloci)+3));
strcpy(mallocstring, "loc\n\0");
printf("%s", mallocstring);
} else {
printf("%d\n", malloci);
}
}
malloci = 0;
return *mallocreturn;
}
>>
>>53507198
IF YOUR SHITTY CODE WORKS IN JAVA, IT WORKS IN C/C++ AS WELL, THE PERMISSIONS ARE ATTACHED TO THE PROCESS

FUCKING RETARD

THE JOKE'S ON YOU ANYWAY BECAUSE YOU'RE THE ONE HAVING THIS "PROBLEM"
>>
anon@muhthinkpad ~ $ nodejs
> ((~(';_;'))^[{/*~*/}])>>>(!'(!'|!!'!|!'-(-+"@:"));
4294967295
> ((~(';_;'))^[{/*~*/}])>>>(!'(!'|!!'!|!'-(-+""));
2147483647


wow
>>
Guys can we seriously stop arguing and all work together programming an application together we could have made a great piece of software by now if we all collab together
>>
>>53507200
#define char int
#define int char

#include <stdio.h>

int main (void) {
printf("%zu\n", sizeof(char));
return 0;
}

Enjoy fag. Still 1.
>>
>>53507160
If you want a Android app running in the desktop, you will have to adapt it for the differences too. You are literally making my point. You can use something as a grid instead of treating the screen as pixels, that's no different. Your clients deserve something usable if they use a cheap phone with low resolution or a state of art with more pixels than sensible.
>>
>>53507238
I'M NOT WORKING WITH THESE LITERAL RETARDS

I'M WORKING ON MY OWN, FUCK YOU TARDS

I SUPPOSE YOU COULD DO SOME BULLSHIT LIKE THE TOX SHIT AND THEN STEAL SMALL-TIME DONATIONS LIKE A CHILDISH FUCKTARD
>>
>>53507088
>>53507041
Technically speaking, you can ship .NET 4 with your application all the way down to XP, and those market shares were against ALL desktops (including Linux, OSX, etc.), not just Windows machines.

.NET 3.5 is virtually every single Windows machine in production right now, and .NET 4 can be shipped with app for older machines.
>>
>>53507239
#define char int
#define int char

#include <stdio.h>

int main (void) {
printf("4\n", sizeof(char));
return 0;
}

nope, that prints 4 to me.
>>
does anybody know this pattern?

0 0 1 0
2 1 1 0
3 2 2 1
2 1 1 0
4 3 3 2
3 2 2 1
3 2 2 1
2 1 1 0
5 4 4 3
4 3 3 2
4 3 3 2
3 2 2 1
4 3 3 2
3 2 2 1
3 2 2 1
2 1 1 0
6 5 5 4
5 4 4 3
5 4 4 3
4 3 3 2
5 4 4 3
4 3 3 2
4 3 3 2
3 2 2 1
5 4 4 3
4 3 3 2
4 3 3 2
3 2 2 1
4 3 3 2
3 2 2 1
3 2 2 1
2 1 1 0
>>
>>53505850

So I want to random generate telnet IPs and test if they are live or not

I can cope with any language. Were do I start?
>>
>>53507302
>telling random servers where you are
>>
File: umad.gif (2 MB, 178x120) Image search: [Google]
umad.gif
2 MB, 178x120
>>53507223
>>
>>53507302
learn how ip addresses work
generate them excluding reserved ranges
learn socket programming
???
>>
>>53507316
>not hiding behind 8 proxies
I am 192.0.0.1, come at me bro
>>
>>53507320
>Java programmers trying to get your business via Skype
>>
>>53507332
sending you 25 pizzas all for free
>>
>>53507325

> learn socket programming

this is the answer I was looking for

>>53507316

any advice on how to protect muh freedoms while doing this
>>
>>53507364
just ping all IPs then check if 23 is open bro, should take so long
>>
>>53507332
PLEASE try to telnet to my server:
98.124.243.46
port 3306
>>
>>53507271
Nope, that doesn't compile for you.
>>
>>53507406
It's a trap
>>
File: 4kSkThk.png (2 KB, 516x23) Image search: [Google]
4kSkThk.png
2 KB, 516x23
>>53507406
lol
>>
>>53507410
yes it does
>>
>>53507434
Not with -Werror, which you should be using.
>>
post one liners
# Atbash cipher
from string import ascii_uppercase as up, ascii_lowercase as low
print("".join(up[-(up.index(char)+1)] if char in up else low[-(low.index(char)+1)] if char in low else char for char in input("Encrypt: ")) if input("(1) Encrypt or (2) Decrypt? ") == "1" else "".join(up[::-1][25-up[::-1].index(char)] if char in up else low[::-1][25-low[::-1].index(char)] if char in low else char for char in input("Decrypt: ")))
>>
>>53507451
warnings are not errors.
what error does it give anyway? can't compile now.
>>
>>53507465
That's two lines though, replace the imports with __import__ and you're set.
>>
>>53507073
>undefined behavior
anon...
>>
>>53507302
def generateClassCIPAddress():
x = lambda: str(random.randint(192,224)) + "."
y = lambda: str(random.randint(0,255)) + "."
print((x()+y()+y()+y())[:-1])
>>
>>53507465
>Greater than 80 chars
>"one" liner
>>
>>53507488
what is it? Yeah I forgot void in main parameters.
>>
>>53507471
error: too many arguments for format [-Werror=format-extra-args]
printf("4\n", sizeof(char));
^
cc1: all warnings being treated as errors
>>
>>53507526
That is still valid C though, that is just your compiler being kind to you.
>>
>>53507552
It's you being unkind to yourself by being shit.
>>
>>53507491

Well, it's already been done.

might as well go smoke crack today
>>
>>53505907
fuck off with your meme books pls
>>
>>53507630
and right, sizeof(char) is not always 1. case closed.
>>
Find the most frequent integer in an array

Find pairs in an integer array whose sum is equal to 10 (bonus: do it in linear time)

Given 2 integer arrays, determine of the 2nd array is a rotated version of the 1st array. Ex. Original Array A={1,2,3,5,6,7,8} Rotated Array B={5,6,7,8,1,2,3}

Write fibbonaci iteratively and recursively (bonus: use dynamic programming)

Find the only element in an array that only occurs once.

Find the common elements of 2 int arrays

Implement binary search of a sorted array of integers

Implement binary search in a rotated array (ex. {5,6,7,8,1,2,3})

Use dynamic programming to find the first X prime numbers

Write a function that prints out the binary form of an int

These questions were part of my programming job interview
>>
>>53507665
nice cs101 quiz
>>
>>53507661
you changed it to sizeof(int) with a preprocessor macro, sizeof(char) is still 1 in the C language
>>
>>53507758
>sizeof(char) is always 1!
>except when it isn't
>>
>>53507635
You can do way better than this desu.
Like, by avoiding to generate subnetwork and broadcast addresses, and directly calling ping/telnet from python for example.
>>
>>53507829
You're a fucking idiot.
>>
>>53507829
you can use macros to change the entry point to public static void main(String[] args), doesn't mean that that's what the entry point in C looks like
>>
File: lam.png (59 KB, 919x401) Image search: [Google]
lam.png
59 KB, 919x401
>why.pyc
>>
>>53507926
Multiline lambdas wouldn't really work with the bracketless syntax python has
>>
>>53507926
>it's better to create a standard function
indeed
>>
>>53507888
>doesn't mean that that's what the entry point in C looks like
standard does not agree with you. 5.1.2.2.1.1 says it can be
int main(int argc, char *argv[])
or
int main(void)
or anything 'eqivalent. If
public static void main(String[] args)
is eqivalent with preprocessor defines/typedef then it is within standard
>>
>tfw making $100 a day off your android app
>>
>>53507964
ok but #define char int, sizeof(char) isn't equivalent to sizeof(char)
>>
>>53508003
>sizeof(char) isn't equivalent to sizeof(char)
anon...
>>
>>53508018
patel...
>>
>>53507926
because
def fizzbuzz():
printlist = lambda xs: [print(x) for x in xs]
printlist(list(map(lambda x: "FizzBuzz" if x%15==0 else "Fizz" if x%3==0 else "Buzz" if x%5==0 else str(x), range(1,101))))
>>
>>53507965
What does it do, anon?
>>
>>53508064
plays fart sounds
>>
>>53508064
detects different musical soundwave frequencies
>>
>>53506478
How's it feel to produce nothing anyone is interested in and waste your time shitposting?

Go rice your desktop, fag.
>>
>>53508104
i don't shitpost all day if that's what you're thinking
>>
File: 1456000651593.jpg (29 KB, 500x363) Image search: [Google]
1456000651593.jpg
29 KB, 500x363
Okay, C fag working on a BST rotation and balancing implementation reporting in.

So, I'm getting pretty close, but I have something that's ever so slightly off when the tree gets larger. For instance, if the tree is in a format such that the root needs to be two tree links down, it fails to balance properly. I think I need a recursive case somewhere, but I haven't been able to implement one.

Do I need to call this function all the way down to the end of the tree recursively, or something else?

TreeNode* CheckHeightAndRotate(TreeNode *root)
{
int balance = getBalance(root);
int rBalance = getBalance(root -> rightChild);
int lBalance = getBalance(root -> leftChild);

if(balance > 1 && lBalance > 0){
root = rightRotate(root);
return root;
}

if(balance < -1 && rBalance > 0)
{
root = leftRotate(root);
return root;
}

if (balance > 1 && lBalance <0)
{
root -> leftChild = leftRotate(root -> leftChild);
root = rightRotate(root);
return root;
}

if (balance < -1 && rBalance > 0)
{
root -> rightChild = rightRotate(root -> rightChild);
root = leftRotate(root);
return root;
}
return root;
}


So if the tree requires more rotations than the one, it shits the bed. Any advice where I need my recursion?
>>
When should I use views and table-returning functions in SQL?

For example, would it be enough for security to have a view that returns all usernames and passwords, but limit the query to "SELECT * FROM view WHERE name=specified_name"?

Or is it better to use a function that returns a single row?
>>
>>53506054
>you aren't even supposed to use operator overloading in languages that have them

wow, that's just a really wrong statement. C++ was made in part to allow users to do to their class objects anything they can do to primitive data types.
It grants excellent utility.
think about it
>>
>>53508283
it's generally considered bad practice to use operator overloading. the only reasonable use of it is for arithmetic of vectors, matrices, bignums, complexnums
>>
Is it possible to make Visual Studio Code auto-indent like Atom? Shit is really fucking annoying
>>
File: uEeTMAg.png (112 KB, 688x1434) Image search: [Google]
uEeTMAg.png
112 KB, 688x1434
Java faggots on operator overloading.

>>53508334
>It is bad unless when it is good
haha.

It is also used in strings. also data structures such as vectors. also IO operators (<< >>) so you can write more standard IO libraries. also for comparison operator so you can use with templates to sort or something. also to cast stuff in a more controlled way (bool for example). Also custom assignment operators so it won't be a simple memcopy. Also overloading new/delete for custom allocators. Also for increment operator so you can use it on iterators. Also pointer access so you cna have smart pointers.

Of course non of those can be trusted on java 'programmers' or even available on java so its designers were wise to not support it.
>>
>>53508440
even in the clusterfuck that is C++ it should generally be avoided
>>
def calc_ledgbal():
ledgname = input("which ledger?\n")
c.execute("SELECT * FROM history WHERE ledger = '%s' AND t = 'dr'" % ledgname)
while True:
row = c.fetchone()
if row == None:
break
print (row[0], row[1], row[2], row[3], row[4])

how do i add all results for row4 together
>>
>>53508556
Have the user input
'; DROP TABLE history; --
>>
>>53508440
Operator overloading is syntactic sugar and should be avoided anyways.
>>
>>53508654
REKT
E
K
T
>>
>>53508654
pretend it uses ? instead
>>
>>53508556
10/10 sanitizing input m9
>>
I bet you all smell like Doritos and BO
>>
>>53508201
Nevermind, I managed to figure it out.

In case anybody is interested, you need to call it recursively after EACH time a rotation occurs, not just specific times.

So


if(balance < -1 && rBalance > 0)
{
root = leftRotate(root);
//call the function again here right before returning
return root;
}


Cheers /g/, I hope you have a good rest of the day

n_n
>>
>>53508697
I'm out of doritos, lad :^(
>>
>>53508697
what the hell are Doritos
>>
Why does people recommend java for first language. Java is harder than C++
>>
>>53508733
They want to pump out more codemonkeys quicker
>>
>>53508733
Java should not be a first language. A first language should be a scripting language like Python, Javascript, Ruby, or whatever other ones there are then to move on to the harder ones of Java, C etc
>>
>>53506165
Do you write web applications in C?
>>
I rendered an immaculate circle in opengl using exactly 600,000 vertices and the framerate dropped down to 6fps.

How do I get it to go faster?
>>
>>53508258

p-please respond.
>>
>>53508798
You are probably using immediate mode. Don't use it. Use vertex/index buffers

Also 600k for a circle is kinda high.
>>
File: snake-business-man-236x300.jpg (11 KB, 236x300) Image search: [Google]
snake-business-man-236x300.jpg
11 KB, 236x300
>>53508733
As somebody who is currently learning C++ as his first "big boy language" (I've only played with MATLAB prior to this) I don't think C++ is really a difficult language to learn, but can be difficult to master and do things with as easily as java. (I know GUI's are a hot topic around here)

From my standpoint, if you have absolutely zero experience coding, I'd just start with something like python.
>Easy to get some neat, tangible results goign
>Plenty of resources available
>Learn some of the fundamentals of coding in a pretty fool proof environment

I say start with python (or really whatever scripting language you prefer but python is a MVP to most people) because if you understand how to do a thing in this language and KNOW you can do it, then you can X and apply it in a C++, Java, etc way.

The only reason I could see to start with C++/Java is to just learn more about pointers, dynamic memory, and objects. Because it isn't like they are HARD concepts by any stretch, but it's really easy to make a memory/logic mistake and have absolutely no idea how to fix it.
>>
>>53508814
What's good enough for a circle?
I don't notice the difference between 100 and 6,000,000 vertices, the latter of which runs at 2fps.
>>
>>53508716
some mediocre murrican tortilla chips
>>
>>53508846
If you don't notice difference then 100 is good enough.

But still, use a vbo
>>
>>53508846
you don't need all that many vertices if you have a good shader or if it's all one flat color, it's mainly just the perimeter that will be affected, like if you have one triangle it will be a triangle of course, and if you add more vertices it will look more and more like a circle
>>
>>53505949
if op.faggot():
print 'op is a faggot'
>>
>>53506815
Performance is always a priority, everywhere!
>>
>>53508556
What do you mean by add all results together?
>>
>>53506815
>compiler dependent trash
Why is writing bug free code a bad thing? Enjoy your run time errors I guess.
>>
Anyone know how to fix Atom's fucking stupid autocorrect? I just want self.name here. Why is it giving me all of these dictionary words and other bullshit? Googled around and can't find anything.

No other editor does this nonsense
>>
This is why we need to go back to typing 1s and 0s
>>
>>53509067
try not using a browser as a text editor
>>
>>53509108
any suggestions?
>>
>>53509117

sublime, cuz ur a faget
>>
>>53509117
Vim
>>
What's the easiest (as in, less shit to figure out) way to JIT compile some generate C code? Do I just call tcc or something?
>>
>>53509540
not good for fagets
>>
>>53509540
how about something that doesn't require 9000h of practice before you are productive with it?
>>
>>53509614
vimtutor
>>
>>53509584
call gcc
>>
>>53509117
>>53509067
>>53509494
>Visual Studio Code - doesn't auto-indent with python, shitty autoload system
>Atom - autocomplete-plus suggests useless dictionary words (what the fuck)
>Sublime: ugly as shit, annoying to install themes etc

what the fuck
guess I have to become one of those vim retards
>>
further ray tracer progress
>>
>>53509646
>added 4th sphere
>progress
lad...
>>
>>53509640
>annoying to install themes

If you can't figure this out, then you're hopeless.
Thread replies: 255
Thread images: 30

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.