[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: 322
Thread images: 45

File: dank_rust_meme.jpg (51KB, 600x816px) Image search: [Google]
dank_rust_meme.jpg
51KB, 600x816px
What are you working on, /g/?

Old thread: >>60905260
>>
File: t. me.png (27KB, 550x550px) Image search: [Google]
t. me.png
27KB, 550x550px
>when anon quotes you
>>
>>60909385
Lisp
>>
>>60909385
What kind of malware do you have experience writing? Why?
>>
>>60909417
Actually, good programmers do use patterns, they just don't care about taxonomy.
>>
>A) DRY is a design pattern
>B) Using design patterns is repetition
>A ^ B) Using design patterns requires violating design patterns
>>
There is literally nothing wrong with using singletons
>>
>>60909417
There is a difference between design patterns and """""design patterns""""".
>>
File: sasuke_deformed.jpg (36KB, 459x488px) Image search: [Google]
sasuke_deformed.jpg
36KB, 459x488px
If a data structure has a space-complexity of O(nr + n), can I just simplify it to O(nr) as n would be a non-dominant factor?

Or will n still have to be accounted for, and I'm mistaken in my assessment of it as a dominant factor?
>>
Holy fuck guys please keep your code clean
>>
File: 1367528740648.jpg (186KB, 1000x666px) Image search: [Google]
1367528740648.jpg
186KB, 1000x666px
can someone riddle me this:

PerceptionComponent->OnPerceptionUpdated.Add (delegate);


so my understanding is that a delegate is like interface in java. but Im not sure about the syntax. according to a tutorial it should look like this:
PerceptionComponent->OnPerceptionUpdated.Add(&AAIControllerUnit::SenseStuff);


I dont get it. is this the reference to the static implementation? can't I give a reference to a specific instance?
>>
>>60909490
>can I just simplify it to O(nr) as n would be a non-dominant factor
yes
>>
>>60909491
>realize my code is hideous
>say i'll go back and clean it up after I get it all working
>get it working as desired
>eh, i'll start on the next project and clean this one later
itjustworks.jpg
>>
>>60909471
Shut the fuck up Pajeet
>>
>>60909490
O(nr+n)
O(n(r+1))
O(nr)
>>
Do you guys unit test your code?
>>
>>60909532
On my resume it says I do
>>
>>60909515
>realize my code is hideous
>say i'll go back and clean it up after I get it all working
>it's all in COBOL
>stop giving a shit
>>
>>60909543
>>60909515
What I meant was use (((design patterns)))
>>
>>60909532
No, I write formal proofs instead.
>>
>>60909532
If course, I have a job
>>
https://www.youtube.com/watch?v=n2uJDp1sNy0
>>
>>60909385
/dpt/ - Designated Pajeet Thread
>>
>>60909532
no
>>
>>60909616
that's right, bitchboi
>>
I just knew Postman is built by pajeetnation
>>
>>60909532
Do you write unit tests for your unit tests?
>>
File: 1494584131867.png (228KB, 367x600px) Image search: [Google]
1494584131867.png
228KB, 367x600px
>>60909572
This
>>
File: 1493363267244.jpg (50KB, 849x852px) Image search: [Google]
1493363267244.jpg
50KB, 849x852px
>>60909419
What is this "Lisp", anon?
>>
File: Kurt_gödel.jpg (19KB, 212x270px) Image search: [Google]
Kurt_gödel.jpg
19KB, 212x270px
>>60909817
Do you write formal proofs of your formal proofs?
>>
File: 1485687413146.jpg (64KB, 582x582px) Image search: [Google]
1485687413146.jpg
64KB, 582x582px
>>60909451
>>
File: 1495602826818.jpg (37KB, 302x562px) Image search: [Google]
1495602826818.jpg
37KB, 302x562px
>>60909857
I write my proofs exclusively in anime (which is complete, consistent and decidable).
>>
File: 1493539087168.jpg (129KB, 1280x720px) Image search: [Google]
1493539087168.jpg
129KB, 1280x720px
>>60909817
>>60909855
>>60909857
>>60909876
>>60909886
Thank you for using anime images!
>>
why am I too retarded to understand delegates?
>>
>>60910206
So-called "delegates" are themselves retarded.
>>
>>60909857

hah, a subtle but devastating #wreck..
>>
>>60910307
>subtle
In what sense?
>>
>>60910206
Maybe they speak in a foreign language.
>>
File: 1495224704775.jpg (111KB, 709x290px) Image search: [Google]
1495224704775.jpg
111KB, 709x290px
>>60910206
>C#
Die in a bus fire.
>>
>>60910349
c++
>>
File: 1493064747460.png (1006KB, 912x1080px) Image search: [Google]
1493064747460.png
1006KB, 912x1080px
>>60910359
>c++
Die in a bus fire.
>>
>>60910206
>delegates
Are you Ted Cruz?
>>
The thread is as dead as D, which is very dead.
>>
>>60910826
How can languages and threads have "lives"?
>>
>>60910852
If the js-hipsters are not constantly writing blogs about it it's "dead". For alive languages see rust.
>>
>>60910852
they live in the metaphysical layer of stallman. this is like 10 layers deeper than the religious one.
>>
>>60910887
>stallman
Stopped reading right there.
>>
File: 1401721277318.jpg (156KB, 528x528px) Image search: [Google]
1401721277318.jpg
156KB, 528x528px
>>60910897
too bad your a brainlett
>>
>>60910899
>brainlett
What is an "brainlett"?
>>
I just got 1 (ONE) question today.


