[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: 327
Thread images: 28

File: 1444227862280.jpg (479KB, 2500x1000px) Image search: [Google]
1444227862280.jpg
479KB, 2500x1000px
men who know more about this shit than you do edition

previous thread >>51512898

what are you working on /g/?
>>
A language based on type theory with dependent and linear types which supports manual memory management and FFI.
>>
>>51518099
D is better
>>
what are your other hobbys, /dpt/
>>
File: FB_IMG_1447534981747.jpg (51KB, 720x720px) Image search: [Google]
FB_IMG_1447534981747.jpg
51KB, 720x720px
>>
Got the first phase of my C++ based book and dictionary scraper/parser working for my NLP project.

Now I'm going to start working on the Object Role Modeling (the other ORM) mapping system to help with tagging and analysis.
>>
>>51518113
Amen anon.
>>
>>51518047
Any thoughts on the direction of Rust?

It is very nearly "perfect" as far as major decisions, in my opinion. I've been following / contributing occasionally since 0.8, and I've been really impressed with the team's use of open discussion around design decisions; I don't think there have been many major missteps so far.

I'm hoping more attention will be spent on extending the type system in the near future, with respect to higher kinded types + linear types in particular. Did you read the Session Types in Rust paper? Very cool stuff.
>>
>>51518099
Interesting anon. Keep us up to date you're progress yea?
>>
>>51518112
Animu
>>
>>51518112
Programming isn't a hobby, /g/ is though.
>>
>>51518112
>anime
>some casual gaming
>tried to think of other things but couldnt come up with any
>>
>>51518151
I think that it's missed the mark as far as types go. It's not really that powerful, and waters down the idea of linearity much like C++ does, yet has an overly complicated implementation of borrowing and lifetime annotations that's absolutely horrible to use, syntax-wise. And it makes no attempt to control side-effects.

I've found that the farther down the rabbit hole of type theory you go, the language becomes safer, more expressive, and simpler in terms of both reading the code, writing the code, and implementing the compiler.

That's why I'm making >>51518099.
>>
>>51518112
football
>>
for some reason >>51517224 works with the previous thread but not this one (after switching thread numbers)
>>
>>51518112
motormuhcycles, books, vidgit games
>>
>>51518233
That's because I expressly created it to keep that picture out anon. Do you have a better one maybe?
>>
I like it how Python does not need a semicolon ';'
>>
>>51518256
I like how other C-derivatives basically don't give a shit about white-space ' '.
>>
>>51518222
If there's really a more clear syntax for a more powerful type system, I'd be completely on board, and would love to help.

Can you give me the pitch and a snippet?
>>
any volafile links
>>
>>51518297
>>>/b/
>>
http://www.learnpython.org
>>
>>51518273
I should probably make a copypasta like the Valutron guy.

Anyways, it's just combining dependent and linear types, which lets you do a lot of really nice static verification (like, of everything, as far as I've explored). I got the idea from reading about linear pointer capabilities, which are kind of like a formalization of Rust's lifetimes and borrowing.

Using dependent types, you constrain these capabilities to be associated with a single pointer, and you give them a reference count in the type as well (which will typically be erased at compile time, unless you're implementing something like shared_ptr). By making the process of borrowing explicit, you can express, using a rather simple type system, rules that forbid things like accessing a pointer after it's been deleted or writing to the same place in memory at the same time on multiple threads.
-- -> is the dependent function (pi) type
-- & is the dependent pair (sigma) type

-- allocate and free a unique pointer
new : (a : Set) -> (ptr : Ptr a) & Cap ptr 0
delete : (ptr : Ptr a) -> Cap ptr 0 -> ()

-- explicit borrowing, enforced since a capability can and must only be used once
fork : (ptr : Ptr a) -> Cap ptr n -> Cap ptr (succ n) & Cap ptr (succ n)
join : (ptr : Ptr a) -> Cap ptr (succ n) -> Cap ptr (succ n) -> Cap ptr n

-- can only write to a unique pointer
read : (ptr : Ptr a) -> Cap ptr n -> a & Cap ptr n
write : a -> (ptr : Ptr a) -> Cap ptr 0 -> Cap ptr 0


Anyways, that's just one example, and it shows that a good chunk of Rust's seemingly complex borrowing system is easily encoded in a more expressive yet simpler type system. The caveat is, of course, that you have to explicitly borrow and delete things, but the compiler is nice and will tell you if you forget.
>>
>>51518273
>>51518409
Oh, and two other things. When you're dealing with capabilities, they're just values. No extra syntax layers to deal with. And, except when doing things like reference counting or sharing resources with mutexes, all traces of the capabilities are removed during compilation and you're left with what is basically a valid C program.

The one area that I really need to look into is how to use this system with lock-free concurrency (i.e. atomics), though I don't foresee that being too much trouble.
>>
>>51518113
Translation:
>Dear Lord, protect the UPS truck carrying the TV I bought on Amazon
>>
>tfw I really want to do mixfix in my language but it looks like a fucking pain to parse
>>
>>51518473
I'd look into Pratt parsing. I haven't tried to implement it yet but it seems like it would work with mixfix just fine. It's always shown using a total ordering of operators like in Haskell, too, but from what I can tell, it should work with a partial order like Agda as well.

I'd also stick it in a separate stage from parsing into an AST. What I found worked well was to first parse your code into something like S-expressions (this is where mixfix parsing would go), and then turn that into your AST.
>>
File: Capture-Dunamis-3.png (59KB, 1345x660px) Image search: [Google]
Capture-Dunamis-3.png
59KB, 1345x660px
This is what I am working on.
>>
>>51518445
>>51518409
Very cool, and surprisingly easy to understand the syntax. I don't exactly see how this relieves the syntactic burden of Rust, though. You annotate "read" and "write" in essentially an identical way as you would in Rust.

I'm impressed how well "borrow checking" is modeled by "compile time reference counting" as a special case of dependent types + capabilities. Seems quite powerful, though I don't fully understand how the checks are moved to compile time. Does the compiler just have an integrated prover that works in common cases of dependent types, like this? I like the idea that the compiler will only add overhead for constraints it can't prove at compile time, and will notify me in those cases. Seems like you'd be able to extend it with a very broad range of things it could prove at compile time, especially if you also formalize tracking of side-effects in your language (necessarily so, I guess).

I'm not an expert in type-systems, but this seems like a very cool project. Do you have a link to anything, or just posts in /g/?
>>
>>51518504
I'm thinking that rather than going those route it might be better to just go ahead and do a macro system, as that can implement the same functionality plus more (although it's much harder to keep this type-safe). Anyways, thinks for the tips. I'll try to play around with that and might go with it if I'm happy with how it works.
>>
Polished up some js for my kanban board that parses and manipulates todo list text files.

