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



Thread archived.
You cannot reply anymore.



File: 7.jpg (410 KB, 1057x1500)
410 KB
410 KB JPG
Old thread: >>62868621

What are you working on, /g/?
>>
>>62874252
Both YAML and JSON are horrible languages.
>>
>>62874250
idk stuff
>>
yeah, Common Lisp really is the best language.
>>
>>62874268
I know you're just trying to be provocative, so uh, good luck with that buddy.
>>
>>62874252
{
"reddit": {
"subreddits": ["foo", "bar"]
},
"rss": {
"urls": ["http://foo.com", "http://bar.com"]
},
"console": {
"format": "{NAME}\n{URL}\n{DESCRIPTION}"
},
"mail": {
"host": "smtp.foo.com",
"port": 25
}
}

I have to agree, JSON does look nice.
>>
File: 1505407305285.jpg (64 KB, 638x680)
64 KB
64 KB JPG
What's better?
XML, JSON, or dumping your structs in a binary file for persistence?
>>
>>62874318
SQLite.
https://sqlite.org/appfileformat.html
>>
>>62874318
Binary if the user isn't supposed to change the file
>>
>>62874318
XML is bloated garbage
JSON is alright for a human readable format
binary dump is the fastest
>>
Could someone give me assistance? This program (left) stops at line 29 with a segmentation fault error and I don't know why.
>>
>>62874318
CSV
>>
why do people here hate on c#

pls no memes
>>
>>62874318
JSON
>>
>>62874386
Microsoft.
>>
>>62874283
Not even the best lisp.
>>
>>62874386
same reason they hate on Java
>>
>>62874386
No linear types
>>
>>62874362
And where is line 29?
>>
>>62874386
Closed source. Enterprise-y.
>>
>>62874442
clojure is not.
dumb jvm poster
>>
>>62874386
Just memes. It's one of the best languages out there.
>>
Line 29 is 'call factorial' located in the function.
>>
>>62874506
ClojureScript :')
>>
>tfw can't grok Rust lifetimes
>>
>>62874529
javascript is C in lisp clothing.
>>
>>62874386
Do they? I haven't noticed. Anyway, it's a good language and .net is a nice platform, if I had to choose a language with GC to make some enterprise shit, I would choose C#, but thank god I don't.
>>
File: 1024025.jpg (28 KB, 460x460)
28 KB
28 KB JPG
>>62874362
"Here's a nickel, Kid. Buy a real editor."

Also, solarized is so 2013.
>>
http://seriot.ch/resources/talks_papers/20141106_asfws_unicode_hacks.pdf
Unicode was a mistake.
>>
>>62874250
Well I have created this to reply to faggots
https://mega.nz/#!s3BH0DjZ!cE9FZZRNpo_IQAcdq1x74fMbRVO0RXh4pckc6vR3kZM

