[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: 355
Thread images: 29

File: DPT.png (389KB, 934x1000px) Image search: [Google]
DPT.png
389KB, 934x1000px
Old thread: >>56778372

What are you working on /g/?
>>
>>56783876
great
then I don't give a fuck about your incorrect broscience
Have fun being angry at "society", old man yelling at cloud.
>>
>>56783891
>Have fun being angry at "society", old man yelling at cloud
again, not me.
>>
>>56783907
If you think that food makes people less capable of paying attention, and you aren't able to provide evidence for this at all, then you are just afraid of things being different.
>>
>>56783922
>and you aren't able to provide evidence for this at all,

idgaf, there's a difference
>>
im pretty noob I have a question

Let's say I'm programming and want to save my program to google drive, dropbox or whatever (maybe github but I've never used it). Is there a way to setup an idea like netbeans so that when I click save it also saves my packages to my google drive?
>>
>>56783938
you care enough to make the claims in the first place and defend them
you even wrote a gigantic paragraph
that you pulled out of your ass

>>56783947
Set your project directory to your google drive folder (you need to download the actual application)
>>
>>56783947
wtf i wrote idea but obv meant IDE
>>
File: 1314969009035.jpg (72KB, 628x473px) Image search: [Google]
1314969009035.jpg
72KB, 628x473px
He doesn't check before Y=-X
>>
>>56783947
there may be a plugin for that....

but dropbox for sure. I used to set my default project folders for idea in dropbox so it would autosync.

you'd be better off learning git / github tho
>>
10th for Haskell
>>
>>56783961
>you care enough to make the claims in the first place and defend them
>you even wrote a gigantic paragraph


>>56783691
>>56783757
>>56783876
nop
>>
Repost:
Anyone got some article on nosql key-value data models that are easly queriable by value?
That is. Let's say I have k keys, with n properties. The db is such that [k] = n1,n2,...,nn. And I need this structure to easly query k and get the ns.
Now let's say I want all ks such that n3=const1 and n5=const2.

My current idea:
Make a [nxconstx] = k1,k2...kn reverse lookup entry and compare the entries for n3const1 and n5const2, but that seems quite wasteful and I end up with duplicated data.

In b4 "get a SQL DB"
>>
>>56784059
"get a SQL DB"
>>
>>56783867
i already know c and c++, should a learn rust? is there any benefit it has over c or c++?
>>
nosql was a mistake
>>
>>56784065
I think engines like redis tend to handle duplicated data in an effienct way so that you dont need to worry about it.
>>
>>56783930
That shouldn't be the case, except for maybe after the scanf call.
fgets reads up to and including the newline character. scanf doesn't do this however.
Really, scanf is a horrible function and you shouldn't use it, because it leaves all of those trailing characters (i.e. the newline) in the stream. You should use fgets + strtol/sscanf:
#include <stdio.h>
#include <string.h>

int main()
{
char buf[256], data1[256], data2[256];
int number;

printf("Input data 1:\n----> ");
fgets(data1, sizeof data1, stdin);
// Remove trailing newline
if (data1[strlen(data1) - 1] == '\n')
data1[strlen(data1) - 1] = '\0';

printf("Input number:\n----> ");
fgets(buf, sizeof buf, stdin);
if (sscanf(buf, "%d", &number) != 1) {
// Some error handling
return 1;
}

printf("Input data 2:\n----> ");
fgets(data2, sizeof data2, stdin);
// Remove trailing newline
if (data2[strlen(data2) - 1] == '\n')
data2[strlen(data2) - 1] = '\0';

printf("data1: \"%s\"\n", data1);
printf("number: %d\n", number);
printf("data2: \"%s\"\n", data2);
}

I just changed data1 and data2 in this example to arrays for the sake of simplicity. Leave them as they were.
>>
>>56784104
Thanks anon, will take a look.
>>
>>56784059
if k is small dont worry about it.

if k is several KB you may..
do a hash of k,
n1,n2.... be keys to the hash of k
the hash of k is the key to value k.

n1,n2,n3... -> hash-k -> k
>>
newbie here
how could I juggle between two method calls, ex:
while (something reaches 0)
{
method 1:
.....


method 2:
.....
}
I want to call method 1, then call method 2 etc alternating.. HOWEVER sometimes when I call method 1 or 2 theres a chance I hit something and it wants me to call the next method twice. IE I can call method 1 and then it might want me to call method 2 twice.
>>
>>56784467
Make a finite state machine.
>>
>>56784467
Okay, assuming that you ALWAYS want to call method1 AND method2, but sometimes you want to call method2 twice, then I can think of a few solutions

1) If method1 and method2 don't need to return anything, you can instead make it return a bool, like so

bool method1(){
bool callTwice = false;
// do stuff
// if we want to call the 2nd method twice, set callTwice to true
return callTwice;
}
void method2(){
// do stuff
}

int main()
{
int i = 12;
while(i-- > 0){
if(method1()){
method2();
}
method2();
}
return 0;
}


2) If you already return a specific value with that function, you can do something like this.

void method1(bool* callTwice){
// do stuff
// if we want to call the 2nd method twice, set callTwice to true, like so.
*callTwice = true;
}
void method2(){
// do stuff
}

int main()
{
int i = 12;
bool b;
while(i-- > 0){
method1(&b);
if(b){
method2();
}
method2();
}
return 0;
}


