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

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 323
Thread images: 19

File: pair_programming.png (198KB, 640x480px) Image search: [Google]
pair_programming.png
198KB, 640x480px
Daily Programming Thread

What are you working on, anonymous ?

# New & Revised /dpt/ Code of Conduct #
We want to ensure that the /dpt/ community, while large and diverse, remains
welcoming and respectful to all participants. To that end, we have a few
ground rules that we ask people to adhere to.

- *Be friendly and patient.*

- *Be welcoming.* We strive to be a community that welcomes and supports
people of all backgrounds and identities. This includes, but is not limited
to members of any race, ethnicity, culture, national origin, colour,
immigration status, social and economic class, educational level, sex,
sexual orientation, gender identity and expression, age, size, family
status, political belief, religion, and mental and physical ability.

- *Be respectful.* Not all of us will agree all the time, but disagreement
is no excuse for poor behavior and poor manners. We might all experience
some frustration now and then, but we cannot allow that frustration to turn
into a personal attack. It’s important to remember that a community where
people feel uncomfortable or threatened is not a productive one. Members of
the /dpt/ community should be respectful when dealing with other members as
well as with people outside the /dpt/ community.

- *When we disagree, try to understand why.* Disagreements, both social and
technical, happen all the time and /dpt/ is no exception. It is important
that we resolve disagreements and differing views constructively. Remember
that we’re different. The strength of /dpt/ comes from its varied community,
people from a wide range of backgrounds. Different people have different
perspectives on issues. Being unable to understand why someone holds a
viewpoint doesn’t mean that they’re wrong. Don’t forget that it is human to
err and blaming each other doesn’t get us anywhere. Instead, focus on
helping to resolve issues and learning from mistakes.
>>
Got a weird bug, which I'm pretty sure is a logic error on my part. Anyone wanna help?

Language is Swift.

When I run this code in a Cocoa interface, it saves the value as a string and makes it the placeholder text instead of writing the value. The weird part is when I open the window back up, that value is the placeholder text, and when I submit it, it takes the value, just like I want it to do the first time around.

Effectively it causes a user interface bug where the user would have to save the api key, close the window, open it again, and click save again. Kinda weird.

import Foundation
import Cocoa

class SavePreferences: NSViewController {
@IBOutlet weak var apiKeySavedText: NSTextField!
let defaults = NSUserDefaults.standardUserDefaults()
var apiKey = ""
var apiKeyTitle = NSUserDefaults.standardUserDefaults().objectForKey("userApiKey")

//MARK textfield for api key
@IBOutlet weak var textFieldApiKey: NSTextField!

//MARK save API Key as default preference
@IBAction func btnSaveApiKey(sender: AnyObject) {
self.defaults.setObject(self.textFieldApiKey.stringValue, forKey: "userApiKey")
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)) { () -> Void in
self.defaults.synchronize()
print("apikey saved as", self.apiKeyTitle)
}
apiKeySavedText.hidden = false
}


override func viewDidLoad() {
super.viewDidLoad()
apiKeySavedText.hidden = true
if(self.defaults.valueForKey("userApiKey") != nil) {
textFieldApiKey.placeholderString = self.defaults.valueForKey("userApiKey") as? String
}
}

}
>>
>>52987029
I'm just working on this stupid fucking program that makes it easier to dub/trip/quad post

http://pastebin.com/Y9yaDZBV
>>
>>52987056
>http://pastebin.com/Y9yaDZBV
that creates about 500 requests per second on my machine, nice DoS script faggot
>>
how difficult is manual memory management? I've been doing some programming in school , mainly java, and dabbled in assembly (in an emulator), but I'd like to get into c/c++.

can an average idiot like myself handle c++?
>>
>>52987095
You don't need to do a whole lot of manual memory management in C++
>>
>>52987029
>>>/u/ faggot
>>
>>52987095
Manual memory management is difficult when you start throwing around pointers and need to "save things for later."
In C++ this is made a lot easier with shared_ptr and unique_ptr but it's still quite difficult.

Try to write your own locking algorithms sometime. Pull out "Introduction To Algorithms" and implement the CLH/MCS lock in C++ with smart pointers.
>>
>>52987112
Damn reaction speed still matters though. There might be too much latency between the API data and the state of the board for this to work on faster boards.
>>
>>52987136
>Introduction to Algorithms
not this, but
>The Art to Multiprocessor Programming
This book was written in a Java context, so some features may require the use of Assembly (in particular an equivalent to x86 CMPXCHG8B or CMPXCHG16B) to implement in C++.
>>
>>52987095
[Code]
int *a = new int[100];
...
delete[] a
>>
>>52987050
Found your bug. You're using swift
>>
function factorialize(num) {
var factorArray = [];
var factorSingle = 0;

for(var i = num; i == 1; i--) {
factorArray.push(i);
}

factorSingle = factorArray.reduce(function(a,b) {
return a * b;
});

return factorSingle;
}

factorialize(5);


Why isn't my for loop working? Trying to make an array from 5 to 1 to multiply them and return the factorial.
>>
>>52987280
>i'm not smart enough to contribute non-autistically, so i'll just shitpost :^)
>>
Anyone familiar with matlab? Trying to pass a concatenated string variable into fopen but it keeps throwing errors at me. Doing a normal string like 'c/.../.../..txt' works but having a path string concatenated with the filename string doesn't
>>
>>52987354
>I'm not smart enough to do my own homework so I'll ask a North Korean Sexbot enthusiast fishing post
>>
>>52987333
i == 1 is your problem
>>
>>52987029
I totally forgot, but

Go fuck yourself, you braindead faggot.
Seriously.
>>
>>52987333
>i = num; i == 1;
GUISE WHY IS IT NOT WORKING????
>>
>>52987394