Confident it's stable enough to graduate beyond testing and become integrated with my main todo lists.

Looking to follow it up with some routine task allocation each day / week / month / etc.

>>51518533
Hello fellow /biz/nessman. Do you have a project site? I might be interested in making use of that someday.
>>
File: security.png (26KB, 448x274px) Image search: [Google]
security.png
26KB, 448x274px
Are you as good as you think you are /g/? What about you're mom?
>>
>>51518533
>>>/g/wdg/
>>
>>51519025
implying i know my 512 characters key by heart.
>>
File: PFvE9ye.webm (2MB, 718x404px) Image search: [Google]
PFvE9ye.webm
2MB, 718x404px
Ask your beloved programming literate anything.
>>
>>51519195
jesus christ anon my boss just walked in and saw this..i just got promoted
>>
>>51519195
(^.^)
>>
>>51519195
Why the hell haven't you killed yourself yet?
>>
>>51519290
why would i ?
>>
>>51518112
Music production, which ties into my programming a lot. I've been writing my own synthesizers for two years
>>
what compiler for Python
>>
>>51518151
> It is very nearly "perfect" as far as major decisions, in my opinion.
I've written it off as worthless due to the lack of exceptions and (consequent) abdication of responsibility regarding integer overflow.

You can either compile in debug mode and have it abort the program on overflow, compile in release mode and have it silently ignore overflow, or use the checked_* functions with explicit result checks (meaning that "a+b*c" becomes half a dozen lines of code).

None of those three options are remotely acceptable and the Rust developers should just commit seppuku, in my opinion.

If you're going to design a "safer C++", you should at least attempt to fix its most significant flaw. At least C++ lets you define your own integer class which throws on overflow; Rust can't even manage that.
>>
In python, is it possible to create a new text file and write to it within an existing zipfile or do I need to create the file, add it to the zip, and then delete the file?
>>
>>51518085
Concurrency Assignments in Java. Fun as fuck.

The one question I am working on is about a mafia boss that can't leave the hotel without a certain amount of bodyguards, and you have to solve using a Semaphore and then a solution with Monitors.

Pretty cool class.
>>
>>51518533
WebShit != Real Programming
>>
>>51519342
Do you do anything with Pure Data or Supercollider?
>>
File: Screenshot 2015-11-25 12.08.16.png (60KB, 383x523px) Image search: [Google]
Screenshot 2015-11-25 12.08.16.png
60KB, 383x523px
This is a cool article on what has worked in Computer Science and what hasn't

http://danluu.com/butler-lampson-1999/
>>
>>51520373
>java
>fun
>>
>>51520398
fun is subjective anon.
>>
>>51520404
i'm a minimal normative realist

everyone thinks java bad (including you)
therefore it is bad
>>
I wanna get into ios development. Should I go straight for swift or should I learn Objective-c?
>>
>>51520423
You should go straight for a noose
>>
Anyone wants to make a game and then sell it on www.itch.io ?
>>
talk on volafile /r/ n5FQop
>>
How do you average two ints in C, /dpt/?
>>
>>51520519
don't bait
>>
>>51520519
int average (int a, int b, int(*avg_fn)(int, int))
{ return avg_fn(a,b); }
>>
>>51520538
And how do you implement avg_fn?

>>51520531
Not baiting, just need a big dick C playa to answer.
>>
>>51520519
int average (int a, int b)
{ return (a > b ? a : b); }
//approximate
//more accurate as abs(a-b) increases
>>
>>51520548
>average = max
okay
>>
>>51520548
>negatives
fml
>>
Working on a small Dynamic Recompiler for fun.
I'm looking at this "tutorial"
http://www.multigesture.net/wp-content/uploads/mirror/zenogais/Dynamic%20Recompiler.html

However, attempting to execute my code block results in an illegal operation exception.
Trying just an array with a ret (0xC3) seems to work, but adding any other instructions causes a segfault...

I've got no idea what the fuck is going on at all, it looks like the fuck up is occurring during the function pointer creation, which looks like this...

    if(blockptr > 0)
{
void (*BlockFunction)() = (void(*)())█
BlockFunction();
}
}


Anybody got any ideas??
>>
>>51520553
it approximates the geometric mean for large values of abs(a-b)
>>
>>51520565
>geometric mean (N-th root of the product) = max
>>
>>51520585
it
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>approximates
the geometric mean
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>for large values of abs(a-b)
>>
>>51520559
>However, attempting to execute my code block results in an illegal operation exception.

https://en.wikipedia.org/wiki/NX_bit

tl;dr You can't run random sections of data
>>
>>51520598
how do JIT
>>
>>51520595
>approximates
Okay

int average(int a, int b)
{
return 0; // approximates the arithmetic mean of (INT_MAX + INT_MIN) / 2
}
>>
>>51520609
Make sure your byte code is loaded into a section of memory that can be executed.
>>
>>51520615
that's shit
yours is shit
>>
File: 1434138902151.jpg (288KB, 709x709px) Image search: [Google]
1434138902151.jpg
288KB, 709x709px
>>51520559.
allocate memory with mmap and the flag PROT_EXEC

https://en.wikipedia.org/wiki/Mmap
http://linux.about.com/library/cmd/blcmdl2_mmap.htm
>>
>>51520615
also meant to say for low values of abs(a-b)
>>
>>51520598
>>51520609
Yeah, how would a JIT work then? This is apparently how most Recompilers do it. Sorry this is all a bit new to me and I don't really know what the fuck I'm doing.
>>
>>51520634
>when I shitpost, it's funny
>when others do it, it's not
okay
>>
>>51520649
yours doesn't approximate the arithmetic mean of (INT_MAX + INT_MIN) / 2

mine does approximate the geometric mean for low values of abs(a-b)
>>
>>51520630
How do I move it into an executable section??
>>
arithmetic mean edition

int average(int a, int b)
{
return (a > b ? a : b) / 2;
// approximate
// more accurate as abs(a-b) increases
}
>>
>>51520655
>yours doesn't approximate the arithmetic mean of (INT_MAX + INT_MIN) / 2
Yes, it does. In fact, it approximates all values where b = -a

>mine does approximate the geometric mean for low values of abs(a-b)
lol, ok kid
>>
>>51520660
see >>51520639
>>
>>51520678
I'm on Windows and not near my Linux machine atm.

Am I fucked?
>>
>>51520675
-0.5

