[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: 314
Thread images: 30

File: C++.jpg (105KB, 603x324px) Image search: [Google]
C++.jpg
105KB, 603x324px
Old thread: >>55688901

What are you working on, /g/?
>>
First for web development
>>
first for superior OOP programming style
>>
Sorry /dpt/, I might learn the web dev meme
Apparently it makes you like 5 times more employable
>>
C++ and lua game engine. Its going pretty well you could even make pong with it
>>
Turing machine ... screensaver. For... uh... science.
>>
>>55699322
In case you migrate over, I just want to make sure you see me blowing you the fuck out
>>55699414
>>
>>55699354
it even pays much better, at lest in Europe
>>
>>55699419
Delete your post. You're fucking embarrassing yourself.
>>
>>55699481
Okay my backpedaling friend
>>
File: Capture.png (9KB, 408x269px) Image search: [Google]
Capture.png
9KB, 408x269px
>Both of them have a reference to the same C object
>Both of them have a reference to the same C object
>Both of them have a reference to the same C object
>Both of them have a reference to the same C object
>Both of them have a reference to the same C object

He just doesn't want to admit that he learned that's not how OOP works today
>>
File: emilia-what-is-that.gif (2MB, 400x400px) Image search: [Google]
emilia-what-is-that.gif
2MB, 400x400px
>>55699541
>>
>>55699541
>do_something()

No such method exists for class 'A'.
>>
>>55699584
Baby doesn't class members work
>>55698768

>>55699587
He said it was a typo, so I'll be nice and give him that
>>
ffs OOP is a tool its good for some things and bad for other...
>>
File: 1407241549728.png (445KB, 807x700px) Image search: [Google]
1407241549728.png
445KB, 807x700px
I'm going to leave this here:
https://www.youtube.com/watch?v=QM1iUe6IofM
>>
>>55699541
don't bring that shit in the new thread, ffs
>>
File: 1438275792231.jpg (50KB, 502x370px) Image search: [Google]
1438275792231.jpg
50KB, 502x370px
>>55699636
>>
>>55699636
WHOA HOLD UP AND REFRAIN FROM DOING THAT HERE
WE ARE NOT SUPPOSED TO MAKE ANY SENSE
>>
>>55699322
Thank you for not using an anime image
>>
>>55699636
No, everything must be good or bad.

Preferably, things that are bad are completely bad because of a small issue I have with it.

Things that are good are things I am already predisposed to like, based on a sense of superiority in using that thing via attribution to individuals I respect or an image I would like to portray.
>>
is there a C++ book about data structures beyond STL ? like all kinds of trees and shit
>>
File: 1453311921690.jpg (105KB, 720x404px) Image search: [Google]
1453311921690.jpg
105KB, 720x404px
Hello, I'm learning C++ but I can't past pointers and anything related to memory management. Any good book that ELI5?

Thanks
>>
>>55699852
>ELI5
>>>/reddit/
>>
>>55699852
"Pointers on C".
>>
>>55699852
>ELI5
?
>>
>>55699883
>Pointers on C
Thank you
>>55699883

Explain like I'm 5
>>
>>55699759
I would recommend using a language-agnostic data structures book and convert the examples to C++ on your own.
>>
>>55699852
What specific questions do you have?
>>
>>55699759
>>55699915
This, if you are going to just copy paste c++ code from book might as well use library.
>>
>>55699930
I get that you can get the memory address of a variable but how is it useful in real life
>>
>>55699960
>>55699915
> if you are going to just copy paste c++ code from book
I just want to learn from it, that's all

on a recent job interview I was owned with a question like that because I implemented a recursion to build it which they didn't like and I couldn't immediately show something else, and I guess my c++ style was shit too
>>
>>55700002
Very useful. The most important reason for pointers is that they are the only way to access dynamically-allocated memory. Pointers are also used to avoid copying a large piece of data when passing it to a function, but that's better done with references in C++.
>>
>>55700002
Pass by reference to functions
>>
>>55700038
What was the question?
>>
>>55700038
Pick up The Algorithm Design Manual. Then read Cracking the Coding Interview to make sure your knowledge is up to par.
>>
>>55700105
>Cracking the Coding Interview
God, I despise whiteboard "coding"

I wish interviewers would just Google my name, check out my github, check out my kernel patch, ask my previous employers about what I did at the company instead.

I have a fucking master's degree and 5 years of experience as a software developer (7 if you count part-time jobs too), why the hell do I have to prove to you that I can reverse a string without invoking any standard library functions.
>>
>>55700140
>God, I despise whiteboard "coding"
Same, but the reality is that coding interviews are an important barrier to getting a job and thus need to be diligently prepared for.
>>
>>55700058
References are just syntactic sugar for passing a pointer to a function and automatically dereferencing it. You probably know that, mentioning just in case.
>>
>>55699354
Alternatively you could not be a cuck and get into cyber security. Even more employability and you don't have to be a webshit
>>
>>55700191
>Even more employability
Preach it brother, went into InfoSec and got an internship right after my freshman year of college. Now I'm lined up for a full-time job once I graduate.
>>
>>55700188
And references arent replacement for pointers since you cant dynamicaly allocate memory.
>>
>>55700071
apparently it's pretty standard, to build and populate some fucking tree thing but I don't remember the exact question

like I said, I knew what it was in theory but I never fucked with something like that in an actual program so I was slow, too
>>
>>55700140
>why the hell do I have to prove to you that I can reverse a string without invoking any standard library functions.

post your code for it without using array traversal loop.
>>
>>55700488
size_t strrev(const char* input, char* output)
{
if (*input != '\0')
{
size_t n = strrev(input + 1, output);
output[n] = *input;
return n + 1;
}

return 0;
}
>>
>>55700574
wow nerd just call
.Reverse()
on the string
>>
>>55700574
Nice.
>>
>>55700625
>>55700574
>>55700488
Sorry for the delay, I didn't see the post immediately and I had to test if it actually worked so I didn't make a fool out of myself on the Internet.
>>
>>55700603
You're missing the point of the original post.
>>
>>55700640
yeah, and you should have told that anon that he's a nerd and just to use the built-in function
>>
>>55700651
>telling the interviewer that he is a nerd and doing the opposite of what he is asked to do

This is why it is so hard for you to find a job, /g/
>>
>>55700574
>not TCOptimizable

In2theTrash.exe
>>
>>55700640
>You're missing the point of the original post.
you never know, anon
it's very possible that if you were asked this question in an interview that the only acceptable answer is
>just use .Reverse()
>>
>>55700665
Teach us your way then, senpai. Show us the code. In C, preferably.
>>
File: 1426945716186.jpg (52KB, 522x600px) Image search: [Google]
1426945716186.jpg
52KB, 522x600px
>>55699720
>No, everything must be good or bad.
>Preferably, things that are bad are completely bad because of a small issue I have with it.
>Things that are good are things I am already predisposed to like, based on a sense of superiority in using that thing via attribution to individuals I respect or an image I would like to portray.

fuck
>>
>>55700666
>without built-ins/standard lib explicitly stated
>just use reverse :^)