3) You could take method2 as a parameter of method1, and call it from there. Not the best solution, but it works. Note: this is assuming you're using C++, not C, and I haven't tested it, so the syntax might be off (haven't done C++ in awhile)

#include <functional>
void method2();

void method1(std::function<void()> f){
// do stuff

if(true){ // replace true with whatever condition you want
f();
}
f();
}
void method2(){
// do stuff
}

int main()
{
int i = 12;
while(i-- > 0){
method1(std::function<void()>(method2));
}
return 0;
}
>>
>>56784617
The FSM approach is a lot cleaner, and doesn't lead to complicated conditions:
#include <stdio.h>

enum state {
STATE_1,
STATE_2,
};

void method1(enum state *next)
{
*next = (some_condition) ? STATE_1 : STATE_2;
}

void method2(enum state *next)
{
*next = STATE_1;
}

int main()
{
enum state state = STATE_1;

for (int i = 0; i < 100; ++i) {
enum state next_state;

switch (state) {
case STATE_1:
method1(&next_state);
break;
case STATE_2:
method2(&next_state);
break;
}

state = next_state;
}
}

or without the switch:
#include <stdio.h>

enum state {
STATE_1,
STATE_2,
};

typedef void (*fsm_fn_t)(enum state *);

void method1(enum state *next)
{
printf("a");
*next = (1 < 2) ? STATE_1 : STATE_2;
}

void method2(enum state *next)
{
printf("b");
*next = STATE_1;
}

int main()
{
enum state state = STATE_1;

for (int i = 0; i < 100; ++i) {
static const fsm_fn_t table[] = {
[STATE_1] = method1,
[STATE_2] = method2,
};

enum state next_state;

table[state](&next_state);

state = next_state;
}
}
>>
File: jeb's autism frog.jpg (210KB, 1012x1328px) Image search: [Google]
jeb's autism frog.jpg
210KB, 1012x1328px
Daily reminder that memenads are not math.
>>
How do I refactor my help code? I'm writing a shell in Java for an "Advanced OOP" course in my uni. It's actually more of an SE course.
private static void runHelp(String[] args) {
if(args.length == 1) {
System.out.println("For more information on a specific command, type \"help command\"");
System.out.println("\texit\tExits the shell and terminates the server.");
System.out.println("\thelp\tProvides information on available commands.");
System.out.println("\tstart\tStarts a GUI session of specified view.");
} else {
switch(args[1]) {
case "exit":
System.out.println("Exits the shell and terminates the server.");
System.out.println("\texit");
break;
case "help":
System.out.println("Provides information on available commands.");
System.out.println("\thelp [command]");
break;
case "start":
System.out.println("Starts a GUI session of specified view.");
System.out.println("\tstart admin");
System.out.println("\tstart client");
break;
default:
System.out.println("No help information found for \"" + args[1] + "\".");
}
}
}
>>
PHP noob here.

why the fuck am I being told that a public superclass function is "undefined" on a subclass?
>>
>>56784793
How are you calling it?
>>
>>56784798
$a->getProperty()

(probably doesn't matter, but I'm doing this inside of a foreach where I'm unpacking an array of objects)
>>
>>56784788
i vaguely remember hearing something like using switch in java was bad
>>
>>56784798
nevermind, I'm a fucking idiot. Apparently I should have concatenated the call on the method with the string because it was interpreting the () as part of the string.
>>
>>56784788
One option is using a static Command object, which implements a help() method and an execute() method.
>>
>>56784822
I know it's bad. I can't figure out how I should refactor it to make it easier to add commands in the future.
>>
>>56784845
OOPfags, everybody.
>>
>>56784845
Then I have every available object in an array? So when I make a new command object, I have to add it to the list of commands on the shell?
>>
>>56784274
k is a unique 4 byte identifier.
The problem is not really that the keys may be big, but how to avoid having to load from disk and compare irrelevant data. The inverse lookup size seems pretty small, at worst 100 thousand entries would be 400KB, but doing 100k comparisons for a single simple query seems like a waste of processor if the server is supposed to return thousands of queries.
>>
thanks mate, I was doing something similar now that I think of it (with the function returning a boolean). It's working now
>>
>>56784861
Hey, I hate needless abstraction as much as the next guy. But the asker has to use OOP, so I gave him OOP. Writing a shell in Java is a terrible idea in the first place.

>>56784869
That's one way to do it.
>>
>>56784822
Sounds like most of /g/'s knowledge
>>
>>56784822
Why?
>>
Currently I am writing a javascript evaluator in ruby because I hate myself
>>
>>56784941
idk, it's been fucking years since i used java thats why i'm asking
>>
>>56784920
Well, the shell doesn't need to strictly be OOP. The overarching functionality does, which is what were working on. It's a semester-long project. We have a window for a client and for the admin or manager or w/e. I thought it would make sense for the server to have a shell, and that the server could start client and admin windows.
>>
>>56784952

As much as Ruby is nice for processing text, it would make a silly language to write an interpreter in. Honestly, if I wanted to be able to call Javascript from Ruby, I would write a module in C to bridge the two languages.
>>
File: coorperate machine.png (92KB, 1221x789px) Image search: [Google]
coorperate machine.png
92KB, 1221x789px
Didn't realize old thread was kill :x

I have a DES Encryption program to write, due Monday at midnight, that I've barely progressed on. ;_;

We could use any language we want, I wanted to C but my power level is shit in C so with only a few days left for the assignment I decided to go with familiar old Java. Already regretting it. Having to cast byte arrays into int arrays and manipulate the individual bits is like performing brain surgery with twigs and leaves. Fuck me sideways.

Ah well. I have a thermo test to study for tonight so it looks like tomorrow after lifting I'm gonna pop ungodly amounts of adderall and see if I can burnout race to the finish and write everything out in time for the deadline.
>>
>>56784992
Well, the key to increasing maintainability in stuff like this is splitting the help contents from the help logic. If you want to get fancy, you could generate XML from javadoc comments at compile-time. Then just parse that in your command-line help command. As a bonus, you can reuse that same XML for your GUI help screens.
>>
>>56785144
Yeah, that sounds good. I'll try that.
>>
File: SDLboids.gif (406KB, 408x310px) Image search: [Google]
SDLboids.gif
406KB, 408x310px
My SDL boids!
>>
>>56784952
Why not write it in Haskell?
>>
>>56785207
You should make the map bigger and make them flock more
>>
>>56784871
okay, if k is unique, I've misunderstood something where is the duplicate data coming from?

the tl;dr is you dont look up things by value. you look up things with a key. so if you need to look up things with the value you need a second index where the value is the key and do it in reverse.

if there is duplication in that more than one key in the first index references the same value in the first index, you make the second index value equal to some set describing all the keys in the first index.

if you have a many to many relation between your two index you need an intermediate index......... and this is where I tell you to go look it up because I honestly forget how it works but you may be entering sql territory because you are going to be handrolling a lot more code and sql is probably more efficient.
>>
>>56785232

I think there's a precision error of some sort that's leading to the clumping. I'd have to go over the rules again and make sure everything is kosher.
>>
Daily reminder that you do not need drugs or women's clothing to make you a better programmer. These are just memes. It does, however, help to be in a comfortable position with as little outside distractions as possible. I personally prefer to work in conditions of deafening silence, and if possible, very little lighting other than that of my computer screen.
>>
>>56785512
That sounds awful. Mostly the lighting part. Dark rooms with a bright monitor are not healthy environments, and the solution is not specialsed palettes but just fucking turning on a light.
>>
>>56785512
>do not need
but one of them DOES help
>>
>>56783867
Started reading a book about WCF, wish me luck.
>>
File: 1376182921994.jpg (65KB, 445x488px) Image search: [Google]
1376182921994.jpg
65KB, 445x488px
Does anybody else follow what's being proposed for the next C standard (C2X)?
There were some more proposals recently trying to clarify a bunch of shit in C.
I find these sorts of things really interesting, for some reason.

>tfw 6 years away
>>
>>56785604

Garbage collection.
>>
File: 1454898862819.jpg (42KB, 800x587px) Image search: [Google]
1454898862819.jpg
42KB, 800x587px
>>56785620
>>
>>56785546
Yes, my lacy black VS panties are like jet fuel for code writing.
>>
File: 1467618605833.jpg (88KB, 600x600px) Image search: [Google]
1467618605833.jpg
88KB, 600x600px
>>56785620
this is the most relevant pic i had
>>
>>56785633
>>56785668

nice.
>>
>>56785604

Only one I know of is short float. Because apparently we need it.
>>
>>56785815
>Because apparently we need it
It does seem like it would be pretty useful, especially when interfacing with GPUs.
Of the other proposals off of the top of my head:
- closures
- [[C++-like attributes]] (pretty shit in my opinion)
- OpenMP/Cilk-like parallelisation
- Fortran-like Array sections (efficient vectorisation)
- <tgstring.h>, like tgmath.h but for strings/wide strings
- clarifications of unspecified values, pointer origins and removal of trap representations (i.e. cleaning up underspecified parts of the standard and what compilers are allowed to do)

I can vaguely remember a couple of others, but I can't be bothered digging through the WG14 documents to find them.
>>
(loop for x from 1 to 100 do
(format t "~A~%" (cond ((= 0 (mod x 15)) "FizzBuzz")
((= 0 (mod x 3)) "Fizz")
((= 0 (mod x 5)) "Buzz")
(t x))))


99% of programmers cant do this in an interview
>>
>>56785956
cant do fizzbuzz?

I have no idea what language that is, but I'm pretty sure most programmers can use a modulus and print something to screen
>>
>>56785252
Yeah, that's why my current idea was a reverse lookup thing.
Guess you're right and any more complex solution would just lead to (badly) remaking sql on top.
>>
>>56786010
>not being able to identify lisp
>"programmer"
>>
java is my first language? Am I doing it right? today I learned about printnl and variables and found it easy. how long until I'm an elite programmer working for fortune 500?
>>
>>56785890

Personally I'd like to see a few features from GNU C merged into ISO C...
>>
>>56786040
i thought it was printIn
>>
>>56786072
oh yea you're right ln means line or something
>>
>>56786069
>GNU
pls
>>
>>56785604

I do. Unfortunately, I doubt anyone here has the chops or credentials to contribute anything to the standard but the proposals are somewhat pretty interesting.

>>56785890

Just save http://www.open-std.org/jtc1/sc22/wg14/www/wg14_document_log.htm. Better than traversing the Apache server to find whatever the new documents are.

The C++ attributes system is shit because the syntax and grammar addition is shit and not adopting the GNU semantics for attributes which fit much much better into C is a travesty.

But yeah, there is also the register overhaul, which makes sense and would finally give C a way to represent immutable values, whether it be one of the basic types or an array or an integer constant expression. The only downside is the orthodox C users having a problem with the semantics and incompatibility. C will be incompatible with C++ since C++17 is going to completely remove the register keyword. But since C++ shouldn't dictate what C adopts, it should go through, hopefully.
>>
>>56786085
Oh shit, I didn't know about that page.
Thanks.
>>
>>56785890
>- closures
>- Fortran-like Array sections (efficient vectorisation)

I would very much like to see these.
>>
>>56786081

Certain compiler macros for, for instance, detecting if a system uses little endian, big endian, or something else, would be nice to have standard in ISO C. They are present in GNU C, however.
>>
>>56785890
closures look useful. would work great with the cleanup attribute if they added that too.

__attribute__((cleanup(^void (void *x) {
// cleanup x
})))
type *x = init_type(...);
>>
>>56786024
I had heard about a schemaless nosql store with some advanced relational query functions but I dont recall what its called, but you could search if you were really interested
>>
>>56786150
>closures look useful.
there's a lot of precedent for them being useful...
>>
>>56786135
is endian.h not in ISO?
>>
>>56786038
Functional programmers are the special snowflakes of the programming world, only more smug.
>>
>>56786269
No. I'm pretty sure that header is non-standard.
>>
>>56786269

It's only getting into POSIX's next standard after getting considered in 2011.

http://www.opengroup.org/austin/docs/austin_514.txt
>>
>>56785890
So it's just some slightly nicer syntax to do the same old stuff. Eh, not that it matters that much, given that most projects are still C89. Maybe by 2022 people will be using C99.
>>
>>56786282
>implying lisp is necessarily functional
>>
>>56786377
>So it's just some slightly nicer syntax to do the same old stuff
What a pessimistic attitude towards things.
Most of those features allow for the compiler to generate more efficient code and/or allow to the programmer to write programs more easily.
You sound like you would enjoy writing in assembly or designing a Turing machine more than using a programming language.
>>
>>56786038
>>56786038
I never identified myself as anything
but by your own assertion 99% of programmers cant lisp. turns out lisp is dead
0/10
>>
>>56786377

People who write C mainly fall into 3 categories.

The orthodox and people who have no choice who write C89.

People who teach and learn C from programmers who don't know better and/or people who want to be compatible with C++ who use a superset of C89 and handpicked C99 features like // comments, inline and long long.

Then there is the infinitesimal small group of people who write modern C with the full C11 standard and C99 features like VLAs, restrict, _Generic, and etc. The only person who I've seen programming in this style is Jens Gustedt, on his blog and book Modern C.

https://gustedt.wordpress.com
>>
>>56786160
>>56786024
*torodb

cassandra might be worth looking at too
>>
File: lol.jpg (9KB, 289x175px) Image search: [Google]
lol.jpg
9KB, 289x175px
>>56786545
>Modern C
>>
Hi g, I just wanna ask what's the difference between these 2 java methods. Is there any performance improvement over the other?

private boolean resultSuccess() {
boolean result = BluetoothDriver.connect();
return result;
}

private boolean resultSuccess() {
return BluetoothDriver.connect();
}


Thanks
>>
>>56786545
>full C11 standard
Are there any compilers that actually implement the full C11 standard? I may be mistaken, but I was under the impression that C11 threads, for example, isn't implemented by most compilers.
>>
>>56786682
No, the compiler will optimise it anyway. Personally, I like the latter because it's shorter and more concise.
>>
>>56786655
Checked.
>>56786682
The only difference is the obvious: the first creates a boolean and returns it, which is unnecessary, both are equivalent.
But it's weird that the "success" of that function (connect()) is dictated by a bool instead of an exception.
>>
>>56786709
Thank you very much
>>
>>56786696
C11 threads are an optional feature, so even though glibc doesn't support them (yet), it is still C11 compliant.
Also, musl libc supports C11 threads.
>>
>>56786717
Thank you, can you explain to me why should i use an exception instead? I'm just a newbie, based on the code it only has an if statements for getting available/default adapter.
>>
>>56786726
Well, VLAs are also optional in C11. GCC and Clang usually implement even optional features, but I reckon there's a reason for not doing so with C11 threads?

Also, it seems that bounds checking isn't widely supported either.
>>
>>56786655

It's far more impressive than laughable of some of the features "modern" C has.

Take for example,

size_t strlen(char const string[static 1]);


That is a valid signature for strlen. It basically stipulates that string has to be at least of size 1 or non-NULL. Only Clang unfortunately emits a compiler error for this, and GCC just ignores it sadly. There is a proposal to make it stronger or to remove it. I hope they make it stronger and more formal.

http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2074.htm

>>56786696

It's a library issue, so you would have to look at your C libraries available to see which one does it.

And so far, only musl has C11 threads.
>>
>>56786749
>Thank you, can you explain to me why should i use an exception instead?
I only recommend it since you're using Java (I use C#, they're pretty similar) and the normal way to do error checkings is by exceptions.
When I was using C, I did the same, use return codes (sentinels) for error checking.
This can help: http://stackoverflow.com/questions/99683/which-and-why-do-you-prefer-exceptions-or-return-codes
>>
How the hell can JIT possibly work without invalidating any and all jumps?
>>
>>56786766

Bounds checking is broken, it was forced in by Microsoft way back when they cared about C, who only recently has a working C99 compiler and their implementation is non-C11 conformant.

So basically, it was a thing that should've never existed. Hopefully, they just nuke it from the stratosphere.

http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1969.htm
>>
>>56786766
>VLAs are also optional in C11
And were mandatory in C99. Since both of those compilers also target C99, it makes sense that they would support them in C11.
>GCC and Clang usually implement even optional features
I'm not aware of either having a policy for that. Also, <threads.h> is a library issue, not a compiler issue.
>Also, it seems that bounds checking isn't widely supported either.
That's because it's stupid and has several flaws.
>>
>>56786812
>>56786809
So if compiler developers decide to cherry pick what features to implement, why even bother to have a standard?

This is why undefined behaviour exists, you guys.
>>
>>56786839
>So if compiler developers decide to cherry pick what features to implement, why even bother to have a standard?
Optional features exist so that if there is a feature that some implementations might want to support, there is a standard way that programmers can use it.
For example, it doesn't really make sense for tiny embedded systems to support multi-threading, so they don't have to support it. However, this doesn't mean that desktop-computers and servers wouldn't want that interface.

There actually exists a patch-set for glibc to add C11 threads, but they've been very slow at reviewing it and getting it added to their mainline code.
>>
>>56786839
That's why C ""standards"" are a joke. You want a good way to do threads/unicode/complex/bound checking? Pick a well-known and well-supported non-standard library, and stick with it. It's going to be more stable, more reliable and more portable.
>>
>>56786912
You are a fucking idiot.
>>
>>56786839

The optional features are prone to cherry picking because of embedded systems and complaints about C99 being too hard to implement. So they decided to do that for C11.

The optional Annex K was clearly a political move by Microsoft. It was only until they stopped caring about the language that they stopped having a representative at the C standards committee. There used to be a person there as late as 2007.

https://blogs.msdn.microsoft.com/vcblog/2007/11/06/iso-c-standard-update/
>>
>>56786928
>>56786900
>embedded systems
That's no argument for not implementing multithreading what so ever. I mean, GCC implements OpenMP using pthreads. They could very easily implement C11 threads on top of pthread.
>>
>>56786803
Thank you very much.
>>
>>56786949

Embedded systems unfotunately at many times run on only 1 core and in the MHz or Hz range. Yes, the hardware manufacturer could add a library that would implement this but honestly it would be pointless.

For everything else, it is important to have even if there are many flaws with the design. Hopefully, they can hash it out for C2X and glibc can mainline the C11 threads code soon.
>>
>>56786928
>C99 being too hard to implement.

Oh, that is rich.
>>
>>56787074
as someone who hasnt lurked for the past few years

why the fuck do you exist
>/pol/-teir tripfag
>>
File: CtOCKIsWAAAnf92.jpg (232KB, 1536x2048px) Image search: [Google]
CtOCKIsWAAAnf92.jpg
232KB, 1536x2048px
You can use this to punish your descendancy.
>>
File: 1369446960901.png (20KB, 256x310px) Image search: [Google]
1369446960901.png
20KB, 256x310px
>>56787263
>the fundamental programming language
>>
>>56787226

That's rude.
>>
>>56787263
>code babies
Yep, that's C++ alright.
>>
So, I got my Comp Sci degree but was immediately shelved to be a stay at home parent because my wife landed a sweet job that makes a lot of money.

Almost 7 years of cabin fever have passed and I'm about to be at a point where I can enter the industry. I have my time at home with my kids working against me already, so I need to sharpen my skills.

Anyone have any interesting programming exercises I can dig into? Fair warning, I literally stopped coming to /g/ 6 years ago or so when I realized how landlocked to home I was and have spent most of my time child rearing, gaming, and putting on weight. I may be rusty.
>>
File: hoodie.jpg (103KB, 750x747px) Image search: [Google]
hoodie.jpg
103KB, 750x747px
>>56778700
Teach me senpai. What can I change?
>>
>http://www.strawpoll.me/11285971
>The Creator of the GIF Says It's Pronounced JIF. He Is Wrong - Gizmodo

THE FUCK IS WRONG WITH PEOPLE REEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
>>
>>56787509
>Jraphics Interchange Format
>>
>>56787509
he IS wrong
>>
>>56787520
kill yourself

>>56787531
kill yourself

it's the same with 'gib', which is pronounced as 'jib' as in giblets
>>
>>56787541
Do you pronounce 'graphics' with a soft g?
>>
https://www.youtube.com/watch?v=MSJaSS_Zj0Y
>>
>>56787541
>everyone but me is wrong
>look at this slang abbreviation i've literally just invented
>>
>>56787557
KILL YOURSELF KILL YOURSELF KILL YOURSELF FUCKING CANCER IDIOT

SEE >>56787561

DO YOU PRONOUNCE 'MISC' AS 'MISS'? LMFAO RETARD

>>56787568
KILL YOURSELF

SEE >>56787561
>>
>>56787557
Do you pronounce stimulated with a z?
>>
>>56787575
calm down
it's ok to be wrong
>>
https://www.youtube.com/watch?v=MSJaSS_Zj0Y
https://www.youtube.com/watch?v=MSJaSS_Zj0Y
https://www.youtube.com/watch?v=MSJaSS_Zj0Y
https://www.youtube.com/watch?v=MSJaSS_Zj0Y
https://www.youtube.com/watch?v=MSJaSS_Zj0Y

FUCK YOU FUCKING INSUFFERABLE SPERGS
>>
(/wdg/ is too slow)

I want to get rid of any <html> in my project. ANY.
With react I can implement server-side rendering for the whole document except doctype. What shall I do if I don't want to put <!DOCTYPE html> string into my code?
>>
>>56787588
it's pretty clear who's sperging out
>>
>>56787587
DIE IN A FIRE FUCKING PATHETIC RETARD

https://www.youtube.com/watch?v=MSJaSS_Zj0Y
https://www.youtube.com/watch?v=MSJaSS_Zj0Y
https://www.youtube.com/watch?v=MSJaSS_Zj0Y
https://www.youtube.com/watch?v=MSJaSS_Zj0Y
https://www.youtube.com/watch?v=MSJaSS_Zj0Y
>>
>>56787561
>>56787588
>>56787593
Please stop spamming, we don't want to subscribe to your jannel
>>
>>56787604
have fun being a contrarian edgelord who never grew up

and you're probably mexicans because you have no proper feel for the english language
>>
File: pulp fiction gif jif.gif (3MB, 422x180px) Image search: [Google]
pulp fiction gif jif.gif
3MB, 422x180px
>>56787588
>>
>>56787263

Honestly, what I think I'd do is I'd get the kid an Arduino and teach 'em C. Then they could move onto C++.
>>
>>56787612
>contrarian edgelord
But you're the only one here defending "Jif"
And then there was the poll

77% gif

Who's the contrarian edgelord?
>>
>>56787588
>all butthurt in the comments
please stop spamming though
>>
>>56787409
Anyone? I need some practice, refreshers.
>>
>>56787612
>probably mexicans
>you have no proper feel for the english language

calm down sperglord, why dont you try that again with proper grammer
>>
>>56787575
>DO YOU PRONOUNCE 'MISC' AS 'MISS'
The letter 'g' at the start of an english word is pronounced as either a hard or soft g depending on the word. For example, giraffe is a soft g and gills are a hard g. For a neologism like gif it makes sense to take the pronunciation of the root morphemes (in this case the words that make up the acronym). Hence a hard g is the logical choice.
A terminating 'sc' as in 'misc' is never pronounced as an s in the English language. Hence it would make little sense to say "misc" as "miss". For this reason, the comparison is not equivalent and your analogy is fucking shit you autistic sperg.
>>56787584
What does this even mean?
>>
>>56787612
>you're
your*
>>
>>56787625
kill yourself

>>56787626
kill yourself

>>56787639
>grammer
kill yourself

>>56787649
weak bait
>>
>>56787643
kill yourself

https://www.youtube.com/watch?v=MSJaSS_Zj0Y
>>
>kill yourself
>kill yourself
>kill yourself
>kill yourself
wtf i hate english now
jif jif jif
>>
>>56787643
>laser
>light amplification by stimulated emission of radiation

Also
>For a neologism like gif it makes sense to take the pronunciation of the root morphemes
Based on what? When has a precedent like this ever been set?
>>
>jif
it's pronounced jeff you fucking imbeciles
>>
>>56787695
yeb!
>>
What's a good card game to implement?
>>
>>56787744
yugioh
>>
>>56787657
>>grammer
but thats how they spell it in the spec!?!?!
>>
>>56787760
I said good
>>
https://www.youtube.com/watch?v=OJovxS9-RTQ

stay assmad vegan faggots
>>
>>56787671
>muh vowels
His whole argument is ridicuous. It's based on the fact that most English words starting with 'gi' use a soft g. Guess what, I have an equally valid rule. Most english words use the pronunications of their root morphemes. My rule actually has fucking logic behind it too (it makes sense to associate words of similar meaning phonemically). Even if you don't agree with me it doesn't matter. Language is a democratic process and at the end of the day what's correct is what the majority of people use. It's the same as going around whining that people use 'who' as an object pronoun.
>>56787688
Laser is a perfect example. We say the s like a z because that follows orthographic conventions for the english language. There are so words with 'ase' said with an s sound. We use a c for that (lace, race, etc). There are plenty of words with 'gi' said as a hard g (I gave the example of gill before. You have girl, git (as in the software), etc). Hence we follow the other rule that things should sound like the words they came from.
Based on what?
>>
I pronounce it like "gift", minus the "t" sound. The creator can blow it out his ass.
>>
>>56787777
retard
>>
Alright, it seems that the majority of people who visit /g/ are just hobby level and are more concerned with bullshitting about random pop-tier bullshit because professionally and amongst us as long as we understand you we can figure it out. It's the "ask shit you can google" people who you should eject or bicker about.
>>
>>56787807
Are you that jif faggot?
>>
>>56787792
Nice argument there fagtron, you really convinced me with those hot opinions.
>>56787807
damage control :^)
>>
>>56787772