How do I become a good programmer like Andrei?
>>
>>60910312

the image
>>
>>60909532
HAHAHA That shit isn't in the budget cuz the suits want that shit yesterday.
>>
>>60910968
I don't understand the question
>>
>>60910349
Delegates aren't used in C# anymore. At least, not in the way you might be thinking or thought of.
>>
Ability to unsarcastically read a good tech book from cover to cover and grok most of it, is the single most important skill a programmer can acquire.
>>
>>60911398
I disagree.
>>
>>60908122
There's nothing wrong with my logic. I hate it when people say "your logic is flawed" when they're talking about your premises. Logic is not premises. Logic is the relationship between premises and a conclusion. If your premises are flawed, your logic isn't invalid, it's unsound.
>>
>The documentation example doesn't show which headers to include
This happens way too fucking often. Anyone who does this needs to jump off a fucking bridge.
>>
>>60911550
>he mad
>>
>>60911550
>His language doesn't have modules
>>
>>60911550
>headers
Sucks to be you.
>>
File: 1476141676584.png (102KB, 989x569px) Image search: [Google]
1476141676584.png
102KB, 989x569px
>He uses emoji in his commit messages to denote commit type
>>
File: pemg.jpg (5KB, 1000x653px) Image search: [Google]
pemg.jpg
5KB, 1000x653px
>muh lamb duhs
>muh moan ads
>>
>>60911592
>emoji
What is a ``emoji"?
>>
>muh
>ribbit the reddit frog
>>>/r/abbit/
>>
File: frog.png (240KB, 483x564px) Image search: [Google]
frog.png
240KB, 483x564px
>>60911637
>>ribbit the reddit frog
>mfw
>>
@60911623
@60911670
Everything in your posts reeks of reddit.
Seriously: piss off. Your kind is not welcome here.
>>
>>60911623
dumb frogposter
>>
File: buhscuseme.png (106KB, 595x358px) Image search: [Google]
buhscuseme.png
106KB, 595x358px
>>60911672
>>60911687
>he assume it are unironic
>mfw
>>
I just had a look at Arduino
Can anyone tell me whether you have to use C++ and their weird sketch shit
I want to work more on the hardware level and with C
>>
I am more or less trying to organize my time for college, coding and shit.
about 2h dedicated for organic chemistry, 30min for genetics a day plus 1h every sunday
2h for math every second day and the rest is used for coding assignments.
It's not easy, but I think college is a good place to prepare me for the workload of the CS/IT industry.
>>
@60911740
"""unironic""" frogposting is still frogposting. Fuck off, retard.
>>
>>60911740
I don't care what the motivation or subtext was, the fact is you did it and you are a dumb frogposter.
Now go back to r9k or reddit.
>>
>>60911763
Pls reply
Will post cute anime girl
>>
>>60911565

>his language doesn't have any libraries to import
>>
what language did you first learn?

how much will it impede by ability to start programming if I try to learn coding with two languages at once?

is Mathematica and MATLAB irrelevant if you can code?
>>
>>60911812
>Will post cute anime girl
Do it.
>>
>>60911820
I first learned Haskell, I wanted to kill myself
Now I learn a bit of Python and majority of time Java for my assignments and courses.
As long as you can manage your time, you can manage everything.
>>
>>60911623
>>60911670
>>60911740
Go be retarded somewhere else, like at reddit. Your kind isn't welcome here.
>>
File: 1444016619830.jpg (114KB, 970x880px) Image search: [Google]
1444016619830.jpg
114KB, 970x880px
>>60911835
You better not trick me
>>
>>60911820
Learned JavaScript first.
Then C
Then C#
Then F#
Then D
And now (((Rust)))
>>
>>60911820
Learned Java first. I found that it made me overdesign and overcomplicate a lot of code, writing C helped me learn to simplify.

Mathematica and MATLAB are irrelevant outside their domain, but they both are used quite a lot for "non programmers" who need a math programming language. Personally, I prefer to do mathematics in Python (with numpy) or Scheme, but that's a personal preference.

Learning two languages at the same time is not impossible, but I would recommend alternating between the two every week or every couple days, rather than trying to actually simultaneously learn two new things
>>
>>60911763
No, you don't have to use sepples.
>>
So I'm implementing a Lisp interpreter in Lua and a question crossed my mind on the way: why are (lone) pairs so rarely used in Lisp? It looks like pairs would fit some constructs like (let ((var1 expr1) ...) expr), yet they use lists anyway. Wouldn't it make sense to write
 (let ((x . 1) (y . 2)) (+ y x)) 
?
>>
File: primates-synopsis.jpg (150KB, 1200x766px) Image search: [Google]
primates-synopsis.jpg
150KB, 1200x766px
Noob here, what is the time complexity of this algorithm checking if number is a prime:

def is_it_a_prime(number):
if number <= 1:
return False
for num in range(2, int(sqrt(number))):
if number % num == 0:
break
else:
return True
return False


It checks only from 2 to the square root of the candidate number. Is is O(sqrt(n)) complexity time?
>>
>>60911935

If the size of the input increases by a factor n, then the number of ops performed increases by a factor of sqrt(n). So yes.
>>
>>60911957
Thanks! So if I want to generate n numbers of primes, using this algorithm, time complexity would be O(n * sqrt(n))
>>
>>60911820
Roughly in order:
DarkBASIC
C++
C
Python
C++11
Rust
C#
SQL
>>
>>60911972
>C++
>C++11
As if C++11 is a different fucking language
>>
>>60911981
I basically had to relearn c++ at that point since i forgot most things, which is why i listed it separately.
>>
>>60911971

Yes. But if you are concerned about speed then you should consider a specialized algorithm such as a sieve of Eratosthenes.
>>
>>60911981
>As if C++11 is a different fucking language
Might as well be.
>>
>>60911981
C++11 is completely different.
Writing new C++ like you're writing C++98 is just as bad as if you were writing it like C.
>>
>>60911996
Thanks. I'm not concerned about speed. I'm new to understanding the time complexity and big O notation, so I was just wondering.
>>
>>60912010
Is::this""<<*Cancer>::gone>::yet?
>>
>>60909532
Only when I already have a completed function to compare the results to. I just manually test/debug until I get the proper answers from the function

Because sometimes I just don't feel writing out every answer to every function.
>>
>>60912024
>C++11 is completely different.
>>60912028
Did it get modules?
>>
>>60911820
>how much will it impede by ability to start programming if I try to learn coding with two languages at once?
Not at all, in fact it probably helps, because it's easier to separate knowledge that's specific to language and generic programming concepts.
>>
>>60912028
No. They added more of it.
>>
>>60912028
C++ can now infer a lot of template arguments. That and auto helps cut down on that shit a lot
>>
>>60912033

What does modules have to do with templates?
>>
>>60909532
on the job -> yes
private projects -> rarely (but i insert assert statements)
>>
>>60911981
It is, I woudn't fucking wish anyone to write in C++98.
>>
File: 1492579258592.png (308KB, 638x721px) Image search: [Google]
1492579258592.png
308KB, 638x721px
>>60912101
>->
>>
>>60912036
This

But also this: >>60912047
>>
>>60911820
C++;
Java, C;
OCaml, Racket (basics) and Ruby;
Prolog, Haskell, Elm (basic), C# and Lua

I think the best order towards reaching enlightenment is C -> C# -> OCaml / other ML-based -> Haskell -> whatever you want later. C shows you basic concepts of programming and it doesn't hide much of the inner workings so you learn how this shit works. C# shows you OOP and it's very bearable compared to other OO languages. OCaml is pretty basic functional language, but still very capable, making it a good entry point into FP. Haskell lets you fly high. I will probably add something to this list as I learn more languages (now I'm especially curious about Coq).

For languages outside the list: Ruby didn't really give me any more insight into programming, I only felt frustrated by the lack of typechecker. Prolog was kinda cool, but the most I can apply it to other languages is making programs with the type system in Haskell (as in programs that calculate the answer as a type so actually they don't calculate it, but the typechecker does). Java is shit, C++ is a clusterfuck. Elm showed me that FRP is pretty comfy.


I think it would be better to start with just one pretty basic language and do it step by step. When you grasp the basics, you can then step onto the next level.
>>
Why is java seen as more portable than other languages
Don't you just have to now write the JVM(for which you probably want a compiler) for every device you want to use it on instead of simply writing a C compiler?
>>
>>60912123
>not using pattern matching on regular basis
match id with
| x where x = 60912123 -> Just Faggot
| _ -> Nothing
>>
>>60912179
It's more portable from the application developer's standpoint, since any platform with a JVM also has a fuckhuge stdlib and probably also lets you continue using your old classes.
>>
File: 1494816077115.png (127KB, 346x315px) Image search: [Google]
1494816077115.png
127KB, 346x315px
>>60912206
My pattern matching uses =>
>>
>>60912174
>C++
>Java
>Ruby
>C#
All of them are garbage not worth wasting your time on.
>>
>>60912269
Edgy
>>
File: 1350594293765.jpg (111KB, 500x500px) Image search: [Google]
1350594293765.jpg
111KB, 500x500px
I am dealing with OpenGL shader lighting calculations. What is the difference between calculating Phong shading in World Space versus calculating it in View Space?
>>
>>60912294
You might be retarded.
>>
>>60912301
unless you're calculating specular it shouldnt matter
>>
File: 497.jpg (50KB, 518x768px) Image search: [Google]
497.jpg
50KB, 518x768px
>>60912338
That's the next step of my master plan.
>>
I have some questions regarding Java.

Trees{
int val;
Trees left, right
}

class Tree{
Trees root;
}

static vid insert (Tree r, int v){
Trees t = r.root
}


what actually happens with t = r.root?
so you give a value for r and it links it with root, aka overwrites it and then assigns it to t or what?
>>
>>60912389