k
>>
>>55700666
There is no String.Reverse() in C, so no, that's not the only acceptable answer, there isn't even a string type. The question was clearly "reverse a string without invoking the standard library function"
>>
>>55700687
>>55700699
>I've never been in an interview!
it's a trap, you're supposed to do the best thing and prove to them why it's the best thing in your opinion
>>
>>55699915
>I would recommend using a language-agnostic data structures book

I want to learn coding and this seems like an amazing idea if possible

can you recommend a book or explain further?
>>
>>55700699

I think he's just jealous. Beautiful recursive solution anon.
>>
>>55700728
See >>55700664
>>
>>55700737
Thank you.
>>
>>55700733
I'm not him but Introduction to Algorithms is a classic introductory book.
>>
>>55700637
Ironically, this is why whiteboard programming sucks. I had to test it to know that it for sure worked, since I don't have a slightest idea how to formally prove my routine using Hoare logic.
>>
>>55700824

thx anon
>>
>>55700737
fuck off nigger
>>
>>55700952
>fuck off nigger

That's based Kenny faggot
>>>/pol/
>>
>>55700963
literally who
>>
>>55700977
Hello newfriend
>>
>>55700963
>based
You fuck off, too, cuck.

>>55700977
A tripfag from two summers ago.
>>
>>55700977
Python guy who used to help a lot in the DPT. He left us when he started working at Edmodo
>>
File: memes.jpg (46KB, 695x431px) Image search: [Google]
memes.jpg
46KB, 695x431px
>>55701063
>Python
>tripfag
Suddenly it all makes sense
>>
>>55701085
>can't even reverse a string in c
>can't even average two ints in c
>thinks his opinion matters
webcuck, please
>>
>>55701085
Meanwhile he's making 6 figures...
>>
>>55701096
who are you talking about?
>>
>>55701113
(You)
>>
>>55701101
>buys a tesla
>"look /g/ no hands"
>dies
>>
>>55701101
I've posted here for over 2 years now.

I make six figures and I don't resort to tripfagging.
>>
File: 1451267160881.jpg (13KB, 267x200px) Image search: [Google]
1451267160881.jpg
13KB, 267x200px
Speaking of Python, what do you guys think about BeautifulSoup? I started using it a few days ago and it looks pretty interesting. Do you guys have any idea for projects I could use it?
>>
I wanna buy a new laptop for dev

I think im gonna get a mac
>>
File: abstract hell.jpg (172KB, 854x853px) Image search: [Google]
abstract hell.jpg
172KB, 854x853px
>Stop working on unofficial API because it's functional and competent, but nobody uses it anyway
>The data source of the API is changed drastically
>My decision to write the entire API as statically typed objects immediately comes back to haunt me as ~4000 lines of code-generated codebase becomes entirely redundant

Fuck, why didn't I just wrap the entire thing generically and let the devs on the other side deal with it.

Who else /LackOfForesightLeadingToImmenseRegret/ here?
>>
>>55701333
BeautifulSoup is great.

However, you should be using APIs if they are available for what you're trying to do.
>>
>>55701333
Webscrapper of some sorts, obviously.
>>
>>55701383
Are you an OpenDNS developer?
>>
how does c++ linker/compiler know where to find header ( aside from /../../goo.h)

also where does the linker now where to look for cpp files when theyre in separate folders ?

>>55701333
4chan image scraper
>>
>>55701426
>scraping the images when the 4chan API exists
>>
>>55701415
No I'm just some self-taught bedroom programming NEET working on some garbage .NET API that about 3 people have used since I open sourced it about 2 months ago.
>>
>>55701426
>how does c++ linker/compiler know where to find header ( aside from /../../goo.h)
>also where does the linker now where to look for cpp files when theyre in separate folders ?

The linker doesn't look for cpp or h files, the compiler does. It looks in a default set of directories for include files, which you can override by setting -I and -i. As for source files (cpp), if you supply the path to them rather than just the filenames, then the compiler will be able to find them.
>>
File: 1386208641268.png (196KB, 342x359px) Image search: [Google]
1386208641268.png
196KB, 342x359px
I want to earn some money on the side with fixing computers. but how the fuck do I get the word out and advertise my services? I distributed over 500 flyers so far in my neighbourhood, im on google maps and Im on the google index. And Im much cheaper than my competitors and I have better opening hours.
so far nothing.
>>
Making myself a personal program that searches 4chan archives, as there is no archive that searches all boards.