now THATS a capital meme, carry on mate!!
>>
>>52987418
Do you have to act like a retard?
>>
>>52987430
Stupid questions get stupid responses. Go fuck yourself dipshit.
>>
>>52987430
>WHY ARENT U DOING MY HOMEWORK G???

I bet you're CS trash.
>>
File: 0103.jpg (13KB, 252x276px) Image search: [Google]
0103.jpg
13KB, 252x276px
>>52987440
What if I don't?
>>
>>52987453
I'll force feed you my semen until you do.
>>
>>52987430
I mean the point is that you knew where the problem was. that your for loop wasn't working, but you didn't look into it enough to figure out why it didn't work. You could have tried printing the contents of the array after the loop, to see if it was working,
>>
>>52987095
Not difficult at all

c++ isn't really a crazy language either, it comes with a load of bulky libraries that do shit for you. If you can program in Java, you can do C++.
>>
>>52987333
Because you're not using recursion :^]
def foo(a):
if a==1: return 1
return foo(a-1) *a
>>
>>52987463
You promise?
>>
File: XadkW.jpg (705KB, 3473x1954px) Image search: [Google]
XadkW.jpg
705KB, 3473x1954px
Programming some ultralight beams that I saw last night in my god dream
>>
>>52987507
You don't even need recursion
def fact(n)
(1..n).reduce(:*)
end
>>
>>52987526
I'm not prepared for those kinds of commitments.
>>
>>52987561
BLASPHEMY
>>
>>52987571
In ruby, reduce and inject (they're both the same) it's implemented as a for loop.
>>
>>52987029
Not to shitpost, but fucking really? What is this code of conduct shit?
This isn't Reddit or Github, fuck off with this shit
>>
>>52987661
It's a commentary on that you sperg.
>>
>>52987669
Oh fucking hell
Disregard that, I suck cocks
>>
>>52987661
It's supposed to be for irony, but no one seems to realize that it's not funny and that there really is people stupid enough to take it seriously.
>>
>>52987661
Fucking irony is dead.

REEEEEEEEEEEEEEEE
>>
>>52987669
>>52987796
>>52987820
>Any community that gets its laughs by pretending to be idiots will eventually be flooded by actual idiots who mistakenly believe that they're in good company.
>>
>>52987796
ironic shitposting is still shitposting, it's not funny, and at worst you're just enabling/encouraging real zionist sjw faggots
>>
>>52987876
there is literally nothing wrong with having a CoC
>>
>>52987967
Prime example of >>52987876
>>
>>52987967
>CoC
>reminds me of cock
TRIGGERED
>>
>>52987029
Good books about database engineering?
>>
>>52987029
>New & Revised /dpt/ Code of Conduct
>>52987967
EAT SHIT, GO CHOKE ON A BOWL OF DICKS AND DIE YOU COC LOVING FAGGOTS

>>52987661
>>52987796
>>52987876
>>52987882
stay vigil, brothers
the cancer is spreading
>>
>tfw your variables don't line up

help
>>
I could never feel safe coding unless I had proud feminists protecting my feelings.
>>
>>52988199
I never feel comfortable coding unless I'm wearing a schoolgirl outfit. :3
>>
>>52987095
>>52987503
You can always run the program through valgrind to see where you fucked up.
>>
Reminder that good solutions are better than bad solutions.
This may already seem extremely obvious, but /g/ often forgets this when they suggest functional or OOP solutions to any problem.
>>
>>52987095
The larger your program, the worse it gets.
>>
>>52987998
>database engineering
lmao
>>
>>52988402
what good solutions? for non-trivial problems you will have state and you should group things in structs/namespaces at the very least which is kind of OOP
>>
>>52987376
how can it be homework when I'm a NEET?
>>
>>52987095
You allocate memory and you free memory.
How hard could it possible be?

>assembly (in an emulator)
>(in an emulator)
Oh right, you're retarded, but don't worry! manual memory management is easy even for dumbfucks!
>>
Is it true that C++11 supports garbage collection?
>>
>>52988459
the implementation is not required to support it
>>
>>52988435
OOP as in what you'd see in C++, C#, or Java.
The OOP you'd find in C is technically OOP, but it's the only acceptable form of OOP.

And functional as in the functional you'd find in haskell.

These are what's know as bad solutions.
>>
>>52988459
yes, it's because the language is garbage itself

> 2016
> still using a language that can't even average integers
>>
>>52988471
lol k tard
>>
>>52988256
...what kind?
>>
>>52988478
Enjoy knowingly implementing bad solutions when good ones exist and you know it.
>>
>>52988486
enjoy being stuck in the 1980's and you know it
>>
>>52988471
>C++ classes aren't objects
>can't get a pointer to a C++ class
>can't check if one class is a subclass of another class

If C++ is object-oriented, then Python is functional.
>>
>>52988425
?

I want to write one for fun and learning, what's wrong with that?
>>
>>52988494
Are you saying 1980's solutions are good solutions?
Well whatever, it doesn't matter, the truth still stands than good solutions are better than bad solutions no matter where they came from.

I think you're also trying to imply that old things are bad, which isn't true and childish to think so.

>>52988508
I didn't say C++ was a good object oriented language.
>>
>>52988518
>good things are better than bad things
what are you even on about, tard
>>
This is the state of /dpt/ today.
They're actually arguing against good solutions and for bad solutions.
Who the hell argues for bad solutions? /dpt/ everyone.
>>
Give me a good reason to use private ever.
>>
>>52988536
you're a fucking retard
>>
>>52988529
Yes, that's exactly right. Good things are better than bad things, following that logic, we come to the solution than OOP and functional solutions are bad solutions.
It is really quite simple but this is something /dpt/ seemingly doesn't understand, that good things are better than bad things.
>>
>>52988543
>do my homework for me
>how do i google
kill yourself
>>
>>52988543
Because you're a naughty gurrl who can't be trusted to obey OO paradigms
>>
>>52988551
you either have severe assburgers or you should fuck off back to /b/ with your epin funposts
>>
>>52988553
Homework? Nigga just tell me why I shouldn't set everything to public. Do you hate freedom?
>>
>>52988558
So if I understand your argument correctly, you're saying that bad things are better than good things?
Why do you suggest so and do you have anything to support this claim?
>>
>>52988560
don't expect me to spoonfeed tards all the time

one of the major points of using OOP is for encapsulation. like if you have a car, do you drive just the bare chassis? no you have a body and an engine hood to cover the car so some fuck can't just pull out the spark plug or whatever so your car gets all fucked up
>>
>>52988580
Stop replying to him you stupid fuck.
Jesus christ I'm pretty sure you're the one actually baiting me to respond to you.
>>
Give me the hardest puzzle you got and I will solve it in less than 10 seconds.
>>
>>52988580
But you CAN open a car and pull out the spark plug.
>>
>>52988591
x86 emulator.
>>
>>52988589
>falling for the double bait
>>
>>52988594
not without breaking into it (using reflection) if you don't have the key
>>
>>52988580
So what you're saying is I should write my OO code to be fully public, then write a fully public OO wrapper on top of that code that handles all the stuff for you. That way you can use it without getting into the details, but you CAN go deep and fuck with the details if you want.
>>
>>52988543
In C++, private members are part of the class's public API. When you change your privates, all clients of your class need to be recompiled - you can't just drop in an upgraded version of your C++ library and expect it to work.

Not without the insane acrobatics of declaring all of your public members in one class, declaring all of your privates in another, and having the public class merely contain a pointer to the private class whose type isn't exposed in your API.
>>
>>52988598
Serious replies only please.
>>
>>52988543
>programming illiterate
https://code.org/
>>
>>52988617
Maybe.
>>
>>52988617
you can still fuck with the details of the private implementation

are you even trying to understand
>>
File: puzzle.png (237KB, 742x476px) Image search: [Google]
puzzle.png
237KB, 742x476px
>>52988591
>>
HELLO FROM THE OTHER SIDE
>>
>>52988650
I meant programming puzzles.
>>
>>52988636
Great, I knew OO was the solution to OO.

>>52988640
How? They're private, you'd need to do some dumb shit.
>>
>>52988626
Okay, I will be serious now.
Fully PC compatible VM with support for all common interfaces including DMA & PCI(E) and peripherals including a VGA compatible device and input.
x86 virtual CPU included and support for SSE and virtualization extensions.
All of this must be fully compliant and capable of running MS Windows, Linux, and *BSD and speeds comparable to vbox or qemu.

You said you wanted my hardest challenge, so here it is and hurry and and solve it in 10 seconds.
I'll be waiting, faggot.
>>
>>52988657
you as the programmer can change the private implementation. if you're merely using the object without changing its implementation, you can't use private methods and variables except with reflection
>>
>>52987029
plz, can you give challange boss plz


Can a nice 4chan cunt post all current programming challenges?

from
>Some cunt who wants the fucking challenges.
>>
>>52988591
Write a program that will determine if any arbitrary program will complete a computation on a given input.
>>
>>52988675
Yeah but what if someone needs to use a private variable to solve a problem or make my program behave in unexpected but beneficial ways? I think it's optimistic to believe your code is perfect and that implementation needs will stay the same forever.
>>
>>52988692
the private implementation may change in future versions which is one of the reasons they're set to private, so you don't have to worry about them. if you need functionality that the public interface can't offer then make your own implementation or use reflection.
>>
Getting decent cache efficiency seems to do about twice as well as normal blocking. Trying to get intrinsics in, or doing loop unrolling, however, makes things worse :(

But at least I've optimized this shit well enough to get a passing grade...
>>
It's funny how when you think about functional programming and have a laugh but then you realize that functional is actually a real paradigm that people use, and then you lose all faith in humanity.
>>
>>52988777
you are trying too hard
>>
>>52988809
it's true though
>>
>>52988809
You're not trying hard enough.
>>
Has anyone used my VichanSharp library? I posted it yesterday, wondered if anyone had a chance to try it out and has any feedback.

It's on NuGet and GitHub so having people contact me with bugs and feedback is obviously never going to happen.
>>
>>52988591
average 2 ints
>>
>>52988853
In D
>>
>>52988872
>D
XXXDDDDDDDDDDDDDDDDDDDD
EPIC MEME BRO

LOOK HE POSTED THAT LE EPIN FUNNAAAY MEME AGAIN GUYS LOLOLOLOLOLOLOLOL
>>
>>52987029
>that coc
Words cannot hurt you. Fuck you, nigger, chink, spic, gook, kike, wop, faggot, cunt, kimchi, slope, redneck, retard, pansy. Are you feeling hurt?
>>
>>52988777
Functional programming and object oriented and other ways programming are just tools. You may use one in one in one part of the project and another in another part of the project that might benefit from it. Learn how to encapsulate your shit and it shouldn't matter.

Languages who force you into a "paradigm" are shit and should feel shit, learn C++ (tm) today!

Also, >>52987998 anyone?
>>
boards.4chan.org/g/thread/52987029

I want to get the board ID out of this URL, any ideas? I've never been very good at string manipulation.
>>
>>52988914
>are just tools.
Imagine if someone created a tool that is completely and utterly useless and only breaks whatever it works on.
That is OOP and functional programming.
>>
>>52988922
if (url.IndexOf(@"/g/") != -1)
board = @"/g/ - Technology";

Always use the simplest option.
>>
>>52988922
strncpy(id + strlen(strerror(ENOMEM)), url + time(0), getpid());

That should do it.
>>
>>52988930
Object oriented programming is nothing more than thinking about the objects before thinking about what they can do.

Functional programming is nothing more than thinking about programming elements through the actions available to them.

You, like most, do not know what you're talking about.
>>
>>52988957
I agree with what you're saying, but to maintain the goalposts of my previous posts, you are still wrong.
>>
include <stdio.h>

int main(void) {
printf("Potato\n");
return(0);
}


I am smart now thx guys if any question just ask me i can answer anythin
>>
>>52988972
What fucking previous posts? Were you attacking the concept or weren't you? You spoke about the functional approach and the object oriented approach, so did I, are we not talking about the same thing?

>You're right, but you're wrong.
I dong get it, when did I ever contradict myself?
>>
PLEASE
>>
STOP
>>
>>52988994
awwww fook i forgot the hashtag pound symbol ###################
>>
>>52988994
why aren't you using the objectively superior allman style?
>>
REPLYING
>>
TO
>>
ME
>>
>>52989007
tha wat
>>
>>52988995
>being bait that hard
just ask him what's his experience in both oo programming and functional programming.
>imba <10kloc projects
>>
>>52988972
Wow, what an enlightening post. That sure raised the standard of academic education throughout this forum.
>>
>>52989035
>being bait that hard
It's not like I don't hear people complaining about OOP and FP all the fucking time without them even realizing what those things entail. If this is bait it's not a very good joke.
>>
>>52988891
18+
>>
File: 1449756574386.jpg (3MB, 3264x2448px) Image search: [Google]
1449756574386.jpg
3MB, 3264x2448px
>>52988930
kill yourself idiot

let me guess, you would defend pic related? if not, then what paradigm do you think isn't shit?
>>
is there any relatively simple way to transparently hook code in a specific process in gnu/linux? the original code shouldn't be modified
the only thing i found was debug registers but those can't be used from user space
>>
>>52989441
I don't know why on earth you keep posting that image.
What the hell is it supposed to prove? It was written by a novice.
>>
>>52989476
What are you trying to accomplish?
>>
File: It's not possible ....jpg (152KB, 1003x767px) Image search: [Google]
It's not possible ....jpg
152KB, 1003x767px
>Iter, Map and Fold are a subset of ZipN's
>>
>>52987029
Why can't any language compete with Python in terms of concise code & libraries?
>>
File: IMG_20160215_115641.jpg (60KB, 512x385px) Image search: [Google]
IMG_20160215_115641.jpg
60KB, 512x385px
>>52988256
I am sat here very comfortably wearing a frilly maid outfit right now (very awkward angle looking down, so whatever), sipping Earl Grey tea in the early afternoon - and designing a key management system around Let's Encrypt out of #!/bin/sh shell scripts and openssl -checkend.

It's nice how they're implementing ECDSA support on the staging server. I can't wait for it to go live, but it does mean I will have to handle more than one type of cert and handle it carefully.

Fortunately, ACME is easy and there's plenty of work out there already for me to build on, it's really just a framework around that. Probably going to cron job it. Just deciding what, precisely, I need is really the hardest part here.
>>
>>52989604
>& libraries
C has way more fucking libraries than memesnake. In fact, if any library does not expose a C interface, you can consider it completely useless.
>>
Working on a polynomial calculator in Java for class. I've got all of it done besides dividing and trying to do it recursively is making me realize how incompatible it is with the rest of my code so I've gone back and rewritten a lot of it.
>>
>>52989580
hooking functions in a video game, so when the specific function is called it calls my function first

it's easy to do but it's easy to detect that the original code is modified so i need a way to hook it without modifying the original code
>>
>>52989642
Is the game engine stuff dynamically linked?
If it is, you could use LD_PRELOAD to overwrite their functions, do your crap, then call the original.
>>
>>52988650
I can only get 8, but not 9.

Do I get half a gold star?
>>
>>52989593
>ZipN is a subset of FoldN
>>
>>52989663
they aren't, i do that for glxswapbuffers so i can draw on screen
>>
>>52988650
>>52989670
Well shit, it would be nice if the text mentioned you are adding 3 lines to the 'M' and not just a blank canvas.
I thought it was just a stock "uncomfortable scientist" image.
>>
>>52989622
Jesus christ, iron your clothes.

2/10, shit maid, would not hire.
>>
>>52989709
I don't think there will be a way to insert code without modifying the original functions then.
>>
>>52989773
debug registers seem like they do what i want however they can't be used from user mode and most things i find about them on linux are about gdb, guess i will do some more research
>>
>1989
>1999
>2011
>still can't average 2 ints in 1 cycle
MEMORY
O
D
E
L
>>
>>52989561
then tell me what is so good then if both OOP and FP is shit

fucking retard
>>
>>52988670
already done
>>
>>52989711
you get a gold star, friend
>>
I'm taking Java classes in uni right now and my professor spends like half the class time talking about how shit Java is

Why is it so widely used if it's such a shit language?
>>
>>52989868
you have a shit professor
>>
>>52989868
it's not shit, it's just ahead of its time
>>
>>52989881
>Stuart Reges
>shit
He left Stanford after they caught him doing cocaine and selling alcohol to kids, seems pretty cool to me
>>
>>52989868
>Why is it so widely used if it's such a shit language?
Unfortunately, popularity has nothing to do with quality.
Sun/Oracle just marketed the shit out of it and it unfortunately stuck on with the ENTERPRISE.
>>
>>52989898
the quality of java is a matter of subjective opinion. there are tremendous benefits of using java vs other languages
>>
>>52989906
can it average 2 ints?
>>
>>52989906
And there are tremendous benefits in using other languages instead of Java.
>>
>>52989911
int avg(int a, int b) {
return ((long) a + b) / 2;
}


>>52989913
yes, like C++ for instance can be useful it you need to get the maximum performance.
>>
>>52989906
>>52989913
Also, if Java is so great to use, why does everyone who writes Java try not to write Java?
You have shitloads of JVM crap like Jython, Jruby, Scala, etc.
>>
>>52989920
You can't be sure that long is longer than int.
>>
>>52989920
int avg(int a, int b) {
return (int) (((long) a + b) / 2);
}


forgot java has strong typing (which is a good thing)
>>
>>52989930
in java, you can. that is also another benefit of using java. an int is always a 32-bit and a long is always a 64-bit 2's complement integer.

>>52989927
those are obscure hipster meme languages. the real deal is by far more popular than those languages.
>>
File: 1455155298915.jpg (29KB, 500x335px) Image search: [Google]
1455155298915.jpg
29KB, 500x335px
>>52989868
>>52989898
This, cucks took over the industry unchecked and made it the standard. Now everyone is churning out cucks from cuck university. C/C++ for life fsggots
>>
Is there a programming language that can't average 2 ints?
>>
>>52989938
python can't average 1 int
>>
>>52989935
>C/C++
Please stop grouping those two completely different languages together.

>>52989938
Any Turing Complete language should be able to.
>>
>>52989938
any turing-complete language can average two ints, just with varying difficulty
>>
>>52989946
>>52989948
can it do it in 1 cycle?
>>
>>52989934
I didn't know it was shit Java and not glorious C. Sorry.
>>
>>52989931
that's not strong typing.
>>
>>52989977
how is it not? you have to explicitly cast from long to int
>>
>>52990020
strong and weak typing is about when you can circumvent the type system or not.

what you are doing here is actually an unchecked cast. a safe cast would have an semantic like

(int)(x) =
if (x > max_int or x < min_int)
raise exception(...)
return x


https://en.wikipedia.org/wiki/Type_conversion#Type_promotion
>>
>>52987056
>http://pastebin.com/Y9yaDZBV
>upper case method names
MY EEEYYES...
>>
>>52990136
it's C#
>>
>>52989711
how the heck do you get 8 triangles using 3 lines on a blank canvas anyway
>>
File: 1455530658361.png (198KB, 742x476px) Image search: [Google]
1455530658361.png
198KB, 742x476px
>>52988650
BOOM
what do I win?
>>
>>52990203
Oh fuck, bottom left isn't a triangle.
end me.
>>
>>52990225
nor is the thing to the right of it
>>
File: 1442003693768.png (155KB, 500x464px) Image search: [Google]
1442003693768.png
155KB, 500x464px
>>52990233
that's what happens when you rush shit at work.
>>
Where the fuck is the Umaru-chan /dpt/?!?!
>>
Best language for a cross platform desktop/GUI-based application?
>>
>>52990299
C++ w/ Qt.
>>
>>52990299
Java w/ JavaFX
>>
>>52990311
>seeples
>gui
>2016
ishyggy
>>
>>52990299
JS w/ Electron
>>
>>52990299
java or C++
>>
>>52990299
Python w/ Tkinter
>>
>>52990299
c# w/ Windows® forms
>>
>>52990455
>cross platform
>windows forms
end yourself
>>
File: clip+(2016-02-15+at+05.50.59).png (210KB, 742x476px) Image search: [Google]
clip+(2016-02-15+at+05.50.59).png
210KB, 742x476px
>>52990243
here is my solution I think it's correct
>>
>>52990197
Stop thinking in two dimensions.
>>
>>52990299
Free Pascal w/ LCL.
>>
>>52990299
C w/ Average Memory Model in 1 Cycle.
>>
>>52990299
TypeScript w/ Node-Webkit!
>>
>>52990469
do you have a picture or anything
>>
>>52990299
HTML w/ CSS
>>
>>52990465
it works on windows 7, windows 8 as well as windows 10

it's cross platform
>>
>>52990530
>pajeet
>poo in loo
>designated
>>
>>52987095
Mystruct *Mystruct_new()
{
Mystruct *mystruct =
calloc(1, sizeof(*mystruct));
return mystruct;
}
>>
Please suggest some programming project ideas that would use Artificial Neural Networks.
>>
>>52990591
>calloc
webcuck detected
>>
>>52990622
something to do with image recognition if you don't want to work too hard
>>
>>52990622
robocode
>>
>>52990512
A sphere. A "straight line" drawn on a curved surface is still a straight line.

Two axis rings (e.g. prime median & international dateline, continued around the "back" of the globe) will split a sphere into 4 wedges. another axis ring (e.g. equator) across them gives you 8 half wedges.
Each wedge will be (from the original sphere's surface) an equilateral triangle with three 90 degree angles.
>>
>>52989441
>Shitting on my unfinished code
Wew lad
>>
>>52990660
Sorry, not the international dateline, but 90E/W from pole to pole. There isn't really a friendly name for it that I can think of.
>>
>>52990629
Give me a good reason to not use calloc, it's much better then malloc + memset.
>>
>>52990660
I understand non linear coordinate systems but I was under the impression that some image wouldn't ask me to compose shapes in non standard euclidean space

also saying "non cartesian" would have been more clear than "not 2d"
>>
Looking to make a home automation software, was going to use voice control to control the server but after contemplating I have come to the conclusion that a web interface would be more appropriate at this time.

I would like to implement the oracle web logic server into the website so that I can scale the software and learn the REST api in the meantime.

What would /g/ suggest coding the software in, I would like to use java for TTS, but other than that I don't know much about web development. The site needs to be scaleable as I will be using my main computer & phone/tablet/laptop to control the server.

Also I have plex installed on the server and would like to be able to control music from the website and get it to play through the server which is connected to my speakers... is this possible?
>>
>>52990754

If you want to use it to zero initialize a block of memory, I guess it's fine. Otherwise, the zero initialization is a small waste of time to do and you are better off with just overwriting the junk values from malloc, although in the grand scheme of things, it matters little.

The OS doesn't always guarantee it has a block of memory that is 0 initialized for you ready for your calloc calls which makes it as fast as malloc.
>>
>>52990789
you don't need it to scale for that many devices

you can play music on the server, not sure if plex will help you with that tho, mpd is probably a better choice for that
>>
>>52987125
Kill yourself hetfag, women are leaving abusing and degrading hetero relationships and are seeking refuge with a lesbian relationship.
>>
>>52990299
Python with PySide
>>
>>52990822
>
iirc statistics say lesbian relationships have the highest number of reported abuse per couple, where as gay guys have the lowest
>>
>>52990812

I realize I don't need it to scale, but I would like for it to scale I have plenty of free time and may as well put everything I have into it and make it professional for usability.

I was wondering if I could utilize plex as a way of using their album art/web interface to play on the server from a remote host.
>>
>>52990792
Well if I was going to initialize all the members of the struct that I'm allocating then I would just use malloc, but sometimes I just want make sure there is absolutely no garbage memory in the worst case scenario.
>>
>>52990853
do you have additional computers you can scale with?

i don't think plex server itself will play any content, you need a client. you can then try to control the plex client from your app. don't think you'll be able to easily get the plex web interface integrated into your app though
>>
File: 1448821505008.png (427KB, 514x662px) Image search: [Google]
1448821505008.png
427KB, 514x662px
How does one check the proxy type and version via code? (That is, decide whether it's SOCKS5, HTTP or some other type.)
>>
>>52990467
yep that's it well done
>>
>>52990943
try it each way
>>
>>52990912

I have every computer in my home, 6 students, 2 computers each, some @ 4k, some @ 3440x1440 some @ 1080p some @ 720p, phones and tablets with various resolutions. I am creating this for the whole household to be able to control various things around the house, ofc requiring authentication for things in each others rooms but that's another topic and easy to solve.
>>
>>52991029
i mean if you're going to scale, you'll need more machine to run your app server on.

you can't scale with just one pc.
>>
>>52991046

I am running this on a Xeon 2650v3, I do not need it to scale past the cpu's limits, I mean scale-able as in the website scales with resolution, I know networking, just not web development
>>
>>52991066
use css flexboxes
>>
>>52991066
ohhh, that's what you meant by scale. my bad.

have you heard of responsive design? great for this sort of thing
>>
>>52987333
>javascript function that gets called right away in the code
>not using an IIFE

Embarassing.
>>
>>52991084
>>52991108

responsive design and css flexboxes, thank you very much guys!
>>
>>52990754
>better then malloc + memset
who said you should use memset?
>>
>>52990867
>make sure
>absolutely no garbage
>worst case scenario
the worst case scenario would be structure containing a pointer on a platform were null is not represented by all-bits-zero; so you failed
>>
What's the best C or Python 3 library out there for crafting packets?
>>
>>52991249
struct
>>
>>52991277
I meant crafting and sending network packets.
>>
>>52991311
consider literacy
>>
File: 1376693332623.jpg (31KB, 245x204px) Image search: [Google]
1376693332623.jpg
31KB, 245x204px
>/dpt/ will never stop the bullying of java
>>
>>52991249
>C
>library
You 'avin a giggle?
>>
>>52991249
Scapy
>>
>>52991367

Some of it is well deserved. Some not so much.
>>
>>52991367
>no bully
>coc
>cuck
>fuccboi
>>
>>52990842
oiled lesbians' fights streaming where?
>>
File: screenshot-4.jpg (40KB, 404x349px) Image search: [Google]
screenshot-4.jpg
40KB, 404x349px
>>52987029
I'm building a 2D game.

Am I literally retarded for wanting to make an engine from the ground up ?

>pic related
>>
>>52991592
yes
>>
>>52991592
no, it's very easy to make a 2d game engine, especially for that kind of game as in your pic. game engines are generally intended for 3d games (hence the unity engine was called unity3d), they have almost nothing to offer for 2d, they just constrain you in what you can do
>>
>>52991645
>very easy
show your code, fgt
>>
>>52991670
>gibs me dat
how about no
>>
>>52991223
Try using plain old malloc for something like snprintf, you will want the buffer cleared.
>>
>>52991592
You need Unity3D to render realistic frilly laces on the girls hats and stockings.
>>
>>52991728
>plain old malloc for something like snprintf
absolutely no problem with it
>>
>>52991714
>I have none
as expected, pajeet
>>
>>52991871
>he thinks you need to use unity3d/gamemaker/unrealengine4/etc to make a 2d game
>>
>>52991895
>I haven't shipped a game but I think it's easier to do it from scratch
fuck off to your designated place
>>
>>52991895
>he spends 7 years making a shmup with nothing more than autism and opengl
>>
>>52991907
>>52991917
even a pajeet can make a rudimentary version of flappy bird, with no pre-built babby engine. any high schooler can make pong. it's not that hard, faggots.
>>
>>52991927
>even a pajeet
>any high schooler
>not that hard
show yours
>>
>>52991927
Touhou is anything but a simple 2D game. I suggest killing yourself.

You are a 2/10 troll though, so not mad
>>
>>52987430
Better than being one
>i==1
>>
>>52991950
>>52991958
keep believing that, underachieving normies w/ no math ability, having to resort to using drag and drop engines and deluding yourselves into thinking your games are any good
>>
>>52991977
What would you rather have.
1) A product that people can use ?
2) A mess of spaghetti that took you years to code ?

Those of us in the real world acknowledge that you have to make money to live.
>>
>>52991994
>he thinks people will play his cobbled together uninspired garbage for more than 5 minutes
>he can't make a piece of software without turning it into a mess of spaghetti
lol @ u
>>
Pajeet did nothing wrong.
>>
>>52992012
>He still thinks that you can code a game into becoming good.
>Doesn't acknowledge ease of production increases game design considerations
>>
>>52991977
>still showing nothing
we know you're a webcuck
>>
>>52987029

who the fuck wrote those autistic rules? pretty pathetic tb honest. Reminds me of the shithub activists
>>
>>52992043
>>52992054
i don't have to prove anything. also >>>/vg/agdg
>>
>>52992039
>designated
>nothing wrong
m8
>>
>>52987112
>my trips
FAIL
>>
>>52992071
>I have nothing to show because I write CSS all day
>my opinion on game development matters
fuck off
>>
>>52992071
As soon as you use three >,
you have admitted just how wrong you were to attack the idea of using preprogrammed game development software.

Mind you, I'm still using opengl to code this since it's more valuable on a portfolio.

Just wanted to know if there was a better way.
>>
>>52987167
you can't time it perfectly. there's latency and the rate of posts isn't constant. also the rate of posts tends to go up by a lot during big gets
>>
>>52987029
I'm working on a pic related renderer in Rust and SDL2.

When I build using the --release flag I get C-like performance, but if I don't, it's atrocious. I suppose this is how rustc optimization works?
>>
>>52992099
no you fuck off to >>>/vg/agdg adhd nomath enginebabby
>>
>>52991994
>those of us in the real world
Enjoy being a wage slave, cuck. I don't give a fuck about that shit. I write the code I want to write and enjoy myself doing so. No need for babby engines so I can get my next paycheck before I get evicted.
>>
>>52992099
Stop projecting and get back to work. You have some responsive CSS to vomit.
>>
>>52991950
>>52991958
>>52991977
>>52991994
>>52992012
>>52992043
>>52992071
>>52992126
>>52992167
find a room already, you two
>>
>>52992126
>>52992190
>I'm mad for getting told
>projection meme
>>
>>52992197
I'm an intruder
>>
>>52992066
>Reminds me of the shithub activists
it is suggested >>52987796 to be an ironic reference to them

either that, or SJW cancer is spreading here
don't forget that moot was cucked by an SJW bitch
>>
>>52992167
>I've never finished a game
>>
>>52992218
aight, you can join them and watch
>>
>>52992167
I didn't know /g/ was a hobbiest board.
If you've ever tried to write a game you'll realize just how large of an undertaking it is to make one that isn't shit.

ZUN who does all the work for Touhou sleeps 4 hours a day to put out a game every year

>>52992197
3 people actually
>>
>>52989622
>those wrinkles
embarrassing lad
>>
>>52992235
And what engine does he use? He surely can't have a fucking world record in churning out games if he doesn't use a prebuilt engine, right?
>>
>>52987056
>
                                    }
}
}
}
}
}
}
>>
>>52992265