I'm not a vegan, but... shouldn't they be fattened up first? With baby chicks, there's not much meat relative to the body size.

Also, what the hell happened to the programming discussion?
>>
>>56787818
>>56787823
I haven't taken part of the argument. I don't care how someone says it, I understand them. We deal with people who don't know their fucking shit all the time, and if you work in the industry in any part you're constantly listening to people drone about shit they can't even define or describe anyway.

You'd have to be a petty child who needs to express his superiority amongst anonymous strangers on the internet to get so stuck on something so dumb. I agree the article (based on the clickbait title) is stupid, but us discussing it is reductive and worse.
>>
>>56787832
You seem okay. What is wrong with my code? >>56774175 called it shit but then didn't tell me what is wrong.
>>
>>56787777
>Hence we follow the other rule that things should sound like the words they came from
Laser doesn't follow that rule dumbass, did you even read your own post after writing it?
>there are plenty of words with 'gi' said as a hard g
So? There are plenty with a soft g
giant
gibberish
gin
ginger
Gibraltar
giraffe

There's nothing that says acronyms need to be pronounced based off of the word that make them up, laser proves that
>>
>>56787860
It's written in Python for a start, and secondly there's a lot of repetition

>>56787864
>>>/jif/
>>
>>56787864
Are you ignoring my post?
Let me step it out for you:
If a letter is always pronounced one way in a group of letters, we say it that way. For this reason we say laser with a z sound.
If a letter could be pronounced either way, then we must look elsewhere for how to say it. A reasonable thing to do is to use the word it comes from. For this reason we use a hard g for gif.
Regardless of whether you accept this logic you're wrong. You can argue that it should be said as 'jif', but in our current society the majority say it as 'gif' and so that is what is "correct".
>>
>>56787874
What repitition?
The only thing that gets repeated is the call to the array which happens twice for each direction.
If you're talking about just repeated code I don't really see how to change it. I guess I could do a for loop for up/down, and a for loop for left/right. It doesn't seem that big of a deal though.
If there is a way and I'm dumb then please point it out.
>>
>>56787915
>A reasonable thing to do is to use the word it comes from.
That's what I was asking, what precedence are you basing this off of? Other than pulling it out of your ass of course
>You can argue that it should be said as 'jif', but in our current society the majority say it as 'gif' and so that is what is "correct"
The majority of people saying it one way does not make it correct