Last thread some guy made fun of me for not using an API? I'm new to programming. What the hell is an API? Does the API work on Foolfuuka or just 4chan? Some code below:

System.out.println("What board would you like to search?");
Scanner input = new Scanner(System.in);
String board = input.next();
System.out.println("What would you like to search for?");
String query = input.next();
URL archive = new URL(archives.get(board) + "/" + board + "/search/text/" + query);

//System.out.println(archive);
Connection connection = Jsoup.connect(String.valueOf(archive));
connection.userAgent("Mozilla/5.0");
Document doc = connection.get();
Elements elements = doc.select("div [class=text]");
System.out.println(elements);


Sample output:
What board would you like to search?
v
What would you like to search for?
mario
<div class="text">
<span class="greentext"><a href="https://boards.fireden.net/v/post/345867798/" class="backlink" data-function="highlight" data-backlink="true" data-board="v" data-post="345867798">&gt;&gt;345867798</a></span>
<br>Did... Mario just kill a man?
</div>
<div class="text">
<span class="greentext"><a href="https://boards.fireden.net/v/post/345868386/" class="backlink" data-function="highlight" data-backlink="true" data-board="v" data-post="345868386">&gt;&gt;345868386</a></span>
<br>
<span class="greentext"><a href="https://boards.fireden.net/v/post/345868946/" class="backlink" data-function="highlight" data-backlink="true" data-board="v" data-post="345868946">&gt;&gt;345868946</a></span>
<br>
<span class="greentext">&gt;purchasing the game to make them think this is what Paper Mario fans want</span>
<br>Please
</div>
>>
File: 1467040891129.jpg (68KB, 640x960px) Image search: [Google]
1467040891129.jpg
68KB, 640x960px
>>55701534
Tell your friends about it
>>
>>55701618
Also, I don't know Javascript or HTML.
>>
>>55701534
Website, approach local small businesses to provide them with tech support, tell your friends and family to tell their friends and family.

Nothing more than proactively reaching as many people as you can and waiting for some bites.
>>
>>55701435
well then give a better idea i think its a fun excersise

>>55701481
so when I include a header, the compiler looks for the header in the given directory then, will look for the source files which i somehow (how?) supplied

now two more questions: first, I have to use a build tool after even like 5 modules right ? otherwise it wont be doable to compile from hand ?

also i forgot the second question while typing this
>>
>>55701620
I did. but my whole point is to try to acquire customers without any vitamin B.

>>55701639
I did everything except approaching the business. thinking of buying a small add in the local newspaper.
>>
>>55701618
Jesus christ, Anon.

https://github.com/4chan/4chan-API
>>
>>55701640
>so when I include a header, the compiler looks for the header in the given directory then,
Yes

>will look for the source files which i somehow (how?) supplied
Arguments to the compiler, for example
gcc -o executable file1.cpp file2.cpp ../file3.cpp somedir/file4.cpp


>I have to use a build tool after even like 5 modules right ? otherwise it wont be doable to compile from hand ?
It's easier to use a build script, like Makefiles, yes. It's not impossible without, but it takes a lot of time and especially if your project is expanding and/or you're collaborating with other people.
>>
>>55701663
1. how many competitors are in your area
2. what kind of business are they doing? if they have shops maybe scope outside one you think is popular for a few hours to judge traffic.

computer repair biz isn't quite what it was... people just toss their laptops and get new ones now.
>>
>>55701664
I don't know what this is... I don't know what JSON is...

I don't even know if it works on foolfuuka archives, or just 4chan. It needs to work on all 4chan archives like rebecccablacktech.
>>
>>55701667
thanks for the answers, I originally thought the compiler would somehow on his own look for source and header files

are there any beginner projects that you recommend for cpp learners comming from a java backround ?
>>
>>55701399
>>55701426
Pretty good idea, I'll get to it.
>>
>>55701703
How did you manage to survive so far if you can't research stuff on your own.
>>
>>55701700
judging by google maps maybe a handful in the whole city. by far not as many as it would be too many.

The experience I made is just once you have a customer and you do a good job they gladly rely on you and call you up for everything. Its just the step to convince someone that it is cheaper for them in long run to hire me instead of trying to solve their own problems.
>>
>>55701747
I do research on my own... turns out that link you gave me is useless. 4chan API has nothing to do with what I'm doing. I'm trying to access a third party archive that archives 4chan posts, not 4chan.
>>
just getting into programming, going through ruby and we're doing a basic fighter game program but fuck man, im just not getting it at all. all this right here will just run through battle.fight once and thats it and i dont know how to loop through that sequence until someone reaches 0. the farthest ive gotten was having it endlessly go through it to the point of negative numbers.

require_relative 'bear'
require_relative 'ninja'

class Battle
attr_reader :fighter1, :fighter2

def initialize(fighter1, fighter2)
@fighter1 = fighter1
@fighter2 = fighter2
end

def fight
@fighter1.attack(@fighter2)
@fighter2.attack(@fighter1)
self.battle_status
end

def battle_status
puts "#{@fighter1.name} has #{@fighter1.health} health left"
puts "#{@fighter2.name} has #{@fighter2.health} health left"
end
end

bear = Bear.new('Bearry', 100, 12)
ninja = Ninja.new('Yoshi', 100, 10)
battle = Battle.new(bear, ninja)
puts battle.fighter1.name
puts battle.fighter2.name

# hp = :health

when != 0
puts battle.fight
if :health > 0
puts battle.fight
else :health == 0
puts "WINNER"
end

else
puts "VICTORY"
end


is my battle file and pic related are two other related files (ninja is the same as bear.rb)