He codes it all from scratch, probably using his own self built engine like what I want to do.

But using an engine in of itself does not disqualify your product.
>>
>>52990299
HTML, CSS, and javascript
>>
>>52992265
i doubt it uses a pre-built engine. it's not that fucking hard you fucking plebs. it may look a bit scary if you've never done it but fuck off with this fiction about it being some impossible task.
>>
>>52992298
>I never shipped a game
pls just leave
>>
>>52992298
It's not impossible, it's just retarded to do yourself since there are other engines out there that are just fine. DRY
>>
>>52992316
>>52992318
k tards

literally the game he gave as an example apparently was built from scratch by 1 guy and you say it's retarded to do it if you want to make a game like that... lol
>>
I can't understand the behaviour of the following C program:
 
#include <stdio.h>

double sqr(x) {return(x*x);}
#define sqr(n) n*n

int main(int argc, char *argv[]) {
double a[] = {1.0, 7.0};
double *p = a;

printf( "sqr(3.0) = %f\n"
"sqr(3) = %d\n"
"sqr(3+3) = %d\n"
"!sqr(3) = %d\n"
"(sqr)(*p++) = %f\n"
"(sqr)(3+3) = %f\n",
sqr(3.0), sqr(3), sqr(3+3), !sqr(3), (sqr)(*p++), (sqr)(3+2));
p--;
printf("(sqr)(*p++) = %f\n", (sqr)(*p++));
return 0;
}

