[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: 321
Thread images: 39

File: ayayayayayaya.jpg (42KB, 1280x720px) Image search: [Google]
ayayayayayaya.jpg
42KB, 1280x720px
What are you working on /g/?

Previous thread: >>61409756
>>
File: 1439648511159.jpg (116KB, 469x469px) Image search: [Google]
1439648511159.jpg
116KB, 469x469px
Thank you for posting a cute anime girl.

>What are you working on /g/?
I just finished a skype interview, and they now want to interview me in person.
>>
>>61416021
what kind of job, lad?
>>
>>61416021
all the best!
>>
>>61416030
It's sort of a mixed technical support (Tier 3)/programming job. And this is coming basically straight out of university.

>>61416044
Thanks!
>>
>>61416003
Thanks for anime picture.
>>
File: misaka_mikoto.png (1MB, 850x1195px) Image search: [Google]
misaka_mikoto.png
1MB, 850x1195px
I-Is Mikoto-chan there? ...
..
( ´_ゝ`)
>>
Automate the boring shit with Python

Is this book any good? Sounds like its right up my alley. If i wanna automate some stuff and scrape the web is there a better language than python? Why is Python used for these purposes? Noob here
>>
>>61416321
Use Ruby
>>
Use gbeta
>>
File: わいふ.png (173KB, 600x355px) Image search: [Google]
わいふ.png
173KB, 600x355px
>>61416003
>>
What are the actual laws about embedded fonts in your programs? I keep hearing that copyright laws only apply if you distribute the font alongside your program, but not if it's embedded?
>>
>>61416750
Embedded into your program certainly IS distributing it with you program.
Stop using jew fonts.
>>
>>61416750
Depends on the license afaik. E.g. adobe allows embedding fonts but other's dont:

http://www.adobe.com/products/type/font-licensing/font-embedding-permissions.html
>>
File: crunching.png (547KB, 521x515px) Image search: [Google]
crunching.png
547KB, 521x515px
Don't forget to crunch your code for maximum performance
>>
>>61416908
javascript minification is the modernization of this concept
>>
File: crying_on_bed.jpg (495KB, 1000x903px) Image search: [Google]
crying_on_bed.jpg
495KB, 1000x903px
I-I just w-want to pair program... with m-my friend Mikoto-chan...
...
(ノ﹏ヽ)
...
>>
>>61416964
You have no friends, tripfag.
>>
Was always /dpt/ shit and filled with faggots?
>>
>>61417105
I think you need to learn English.
>>
>>61417105
I blame shitskins like you.
>>
>>61417116
Nah, it's the animefags.
>>
>>61417138
Go home, you mudslime redditor.
>>
>>61417143
Nice projection.
>>
File: 1494683129568.jpg (68KB, 800x500px) Image search: [Google]
1494683129568.jpg
68KB, 800x500px
>tfw learning lua
>>
File: happy.jpg (41KB, 394x353px) Image search: [Google]
happy.jpg
41KB, 394x353px
>>61417475
>tfw learning Ruby
>>
why would an adreno 330 gpu render at a worse quality than an adreno 320? it doesn't even help if i switch from mediump to highp. i'm doing bicubic upsampling and the shader is very straightforward with texture reads, fract, floor, addition, subtraction, multiplication, division, that's it.
>>
>>61417475
check out nim too
>>
File: aya.png (783KB, 1280x720px) Image search: [Google]
aya.png
783KB, 1280x720px
>>61416003
Ayaya?
>>
>>61417475
PAIP is actually a pretty cool book. It's lots of old school AI with Lisp. What's really fun is creating your own version of ELIZA and GPS. Can recommend if you're are interested in the field and its historical context
>>
My DELL XPS 13 9365 arrived today, can't wait to go home from work and try it out. ^^
>>
>>61416003
>>61416021
Anime is for losers, get a life faggots
>>
>>61417521
WE ARE A PART OF THE WILDERNESS
>>
File: 2.jpg (9KB, 300x168px) Image search: [Google]
2.jpg
9KB, 300x168px
>>61416003

python, still basic stuff almost finished 1st book
>>
What naming convention should I use for C++ files?
>>
>>61417577
Whatever you feel like.
.h or .hpp for headers and .cc, .cpp, or .cxx for implementations.
>>
>>61417590
I mean the name before the extension.
>>
>>61417596
If the entirety of the file is one scope (one class, one namespace, maybe even just one function) then you have an easy answer. Otherwise just pick something sensible.
>>
>>61417500
WELL FUCK i mean
>why would an adreno 530 gpu render at a worse quality than an adreno 330?
looks fine on 330, looks shit on 530
>>
File: 1483583276557.jpg (16KB, 190x188px) Image search: [Google]
1483583276557.jpg
16KB, 190x188px
>>61417521
ayaya! ayaya!
>>
File: multigpu_rendering.webm (2MB, 1024x576px) Image search: [Google]
multigpu_rendering.webm
2MB, 1024x576px
I'm working on getting multi-GPU support in my wayland compositor backend.
The red part is from the secondary GPU, and the green part is from the primary GPU.
I have an annoying rendering bug, though. Maybe I'm not handling the double buffering properly.
>>
>>61417751
Is the artifact on the top right the aforementioned bug?
>>
>>61416964

You know that the thing about pair programming is that you both have to be physically present in the same room, right? All of the comfortable anonymity/pseudonymity of the Internet is gone, and you are left with one neckbeard standing over the shoulders of another neckbeard, pointing out whenever they make a mistake.
>>
https://www.youtube.com/watch?v=cbBkAdNc88w
>>
Any idea how to write a program to load balance connection to openvpn server ?
>>
>>61418195
Shit, forgot. In C
>>
>>61418089
Yes. Actually, after changing changing it to render something that isn't static, it realised I'm nowhere near getting this shit right.
Unsurprisingly, sharing resources between GPUs (and separare OpenGL contexts) is hard.
>>
File: ange.png (585KB, 2000x1519px) Image search: [Google]
ange.png
585KB, 2000x1519px
oh god it hurts wtf am i doing hurrrrr

#include <stdbool.h>
#include <stdio.h>

// X = Value, Y = Mutable
#define __let(X, Y) _Generic((X), \
/* Basic */ \
default: _Generic((Y), \
false: void, \
default: const void), \
void *: _Generic((Y), \
false: void *, \
default: const void *), \
char: _Generic((Y), \
false: char, \
default: const char), \
char *: _Generic((Y), \
false: char *, \
default: const char *), \
\
/* Signed */ \
signed char: _Generic((Y), \
false: signed char, \
default: const signed char), \
...
long double _Imaginary *: _Generic((Y), \
false: long double _Imaginary *, \
default: const long double _Imaginary *) \
)

#define _(X, Y) __let(X, Y)

typedef union let
{
void;
char;
short;
int;
long;
float;
double;
} let;

int main(int argc, char **argv)
{
let stupidshit = _((char* )"lol this is so fuckign badf", true);

puts(stupidshit);

stupidshit = "wow the string changed this is l33t h4x";

puts(stupidshit);

let morestupidshit = _((int)69, false);

stupidshit = "ok lets end this abomination of a \"\"\"\"program\"\"\"\"";

puts(stupidshit);

return morestupidshit == 69 ? 0 : 1;
}


https://ghostbin.com/paste/za63q
>>
>>61418309

Just use C++ and do this:
#define let auto
>>
>>61418333
>use C++
REEEEEEE
>>
>>61418333 (checked)
>use C++
excellent choice
>>
>>61418342
that shit in >>61418309 is objectively more disgusting than C++
>>
>>61418333
>use C++
use Rust
>>
>>61418389
dear mozilla stop shilling on boards and go fix firefox
>>
>>61416321
yeah, go for it.
python is nice for doing that sort of stuff.
don't use shitty ruby.
>>
>>61418389
Rust posting seems to have completely stopped desu, i guess most people realized its shit.
>>
File: multigpu.webm (2MB, 1024x576px) Image search: [Google]
multigpu.webm
2MB, 1024x576px
>>61418217
>>61417751
I managed to get it working.
The artifacts from before was an issue with vsync, so it got some pretty fucking terrible tearing.
I got my moving images working correctly by changing the buffer formats.
>>
>>61418384
you should have a look at the beauty in GNU's tgmath.h
that's the delightful way how _Generic was hacked with macro crap before it existed in C11
>>
I'm working on a personal project that create's JSON files to get sent and populated into a database. So far haven't achieved much with it, but I have until September until my summer is over
>>
>>61418309
_Generic is supposed to return expressions, not types.
I don't think that would work.
>>
>>61418104
B-But I just want t-to program with Mikoto-chan.....
W-Where is Mikoto-chan? (つ﹏<。)
>>
>>61418747

Asleep, possibly? I should be getting to sleep soon, myself. It is 5:20 AM here on the West coast. Not a good time to be staying up until, but I'm a night owl during the summer.
>>
>>61418426
the shills might just be on vacation
>>
>>61418807
Pretty long vacation then.
>>
>>61418815
well they're based in the bay area and in other fancy meme areas
>>
In C++11 I know it's possible to take the function pointer of a non-capturing lambda function.
However, is it supposed valid to return the pointer of a lambda which is local to a function, and then invoke it outside?
The example shows the idea and works when I run it, but in real programs I had crashes in similar usages, which makes me think the program may permit itself to allocate the code of the lambda on the program's stack.
Is the code below correct?
#include <stdio.h>

void (*foo())(const char *) {
return [](const char *s) {
puts(s);
};
}

int main() {
void (*fun)(const char *) = foo();
fun("Hello!");
return 0;
}
>>
Please webdev gods

https://apps.getpebble.com/en_US/application/54f972b93dd477b391000017?section=watchfaces&dev_settings

I'm trying to programmatically =, press that "DOWNLOAD PBW" file. I can't get angular to accept my fake clicks, I can't figure out how to get into scope to just call that openexternal() myself, I DEFINITELY can't even find where it generates the link
>>
>>61419166
you are making an app download bot? I know somebody who built one with sikuli and an army of fake accounts
>>
>>61419268
Yeah the bots aren't the problem, it's just scripting downloading the dang things
>>
>>61418309
Literally just don't.
You gain nothing with this.
Simply always specifying the type when you declare a variable is much more elegant.
Especially in C, which has no generics or ADTs, so types never get very complicated.
>>
>>61419162
I can't see why that would be the case. Would it be invalid to return a function pointer to a static member of a class scoped within the function?
void (*get_fptr())()
{
class Lambda
{
void invoke()
{
std::cout << "Lambda has been called";
}
};
return &Lambda::invoke;
}
>>
>>61419278
I don't have the web skill to help you. The method I mentioned bypasses web stuff it is a visual recognition which sends mouse sequences at the os level. It is way slower but works also outside the browser for itunes like programs.
>>
File: 1459374040496.jpg (9KB, 238x192px) Image search: [Google]
1459374040496.jpg
9KB, 238x192px
GHCi, version 7.10.3: http://www.haskell.org/ghc/  :? for help
Prelude> quickSort :: Ord a => [a] -> [a]

<interactive>:2:1: Not in scope: ‘quickSort’
Prelude>

0/10 language tbqfhfam
>>
>>61419166
Tried selenium?
>>
>>61419333
>I can't see why that would be the case
Me neither and I was equally surprised.
My last crash experience was having a member method returning a curl callback. lambda = crash, static function = good
Since it's so bizarre I suspect a compiler bug. From memory I think only gcc produced crashing programs, not clang.
>>
>>61418389
This
>>
Well, 5 years /g/ pretty much made me do it - today I enrolled into a CS degree. Still don't know whether to go for a SE or CE specialisation a year into it, but there will definitely be lots of programming regardless of what I choose.

Really looking forward to actually doing C and *NIX.
>>
>>61419382
"sort" is in Data.List
>>
>>61419537
that's beside the point
the point is that haskell is such a shitlang the repl won't even let you define things
>>
>>61419531
all the best, anon!
>>
Swift, ocaml or D?
>>
>>61419613
>Appleshit, deadshit or completely deadshit
Good question.
>>
>>61419531
I just completed my CE degree. Definitely better than SE as we build real solutions instead of durdling with databases and other junk nobody cares about.
Now I work with making medical robots, making the world a better place.
>>
>>61419624
There's really no better alternative other than C.
>>
File: 1488477805916.png (143KB, 600x600px) Image search: [Google]
1488477805916.png
143KB, 600x600px
0000000000438cc4 <_fini>:
438cc4: 48 83 ec 08 sub $0x8,%rsp
438cc8: 48 83 c4 08 add $0x8,%rsp
438ccc: c3 retq


>>61419624
>OCaml
>dead
lmao /g/toddlers everyone
>>
An innocuous-seeming line actually introduces an arbitrary code execution exploit:
const string& longer = max<string>("a", "b");


C++ fags WILL defend this
>>
>>61419640

I find CE a bit more interesting as well and I've been tinkering with hardware ever since building (not completely on my own, of course) my first PC at 9.

Unfortunately, a lot more money is in SE, it's hard to earn $80k+ as a sysadmin. There are lots of CE-related elective studies even in the SE spec so I'm sure I'll be able to learn both if I want.
>>
>>61419613
D
>>
>>61419613
D
>>
>>61418407
Thanks
>>61416321
Bump
>>
>>61419695
How so
>>
>>61419681
https://www.tiobe.com/tiobe-index/
>ctrl+f ocaml
really makes you think
>>
File: openLoo.png (19KB, 320x245px) Image search: [Google]
openLoo.png
19KB, 320x245px
Poo in the
>>
>>61419695
My innocuous-seeming dick actually introduces an baby execution exploit in ur mom.
>>
>>61419695
I'm guessing it's because of one of the fucking overloads
>>
File: Untitled.png (30KB, 828x107px) Image search: [Google]
Untitled.png
30KB, 828x107px
>>61419730
>>
>>61419743
kek
>>
>>61419730
By being retarded.
>>
>>61419760
>r*ddit
>>
>>61419382
Hasklets BTFO their interpreter can't even fucking declare things
>>
>>61419574
... yes you can define things, you just can't give type sigs that way
>>
>>61419760
fucking hell, what a rubbish language
>>
>>61419382
>>61419825
>>61419838
in fact if you follow that up with a ';', so that you've actually given it a declaration and not an expression, it will say
"lacks accompanying binding"
and to do multiple declarations

a; b;

alternatively
:{
multi line
:}
>>
>>61419574
dont you need "let" to define repl things?
>>
File: 1477501231840.png (168KB, 1149x832px) Image search: [Google]
1477501231840.png
168KB, 1149x832px
>>61419838
In that case, you can't define things in an interpreter the way you can in a file.
Which basically makes it not an interpreter.
So it's even worse than I thought: Haskell has no interpreter.
fucking kek
>>
>>61419859
>need ; in interpreter but not in file
>>61419862
>need "let" in """"""""""interpreter"""""""""" but not in file
kek
>>
>>61419872
What are you talking about you fucking idiot?

It's a REPL

Read Eval Print

You are giving it an expression and not a declaration
Add a semicolon and it will know you're declaring
>>
>>61419896
>It's a REPL
Yeah
It reads input
It """""evaluates""""" it in a language that is NOT FUCKING HASKELL
It prints the result
>>
>>61419743
>Designated shitting streets
>>
>>61419695
char *foo = &'x';

getting a pointer or a reference to a temporary is retarded in any language, get over it
>>
Are you that C++ poster who actually installed Haskell just to learn ADT's?
>>
>>61419917
It reads expressions.
If they're followed with a semicolon, they are declarations.

You can use semicolons in regular haskell too.
>>
>>61419695
literally just
string longer = max<string>("a", "b");
>>
>>61419917
>>61419931
in fact if you give it anything that it knows must be a declaration, unlike the example you gave which was a valid expression, it will treat it as such

case in point:

x = 5
This is how non-brainlets who are at least minimally more intelligent than dumb frogposters like you declare things
>>
>>61419931
The subset of Haskell that consists exclusively of expressions and semicolon-terminated declarations is not Haskell because Haskell does not consist exclusively of expressions and semicolon-terminated declarations
Therefore this is not a Haskell interpreter
>>
>>61419960
What the fuck?
If you give it an expression, it will treat it as an expression
If you give it a declaration, it will treat it as a declaration

If you give it something that could be either an expression or a declaration, it will treat it as an expression
>>
>>61419947
see: >>61419960
>>
>>61419974
Yeah, but if you give a Haskell file something that could be either an expression or a declaration, and it would be appropriate for it to be a declaration, it will treat it as a declaration.
The interpreter visibly works differently from the compiler.
Therefore it is not an interpreter for the same language.
This is really not such a hard concept to grasp.
>>
>>61420003
No, a Haskell file only takes declarations at the top level, with the exception of the TemplateHaskell extension (effectively monadic expressions that return declarations)

The REPL is interactive, and an interpreter, which makes it inherently different from a compiler.

Why would you have a REPL that works EXACTLY like the compiler?
Then you wouldn't use the fucking REPL

The reason you use the REPL is because it is a REPL
Is this your first time using a REPL or something?
>>
File: 1486568410839.jpg (40KB, 405x650px) Image search: [Google]
1486568410839.jpg
40KB, 405x650px
>>61418309
>>
>>61420043
Im almost sure its the ADT frogposter.
>>
>>61420063
I really just wish someone would fucking gut these fucking frogposters, they need to die
>>
>>61420043
>The REPL is interactive, and an interpreter, which makes it inherently different from a compiler.
Sure. And here's the full extent of what those differences should entail:
>provide values of expressions as output
>that's literally it

>Why would you have a REPL that works EXACTLY like the compiler?
>Then you wouldn't use the fucking REPL
The REPL should be able to accept the same input as the compiler.
Otherwise the languages they accept as input are not the same language.

>Is this your first time using a REPL or something?
Scheme and CL REPLs don't have this problem.
>>
>>61420093
If you care that much just filter them as theyre posted and youll see less and less over time since OC has pretty much stopped.
>>
File: 1496810915969.jpg (98KB, 1456x896px) Image search: [Google]
1496810915969.jpg
98KB, 1456x896px
>>61420093
Ain't breaking the rules friendo
>>
>>61420043
(cont from >>61420101)
To add to this, here are other REPLs that don't have this problem:
>Ruby REPL
>JavaScript REPL
>PHP REPL
>Pretty much every other shitlang REPL
Your language is so shit that a shitlang is a better language.
>>
>>61420118
People really don't filter enough.
>>
>>61420123
>2. You will immediately cease and not continue to access the site if you are under the age of 18.
>3. You will not post any of the following outside of /b/: Trolls, flames, racism, off-topic replies, uncalled for catchphrases, macro image replies, indecipherable text (example: "lol u tk him 2da bar|?"), anthropomorphic ("furry") or grotesque ("guro") images, post number GETs ("dubs"), or loli/shota pornography.
>6. The quality of posts is extremely important to this community. Contributors are encouraged to provide high-quality images and informative comments.
>10. No spamming or flooding of any kind. No intentionally evading spam or post filters.
>13. Do not use avatars or attach signatures to your posts.

>>61420139
What problem?
He entered an expression and it evaluated it.
That's not a problem.
He should've entered a declaration.
>>
>REPL
Why do you care? It's not like you actually work in that environment. I hardly ever use it. Most of the time it's faster to just write a short program rather than using the interactive prompt.
>>
>>61420165
>avatars
Anon I'm not for frog posting but let's not undermine the importance of this rule by pretending it's broader than it is.
>>
>>61420165
Not breaking any of those rules.
>He entered an expression and it evaluated it.
>That's not a problem.
It treated it differently than a compiler would have, so yes, it is.
Compiled Haskell and interpreted """Haskell""" are not the same language.
>>
>>61420183
He isn't just one person.
He is an instance (an avatar, if you will) of the frogposting menace.
The frogposting menace is avatarfagging.
>>
>>61420169
>It's not like you actually work in that environment.
I absolutely do. Or, would, rather, if Haskell actually had an interpreter. I'm not interested in programming in whatever language ghci actually interprets.
>Most of the time it's faster to just write a short program rather than using the interactive prompt.
How absurd.
>>
>>61420187
>it treated it differently than a compiler
One, a compiler and an interpeter are completely opposite you fucking retard
Do you really not understand that?

A compiler takes predefined code, compiles it and produces binaries.
An interpreter takes code dynamically and runs it interactively.

They are different.
Two, you gave it an EXPRESSION and not a DECLARATION.
When you load a file, it loads DECLARATIONS.
You can, incidentally, load files in the REPL.
>>
File: Untitled.png (32KB, 983x659px) Image search: [Google]
Untitled.png
32KB, 983x659px
>>61420118
filter this
>>
>>61420204
>absurd
I find it absurd that you'd write programs in an interactive environment. They're such a major inconvenience for anything non-trivial.
>>
>>61420187
>>61420214
Here's the tutorial which you so desperately need
https://downloads.haskell.org/~ghc/7.8.4/docs/html/users_guide/interactive-evaluation.html
>>
>>61420214
>Two, you gave it an EXPRESSION and not a DECLARATION.
First of all this is wrong. In a file, that would have been a declaration.
Secondly:
>When you load a file, it loads DECLARATIONS.
>You cannot even put bare expressions in a file in his shitlang
KEK
>>
File: 1415237806211.jpg (56KB, 500x500px) Image search: [Google]
1415237806211.jpg
56KB, 500x500px
>What are you working on /g/?
A mobile version of an imageboard, based on 4chan but with some tweaks.
>>
>>61420228
Thanks but I don't learn languages that pretend to have interpreters but actually don't. Honesty is important to me.
>>61420226
This is some next level trolling
>>
>>61416003
>not having eidetic memory
>not being an expert in every programming language in existence
>>
>>61420257
>it's trolling
I've never met a serious developer who uses the interactive prompt regularly.
>>
struct Foo
{
Foo(int i):
i(i)
{ };
int i;
};

void fooTaker(Foo f)
{ }

int main()
{
fooTaker(1);
}

why is this allowed
>>
File: .png (98KB, 1131x879px) Image search: [Google]
.png
98KB, 1131x879px
>>61420271
>I've never met a serious developer who uses the interactive prompt regularly.
Please, give me more of the jokes
>>
>>61420254
>normie-chan
sounds awful.
>>
>>61420274
make ctor explicit
>>
>>61420257
>>61420239
Go back to uni and tell them you forgot your fucking semicolon
>>
File: 1496534510363.gif (859KB, 200x200px) Image search: [Google]
1496534510363.gif
859KB, 200x200px
>>61420118
>>61420093
>>
>>61420266
>memory is all that matters
No
>>61420285
He clearly doesn't think you're a serious developer.
>>
>>61420274
In sepples, constructors are pretty much cast operators, except owned by the "to" type instead of by the "from" type
>>
>>61420290
Semicolons should only be used for comments
>>61420293
>He clearly doesn't think you're a serious developer.
Well seriousness IS against my religion so i mean
>>
>>61420295
>>61420289
I know why it works, but who thought this was a good idea?
>>
>>61420271
Sometimes I use it instead of the calculator or if I want to introduce a new function to a program and I want to test it and perfect it before actually writing it in, I don't use it all the time tho.
>>
>>61420322
How is it not?
>>
>>61420322
Nobody. The C++ committee vomits features and then try to make it look good.
>>
Not him but:
>>61420347
Yeah but why is it actually a bad thing?
>>
>>61420340
implicit conversions are evil, especially so as a default
This is why I'm glad void* requires an explicit cast now
>>
>>61420362
Why though?
I use implicit conversions often, they're very convenient
>>
>>61420288
It might be, I'm writing it for private use within my university as they don't have a community based system and alumni are relying on facebook groups.
It will work through an app and I rewrote the backend to be a nice smooth API, so ux and design will be as comfortable as possible.
Also JWT tokens ensure no captchas.
>>
>>61420378
If any implicit action is taken, it should be obvious what it does. Nobody is surprised when a Derived* decays to a Base* and then to a bool, but gaining type information is a different story.
>>
Why do C programmers love so much to alias their opaque pointers to void*? do they like the masochist idea of defeating the little type safety the C language may offer?
/usr/include/gawkapi.h:typedef void *awk_array_t;
/usr/include/gawkapi.h:typedef void *awk_scalar_t;
/usr/include/gawkapi.h:typedef void *awk_value_cookie_t;
/usr/include/gawkapi.h:typedef void *awk_ext_id_t; /* opaque type for extension id */
>>
>>61420608
>cniles
>caring about safety
>or productivity
>or quality of life
>or quality of code
>or [...]
>>
>>61420608
The reason is to actually INTRODUCE type safety, without exposing the underlying type.
Now that these types (although technically all the same type) all have different names, passing one to a function that accepts another is a much harder pitfall to fall into. If you make that mistake, you can only have made it on purpose, and so it's appropriate you should suffer the consequences. Whereas, on the other hand, if we were to scrap the typedef and just use void *, the public interface of the opaque type wouldn't be clear or comprehensible at all, and doing type-unsafe things accidentally would be very easy.
>>
not him but
>>
>>61420777
I'm not sure, it gives you a false sense of security.
>>
What are uwps from tech point of view? Just like binaries for every platform stuffed together apple-style?
>>
>>61420882
It's not a false sense of security. You enforce type consistency this way. Well, as long as the pointers are not cast back to void *.
>>
>>61420777
This is what polymorphism is great for, you use this in Haskell and it's ACTUALLY type safe

It's part of what I'm doing right now

I have different type variables for type and expression variables, so I can't mix them up
>>
>>61420968
By polymorphism I mean parametric polymorphism and universal quantification (e.g. generics)
I don't mean OOP polymorphism
>>
/dpt/ # 1
>I've been here for 10 years and generals are probably one of the better things we've started to have. /dpt/ in particular is one of the best-quality threads on the board at any given time.
>>
>>61421026
The really awful thing is this is true
>>
File: file.png (40KB, 2349x148px) Image search: [Google]
file.png
40KB, 2349x148px
My trading algorithms are pretty conservative.
>>
File: alphatest.png (3KB, 360x118px) Image search: [Google]
alphatest.png
3KB, 360x118px
What's your preferred way to do this?
>>
>>61421115
if(cond1 ||
cond2) {

}
>>
>>61421115
Should probably not have put bugs in the code. Intent was <= bounds obviously.
>>
>>61421115
if (Char.IsLetter(character))
{

}
>>
>>61421115
Like you did but with different formatting:

bool cond1 = ('A' < character) && (character < 'Z');
if (cond1 || cond2) {

}


It's more verbose but if I have to mess with it later it's *maybe* a bit more robust. Not that big of a difference, just preference.
>>
>>61421115
if (isalpha(character))
>>
>>61421172
>Indicates whether a Unicode character is categorized as a Unicode letter.

Good job, your refactor introduced a subtle bug in our database and now we have to spend two weeks manually fixing everything. You are fired.
>>
>>61421172
>Char.IsLetter
What a mistake
>>
>>61421201
Not that guy but if I was working with someone this incompetent I'd probably go through a list of rookie mistakes and find it quite quickly.

Also no doubt I could find his commits and limit my search further.
>>
>>61421222
>Also no doubt I could find his commits and limit my search further.
If you're going to filter on contributor like this it would probably be more efficient to do it categorically and automatically e.g. write a script to reject commits from all black people
>>
>>61421222
>hiring someone that needs to be babysitted so its actual cost is >2x the salary of a junior engineer while being a net loss for the team
>>
>>61421274
>hiring someone that needs to be babysitted
At my company HR makes problems for us. We're not some small company where things actually work.
>>
I'm working on a chan app. IDK if itll be popular, but I have to say programming in Kotlin has been an absolute blast. For some reason Java has always turned me off due to the verbosity of the language. Probably because I'm a dirty python user with no regard for strong types or semicolons
>>
>>61421222
>>61421265
>>61421274
>>61421286
>>61421201
Stop bullying.
>>
>>61421296
Strong types are awesome, especially with type inference. Kotlin got that right, and it has the right idea regarding null too.
>>
>>61421115
In Haskell this is just
import Data.Char

if (isLower c) || (isUpper c)
then ...
else ...
>>
File: 1492898068666.png (37KB, 1127x685px) Image search: [Google]
1492898068666.png
37KB, 1127x685px
>>61421299
i'm not bullying, i'm just envious
i'm an aspie and no one will hire me because i don't have social soft skills[spoiler], at least that's what i'm telling myself[/spoiler]
>>
>>61421299
> >>61421265 (You)
>Stop bullying.
Telling it like it is isn't bullying
>>
>>61421336
PS. Or even
import Data.Char

if isLetter c
then ...
else ...
>>
>>61421321
Yeah, kotlins handling is a lot nicer than Javas, idk much about Jetbrains, but I'm pretty impressed so far
>>
>>61421336
Point was to implement the function. It's a general question about how you format slightly complex conditions that would go in an if statement.
C and C++ both have isupper and islower.
>>
>>61421336
>>61421380
a `elem` (['a'..'z'] ++ ['A'..'Z'])
>>
>>61421385
if isLetter c
then ...
else ...
where isLetter c' = elem c' $ ['A'..'Z'] ++ ['a'..'z']
>>
>>61421336
Wow, using functions instead, I never would have thought of that.
>>
>>61421416
This I approve of.
>>
>>61416956
that just removes whitespace
>>
>>61421026
>one of the best-quality threads
>/dpt/
oh my god
>>
>>61421416
is c' just a variable name?
>>
>>61421455
Kinda. Don't have variables in Haskell, but it's a local binding. Apostrophe is a valid character in names.
>>
>>61421115
Sir i have done the needful and attached the Code below
if (character == 'a' || character == 'b' || character == 'c' || character == 'd' || character == 'e') { //TODO: finish

}
>>
>>61421488
I wanna see if the compilers can collapse this.
>>
>>61421455
It's the parameter
Function application is whitespace, i.e.
f x
= call f with x
function description is similar

f c' = e

f c'
>e
>>
>>61421488
Just waiting for the JavaFactoryMaker version of this...
>>
>>61421502
yeah i'm aware of the basic syntax, i was just wondering if ' was allowed in identifiers or if it had any particular meaning
i misused ``variable'' because i'm an imperative brainlet
>>
Sooo any clojure recomendations??
I really found interesting that I can use it on front-end and also on back-end.
>>
>>61421535
You can have f', f'', f''', whatever. Not very descriptive, but the facility's there.
>>
>>61421536
Clojure is pretty good, really enjoy using it.

http://typedclojure.org/
>>
>>61421535
yeah, you can put ' so long as it isn't the first char
>>
File: .png (5KB, 821x68px) Image search: [Google]
.png
5KB, 821x68px
This confuses me greatly.
>>
>>61421618
I know nothing about C++, but this sounds like a type error. Are you sure 'theString' is a string?
>>
>>61421115
read a style guide jesus christ. could use some whitespace. at first i thought it was some C++ wizardry
>>
>>61421658
It says right there
[first operand] << std::string

I 'solved' it though. Just call c_str() on the string.

This is very ugly and wrong though. I need to figure this out.
>>61421679
>style guide
I actually copied this example because I'm learning. I don't see how this is confusing though, it's just a basic output stream.
>>
Anyone here successfully freelancing off sites like Upwork? What did you do differently to start getting successful contracts?

Is it possible to compete with the third world charging $3/hr?

Semi related: what are some good ideas for portfolio pieces of a full stack developer.
>>
>>61421026
>generals are probably one of the worse things we've started to have. /dpt/ in particular is one of the worst-quality threads on the board at any given time.
FTFY
>>
>>61421618
>>61421710
It's an IDE problem. The code as you have it here would work if you cut out the middleman and forwarded it directly to the compiler.
>>
>>61421710
>I actually copied this example because I'm learning. I don't see how this is confusing though, it's just a basic output stream.
i was replying to >>61421115
>>
Why are there no (good) open-sourced podcast apps for Mac OS X?
>>
>>61421739
What, you mean that my lack of spaces separating symbols and operands confuses you that much?
It's very difficult to understand retarded people anon. You'd have to be more specific.
>>
Fug these threads are retarded. The only guy that actually do interesting stuff is the multi GPU rendering fag
Everything else is just baiting and retarded faggot acting smart
I don't know why I even bother to post and read /dpt/ anymore
>>
>>61421770
I don't post projects here because I don't want to be associated with /dpt/. Which probably makes it a bit of a negative spiral.
>>
>>61421618
Have you perhaps forgotten to #include <string> ?
If not, this guy is right: >>61421738
>>
>>61421768
kill yourself google shill. here, have a (You). i'm sure your self-driving memes will get there some day.
>>
>>61421789
Don't worry, this place is such a black hole of negative garbage-shit that no one who isn't at least as trashy as we are even knows we exist. If you ever land a job interview with someone who saw your project posted on /dpt/, that's not someone you want to work for anyway.
>>
File: compiler output.png (3KB, 926x24px) Image search: [Google]
compiler output.png
3KB, 926x24px
>>61421796
>#include <string>
I have.
>>61421738
I guess that's the problem?
This is MSVC 11. So it's notoriously bad but this seems like a new level.
>cut out the middle man
Why would this help? I'm getting the errors from the compiler output too.
>>
File: l04he.jpg (27KB, 399x385px) Image search: [Google]
l04he.jpg
27KB, 399x385px
>>61421831
>If you ever land a job interview with someone who saw your project posted on /dpt/, that's not someone you want to work for anyway.
>>
>>61421770
everyone on dpt are mostly either college or hobbyists who shill C everyday, everyone who actually has a respectable career go on more decent communities. What did you expect?
>>
Idris.
>>
>>61421902
a lot of tech companies have shills and random employees/executives who go on 4chan
>>
>>61421910
If by more decent community you mean any prog related subreddit then thanks but no. It's just constant shilling of the same languages and pajeet tier """challenges"""
>>
File: raytrace.png (22KB, 1020x997px) Image search: [Google]
raytrace.png
22KB, 1020x997px
>>61416003
Wrote a new and improved ray tracer for my minecraft clone.
void finite_pick_ll(finiteworld * f, float x, float y, float z, float dx, float dy, float dz, int distance, int * output) {
block * b = finite_getblock(f, x, y, z); //Quick test to see if ray is already in a block
if(b->type != AIR) {
output[0] = 1;
output[1] = x;
output[2] = y;
output[3] = z;
return;
}
vec3 const p = { x, y, z };
vec3 const d = { dx, dy, dz};
int cur[3] = { lrint(floor(x)), lrint(floor(y)), lrint(floor(z)) };
int signs[3] = { (dx > 0) ? 1 : -1, (dy > 0) ? 1 : -1, (dz > 0) ? 1 : -1 };
vec3 corner = { x, y, z };
for(int i = 0; i < 3; i++) {
corner[i] = (signs[i] > 0) ? ceil(corner[i]) : floor(corner[i]);
}
vec3 tmp;
float ndotd;
for(int k = 0; k < distance; k++) { //TODO better distance measure
vec3_sub(tmp, corner, p);
float smallest = INFINITY;
int coord;
for(int j = 0; j < 3; j++) { //TODO avoid recomputation
ndotd = d[j];
float t = fabs(tmp[j] / ndotd); //Don't be afraid!
if(t < smallest) {
smallest = t;
coord = j;
}
}
cur[coord] += signs[coord];
corner[coord] += signs[coord];
b = finite_getblock(f, cur[0], cur[1], cur[2]);
if(b->type != AIR) {
output[0] = 1;
output[1] = cur[0];
output[2] = cur[1];
output[3] = cur[2];
return;
}
}
output[0] = 0;
//let n = normal of plane
//let d = direction of player
//let a = position of player
//let b = point on plane
//t = (n dot (b - a)) / (n dot d)
//where intersection i = t * d + a
}

The old brainlet version used iterative Euler integration and did a lookup at each step. It was simpler and the math was faster, but having to do lookups 50x more murdered performance.
>>
so I want my program to 1.) have a simple terminal user interface where the user inputs stuff from the keyboard and 2.) figure out how soon something from a database is and wait until that time, and print a reminder.

Is there a less retarded way to do that than spinning up a second thread for waiting and restarting it whenever the user changes something?
>>
>>61421933
>executives
Some, but they're not many
>>
>>61421933
Yes, and they a shit. Specifically for that reason if nothing else.
Your point being?
>>
>>61421940
If you don't want to use 2 threads, you can use coroutines, or just add an input check in your main loop.
>>
>>61421928
genericVariable : a
>>
>>61421910
>everyone who actually has a respectable career go on more decent communities
most people don't sperg off in online communities, they actually do work and at home they either do more work or do more reasonable activities than to go on fucking reddit or hackernews
>>
>>61421928
Can you explain why I should use Idris over Haskell, like I'm five years old?
>>
>>61421940
would select work for your application?

// pseudocode
remaining = get_wait_from_db()
for(;;) {
if(remaining <= 0) {
remaining = get_wait_from_db()
}
t = now()
command = select(stdin, timeout = wait_time)
remaining -= (now() - wait_time)
}
>>
>>61422011
A few reasons:
1) Dependent types.
2) Types are data. This eliminates the need for Haskell's "forall" by allowing you to implement generics as meta-constructors, e.g.
sort: (t: Type) -> List t -> List t
. Of course you could just omit the
(t: Type)
and have
sort: List t -> List t
, which is like an implicit forall, but there are other more sophisticated uses for first class types; for example, I'm sure if you try hard enough you can think of some crazy use case for a list of types, or a binary tree of types.
A few reasons NOT to use Idris:
1) Poor support compared to Haskell.
2) Poor performance compared to Haskell.
3) Still a pretty new language.
>>
>>61422092
whoops

remaining -= (now() - t)
>>
>>61422189
Hi!
You first!
>>
>>61422092
uh... I guess? I'll look into it. thanks anyway anon
>>
>>61422185
Quit spreading misinformation. Haskell has implicit forall as well, and Idris does have explicit forall, which you're implying it doesn't.
The rest of what you said is true though.
>>
>>61416058
Sounds good, congratulations.
>>
>>61418309
What the fuck is wrong with you?
>>
Is it just me or is Visual Studio Code surprisingly legit?
>>
>>61422404
It is surprising MS did something moderately OK.
>>
>>61422404
the autocompletion from other files and the plugins pleasantly surprised me, i think microsoft is trying to make up for the past or something
>>
>>61422404
not as legit as eclipse
>>
>>61422404
https://www.theregister.co.uk/2017/03/23/cursor_devours_cpu_cycles_ms_code_editor/
>>
echo 1...1; //10.1
php is fun
>>
>>61422593
Let's talk about how awful PHP is.
>>
>>61422593
>>61422613
it's such a fucking dead horse at this point.
>>
>>61422593
>>61422613
>>61422715
It an smelly meme lang with maximum meme.
>>
>>61421066
You do better in the long-run than 95% of all banks
>>
File: 2017-07-17-192446_834x1037_scrot.png (491KB, 834x1037px) Image search: [Google]
2017-07-17-192446_834x1037_scrot.png
491KB, 834x1037px
>unique login/signup adress for every page
is this normal for php?
>>
>>61422404
say what you want about microsoft but their dev tools dept has always been sorta solid
>>
>>61423243
>dev tools dept has always been sorta solid
No. Not at all. People just ignore when they blunder because that's the norm.
>>
>>61423230
I don't see the problem here.
>>
/dpt/ is there a name for a data structure that's like a graph except the adjacencies are associative? so say you're at a vertex, then every edge you can follow has an associated key. the same edge might not have the same key in both directions
>>
>>61423292
pretty sure that's called a filesystem
>>
>>61423292
Im not sure what you mean but check out directed graphs
>>
>>61423292
I'm actually kind of interested in this.
>>
>>61423292
bumping for interest
>>
File: 1123334.png (12KB, 670x445px) Image search: [Google]
1123334.png
12KB, 670x445px
>>61423292
Do you mean like this?
>>
File: 1495760710338.jpg (268KB, 1024x768px) Image search: [Google]
1495760710338.jpg
268KB, 1024x768px
>>61423416
>>
>>61423476
Dude don't respond to him, the guy is posting it in literally every thread with an anime OP.
Not only that but he removed a previous time he posted it and posted it again just to be more noticeable, he's attention whoring like crazy.
>>
>>61423292
Either just a tree, or you're getting at a state machine >>61423474
>>
>>61423474
Yeah, like that, except if you could also use strings instead of numbers.
>>
>>61423539
>or you're getting at a state machine
fuck never realized this
yes I need a nondeterministic state machine
>>
What language to use with C?
Should be embeddable
Should have trivial interface to C, most languages have way too verbose C interface
Should work at least on x86, x64 and arm
should be statically typed
>>
>>61423855
C++
>>
>>61423855
more C
>>
>>61423855
More C
>>
>>61423855
Nim?
>>
>>61423855
Have you tried using C?
>>
>>61423873
Yeah I would rather just use C
>>61423896
Looks interesting but I don't like the python-like syntax
>>
>>61423921
>I don't like the python-like syntax
Me neither.
>>
>Idris
>name chosen based on Idris the dragon from Brit jugs
kids show ivor the engine
Hasklets btfo
how THE fuck would you feel if your favorite language you shill 24/7 was called Thomas
not after any great computer scientist or mathematician of old
but after Thomas the fucking tank engine
>>
File: 1385329458244.jpg (76KB, 953x953px) Image search: [Google]
1385329458244.jpg
76KB, 953x953px
Is embedded programming classes worth their salt in uni?
>>
>>61423855
I heard C works pretty well.
>>
how to compute quantity of meme
>>
>>61423948
The one I took was nice
Just make sure it's not arduino shit
>>
>>61423942
fuck off, Idris was an awesome dragon
>>
>>61423942
how does this btfo hasklets
>>
>>61423855
Check out call-cc.org
>>
>muh research language
>>
teach me how to use pointers
>>
>>61424047
what do you need to know senpai
>>
I dunno what to make :(
>>
>>61424047
take your working program, sprinkle it with *'s then add &'s until it compiles again
>>
>>61424047
Just dereference them
>>
>>61423976
>>61423948

Some of the books in the course are these

>RTL Hardware Design Using VHDL: Coding for Efficiency, Portability, and Scalability
>Computer Arithmetic Algorithms
>Structured Parallel Computing
>Heterogeneous Computing with OpenCL
>Computer Architecture: A Quantitative Approach

Seem pretty old stuff desu. Does anyone know em?
>>
>>61424085
Seems like a decent class
Go for it anon
>>
>>61424085
It was an interesting class, but I never used any of it IRL.

Nor would I want to.
>>
>>61424057
Some ideas:
> create a software which takes whatever is in your fridge and shows your recipes only using these items
> sudoko solver
> crawl pictures on /g/ and find out which pics get the most (you)s
> crawl posts on /g/ and try to deanonymize people
>>
Any good text editor for a newbie? I want the process of writing code to be a bit more comfy. I have been using nano the whole time, but I get lazy to write code because I need to keep track of a lot of things.
>>
>>61424248
vi > nano, straight up
what features do you want?
>>
>>61424269
I want auto indenting, auto curly braces, etc. Just QOL things, so I just need to worry about the syntax, and logic of the code, instead of worrying if I am missing a curly brace.
>>
What are references used for?
>>
>>61424339
pointers
>>
>>61424339
A reference is a pointer that cannot be null
>>
>>61424339
In which language?
>>
>>61424372
int &x = *(int*) nullptr;
>>
>>61424337
S U B L I M E
U
B
L
I
M
E
>>
File: 1500255322472.gif (3MB, 100x108px) Image search: [Google]
1500255322472.gif
3MB, 100x108px
>>61424339
they are useful to get a job
>>
>>61424378
C++

>>61424353
>>61424372
I know they're used with pointers but what would be a practical application.
>>
>>61424408
>dereferencing null pointer
>>
>>61424453
https://www.youtube.com/watch?v=bLHL75H_VEM
>>
why is bash so gross? i=1 is valid but i = 1 isn't? what the hell?
>>
>>61424418
M E M E
E
M
E
>>
New thread:
>>61424474
>>61424474
>>61424474
>>
muzzy shill in 321...
>>
>>61424471
NOT AN ARGUMENT
O
T

A
N

A
R
G
U
M
E
N
T
>>
>>61424438

They're pointers which are automatically dereferenced. Conventionally, they do not point to null (you can force a reference to null but this is undefined behavior according to the standard).
Use them in the same places you would use a pointer, but where you do not need arithmetic and where you do not need null.
>>
>>61424483
You sound triggered.
>>
>>61424438
Instead of copying a large data structure (especially one that may be nested or self-referential), you can pass a reference to the object, which is just an address.
>>
>>61424479
lolno

>>61425574
>>61425574
>>61425574
>>
>>61425646
fail
Thread posts: 321
Thread images: 39


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