please help or at least point me in the right direction, ive been watching videos over loops and thought i knew what was going on but as soon as we get to hashes i just blanked.
>>
Working on parallel processing with Scala. As much as I was prepared to dislike Scala, it is really starting to grow on me.
>>
>>55700574
size_t strrev(const char* input, char* output)
{
if (*input) {
size_t n = strrev(input + 1, output);
output[n] = *input;
return n + 1;
}

return 0;
}
>>
>>55702024
Critical fix, Anon.
>>
>>55701893
doesn't look like you ever break your when loop, if someone gets to 0 hp or below you need to end your loop. also it is unlikely hp will ==0 exactly when the fight is done.
>>
>>55702055
thanks
>>
Happy Friday, /dpt/.

Eating BBQ and drinking at the office, casually experimenting with .NET frameworks.

Get a comfy programming job!
>>
File: emilia-laffin.gif (987KB, 245x370px) Image search: [Google]
emilia-laffin.gif
987KB, 245x370px
>>55702230
>.NET
>comfy
>>
>>55701534
>And Im much cheaper than my competitors

>Oh look, this shitty high school kid thinks he can provide proper tech support
>>
>>55702066

alright thanks i fixed that.

and im not calling on 'health' correctly either. is it a key? value? do i use @ or #?
>>
File: ok.gif (916KB, 245x285px) Image search: [Google]
ok.gif
916KB, 245x285px
>>55702360
>Implying .NET isn't the comfiest framework around
>>
>>55702370
are we projecting?
>>
>>55702402
Lel, you misspelled Flask.
>>
File: 1431471048976.png (63KB, 217x338px) Image search: [Google]
1431471048976.png
63KB, 217x338px
>>55702422
>Python
>>
>>55701534
>much cheaper than my competitors
Not always a good thing, some people will see your services as less valuable if you have a reduced price
>>
>>55702433
here we go again.

what's wrong with python?

please provide reasonable arguments.

thanks
>>
>>55702438
not cheap by any means. but not as jewish as the others. just relatively cheaper.
>>
>>55702410
No, not in the slightest.
>>
Learning how to make a merge sort work, keep getting an array out of bounds error when I try to split array a into a1 and a2. Will post my retarded code later if I'm still stuck.
>>
>>55699852
>Hello, I'm learning C++ but I can't past pointers and anything related to memory management. Any good book that ELI5?

Personally, I only *really* understood pointers once I programmed in x86 assembly. I mean, I could use them effectively in Pascal or C, I could make lists and trees, but I didn't *really* understand them until I did ASM.
>>
>>55702489
that question was rhetorical, dickweed
>>
>>55702402

Every time I try to get into .NET, I find the framework to be weirdly laid out and to have very poor discoverability. Like, "I want to do X" does not naturally lead me to finding the relevant portion of the .NET framework.

It doesn't help that when you look up examples, people always post code that implies a using statement, such that you have no idea WTF part of the framework the function they're calling comes from.
>>
>>55702433
We're talking about framework comfiness here, not language superiority. Flask is literally kino.
>>
>>55702465
>what's wrong with python?

1) It's too easy and readable. Newbs can be up and running, writing primitive systems with ease. This goes counter to the Alpha-Geek Value System.

2) It uses whitespace. This is abhorrent to the Alpha-Geek.

3) It's powerful, yet approachable. This is distasteful to the Alpha-Geek.

4) It's slower than compiled C. This is the standard by which the Alpha-Geek judges all things, except for Lisp because that's really powerful and all the newbs are confused by it which means it's DEFINITELY proves I'm a 1337 badass.
>>
>>55702644
> what's wrong with python?
> It's too easy and readable.
kek what
> It uses whitespace.
so?
> It's powerful, yet approachable.
ok
> It's slower than compiled C
no shit
>>
>>55702693
>>55702693
>he fell for the bait
>>
>>55702530
The only way that question would be rhetorical is if both you and I obviously agree that I was projecting.

That's like saying
>And we all know Trump is a Nazi, right?

...without expecting a dissenting answer.
>>
>>55702534
Honestly, I feel like .NET is literally the BEST language for someone with a complaint like that.

Can you give an example or two of something you'd need to look up and learn how to do?

Particularly with Intellisense, you just type a '.' after an object and you have every single method and property laid out for you to experiment with, along with explanations.
>>
In C, how safe is it to take a pointer to a begin and end element in an array acting as a range of objects, doing memcpy and realloc and still use the begin and end to read/write to the array?

I hope this shit isn't undefined behavior. Pseudo code

int* arr = malloc(10 * sizeof(int));
void* begin = &arr[5],* end = &arr[8];
//now some realloc shenanigans, everything between begin/end does not get modified, elements before/after it may get removed/added with realloc and memcpy
for(void* a = begin; a != end; ++a) //not sure if correct code but understandable enough
>>
This thread and the last dpt thread reminds me of this
http://www.smashcompany.com/technology/object-oriented-programming-is-an-expensive-disaster-which-must-end
>>
>>55702693

Jesus Christ, I was being facetious, you retard.
>>
Banged out my first perl script today. Originally wrote the thing in php with GUI integration and shit but some bird made so many changed to the application without commuting that what I wrote had to be completely reworked. I just said fuck it, all the other system scripts are in perl anyway so may as well keep with the trend

Perl is just a weird version of php anyway desu
>>
>>55702786
Did you just called me a "retard"? is that correct?
>>
>>55702799
Why are you letting birds make changes?
>>
>>55702755

>realloc
>The function may move the memory block to a new location (whose address is returned by the function).

So, what do YOU think?
>>
>>55702807
It's her project. I was just asked to write some small functionality that I went well overboard on because I had nothing to do
>>
>>55702709
exactly. everyone except you knows that you are projecting.
>>
File: longlegs.jpg (159KB, 706x324px) Image search: [Google]
longlegs.jpg
159KB, 706x324px
>>
>>55702835
I'm employed in the software industry, and I'm in my mid 20's.