In Java, all Object types are secretly references.
t and r.root both refer to the same object. It is not contained in either location.
>>
File: faps.png (4KB, 172x922px) Image search: [Google]
faps.png
4KB, 172x922px
Beat this 'tism:

I made a fap log and a visualizer for it.
White = no material
Green = non-nude pic
Red = non-nude vid
Purple = gonewildaudio
>>
>>60912419
very nice. is one line representative of a day or simply a session?
>>
File: salary_graph-1-1024x731.png (156KB, 1024x731px) Image search: [Google]
salary_graph-1-1024x731.png
156KB, 1024x731px
https://stackoverflow.blog/2017/06/15/developers-use-spaces-make-money-use-tabs/
Tab-fags BTFO
>>
>>60912414
So, if I were to decide to putthe insert Method inside the Tree class and just change it so that only root is accessed, nothing would change and all would be the same??
Makes it simple
>>
>>60912419
Source?
>>
>>60912456
FUCK
>>
>>60912456
I use 4 spaces because Walter Bright told me to
>>
File: hard.png (85KB, 1082x744px) Image search: [Google]
hard.png
85KB, 1082x744px
How hard it would be to make a small gui app in python which embeds a terminal in it (something like a geany IDE does)? I want to make an app whose only functionality is to be a "container" for six terminal sessions.
>>
>>60912458

Yep.
>>
>>60912456
I use an IDE because I'm not retarded
>>
>>60912484
Geany uses GTK. There's a GTK widget with a terminal called VTE, so you could use that.
>>
A tutorial I'm going through is telling me I need to calculate a normal matrix based on the model matrix. It is defined as 'the transpose of the inverse of the upper-left corner of the model matrix'. In GLSL, the code to calculate it is:

mat3(transpose(inverse(model)))


I want to calculate this matrix in C++ using GLM. What would be the most performance-optimal approach to take? First stripping my matrix down to 3x3 by omitting the W-components, and then running inverse on it, and then running transpose on the result of that? Or does it need to be a 4x4 for the inverse and transpose to give me correct results?
>>
>>60912452
Neither. I wanted to fit all of it onto one screen so I just set a maximum row count and made it spread everything out. The gap towards the top is about 5 days long. The three purple ones in a row near the bottom spanned three days.

I should probably figure out a better way to visualize the info.
>>
>>60912493
>I use an IDE
>I'm not retarded
That's impossible though.
>>
/* tab 8 */
int x = 10;
int variable = 20;

/* tab 4 */
int x = 10;
int variable = 20;

>>
>>60912570
>in C++
Stopped reading right there.
>>
>>60912578
Ughh
Don't you have a syntax error to find
>>
>>60912461
I've never given any complete source code files of mine to anybody. I'll give you function, though!

def get_format(material):
9 key = [('video', ['video', 'vid', '.webm'] ),
8 ('picture', ['picture', 'pic', 'still', '.jpg', '.png']),
7 ('audio', ['audio', '.m4a'] ),
6 ('none', ['none'] )]
5 for format_pair in key:
4 for ending in format_pair[1]:
3 if re.search(ending+'$', material):
2 return format_pair[0]
1 print(material + ' has no format.')
0 return 'unknown'
>>
Where can I practice writing regex if I can already read it?
>>
>>60912625
implement your own parser and GUI toolkit for it with opengl.
>>
>>60912614
I don't make syntax errors.
>>
File: 1407888206116.png (1MB, 1200x1800px) Image search: [Google]
1407888206116.png
1MB, 1200x1800px
>>60912606
Please do not language bully. All programming languages are precious, and although some are a bit more lewd than others, all deserve nothing but love and praise. Thank you!
>>
>>60912618
Here's an example of a log line:
2017-03-31 13:30 rebecca-ferguson.jpg
>>
Is it wrong if I like to call Kotlin "Koklin"?
Also learn Kotlin
>>
>>60912642
Why were so many programming languages made in 1994-1996?
>>
>>60912654
>Also learn Kotlin
Why would I even use a POOlang?
>>
File: 1497468909989.gif (477KB, 400x273px) Image search: [Google]
1497468909989.gif
477KB, 400x273px
>>60912614
I'm not into this whole autistic IDE vs non-IDE argument, but the whole reason you make syntax errors is because you are dependent on the IDE catching them for you.

People be complaining about how hard it is to not fall on a bike, when they've been on training wheels their whole lives.
>>
File: i09FJm4.jpg (177KB, 1124x1024px) Image search: [Google]
i09FJm4.jpg
177KB, 1124x1024px
>>60912654
Actually it's Kot(b)lin(i).
>>
>>60910206
literally just function pointers
>>
>>60912625
You should try
https://alf (dot) nu/RegexGolf
you may need to know that you can do maths shit like identify primes with regex later on...

Link looks like spam, replace dot
>>
File: 1494119443274.gif (880KB, 500x281px) Image search: [Google]
1494119443274.gif
880KB, 500x281px
>>60912642
>All programming languages are precious
Correct, but C++ isn't a programming language.
>>
>>60912601