I'm aware the macro should be
#define sqr(n) ((n)*(n))

but that's not what I can't understand, running it prints
sqr(3.0) = 9.000000
sqr(3) = 9
sqr(3+3) = 15
!sqr(3) = 0
(sqr)(*p++) = 25.000000
(sqr)(3+3) = 25.000000
(sqr)(*p++) = 0.000000

My problem is with the last and third to last lines. For some reason, (sqr)(*p++) takes the same argument as whatever is in the second sqr call, in this case 2+3 = 5 and 25 is printed and the p pointer is not incremented. What I was expecting to see was
sqr(3.0) = 9.000000
sqr(3) = 9
sqr(3+3) = 15
!sqr(3) = 0
(sqr)(*p++) = 1.000000
(sqr)(3+3) = 25.000000
(sqr)(*p++) = 1.000000

At first I thought since x isn't explicitly assigned a type and is assumed to be int might have something to do with it, however if I change the declaration of sqr to
 double sqr(int x) {return(x*x);}
it prints what I expected it to.

I know it's probably something stupid, but for the life of me I can't figure out what.
>>
>>52992298
Yeah it's fucking easy to draw some sprites on a screen at a reasonable framerate. And yeah it's easy to add shaders. And yeah it's easy to add post processing. And yeah it's easy to add multiplatform support. And yeah it's easy to implement APIs for stuff like ads/steam/whatever.
Oh whoops you're now 4 months into development and you have fuckall game to show for it. And all your features and more already exist in Unity or have a plugin available for it in the Unity store.
Oh well at least you have -~<your own engine>~-
>>
New thread: >>52992368
>>
>>52992347
>literally
you're literally not him, so shut the fuck up! he gets to do his own engine because he's not shitposting on 4chink; YOU better use a ready-made engine if you want to ever finish a game
but the again, you'd be incapable of making a game even if you use an off the shelf engine and ready-made assets; why? because you're obviously a loser; we can tell from the attitude
>>
>>52992374
let me guess, you haven't shipped a game in unity and you're just imagining that unity isn't complete garbage