It would be weird if I went to a high school right now.
>>
>>55702865

it's fine as long as they're at least 17..
>>
File: 1469210909595.jpg (194KB, 706x324px) Image search: [Google]
1469210909595.jpg
194KB, 706x324px
>>55702840
>>
>>55702811
If std::vector can do it, C memory magic can do it.

Thinking int** might actually make it secure.
>>
>>55702890
Depends on the state. 17 in Texas, though.
>>
>>55702904

Huh? What makes you think that std::vector iterators are still valid after a reallocation?
>>
>>55702771
>that article talks shit about WSDL

WSDL is one of the greatest things I've ever come across, as someone who needs data.

I can drop a WSDL URL into VS and it auto-generates the library with classes and it Just Werksâ„¢
>>
Just started going through c++ primer plus, and in one of the first example programs it's putting the "using namespace std" inside of main() instead of where I've usually seen it which is after the #includes, before main(). Are there any big differences between either use?
>>
Give me some projects to work on
>>
>>55703332
Build a VM plus assembly language
>>
>>55703332
a no-fap calendar for your iphone
>>
>>55703274
scope.
putting it "outside" affects the entire file (or worse, if it's a .h and you #include it), putting it inside a function only affects the function.
>>
>>55703355
fuck off retard
>>
>>55703368
rude
>>
Anyone realizing how amazing the concept of recursion actually is?
>>
>>55703409
Recursion should be avoided.

Did you just learn your first neat recursion trick in CS101?
>>
>>55703409
you never had a math lecture ?
>>
>>55703366
+1
>>
>>55703423
yes!
In the coding bootcamp i'm in, it was the first thing they teach us!
>>
>>55703423
>Recursion should be avoided.
No.
>>
>>55703423
>Recursion should be avoided.
Depends on the application really. Sometimes, recursion is stupid. Sometimes, it is the perfect choice.
>>
>>55703332

Implement a lisp dialect built on llvm with full native support for interaction / binding with c or c api style libraries. Oh, and monads / comonads must be a native offering with some sort of syntax support to make it less cumbersome than the macro method.
>>
>>55703518
Nah.. that's too easy. i feel like you're mocking me
>>
i know it's totally unrelated but anybody knows what happened to it-ebooks . info?


That's where i used to get my ebooks from god damn it.

>inb4 get hardcopy faggott
>>
File: 1468899863437.jpg (95KB, 394x404px) Image search: [Google]
1468899863437.jpg
95KB, 394x404px
>>55703542
what book do you need?
>>
>>55703463
Recursion should be avoided.
>>
>>55703565
No.
>>
>>55703565
>no, as stated here >>55703518
>>
>>55703576
Yes.
>>
>>55703576
Recursion should be avoided
>>
>>55703585
>Recursion should be avoided.

why tho fám?
>>
>>55703599
Recursion should be avoided
>>
>>55703556
I don't need something at the moment, thanks.

The site used to upload almost immediately after a programming(infosec and other close fields too) book got released, pretty sad to be honest.

Seems like the anti-piracy faggots make some steps these days
>>
>>55703530

I find it hard to believe that a vm with it's own bytecode assembly language is "too hard" but a full lisp dialect with the described features is "too easy".
>>
>>55703604
Anything done with recursion can be done in a loop, and recursion means you're calling a method on every iteration, which has overhead.
>>
>>55703651
>python user detected
>>
>>55703626
why don't you use lib gen?
>>
File: bencoding.png (13KB, 969x452px) Image search: [Google]
bencoding.png
13KB, 969x452px
>What are you working on, /g/?

Started working on the bencode portion of the library to build a torrent client without using preexisting torrent libraries mentioned a few threads ago.

Right now I only have int, string, and list encoding, going to do dictionaries and then work on decoding.
>>
>>55703679
I do not program in Python.

This goes for most common languages, including C, C++, C#, Python, Ruby, and Java.

It also exposes you to potential crashes from stack overflows, which don't manifest in iterative solutions.
>>
>>55703651
>Anything done with recursion can be done in a loop,
de-recurse this
def function(M, N):
if M == 0:
return N + 1
elif N == 0:
return function(M - 1, 1)
else:
return function(M - 1, function(M, N - 1))
>>
>>55703702
haven't heard of it

Is it libgen.io? If yes, thanks.
>>
>>55703741
yes, but i use a russian mirror

http://gen.lib.rus.ec/
>>
>>55703651
>>55703727
ahah I was about to post it
>>
>>55703727
def function(m,n):
s = [m]
while len(s):
m = s.pop()
if m == 0:
n += 1
elif n == 0:
s.append(m-1)
n = 1
else:
s.append(m-1)
s.append(m)
n -= 1
return n
>>
>>55703651
Look at this Java programmer.

>overhead
haahaha
>>
>>55702422
You can use Flask with IronPython and have the best of both worlds.
>>
>>55703727
>this overflows the stack
>>
>>55703786
>C, C++, C#, Python, Ruby, and Java
>and more
>>
File: 1462843478030.jpg (3MB, 4039x2690px) Image search: [Google]
1462843478030.jpg
3MB, 4039x2690px
what's the best container type to hold some objects that all have a unique "id" field and when I'm done with a certain "id" I must remove it from the container? I'm primarily doing lookups by id to utilize the container and am using C++
>>
>>55703807
not in OCaml
>>
>>55703807
>C, C++
You must have a shitty compiler
>>
>>55703775
did you type that or found it online?
>>
>>55703856
It doesn't matter.

You just got BTFO.
>>
>>55703727
>>55703759
>>
>>55699322
I want to learn a language that will work on linux and windows, what do I learn?
>>
>>55703811
map or unordered_map, of course
unordered_map<string, string> ms;
ms["abc"] = "123";
ms.erase("abc");
>>
I'm reading about ES6 features. I've been using what I thought were many, but it appears there's many more.

The first I'd like to ask about is this object destructuring, in pic related.

How exactly, in the most literate and clear english, can the assignment of lhs.op's value to the variable b be explained?

The other thing I'd like to talk about is how array destructuring can now make tuples a thing in JS. The vector is a perfect example I believe; an object with at least an x and y coordinate pair.

Prior to object and array destructuring, we'd use this:

// Old style
var coordsObj = {x: 0, y: 2};
// coords.x, coords.y


But now with array destructuring, we can do this too:
var coordsArr = [0, 1];
var [x, y] = coordsArr;
// x, y


There's object destructuring too:
var vect = {x: 1, y: 2};
var {x, y} = vect;
// x == 1, y == 2


Here's the coolest thing I just discovered though: Function signatures can perform object/array destructuring IN THEIR PARAMETER LISTS.
See: http://es6-features.org/#ParameterContextMatching

function f ([ name, val ]) { console.log(name, val) } function g ({ name: n, val: v }) { console.log(n, v) } function h ({ name, val }) { console.log(name, val) } f([ "bar", 42 ]) g({ name: "foo", val: 7 }) h({ name: "bar", val: 42 })


I was already excited for ES6 just for lambdas, default params and [a, b] = [b, a] swapping... But things keep getting better
>>
Qt has some of the shittiest documentation i ever seen
>>
>>55703839
C/C++ allocates another stack frame just the same as Java or Python.
>>
>>55703861
>It doesn't matter.
lol
>>
>>55703866
C# or Python

Both open sources and cross-platform.

Both extremely easy to learn and hobbydev in.
>>
>>55703891
>what is TCO
>>
>>55703891
Not on a decent compiler if you make a tail recursive function

>>55703878
>lol fp is a shitty meme
>filter/map/reduce >look i'm fp now
>holy shit have you guys seen this completely original feature
>>
>>55703903
Java and Python also have TCO, but this is because they optimize the recursive function into an iterative one.

It's impossible to guarantee TCO, so just avoid recursion.
>>
>>55703903
my favorite competition.

are you going this year?

http://tco16.topcoder.com/algorithm/
>>
>>55703866

Nearly any language. I don't think swift is officially supported on microsoft spyware systems yet. Objective C is also annoying to use on windows if for some masochistic reason you want to go that route.
>>
>>55703924
>I don't think swift is officially supported on microsoft spyware systems yet
fucking keked
>>
>>55703914
Let me guess, you would suggest I learn Haskell?
>>
>>55703944
Yeah, I love that meme!

*high fives*
*installs gentoo*
>>
>>55703902
>>55703924
think I'm going for c# what software would work well for this on my x220 running arch
>>
>>55703957
Monodevelop.

http://www.mono-project.com/
>>
>>55702895
should be the ghost of Dennis Ritchie instead since we are in a programming thread.
>>
File: 1469004167328.gif (928KB, 500x246px) Image search: [Google]
1469004167328.gif
928KB, 500x246px
>>55703953
>he sticks up for Micro$hit
>>
File: vokoscreen.png (480KB, 1259x1048px) Image search: [Google]
vokoscreen.png
480KB, 1259x1048px
Anyone have experience using widget toolkits (Tkinter or Qt)? Specifically, using them on Linux distros (x11) that *don't* have a composite manager running.

I would like to write a program that uses your mouse to draw a rectangle on your screen. Something like what 'scrot' does when you use the '--select' option. Another example is the pic I attached, although that rectangle has a lot of extra stuff I don't really need. I want the inside of the box to be transparent.

I know what with Tcl/Tk is and I have a little experience making GUIs with Tkinter (python). I have always *assumed* that GUI toolkits like tcl/tk, gtk, and qt were only for making guis. But, everything I have Googled seems to suggest otherwise.

1) If I want to draw a box on my screen are gui toolkits the correct solution? Or is there something else I need to look into?