>returning a truncated answer
>>
>>51520660
I don't know a lot about the subject, but at least make sure it's not on the stack (because then it's almost guaranteed to not be executable due to buffer overflow protection).
>>
>>51520687
>int a, int b
>passing -0.5
Did you read the question?

>How do you average two ints in C, /dpt/?
>two ints
>ints
>>
>>51520688
>>51520639
>>51520598
Okay thanks guys, I'm looking into it.
It completely slipped my mind that the OS wouldn't let me just run random as fuck code hahaha.
>>
>>51518112
Art is my passion, programming is a job and a thing I can do the whole day.
I also like to travel, mainly to places with art museums.

I'm still looking for a way to combine them
>>
>>51520705
yeah
you should return 1 and inform them to shift right
>>
File: 6489.jpg (497KB, 2560x1440px) Image search: [Google]
6489.jpg
497KB, 2560x1440px
>>51520683
>I'm on Windows
then
https://msdn.microsoft.com/en-us/library/windows/desktop/aa366887%28v=vs.85%29.aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/aa366898%28v=vs.85%29.aspx

"To execute dynamically generated code, use VirtualAlloc to allocate memory and the VirtualProtect function to grant PAGE_EXECUTE access."
>>
>>51520668
>more accurate as abs(a-b) increases
It doesn't handle negative numbers
>>
>>51520721
>averaging negative and positive integers
fucking third worlders
>>
>>51520741
It still doesn't work if you're averaging two negative numbers, shit for brains.
>>
>>51520746
>averaging negative numbers
fucking commies
>>
>>51520751
alright here's your fucking gender equality version

int geometric(int a, int b)
{ return (abs(a)>abs(b)?a:b); }
//approximate

int arithmetic(int a, int b)
{ return (abs(a)>abs(b)?a:b)/2; }
//approximate
>>
>>51520763
accuracy of both relates to abs(abs(a)-abs(b))
>>
>>51520763
>How do you average two ints in C, /dpt/?

not

>How do you approximate the average of two ints in C, /dpt/?
>>
>>51520784
god you're so entitled
>>
>>51520794
Indeed

Check my white-male CIS privileges. Check 'em.
>>
>>51518112

Guns, cars, and black women.


Also, unrelated, somebody last night said using libraries was for codemonkeys. Whoever you were (and you know who you are), I sincerely hope you were joking. I also sincerely hope you avoid the stdlib of your lang of choice, lest you be labelled a code monkey.
>>
int average(int a, int b)
{
return 5; // guaranteed to be the average for some values of a, b
}
>>
>>51520806
int average(int a, int b)
{
return a; // all integers are equal
}
>>
>>51520821
>Guns, cars, and black women.
How American
>>
>>51520830
You acist scum. Take your b-phobia elsewhere.
>>
File: cat_contemplating_suicide.jpg (53KB, 495x490px) Image search: [Google]
cat_contemplating_suicide.jpg
53KB, 495x490px
>>51520833

It feels like freedom, anon.

>tfw no negressfu who likes guns and cars
>>
Anyone writing anything in nim?
>>
File: GQTvZJ4.png (11KB, 678x665px) Image search: [Google]
GQTvZJ4.png
11KB, 678x665px
Anyone here knowledgeable in R-Code?

I've this code and the Q-Q Plot is pic related which doesn't look right, did I fuck something up?

set.seed(13144278)
simreps = 1000
xbar = rep(0, simreps)
for(i in 1:simreps){
xbar[i] = mean(rbinom(n=50, size=1, prob=0.5))
}
hist(xbar)
qqnorm(xbar);qqline(xbar)
>>
>>51520874
In this thread, or just in general?
[spoiler]the answer is no[/code]
>>
>>51518112
Judo and violin. Others as well but they are pretty casual.
>>
>>51518112
programming is both work and hobby
other than that, i play vidya, violin and piano
>>
File: 1447921043042.jpg (7KB, 180x210px) Image search: [Google]
1447921043042.jpg
7KB, 180x210px
>>51520395
>fancy type systems
>no
what
>>
>>51518112
Beer and cocaine.
>>
>>51520821
overuse of libraries is for code monkeys. many libraries don't provide enough value to justify their drawbacks to a competent programmer.
>>
>>51521127
Those are not hobbies, they are necessities.
>>
>>51521157
>implying I have time to reinvent the wheel every time I need one...
>>
>>51521213
I like the cut of your jib, son.
>>
Any easy lexicon word analysis libraries in C# or Python?

Trying to jam a cockload of text into something and have it spit back out like top 40 keywords.
>>
>>51518409
How about the memory model, anon?
>>
>>51521223
>needing wheels
still fizzbuzz level, m8?
>>
File: 1352147751100.jpg (37KB, 312x700px) Image search: [Google]
1352147751100.jpg
37KB, 312x700px
Should I make a paint program with SDL or should I learn OpenGL?
I really don't feel like learning OpenGL
>>
>>51521401
SDL. Isn't that backed by OpenGL anyways?
>>
void kek (int& num){
num -= 10
}

int main(){
int num = 100;
thread top(kek, num);
kek.join();
//print num
}


Why my number doesn't change?
>>
>>51521401
SDL is simpler and what you need unless you go into 3d, in this case start here
https://www.libsdl.org/release/SDL-1.2.15/docs/html/guidevideoopengl.html
>>
>>51520021
python usually works
>>
>>51521223
>have time
>it takes more time for him to write a couple of fizzbuzz-tier functions than to find a library, read its documentation and integrate it into his project
>>
File: 1383446757988.jpg (278KB, 800x600px) Image search: [Google]
1383446757988.jpg
278KB, 800x600px
I wrote a little program that recursively travels down from some starting directory and does some operations on certain kinds of files it encounters (mostly it breaks .json files up into several smaller .json files).

The problem is that there are over a terabyte of these files and I estimate that it will take like a month of running my program to actually do all this shit over all of the files.

Any recommendations? I'm guessing using lots of threads isn't going to do shit as the cost is probably mostly memory access operations here.

I've never worked with anywhere near this amount of data before.
>>
File: C.png (136KB, 2000x2126px) Image search: [Google]
C.png
136KB, 2000x2126px
>>
>>51521610
if you are using C for anything other than kernel development or embedded systems, you need to kill yourself.
>>
>>51521609
How long does it take to process a single file? How many files are there?
>>
>>51521609
problem description here is pretty unknown, but you might check out https://stedolan.github.io/jq/

json parser in C, very good for aggregating, filtering, transforming json data.
>>
>>51521609
Post profiler results
>>
>>51521609
The drive is the limiting factor, not threads. Breaking it apart on several machines is a reasonable approach. If you're code is in something fast it shouldn't take long. I regularly work with ~250MB of JSON data and parse it in roughly two seconds on an old Core-2 box w/ a slow IDE drive.

Should take you around an hour to process you're's on decent box anon?
>>
>>51521681
Although with 250MB data you can just keep the whole thing in your memory, here we have to pull files in and throw them out, repeat, and the files are probably of a nice size.
>>
>>51521681
>you're code
>you're
REEEEEEEEEEEEEE
>>
>>51521157
>>51521378
>>51521580
I'm sure your bosses are really happy with you and your code...
do you even document it?
>>
>>51521820
>your bosses
>implying
wagecuk codemonkey detected
>>
>>51521843
welfarecuk detected

or you live off of your parents
>>
>>51521843
so, you don't even have a grasp in reality and are criticizing other people for not reinventing the wheel

ok, m8
>>
File: 1445511667448.gif (1MB, 320x180px) Image search: [Google]
1445511667448.gif
1MB, 320x180px
>>51521490
you arent starting the thread?
>>
>>51521490
Why would pass references where you can just use pointers? :^)
>>
>>51521490
Use std::ref(num) when passing a reference to an indirect function call.
>>
>>51521490
>>51522066
See http://en.cppreference.com/w/cpp/utility/functional/ref. This site is super duper useful because it is completely exhaustive. It doesn't tutorial tho, but I assume you've got one for the language basics and you can understand the more endgame stuff with the docs. Also, always compile with ALL warnings and EXTRA warnings enabled if you're learning.
>>
>>51518222
I disagree. It too often results in overengineered and overabstracted code, which is harder to read.
Especially languages like Haskell encourage you to abstract a lot. Multiple programmers then work with different abstractions and most only know a subset of those.
This essentially results in code that is more fun to write (because it satisfies one's autistic ego to avoid all duplication) but at the same time harder to read.
I feel that some languages get this right by preventing you from abstracting too much, while other languages, like Java, prevent you from abstracting and programmers still overabstract stuff, just with shitty abstractions instead.
I am not sure if I like Go, but it's atleast nice that the designers of Go are making the idea of simplicity over abstraction more popular.
This might result in people getting better at finding the sweet spot regarding abstraction.
>>
>python
            ImageGrab.grab().crop(box).save(ip_address+"_N_"+name+"_I_"+intr+".PNG", "PNG")

How do I get this to create a directory for the ip_address?
Google returns tons of super specific stuff,
I want it to create a folder in the current directory :<
>>
>>51521618
If you are not using C, C++ or Rust for anything that needs to perform well, kill yourself desu.
>>
>>51514323
Surely what she said is hella moronic right????
>>
Does an actually good all-around Java book exist?
A tried the beginner's guide from schiidt, but it is the exact opposite of thorough.
>>
>>51521490
top.join();?
>>
>>51515666
people like you are why google chrome grinds to a halt within a couple of weeks.

kill yourself.
>>
File: lawrence strike.jpg (84KB, 550x955px) Image search: [Google]
lawrence strike.jpg
84KB, 550x955px
>OO "programming"
>>
>>51522342
>literally retarded
>>
Eradicating std::wstring and wchar_t from a project of mine. It's all UTF-8 now. Except in a few places where I must deal with the Windows API and it unfortunately only accepts UCS-2. Plus one place where a string must be edited, it's UCS-2 too because UTF-8 splicing and access by index is ugly. But otherwise it's almost all gone now. Few lines of preprocessor magic makes sure it all compiles in Linux too, but the Linux code is pure UTF-8, not tainted by inferior encodings.

Feels good.
>>
>>51522342
>not appreciating the value of all widely used paradigms
multi paradigm materrace
>>
>>51522237
Looking at the Image.save documentation at http://pillow.readthedocs.org/en/3.0.x/reference/Image.html#the-image-class, it says:
You can use a file object instead of a filename. 

So how about using python to create the subdirectory, and then create a file object in that subdirectory, and then pass this file object to Image.save()?
>>
What should i learn if i want to make something out of this? What programming language
>>
>>51522445
java
>>
Guys i have a week to practice for a technical interview that's gonna be logic based or whatever in C++

What the fuck should I study? Does anyone know how to prep for this things?
>>
>>51518085
textbox1.text = textboxt2.text
>>
>>51522422
I didn't want to do that ;_;
Usually these things are simple and built-in.
Thanks though, anon.
>>
>>51522451
For desktop apps, Web apps, or what? What should be my main focus?
>>
>>51522495
>logic
just don't be retarded
>C++
study C++
>>
>>51522519
What are you interested in? Are you just trying to earn money?
>>
>>51522519
desktop and mobile apps. web apps are for fags
>>
>>51522505
Usually it's simple and built-in for a save() function to create arbitrary directories? Pretty sure that's not the case. And I wouldn't want it to be the case.
>>
>>51522500
Are you bulding a GUI to track criminals? I have an eye for this sort of thing since I used to use visual basic 6.
>>
>>51522531
Don't really have any preference, just developing overall but making money would not be bad.
>>
>>51522562
>>51522544
Why are web apps for fags?
>>
>>51522519
>calling programs apps
Jesus Fucking Christ
>>
>>51522549
No, I mean there might be an option.
Not that they create random sub-directories, lol.
>>
>>51522495
Easy: just study quantum physics, build a time machine, go back in time to 2005, pour 10k hours into studying C++ and then you'll be ready for the interview next week.
>>
>>51522562
mmm. Better to do something you actually care about making, or you'll get bored fast. It's like becoming a carpenter because you like fucking about with wood, and don't give a shit about furniture or whatever.
>>
File: 2015-11-25 08.22.13.jpg (331KB, 560x560px) Image search: [Google]
2015-11-25 08.22.13.jpg
331KB, 560x560px
>>51518112
>>
>>51522544
>mobile apps
>web apps
if it's "app" it's already for fags
>>
>>51522614
>not posting webm of picking it
loser
>>
>>51522616
app is short for application

there is nothing wrong with the term 'app'

program as in 'computer program' doesn't make sense for a mobile device. app as in 'mobile application' makes more sense.

inb4
>hurr a phone is a computer
>>
>>51522614
>>
File: inputarea.jpg (13KB, 504x370px) Image search: [Google]
inputarea.jpg
13KB, 504x370px
So I have a bit of javascript which adds an extra textarea element & a button to a preexisting page.

A list of keys is pasted or entered into the textarea, then once the button is pressed, it copies one entry from the textarea, places it into a regular input text box, deletes it from the textarea, then submits the form & saves the key to the database.

Then after the page reloads (from submitted the form), it moves on the the next key, basically automatically adding the list of keys, one by one, to the database.

It keeps tracks of the current list, unsaved key count, saved keycount, & if processing is in progress using localStorage.

Pic related is the final generated form

This is the javascript code
http://pastebin.com/t379Ep6M

Now everything works correctly, but I feel like the script/code could be optimized/simplified.
One issue I had was properly detecting "paste" "cut" "deleted" events.
I understand I could instead just send post requests, but I do not want to do that. I would rather just submit the form normally, key by key.

Any advice /g/? Thanks
>>
>>51522651
>app is short for disposable pile of shitcode
ftfy
>>
>>51522604
>>51522616
Alright, would really like to make something on windows or android so what should i develop with it? For Android i should get the Android Studio and i got intelliJ idea
>>
>>51522680
not all apps are shit

>>51522681
imo you should get eclipse with the ADT bundle but android studio and/or intellij idea should be fine if you're arleady comfortable with them
>>
>>51522681
Use android studio.

If you want to do windows stuff, get Visual Studio community edition and learn C#.
>>
>>51522702
>not all apps are shit
got example?
>>
>>51522706
>If you want to do windows-only stuff, and lock yourself in the microsoft ecosystem instead of becoming a well rounded professional, get VS and learn C#
ftfy
>>
>>51522681
C# with Visual Studio

Start learning to make your applications work with all sorts of libraries and visual frameworks, so you can develop cross-platform.
>>
>>51522706
>>51522895
>2015
>using C#
>not rolling in Swift cash
lmao
>>
File: 1412915553367.gif (2MB, 500x280px) Image search: [Google]
1412915553367.gif
2MB, 500x280px
Greeting /g/ents,
I was wondering if it would be possible for c++ class to call functions from another class?

Lets say A calls the constructor of B and afterwards a derived function from a common base clase that returns some kind of container, which holds all fucntion pointers (tuple with std::binds or a vector with boost::anys or whatever). The problem lies in casting/calling the functions of B from A.

Any ideas?
>>
>>51522913
>implying I don't already roll in database cash

C# is a great compliment for integrations and API tomfoolery.
>>
>>51522940
show me the code
>>
>>51522955
Stallman pls go!
>>
// check that the connection was opened successfully
if (inFile.fail())
{
cout <<"\nThe file was not successfully opened”
<< "\n Please check that the file currently exists."
<< endl;
exit(1);
}
>>
>>51522955

> Samefag on another device

class Bar : public Base
{
public:
Bar();

// some functions

boost::any getFuncs(); // Derived Function from Base returning a structure with all the functions of this class
};

class Foo : public Base
{
public:
Foo();

init(){ Base* p = new Bar; auto = p->getFuncs; } // Get the function container and call the funcs?
}
>>
>>51523057
/me projectile vomits, propelling himself in circles
>>
>>51522940
something like this ?

http://ideone.com/ParP87
>>
>>51523089
auto variables allowed in function parameters?
>>
File: Linus.jpg (125KB, 1211x1210px) Image search: [Google]
Linus.jpg
125KB, 1211x1210px
>>51523036
>misquoting
fuck off 2bh
>>
>>51523107
no, it's gnu c++. i used auto to avoid to write typedefs.

i have now updated the example.

http://ideone.com/ParP87
>>
>>51523065
What's the problem?

I'd suggest avoiding boost::any, though. If you need to return arbitrary closures, return a std:.function<void()> that runs all the functions you need to run.

void init()
{
Bar().getFunc()(); // different object though
}
>>
>>51523171
Thanks! Still in my case class Foo calls functions from class Bar without knowing Bar's functions. So the easiest way is to
 std::function<void(params)> f1 = std::bind(bla(params, this, std::placeholders::_1)); 

So I can call it anywhere like this
 f1(params); 


>>51523191
I prefer to avoid boost::any as well but if the functions have different parameters, i cant bind them in the same std::function. So i thought about using a std::tuple with different std::function(params)
>>
>>51523145
why are you a c᠎uck, f᠎am? can't you say "t᠎bh"?
really s᠎mh
>>
>>51518648
>I don't exactly see how this relieves the syntactic burden of Rust, though.
I wouldn't say it relieves a burden, but it certainly integrates it better with the rest of the language. Dependent types are like that -- they smash the boundaries between syntactic layers like terms vs. types.

>Seems quite powerful, though I don't fully understand how the checks are moved to compile time. Does the compiler just have an integrated prover that works in common cases of dependent types, like this?
It's not really got to do with dependent types, they're just for making sure that you're only using a given capability with the appropriate pointer. It's the strong linearity, in which a linear value like a capability must be used once and only once, that helps with verification.

>I like the idea that the compiler will only add overhead for constraints it can't prove at compile time, and will notify me in those cases.
It's not overhead. It's just what you'd need to do anyways in a language like C. In order to be able to do things to the reference count at run time, like atomically modify it in a shared pointer, the reference count needs to be implemented using a run time value which, using dependent pairs, gets matched up with the reference counts in the capabilities' types.

>>51521321
It's basically C. Structs are implemented using pairs, unions are implemented using functions that take some kind of discriminator and return types. In order to represent things like lists, you need pointers, but you can still use a subset of algebraic data types that are structurally recursive to implement things like fixed length arrays. No garbage collection.
>>
>>51523344
᠎>mongolian vowel separator
᠎>2015
>>
>>51521765
actually it's hundreds of different files, but yea.

>>51521786
anon pls.
>you're normie is showing
>>
>>51522940
that's what the C++ 'friend' keyword is for anon.
>>
>>51523932
not really.
>>
>>51523269
Why not store the arguments in the closure in a lazy evaluation style?
>>
bunch of nerds with glasses
>>
>>51523897
᠎>no
>>
File: 1384355872581.jpg (83KB, 466x365px) Image search: [Google]
1384355872581.jpg
83KB, 466x365px
Why don't we just make a functional programming language that runs on the GPU?
>>
>>51524202
Because you need stuff to happen on the CPU too
>>
why not go outside
>>
>>51524202
http://haddock.stackage.org/nightly-2015-11-25/accelerate-0.15.1.0/index.html
>>
>>51524226
It's cold out there.
>>
Read treat_heap_as_int like pseudocode. Is there a defined way I can treat a block of memory of size sizeof(int) as int?
#include <stdio.h>
#include <assert.h>
#include <string.h>
#include <stdlib.h>

void
treat_struct_as_int(int n) {
FILE _, *fp = &_;
assert(sizeof *fp >= sizeof n);
memcpy(fp, &n, sizeof n);
memcpy(&n, fp, sizeof n);
printf("struct: %x\n", n);
}

void
treat_heap_as_int(int n) {
static char *mem = NULL;
if (!mem) {
mem = realloc(mem, sizeof(int));
assert(mem);
}
*mem = n;
printf("heap: %x\n", (int)mem);
}

int
main(void) {
int n = 0xffef;
treat_struct_as_int(n);
treat_heap_as_int(n);
return 0;
}
>>
>>51524230
Pretty coo-
>CUDA
Dropped.
>>
>>51524202
AFAIK, the reasoning is: GPUs are actually slower than CPUs, the only difference being that you can send massive amounts of data to them.
>>
>>51524202
Better to use a functional language for everything and embed a DSL for writing shaders.
>>
>>51524288
nm, I didn't even read the question

>>51524272
http://www.amd.com/en-us/press-releases/Pages/boltzmann-initiative-2015nov16.aspx
>>
>>51524202
F# has been able to run on GPUs for a while now. not sure of any others
>>
Quick!
You're about to be executed your only way out is to say something good about Python.
>>
>>51524498
syntax is fairly readable
>>
>>51524498
>can't say anything
>Rasheed starts slicing into my neck
>gurgle, ">forced indentation"
>>
>>51524288
GPU cores are very simple but you have thousands of them. They can't do complex functions like an x86 cpu can, but they can repeat simple ones a thousand times faster than a x86 cpu.

It's like building a house with a hundred thousand ants instead of five illegal immigrants.
>>
>>51524498
global interpreter lock
>>
>>51524413
This.

It's not the world's best language for no reason.
>>
>>51524498
concise syntaxt
>>
>>51524558
it's a mere rip of ocaml by talentless people for the dot net kids.
>>
>>51524589
I use F# on mono over ocaml solely for the standard library
and there's nothing you can do to stop me
>>
>>51524558
>It's not the world's best language.

ftfy
>>
Just got into programming and an mildly familiar with Python and Java. Played with data structures a bit, where do I go from here
>>
>>51524612
i don't want to stop you, ocaml's scene must remain retard free.
>>
>>51521157
>overuse of libraries is for code monkeys.

That wasn't the claim, so it's not relevant.
>>
>>51518085
Somehow after quite some years of being taught programming in hs and now college, it is only now that I learn of macroinstructions.
Could someone please give me a #define example for a macro that returns the max value out of 3 input integers? Help a dumb motherfucker out.
>>
>>51521609
What's the back-story of that pic ?
>>
>>51518112
Pretty much video game at the moment. If I lived in a legal state I would probably try weed but I'm not sure if that counts as a hobby.
>>
>>51524589
It's more than that. Type providers, GPU support, multi core and use of the entire .NET ecosystem are pretty nice pluses.
>>
>>51523269
>using std::bind
>not a lambda
it's 2015
>>
In C11, I'm trying to decided whether I want to use #define, static const or enum.

For one, I don't understand how enum comes into play.

Second, why can't I just make a static const in a header file in C? It says I'm trying to redeclare.

If I use define, I lose my typesafety

what's your best practice?
>>
>>51524978
you have to forward declare it in the header file and initialise it in the cpp file

if it's one value you probably don't want enum

if you want to use it in other macros, make it a macro (you probably don't, so make it static const)
>>
>>51524978
I use enum because you retain the symbol in gdb, for example with enum { HEREIAM = 0xff }; you'll get to see HEREIAM next to 0xff where you use it in code.
>>
File: 1448472078469.jpg (201KB, 789x1013px) Image search: [Google]
1448472078469.jpg
201KB, 789x1013px
>>51524226
>living in sweden
>going outside, ever
>>
>>51525048
>living in sweden
>staying in to watch the african-syrian bull play with your wife
>>
>>51524895
ocaml too has multicore computing
>>
>>51525025
what's the different between forward declaring it? does it still require "extern"?

What is extern used? What's it for then?

>>51525043
That's interesting. Is there any downsides?

separate question with symbols - why is it sometimes when i print pointers in lldb, it just prints memory addresses and doesn't show me internals. how can i make it so it prints the memory address in the format of the struct/type?
>>
>>51525087
And the other 3 points made?
>>
>>51525087
no it doesn't. It's just in the works.
>>
>>51525123
header
extern static const Type Variable;

cpp
const Type Variable = Value;
>>
>>51525173
is extern required?

does extern go in the header filed?


do any of you know any SDL2 widget libraries / frameworks / permissively licensed projects in C?
>>
>>51524758
USE INLINE FUNCTIONS INSTEAD OF MACROS (unless you know what you're doing)
#include <stdio.h>

#define max(a, b) ((a) > (b) ? (a) : (b))
#define max3(a, b, c) max(max(a, b), c)

int
main() {
int a = 1, b = 2, c = 3;
int max = max3(a, b, c);
printf("max of (%d %d %d): %d\n", a, b, c, max);
/* Do not do this (this is why macros suck): */
max = max3(++a, ++b, ++c); /* This changes a, b, and c in a way you might not expect. */
/* Examine the output: */
printf("max of (%d %d %d): %d\n", a, b, c, max);
}
>>
>>51525150
And yet it's better supported by the INRIA guys than the GPU backend for F# is supported by Microsoft.
>>
File: 1448474986516.jpg (16KB, 225x255px) Image search: [Google]
1448474986516.jpg
16KB, 225x255px
>>51524745
>>
>>51525270
but not supported as well as multi core for F#. Infact it's kind of not supported at all since it's not recommended for production code. It's hilarious how you're trying to make it looks good by comparing it to a useful feature in F# that ocaml doesn't support at all.
>>
>>51525150
>multicore = multi threading
you still have much to learn, anon-kun, ocaml has multi processing.

for examples, see http://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=ocaml&lang2=fsharp

>>51525132
>gpu
http://mathiasbourgoin.github.io/SPOC/

>>51524895
>Type providers
lel, and f# is missing modules, functors, polymorphic variants, structural typing, ... i told you: it's just a mere rip.

>>51524895
>.NET ecosystem
https://opam.ocaml.org/
>>
File: 1446086761229.jpg (145KB, 834x1200px) Image search: [Google]
1446086761229.jpg
145KB, 834x1200px
>>51525239
Thank you very very much. Have a comfy wp in return.
>>
>>51525325
it's also missing GADTs, open types, etc.
>>
>>51525081
>>51525081
>>51525081

Help!
>>
>>51525123
extern is a way to signal to the c++ compiler to not name-mangle the variable so it can be used as an external library interface by other programs. if you're not writing library code, you don't need to use it.
>>
>>51525445
>the function*
>>
>>51525431
Not sure, but there are websites that can do this. Since you're in /dpt/, why not try to make your own?
>>
>>51525325
>>multicore = multi threading
No it doesn't you dumb shit. Ocaml current only supports green threading. Meaning the threads are not systems threads, and can only run on a single core. Multi core support is being worked on and should be ready quite soon I'm told. Learn what green threads are.

>http://mathiasbourgoin.github.io/SPOC/
Neat. fair enough

>modules
https://msdn.microsoft.com/en-us/library/dd233221.aspx
>functors
These are basically just regular classes in F#. No point is calling them functors in the .NET ecosystem when normal classes do the same job perfectly fine.
>polymorphic variants, structural typing
true
>it's just a mere rip.
Except for the other features i mention and many others, which are quite excellent. Who cares if it's a rip off? It doesn't claim not to be based off ocaml. Just use whatever language is best.

>https://opam.ocaml.org/
Yeah, i know. Weak shit. Also F#, like C#, can do native interop very easily.
>>
>>51525431

Wolfram?
>>
>>51525431
ask in >>>/sci/sqt

it's simple though just follow the rules of integration
>>
>>51525465
>make your own?
I'm thinking about it. I'm kinda lazy though and already have another project open atm.
Also, might as well check if there's something out there already.

>>51525478
>Wolfram
Checking it out, thanks
>>
>>51525272

r-rude
>>
>>51525528
>ask in >>>/sci/sqt
That place appears to be a wasteland
>>
Fuck.

Need to recursively called a table-valued function and union each result with the last one in SQL.

Hold me.
>>
>>51525595
lel

but usually when there's a SQT in there you can ask math shit and get answers within a few hours
>>
>>51525561

I used it when studying for calc when I was in college. It shows you all steps and everything, just doesn't blurt out an answer.
>>
>>51525466
>Ocaml current only supports green threading
never i have said that ocaml has native threads. what i said is that ocaml supports multicore through multi processing (spawning multiple processes). reading comprehension is a thing.
>>
is there any unretarded way to have a WPF program start in the notification tray without having to create a window?

I'm using the Hardcodet WPFNotifyIcon library for the notify icon functions.
>>
>>51525638
You said
>multicore = multi threading
Which is wrong. If you just mean multi process support then you should be well aware of the limitations of that. IPC overhead and all that shit. It doesn't have true multi core support like F#. It's a widely accepted problem with ocaml, which is why they've been bothering to fix it.

Glad you accept everything else I said.
>>
>>51525685
>WPF
don't be a retard
>>
>>51525685
I'm not 100% sure. But you can of course just create a hidden window that doesn't show up on the taskbar. But i recall reading it's possible to not create a window do shit like that. I think support was added in 4.0 when VS started using WPF.
>>
bunch of nerds
>>
r8

ermac.h:
#ifndef ERMAC_H
#define ERMAC_H

#include <errno.h>
#include <stdlib.h>

#ifndef ERMAC_NAME
#define ERMAC_NAME "error"
#endif

#define cx_(cond) do { if ((cond)) { \
perror(ERMAC_NAME); exit(1); } } while (0)
/* POSIX error catcher for arbitrary failure condition. */
#define cx(cond) cx_(cond)

/* Catch Null */
#define cnull(expr) cx((expr) == NULL)
/* Catch False */
#define cfalse(expr) cx((expr) == 0)
/* Catch Sign (Fail if <0.) */
#define csign(expr) cx((expr) < 0)
/* Catch EOF */
#define ceof(expr) cx((expr) == EOF)

#endif /* ERMAC_H */


test.c:
#include <stdio.h>
#include "ermac.h"

int
main(void) {
FILE *fp;
cnull(fp = fopen("JEWS", "r"));
ceof(fclose(fp));
return 0;
}


build:
clang -o test test.c -DERMAC_NAME='"test"'
>>
>>51525721
what do you suggest then? The logic is decoupled from the UI I think I can switch to something else if you convince me.

>>51525738
I'm using the hidden window method right now but the problem is that it shows up in the windows 10 task view thing (win+tab).
>>
>>51525766
>what do you suggest

XAML of course.
>>
>>51525123
> What is extern used? What's it for then?
It declares a variable without defining it.
"extern int foo;" tells the compiler that "foo" is a variable of type "int". "int foo;" would cause the compiler to create the variable as part of the generated object file. If you define a variable in a header, you'll end up defining it in every object file whose source file includes that header, which will typically lead to link errors due to multiple definitions.

>>51525445
> extern is a way to signal to the c++ compiler to not name-mangle the variable
Um, no. You're thinking about e.g.
> extern "C" void foo(int);
This specifies that the function has C linkage: it will be called use the C ABI (which may be different to that for C++) and the name won't be mangled. If you look at a header for a C library, it's fairly typical to see:
#ifdef __cplusplus
extern "C" {
#endif

// body of the header
#ifdef __cplusplus
}
#endif

This allows the header to be used from within C++ code, as all of the functions are declared as having C linkage (without that, they would be assumed to have C++ linkage, with name mangling etc).
>>
>>51525756
kill yourself, my man
>>
>>51525787
...which is WPF
>>
File: Valutron.png (17KB, 750x216px) Image search: [Google]
Valutron.png
17KB, 750x216px
>>51518085
I'm building a Lisp, called Valutron. I am implementing its compiler-interpreter in Objective-C.

It has some unique features: first, it offers what are called V-expressions, an alternative notation for writing code. Second, it offers a comprehensive object system inspired mainly by that of SmallTalk-80, one of the earliest Object-Oriented languages, and by Common Lisp's CLOS, Common Lisp being the first object-oriented language to be standardised.

This object model is implemented atop the Objective-C runtime, which I have extended with support for Double Dispatch to enable the availability of CLOS' characteristics multimethods.
>>
>>51525766
well.. i expect there is a way to hide it. I wouldn't even know what to look up though. I just recall reading a blog about support being added to do it.
>>
>>51525766
WinForms
>>
>>51525827
Ok, thanks. I'll try and dig up more information.
>>
>>51525808
>Objective-C
shit b8
>>
File: 1441684460338.jpg (92KB, 1280x720px) Image search: [Google]
1441684460338.jpg
92KB, 1280x720px
>>51525808
>Objective-C
>>
>>51525848
>>51525849
Objective-C is literally a good language.
>>
>>51525828

This. Winforms is good and also multiplat.
>>
>>51525808
what's the github for it?
>>
>>51525866
Right, that's why nobody besides Applel uses it.
>>
>>51525871
isn't it considered obsolete now?
>>
>>51525884
I'm using it and I don't do Apple dev.
In any case, take your argument from popularity to Betamax/VHS or one of millions of other examples about the inanity of popularity.
>>
Does anyone know how to decide whether the definite contour multiple integral of an elementary meromorphic function is zero over an everywhere real analytic manifold on which it is analytic?
>>
>>51525899

No. The whole "winforms btfo lmao WPF!" thing is/was a total meme.
>>
What does /g/ think about using 1 letter variables? Go encourages this practice, but I'm not sure if it helps readability. Take this method for example.
func (c *Client) write() {
w := bufio.NewWriter(c.conn)
for m := range c.Out {
m = append(m, delim)
_, err := w.Write(m)
if err != nil {
log.Print("write ", c.conn.RemoteAddr(), err)
c.die()
return
}
w.Flush()
}
}

delim is an abbreviation for 'delimiter' which is a global variable holding a character.
What's wrong with the captchas? I'm getting those impossible word ones (botnet ndedfp).
>>
>>51525923
and then there's this asshole
>>
>>51525958
they should almost never be used except for loop iterator variables. sometimes they can be used for very short-lived variables.
>>
>>51525957
can you provide resources on how I can accomplish what I set out to do in winforms?
>>
>>51525899
Maybe "considered"
But there's still no successor
>>
>>51525923
this is bullshit, Obj-C is worthless without Apple's foundation libraries, GNU-Step is a joke. the only reason that Apple got away with using Obj-C for so long is that Obj-C is a strict superset of C, so pretty much all the low level Foundation libraries are pure C. Obj-C is slow, unsafe, and unsuitable for any modern programming. It is not really even its own language, all Obj-C syntax gets translated into C and is compiled as C.
>>
>>51525923
Even Apple realised it's shit and dropped all that dynamic typing shit in Swift.
>>
>>51526020

I've never had to do it, but SO provides some code:

http://stackoverflow.com/questions/1730731/how-to-start-winform-app-minimized-to-tray
>>
>>51526027
>all Obj-C syntax gets translated into C and is compiled as C.

Exactly. It's like Vala, but worse.
>>
>>51525878
>what's the github for it?
lol, its pretty obvious this Vaultron language is a troll/joke
>>
>>51525958
Go is fucking garbage. If go does or suggests something, you know it's trash.
>>
>>51526053
Thanks, I'll take a look at this. Might end up migrating over unless I find an easier solution.
>>
>>51525958
https://talks.golang.org/2014/names.slide#1
the talk itself:
https://www.youtube.com/watch?v=sFUSP8Au_PE

all you need to know about the advantages and disadvantages of short variables is in here

tl;dw:
- use short names when the scope is small and the context makes the meaning clear
- use short names when the scope is large and the variable is used a lot (certain packages for instance)
- use names with appropriate length otherwise
- don't make names longer than necessary in the given usage context, names longer than necessary obscure the flow and the meaning of the code
>>
>>51526112

WPF is nice, and pretty fancy, but WinForms is 110 years old at this point. It really couldn't get more mature, my man.

You could probably fly a god damned fighter jet with Winforms.
>>
I'm writing a list of non-softskill keyword metrics which are relevant to working in the IT sector (not specifically as a developer).

# Programming languages (C, C++, Java)
# IT certificates (CISSP, TISP, Cisco)
# Programming concepts (Scrum, agile)
# Operating systems (Windows, Linux)
# Common software and security tools (MSWord, Nessus, Metasploit)
# Guidelines, Standards, etc (ISO)

Any more ideas?
>>
>>51526131
and that's how you end with variables like
x, xx, xxx, y, yy, yyy
>>
>>51526168
I'll take your advice into account. Thanks again for the help!
>>
>>51526168
But WPF is the future! That's why more or less all windows apps these days use WPF instead of GDI. Especially ones microsoft make!!

... wait...
>>
File: efd.jpg (47KB, 403x392px) Image search: [Google]
efd.jpg
47KB, 403x392px
Day 3 of negotiations with management about how a select/deselect all button is supposed to work.

The button has become sentient.
>>
>>51526173
Trash (HTML/CSS/JS/PHP)
>>
>>51518085
Who wants to write a multiplayer tictactoe game over HTTPS with me
>>
>>51526198
bullshit, if you follow the advice given in that talk you won't

you got an initializer?
u := User{}
is the function name ConnectUser?
why would I have to call the user "userToConnect"?
isn't the meaning immediately obvious to anyone reading the code?
code with an appropriate, context-sensitive name length is a lot easier to read than code that uses names that are too short in the given context or too long. both hurt readability.
>>
>>51526235

hue

>>51526214

No problem. It kinda sucks that I couldn't give more personal advice (being that I don't usually build applications which live in the tray), but oh well.