kindly fuck off to >>>/vg/agdg where you belong
>>
>>52992398
>you haven't shipped a game in unity
have you shipped a game in anything? or you just like shitposting about how easy game development is?
>>
>>52992397
>YOU better use a ready-made engine
>you're obviously a loser
>projecting this hard
not everyone is completely incompetent
>>
>>52992419
>never made a game
>here's how you should make a game
>more projection memes
just die, loser
>>
>>52992231
>>52992235
>>52992265
>>52992287
>>52992298
>>52992316
>>52992318
>>52992347
>>52992374
>>52992397
>>52992398
>>52992417
>>52992419
>>52992447
and this, keeds, is why gamedev is such a shithole and deserves every srakisyan (*) it gets

(*) from Russian "cpaкa" (sraka) - ass, asshole
>>
>>52992542
>dem grapes sure are sour
tell 'em, pajeet!
>>
>be agdg faggot
>I like dpt because they can answer baby questions about programming and baby shit for 2D games like baby triggo
>see this faggot who tries to talk shit about game development
unity is fine.

Do you think because I use photoshop to make my assets instead of coding my own paint editor somehow make them bad?

>but you're a kid
I'm trying to build my own editors for a custom 2D action melee game in libgdx.
>>
>>52992735
Sorry, rephrase that without the memes please.
>>
>>52992863
unity is just a tool.