2) If GUI toolkits are the answer, then how to I accomplish this on my non-composite window manager? Obviously, scrot and vokoscreen are doing it (but maybe they aren't using toolkits).

Thanks.
>>
>>55703982
Yeah, that evil company just want to make money to pay its employees and provide new services!

They sure are evil >:)

*uses LibreOffice*
*gets complaints that my spreadsheets look like garbage*
>>
>>55704000
kys
>>
template <typename ... T>
auto sum (T ... t) { return ( t + ... ); }
>>
>>55703874
here's my question about map though

when I do a .insert() or insert using [] operator does it look to the last place first in to keep order? In my map new inserts will always have greater "ids" then what is already in the map and I don't want it to waste time searching.
>>
>>55704000
Waste of trips, microcuck

I use Office, but not Windows bullshit nor their shitty .NET frameworks
>>
>>55704028
template <typename ... T>
auto average (T ... t) { return ( t + ...) / sizeof...(t); }
>>
>>55704043
>Shitty .NET frameworks

Say what you like about Microsoft but .NET is far from shitty.
>>
>>55704043
>shitty .NET frameworks
Nice try, moron.

It's like one of their few redeeming qualities.
>>
>>55700574
strrev(NULL, NULL);
Now go fuck yourself.
>>
>>55704118
why would you do that you fucking moron?
>>
>>55704155

You've never had some stupid fuck pass null pointers into your functions?
>>
>>55704203
>he doesn't practice contract oriented programming
>>
What are some ways to clean up a string in Java? Replacing certain characters with other characters? Deleting certain phrases? Deleting stuff in between two phrases?
>>
>>55704118
here you go
    if (input == NULL)
return 0;
>>
>>55704068
can't wait for fold expressions desu
>>
>>55704287
Regex
>>
>>55704040
why not use unordered_map?
broadly I would assume that no, it would not first look at the last element since the general use case for map would not always have elements inserted that are larger than every previous element
you could use a linked list for that and always insert at the end of the tail pointer
>>
>>55704220