Really, I couldn't give a shit either way, but it pisses me off whenever people tell me "well it's graphic, not jraphics hurr hurr hurr"
>>
P Y T H O N
Y
T
H
O
N
>>
File: Untitled.png (3KB, 846x395px) Image search: [Google]
Untitled.png
3KB, 846x395px
>>56783867
Currently working on:

>a clock type thing
>it's supposed to picture the sun and moon and match the day to day transitions
>Might draw the season changes and implement those as well
>Program runs on startup
>pic related, it's the concept, not the final, the final will be far more appealing

I'm doing this because I don't go outside often. Also because I'm a beginner. Seems basic enough so I figured I'd tackle it. Using C++
>>
>>56787961
>what repetition
seriously?
>>
>>56787860

Arrays in Python, as they are in Ruby and Java, are objects, and passed by reference. If you pass them to a function, you do not copy the entirety of the array. You could stand to use a function to achieve the purpose of your copypasted code.
>>
>>56787963
>That's what I was asking, what precedence are you basing this off of?
Take a lexeme like "girl". Add some inflectional morphemes to create new words (girly, girlish, girls, etc).
What do you notice? The pronounciation of the free morpheme remains the same. This means these words will share a phonetic link as well as a semantic link. Logically we should apply this concept to acronyms. There are of course exceptions to this rule. For example 'precede' vs 'precedence' where the intonation changes because of another rule of English pronounciation. However in this case, while less likely, it is not impossible for english words beginning with 'gi' to use a hard g.
>>
>>56788070
lol nerd
>>
>>56787984
I could use a for loop for nx in [-1,0,1] and ny in [-1,0,1] to do all of the things in one loop. I'd have to run an extra check to see that they didn't both equal 0 though. It doesn't seem worth it.
Thanks for explaining what was wrong though. Perhaps I'm being a bit stupid by trying to write faster code over readable code since I chose python in the first place.
>>56788060
Thanks. I worked this out because another function was behaving that way.
>>
>>56788115
It's high school level linguistics.
>>
do you guys go to programming meetups?
>>
File: 1473662685015.png (628KB, 478x604px) Image search: [Google]
1473662685015.png
628KB, 478x604px
I've got a semi obscure question.

