[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: 330
Thread images: 32

File: images.jpg (8KB, 297x170px) Image search: [Google]
images.jpg
8KB, 297x170px
Krapula editio

Vanha: >>55242627
>>
>>55253746
first for
eiks joku muu vois välillä alottaa nää langat
>>
File: averaging two integers.png (1001B, 247x40px) Image search: [Google]
averaging two integers.png
1001B, 247x40px
>>
>>55253746
Kannattaisiko poistaa sun suomi näkyy taas.
>>
File: finland.jpg (909KB, 1982x1724px) Image search: [Google]
finland.jpg
909KB, 1982x1724px
GOD DAMN FINNS
Get off this board

Are you even white?!
>>
File: perkele.png (213KB, 800x762px) Image search: [Google]
perkele.png
213KB, 800x762px
>>55253862
were as white as the snow and ice surrounding us and our ancient kingdom.
everlasting glory for mongolia!
>>
File: comfy.png (167KB, 376x328px) Image search: [Google]
comfy.png
167KB, 376x328px
DAILY PROGRAMMING CHALLENGE!

Post a function that averages an arbitrary number of integers without overflowing and returns an integer.
>>
>>55254071
What should the integer return value be?
>>
>>55254146
int, i'm pretty sure
>>
>>55254071
int avg(int n, int *arr)
{
float result = 0.0f;
int i;
for (i = 0; i < n; i++)
result += (float) arr[i] / n;
return (int) result;
}
>>
>>55254156
What do you mean?
>>
>>55254071
val isZero : 'a -> Tot Bool
let isZero x = (x = 0)
val average : list (x:int { isZero x }) -> Tot int
let average _ = 0

possible incorrect syntax
>>
File: boat.jpg (1MB, 1343x1906px) Image search: [Google]
boat.jpg
1MB, 1343x1906px
what should I call my ocaml program?

it tells you if dates are matched by an s-expression.
made for recurring scheduling.
>>
>>55254533
sex dating scheduler
>>
>>55254533
iTrump
>>
>>55253862
>karuselli
>karu selli
Reminds me of this.
https://www.youtube.com/watch?v=6Cw8cKQ6SN0
Pretty funny stuff.
>>
>>55254156
He's asking what the function is supposed to return.
Most would assume the average of the array of integers. But you can't be sure.
>>
File: Untitled.png (307KB, 1800x1582px) Image search: [Google]
Untitled.png
307KB, 1800x1582px
>>55254612
Well it can't be the average, integers aren't closed under any form of averaging I know

>>55254598
>mastering swedish
>>
First year course in C#. Can anyone help explain why my method only returns guessBool=False?

Method here: textuploader / 53zt5

Sorry about the url 4chan thinks its spam
>>
>>55254820
Debug that shit lazy nigger.
>>
>>55254174
#include <stdio.h>
#include <limits.h>
#include <stdlib.h>

int avg(int n, int *arr)
{
float result = 0.0f;
int i;
for (i = 0; i < n; i++)
result += (float) arr[i] / n;
return (int) result;
}

int main() {
int arr[] = {INT_MAX-5, INT_MAX-5, INT_MAX-5};
printf("%d\n", avg(sizeof arr / sizeof *arr, arr));
}


$ gcc x.c -O0 -o x && ./x
-2147483648
$ gcc x.c -O2 -o x && ./x
2147483647


well done
>>
>be writing javascript program
>run it
>suddenly fans go FULL BLAST

What the fuck.
>>
>>55255438
Infinite loop, probably.
>>
Anyone use mathematica?
I want to take a list, square every item in the list and print it.
someList = {1, 3, 5, 7, 9}
sqList[a_] :=
For[i = 1, i <= Length[a], i++, t = a[[i]; t = t^2; Print[t]]


Then doing sqList[someList], just outputs 1, 5 times.
>>
>>55255589
>For[i = 1, i <= Length[a], i++
>calling the C/LISP modified while loop "for"
Put it in the fucking garbage.
>>
Why does /g/ hate C++?
>>
>>55255686
Because it's verbose and complex shit bolted on top of C.

C++ is an abomination that should have dropped C backwards compatibility 30 years ago.
>>
>>55255686
It's pretty cool desu. I still prefer C tho.
>>
Why does /g/ hate R?
>>
>>55255994
R is very powerful and useful, but also gross.
(see also Java, C++)
>>
>>55255686
It's ugly, bloated and the niche it fills (gotta-go-fast with some high level features) becomes less relevant all the time.
>>
>>55255686
>>55255755
>In fact, my ideal when I started on C++ was "Algol68 with Classes" rather than "C with Classes." However, the list of solid reasons against basing my work on type-safe Algol68 [Woodward, 1974] was long and painful. So, perfect type safety is an ideal that C++ as a language can only approximate.
>>
>>55253746
Is writing an api wrapper a good first project? The API has a bunch of wrappers already (just in languages I don't want to use)
>>
>>55256156
A project with a useful result is always a good project.
>>
Can I override the Close (X) button of a Window in WPF? I think the button calls the Close() method of that window, but I want to call ShutDown() to close the application and therefore all the windows spawned, not only one window.
>>
>write website for remote file management
>drop project because fuck html and css
>write client server application instead
>fuck writing 2 applications
REEEEEEEE
I think I'll go back to my initial plan and go for a website.
>>
>>55256252
https://stackoverflow.com/questions/3001525/how-to-override-default-window-close-operation

t. your friendly google proxy
this never gets old
>>
>>55256408
Yeh, I searched for it, and saw that solution but at first didn't worked because he was trying to override a public method to a private, therefore that method wasn't showing in the IDE.
I susbcribed to the Window.Closing event and that worked. (https://stackoverflow.com/questions/3001525/how-to-override-default-window-close-operation)
ty senpai.
>>
What is /dpt/'s opinion on singletons?
>>
>>55256607
Great when you only need 1.
Not so great when you don't.
Little point in structuring your code around them
>>
>>55256607
Inflexible. Dependency injection is much better.
>>
What is the best option for sanitizing data in perl?

I mean for protecting against XSS for example
>>
>>55256962
Regex could be an option.
>>
>>55256981

I was hoping that wouldn't be the answer..

(I'm bad at regex)
>>
File: lrg.jpg (122KB, 500x656px) Image search: [Google]
lrg.jpg
122KB, 500x656px
>>55256993
Check out this, I readed it when I was a webdev.
>>
if i have an int x, would it be faster to do x = ~x + 1 than x*= -1 ?
>>
>>55256607
Mostly useless in my experience.
>>
>>55256607
It's a way to use global state "without" using it
>>
>>55257077
If so, then the compiler will probably optimize it anyway and it will be less readable if you write it the first way.
>>
>>55255686
check the assembly yourself.
>>
>>55257040
thanks I will check it out did you find it helpful for untainting also?
>>
File: h.jpg (63KB, 797x588px) Image search: [Google]
h.jpg
63KB, 797x588px
52. postaus suomalaiselle kulttuurille ja perus /g/ käyttäjälle
>>
>>55257125
>did you find it helpful for untainting also?
I don't do Perl, so I can't know if it's useful for that.
>>
>>55257077
Here's a checklist:
1. I have written both versions
2. I have looked at the disassembly
3. I have profiled the code
4. I have considered if the difference is worth it
After going through these steps you will know what to do.
>>
File: 1466872577563.jpg (2MB, 1346x2002px) Image search: [Google]
1466872577563.jpg
2MB, 1346x2002px
Is it true crossdressing gives godtier programming abilities?
>>
>>55257077
those being equivalent is implementation defined
>>
can you guys help me with coding something? I'm practicing for an exam and I'm having trouble with a part of my code. the language is java and it has to do with queues.
>>
>>55257790
True, I can confirm. I do not crossdress and I can't write fizzbuzz.
>>
>>55257839
Post it.
>>
Well at least there are no faggots SJW that like Rust in /g/
>>
File: 1442246460245.jpg (465KB, 3888x2592px) Image search: [Google]
1442246460245.jpg
465KB, 3888x2592px
>mfw using gradle
i was positively surprised
now they just need to extend it for a bunch of other languages
>>
how do you get past dependency paranoia
like, i know there are millions of great libraries out there but im scared that my build process will turn to shit
>>
File: 1403216098548.gif (297KB, 640x448px) Image search: [Google]
1403216098548.gif
297KB, 640x448px
>>55257913

english is my second language so bear with me.

basically the user needs to input a word or sentence and the program needs to check if it's a palindrome or not.
I have to use a single linked queue. it enqueues at the end and dequeues from the beginning of the list.

the part I don't understand how to do is this: I have to check if the word (or sentence) is a palindrome using dequeue.

should I make two different queues, one normal and one flipped and then compare them with dequeue? or can I directly check. I'm pretty sure I can't do it that way because it's single linked, but maybe I'm missing something.
>>
What Python GUI framework would you advise me to use ?
>>
>>55256407
>fuck html and css
Ah, I see. You guys rip on webdevs because you're actually too dumb to even understand html/css.
>>
>>55257077
>>55257346

STOP. This is premature optimization and one of the worst things you can do to your project. Just use whichever displays your intent better (the second one) and move on to more important things.
>>
>>55258113
Write to the screen directly.
>>
>>55257961
I like rust, it's a great language
>>
>>55255640
Found the autist
>>
>>55258401
What ?
>>
what's the correct way to handle errors in C that might happen in some function or procedure? should I just return an error code and check for it in the main method?
>>
>>55258571
Yeah pretty much, I remember creating a bunch of small functions validators, each returned a non-zero if there was an error. And finally I wrapped all the function into one.
You might wanna return an object which contains the functions that raised an error if you need to know that.
>>
>>55258661
>which contains the name functions*
>>
For someone who only knows Turing (it's taught as a course in my school) what programming language would you recommend as a next step, C, C++, C#, Java, something else? I'd prefer for whichever language to have pretty extensive documentation that is actually understandable for a beginner. Thank you all in advance.
>>
>>55255686
I don't hate it mane. Concepts are the shit.
>>
>>55258695
what the fuck is Turing
>>
>>55258695
>actually understandable for a beginner
>extensive documentation

python 3
>>
How do I make the jump from regular C programming to Data Structures programming?

I don't know about nodes and structures and lists and trees and shit.
>>
>>55258966
>Data Structures programming
lol

lists are super ez.
BSTs are super ez
balanced BSTs are not as easy.

there's no magic involved, just read some sample implementations and understand them.
>>
Whats good /gee/

I think I've come to realize that programming a series of small scripts will not greatly progress programming ability, and ability gained from programming these scripts will taper off into a plateau over time

In this case I define a script as anything <200 lines

I do believe a way to vastly improve ability would be to program large projects, since they require a great deal of thought and several varying methods

This leads me to my question /g/, who's got large programming projects here to share? School projects? Large personal projects? List/screenshot the project guidelines
>>
>>55258911
Turing is a Turing complete language developed by holtsoft, it's incredibly basic.
>>
>>55258988
>lists are super ez.
>BSTs are super ez

I feel very dumb now.
>>
>>55259002
Maybe check out an open source project.
https://github.com/django/django
https://github.com/git/git
git://git.musicpd.org/master/mpd.git
[...]
>>
>>55259054
Eh, everyone has to start somewhere.
If you want I can write some basic implementations of lists and BSTs for you to work through.
>>
>>55258073
Take your input, save it as a string.
Take that's string's length, save it as an int.
Half that int and round down.
Walk across your string and enqueue that many char.
You can start at the front or the back, it doesn't matter.
Then walk across the string in the /other/ direction.
As you go, dequeue and compare it.
If it matches until the queue is empty (or maybe just reusue the ½length), it's a palindrome.

So,
>take input
>prepare ½length
>loop where you enqueue
>loop where you dequeue
>return something
>>
>>55259090
Yeah that would be cool.
I just need to study for an exam and like I said I only know "regular" programming. I'm not even good with pointers.
>>
>>55254071

avg :: (Integral a) => [a] -> a
avg [] = 0
avg xs = fromIntegral((sum xs)) `div` fromIntegral((length xs))
>>
I'm currently working on my xscreensaver replacement.

Improving the saver API and Rust implementation to take into account all the various issues that screen lockers had in the past.

In the end it should be even simpler to write screen savers in any language than it is with xscreensaver, and they'll even be more customizable.

Wonder if jwz will ever write a rant about me.
>>
>>55259309
Cool, I'll probably take an hour or two and release it here: https://github.com/p512/ads
>>
This (>>55259148) assumes some things about your problem.
Frankly, you were /really/ vague about it.

If you do it with literally a single queue and a two chars things get messy.
The easiest solution would be to use a bookened. EOF/EOT/NUL/whatever. A char value you know you won't see.
Actually, how do you know when the input is finished? Just use whatever it terminates with?

So you take a char of input, save it in your a char, enqueue the char, then check if the char is the termination char.
This enqueues the termination char as well, but that's fine, because you'll use it as your bookend.
Then do this shit, but in Java instead of fugly psuedo-code.
loop (is char1 not the bookend?)
input -> char1
char1 -> enqueue
dequeue -> char1
loop (true) //we just return at some point
is char1 your bookend? //inputs of even length
(yes) you're done! it's a palidrome
// there's no (else) case, we just keep going
enqueue -> char1
dequeue -> char2
is char2 your bookend?
(yes) enqueue -> char2
dequeue -> char2
is char2 your bookend again? //inputs of odd length
(yes) you're done! it's a palindrome
(else) are char1 and char2 the same value?
(yes) dequeue -> char1
back to the start of the loop
(else) you're done! it's not a palindrome
(else) char2 -> char1
>>
>>55254071
 return 3; 
>>
File: 1404590990764.gif (226KB, 500x375px) Image search: [Google]
1404590990764.gif
226KB, 500x375px
>>55259148
that's clever, thank you. I'm trying to type it out now.
>>
>>55255370
how would you do it then?
>>
>>55257077
uh, you can also do x = -x; If there are no optimizations involved, I believe it would be fastest. and the most clear
>>
File: Capture.png (11KB, 709x668px) Image search: [Google]
Capture.png
11KB, 709x668px
>>55255589
no stop
>>
I'm trying to scrape a site but I'm exceeding the amount of request. I've started sleeping my in between requests up to 3 seconds but I'm still getting hit with the too many requests. Am I just going to have to keep sleeping longer and longer until I get under their limit? It's already becoming deathly slow.

>any ideas would be much appreciated
>>
>>55259660

Well for starters, if you are going to cast to float, you should at least use a bigger one. 32 bit floats can hold 23 bit integers. 64 bit floats (doubles) can hold 52 bit integers.
>>
>>55260196
sleep longer
>>
>>55260196
make a virus, infect a hundred PCs, scrape with them too
>>
>>55260228
>>55260232
Figures. Apparently you can use tor and request different IPs which could be useful. But I'm lazy and would rather sleep longer.
>>
>>55260196
What site? Does it have an API?
>>
>tfw want to do SICP but CL has better features like CLOS
Which dialect should I learn lads: scheme or CL?
>>
>>55260282
Nah it doesn't. It's a sports site with a lot of statistics I'm trying to grab.
It seems like they really don't want you scraping. The limit seems to be 5 requests for a certain position in a given time. So you can quickly look up different items quick. But when you start looking up the same type of thing over and over is when they ding you. Maybe if I randomly visit the homepage every so often..
>>
>>55259402
Cool shit bro.

Please keep it easy enough for a noob.
>>
>>55260315
Doesn't matter which dialect you learn, you won't be doing anything important with it.
If you ever find yourself in a situation where it matters, you can pick up another dialect with it fairly quickly.
Since you want to do SICP, just use Scheme.
>>
>>55254533
sexpy-time
>>55258411
this, top 10 language
>>
Is rust a meme or can it legitimately replace C and C++
>>
>>55261005
>Rust

https://github.com/rust-lang/rust-www/issues/268

top kek
>>
>>55261023
I mean I guess you could say Mozilla is enabling these faggots but this kind of thing is happening in all sorts of github projects these days
>>
>>55257985
Gradle is great until you go to build a project that hasn't been touched in 4 years and it no longer builds with the latest version. Then, you download a legacy Gradle, but then discover they changed where libraries are stored. You find the new spot, but then discover that certain underused libraries were dropped from the repository.
>>
>>55260315
SICP uses Scheme.

Afterwards, learn Clojure.
>>
>>55261005
It's not a meme, it's a very nice language to actually use. That doesn't necessarily mean that it will overtake C/C++ but I think it will continue to gain popularity in many industries currently using those languages. It also has the potential to replace Java/C# in many cases, IMO.
>>
>>55254071
Stupid weaboo
>>
>>55254071
I couldn't do it without a list (or ParamArray for that matter), so I found this online which looked interesting enough to post

type T = T with
static member ($) (T, _:int ) = (+)
static member ($) (T, _:decimal) = (+)

let inline sum (i:'a) (x:'a) :'r = (T $ Unchecked.defaultof<'r>) i x

type T with
static member inline ($) (T, _:'t-> 'rest) = fun (a:'t) -> (+) a >> sum

let x:int = sum 1 2 3 4 5
let x:int = sum 1 2 3 4 5 6 7 8 9 10
>>
>>55254071
(defn avg [seq]
(/ (reduce + seq) (count seq)))
>>
>>55254071
average = lambda *n: int(sum(float(x) / len(n) for x in n))
>>
>>55261507

rubyist@Overmind:~$ clojure
Clojure 1.6.0
user=> (defn avg [seq]
(/ (reduce + seq) (count seq)))
#'user/avg
user=> (avg '(9223372036854775807 9223372036854775807))
ArithmeticException integer overflow clojure.lang.Numbers.throwIntOverflow (Numbers.java:1424)
>>
>>55261669
Anon, this is just curiosity, but why you had changed your tripcode like 2 or 3 times in the past few years?
>>
>>55261456
F# is fucking gross desu it's like they reversed every good design decision from OCaml and then repeatedly raped the language with a horse's dick covered in shit
>>
>>55261669
+ is polymorphic:
(avg [(BigInteger. "9223372036854775807") (BigInteger. "9223372036854775807")])

Yields 9223372036854775807, as expected.

Code is correct.
>>
>>55258695
I too went to school in Canada
>>
>>55261669
>>55261778
You don't even need the
BigInteger
. There's syntactic sugar so that we can say:

(avg [9223372036854775807N 9223372036854775807N])
>>
>>55261729
cute but that's not even possible in Ocaml, not to mention you need to use 2 different operators for addition (int and float), also not having unsigned integers

ocaml only has modules going for it
>>
What's the best way to get into an Open Source project? Should I just look in the bug reports and pick something to try and fix?
>>
>>55260364
That took a lot longer than expected - guess I got rusty.
Only got the list done, dunno if I have time tomorrow, but I'll eventually get to it and do the tree as well.
Did my best to make the implementation easy to understand and might further improve upon it later.
I'll have a nap for now, oyasuminasai~.
>>
File: lain38.jpg (53KB, 1044x957px) Image search: [Google]
lain38.jpg
53KB, 1044x957px
>>55260315
Scheme has a couple of CLOS integrations. Meroon is nice, for example. It's also simpler, and many consider it to be more elegant. It has no standard implementation though, and (older) libraries sometimes rely on certain implementations. It also comes with a hygenic macro system, but that'll only get interesting for you later.

There's also Racket, which is almost Scheme, but doesn't adhere to the standard. It has a really big standard library, superb documentation and a great guide. I'd recommend you start with this one, if you want to just start programming Scheme.

Common Lisp was designed for real world usage, in contrast to Schemes focus on being small, simple and elegant. It's a great language with a big ecosystem, good compilers, and a big standard where everything you'll need is defined (the CLHS).

All of those languages are worth learning, it's more a question whether you want to learn Lisp to learn more about PLT, or to learn Lisp to write applications. For the first, Scheme is clearly what you want, and for the second it would be CL. Even though Scheme is by no means unusable for real-world-applications.

>>55261729
Hi.
>>
>>55261918
That or talk with one of the devs.
>>
File: trashgame.png (73KB, 1408x620px) Image search: [Google]
trashgame.png
73KB, 1408x620px
>>55259002

I'm doing the "make a rogue-like" thing that people do. It's at around 4,000 lines of code, but it needs refactoring. It's pretty fun to make and has taught me that I didn't know some things I thought I knew.
>>
Hey guise, I don't know shit about programming but I'm thinking about learning and changing my job.
2 questions (I figured here was a good place to ask) :
- does age matter? (I'm 35)
- do you think this web dev formation (in 3 months) looks good : http://www.numericall.fr/webforce3-une-formation-vers-lemploi/#webforce3-formation-appliquee ?
(it's in french but there's a list of the different teachings near the bottom of the page)
- is web dev a good option at all nowadays?

Thanks in advance.
>>
>>55261910
yeah but that code is gross and nobody sane would ever want to write something like that
half of the reason ocaml is nice is because it tries to stay minimal without putting in all this crazy bloat that doesn't fit into the language
>>
File: 1383360246014.jpg (601KB, 900x2200px) Image search: [Google]
1383360246014.jpg
601KB, 900x2200px
where can I find a list of java commands
or where is a general good java book
>>
>>55262602
https://docs.oracle.com/javase/6/docs/technotes/tools/solaris/java.html
https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javac.html
>>
>>55262640
I feel dumb for not checking the java website
scoured the archive and other websites
thank you
>>
Anyone in here have any passive income from side projects? Any advice for taking this on?
>>
EE here, I kinda want to learn about compilers. Anyone have any good materials?
>>
>>55262927
https://en.wikipedia.org/wiki/Compilers:_Principles,_Techniques,_and_Tools
>>
>>55262927
SICP and EOPL can teach you a ton. also try going through the LLVM kaleidoscope tutorials. try to find projects on github too, as long as they're not huge you can learn a ton just by reading the compiler's source code.
>>
>>55262529
you could've just said you don't understand what's going on, that would be easier
>>
>>55263119
it's not about not understanding it, F# just gave up on trying to stay simple and elegant
>>
>>55253746

Just getting back into programming, making some VBA scripts for Excel for work.

Is there any way around using loops when running find and replace commands in VBA? It makes the script I'm running a lot slower.
>>
>>55263381
continuations
>>
I wonder, does anyone outside of Slavland on /g/ use Nette?
>>
>>55263145
It's a recursive polyvariadic function

It's about the choice it gives you (which is important in a functional language)

Here is the other way

type Prob =
static member average([<System.ParamArray>] args: int[]) =
(Array.sum args |> float) / (args.Length |> float)

>Prob.average(1,2,3,4,5,6);;
val it : float = 3.5


of course you can just take in a list directly and be done with it
>>
Any recommendations on how to collect bug reports? Using C# in the event that anyone has specific experience that would cater to the question. I've done a bit of research but I like when technical aspects are laid out AND an opinion is given--haven't found many personal opinions, so that's what I'm primarily looking for.
>>
>>55263571
As in from random users of the program somewhere with a network connection?
>>
>>55261725

The first I accidentally posted in the email field, so had to change that. The second time I can't remember why I had changed it, and now can't remember it. The third I still use while on mobile, but I currently use this one everywhere else because I had a friend offer to generate me one, and I rather like it.
>>
>>55263478
I get that much, I just don't think it's a particularly elegant solution to the problem. The only way that seems really nice to me is still to do it through dependent typing. That shit honestly looked more hacky than the weird typeclass tricks people use in Haskell to do polyvariadic functions. Using a list or ParamArray seems a lot more sane.
>>
>tfw you don't understand why a bug happened until after you fix it
I was working on a game and having a weird carry-over/pop-up thing going on with lateral movement, and I correctly pegged the root cause: there can be a bit of fudge in that movement, and the structures in question are exactly as far apart as the player is wide, so you could be slightly too far over. I just now realized the pop-to-top version was happening because of the gravity I recently implemented, because it does a vertical alignment check. Since the player has walked off the structure they were on, the game makes them fall. The other structure is not just next to the first one, but also low enough for the player to run into it when walking off the first structure.
So:
- the player gets fudged into the other structure
- the fall starts
- the game immediately detects a collision
- this happens right after falling
- because of the context the game it corrects it by putting the player on top of the structure collided with
I fixed it by putting in the same lateral movement corrections I had for collisions while walking, but switched around left to right, and set to run when the player walks off something.
>>
What's /dpt/'s opinion on D? Would D be the good next go-to language for everything ranging from desktop applications to games?
>>
>>55264066
D failed. It's over.
>>
>>55264107
Please elaborate. Did Rust really kill it?
>>
>>55263598
yes
>>
>>55254174
ints in C are not integers
>>
>>55262529
> tries to stay minimal
> has multiple definitions of the same function for different types

kek
>>
>>55262927
read sicp
read books on implementing forth

write lots of small compilers and interpreters
>>
>>55264198
Buy a domain, if none at hand, and simply set up a server that pushes JSON PUT requests to a DB. Hardcode this domain into your program and send the data over, when something happens. Email notification from the server would be nice too.
>>
>>55262960
why would he want to learn obsolete technology?
>>
>>55264280
so your preference is an edge case in the compiler for that one function? how is that not more complexity?
>>
>>55264311
No, my preference is for a language core that doesn't go for minimalism to the point that the burden of code duplication is pushed onto the user.
>>
Did a first "real" 64-bit build of a spare-time project I'm working on. Instantly noticed the skydome was fucked up. It was rendered incorrectly and then cut off from the middle. Worked perfectly in 32-bit builds.

After some digging I found out why. I was storing the index buffer in std::vector<size_t>. Then, when setting the index buffer contents, I used sizeof(size_t) as the stride. size_t is 32 bits in 32-bit mode, and 64 bits in 64-bit mode. So the stride was 8 bytes in 64-bit builds, but I specified GL_UNSIGNED_INT as the size. Of course that mess only works in 32-bit mode. I changed the type to uint16_t and size to GL_UNSIGNED_SHORT and now the skydome works in 32 and 64 bit builds.

Quite embarrassing fuck-up on my part, to be honest.
>>
>>55264302
I like this idea. Luckily I own a domain. Thanks boo
>>
>>55264326
since you fucked up, you gotta give me dome

are you a trap
>>
>>55264066
It's the only language I use anymore because I'm so damn productive in it. You can use it for high-level scripts, low level bare metal, small 1k-line projects, medium 100k-line projects, large 1m-line projects... There's no need to use any other language if you don't want to. The only other language I've used that has the same power and expressiveness of D is Lisp. D replaces and improves on Perl, C, C++, Ruby, Python, Java and many other languages.
>>
>>55264320
there is no burden of duplication though. you can write code that's generic over any types with any interface (just like in Haskell).
module Main (N : Num) = struct
open N
let do_some_math a b =
a + (b / a)
end

but since it's not a weird edge case, this type of code can be written for any interface (like monads, etc.).
>>
>>55264354
I guess all the OCaml memes are out of date then
>>
>>55264349
I remember getting that feeling with Nim/Nimrod.

I got annoyed at random compiler bugs (that are probably long gone by now) and stopped using it however.
>>
Someone give me a new programming language to learn, I tried learning some x86 assembly and making a simple operating system, but realized I just want to do userspace stuff. Please I just want something new.
>>
>>55264503
Haskell
>>
Are there any languages that compile to webassembly yet? I was thinking about making one.
>>
>>55264521
C/C++
>>
>>55264503
forth
or prolog
>>
>>55264521
I started a Scheme that compiled to wasm a while back but I never finished implementing macros.
>>
>>55264575
Sorry I should have mentioned, besides C/C++ which is what they are using for reference I guess?

>>55264593
Basically I'm too lazy to do my own research so I'm asking of wasm is mature enough that I can make a compiler targeting it or if there's no point yet.
>>
>>55264588
>>55264513
Thanks alot! I'll be looking at Forth
>>
Who actually gets paid to program here?
>>
>>55264812
sup
>>
>>55264812
I use programs to automate my sysadmin job. Does that count?
>>
Is there no way to do bitwise operations on a struct in C++?
>>
File: braveclojure.png (104KB, 900x900px) Image search: [Google]
braveclojure.png
104KB, 900x900px
>>55264503
http://www.braveclojure.com/
>>
>>55264899
Yes
>>
>>55264899
Make your own function to do it member by member, operator overload it and you're set.
>>
>>55260196
use threads and get one of those huge proxy lists, then use each thread to scrape different parts, put a timeout on them and cycle to proxies that have already worked if they fail
>>
>>55265017
Interesting. I've been working on setting up a tor relay and then renewing ips on that. But this could also work.

I'm assuming you mean threaded processes?
>>
>>55265105
I think its easier and quicker than using tor, maybe less secure if you don't want chinese proxy owners storing your ip

>I'm assuming you mean threaded processes?
I think?

>Both processes and threads are independent sequences of execution. The typical difference is that threads (of the same process) run in a shared memory space, while processes run in separate memory spaces.

just found this out, don't know which one would be better to use, i normally use threads
>>
>HUR DUR MUH TYPE SAFETY [RETARD NOISES]
God, fuck off you memers.
>>
>>55256090
>3D game engines
>Niche
k
>>
>>55257114
I've checked it m8, there's nothing fucky going on.
>inb4 hur dur muh vtables
>>
whats the fanciest and cleanest way of taking a collection of strings and joining all but one of them with the same delimiter and using a different custom phrase for the last string join
>>
>>55265699
intersperse
>>
if (auto [x, y, z] = f(); x.IsValid()) {
...
}


who /c++17/ here?
>>
>>55265644

I would like to think that there exists a happy medium of type safety that lies somewhere between Ada's anal retentiveness and JavaScript's complete lack of caring.

>>55265699

Like this?
def custom_join strs, delim, fdelim
"#{strs[0..-2].join(delim)}#{fdelim}#{strs.last}"
end
>>
>>55265765
Did they just approve structured binding?
>>
>>55265795
Yes. And a neat little addition to the if-statement syntax:

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0305r0.html

I love cutesy little additions like this. Makes everyday coding just a little nicer overall.
>>
>>55265840
I thought they were still proposals, when were they approved? Why [] and not {}?
>>
>>55257134
rakastan tätä kuvaa
>>
>>55265858
Just this week: https://www.reddit.com/r/cpp/comments/4pmlpz/what_the_iso_c_committee_added_to_the_c17_working/

>Why [] and not {}
Probably because the C++ grammar is an ungodly abomination beyond salvation.
>>
>>55265922
>you can now do total patterns in C++

auto [x,xs] = list.split();
>>
machine learn your porn habits:
https://github.com/pornsieve/porn_sieve
>>
>>55265944
hnnnggg
>>
File: eggplant.png (288KB, 1639x1080px) Image search: [Google]
eggplant.png
288KB, 1639x1080px
>>55265963
>pic related has never been more relevant
>>
>>55265944
or rather
if (!list.empty()) {
auto [x,xs] = list.split();
...
}

being that head/tail is a partial pattern
>>
>>55265974
here's another one

auto [ r, g, b, a ] = 4vec.tuple();
auto [ x, y, z, w ] = 4vec2.tuple();
>>
>>55265993
>4vec
you don't know how identifiers work, do you?
>>
>>55266015
it's a sample, i changed it from vec4 but didn't want to do vec42
>>
>>55266024
>damage control
>vec42
>I'm so retarded I can't think of another possible name
>>
>>55266102
i wanted to make it clear the type was vec4 but it was a different variable
>>
>>55266102
autismus maximus
>>
>>55264812
I will do as of tomorrow
>>
>>55266128
you're mentally ill?
>>
>tfw wanted to buy an ARM dev board to test my gnu turd kernel but gambled the BTC away
eh it was fun I guess
>>
>>55253746
Is Xamarin enough to get me through a programming class using C# in uni or do i need to go parallels with the botnet10 dev environment?
>>
>>55266329
Xamarin is nice for basic things like really simplistic app development in C# and mono is good for basic console applications, but I'd never use anything other than visual studio personally.
>>
I made a program that is supposed to solve Exercise 1.19 of The c the programming language.
Is this any good or?

#include <stdio.h>
#include <stdlib.h>


struct sstring
{
char *str;
int strlen;
};


struct sstring *get_line();
void revererse_str(struct sstring *str);

int main()
{
struct sstring *str;

while ((str = get_line())->strlen != 0)
{
revererse_str(str);
printf("the text reversed text that was read is %s \n", str->str);

free(str->str);
free(str);
}

return 0;
}

void revererse_str(struct sstring *str)
{
char *start = str->str;
char *end = start + str->strlen - 1;
char temp;

while (end > start)
{
temp = *start;
*start = *end;
*end = temp;

++start;
--end;
}
}

struct sstring *get_line()
{
int buff_len = 8;

char *str_buff = malloc(buff_len * sizeof(char));
for (int i = 0; i < buff_len; ++i)
str_buff[i] = 0;

struct sstring *str = malloc(sizeof(struct sstring));

str->strlen = buff_len;
str->str = str_buff;

int c, j;
j = 0;

while ((c = getchar()) != EOF && c != '\n')
{
str->str[j] = c;

if (j + 1 == str->strlen)
{
str->strlen *= 2;
str->str = realloc(str->str, str->strlen * sizeof(char));
}

++j;
}

if (j + 1 == str->strlen)
str->str = realloc(str->str, (str->strlen + 1) * sizeof(char));

str->str[j + 1] = '\0';
str->strlen = j;

return str;
}
>>
In C/C++, is it portable to typecast an enum to an int to do some bitmask stuff on it?

>inb4 just use an int in the first place
It's from a library, one of their functions take a bitmask of enum type, yet the compiler complains about int conversions if I try to do bitwise stuff on it, so I have to typecast to int and then typecast back to their enum type.

In case you're wandering, the library is libmpdclient and the enum in question is mpd_idle.
>>
>>55266569
depends on the underlying type
>>
>>55266329
>programming class
Any editor would probably be fine. Xamarin is alright.
>>
Two questions: first, C or C++? I've been using both for 10 years (extensively), to the point where I can honestly tell I know C++, I am very familiar with both, but I still cannot decide; I just want to end this conflict already.

On one hand, C++ has a lot of nice features, but the fuck huge compilers mean that it isn't available everywhere, and that I often don't get up to date compilers for wangblows, and C's bare bones syntax means that I can more easily generate and parse code myself (essentially making macros), but the lack of features sometimes means the code is mom's spaghetti (or at least big), and what is done in 10 lines in C is done in 3 in C++. If I could fix that one problem, I would go with C any day; I like simplicity, but I like simplicity that lets itself turn into complexity even better, and that's why LISP is best language.

Keep in mind I'm choosing between these two because they are fast; I'm mainly looking for something compiled that has a minimal background environment to it (no things like garbage collection, dynamic types, and stuff like that), but every other language seems to fail at one of those.

Any books on techniques and suggestions for writing C well? What about books about handling errors and exceptional cases in C?

Send help!
>>
>>55266645
Write your own language that compiles to C?
>>
>>55254071
template<typename T, typename... Args>
T mean(Args... args)
{
auto n = sizeof...(args);

T sum;

for (auto value: {args...})
sum += value;

return sum / n;
}
>>
>>55266757
>requires explicit template arguments
>>
>>55266757
>>55266776
>doesn't necessarily 0 initialise
>>
>>55266784
Ops, forgot.
>>
File: 1300044776987.png (150KB, 255x293px) Image search: [Google]
1300044776987.png
150KB, 255x293px
>tfw you've been scraping websites only using a clusterfuck of String.IndexOf and String.Substring and realize Regex is a thing
>>
>>55267021
>regex
>not trash
pick one
>>
>>55267021
Parsing html tags with RegEx is even more painful desu.
>>
>>55267021
>not simply traversing the DOM tree
The fuck are you doing?
>>
Does anyone know how do you get the variable you want in an xml document using javascript?
There is getAttribute() where I can loop through everything until I find the right index, and I can use regex, but both those methods is undesireable.

my xml looks like
<span id='generated' name='target'>
<subspan>value</subspan>
<span>


I would like to get the value based on the string 'target' and the tag name 'subspan'
How is that possible?
>>
>>55267021
it's better to avoid regex
especially if anyone else might look at your code
because if there's regex the barrier of entry goes through the roof
>>
>>55267100
string split right on the value "name='target'>"
string split right on the value "<subspan>"
string split left on the value "</subspan>"
>>
>>55267100
xpath
>>
I've had an exam in lexical and syntactical analysis today, with compiler construction more to go.

Does anyone here work in these two spheres of software engineering? What are the current and on going projects at your companies? What do you do in those projects?
>>
>>55262981
>EOPL
wat?
>>
>>55267172
how do you use that?

As far as I read the documentation it is something like
  var parser = new DOMParser();
var txt = "xml"
var xmldoc = parser.parseFromString(txt, "text/xml");
var nodes = xmldoc.evaluate('/span[0]/subspan[0]', getter, null, xmldoc.ANY_TYPE, null);
var value = nodes.iterateNext();


but how do I target the attribute value?
>>
>>55267040
>>55267140
regular expressions are great, but only if you're trying to parse a regular language.
>>
>>55266498
I think the logic in your getline might be a bit off. You ++j at the end of the while loop and after it falls through you check j+1 and place the nul in j+1, which means its two past the end of the string not one. You'll have an extra character at the end of your string.
>>
>>55267318
brah just tread the xml as one big string and parse it like a normal string
you don't need to use some library or read documentation for such a simple task
>>
>>55267272
Most (interesting and well used) compilers are developed by open source communities and universities. I've never heard of anyone writing compilers for companies since the 90's.
>>
>>55267346
xpath is not really a library...
And the advantage of doing it this way is that it becomes possible to replace values as well.
It must be possible to do it based on the logical structure that is xml.
>>
>>55267339
Thanks for pointing that out ^^ I missed that I always tend to get off by ones like that >.<
>>
mäkään en juo koskaan
>>
>>55267318
with @
http://stackoverflow.com/questions/4531995/getting-attribute-using-xpath
>>
File: 260616-1437.png (439KB, 4000x2560px) Image search: [Google]
260616-1437.png
439KB, 4000x2560px
Trying to make a keygen for this program, taking quite some time to reverse engineer. But I really hate CPP templates, so horrid to reverse.
>>
>>55267649
why not just patch the authentication?
I never really got why so many people are interested in keygens
to me, the only reason to want to make a keygen is if you want to sell keys
otherwise it's a fuckload easier to just patch the thing
>>
>>55258988
my cs prof last semester made us do an AVL tree implemented in C++ with a vector ( couldn't use pointers )

Was pretty much hell
>>
    std::ifstream file("shader.module", std::ios::binary);
std::istream_iterator<uint32_t> start(file), end;
return std::vector<uint32_t>(start,end);

Why is std::distance(start, end) coming out as 0 (i.e. the file is empty, start==end)? If I read from the ifstream directly then it is fine, there's clearly data in it, but reading from the istream_iterator is empty.
>>
>>55267649
What would I need to know in order to make keygens for a program? How do key's and keygens even work?
>>
>>55267848
Welp, I worked it out. I was trying to read binary data and istream_iterator was trying to read formatted data.
>>
>>55267716
First no challenge in that. Second, if you patch the main binary and it has a signature windows will not load it. However, you can have an in memory patcher which executes everytime to bypass licensing. Fourth, most modern binaries aren't a simple patch this compare, and the verification is all over the binary and checks frequently throughout the execution of the main program (in essence, a lot more reversing work to do, to find all the obscure places where checking is done). Lastly, only 1337 cr4ck3rs can create keygens, script kiddies can't as it requires you to fully understand ASM, and the underlying OS, and then figure out the crypto and custom encryption they use for licensing). Fun stuff...
>>
File: keanu mfw.jpg (71KB, 587x545px) Image search: [Google]
keanu mfw.jpg
71KB, 587x545px
>>55267815
i'm pretty sure everyone does that in data structures 1
>>
File: pepe the frog.png (198KB, 550x535px) Image search: [Google]
pepe the frog.png
198KB, 550x535px
>page 202 of SICP
>still nothing dealing with anime girls
>still really boring
i feel misled
>>
>>55268133
lol'd
>>
>>55267100
ffs... it was the xml name space that for some reason broke the xpath...
Now it works... Thanks to everyone.
>>
>>55267953
> How do key's and keygens even work?
E.g. you type your name/serial/activation-code (obtained from purchase) into the register screen of whatever program. It does a ton of encryption/obfuscation on the inputs. And it expects the final stuff to match up.

Easier said than done though, as usually you can't just do a simple compare at the end, as checks are done all through the licensing algorithm. So you need to understand how to get good passes on all the checks, and generate keys based on passing those checks. Again easier said than done..

> What would I need to know in order to make keygens for a program?
You'd need to understand ASM and encryption. As the compiler for the target software does lots of optimizations, but makes your life hell (what is a simple strlen() could be done in an obscure way just to gain some performance in terms of cycles). You'd also need to know e.g. C, C++, if you want to then implement your understanding of the target software licensing algorithm, easiest to translate ASM back to C.
>>
>>55267953
for programs that don't connect to the internet, a valid key is one that follows a certain set of rules (e.g. is 16 letters long, only consists of 1-9 & A-F, the first number times the second number equals the last number minus the fifth number, etc, etc, etc). so to generate a valid key you need to know all of those rules. to know those rules, you can look at the disassembly of the program that checks the key and see what rules it's checking the key on. if a program connects to the internet for key validation, you're pretty much out of luck because a company can just create arbitrary keys, store the list of all valid keys online, make you pay for a key, and then remove that key from the online 'valid key' list once it's been used.
>>
File: coding.jpg (140KB, 869x1776px) Image search: [Google]
coding.jpg
140KB, 869x1776px
>>
>>55268269
>for programs that don't connect to the internet, a valid key is one that follows a certain set of rules (e.g. is 16 letters long, only consists of 1-9 & A-F, the first number times the second number equals the last number minus the fifth number, etc, etc, etc). so to generate a valid key you need to know all of those rules. to know those rules, you can look at the disassembly of the program that checks the key and see what rules it's checking the key on.

I always thought that whatever happens to a key once punched in is much more complicated, especially when I learned about cryptography.
>>
>>55268221
Why don't publishers just use SHA-256 with random number + some secret salt?
>>
>>55268296

>employed
>unemployed
>>
>>55268309
It is much more complicated.
>>
>>55268133
>he fell for the sicp meme
>>
>>55268316
It would provide no benefit in doing so.
>>
>>55268309
It could be. Or it could not be. Completely up to whoever made the program.

>>55268316
And then what? I input my key, it gets hashed and salted, and then compared to what exactly?
>>
do you guys think a computer science ebook series with drawings of chinese cartoon girls marketed to grown men would do well?
>>
>>55268269
>>55268338

For these types of online activations. You can create a local server, that serves up responses expected by the program. Again you reverse the main binary, see how it de-obfuscates/decrypts the server response, and you replicate it. Same concept as keygenning, figuring out what the inputs need to be.
>>
>>55266573
>The underlying type of an enumeration is an integral type that can represent all the enumerator values defined in the enumeration. It is implementation-defined which integral type is used as the underlying type for an enumeration except that the underlying type shall not be larger than int unless the value of an enu- merator cannot fit in an int or unsigned int. If the enumerator-list is empty, the underlying type is as if the enumeration had a single enumerator with value 0. The value of sizeof() applied to an enu- meration type, an object of enumeration type, or an enumerator, is the value of sizeof() applied to the underlying type.
So I guess it's portable as long as I only do bitwise stuff using the enumerators rather than magic numbers.
>>
>>55268406
e.g.
serial is structured like this:
AAAAA-BBBBB-CCCCC-DDDDD-EEEEE

first two blocks of five are the challenge

the publisher concatenates A-B with their 'secret', and hashes it to ascertain C-D-E.

if the key entered by the user matches a key that hashes A-B-blocks to C-D-E it is valid.

The 'secret' is essentially public because its readable from the disk, but its pretty much the same as with any other keygen.
>>
>>55268505
in C++17 I think you can specify an underlying integral type
I'm pretty sure at least
You could always do it in MSVC++
>>
File: llvm.jpg (961KB, 1024x1016px) Image search: [Google]
llvm.jpg
961KB, 1024x1016px
>>55268433
There are multiple series like that already. I don't think you can do better.
>>
>>55268519
Yeah but I didn't define the enum so that's out of my control.
>>
>>55268532
that's written in moon you dip
>>
>>55268538
you can sizeof() an enum
>>
>>55268546
You never specified the language, you stupid fuck.
>>
>>55261023
Amazing
>>
>>55268556
Yeah so? that won't solve anything.
>>
>>55268559
literally only 830 people speak japanese worldwide, of course it'd be written in english and targeted to weebs
>>
>>55268559
Haskell
>>
>>55268433
I would buy them
>>
I wanna learn (my first) functional language, but not haskell.

What should I pick up?

OCaml? Clojure? F#?

Which one is best for getting real werk done.
>>
>>55268577
Don't talk to me or my wife's son ever again.
>>
File: anime girl reading sicp.png (655KB, 777x1028px) Image search: [Google]
anime girl reading sicp.png
655KB, 777x1028px
>>55268586
>>
>>55268573
someEnum e;
char x[sizeof(e)] = &e;
>>
>>55268606
oh wait you can't assign arrays

well you get the point I hope, treat &e like a char* with sizeof(e) chars
>>
File: 61TpiHqMS8L.jpg (66KB, 379x500px) Image search: [Google]
61TpiHqMS8L.jpg
66KB, 379x500px
>>55268546
And this series isn't.
>>
>>55268627
the girls aren't cute though, my girls will be cute
>>
>>55268518
That should be a valid way of doing it as far as I can see. The tradeoff is that it's easy to implement, but also easier to reverse (just extract the secret). And it has 256 bits of characters extra that the user has to type in.
>>
>>55268573
template <typename T>
using UnderlyingType = typename std::underlying_type<T>::type;

template <typename Enumeration>
constexpr auto as_integer (Enumeration value) -> UnderlyingType<Enumeration>
{
static_assert(std::is_enum<Enumeration>(), "Parameter is not of type enum class, or enum.");

return static_cast< UnderlyingType<Enumeration> >(value);
}


This is as portable as it can get, I guess.
>>
>>55268660
>static assert
>not enable if
>>
>>55268518
>>55268653

And what if the corporate proxy for most businesses blocks that traffic? Or internet traffic is managed on another network not connected to the work network to keep it secure? Or one day your intenet goes down, and what, you can't access the software until it comes back up?

Licenses need to be practical. They need to work offline, or that software is not going to be purchased by many companies, or people who are offline. Why do you think MS Office, Adobe Photoshop allows offline activation (using phone to get activation code).
>>
>>55268653
>That should be a valid way of doing it as far as I can see. The tradeoff is that it's easy to implement, but also easier to reverse (just extract the secret).
Yeah I guess it'll be telling if you call out to OpenSSL

>And it has 256 bits of characters extra that the user has to type in.
You can just reduce it to 15 base 36 characters which still is 221073919720733357899776 combinations, i.e. 77 bits
>>
>>55268687
But it is offline
>>
>>55268660
ew
>>
>>55268118
AVL tree I understand, but why vector implementation?
>>
>>55268737
because arrays are always better than making structures with pointers. in the real world, people use arrays
>>
>>55268689
>You can just reduce it to 15 base 36 characters which still is 221073919720733357899776 combinations, i.e. 77 bits
True and I guess you might as only check against the first/last 4 bytes because chances of some other secret producing the same output is still close to non-existant.
>>
>>55268705
Huh? And where are the secrets stored ... in the binary? The very thing we are analyzing?
>>
>>55268737
it's a lot like using pointers but with a controlled region in memory
>>
I'm entering my 3rd year as a CS major... feel like I don't have a general grasp on CS; I can figure out things, and I have gotten an A in all my CS related classes so far, but browsing any kind of CS forum or doing anything more complex than data structures loses me. I've been trying to study on my free time lately, mostly just reviewing basic C++ and Python because my skills have decayed some over the summer, but still feel like I have a super rudimentary grasp on things. Is this normal?
>>
>>55268684
>>55268736

template <typename T>
using UnderlyingType = typename std::underlying_type<T>::type;

template <bool condition, typename T>
using EnableIf = typename std::enable_if<condition, T>::type;

template <typename Enumeration>
constexpr auto as_integer (Enumeration value) -> EnableIf< (std::is_enum<Enumeration>()), UnderlyingType<Enumeration> >
{
return static_cast< UnderlyingType<Enumeration> >(value);
}


Beautiful imo. :^)
>>
>>55268805
Pervert!
>>
>>55268782
Yes, CS is a huge field and honestly 4 years of formal education isn't enough to make you an employable programmer, in my opinion. That doesn't mean you're not gonna get a job, but don't be too surprised if you do bad at it for even a few years after graduating. And you'll be bad at your next job after that too, for a couple of months.
>>
>>55268769
Yeah, the 'secret' is in the binary.
The only difference to conventional keygens is that the key is data, not a homebrewn algorithm.
>>
>>55268805
Disgusting
>>
>>55268805
>
constexpr auto as_integer (Enumeration value) -> 

What's the arrow called in C++?
>>
>>55268826
That's fine, I am fine with being "bad" for a while as long as that is the standard - just making sure this is normal and I'm not a retard for feeling like I understand very little of the whole field
>>
>>55268850
That's a trailing return type.
>>
>>55268433
sure.
https://vndb.org/v7754
>>
>>55268827
But data is easy to find. E.g. 256bits worth of contiguous ASCII. When the majority of ASM instructions are non-printable chars, it's not difficult to find strings like these.

Custom algorithms are hard to figure out, especially when you can turn on obscure compiler flags to make the ASM look like shit, but it still executes fine.
>>
>>55268586
javascript
>>
File: 1438706413584.jpg (14KB, 310x464px) Image search: [Google]
1438706413584.jpg
14KB, 310x464px
auto generation is great until you get auto generated stuff that depends on other auto generated stuff
>>
>>55268586
F# has better learning resources imo

https://fsharpforfunandprofit.com/
>>
>>55268861
I think some compilers have issues with enable_if in trailing return types, but it might just be me
>>
>>55268805
What does std::enable_if do and what is it doing in your code?
The reference made no sense to me.
>>
File: image_9.jpg (90KB, 780x503px) Image search: [Google]
image_9.jpg
90KB, 780x503px
Hey /g/, Java/Python fag here.

I want to learn C++ (because I wouldn't mind making a dead simple ge over the summer months). Are there any books on C++ that you'd recommend for someone who's new to that language?

Sorry in advance if you get this question too often.
>>
>>55268885
It's a template that fails to instantiate if the first parameter is false
>>
>>55268904
if you know java don't bother buying a book on C++, just google what you need to know or read an online tutorial to see what the boilerplate is
>>
>>55268871
Yeah you're right.
But the whole concept of keygenning is trying to solve a (to me seemingly) impossible problem.
You cannot block specific access attempts if you don't control the complete system.
This would probably be possible with TPM, but that's harshly violating the rights of a customer, in general I find DRM (digital restrictions management as GNU likes to call it) disgusting.
>>
>>55268861
Why are they needed in this case?
>>
>>55268907
Yeah, and it's actually pretty neat to look at how easy it is implemented.
>>
>>55268805
>
template <typename T>
using UnderlyingType = typename std::underlying_type<T>::type;

template <bool condition, typename T>
using EnableIf = typename std::enable_if<condition, T>::type;

use std::enable_if_t and std::underlying_type_t

template<typename Enum>
constexpr auto as_integer(Enum val) ->
std::enable_if_t<
std::is_enum<Enum>::value,
std::underlying_type_t<Enum>
> {
return static_cast<std::underlying_type_t<Enum>>(val);
}
>>
>>55268936
Not necessarily needed in this case, just a matter of preference.
>>
>>55268990
use std::experimental::is_enum_v<Enum>
>>
NEW THREAD!!!

>>55269029
>>
>>55269020
i considered it but decided not to because >experimental

this is_x<T>::value/::type stuff is really ugly in c++
>>
>>55269090
_t and _v typedefs don't look much better, rather specify my own ones.
>>
>>55268925
> But the whole concept of keygenning is trying to solve a (to me seemingly) impossible problem.
Not quite. The algorithm to check the license is right their in the ASM, you just need to figure it all out, to pass all the checks in the algorithm with inputs that pass those checks, i.e. a valid key.

> You cannot block specific access attempts if you don't control the complete system.
You can try, you can add anti-debugging in and stuff, but once you understand reversing, you can also bypass these.

> DRM
Will eventually be solely on higher signed policies from boot on Win10. Only signed drivers and signed code is allowed to execute in that mode, and DRM will only play in that environment. Hence your custom video capture tool, won't execute in that secure OS.
>>
File: 1465615989783.png (209KB, 510x346px) Image search: [Google]
1465615989783.png
209KB, 510x346px
>>55268919
I wasn't gonna buy a book anways, I was probably going to use bookz or something.

I just thought a book would be a good introduction, and then I'd start googling more specific stuff.
>>
>>55268047
>Second, if you patch the main binary and it has a signature windows will not load it.
What?
Can you give an example of a program like this?
I've never seen this before
is it a new thing in windows 10?
>>
>>55269358
Let's take it to the new /dpt/

Firing up a VM to show you..
>>
Does anyone know a good library to use for socket communication between a website (javascript) and a server application (c++)?
>>
>>55265235
That's neat. But how would I go about finding a list of proxies?
Thread posts: 330
Thread images: 32


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