> Doesn't work with old code bases regularly.
>>
>>55704296
Would return 0 anyway with both arguments set to null.
>>
>>55703878
Come back to /dpt/ three years from now when js is used to write Crysis for the browser and watch they apologise.
>>
Is networking harder to learn than "programming" languages like C? Then again, I have seen more people leaning towards networking because they hate programming. I am learning C at the moment, but I was curious to know if its harder or just more "interesting" to learn than programming.
>>
>>55704372
I personally hate networking but think that you can learn it just as easily if you read a book or take a class like you would learning programming.
>>
>>55704363

Corporate supported platforms are generally horrible. The only incentive execs / management have is being able to fire and rehire without spending much on training.
>>
>>55704372
Networking is cancer, but it's good money.
>>
>>55699322
That guy has some long legs.
>>
>>55704402
>>55704428
I heard that you NEED a degree to work on that branch. Is it true? Or is it like programming, that as long as you are good enough, you will be able to get a decent job?
>>
>>55704450
are you retarded?
>>
>>55704428
The real cancer is "networking" with other people
>>
>>55704460
probably true
it's piss easy so employers have their pick of the finest applicants for every position
>>
>>55704482

That is every job field. It's not economically viable to do anything but screen out nearly everyone and offer very small numbers of jobs.
>>
>>55702755
realloc can move the memory, but assuming you update the begin/end pointers after, it will work fine.

But it's potentially a sub optimal way of iterating over an array, the compiler will have a harder time optimizing loops without an index counter.
>>
File: Spooks.jpg (91KB, 600x898px) Image search: [Google]
Spooks.jpg
91KB, 600x898px
What books in the sticky would I start with to begin computer programming? There is a lot so I wouldn't know which one is just the basics
>>
>>55704526
If you aren't set on any particular language, my suggestion is SICP.
>>
>>55704526
>please meme me
>>
>>55703727
This doesn't overflow the stack.

function 0 n = (n+1)
function m 0 = function (m-1) 1
function m n = function (m-1) (function m (n-1))
>>
Does anyone know how to get the value of the
link viewer that pops up on chrome at the bottom left? or how to get the link from whatever the cursor is hovering over?
>>
>>55704845
let links = document.getElementsByTagName('a');
for (var item in links) { links[item].onmouseover = (x) => console.log(x.target.href)}
>>
>>55699322
I wonder of Bjarne ever browses /g/.
He seems disgusted enough with people that he might just do it for a twisted sense of enjoyment.
>>
Am I retarded for not understanding this? http://preshing.com/20120612/an-introduction-to-lock-free-programming/
>>
>>55705100

For some reason you reminded me of this:
https://www.youtube.com/watch?v=xF0-LGoXtaw

Look how painful it is for him.
>>
>>55705173
I could imagine that being awkward for anyone
>>
>>55705173
why do people do this to each other
seriously
>>
>>55704734
Thanks f am, this looks exactly what i was looking for
>>
>>55704450
His legs are that long so he can see all the way to the top of the output when he gets a template error.
>>
>>55703947
Yes.
>>
>>55703727
def function (m, n):
s = [m,n]
while len(s) > 1:
n = s.pop()
m = s.pop()
if m == 0:
s += [n+1]
elif n == 0:
s += [m-1, 1]
else:
s += [m-1, m, n-1]
return s.pop()
>>
whats the fastest way to set a C++ array of doubles to some value? say 0 or a really big number, call it 1,000,000.
>>
Anyone familiar with MSVS and Bosot here? I'm trying to compile some project that relies on some Boost libraries, I downloaded them and put the static versions in VC/lib directory however as it seems the project doesn't have the dependencies declared explicitly and MSVS automatically picks up the libs, however, as it stands, it's trying to find the dynamic libraries rather than the static ones, any way to resolve this in a simple way?
>>
>>55705450
memset
>>
>>55705450
for loop

>>55705457
Works only per byte.
>>
>>55705450
Just do a normal loop and your compiler should optimize it.
memset MIGHT work but could be very messy when playing with doubles instead of integers. Setting it to 0 with memset will probably work but setting it to an arbitrary double will most likely not work.
>>
>>55705450
std::copy
>>
Realistically speaking, how long does it take to learn enough coding skills to land a basic web dev job if I practice 2 hours a day? I have basic java and mysql knowledge. My goal is to have a job that would cover the fees of my CS degree and after that I would look into something more serious than web development.
>>
>>55705479
no wait, std::fill
>>
>>55705454
project -> properties -> c/c++ -> code generation -> runtime library
change from multi-threaded DLL to multi-threaded
>>
I'm pretty much a complete beginner at C++. I'm trying to use the Boost library to multiply two large numbers, but When I
#include <boost/lambda/lambda.hpp>
, XCode keeps telling me it can't find the ".hpp" file I'm including...
>>
>>55705516
>two main functions
>>
>>55705173
What.
>>
So I'm learning python what editor should I use on arch (needs to be lightweight) don't mind a slight learning curve but nothing extreme looking into sublime
>>
>>55705552
I have a 2GiB RAM chromebook and use PyCharm well on it, so I'd consider that light-weight
>>
I have a vector of size n which I'm using to find the nth largest element in a list of many elements. How do I shift all the elements down one once I've found that a new element belongs in the order?
>>
So I'm a Python developer. They told me C++17 looks like Python. I want to learn it then.

Which compiler compiles C++17?
>>
>>55705575
gcc
msvc++
>>
>>55705574
std::erase?
>>
>>55705575
gcc, but C++ looks nothing like Python
>>
>>55705516
>complete beginner at C++. I'm trying to use the Boost library
nigger
I've been a c++ programmer for 12 years and I still haven't gotten around to using boost
>>
>>55705516
>I'm pretty much a complete beginner at C++
> I'm trying to use the Boost library
jesus why