I use auto-hotkey at work and I've been playing around with scripts to make my data entry job more efficient. I want a command where I can do a key command such as CTRL - n - V, where n is a number and the command takes what's in the clipboard and adds n to it.

The adding to the clipboard is easy but it's the using a key press as an argument I don't get. Is it possible to do it this way? Or is the only way to have say 9 different commands where n is replaced with 1-9?
>>
>>56788070
>Logically we should apply this concept to acronyms. There are of course exceptions to this rule.
>For example
>Gives a completely unrelated example with words instead of acronyms
Also, are you really gonna tell me grammatical morphemes and acronyms are the same thing? You're saying because a word doesn't change the base word's pronunciation when a morpheme is added, an acronym should follow the pronunciation of the words that make it up.

I'm gonna stop now, no reason to continue shitting up the thread over this
>>
>go from talking about the C standard and its future to something non-programming related and retarded English semantics.

I fucking want a /g/ split. The sooner, the better.
>>
>>56788170
>Also, are you really gonna tell me grammatical morphemes and acronyms are the same thing?
No, I'm saying that a similar concept applies and in situations where the acronym's pronunciation is ambiguous the way we say the original word is the best way of determining how we should say the acronym.

Regardless this discussion is stupid and I honestly don't give a fuck how people say it.
>>
How do you like my for in loop?
#define in(i, limit) (i = 0; i < limit; i++)
int i;
for in (i, ctr->count)
free(ctr->arr[i]);
>>
>>56788281
It's pointless.
>>
File: pih.jpg (966KB, 1012x1345px) Image search: [Google]
pih.jpg
966KB, 1012x1345px
I'd rec this for anyone trying to learn Haskell
>>
>>56788123

No problem.

Just as a general rule of thumb, you're going to want to avoid mass copy pasted code in the future. Not just because it's a bitch to maintain, but also because it just doesn't fit into cache well, regardless of whether it's interpreted, JIT compiled, AOT compiled, or whatnot.

>>56788179

We've had a dedicated programming board before. They mostly talked about Touhou and SICP.
>>
Hey guys, where can i find the daily programming thread?
>>
>>56788393
there is no such thing

go away
>>
C++ is hurting my brain already
#include <iostream>

using namespace std;

int main()
{
cout << "Hello world!" << endl;
cout << endl;

int x=1;
int y=2;
int z=3;

int sum;
sum = x+y+z;

cout << "x+y+z is equal to " << sum << endl;
cout << endl;

int a=1, b=2, c=3;

int subtract;
subtract = a-b-c;

cout << "a-b-c is equal to " << subtract << endl;

return 0;
}
>>
>>56788430

What is there to not understand?
>>
File: 1474852663714.jpg (19KB, 480x480px) Image search: [Google]
1474852663714.jpg
19KB, 480x480px
>>56788483
my first language, so it's a lot to take in. But i'm loving every second of it.
>>
>>56788587
But it's literally just additions, subtractions and printing.

If that hurts your brain it's better to quit now.
>>
>>56788430
week or two and that shits ez man.
>>
>>56788587

Well it's good that you like it. C++ was my first programming language as well, but it took a while for everything to settle in with me. I tend to suggest C as a first time language to most beginners, but in retrospect, C++ will do.