imagine a faggot who wants to make a letter and he writes his own microsoft word clone.
>>
>>52992887
except how is unity going to help you make a shmup like >>52991592, especially considering >>52992347 and the fact that performance sucks in unity even for 2d when there are many sprites on the screen?
>>
I love CoCs so much, I think every thread should have them
>>
>>52992956
>I love CoCs so much
faggotry is thataway:
cm / hm / lgbt / y
>>
>>52992943
except unity will allow to not reinvent the wheel and let you focus on building the game, instead of developing the same algorithms and shit is already done in unity.

>but performance sucks
I've done 2D shumps in unity and the performance seems fine, even in old 2011 phones with 100MB of RAM.

if your performance is shit, that means the problem is with your code or you're being ineficient by not using a pool and other shit.

don't blame the tool, unity is likely the best engine right now for indie developers.

if you have the shaders and art (music+sprites) done, you could make a touhou game in less than one month.
>>
>>52992943
I was wondering about that for predesigned engines.
Probably is best to design from scratch.

Maybe an open game engine that can mod the physics systems, but their's a lot of objects on screen.
>>
>>52992735
just go to /agdg/.
game dev is cancer
its been talked about thousands of times
we dont want to see it anymore
pls go
>>
>>52993018
i'll let you believe that
>>
>>52993026
engines are suitable for when you have a predefined concept like a cookie-cutter first-person shooter and you just want to customize the characters, environments and such. but engines will barely help at all for "simpler" things like most 2d games
>>
>>52993038
>muh animu
>muh traps
>muh jerking it to kids
>game development is not programming, we don't want to see that
>animuuuuuuuuuuuuuuuuuuuu
END YOURSELF, CANCER FAG!
>>
>>52993070
>I got told
>my ass got rekt hard
>play it cool though
designated
>>
>>52992365
Undefined behavior.

The macro expands to sqr(*p++, *p++), which has two unsequenced operations with side effects (p++) that modify the same object (an element of a[]).

Compiling with `clang -Wall` should warn you about this.
>>
>>52993297
>(an element of a[])
Why can't I edit my post and remove this. Everything else is correct.
>>
>>52993108
It's just a lot of work.

Self taught OpenGL + GLFW/GLEW is intimidating.
Spent so much time debugging just to generate a square texture on the screen, I can only imagine how much I'm going to have to learn on top of my crappy semester 2 CS classes.

I feel better though knowing that I taught myself CPP while they were learning what Jav isa, an AND gate is and how to prove arguments.
>>
>>52993070
I'm sure you code using notepad or some plain editor you faggot.
>>
File: 1452712593977.jpg (10KB, 255x200px) Image search: [Google]
1452712593977.jpg
10KB, 255x200px
>>52993070
this is a new kind of stupid
>>
>>52993070
>i'll let you believe that
>>
>>52993255
>>52993578
>>52993889
>>52993915
>he is this butthurt
>>
File: 1372245338348.webm (46KB, 644x616px) Image search: [Google]
1372245338348.webm
46KB, 644x616px
>>52994451
Thread posts: 323
Thread images: 19


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

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
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.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.