>aligning with tabs
lol, fucking moron
>>
>>60912563
neat. thanks! I'll give it a try for sure.
>>
>>60912673
you know the best what language is right for you
>>60912681
kek
>>
>>60912693
Seems pretty good. I suppose I'll have to start doing a few of these every day
>>
Try to beat my minimax NxN tictactoe!
----                                                                                         
----
----
----
>

row 0-3 and col 0-3
>>
>>60912678
>there's two bikes
>one is virtually impossible to fall off of
>the other is virtually impossible to consistently stay up on, and will even be difficult to be stable after many, many years of practice

I know which one I'd use.
>>
File: Untitled.png (9KB, 603x144px) Image search: [Google]
Untitled.png
9KB, 603x144px
>>60912694
Your bullying spree ends here!
>>
>>60912654
You can call it Retusaari
>>
>>60912678
The thing I never get about IDE haters is that they always add so much damn bloat to their beloved text editors that they might as well have just installed an IDE.
I do the same with VIM, I have to jump through all kind of hoops to insert all kind of basic functionalities that IDEs have.
>>
File: 1495607722251.png (110KB, 275x326px) Image search: [Google]
1495607722251.png
110KB, 275x326px
I use an IDE because I value ease of use more than resources my computer has plenty of.

I don't mind people who don't use IDEs, though I wish they'd be less mean to me because of my life choices.
>>
>>60912753
This.

Hilarious seeing Vim installs at my office that are "totally-not-IDEs", even though they spend time installing, managing, and updating like 40 add-ons.
>>
>>60909385
>memory safety
Seriously it's not a big deal. Any competent developer doesn't need to slow themselves down with rust over it
>>
>>60912726
row 1 col 2
>>
>>60912785
Memory safety is nice and all but Rust is already uglier than C++. I get the feeling it wasn't worth the price for general purpose development.
>>
>>60912785
Here is a bold statement: "Memory safety will kill C++"
>>
>>60912785
Riight.
http://heartbleed.com/
https://gotofail.com/
https://dirtycow.ninja/
https://en.wikipedia.org/wiki/Shellshock_(software_bug)
>>
Why can't i reference non-static variables from a static context?

I could talk around the bush and say, asking for a friend, but it is really me who asks.
>>
>>60912829

>Goto fail is a memory safety issue
xD
>>
>>60912845

nonstatic variables belong to an instance of an object.
There is no "this" object in the static context.
>>
>>60909417
Favorite programming quotes?
http://realtimecollisiondetection.net/blog/?p=81
>Design patterns are spoonfeed material for brainless programmers incapable of independent thought, who will be resolved to producing code as mediocre as the design patterns they use to create it.
>Christer Ericson, VP of technology at Activision
>>
>>60909423
Trivial forkbomb keylogger etc.
None designed to avoid antivirus.
They barely count by today's standards.
>why
Fun. None were ever used.
>>
>>60912821
O---
--X-
----
----
>
>>
>>60912898
r3/c4
>>
>>60912829
>you'd implement a core part of openssl using safe in rust
Yeah. Right.
Regardless I don't see how rust would catch that. It might have limited the problem with it by failing a bounds check but what kind of programmer would allow himself to take the overhead of bounds checking everywhere in a library meant to be used in such a wide range of circumstances.
>shellshock
How would you catch that with rust? If you can that's great because it makes perfect sense to use all the bells and whistles there.
>>
>>60912911
OO--
--X-
---X
----
>
>>
>>60912921
It's actually a good idea, Rust is so unreadable and ugly that no hacker will bother to read the code and it'll be secure forever
>>
>>60912828
Maybe. I think there's a lot of hostages in C++. Their standards are so low that they might not ever leave.
>>
>>60910291
so how do you handle events?
>>
>>60911672
says the guy who can't quote
>>
>>60912678
>>60912729
no it's really more like
>there's one unicycle
>there's one tricycle
>there's no bike
>you need a bike
>there's no bike
>>
>he doesnt write everything in FiM++

baka
>>
how do I include defined constants in my C printf function
>>
Got bored made game of life in ES6 to practice it.
https://jsfiddle.net/zm7vj8um/
>>
>>60913167
>my C printf function
why are you rewriting printf it already exists
>>
>>60913206

>Cfags
>Not handrolling their own half-assed implementation of everything that already exists
>>
>>60912921
rustc eliminates bound checks, where it can, just like any sane compiler from the last 30 years.
>>
File: laugh2.webm (364KB, 1280x720px) Image search: [Google]
laugh2.webm
364KB, 1280x720px
>he need static typing
>>
>>60912658
People realized that processors had become fast enough that interpreted languages were no longer laughably inefficient and could be more than toys.
>>
>>60913309
>need
>>
>>60913309
I too love javascript.
>>
>>60913309
"static" is redundant here.
>>
>>60913206
>he doesn't use his own handcrafted libc
>>
6..9
t. brainlet
>>
>>60913327
explain
>>
>>60913309
>he solves problems by throwing hardware at them
>>
>>60913339
Explain what? It's similar to "unmarried bachelor", it's correct but completely redundant.
>>
>>60913327
dynamic typing is just an auto container
>>
>>60913278
So? Clearly it can't do that here.
>>
>>60913354
typing is not always done in the static environment.
>>
>>60913357
>dynamic typing is
Sure, assuming it exists it can be anything you want.
>>60913374
I think you're thinking about "type-checking", not "typing".
>>
>>60913362
So shipping slightly slower code is better than shipping insecure code?
>>
File: help.png (65KB, 1875x940px) Image search: [Google]
help.png
65KB, 1875x940px
please explain the error on EEE
>>
>>60913382
which is true in Jshit
>>
>>60913382
static typing, dynamic typing, duck typing, gradual typing, ...
>>
>>60913391
What is true in *shit?
>>
>>60912179
Writing a C compiler does not mean you can run any C program.
>>
>>60913390
>sepples
Fuck off.
>>
>>60913390
you are trying to assign multiple values to a single char
>>
>>60913390
Why arent you using enums?
>>
>>60913390