If you don't trust links I can share source code but it's xtremly spaggety (I've started CS 2 weeks ago so yeh)
>>
>>62874506
But Scheme is.
>>
>>62874599
Every scheme ends up providing the same things as Common Lisp but in non portable way.
dumb racket poster
>>
>>62874592
>his language doesn't store all string as utf8 internally
>the char type in his language isn't 32 bits wide
Sucks to be you.
>>
Beginning to get more comfortable with working exclusively with the terminal.
I'm loving it -- There's no distractions or shitty GUI's I have to deal with.
One question about emacs though:
How do I get the undo-tree C-x u to appear on the right side of the screen?
I've tried to do
 C-x 2 
or/and C-x 3 to split the panes, but that only further splits the two panes I have.
>>
>>62874634
Every scheme ends up providing 20% of Common Lisp and that's the point.
>>
>>62874678
No matter how you slice it, it's unstable garbage. UCS-2 (UTF-16 static length) would have been enough if they didn't pander to the chinks by not unifying their fucking massive character set because of "muh legacy encodings", then they would have no problem fitting in everything they needed in BMP.
>>
>>62874714
t. somebody who have never read Common Lisp standard or any scheme compilers documentation.
>>
>>62874730
And also, there shouldn't be any RTL support. Arabic text should have been stored reverse, and applications would have to input it in the rendering order (e.g store "As-salamu Alaykum" as "mukyalA umalas-sA", then x11 people get to make sure the selection goes haywire properly)
>>
File: 1495508708068.gif (682 KB, 540x540)
682 KB
682 KB GIF
I'm a beginning noob and I'm learning C from a book. So far I'm making decent progress. I'm taking small steps and doing as much typing and testing the concepts that I can. Right now I'm trying to make a math game that allows the player to set how many questions it will ask, keep track of how many they get right and wrong and display that at the end of the quiz.

I feel like I understand the simple things but I don't know how to plan and organize the programs I'm making. I feel like they could be better designed but I'm not really sure. Any books that would possibly help me do that? C is my first and only language so far. I'll be starting community college in January to start learning all of this stuff in a classroom setting but I want to get ahead now while I have the change.
>>
Is there any way to manipulate the tokenized representation of C source code? I don't want to write my own tokenizer.
>>
>>62874730
> No matter how you slice it, it's unstable garbage.
It's quite stable now, utf8 works just fine, it's only unstable for the platforms from the 90s that embraced UTF-16 too hard too early.
> then they would have no problem fitting in everything they needed in BMP
But what about character? How would we live without it?
>>
File: pile-of-poo_1f4a9.png (4 KB, 120x120)
4 KB
4 KB PNG
>>62874808 (You)
Wew, apparently 4chan doesn't like my perfectly fine Unicode block: U+1F4A9 PILE OF POO (HTML 💩)
>>
>>62874781
Organisational code will be something you'll get better at over time. Everybody sucks at it when they start.
>>
>>62874781
You should try to split everything up into smaller functions as much as possible, until you feel you've gone too far. That's the gist of it, there are several books on it.
>>
>>62874818
4chan strips emoji and shit from posts
>>
>>62874834
>"""""Design Patterns"""
That list is garbage, unless it's there as an example of what NOT to do.
>>
>>62874581
> i havent noticed
go to previous dpt thread mr dummass
>>
>>62874827
>Organisational
Organising*
I realised I picked the wrong spelling correction.
>>
>>62874808
Unstable garbage in the sense that it's unreliable. When there are security vulnerabilities in text rendering, something has gone horribly horribly wrong.
>>62874818
4chan is quite strict on the unicode, you can't have too many combining characters (zalgo) and Cyrillic acexopy gets replaced with acexopy. This confuses and enrages the google translate.
>>62874843
>some of these are utter garbage.png
>>
File: 1353966539814.jpg (118 KB, 854x859)
118 KB
118 KB JPG
>>62874827
I figured that might be the case. As I'm doing more varied programs and solving how to go about making them I've gotten quicker at figuring things out.

>>62874834
Thanks for the list. I'll check some of them out. So far I'm just working on nesting things and making sense of how much nesting is necessary. Also when using "if, else" vs a switch and two or more cases.
>>
>2017
>C and C++
>Overflow on signed types is undefined behavior
>No built in way to check if overflow has occurred
defend this
>>
>>62874919
It's architecture specific, how should they implement it? You can check the overflow flag on x86 and friends, you can write a safe addition routine that warns you beforehand. What do you want?
>>
>>62874781
>but I don't know how to plan and organize the programs I'm making.
Split your code up into different layers.
UI (GUI/CLI) <--> glue code (business logic) <--> backend (I/O such as database interaction)
It's not exactly programming related, but 'The Art of Unix Programming' has some tips and tricks to keep your code modular.
>>
>>62874919
It's FAST and PORTABLE

>>62874935
Most other languages either explicitly define that integer overflow wraps around (because that's how it works on 99.9% of processors) or that it triggers an exception of some sort (because it's checkable on 99.99% of processors).
In C, the compiler is allowed to generate code that works differently under different optimization flags. E.g.
int test(int x) {
return (x+1) > x;
}
>>
>>62874935
>You can check the overflow flag on x86 and friends
Would be lovely if C had any functionality to let me do it.
>>
>>62874919
>Wanting your language to be slow as balls by doing everything instead of letting the programmer worry about relevant parts of code execution
If you want something done right, do it yourself:
long sat_add(long a, long b, int bitwidth)
{
int sign_state, temp_sign;
long temp_addition;
sign_state = get_sign_state(a, b, bitwidth);
temp_addition = a + b;

temp_sign = get_sign(temp_addition, bitwidth);

/* Make a decision of what to return based on the signs of the inputs */
switch(sign_state)
{
case(BOTH_POSITIVE):
/* We know if an overflow/underflow happens if the sign of the addition is
different than from one of the inputs (and both inputs have the same sign) */
if(temp_sign != get_sign(a, bitwidth))
return signed_max(bitwidth); /* Overflow */
else
return temp_addition;
break;
case(BOTH_NEGATIVE):
if(temp_sign != get_sign(a, bitwidth)) /* Underflow */
return signed_min(bitwidth);
else
return temp_addition;
break;
default: /* case(SIGNS_DIFFER) */
return temp_addition; /* Business as usual */
}
>>
>>62874979
If 99.9% is good enough for you, then rely on UB. It's that simple.
>>62875004
Write a macro that checks if you're on an arch where you can check overflow flag, if so evaluates to inline assembly snippet, if not evaluates to safe addition snippet. Simple as.
>>
>>62875056
>sign(a + b)
IT'S ALREADY TOO LATE
>>
>>62875060
>then rely on UB
That's not what UB means. UB doesn't mean "architecture specific". UB means "the compiler is allowed to completely ignore the effects in the case of the UB event happening, so you literally cannot predict the result of your code even if you know how it is *usually* implemented on your architecture"

Also: C is not anywhere close to a "short translation away from assembly" as most people claim.
>>
learned about functions today in class
you REALLY have to read the code! in C, at least

I can see how it can get very messy very fast
>>
File: rust_integer.png (149 KB, 986x991)
149 KB
149 KB PNG
>integers in his language don't have wrapped_*, saturated_*, checked_* and overflow_* methods
>>
>>62875127
eww
>>
>>62875127
>checked_abs
>>
>>62875179
and?
>>
>>62875179
with systems that use two's complement the most negative value cannot converted to positive with same bit width.
>>
>>62875210
wanna check my abs?
>>
>>62874250
check this out:
01000100 01000001 01010100 01000001 00100000 01010011 01000101 01000111 01001101 01000101 01001110 01010100 00001101 00001010 00100000 00100000 00100000 00100000 00100000 01001110 01010101 01001101 00110001 00100000 01000100 01000010 00100000 00111001 01001000 00001101 00001010 00100000 00100000 00100000 00100000 00100000 01001110 01010101 01001101 00110010 00100000 01000100 01000010 00100000 00110111 01001000 00001101 00001010 00100000 00100000 00100000 00100000 00100000 01010010 01000101 01010011 01010101 01001100 01010100 00100000 01000100 01000010 00100000 00111111 00001101 00001010 01000101 01001110 01000100 01010011 00001101 00001010 00100000 00001101 00001010 01000011 01001111 01000100 01000101 00100000 01010011 01000101 01000111 01001101 01000101 01001110 01010100 00100000 00100000 00001101 01001100 00100000 00100000 00001101 00001010 00100000 00001101 00001010 00100000 00100000 00100000 00100000 00100000 00100000 01001101 01001111 01010110 00100000 01000001 01001000 00101100 00110100 01000011 01001000 00001101 00001010 00100000 00100000 00100000 00100000 00100000 00100000 01001001 01001110 01010100 00100000 00110010 00110001 01001000 00100000 00100000 00100000 00100000 00100000 00100000 00001101 00001010 01000101 01001110 01000100 01010011 00001101 00001010 01000101 01001110 01000100 00100000 01010011 01010100 01000001 01010010 01010100
>>
>>62875211
>Most
Literally only the minimum value.
>>
>>62875245
<code>DATA SEGMENT
NUM1 DB 9H
NUM2 DB 7H
RESULT DB ?
ENDS

CODE SEGMENT
L

MOV AH,4CH
INT 21H
ENDS
END START</code>
>>
>>62875245
dumb binary poster
>>
>>62875256
>the most negative value
dumb spanish poster
>>
>>62874250
>What are you working on, /g/?
Writing a standard neutal network in C++ using Eigen for matrix stuff. Just for practice/fun.
>>
>>62875268
>:^(
01010111 01100101 01101100 01101100 00100000 01100110 01110101 01100011 01101011 00100000 01111001 01101111 01110101 00100000 01110100 01101111 01101111 00100000 00111110 00111010 01011110 01111100
>>
So I have a industry related question. So after a few years of experience, degrees and qualifications don't matter as much. Now my question is, does the success/scale of previous projects get taken into consideration when hiring someone?

Let's say for example (which is kinda the position I'm in), you work for a company, they assign you as the only developer for a product. The product is quite successful and gets deployed nationwide by 2 or more very big companies. If you were to apply for a job which require way more qualifications/experience than what you have, would you even get considered based on the scale/success of this project? Because to me it feels like it's an experience or gtfo industry. And how do you even get noticed in the industry when working for a company (you can't show anyone the code).
>>
Why is writing libraries in C++ a bad idea?
>>
>>62875420
C++ has no stable ABI so you can't distribute compiled object code.
>>
>>62875420
The language is shit to begin with.
Unstable ABIs, making your library stupidly hard to link with.
>>
sql is really fucking cool in so many ways
>>
>>62875443
thanks senpai
>>
>>62875420
You propably need to use libraries to build your own library. Most sepples libraries are shit and cluster fucks of template mess.
>>
>>62875443
error: unresolved external ___SDfSDF_ASCASDc_______ASEFDasd__Hello_World_ZSD123D@#FD123dfc
>>
>>62875288
That terminology is used all the time in science because if you just say "minimum" it's not always clear whether you are talking about the minimum magnitude or the minimum value. Saying "most negative" makes it explicitly clear that you mean the number with the lowest value, not the closest to zero.

In CS the distinction is less meaningful because whatever zero represents for a given dataset might as well be arbitrary, but it's not a bad habit and certainly isn't exclusive to non-native English speakers.
>>
>>62875385
>Now my question is, does the success/scale of previous projects get taken into consideration when hiring someone?
Success no, scale yes.
It's the job of the marketeer to make the product/service commercially successful. Your job is to make it as good as possible for the given time/resources.
Having experience in large scale projects is a big bonus. Everyone can write a simple script, but mastering a large scale project is tricky. You have to take into account performance, maintainability and scalability. Those three aspects are also relevant to small projects, but they really make or break large scale projects. Architecture is very important during technical interviews. Make sure to convince the interviewer why your architecture is so great and what you contributed to it.
>>
>>62875560
Here is pretty much the worst place to complain about this because y'all will just tell me to use C or something if I want speed, but matplotlib is fucking slow! I thought it would be cool to represent some of my data as a 3D surface, but if I try to render it with enough resolution to actually look like something, I run out of memory. I guess that means no easy surfaces for me.
>>
File: boost.png (36 KB, 483x884)
36 KB
36 KB PNG
>>62875443
> C++ has no stable ABI so you can't distribute compiled object code.
It has no stable cross-platform ABI, but that doesn't mean you can't distribute compiled object code within a platform.
>>
>>62874250
I'm working on a command-line tracker that synthesizes music from text files. I originally only planned on making the synthesizer part (as a means to play music live), but I wanted to be able to store and playback music. It's currently got support for sine/square/pulse waves, polyphony, and the ability to change the duty cycle on the pulse wave. My next goal is to make each channel independent of one another, allowing for standard features like having different waves play in different channels.
>>
>>62874362
Stack overflows.
>>
>>62875691
Fuck you, and fuck your boost. C++ code using std::string compiled using c++11 mode can't be linked to C++ using previous c++ standards.
>>
>>62875787
Yes, because the internal representation of std::string in libstdc++ has changed, they used to have some optimizations the new standard specifically forbid IIRC. It's a gcc problem tho, not C++ one.
>>
>>62875857
It's a gcc problem, and what this problem means is that c++ does not actually have a stable ABI within a single platform either.
>>
>>62875903
Well, ok, you're kinda right, but that doesn't stop all the C++ libraries from being distributed as compiled shared libraries. I mean, Qt works fine everywhere, yet no one links to it statically.
>>
>>62875996
Doesn't have linear types
>>
>>62875945
Static Qt is intentionally gimped, last time I checked you couldn't even have Wekbit if you compiled it as a static lib.

But static/shared distinction is completely irrelevant for the question, since both suffer the same from the lack of stable ABI.

>>62875996
I learned Perl because it made easy things trivial and difficult things possible. Haskell makes easy things difficult and trivial things possible. I gave up trying to make any use of it.
>>
File: pipes.jpg (66 KB, 857x596)
66 KB
66 KB JPG
So I want to create a child process and redirect its stdin and stdout to the parent, then go back and forth - send string to child, get response, send another string, get next response, and so on. Unless I close the pipe write handle(which I don't want to because I want multiple writes), ReadFile() will block indefinitely (despite the child process writing something to stdout immediately after startup, so at least the first read should go through). Also if I ignore the ReadFile() issue for a moment and just call WriteFile() a couple of times, only the first write works out.
Halp. Has anyone else done this sort of stuff?
>>
>>62876016
> But static/shared distinction is completely irrelevant for the question, since both suffer the same from the lack of stable ABI
According to you the lack of stable ABI is such a huge problem "you can't distribute compiled object code", yet the fact that all the Linux distributions have no problem deploying C++ libraries as compiled shared libraries makes your statement demonstrably false.
>>
>>62875691
>but that doesn't mean you can't distribute compiled object code within a platform.
So long as "within a platform" means "I've got exactly the same versions of everything" then yes.

Qt does better than that because it actually tries to avoid putting implementation details in places where they'd get compiled into client code, but that's very much the exception in C++ land.
>>
>>62876083
Don't see how. All distributions compile their own libraries and software packages. If you want to distribute binary library you expect that whoever makes the software will build that software himself, not ask for you to build it or build it using the compiler you provide.
>>
>>62876070
>winapi
I'm sorry anon
>>
>>62876070
I don't know about Windows, but on Linux the typical problems would be:

1. You not flushing the buffer after writing to it.
2. The program you write to detecting that stdout is not a tty and therefore not flushing its own output buffer.
3. Using a function that tries to read the amount of data you ask for instead of returning when it gets anything (i.e. hanging until you get your full 4096 bytes)
>>
>>62874294
>>62874303
He isn't wrong, IMO. JSON should only exist for your restapis and shit because it is already the standard.

For persistent data storage, you should be using something like Postgres. And, for configuration, you should be using something like TOML.
>>
>>62876016
>Haskell makes easy things difficult and trivial things possible

It also makes difficult things trivial, thanks to flexible but strict control of side effects and shared state. I learned way more about developing Java and C++ from writing Haskell than I ever did from developing Java and C++.
>>
>>62874303
[reddit]
subreddits = ["foo", "bar"]

# comment example #

[[rss]]
url = "http://foo.com"

[[rss]]
url = "http://bar.com"

# or you can do this instead #
# [rss]
# urls = ["http://foo.com", "http://bar.com"]

[console]
format = "{NAME}\n{URL}\n{DESCRIPTION}"

[mail]
host = "smtp.foo.com"
port = 25
>>
>>62874386
Not a fan of the eco system and, IMO, the JVM is nicer. It's not bad, though. I think it is better than Java itself.

But, Kotlin beats both of them and runs on the JVM. So...
>>
How do we make writing python a felony in the west?
>>
>>62876394
it should be classified as a war crime imo
>>
>>62876393
kotlin is gay
>>
>>62876403
no, ur mom
>>
Maybe this belongs in the stupid questions thread but I'll try here first.

When I copy the following array in c with memcpy
>int x[2] = {4, 256,}
to char c[8], I expect c the contain
>{0, 0, 0, 4, 0, 0, 1, 0}
But when I print c it looks like this
>{4, 0, 0, 0, 0, 1, 0, 0}

Shouldn't the least significant bits be on the right like I predicted? Is this platform dependant?
>>
>>62876459
It's platform dependent. It's called endianness.
>>
hey guys i am taking the web development bootcamp course on udemy can't wait to make some siq apps and share with u guys

while(0 < 1) {
console.log(":^)")
}
>>
@62876503
here's you're you
>>
>>62876403
Disagree. It has (almost) all of the good features of C# with the benefits of the Java ecosystem and tuning of the JVM.

Compared to Java:
* Kotlin has operator overloading.
* Kotlin has C# style getters and setters
* Kotlin has some of the best null safety in the industry
* Kotlin pretty much has C# reified generics
* Kotlin has great DSL-style builders
* Kotlin has C# style extension functions
* Kotlin's KDoc is significantly less verbose and flexible
* Kotlin's default types are much better than most others; immutability and null safety is default rather than something you have to add in.
* Kotlin has data classes so you don't need to constantly overload tostring and equals and hash
* Kotlin has lazy initialization singleton objects so you don't need to write boilerplate
* Kotlin has named parameters and its data classes come with a clone() function. So, what this means is instead of relying on something like Lombok's @wither or writing a billion boilerplate functions to clone your immutable objects with x, y or z field, you can just do clone(x = newX), clone(y = newY) rather than withX(final int x), withY(final int y) withZ(final int z)
>>
>>62874250
When will Go get driversfor common databases?
>>
>>62874318
Depends on your project. What are you building?
>>
>>62876543
> tl;dr Kotlin has C# on the JVM.
>>
>>62876560
It's like wow and gta but in the same game
>>
>>62876543
>Simply adding features makes a language better
I bet you think C++ is better than C

operator overloading is shit. properties are shit. Trying to patch null safety into an ecosystem which has none is shit. Generics remain shit and can only be reified in the most restrictive contexts. Extension methods are shit. etc.
>>
>>62876589
And what do you want to store?
>>
File: china.jpg (136 KB, 768x1024)
136 KB
136 KB JPG
>>62876546
hey can some "gopher" redpill me on what go does that c#, java, ceylon, and kotlin don't do? Or, what it does better than those?

coroutines are cool and shit, yeah. But, Quasar pretty much brings most - if not all - of go's concurrency shit to the jvm and kotlin has first class coroutine support.

like, I genuinely don't quite get what purpose the language serves. Genuine question and any response is appreciated
>>
>>62876622
it's so simple even a moron can use it
>>
>>62876471
For some reason I assumed no modern platform would use little-endian (as I now know the name). Thanks for clearing it up though
>>
>>62876622
I'm a go-newbie myself. It's just that go seems to allow to built the same things like in C but has some syntactic sugar on top. I'd like to use it but without easy peasy db drivers it won't be suitable for me.
>>
>>62876622
go's selling point is first-class channels, which is supposed to enable highly concurrent applications.
but it lacks generics, so you know.
>>
Is there a Rust crate for setting up and tearing down tests? Or is there some magic I can pull that would make it so I didn't have to do
#[test]
fn test() {
setup();
...
teardown();
}
>>
Why does C let you write arbitrary { } brace blocks even if there's no conditional or loop statement guarding that block?
>>
File: what.png (38 KB, 1766x434)
38 KB
38 KB PNG
Can anyone here help me?
How do you change the output language in pep8? for some reason it is coming out in Chinese when i don't even have that set as my locale, everything is in English.
>>
File: godot-80lv.jpg (40 KB, 500x500)
40 KB
40 KB JPG
Juan Linietsky justifying the GDScript language for Godot:

>Been there, done that, it wasn't good enough. That's why a DSL. Godot was an inhouse game engine for a long-time, and using existing languages (we used Lua and Squirrel mainly and experimented with Python) lead to all sort of problems, like:
>-No multi-thread support (most script VMs don't support this)
>-No built-in vector types (vital for games, ignored by other SL)
>-Garbage collector stalls (Lua is terrible at GC)
>-Bad performance due to SL OO model not matching Godot OO model (Python and Lua)
>-General confusion by programmers using the SL due to it having to be wrapped to a data model it was not designed for.
>Many criticize Godot for having a built-in script language, as if we just had to pick one and use it and as if we were dumb for ignoring the existing ones.
>But that people really has no idea how difficult it is to use existing scripting languages in a real-time constrained environments because none of them is designed for that. Even Unity users have trouble with C# due to the garbage collector and have to use strange workarounds such as pooling.
>Godot uses GDScript and both together work seamlessly as a whole, with no strange corner cases. It's very easy to learn, It always works as expected, it scales and you never feel that the glue that puts language and engine together doesn't stick.
>I can't blame anyone for not wanting to leave the comfort zone, but I'd rather make something that works properly when required than tempting potential users with the promise of using something familiar that will bring problems later.

Is he right?
>>
>>62876732
Better question: why would C stop you? The grammar is made simpler when compount statements are just like any other statement.
>>
>>62876593
t. Unemployed /dpt/ Clang shitter

stay mad using an unproductive language, idiot :^)
>>
File: trapfaggot btfo.png (40 KB, 640x175)
40 KB
40 KB PNG
>>62874250
Reminder to report disgusting trapfaggots.
>>
File: 1497711228033.jpg (29 KB, 600x600)
29 KB
29 KB JPG
>>62876746
Why not use C++? Or even better, Rust?
>>
>>62876586
Basically, yeah. Best of both worlds, IMO. Feels like a more refined C# with perfect interop with Java.

>>62876593
>>Simply adding features makes a language better
>Glossing over the improvements to existing features

Again, I don't want to write shit like this:


public final class Location {

private final int x;
private final int y;
private final int z;

public Location(final int xCoordinate, final int yCoordinate, final int zCoordinate) {
x = xCoordinate;
y = yCoordinate;
z = zCoordinate;
}

public int getX() {
return x;
}

public int getY() {
return y;
}

public int getZ() {
return z;
}

public Location withX(final int newX) {
retun new Location(newX, y, z)
}

public Location withY(final int newY) {
retun new Location(x, newY, z)
}

public Location withZ(final int newZ) {
retun new Location(x, y, newZ)
}

@Override
public int hashCode() {
// I legit don't even want to write this for the example
}

@Override
public boolean equals(final Object o) {
// I legit don't even want to write this for the example
}

@Override
public String toString() {
// I legit don't even want to write this for the example
}
}


vs

data class Location(val x: Int, y: Int, z: Int)


^^^^^^ legit that is the exact same class no joke

You get the functionality of the withBlah(shit) by doing clone(x = x)

toString, hashcode, equals, etc come with data classes, etc.

Getters can be created after the fact and all existing code in the code base doesn't even need modification.

>operator overloading is shit
I find it really useful in my day to day job, actually

>Trying to patch null safety into an ecosystem which has none is shit
Better than literally no safety, lol

>Generics remain shit and can only be reified in the most restrictive contexts
Like I said, pretty much has them. They aren't as nice as they are in C#. But, they are significantly nicer than in Java

>Extension methods are shit. etc
Meme
>>
>>62874339
That's retarded
>>
>>62876815
hope u enjoy my overuse of legit, btw, thx legit
>>
>>62876815
let your IDE fill in the blanks. Then you can actually see what's happening and it's not impenetrable magic in the background.
>>
>>62876850
Elaborate
>>
>>62876795
Because they're clusterfuck languages?
>>
>>62876727
Nevermind. I figured something out. Still feels awkward.

#[cfg(test)]
mod tests {
use super::*;

struct Setup {
system: System,
}

impl Setup {
fn new() -> Self {
let mut setup = Self {
system: System::new(),
};
load_test_data(&mut setup.system);
setup
}
}

/** Load some test data into the system memory for the purposes of testing. */
fn load_test_data(system: &mut System) {
system.memory[0] = 0xAF;
system.memory[1] = 0x7F;
system.memory[NUM_BYTES / 2] = 0x77;
system.memory[NUM_BYTES / 2 + 1] = 0x88;
system.memory[NUM_BYTES - 2] = 0x3A;
system.memory[NUM_BYTES - 1] = 0x01;
}

/** Read a word (two bytes) from the system memory. */
#[test]
fn read_word() {
let setup = Setup::new();
let system = &setup.system;
assert_eq!(0xAF7F, system.read_word(0));
assert_eq!(0x7788, system.read_word(NUM_BYTES / 2));
assert_eq!(0x3A01, system.read_word(NUM_BYTES - 2));
}
}
>>
File: kamiyama.jpg (40 KB, 640x486)
40 KB
40 KB JPG
>>62874250
In python, how do I take a single list with like 300 elements and then turn it into a nested dictionary that is like

overall dictionary {
dictionary1 {
values
values
}
dictionary 2 {
values
values
}
}


and so on, using only basic functions and stuff?
>>
>>62876871
How is

data class Location(val x: Int, y: Int, z: Int)


Impenetrable magic?

The data marker tells you that it is a class whose sole purpose is to store data. It lets you know that toString and shit are already there for you.

clone() is again not impenetrable magic. it does what it says on the tin

and, finally, getting rid of getters is also not impenetrable magic. if your class doesn't have a getter, then it doesn't have a getter - boom done

And, if you DO see a getter, then you actually know that the getter serves a purpose and wasn't just created as boiler plate

IMO, having 50 lines of boilerplate is a bigger readability issue than clean and concise markers like Kotlin has.

>let your IDE fill in the blanks.

I don't really like the idea that your IDE should fill in the blanks where the language failed to do so

It is the job of the language to do a good job in the first place

And, also, Java's defaults, as I mentioned before, will pretty much perpetually promote bad habits. In Kotlin, you need to actively go out of your way to make some mutable structure whereas in Java, everything is by default. And, again, there is the nulling issue
>>
People knowing asm x86 :
How the fuck do I manipule that shitty crtc cursor ?
>5 first bits of the start register(0xA) are 1
>5 first bits of the end register(0xB) are 0
>So it's supposedly fully visible
I write the 0xE to the cursor command register, then the LSB position in the cursor data register, same with 0xF for the MSB but nothing appends
>>
>>62876976
^ sorry, the example should be

data class Location(val x: Int, val y: Int, val z: Int)
>>
>>62876871
Knowing what's happening is all well and good for your first few classes of undergrad, but there's a lot to be gained from abstraction. If you're too stupid to understand how or why something works, the onus is on you to learn it and not to go "muh black magic everyone should reinvent the wheel any time they want to program anything useful"
>>
>>62876732
So you can decrease the scope of variables.
>>
File: .gif (27 KB, 576x354)
27 KB
27 KB GIF
What is the best BASIC for Linux?
>>
>>62876879
Unless it's very large there is no reason to use a binary format
Storage is cheap. not even 512B vs 512KB matters, so why make it more painful for the users that do wish to change it or developers who want to debug or test the quality of it.
>>
>>62877204
The reason I would choose binary isn't because it results in smaller file sizes but because it can be much easier and faster to read binary than parsing a text file.
>>
>>62875137
Operators call the checked versions. You have to use the full name for wrapped or overflowing versions, but it's rare you want to rely on that behaviour. Since Rust has method syntax it at least looks like x.wrapped_add(y).
>>
>>62877233
If you're constantly reading and writing to it, sure.
But realistically this will only be writing in a separate thread and when you're starting and stopping the application.
But obviously if the data is very large and this actually impacts performance noticeably you should be using something like sqlite.
If it's even bigger go for a database server
dumping structs in binary form belongs to cheap home computers from the 80s and other toys.
>>
>>62877300
I'm gonna take your advice pal and convert all the assets in my game to text formats.
>>
>>62877400
I've got your back, pal!
https://en.wikipedia.org/wiki/Netpbm_format
>>
File: brainlet.png (253 KB, 1000x1000)
253 KB
253 KB PNG
>>62877300
>dumping structs in binary form belongs to cheap home computers from the 80s and other toys.
>>
>>62877400
>moving the goalposts
a game shouldn't write to the assets at all.
>>
>>62877439
>i've only ever dealt with dos games
i just hope you don't end up writing software that deals with important data
>>
>>62877536
Why specifically do you think it's a bad idea?
>>
>I need you to compute X
>okay, to do that I need you to send me Y
>*sends half of Y*
Why do people do this?
>>
>>62877602
It's a secure transaction, faggot

lrn2 crypto
>>
>>62874250
I don't understand checked vs unchecked exceptions (i'm trying to learn java). My text says RuntimeException and Error (and their subclasses) are known as unchecked exceptions, and all others are known as checked exceptions. It says: "by checked we mean that the compiler forces the programmer to check and deal with them in a try-catch block or declare it in the method header." That's pretty much all it says distinguishing the two.
Why did they choose these classes as checked and unchecked? why even make the distinction?
>>
>>62877588
Because all it takes is one bad write operation to mess everything up. If you have a database this isn't an issue to the same degree.
If you're going to make it reliable you basically have to write your own database engine.
And if the data is small it's pointless in the first place and just makes things difficult for users.
>>
>>62877469
And the tools that create all the assets?

Oh right, we don't need them any more because we can type out our assets in a text editor
>>
>>62877622
Checked exceptions can be recovered from. Say for example, if you try to open a file that doesn't exist.

Errors are generally things you can't recover from like out of memory. Nothing you can do but let your program crash in this case.
>>
>>62877637
>write to new file
>swap names
>delete old file
Not that hard. Worst case scenario you end up with two files and one of them is malformed, but that would be easy to detect automatically to load the old one.
>>
>>62877645
The tools that create the assets don't dump structs either, they create properly formatted files according to open standards.
>>
>>62877622
IIRC Java started out with only checked exceptions but added unchecked exceptions because nobody wanted to have try/catch and annotations everywhere, so now it has both.

>>62877688
That's not how Java works.
>>
>>62877622
It's a design choice. You would go mad if you had to catch an overflow exception everytime you add two integers, so these exceptions are runtime exceptions. You can catch them if you expect them, otherwise you ignore them.
Some exceptions are so common, like retrieving shit over some unreliable network, that java forces you to catch them and react gracefully. So if your program ever crashes, the developer has no excuse but his own shitty coding.

Some developers are so pissed of by forced checked exceptions that they wrap every exception in a runtime exception, because in their view the developer knows best. Not everybody agrees with the java design. You should make your own opinion
>>
File: index.jpg (6 KB, 300x168)
6 KB
6 KB JPG
I've made an android app, but the design looks like shit

Any sources to find inspiration to design net apps?
>>
>>62877739
*neat apps
>>
>>62877697
You've already made it more complicated than using a database, but all right, let's stick to it.
What happens when the backup job starts?
What happens when you add a second server for load balancing?
What happens when your program causes the file to corrupt without noticing it and you have the merge the non-corrupt changes back into the latest backup?
>>
>>62877739
the fellas over at Dribble are bretty gud
>>
>>62877757
good idea

thanks
>>
>>62877754
>What happens when the backup job starts?
>What happens when you add a second server for load balancing?
He's making a game retard.

>What happens when your program causes the file to corrupt without noticing it and you have the merge the non-corrupt changes back into the latest backup?
Just don't write a broken program?
>>
how do you learn a programming language off by heart?

I've been doing online learning courses and assignments and problems in javascript and I'm constantly looking at a reference sheet of the syntax of all the different built in string and array manipulation functions and I feel like such a slow scrub.

Did you guys find that you memorised it all over time naturally or did you bite the bullet and just sat down and wrote them out or something again and again until you had wrote memorised all the basic functions and their syntax in a language?
>>
>>62877814
it comes with practice, and you shouldn't worry about it as it does not matter at all.
What should matter is that you write good code
>>
>>62877782
If you click through all the replies there a game is never mentioned.
>Just don't write a broken program?
Multi-billion dollar companies do it, why do you think you can do better?

If it's a game and you're not a AAA developer, however there is no excuse to dump binary structs, the data is so small it's irrelevant.
It could be excusable if you're microoptimizing and pushing hardware to its limits, but if it's just a small game's map data or animations etc, you're just being ridiculous by not making that easily modifiable.
>>
>>62877814
You can learn by repetition or you can search for the janki method in your favorite search engine, it basically utilises Spaced Repition Software to make learning more efficient and a long term thing.
https://www.youtube.com/watch?v=ai2K3qHpC7c is a oversimplified simulation of SRS, but it gets the point across
>>
>>62877854
>If you click through all the replies there a game is never mentioned.
>>62877400

>you're just being ridiculous by not making that easily modifiable.
That shit should be done in an editor anyway.
>>
>>62877854
and you are hurting your game by making modding harder
>>
>>62877700
Those two aren't mutually exclusive. You dump structs in exactly the same format that the standard asks for (ironically, the standard was usually designed around dumping said structs).

You don't need to worry about alignment/endian issues in a game because you're only running it on a small number of architectures, and you know what they are, and you can test the compiler does in fact do the correct alignment.

Let's call deserialize() on every int, which will either do a memcpy or several bitwise ors and shifts to basically do what could be done by casting a pointer instead.
>>
>>62877688
>>62877711
>>62877734
Thanks guys
>>
File: 1479816099119.jpg (28 KB, 640x480)
28 KB
28 KB JPG
xDDD tranny is programming!!!
>>
In the jvm what exactly are references on the stack?
>>
>>62874250
Hey guys! had a basic ass question about my c++ project.

cout << "Your new cost is " << pow(ADULT_PARTY,2) << " dollars" << endl;

How do I get that spit out 16000000 instead of 1.6e+07?
>>
>>62877888
>>>62877854 (You)
>>If you click through all the replies there a game is never mentioned.
>>>62877400
That's a different conversation than what you replied to. It ends after a few replies.
>>62877892
This.
>>62877907
>You dump structs in exactly the same format that the standard asks for (ironically, the standard was usually designed around dumping said structs).
In this case the question is pointless in the first place, if you're going to save things in a standardized format you don't choose between XML, JSON and binary, you do as the standard says.
>You don't need to worry about alignment/endian
Only if you are a shitty developer
>Let's call deserialize() on every int, which will either do a memcpy or several bitwise ors and shifts to basically do what could be done by casting a pointer instead.
You're not doing this in the same thread as you're rendering your game in, and the performance difference is irrelevant in a small project anyway.
>>
>>62878046
>cout << fixed << "Your new cost is "
>>
Was interviewing a candidate. I don’t expect on the interviewee to know all the syntax off the top of their head, any reasonable assumption is okay by me.

e.g. : list.sortByAlgo () , myDictionary.putIntoDict(val) , stack.pushInOrder1 (element) is fine by me , as long as they know the O(space) and O(time).

We had a s/w engineering major (not CS, not computer engineering - these are different beasts) come in to interview.

I asked a simple question: reverse every alternate elements in an array.

I just wanted to know they knew how to increment by 2 in a for /while loop. I know it's still O(n) but the c (constant factor ) is half

[1,2,3,4,5,6] → [2,1,4,3,6,5]

they wrote :

temp = a[0]

a[0] = a [1]

a[1] = temp

temp = a[2]

a[2] = a[3]

a[3] = temp

and so on….

I asked what they would do if I had a million elements?

I’m not kidding! Lol! They said this has to be repeated that many times ( 500000 times)! I assumed they meant a FOR loop, so I asked them to write it ( the FOR loop I mean, pseudo-code is OK) . They had not heard of it!

Software Engineering != Computer Science / Engineering

EDIT:

I’m guessing they were an engineering major in some other field (but should’ve learnt FOR loops anyway in the first year ). Probably got a Bachelors in India and got a masters in Software Engineering from SJSU ( Which I assume is about planning & management of schedules/ risk mgmt.). Might’ve been a good fit as a project manager, but not as an Engineer.
>>
File: emoji.jpg (1 KB, 160x160)
1 KB
1 KB JPG
>>62878083
>C++
>>
>>62878086
Lol!
>>
>>62878086
>double line breaks everywhere
>EDIT:
wtf is this post?
>>
>>62878121
>>62878086
https://www.quora.com/What-is-the-most-absurd-code-youve-ever-seen/answer/Ameya-Ganchha?srid=WIQ6
>>
fucking explain life time specifiers on rust to me. what is this
'a
autism? don't dumb it down on some vague shit. explain it or i will kill you right now
>>
>>62874250
Made this "safe" malloc function
void* safeMalloc(size_t size)
{
void *pointer = NULL;
while (pointer == NULL) {
pointer = malloc(size);
}

return pointer;
}
>>
>>62878213
i dare you, i double dare you
>>
>>62878241
the problem with this is that it's going to freeze up the application completely and also try to use 100% of cpu power.
But other than that an approach like this can be useful in certain cases
>>
>>62878304
How could it be improved?
Something like sleep between tries?

I just wanted something that prevents the program from crashing when the system runs out of memory.
>>
>>62878380
>I just wanted something that prevents the program from crashing when the system runs out of memory.
for this purpose in a simple program it's great
>How could it be improved?
>Something like sleep between tries?
While not really a beautiful solution something like a usleep(1000) would drastically reduce the cycles wasted.

If it's a larger application it would just be a very different situation with callbacks to the parent thread and so on to try to divert the situation in some way.

Assuming you're not writing the back-end for a bank the usleep will probably do nicely in a simple single-function abstraction
>>
>>62878241
rustfags on suicide watch

>>62878380
check every malloc, if it fails, then don't do anything with it
>>
>>62878478
>check every malloc, if it fails, then don't do anything with it
that's essentially what he's doing, but if you mean that he should keep the program running without doing the malloc at all that's a much more complex task than a single function
>>
Whats the deal with academia's obsession with sorting algorithms? Every language already has built in functions and libraries to sort data. Does anyone actually ever have to code sorting methods?
>>
>>62878241
>>62878304
>>62878380
>>62878463
>>62878478
>>62878502
On some operating systems e.g. GNU+Linux malloc doesn't fail. You only run into problems if you actually try to use the allocated memory and it's not available
>>
>>62878509
They're useful for teaching undergraduates complexity analysis and big-O notation.
>>
>>62878525
Wait, how do you make a program that handles that correctly?
>>
>>62878525
malloc() does fail on Linux with GCC 6, at least.
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
int *ptr;

ptr = malloc(4398046511104);
printf("%llu\n", ptr);

return 0;
}