What is it that you're working on, anyway?
>>
>>51526257
something windows really needs

https://github.com/Tanjoodo/autoproxy

there's probably a program that already does this somewhere but I thought I'd write my own.
>>
>>51526131
I'm watching the talk right now.
>>
>>51526273

Good shit, m80.
>>
>>51526310
thanks :)
>>
>>51518112
>riding my motorcycle
>drinking beer with buddies
>some games
>reading
>>
>>51526247
I can
>>
>>51519211
I bet she was a woman, wasn't she?
>>
>>51526247
lets do it
>>
New thread: >>51526469
>>
>>51525958
Make a variable name as short as possible so that I know how to pronounce it and the meaning of it without a comment. If you're not conveying additional information, leave it out.

In your example, I know c is pronounced `client' and w is pronounced `writer', but I don't know what m is. This either means I should learn Go and then I would understand it by idiom, or that m is poorly named.
>>
>>51520053
I'm quite sure you could write a macro to be able to do checked! { 2 + n * 17 + x }, and deal with a single result at the end, rather than having to handle them for every operation.

Alternatively, you could define an enum Checked<T> { Value (T), Overflow } wrapper, such that you could use all the normal arithmetic operators without macros or anything, and have them call the checked arithmetic functions, resulting in an Overflow value when either operand was an Overflow, or when the operation actually results in an overflow.