you want a char[]
>>
>>60913390
The C/C++ doesn't automatically concatenate characters the way it can with "strings". Also, why not just write
vowels = "aeiou";
. Sure, it's a magic constant or w/e, but it's both shorter and easier to read in the context. Secondly, you defined the type of vowels to be a single char. What you wrote is similar to something like:
int my_int;
my_int = 1 2 3 4 5;
>>
>>60913384
Anon you don't understand this at all.
It's not slightly slower. It's significantly slower.
And that code can be made safe without bounds checking (if you'd read I it's obvious even, it's the reason the bug has become so notorious). And the non-bounds checking solution is much more elegant and efficient.

You may be in a situation where you can just sacrifice performance as you please but openssl is a 20 year old library next year. Regardless of what you think of the tradeoff today it's not sensible in that perspective.
>>
>>60913390
If you run msvc with -E (preprocessor to std out) or - P (preprocessor output to a file) it should be pretty obvious.
>>
>>60912658
Was there actually though?
>>
>>60913312
>implying
They're still toys
>>
>>60913456
The other anon didn't mention this but bounds checking is optional
>>
>>60913456
I have not read the code in question, but, assuming a buffer of variable size, only one bound check needs to be done on the buffer - before starting itteration. Can't be that much of an overhead. If the size of the buffer is known at compile time, than all bound checks are eliminated at run time.
>>
File: help2.png (68KB, 1345x893px) Image search: [Google]
help2.png
68KB, 1345x893px
>>60913390
please teach me a better way to code pic related
>>
>>60909532
lol, I don't work
>>
>rustlets who can't even read programs claim to have the answers to serious engineers problems
Shameful.
>>
>>60909532
Most of my code can't be unit tested effectively. The code that can is not where I make time consuming bugs.
Though admittedly I do asserts which catch errors. It's a type of unit testing.
>>
>>60913604
forgot to mention that, the vowels had to be in defined constant while the odd numbers had to be in literal constants
>>
void main()
{
import std.range : zip;
import std.stdio;
auto vowels = ['A','E','I','O','U'];
auto nummap = [1,3,5,7,9];
writeln(zip(vowels,nummap));
}


[Tuple!(dchar, int)('A', 1), Tuple!(dchar, int)('E', 3), Tuple!(dchar, int)('I', 5), Tuple!(dchar, int)('O', 7), Tuple!(dchar, int)('U', 9)]


im sure you can et even more terse but im a shitter
>>
>>60913667
>>60913604
>>
>>60913667
What language is this?
>void main
This triggers me.
>>
>>60913688
D
int main is for losers
>>
>>60913604
Use a character array (string).
>>
>>60912419
>gonewildaudio
ah, a man of culture
>>
>>60913667
Learn to use UFCS
void main()
{
import std.range, std.stdio;
immutable auto vowels = ['A','E','I','O','U'];
immutable auto nummap = [1,3,5,7,9];
vowels
.zip(nummap)
.writeln;
}
>>
>>60913604
#include <stdio.h>

int main(void)
{
char numbers[] = { '1', '3', '5', '7', '9', '\0' };
char vowels[] = { 'a', 'e', 'i', 'o', 'u', '\0' };

for (char c : numbers) {
printf("%c ", c);
}
putchar('\n');

for (char c : vowels) {
printf("%c ", c);
}
putchar('\n');

return 0;
}
>>
>>60913715
i do use UFCS, but in this example i thought it cleaner just to print.
>>
>>60913715
>>60913732
also auto would be redundant there since auto c++ is implicit in D and d's auto is C's auto
>>
>>60909499
std::bind(instance, &Unit::Sense)
>>
Reverse an associative array
burger: cucks, faggots, fatass
UK: cucks, skin-deseases
AU: skin-diseases, cancer

becomes

cancer: AU
cucks: burger, UK
fatass: burger
skin-deseases: AU, UK
>>
>>60913725
how about just
#include <stdio.h>

int main(void)
{
char numbers[] = { '1', '3', '5', '7', '9', '\0' };
char vowels[] = { 'a', 'e', 'i', 'o', 'u', '\0' };

printf("%s\n%s\n", numbers, vowels);

return 0;
}
]/code]
>>
Should I learn D or Rust?
>>
>>60913792
Rust is more functional, D is more productive
>>
>>60913792
One has a questionable future. The other has no future.
>>
>>60913792
Why not both? Neither gets you employed anyway, both will make you hate c++
>>
>>60913797
Functional as in Functional programming?
>>
>>60912484
Use tmux.
>>
>>60913805
Yes, it has map, fold, zip, nth etc in the stdlib built in
>>
>>60913792
Rust
d(ead) is a meme
>>
>>60913815
>Yes, it has map, fold, zip, nth etc in the stdlib built in
D has all of those as well
>>
>>60913823
Rust has some nice ideas. But it's painful to do anything big.
>>
-_-
>>
>>60913835
Not in the standard library. It's scattered over std.algorithm.iteration and std.range