simply prints 0 and exits right away. i.e. malloc returned NULL, which is a fail.
>>
>>62878569
that's a retarded amount of memory

are you using a 32 bit os? wtf?
>>
>>62878585
No, I'm on 64-bit x86.
If you're wondering why I picked that number I just did 4 * 1024^4 in bc to quickly get an amount of ram I knew I couldn't allocate.
>>
hey guys im new to programming.

I have my text editor set to have tabs that equal two spaces (as spaces, not as tabs). am i doing it right?
>>
>>62878679
tabs for indentation, spaces for alignment after the indentation
>>
>>62878708
yeah but i mean, is it frowned upon to have the tab make two spaces?

I def tab for the indentation and use spaces for the alignment
>>
I wanna get into security, but hate networking, I failed netcad.

Can I get into it with programming?
>>
>>62878679
Pick up C#, Visual studio takes care of all of that for you.
>>
>>62878743
Yes, learn Haskell.

Most companies are using it to protect their cloud information, and most notably, Facebook uses it for their cyber security through automated Haskell tests and retrieval processes.
>>
>>62878744
I'm starting with Javascript/nodeJS/mongoDB. Will learn other languages later if I need to. Trying to get enough chops to be a good product manager.
>>
>>62878777
All you need to be a good Product manager are interpersonal soft skills.
>>
>>62878792
Not if you want to get interviews at good companies apparently.
>>
>>62878725
4 spaces is way more common
>>
>>62878825
I work for one of the biggest tech companies in the world, Product Managers should leave technical shit to us programmers and be more socially competant. Not a fan of autistic antisocial product managers.
>>
File: 1507697588341.jpg (55 KB, 772x772)
55 KB
55 KB JPG
>>62874362
il help u if u post screenshot with emacs instead of this hell
>>
>>62878838
Well I'm very socially competent, and my background is business and I'm good at gathering feedback and understanding which features further business interests & customer interests. So many PM roles I see here in NYC want you to have experience with some kind of coding.
>>
>>62878859
lol ive never seen a PM with actual software experience
>>
>>62878838
>Product Managers should leave technical shit to us programmers and be more socially competant