Feel free to ask questions here if you don't understand things.
>>
>>56788430
Pain is good for you
1  #include “sy.h”
2 extern int *rgwDic;
3 extern int bsyMac;
4 struct SY *PsySz(char sz[])
6 {
7 char *pch;
8 int cch;
9 struct SY *psy, *PsyCreate();
10 int *pbsy;
11 int cwSz;
12 unsigned wHash=0;
13 pch=sz;
14 while (*pch!=0
15 wHash=(wHash11+*pch++;
16 cch=pch-sz;
17 pbsy=&rgbsyHash[(wHash&077777)%cwHash];
18 for (; *pbsy!=0; pbsy = &psy->bsyNext)
19 {
20 char *szSy;
21 szSy= (psy=(struct SY*)&rgwDic[*pbsy])->sz;
22 pch=sz;
23 while (*pch==*szSy++)
24 {
25 if (*pch++==0)
26 return (psy);
27 }
28 }
29 cwSz=0;
30 if (cch>=2)
31 cwSz=(cch-2/sizeof(int)+1;
32 *pbsy=(int *)(psy=PsyCreate(cwSY+cwSz))-rgwDic;
33 Zero((int *)psy,cwSY);
34 bltbyte(sz, psy->sz, cch+1);
35 return(psy);
36 }
>>
women can't program

feeling entitled to a programming job is like expecting to get hired as a racing driver when you have no interest in cars and you're barely able to get from point a to point b
>>
>>56788670
>set nonumber
>>
>>56788712
>single qt signed up for programming course.
>Not even 2 weeks later she gave up.

I don't want all my colleagues be men tbqh.
>>
>>56788748
>tons of dindus sign up
>one literally brings bucket of chicken one day when she was late
>every semester more are weeded out
>second year it's a small group of white males
Meh, idc though.

I need help, anyone willing to help someone?
>>
>>56788783

What do you need help with?
>>
File: Blood Skeleton.png (518KB, 763x992px) Image search: [Google]
Blood Skeleton.png
518KB, 763x992px
WHY THE HELL WON'T THE RACKET FFI RECOGNIZE LIBRSVG ON WINDOWS IT WORKS ON LINUX I'VE BEEN TRYING TO GET THIS TO WORK FOR A MONTH NOW FUCK
>>
>>56788670

>
(wHash&077777)%cwHash


Top quality hashing... not.
>>
What is the best in/out routine for C++?

<iostream> cin / out
or
<stdio.h> printf / fgets
?
>>
>>56788824
Iostream is easier to use.

Printf might be faster tho.
>>
>>56784099
Second for redis. It is magical.
>>
>>56788818

What sorts of errors are you getting?
>>
why is c still the standard language for hardware programming?
>>
>>56788907
It says shit like "(The specified procedure could not be found.; errno=127)". I used nm on the DLL and all the functions are being exported.
>>
>>56788983
It goes the deepest.
>>
>>56788983
memory and processing power constraints

but shitkids these days like to run python on their raspis and whatnot
>>
>>56785633
>googles
>obeying laws
>>
>>56789039
stay in your containment board, racist brainlet
>>>/pol/
>>
I have seen examples, but I still fail to get it.

1. What is a virtual function in C++? What is it good for?
2. What is a static member in C++? What is it good for?
>>
File: Polluter.png (34KB, 571x443px) Image search: [Google]
Polluter.png
34KB, 571x443px
>>56789039
Your containment board awaits you stormtard.
>>
>>56789060
get a life jeez
>>
>>56788994

Okay, well.. to troubleshoot... can you use any other library with the FFI on Windows? Hack something together in C real quick, possibly with a similar function signature to the one you are using, and see if that works.
>>
File: 1474363000057.png (211KB, 2672x1984px) Image search: [Google]
1474363000057.png
211KB, 2672x1984px
>>56789039
into the >>>/pol/ you go my friend
>>
>>56789039
/pol/ is the place to be for you, my stormtarded friend
>>
>>56789067
nice samefagging
>>
File: pol on the right.jpg (120KB, 960x960px) Image search: [Google]
pol on the right.jpg
120KB, 960x960px
>>56789039
>>
>>56789064
I can interface with cairo, pango, and even a little DLL I made myself (contains a hello_world) that I can successfully connect to and use from Racket. I took a step further and added a single function from librsvg to the test DLL, compiled it, and magically the Racket FFI no longer works with the now two-function library! It gives the same errno=127 shit as before.
>>
File: smug clownpiece.png (185KB, 322x328px) Image search: [Google]
smug clownpiece.png
185KB, 322x328px
>>56789098
>hover hand
>>
>>56788803
Need to practice programming, less quirky exercises in solving problems programmatically, more projects like you'd actually do in a job.

I've done tons of the ones on the challenge sheet, I need more mundane things that just give me general programming practice and maybe practice with crap I don't use often or like to do.
>>
File: stormtards.png (83KB, 905x624px) Image search: [Google]
stormtards.png
83KB, 905x624px
>>56789039
hush now and begone
>>
>>56789123
I second this request.

Is there a more practical challenge sheet, which includes tasks typical for industrial software development?
>>
>>56789129
have fun during the debate i'm sure there will be many records to correct
>>
>>56785512
Enjoy the slow death of your eyesight. At least get some backlighting going on that monitor. And use shit like Workrave & Redshift.
>>
File: le ugly nigger.jpg (57KB, 674x474px) Image search: [Google]
le ugly nigger.jpg
57KB, 674x474px
>>56789067
>someone was butthurt enough to make that image
>>
>>56789123
>>56789133
I suppose the next step up would be to learn the code base of something on github. You're definitely going to be thrown into open waters on the job and be told to learn everything about a project in far too little time.
>>
>>56789142
nice meme
>>
>>56789133
>>56789123
The easiest way to gain chops is to start a project from scratch and figure out all the implementation details without cheating.
You'll be forced to think about every facet of your application.
>>
>>56789059
1. For this, its probably easier to just give a demonstration. In short: if you call a virtual function, it will call the member function of the actual type. If you call a non-virtual function, it will call the member function of the declared type. If you have a pointer to a base class A, which is pointing to a subclass B, then when you call a virtual member function, it will call the derived/overriden member function, since the actual type is of B. If the function is non-virtual, it will call the member function of type A, since the declared type is A*. Its used for polymorphism, and allows you to treat subclasses as types of their superclass. For example, you might have a class Animal, with subclasses Mammal, Reptilian, etc. You could have a collection of Animal pointers, and use the common methods applicable to all animals.

I dunno, I'm shit at explaining things.

2. A static member means that only one of this variable exists for the entire class. If you have 20 objects of type A, then you will still only have one instance of each static member. Similarly, static methods don't "belong" to any one object of the class, they belong to the class itself, so they can be called without any objects instantiated.

For example:
unsigned A::count = 0;
class A {
static unsigned count;
public:
A(){
count++;
}
A(const A&){
count++;
}
~A(){
count--;
}

static unsigned getCount(){
return count;
}
};

int main()
{
A a, b, c;
std::cout << "There are currently " << A::count() << " instances of class \"A\"." << std::endl;

return 0;
}
>>
google dindu nuffin
>>
im not racist i hate everybody
>>
>>56789179
Oops, I meant to give an example of virtual functions.

class A {
public:
virtual void foo(){
std::cout << "A::foo() called." << std::endl;
}
void bar(){
std::cout << "A::bar() called." << std::endl;
}
};

class B : public A {
public:
virtual void foo(){
std::cout << "B::foo() called." << std::endl;
}
void bar(){
std::cout << "B::bar() called." << std::endl;
}
};

int main()
{
A* a = new B();
a->foo(); // calls B::foo()
a->bar(); // calls A::bar()

B* b = new B();
b->foo(); // calls B::foo()
b->bar(); // calls B::bar()


return 0;
}
>>
>>56789059
>Virtual function.
Excuse the wrong syntax but I'm on my phone.

class drawable
{ Virtual void draw(); }

Class rectangle : public drawable
{ Void draw() override { //... }};

Class circle : public drawable
{ Void draw() override { //... }};

Class triangle : public drawable
{ Void draw() override { //... }};

...

Why is this useful you ask?
Well each object here is drawn in a different way so without virtual you have to call draw on each individually.
But with virtual you can create a container and store them all as a drawable, yet each of them will still be drawn in the correct way.

Vector<drawable*> drawables;
Drawables.pushback( new rectangle)
Drawables.pushback( new triangle)
...
For ( auto d : drawables)
{ d->draw(); }
>>
File: 1390443984160.png (299KB, 600x541px) Image search: [Google]
1390443984160.png
299KB, 600x541px
>Have to use Java for a university assignment
>Have a function that needs to return 2 value
>No pointers, tuples or multiple returns
>Have to create a new class with all of the boilerplate
I don't understand how anyone can defend this shitty memelang.
>>
>>56789229
>return 2 value

>returning two values
>not creating a class with two getters and returning that
>>
>>56789229
ok kid
>>
>>56789241
>Have to create a new class with all of the boilerplate
Hes an idiot, but he already mentioned that that is what hes going to do.
>>
>>56789241
>>56789253
Do you two seriously consider this acceptable?
Speaking of the lack of pointers, you can't even write a fucking swap function in Java.
>>
>>56789279
your program is shit
>>
>>56789286
I know: I had to write it in Java.
>>
>>56789293
kill yourself
>>
File: Muh Heritage.png (83KB, 537x585px) Image search: [Google]
Muh Heritage.png
83KB, 537x585px
Do I really need to learn Unions and Structures in C++?
>>
>>56789306
Why can't you take any criticism against your holy language, Pajeet?
Do you seriously think "just create a new data type" is the answer for everything?
>>
>>56789328
fucking idiot, it's not that it's a bad language, it's that you suck at designing your program properly
>>
>>56789328
what language is sacred for you, then?

given how you glorify pointers and swap functions, probably c++?
>>
>>56789316
Structs in C++ are secretly just classes. You need classes.
>>
what is the best way to create a deterministic random number generator?
>>
>>56789362
I learned and practiced how to use classes already.

So I do not really need to bother with structures, right? What about unions?
>>
>>56789229
Java seriously doesn't have a tuple type or even a pair type? C# has tuples even despite the lack of variadics, and C# 7 is even introducing a surprisingly robust tuple literal syntax mainly for multiple return scenarios

>>56789241
>>56789253
there are times when this makes more sense, but having to create a class that's only ever used as the return type of one method is truly stupid
>>
my preferred name for github, Amsterdam, is already taken ;___;

what should I use instead?
>>
/dpt/-chan, daisuki~

>>56789374
Prime numbers, non reversible operations, ...

>>56789316
No.

>>56789306
Please, don't bully.

>>56788983
Tools (and also because of the undefined behaviors).

>>56788824
Streams.

>>56788281
Flawed.

>>56788179
You are free to leave. The split has already happened (/λ/).

>>56788161
Yes.

>>56788060
>and passed by reference

>>56787744
A memory card game.

>>56786696
>Are there any compilers that actually implement the full C11 standard?
clang, gcc, pellesc, ibm xl, ...

>I was under the impression that C11 threads, for example, isn't implemented by most compilers.
The compiler only has to implement _Thread_local to support c11 threads. The rest is at the charge of the standard library (glibc, musl, bionic, ...)

>>56786545
>Then there is the infinitesimal small group of people who write modern C with the full C11 standard and C99 features like VLAs, restrict, _Generic, and etc.

FreeBSD, XNU, ... enforce -std=c99. Linux doesn't but encourage use of c99 features.
Every high performance libraries use restrict for sure.

>>56786282
Lisp is not functional at all but is more declarative than c, fortran, java,... since almost everything is an expression.

>>56786010
http://c2.com/cgi/wiki?FizzBuzzTest

>>56785956
>not using lambda as the ultimate goto

>>56785604
C is a dead language.

>>56783947
https://github.com/anishathalye/git-remote-dropbox

>>56783867
Thank you for using an anime image.
>>
>>56789405
C# is disgusting you fucking moron. just make your own tuple type if you think you need one jeez
>>
What is the fastest way to develop a GUI under Python?
I'm using GTK but I don't understand layouts.
Is there a standard one? I want to put less effort as possible.
>>
>>56789349
How does adding a new class with all of the baggage constitute a good design?
How is
// pairOfThings.java
public class pairOfThings {
private thingType1 thing1;
private thingType2 thing2;

public pairOfThings(thingType1 thing1, thingType2) {
this.thing1 = thing1;
this.thing2 = thing2
}

public thingType1 getThing1() {
return thing1;
}

public thingType2 getThing2() {
return thing2;
}
}

// thingThatUsesPair.java
public class thingThatUsesPair {
public static void main(String[] args) {
pairOfThings pair = someOtherModule.getPair();
}
}

better than
thing1, thing2 = someOtherModule.getPair();

?
>>
>>56789446
kill yourself and i'm closing this thread i'm not wasting any more time on you dunning kruger shitkids today
>>
>>56789460
>i.e. I have no arguments
>>
>>56789444
https://kivy.org/
>>
>>56789432
>C# is disgusting
it's literally just Java but better
that explains why you're mad tho
>>
>>56789426
Kill yourself, you attention whore.
>>
>>56783947
You should just use Git. It's not that of a steep learning curve and useful AF.

Assuming you are using a Windows PC, look into Git Bash and how to generate an SSH key. GitHub has some nice tutorials on their help section.
>>
can't you just return an array of 2 values?
>>
>>56789570
They are different types.
>>
>>56789581
just return them as a string and parse it out
>>
>>56789590
(You)
>>
File: umarusfs.jpg (115KB, 1280x720px) Image search: [Google]
umarusfs.jpg
115KB, 1280x720px
>>56789508
>Kill yourself
Please, don't say that.

>>56789508
>you attention whore.
We are all anonymous here.
>>
Guys, I just made a GitHub account?

Does this already make me an elite programmer, or do I also have to buy a Mac with Linux stickers?
>>
>>56789386

>So I do not really need to bother with structures, right?
It is helpful to know what they are in C++ if you have to work with someone else's code. Basically, it's just a class with all visibility default to private instead of public. If you're making a type where everything is public, a struct is a nice convenience. Also... you're probably going to be using them if you do any C compatibility shit.

>What about unions?
You should know what they are and how to use them. They aren't like classes or structs, but they have fields like them. The difference is that the fields take up the same location in memory. This is useful for creating abstract syntax trees, which are ubiquitous in any sort of language interpreter or compiler. You should be familiar with the concept of a tagged union, which more or less looks like this:

enum Tag {
IsInteger,
IsFloating
};

struct TaggedType {
enum Tag tag;
union {
int i;
double d;
};
};


>>56789590

That's retarded, and actually involves more work. The entire point of structs/classes/tuples/product types is so that you can return multiple co-related values as an element of a single type. You are given a tool for this exact purpose and trying to find some sort of hack to not use the tool whose job it is to do this shit.
>>
>>56789655
no i mean return an array of strings and just parse the values

Int.parseInt() or w/e
>>
does multithreaded rendering make sense?

i think my library (rust-sfml) is too high level to do this.

window.draw(thing);


there's no way for me to specify
 do_computation_for_rendering() 
and then and the end gather all of them and actually show them
>>
>>56789655
>unsafe tagged union
Kek. Do you even oop?
>>
>>56789683
OOP is fundamentally flawed.
Also, you're thinking of polymorphism, which is not exclusive to OOP.
>>
>>56789655
thanks, always love your answers senpai
>>
>>56789691
>Also, you're thinking of polymorphism
Nope.
>>
File: 1470851275805.jpg (53KB, 500x737px) Image search: [Google]
1470851275805.jpg
53KB, 500x737px
Is there a javascript browser extension API abstraction thingy so I can develop for firefox and chrome at the same time?
>>
>>56789714
>>>/g/wdg
>>
>>56789691
>OOP is fundamentally flawed.
Why
>>
>>56789725
why isnt web development considered to be a regular part of programming?

we kinda have an object-oriented programming and a web programming general right now
>>
Depends what you're doing.

Realtime game rendering? Nope - nobody does it.

Rendering some video? Sure why not.
>>
>>56789730
It doesn't model any problem well.
It encourages mutable shared state.
>>
>>56789738
Javascript isn't a programming language, it's a fucking disgrace.
>>
>>56789749
lel, i agree.

nonetheless, this is a subjective opinion and as popular as degrading web development to "economy class programming" is, it is not justified objectively
>>
>>56789738
>why isnt web development considered to be a regular part of programming?
Because webdevs are almost never working on "real" programming problems.
Go to your containment thread.
>>
>>56789749
There is LITERALLY nothing wrong with javascript
>>
>>56789680
Certain software renderers can be used multithreaded. But if it's on top of opengl then no (iirc sfml is on top of opengl). You can't call opengl functions from different threads.


What you can do (and most modern renderers do) is have one or multiple rendering command buffers. Each thread has its own buffer to which it can send commands and at the end (after being sorted by shader,texture, batched, ect.. to minimize state changes in opengl) it submits it to the gpu all at once.

But I wonder what you wanna do that requires that much performance. You can draw 10000+ sprites in a naïve way and still get 60+ fps on modern machines
>>
>>56789666

I'm well aware of what you suggested. I am saying that what you are suggested is retarded. The CPU is doing more work having to translate something from a string into integer, double precision floating point, what have you. It's also having to work with double indirection. But lo and behold, we have the plain old object. You add to a pointer, dereference, and you get your field. It's insanely efficient and it's what the compiler is going to optimize for.

parseInt() is the wrong tool for this job, and you would not be the first idiot to suggest using strings to transfer data that would be more efficiently kept as a goddamned integer or float. I swear, I almost wish I had a magical ruler that I could use to slap your hands through the Internet.

>>56789683

It's a quick and dirty example. Structs are useful for that. It's also valid C
>>
>>56789792
hes using java so it doesn't matter
>>
File: 1319396458001.jpg (12KB, 177x278px) Image search: [Google]
1319396458001.jpg
12KB, 177x278px
>>56789771
Other than the completely dynamic typing, insanely aggressive type coercion, heaps of bizarre behaviour, shitty scoping, non existent exception handling (of any value) and the fact it's slow as balls even after all the attempts at improving it.

But yeah aside from that it's great.
>>
>>56789799

Java performance is shit, why encourage people to make it worse?
>>
>>56789813
because it literally doesn't even matter in the end
>>
>>56789822

If practiced regularly, it does.
>>
>>56789482
Seems more difficult and complex, i don't need any graphics rendering, only gui
>>
>>56789780
yeah, i dont really have a need for this. i was just trying to add multithreading to shit for fun. i already did it for pathfinding and it seems to work well
>>
should i install mingw for g++ or something else
>>
>>56789837
> add multithreading to shit for fun

are you feeling okay?
>>
>>56789799
Just so you know, one of the two types I was returning was not a primitive type.
>>
>>56789740
Everybody does it
>>
Is there a way to specify what native method a Java JNI method should be mapped to? Something like annotations on the method
I'm using a native library with completely retarded method names that I'd rather not have to look at
>>
how did such an utterly mediocre language as java become the industry standard for windows apps?
>>
>>56789867
Because there's no better alternative.
You could use C but sometimes java is just easier.
>>
>>56789839
On windows, you can either go for mingw or cygwin, if you want to use gcc, but on Windows, VC++ is more widely used.

As for cygwin vs mingw, mingw is more "native", whereas cygwin's gcc runs posix on top of windows, and gcc on top of posix. Confusingly enough, cygwin also provides mingw packages too.

You can also opt for clang instead.
>>
>>56789898
guess i'll just use vc++ since i want to do networking stuff :/
>>
is there any point to continue using char arrays after the introduction of strings in c++?
>>
>>56789867
it's not. i haven't used the jvm for months.
>>
>>56789925
if you want to store binary data
>>
Hi guys

I want to do a .io game like slither.io or agar.io
...

I don't understand one thing :

I found on many forum that they use back end for the game and communicate with there front with websockets.

But i saw tutorials that use canvas (so front)
and they can manage keyhooks and all that back end should do.

I think i forgot something important but i don't understand .
>>
Is there any point in learning Ruby, if I am neither a homosexual, nor a hipster?

Afaik everything Ruby can do, Java can do as well.
>>
>>56789951
>Afaik everything Ruby can do, Java can do as well.
no.
>>
>>56789951
Ruby is good imo
>>
>>56789947
cool dude
>>
>>56789161
Very good thinking, and I was thinking the same.

Problem? I'm great at solving problems and coming up with creative solutions, but coming up with a project idea on my own is blank page syndrome
>>
>>56789925
Strings do dynamic allocation. I use char*s to store string literals. There's no point in making extra strings if a static literal does the same job. Otherwise yeah, go for std::string (or even better std::string_view)
>>
>>56789958
For example?

Ruby is a multi-paradigm language with automatic garbage collection, so is Java.
>>
>>56789951
not really python does everything ruby does but better
>>
>>56789961
No it's not. It's one of worst languages in existence.
>>
>>56789984
why
>>
>>56789947
I have no idea what your question is.
>>
>reliable UDP
uh you mean tcp?
>>
>>56789951
I think the adage is, learn one scripting language, and learn it well. Go for Ruby if you prefer it to the others.
>>
>>56789602
He's right.
Please fuck off and kill yourself.
>>
>>56789963
>>56789994
Sorry X)

Why should i use back for my .io game?
>>
>>56789992
It's the worst when it comes to performance and hardly even works on Windows.
>>
>>56789867
>java
>the industry standard for windows apps
I think you must be confused.

Most are written in C++, with most modern ones (last ~4 years) written in C#.
>>
>>56790019
do you want people to play together?
>>
>>56789977
Does Java have mixins and open classes? Does Java have Ruby's singleton methods (NOT singletons, there's a difference)?
>>
>>56790026
then why do 70% of dev jobs in my country (germany) require java above anything else?
>>
>>56790022
so you have no arguments against the language which you are confusing with its implementations.
>>
>>56790036
For business applications, not desktop/windows apps.

We're talking Enterprise level applications.
>>
>>56790019
Only do front and see how far that takes you. Then you'll know.
>>
>>56790036
java is predominant in server programming, not for applications.
>>
>>56790036
Server-side enterprise software.

Think things like Atlassian's Confluence.
>>
Trying to solve this problem on hackerrank:
https://www.hackerrank.com/challenges/simple-text-editor

But I'm timing out on test cases w/ 1 million inputs, would love some feedback
on how to speed this up:


import std.conv, std.algorithm, std.string, std.stdio;


void main() {
auto stack = new Stack;
int opCount = to!int(strip(stdin.readln()));
foreach (_; 0 .. opCount) {
string[] inputs = split(strip(stdin.readln()));
int opType = to!int(inputs[0]);
if (opType == 1) {
stack.push(inputs[1]);
} else if (opType == 2) {
stack.pop(to!int(inputs[1]));
} else if (opType == 3) {
(stack.get(to!int(inputs[1])));
} else if (opType == 4) {
stack.undo();
}
}
}


class Stack {
private string data;
private int[] ops;
private string[] deleted;
private size_t[] appended;
this() {
data = [];
}
public void push(string value) {
ops ~= 1;
appended ~= value.length;
data ~= value;
}
public void pop(int i = 1) {
ops ~= 2;
deleted ~= data[$ - i .. $];
data = data[0 .. $ - i];
}
public char get(int charNumber) {
return data[charNumber - 1];
}
public void undo() {
int lastOp = ops[$ - 1];
ops = ops[0 .. $ - 1];
if (lastOp == 1) {
size_t appendLength = appended[$ - 1];
appended = appended[0 .. $ - 1];
data = data[0 .. $ - appendLength];
} else {
string deletedString = deleted[$ - 1];
deleted = deleted[0 .. $ - 1];
data ~= deletedString;
}
}
}
>>
>>56790044
>>56790028
ok i see .

Thank
>>
>>56790019
of course you should write a backend, are you fucking stupid?
without a backend you've got absolutely no cheating protection
>>
One of you autists make a new thread.

We won't be mad about whatever OP image you use.
>>
>>56790037
Nice goalpostig, But if a language doesn't have a good implementation can it really be called good?
>>
>>56790062
Here you go, fag:

New thread:
>>56790078
>>56790078
>>56790078
>>
>>56790062

>>56790080
>>56790080
>>56790080
>>
>>56790058
Use websocket to communicate is the good way so?
>>
>>56790086
REEEEEEEEEEEEEEEEEEE
>>
>>56790087
i prefer this one >>56790086
>>
>>56790087
Too late. Delete your thread.
Also, your OP isn't the right format.
>>
>>56790085
His argument:
>you're insulting muslim states run by muslims, not muslims themselves which are the topic
He's not going to get what you're going for.
>>
>>56790087
Shit-thread. Save /dpt/ by posting projects instead of procrastinating by flaming languages.
>>
>>56790102
my argument is that you judge a language by its semantics and syntax.
>>
>>56790086
AHAHAHAH

it got deleted
this thread is it, then

>>56790087
>>
>>56790123
>it got deleted
What? No it didn't.
>>
>>56790122
Ok, so Java ala 1996 wasn't bad.

I mean it took fucking forever to run basic applications and was ugly as dogs but hey, that's implementation!
>>
>>56790122
Which is imho an incomplete way to judge a language.
>>
>>56790141
Yes, most of the hate against java were actually towards the java platform, not the java programming language (which has also been criticized but for other reasons).
>>
>>56790202
The platform WAS the implementation you fucking moron. Consider if it was just a straight native compiler instead of a compiler/interpreter set.
>>
>>56790261
not only, it's also the bloated java library, the protocols, the tools, ... you obviously have no clue about the java eco system and about plt
>>
>>56790326
You don't get it fucktard, we're not debating Java, I'm using Java's Implementation as an example that it is an integral part of gauging a language's usefulness to follow up the claims made prior.

I know what I'm talking about, you're just some random idiot or the person I was talking to who suddenly wants to argue the unrelated java metaphor.
Thread posts: 355
Thread images: 29


[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.