And they don't have many things Rust does. Although the same can be said about rust, but not as confidently

See how neatly they are organized
https://docs.rs/itertools/0.6.0/itertools/
>>
https://stackoverflow.blog/2017/06/15/developers-use-spaces-make-money-use-tabs/
Programmers that use spaces make 9% more than those that use tabs. Tab users eternally BTFO!
>>
>>60913856
>standard.range is not a standard library
wew lad
>>
>>60913856
>std. prefixed modules aren't the standard library
really makes you go hmm
>>
>>60913869
Also what HOF does Rust have that D doesnt?
>>
>>60913860
Didn't you post it already?

>>60913869
>>60913884
Oh my bad LOL

The thing with Rust is, you don't have to go through the pain of calling the imports individually
imagine this:

import std{stdio, algorithm, range:iota}
>>
>>60913888
nth comes to mind first
>>
anyone know anything about natural language processing? Looks like the options are sphinx, julius, or kaldi. Can any of these keep up with normal speaking pace? Doesn't have to be real time, just want it to transcribe conversation with decent accuracy
>>
>>60913897
>rustlet talking about a language hes never used
 import std.range,std.stdio;
>>
>>60913924
You had to mention std twice already
>>
Working on my network packet parser/builder library for Rust.

Finished adding basic documentation to everything, added AsPacket and AsPacketMut traits, started adding in-place setters for various packets with automatic checksum if wanted (I went with a variant of what that anon said he did in C++, because eh).

Rust anon that was interested in it a couple days ago, I'll be done with the setters in a couple hours, so check the git version out tomorrow.
>>
>>60913924
You know exactly what he meant
>>
>>60913924
It's not just him that's never used D, nobody has ever used D
>>
>>60913897
>Didn't you post it already?
I didn't notice someone beat me to it. lol.
>>
>>60913932
>>60913938
Then its just nitpicking at this point.
D still does many,many things more simple than rust
>>
>>60913968
Yes, D is a massive language
>>
>>60913962
Nice try
>>
>>60913767
That was fun
use std::collections::HashMap;
use std::hash::Hash;

fn reversed<'a, K, V>(map: &'a HashMap<K, Vec<V>>) -> HashMap<V, Vec<K>>
where
K: Clone + Hash + Eq + 'a,
V: Clone + Hash + Eq + 'a,
{
let mut reversed = HashMap::new();

for (key, value_list) in map {
for value in value_list {
let entry = reversed.entry(value.clone()).or_insert_with(Vec::new);
entry.push(key.clone());
}
}
reversed
}

fn main() {
let mut map = HashMap::new();
map.insert("burger", vec!["cucks", "faggots", "fatass"]);
map.insert("UK", vec!["cucks", "skin-diseases"]);
map.insert("AU", vec!["skin-diseases", "cancer"]);

let rev = reversed(&map);

println!("{:?}", rev);
}
>>
>>60913902
d has a whole submodule dedicated to iteration
std.algorithm.iteration
>>
>>60913805
>Functional as in Functional programming
What is an ``Functional" and ``Functional programming"?
>>
When it comes to template meta programming D beats the fuck out of Rust any day any time.

My biggest gripe against D is their GC's stop-the-world feature which I really hope they fix
Sociomantic is currently working on porting their D1 GC lib to D2 so we can have GC in a separate thread all together
>>
>>60914021
Meh I think you have to emulate nth by using drop(n).front()
>>
>>60914011
Also, the syntax highlighter apparently cannot handle unbalanced quotes
>>
>>60909532
>>>"Hacker" "News"
>>
/dpt/ is there a more efficient implementation of a bidirectional associative container than just two hash maps that are maintained as converses of one another?
>>
File: 2017-06-15 12_50_31.png (34KB, 1583x837px) Image search: [Google]
2017-06-15 12_50_31.png
34KB, 1583x837px
>>60913812
Ayyyy

Post your setup
>>
I'm a webdev, trying to level up. I'd like to get into network traffic analysis/shaping. What language is best for this? The voip guys at my last company used Go
>>
>>60914070
start with node, make your way to C
>>
File: 1497484828388.png (316KB, 500x556px) Image search: [Google]
1497484828388.png
316KB, 500x556px
>>60914079
>>
>>60914041
drop is redundant in D given slices
>>
>>60914089
speaking from experience:
>when you are autistic and anything unexpected happens regardless of whether or not it affects you
>>
File: 1445705986467.jpg (31KB, 853x480px) Image search: [Google]
1445705986467.jpg
31KB, 853x480px
what happens when the os segfaults?
>>
>>60914153
The garbage collector deletes the kernel
>>
File: Afra_013.jpg (2MB, 3008x2000px) Image search: [Google]
Afra_013.jpg
2MB, 3008x2000px
I have no idea how to do correct aggregation.
For example, we have a dress. So, a correct example is
Dress -> Cloth -> Thread