>not embracing the technocratic ethic
>not controlling your PM with nanomachines
>>
>>62878509
No, but they make good academic exercises for explaining CS concepts. Also, I'd rather not have people blindly using things with no idea why/how they work.
>>
>>62874250
>All the foreign students cheat off each other in my class rather then actually learn

They made a comment statement in c++ in visual studio without the proper syntax (they didn't use /* or //)

It took 5 of them trying to figure out why it wasn't working until I had to step in
>>
>>62874268
TOML, faggot
>>
>>62874250
My book does a really shitty job explaining/defining exception handling - in particular, checked vs unchecked exeptions.
It says, "RuntimeException, Error, and their subclasses are known as unchecked exceptions. All other exceptions are known as checked exceptions, meaning that the compiler forces the programmer to check and deal with them in a try-catch black or declare it in the method header."
Does this imply unchecked exceptions aren't dealt with in try-catch blocks? Or is it saying that when a checked exception occurs, it must happen in a try-catch block or be thrown by a method whom is declared to throw such an exception?
>>
>>62879195
We have a lot of Indian students at my uni and they are absolutely notorious for cheating; I have heard a professor say it is not uncommon for them to pull out their laptop during an exam and try to look up an answer or how to do something.
>>
WTF! Where is size_t defined in C++?
>>
>>62879298
Here's the diffrence
//unchecked 
void unchecked() {
throw new RuntimeException();
}

// checked

void checked() {
throw new IOException(); // this wont compile
}

void checked2() throws IOException(); {
throw new IOException(); // compiles
}

void checked3() {
try {
throw new IOException();
} catch (Exception e) {
throw new RuntimeException(e); // compiles
}
}
>>
>>62879345
try {
unchecked();
} catch (Exception e) {
print(e);
}
try {
checked2();
} catch (Exception e) {
print(e);
}
>>
>>62879345
>void checked2() throws IOException(); {
that should be
void checked2() throws IOException {
>>
>>62879345
Dude thank you
>>
>>62879319
http://en.cppreference.com/w/cpp/types/size_t
>>
>>62878213
>>62878274
The lifetime of a reference is the contiguous region of code where it is valid.
>>
>>62878509

http://www.specialneeds.com/children-and-parents/general-special-needs/organizing-and-sorting-normal-children
>>
How do you code merge sort without using recursion?
>>
>>62879587
explicit stack
>>
>>62874682
Listen to the silence. No one cares.
>>
>>62874318

XML and JSON are tree-structured. Don't use them unless you need to represent arbitrary trees. You almost never need to.

Dumping structs is awful because platform independence goes out the window and one out of place byte can make the whole file unreadable.

If you want something easy for humans to read and write, use key=value pairs. You can usually represent anything you want by using dot notation in the key.

struct1.field1 = value1
>>
>Computer science offers a few poorer cousins to these perceptual spaces that may also turn up in your software interface, such as HSV and HLS. They are easy mathematical transformations of RGB, and they seem to be perceptual systems because they make use of the hue–lightness/value–saturation terminology. But take a close look; don’t be fooled. Perceptual color dimensions are poorly scaled by the color specifications that are provided in these and some other systems. For example, saturation and lightness are confounded, so a saturation scale may also contain a wide range of lightnesses (for example, it may progress from white to green which is a combination of both lightness and saturation). Likewise, hue and lightness are confounded so, for example, a saturated yellow and saturated blue may be designated as the same ‘lightness’ but have wide differences in perceived lightness. These flaws make the systems difficult to use to control the look of a color scheme in a systematic manner. If much tweaking is required to achieve the desired effect, the system offers little benefit over grappling with raw specifications in RGB or CMY.
HSL/HSV shills BTFO
>>
>>62879646
Adding on to this, dumping structs is also dependent on the compiler used because of alignment and such so it's not even portable across the same platform.
>>
>>62879713
In practice, struct layout is platform defined.
>>
>>62878608

Wouldn't it be representative of a bigger problem in the code base if you're trying to allocate that bullshit amount of memory?

Outside of big data / server setups where exactly are you going to see applications that need to allocate a 4 terabyte chunk of data..?
>>
>>62879769
>not allocating the maximum amount of memory available to the system to assert dominance
>>
>>62879779

The program is a program it uses what it uses and preferably only enough to do the job.

What is the use of dominance? It'll only cause headaches and strife for whoever is using the program.
>>
>>62879819
prevent other beta programs from running
if possible, you should set the priority of your program's thread to high
>>
>>62878859
>and and and and and
someone did not graduate Business, English, or Comms class well did they?
>>
>>62879882

With that logic you might as well make your program just forcibly terminate any other programs running.
>>
>>62880088
correct
>>
new to programming, how do i get the formatting right on 4chan?
>>
>>62880133
STICKY
T
I
C
K
Y
>>
Stop using malloc
>>
using System;

namespace testing4chan
{
class Program
{
static void Main
{
Console.WriteLine("testing");
}
}
}
>>
So this is the power of C...
https://github.com/videogamepreservation/dukenukem3d/blob/master/source/GAME.C
>>
>>62880179
i'm pretty sure the duke 3d source is well-known for being spaghetti garbage, but i'd still take this over AbstractFactoryFactoryTemplateFactoryDelegatorFactory
>>
>>62880179
>9876 lines of code
WRONG (\:^O|
>>
How does one do nestles promises in javascript?

    modifyFriends(false, reciever, sender, next)
.then(modifyFriends(false, sender, reciever, next))
.then(modifyPending(false, sender, reciever, next))
.then(modifyPending(false, reciever, sender, next))
.then(e => res.json({status : true}))
.catch(err => next(err))
.catch(err => next(err))
.catch(err => next(err))
.catch(err => next(err))


Is this correct?
I dont care if its ugly i just need this done
>>
>>62880230
how about this
https://gist.githubusercontent.com/alessonforposterity/832da4fab11e10609dad/raw/258df12378399919ae088ba8731a7571d9c2c947/drgn.txt
>>
>>62880270
await asynce FTW
>>
>>62880287
How would i write that using async?
Im very new to js
>>
>>62880270
literally monads
>>
>>62880286

What in the actual fuck?

That shit sold enough to get over 400 reviews on steam?
>>
>>62880387
the moral of the story is:
>no matter how tidy, how efficient and elegant your code is, the user doesn't care.
>>
>>62880286
:^(
>>
>>62880401
No, but good code is the difference between a game that is released on time with all the planned features and good performace compared to a game that's been delayed and cut down because it was hard to maintain.
>>
>>62880445
why do you need to maintain your code when you release a new game every 2 year.(looking at you cod and battlefield)
also the user doesn't care but future you or future maitainer of this codebase care so there is that.
>>
Trying to process user input with environment variables in C for an assignment.

What do y'all think?
const char *get_env_value(const char *envp[], const char *varname)                                                                      
{
char* curr_env_var; /* Iterator variable */
int counter = 0;
for(curr_env_var = envp[counter]; /* Start at the beginning of the array */
curr_env_var != NULL; /* Go until there aren't any more env_variables */
curr_env_var = envp[(counter+= 1)]) /* Jump to the next variable */
{
/* If the current string matches the env variable*/
if(strncmp(curr_env_var, varname, strlen(varname)) == 0
/* AND it matches perfectly (not just the first n letters) */
&& *(curr_env_var +strlen(varname)) == '=')
return curr_env_var; /* Return the fact that you matched it */
}
return NULL; /* No such string found*/
}
>>
>>62880478
>future you or future maitainer of this codebase care
That's exactly what I am saying.
>>
How would one handle integer overflow if they want it to wrap around? Language is Rust.
>>
>>62880286
        int floor1y, floor2y, floor3y, floor4y, floor5y, floor6y, floor7y, floor8y, 
floor9y, floor10y, floor11y, floor12y, floor13y, floor14y, floor15y, floor16y,
floor17y, floor18y, floor19y, floor20y, floor21y, floor22y, floor23y, floor24y,
floor25y, floor26y, floor27y, floor28y, floor29y, floor30y, floor31y, floor32y,
floor33y, floor34y, floor35y, floor36y, floor37y, floor38y, floor39y, floor40y,
floor41y, floor42y, floor43y, floor44y, floor45y, floor46y, floor47y, floor48y,
floor49y, floor50y,
floor51y, floor52y, floor53y, floor54y, floor55y, floor56y, floor57y,
floor58y, floor59y, floor60y, floor61y, floor62y, floor63y, floor64y, floor65y,
floor66y, floor67y, floor68y, floor69y, floor70y, floor71y, floor72y, floor73y,
floor74y, floor75y, floor76y, floor77y, floor78y, floor79y, floor80y, floor81y,
floor82y, floor83y, floor84y, floor85y, floor86y, floor87y, floor88y, floor89y,
floor90y, floor91y, floor92y, floor93y, floor94y, floor95y, floor96y, floor97y,
floor98y, floor99y, floor100y,
floor101y, floor102y, floor103y, floor104y, floor105y, floor106y,

floor107y, floor108y, floor109y, floor110y, floor111y, floor112y, floor113y,

floor114y, floor115y, floor116y, floor117y, floor118y, floor119y, floor120y,

floor121y, floor122y, floor123y, floor124y, floor125y, floor126y, floor127y,

floor128y, floor129y, floor130y, floor131y, floor132y, floor133y, floor134y,

floor135y, floor136y, floor137y, floor138y, floor139y, floor140y, floor141y,

floor142y, floor143y, floor144y, floor145y, floor146y, floor147y, floor148y,

floor149y, floor150y,
floor151y, floor152y, floor153y, floor154y, floor155y, floor156y,

floor157y, floor158y, floor159y, floor160y, floor161y, floor162y, floor163y,

floor164y, floor165y, floor166y, floor167y, floor168y, floor169y, floor170y,

floor171y, floor172y, floor173y, floor174y, floor175y, floor176y, floor177y,

floor178y, floor179y

I can't stop laughing
>>
>>62880270
Can anyone help out with this?

I'm not even sure if using promises is the right way to do this. All i really want is for each function to call after the previous one is done
>>
>>62880671
this is from a blog post in 2016 I found on google:
"The current status in Rust was decided in RFC 560:
in debug mode, arithmetic (+, -, etc.) on signed and unsigned primitive integers is checked for overflow, panicking if it occurs, and,
in release mode, overflow is not checked and is specified to wrap as two’s complement."
>>
>>62880671
x.wrapping_add(y)
>>
i want to get paid to program in c or c# or even java or c++, all of which i'm perfectly competent with, but i have no degree and would rather let a blender eat my ass then do webdev

will it never happen
>>
>>62877171
go run a C64 emulator
>>
>>62874594
e:\C++\csharp\REEE\REEE\REEE\obj\Debug\REEE.pdb

Nice compilation path buddo :^)
>>
>>62877754
>>>/g/wdg
>>
>>62880270
```
async () => {
await modifyFriends(...)
await modifyFriends(...)
await modifyPending(...)
awat modifyPending(...)
return res.json({ status: true, })
}
```
>>
>>62880766
hmm yes thanks. I just found those useful methods in the Rust docs. I'm wondering if there is a method similar to saturating_add, but instead of saturating at the numeric bounds, it goes to 0. I'm implementing this system where it's unclear whether overflow should wrap or make the value 0.
https://doc.rust-lang.org/std/primitive.u8.html#method.saturating_add
for reference...
>>
>>62880860
x.checked_add(y).unwrap_or(0);
>>
>>62880860
Nevermind. I found the relevant information I needed.
>Be aware that once the supplied number is added, if the value of the register exceeds decimal 255 (the highest possible value that can be stored by an eight bit register), the register will wraparound to a corresponding value that can be stored by an eight bit register. In other words, the register will always be reduced modulo decimal 256.
>>
>>62876363
What difficult things have you made with haskell?
>>
>>62876795
Those are not scripting languages.
GODOT itself is written in C++.
>>
>>62876944
depends on how exactly you want to split the values between the dictionaries, but I'd imagine you'd just assign a splice of the list to whatever inner dictionary you want
outerdictionary.innerdictionary1 = fatlist(:100)
outerdictionary.innerdictionary2 = fatlist(100:)

keep in mind I don't know jackshit about python
>>
>>62878509
They're easy to understand and analyze.
And sometimes the default sorting algorithm in a standard library is suboptimal for a given use case.
>>
I'm trying to finish a vidya with fellow students as part of a group project. It's in java, and you have to go around a world fighting people to collect titles so you can call yourself a knight.

How do I test homebrew audio and input handling libs? At the moment the only test I have for the controller class is it telling you that it's receiving inputs by printing the keycodes and mouse coordinates to the screen.
>>
Official /dpt/ notepad
https://etherpad.net/p/agdg
>>
I'm a bit confused. I compiled an executable binary. It is supposed to open a program. However whenever I double click on the program, the desktop environment asks which program should the executable be opened with.

I don't want to open the binary with anything, I want the binary to be executed instead. What do?
>>
>>62881649
run it from the command line like this
./program
>>
>>62874362
Did you ever set your variable under the factorial function to a value? Or are you letting it just pick up whatever value is at that data address at runtime?
>>
>>62881649
chmod +x ./foo.bar
>>
I'm hopelessly retarded.
Can someone explain the Karatsuba algorithm in an easy way so I can understand, please?
>>
What are some good Java textbooks? Im ordering a C++ one soon and plan on picking up Java soon afterwards.
>>
Recommend a quick little brain teaser that I can do within the hour using C++, FizzBuzz and such can be done in 2 seconds, looking for something with a bit more thought required but not a full on project that will actually be beneficial.
>>
>>62882108
Write a program which converts filthy C++ programs into nice and clean C programs.
>>
>>62882108
>a quick little brain teaser that I can do within the hour
Write a toy lisp JIT compiler.
>>
>>62882115
>nice and clean C programs.
impossible
>>
>>62882108
Implement a "negative bloom filter" that can only give false negatives. It should not use padding and support key lengths of arbitrary sizes (in bits).
>>
File: 1474729549166.jpg (181 KB, 1280x720)
181 KB
181 KB JPG
Could anyone here with experience with the Bloomberg api tell how to make queries and what can I expect about them in terms of structure? My boss just moved me to the financial branch. They want me to help them with time series analysis and they have a Bloomberg terminal, so there's a lot of potential.
But, besides knowing how to """code""" in R, I'm not really tech savvy and I don't have a business/financial background, so I don't really know how to access the data. Is there an easy way to get the info.
I know that there's a R package for that, but I'm scared of fucking something up, so I would really appreciate any advise.
>>
>>62882212
If your C programs aren't nice and clean, you're doing it wrong. Delete your account.
>>
Is there some equivalent of memcpy that's guaranteed to do it from start to finish, or from finish to end? Not memmove, I want it to still work like memcpy.
 src                 dest
v___________________v______________________________________
[f0f0 f0f0 dddd dddd 0000 0000 0000 0000 0000 0000 0000 0000]
n = 16 bytes

result:
___________________________________________________________
[f0f0 f0f0 dddd dddd f0f0 f0f0 dddd dddd f0f0 f0f0 dddd dddd]
>>
>>62882216
will look into this thanks anon
>>
>>62882256
Why would you want that?
>>
>>62882256
It’s not standard, but you can get a BSD licensed version of ‘memset_pattern’.

That does what you want.
>>
neu thread ja?
>>
>>62882314
Set a pattern in memory.
>>62882357
Well, will do that then, was just wondering if there was anything in the standard.
>>
The compiler can't be trusted.
#include <stdio.h>
#include <limits.h>

int max_ternary (int x, int y)
{
return x > y ? x : y;
}

int max_if (int x, int y)
{
if (x > y) {
return x;
}
return y;
}

int max_if_else (int x, int y)
{
if (x > y) {
return x;
} else {
return y;
}
}

int max_if_else_if_else (int x, int y)
{
if (x > y) {
return x;
} else if (x < y) {
return y;
} else {
return y;
}
}

int max_if_else_if_eq (int x, int y)
{
if (x > y) {
return x;
} else if (x < y) {
return y;
} else if (x == y) {
return y;
}
}

1/5
>>
>>62882446

int max_if_else_if_eq_avg (int x, int y)
{
if (x > y) {
return x;
} else if (x < y) {
return y;
} else if (x == y) {
return (x+y)/2;
}
}

int max_if_else_if_eq_avg_shift (int x, int y)
{
if (x > y) {
return x;
} else if (x < y) {
return y;
} else if (x == y) {
return (x+y) >> 1;
}
}

int max_bithack_xor (int x, int y)
{
return (-(x > y) & (x ^ y)) ^ y;
}

int max_bithack_arithmetic (int x, int y)
{
return (-(x > y) & (x - y)) + y;
}

int max_bithack_shift (int x, int y)
{
return x - ((x - y) & ((x - y) >> (sizeof(int) * CHAR_BIT - 1)));
}

int main()
{
srand(time(NULL));
int x = rand();
int y = rand();
printf("%d\n", max_ternary(x, y));
printf("%d\n", max_if(x, y));
printf("%d\n", max_if_else(x, y));
printf("%d\n", max_if_else_if_else(x, y));
printf("%d\n", max_if_else_if_eq(x, y));
printf("%d\n", max_if_else_if_eq_avg(x, y));
printf("%d\n", max_if_else_if_eq_avg_shift(x, y));
printf("%d\n", max_bithack_xor(x, y));
printf("%d\n", max_bithack_arithmetic(x, y));
printf("%d\n", max_bithack_shift(x, y));
return 0;
}

These should all compile to the same thing if the compiler actually optimizes. However:
gcc -O3 max.c -march=native
objdump -d a.out

2/5
>>
>>62882452
0000000000400770 <max_ternary>:
400770: 39 fe cmp %edi,%esi
400772: 89 f8 mov %edi,%eax
400774: 0f 4d c6 cmovge %esi,%eax
400777: c3 retq
400778: 0f 1f 84 00 00 00 00 nopl 0x0(%rax,%rax,1)
40077f: 00

0000000000400780 <max_if>:
400780: 39 f7 cmp %esi,%edi
400782: 89 f0 mov %esi,%eax
400784: 0f 4d c7 cmovge %edi,%eax
400787: c3 retq
400788: 0f 1f 84 00 00 00 00 nopl 0x0(%rax,%rax,1)
40078f: 00

0000000000400790 <max_if_else>:
400790: 39 f7 cmp %esi,%edi
400792: 89 f0 mov %esi,%eax
400794: 0f 4d c7 cmovge %edi,%eax
400797: c3 retq
400798: 0f 1f 84 00 00 00 00 nopl 0x0(%rax,%rax,1)
40079f: 00

00000000004007a0 <max_if_else_if_else>:
4007a0: 39 f7 cmp %esi,%edi
4007a2: 89 f0 mov %esi,%eax
4007a4: 0f 4d c7 cmovge %edi,%eax
4007a7: c3 retq
4007a8: 0f 1f 84 00 00 00 00 nopl 0x0(%rax,%rax,1)
4007af: 00

00000000004007b0 <max_if_else_if_eq>:
4007b0: 39 f7 cmp %esi,%edi
4007b2: 89 f0 mov %esi,%eax
4007b4: 0f 4d c7 cmovge %edi,%eax
4007b7: c3 retq
4007b8: 0f 1f 84 00 00 00 00 nopl 0x0(%rax,%rax,1)
4007bf: 00

As you can see, they don't compile to the exact same thing. And it gets worse:
3/5
>>
>>62882460

00000000004007c0 <max_if_else_if_eq_avg>:
4007c0: 39 f7 cmp %esi,%edi
4007c2: 7f 14 jg 4007d8 <max_if_else_if_eq_avg+0x18>
4007c4: 7c 0a jl 4007d0 <max_if_else_if_eq_avg+0x10>
4007c6: 74 18 je 4007e0 <max_if_else_if_eq_avg+0x20>
4007c8: f3 c3 repz retq
4007ca: 66 0f 1f 44 00 00 nopw 0x0(%rax,%rax,1)
4007d0: 89 f0 mov %esi,%eax
4007d2: c3 retq
4007d3: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
4007d8: 89 f8 mov %edi,%eax
4007da: c3 retq
4007db: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
4007e0: 01 ff add %edi,%edi
4007e2: 89 f8 mov %edi,%eax
4007e4: d1 f8 sar %eax
4007e6: c3 retq
4007e7: 66 0f 1f 84 00 00 00 nopw 0x0(%rax,%rax,1)
4007ee: 00 00

00000000004007f0 <max_if_else_if_eq_avg_shift>:
4007f0: 39 f7 cmp %esi,%edi
4007f2: 7f 14 jg 400808 <max_if_else_if_eq_avg_shift+0x18>
4007f4: 7c 0a jl 400800 <max_if_else_if_eq_avg_shift+0x10>
4007f6: 74 18 je 400810 <max_if_else_if_eq_avg_shift+0x20>
4007f8: f3 c3 repz retq
4007fa: 66 0f 1f 44 00 00 nopw 0x0(%rax,%rax,1)
400800: 89 f0 mov %esi,%eax
400802: c3 retq
400803: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
400808: 89 f8 mov %edi,%eax
40080a: c3 retq
40080b: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
400810: 01 ff add %edi,%edi
400812: 89 f8 mov %edi,%eax
400814: d1 f8 sar %eax
400816: c3 retq
400817: 66 0f 1f 84 00 00 00 nopw 0x0(%rax,%rax,1)
40081e: 00 00

4/5
>>
File: fortran.png (12 KB, 1117x158)
12 KB
12 KB PNG
what the fug man
>>
>>62882465
0000000000400820 <max_bithack_xor>:
400820: 31 c0 xor %eax,%eax
400822: 39 f7 cmp %esi,%edi
400824: 0f 9f c0 setg %al
400827: 31 f7 xor %esi,%edi
400829: f7 d8 neg %eax
40082b: 21 c7 and %eax,%edi
40082d: 89 f8 mov %edi,%eax
40082f: 31 f0 xor %esi,%eax
400831: c3 retq
400832: 66 66 66 66 66 2e 0f data16 data16 data16 data16 nopw %cs:0x0(%rax,%rax,1)
400839: 1f 84 00 00 00 00 00

0000000000400840 <max_bithack_arithmetic>:
400840: 31 c0 xor %eax,%eax
400842: 39 f7 cmp %esi,%edi
400844: 0f 9f c0 setg %al
400847: 29 f7 sub %esi,%edi
400849: f7 d8 neg %eax
40084b: 21 c7 and %eax,%edi
40084d: 8d 04 37 lea (%rdi,%rsi,1),%eax
400850: c3 retq
400851: 66 66 66 66 66 66 2e data16 data16 data16 data16 data16 nopw %cs:0x0(%rax,%rax,1)
400858: 0f 1f 84 00 00 00 00
40085f: 00

0000000000400860 <max_bithack_shift>:
400860: 89 f8 mov %edi,%eax
400862: 29 f0 sub %esi,%eax
400864: 99 cltd
400865: 21 d0 and %edx,%eax
400867: 29 c7 sub %eax,%edi
400869: 89 f8 mov %edi,%eax
40086b: c3 retq
40086c: 0f 1f 40 00 nopl 0x0(%rax)


As you can see, the bithacks all compile differently. Of special note is the 'average' one, it clearly shows the compiler doesn't optimize well based on what it can be absolutely certain of: when a == b,
(a+b)/2 == (a+a)/2 == 2a/2 == a.
>>
>>62882474
ones*
>>
Hello guys, noob here.

I want to convert list which looks as such: list=[4536,8678],[67867,67809],[324456,678769]....] do something that i can draw graph of. Can anybody help me with this? I mean that the values in graph will become x-es and y-s like list=[[x,y],[x1,y1]....]
>>
>>62882474
>it clearly shows the compiler doesn't optimize well based on what it can be absolutely certain of: when a == b,
>(a+b)/2 == (a+a)/2 == 2a/2 == a.
This is wrong, though, and I suspect that all of your other examples are wrong for similar reasons.
>>
>>62882521
This is elementary algebra though, how is it wrong?
a+a (or b+b) is equivalent to a+b when a == b
a+a is equivalent to 2a
2a/2 is equivalent to a
What exactly is wrong here?
>>
FUCK you!
>>
>>62882565
>what is operator precedence
wow go take arithmetic 101 loser
>>
>>62882572
How does operator precedence play a role here?
>>
>>62882585
your not worth my time desu
>>
>>62882565
>what is overflow
Somehow I don't think you're qualified to analyze compiler output.
#include <stdio.h>

int main() {
unsigned char a = 255;
unsigned char b = a + a;

printf("%d %d", b / 2, a);
}
>>
>>62882597
(You)
>>62882609
Signed integer overflow is undefined behavior in C, so the compiler can safely ignore it.
>>
>>62882621
>Signed integer overflow is undefined behavior in C, so the compiler can safely ignore it.
Looks like you're right. My bad.
>>
New thread:
>>62882668
>>62882668
>>62882668
>>
>>62882621
By the way, what happens if you declare x and y to be const? Does it still fail to perform that optimization?
>>
>>62874250
Who is this semen demon?
>>
>>62882931
Josou Demo Aishite
>>
File: 1506424910953.jpg (7 KB, 249x238)
7 KB
7 KB JPG
>>62882931
Don't derail the thread pls




Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

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.