also according to what your IDE shows, boost is in "../boost/---" not <boost/--->

The different between " " and < > is vital, find out what it means
>>
>>55705575
C++17 hasn't been fully standardized yet. Things are apt to change.

Learn C++14.
GCC, MSVC, and Clang all compile C++14. I'd recommend GCC. Use MSYS2 if you're on Windows.
>>
>>55705598
>>55705583
>>55705630
Thanks. Is there any good free resource or codebase for me to learn 14 or 17?
>>
>>55705647
"Discovering Modern C++", you'll find a torrent. It covers C++11, C++14, and mentions upcoming features of C++17.
>>
I'm leaving this as a repository for people to argue why their paradigm of choice is best and how it is practical in any of the following common applications of programming:


language design
e.g. C compilers, assemblers, parsers, type systems
embedded programming
e.g. real time systems, microcontrollers
drivers, kernel
e.g. graphics drivers, other hardware interfaces
numbers, statistics
e.g. machine learning, number crunching
web dev, front end
e.g. facebook, google, tinder
web dev, back end
e.g. facebook, google, tinder
graphics, audio, video
e.g. photoshop, premiere, ableton
video games
e.g. crysis, league of legends, WoW


Also feel free to contribute additional fields.
>>
>>55705496
Thanks anon, that worked for this problem, sorry for the late reply but the project is huge and it took a while to rebuild, now only one error left but I should be able to fix it myself.
>>
>>55705552
vim
>>
>>55705955
any non-meme answers?
>>
>>55706005
>Everything is a meme meme
Vim is awesome nigger
>>
Could someone make a script in python that tells you when a thread is about to die and would they care if I put it on my github, a friend wanted me to make him one
>>
>>55706074
sounds like too much work
>>
File: 1468579831698.jpg (102KB, 680x491px) Image search: [Google]
1468579831698.jpg
102KB, 680x491px
Is it ever worth it to memcpy() a good-sized buffer (say, 2 megabytes) on some update tick, just to keep it in the CPU cache?

When is copying shit so that all of the data you're working in stays in the cache at the same time justified? When is it not?
>>
>>55705872
>fields

>>55705666
>find

Is this a new meme or did my 4chanx broke?
>>
>>55706093
>what is premature optimization
>>
>>55706103
what u on senpai?
>>
>>55706103
what the fuck r u on about
>>
>>55706074
>download threads.json
>if monitored thread is on page 10, alert
wow hard
>>
File: 1458051930695.png (10KB, 913x216px) Image search: [Google]
1458051930695.png
10KB, 913x216px
>>55706117
>>55706121
the word fields is replaced with fflelds and the word find is replaced with fflnd on my screen but this is only on firefox.
>>
>>55706174
Uninstall gentoo (it's a meme)
Install Ubuntu
>>
Reminder that Haskell is really nice for imperative programming too

>>55706174
I think you're losing it
I hope you ffind your sanity
>>
I did it lads. Tell me how to improve it.

Connection connection = Jsoup.connect(String.valueOf(archive));
connection.userAgent("Mozilla/5.0");
Document doc = connection.get();
Elements posts = doc.select("div [class=text]");

for (int i = 0; i < posts.size(); i++) {
String uncleanpost = posts.eq(i).toString();
System.out.println(cleaner(uncleanpost));
System.out.println("**********************************************************");


Cleaner method
public static String cleaner (String dirtyString) {
String tags = "(<.*?>)";
String cleanString = dirtyString.replaceAll(tags, "");
cleanString = cleanString.replaceAll("(<br>)", "");
cleanString = cleanString.replaceAll("(&gt;)",">");
return cleanString;
}


Sample output:
 Odds the shooter ISN'T a Turkroach? 

**********************************************************

CNN: " A witness who will only be identified as Lauretta told CNN her son was in a bathroom with a shooter at the McDonald's. "That's where he loaded his weapon," she said. "I hear like an alarm and boom, boom, boom... And he's still killing the children. The children were sitting to eat. They can't run." Lauretta said she heard the gunman say, "Allahu Akbar," or God is great. "I know this because I'm Muslim. I hear this and I only cry.""

**********************************************************

This is what will happen.

they will say "Shooter was german"

two weeks later they will release his name as everyone will know it was turk born in turkey.

**********************************************************
>>
>>55699363
Nice. You using any frameworks for graphics or are you rolling pure OpenGL?
>>
>>55706116
Thanks for the meme, senpai, but you kind of need to think about these things ahead of time. The problem is that you can end up architecting a program in such a way where the only way to optimize it is to rewrite the entire project from scratch. I want to avoid that.
>>
>>55706174
fields
fields
field
find

works on my machine

[closed][wontfix]
>>
>>55706201
>>55706201
>>55706201
NEW
>>
>>55706192
Can you not just do

.replaceAll(...).replaceAll(...)
>>
>>55706197
what a bunch of shit
you don't even know if the thing you want to do will improve the situation
you don't solve a problem before the problem exists
because your solution might not even help and it may, as in this case, make the problem even worse
>>
File: 1448141753473.png (102KB, 1601x768px) Image search: [Google]
1448141753473.png
102KB, 1601x768px
>>55706186
I'm on debian and I have been on debian for over 4 years. It's the first time I see something like this.
>first got replaced with fflrst
;_;

>>55706202
pic
>>
>>55706237
hacked kid
>>
>>55706201
>>55706201
>>55706201
>>55706201
NEW
>>
New thread
>>55706254
Past bump limit edition
>>
>>55706242
Please, don't steal my emacs config file.
Thread posts: 314
Thread images: 30


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