How do I do that with pistol, for example? As far as I know pistol can exist without ammo, meanwhile dress can't exist without cloth. Am I even doing the right thing?
>>
>>60914070
A good place to start is to use the C api.
There is a lot of tutorials on how to do it, eg.
http://www.binarytides.com/packet-sniffer-code-c-linux/
>>
>>60913767
Presumably, you meant "diseases" and not "deseases" and also intended for "faggots: burger" to be in the output.

Anyway
let rev = k => { let m = {}; for (i in k) { for (j of k[i]) { m[j] = (m[j]||[]).concat(i) } }; return m }


>rev({burger: ['cucks', 'faggots', 'fatass'], UK: ['cucks', 'skin-diseases'], AU: ['skin-diseases', 'cancer']})

{ cucks: [ 'burger', 'UK' ],
faggots: [ 'burger' ],
fatass: [ 'burger' ],
'skin-diseases': [ 'UK', 'AU' ],
cancer: [ 'AU' ] }
>>
File: faps.png (4KB, 194x919px) Image search: [Google]
faps.png
4KB, 194x919px
>>60912419
>>60913705
The idea is to stop consuming pornography. The red dots here show where I failed and watched something that had bare boobs in it. From the beginning to the first red is over 52 days. Still haven't watched real porn in the whole 78 days, though.
>>
>>60914326
for what purpose
>>
>>60914333
It's fun to log it all and make programs to analyze and visualize the data. Also, it's about exercising willpower and improving yourself.
>>
>>60912419
>Red = non-nude vid
>>60914326
>The red dots here show where I failed and watched something that had bare boobs in it
What?
>>
>>60914370
I changed the colors in between posts. Sry
>>
>>60914361
just stop watching 3D, desu
>>
>>60912419
>>60914326
Are the rows weeks?
>>
>>60914377
One of the goals is to become more aroused by real-life stimuli. 2D does not help this goal at all.
>>
>>60914062
Literally just use a list of pairs at this point
>>
>>60914333
>he hasn't taken the glorious pill yet

https://www.youtube.com/watch?v=j0s3WFENlZ4
https://www.youtube.com/watch?v=guck9gUOIls
>>
>>60914153
When a segfault happens in x86 (although modern systems use paging and not segmentation) the page fault handler (a program pointed to by a special part of the cpu) gets called. When any fault handler triggers another fault a double fault happens and the double fault handler is called (only for some fault combinations however), if this faults then a triple fault happens and the computer reboots.
>>
>>60914420
Lists has linear lookup time

Hashmaps are constant lookup time.
>>
>>60914401
No, I just set a maximum amount of rows so that it would fit on one screen and then make some computations that spread them all out, still in chronological order.
>>
What is the monitor setup of /dpt/?
>>
>>60914448
*on average
>>
>>60914448
If you have a good hash function. If you have a lot of collisions then it degrades to logn.
>>
>>60914490
Still. What's the difference between log(n) and n?

And good hash functions are easy to come across with simple types
>>
>>60914490
>If you have a lot of collisions then it degrades to logn
n*log(n)

log(n) would be better than n
>>
>>60914453
Single 27'' monitor, tiling WM
>>
Holy crap. It's 300. Why isn't there a new thread yet?
>>
>>60914569
Because we 310 dummy.
>>
>want to fix my Lisp interpreter because it's full of spaghetti code
>but have to finish another assignment by tonight
>>
>>60913812
I don't want to deal with setting up any config files. I just want to start an app and type things.
>>
>>60914589
tmux doesn't need any configuration.
>>
>>60914589
You didn't even try to Google you lazy faggot
>>
File: 1497546824.png (7KB, 718x51px) Image search: [Google]
1497546824.png
7KB, 718x51px
>>
>>60914645
>>60914630
Does it replace my default bash when i press ctrl+alt+T? I'm using ubuntu
>>
File: 1495379013447.jpg (59KB, 408x439px) Image search: [Google]
1495379013447.jpg
59KB, 408x439px
>>60914744
>object-oriented
>good software engineering
>>
>>60914747
No.
>>
File: 13751.png (37KB, 1411x228px) Image search: [Google]
13751.png
37KB, 1411x228px
gotta love APL
>>
>>60914775
t. expert kernel hacker who never makes any mistake and survives in the depths of spaghetti code
>>
>>60914744
Buzzwords from the '90s.
>>
>>60914744
>C++
>Enforcing kind of practice
>>
NEW THREAD!!

>>60914806
>>60914806
>>
>>60914453
3 1080p monitors, the center one is vertical
>>
>>60914744
This is literally correct.
>>
>>60914817
C++ does not enforce any way of doing things, let alone a good one.
>>
>>60914782
thanks
>>
>>60914191
BUMP
>>
>>60916001
Thread is dead, and on page 8, retard.
>>
File: 1488461192048.png (107KB, 710x250px) Image search: [Google]
1488461192048.png
107KB, 710x250px
>>60909532
No.
Thread posts: 322
Thread images: 45


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