Both ways you would only need to handle the overflow error case once, at the end, just like with exceptions.

I'm surprised you mind the lack of exceptions. I avoid them in my C++ codebase regardless, and they are disallowed in C++ code I write for work. I find them way harder to reason about than Rust's Result, and in code I've read so far, more prone to misuse.

Also, Rust guarantees twos complement wrapping for signed integers, and normal wrapping for unsigned. That's at least better than C and legacy types in C++, where signed overflow is left undefined in the name of irrelevant legacy platforms.
>>
>>51526473
FUCK OFF FAGGOT
>>
>>51520053
>>51527188
Also, I've never in my life written code where handling an overflow is the correct thing to do.

In almost every case I know overflow will never happen, and I leave it unchecked for performance (or checked with a panic on overflow, if I really want to avoid any sort of possible corruption, though I've never done this in real life). If I know an overflow is possible, I should instead use bignums.

Where have you ever done arithmetic that "might" overflow, where it makes sense to do something other than panic / error out when overflow occurs? In these cases, it seems more like you are masking what is actually a bug. If it turns out that the user passing "foo = 2^63" causes an overflow down the line, you should either be using bignums to avoid the overflow, or you should immediately error with "foo must not exceed X", rather than "overflow on line x" potentially hours later.

To me, Rust's strategy makes sense. In debug mode I want to know when overflow happens because it means I have a bug. In release mode, checked by default would mean I'd be annotating 99% of my arithmetic with "unchecked" in some form, which would be pointlessly annoying. If I'm not sure if an overflow is possible, I can opt in to using bignums or checked arithmetic.
Thread posts: 327
Thread images: 28


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