[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vr / w / wg] [i / ic] [r9k / s4s / vip / qa] [cm / hm / lgbt / y] [3 / aco / adv / an / asp / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / qst / sci / soc / sp / tg / toy / trv / tv / vp / wsg / wsr / x] [Settings] [Search] [Home]
Board
Settings Home
/g/ - Technology


Thread archived.
You cannot reply anymore.



File: 1486137983812.png (56 KB, 853x621)
56 KB
56 KB PNG
What are you working on, /g/?

Last thread: >>69749453
>>
nth for Nim!
>>
Reminder that dynamic typing isn't actually real and static type systems are a superset of unityped type systems.
>>
ummm McAfee keeps deleting my C .exe files as soon as soon as I tried to run them
>>
>>69756238
turn it off?
>>
>>69756238
maybe your C compiler is infected and produces malware
like Visual Studio was known to inject microsoft malware into EXE files (telemetry)
>>
>>69756253
>>69756265
please stop replying to /sqt/ posts.
>>
>>69756253
>>69756265

nah, just McAfee is being ultra chad protection mode today it being monday
>>
>>69756272
well I was going to tell you what I was working on over the weekend but I wont now.
>>
File: 1548020984592.jpg (32 KB, 401x500)
32 KB
32 KB JPG
>>69756323
>>
File: jlxln7at6x911.jpg (45 KB, 750x578)
45 KB
45 KB JPG
im currently learning c for understanding how some interesting things such as st ghc and *nix written
is it worth to learn see blus blus after?
>>
>>69756381
dumb frogposter
>>
>>69756381
>is it worth to learn see blus blus after?
Learn LISP or Scheme before C++
The correct order is:
C, Scheme, C++
>>
File: 1526965794262.jpg (657 KB, 2248x4000)
657 KB
657 KB JPG
Reminder that C is the only serious programming language.
https://dl.suckless.org/slcon/2013/slcon-2013-4-nsz-the_costs_of_abstraction.webm
>>
Is float actually faster than double on modern x86 CPUs?
>>
>>69756461
*segfaults*
>>
>>69756197
True. Such languages actually have untyped variables. The Ruby man page is clear on that.
FEATURES
Ruby's features are as follows:

Interpretive
Ruby is an interpreted language, so you don't have to recompile programs written in Ruby to exe‐
cute them.

Variables have no type (dynamic typing)
Variables in Ruby can contain data of any type. You don't have to worry about variable typing.
Consequently, it has a weaker compile time check.
>>
>>69756177
Why do Suckass fags preach about minimalism, yet use X?
>>
>>69756470
Yes, quite noticeably. Being smaller, vector instructions can "fit" more individual numbers in a single instruction.Try and see for yourself.
>>
>>69756470
if you're doing operations on multiple floats at a time
>>
>>69756381
C++ is a badly designed language. Learn it too early and it'll tarnish your ideas of good programming language design.
>>
>>69756461
Computer science is the study of abstraction.
>>
>>69756512
wrong
>>
>>69756255
fuck off you disgusting piece of shit
>>
>>69756480
why do you care about Suckass being not minimal?
>>
>>69756527
this
>>
>>69756512
Don't tell that to Ctards.
>>
>>69756567
>C
>not abstract
>>
>>69756576
Ctards believe their language is somehow low level and does not abstract anything.
>>
>>69756255
I want her to pee on me
>>
>>69756626
die
>>
>>69756461
Ctards don't know a thing about compilers, abstractions, or programming languages.
>>
>>69756627
I will, after she pees on me. Though not immediately, I will take my precious time to bask in the glory of course.
>>
I'm pretty new to programming and I just learned about OOP, like classes. I'm having a hard time with it because I don't see much value in using classes yet. Outside of the braindead simple printing examples in tutorials and such, I don't see anywhere where I would want to use classes.
This is a bit strange because with basically everything else I've learned I've been able to figure out many places to use them, but with classes I just have absolutely no idea.
>>
>>69756697
just use them like structs desu, fuck OOP
>>
>>69756697
Encapsulation is good. Having a clearly defined interface to something makes it easier to use correctly.
Try to avoid class inheritance. On the other hand, use interface inheritance a lot.
>>
>>69756638
C is great for learning all 3 of those
>>
>>69756723
Ironically, Ctards still don't know anything about them.
>>
I am pretty damn useless at my job, but everyone likes me, so lots of my wrongdoings or slackening goes magically unnoticed.
Should I have gone for manager, instead of developer?
>>
>>69756697
It's probably because you haven't programmed something complex enough that makes OOP actually useful. Check out this challenge from last year's advent of code. https://adventofcode.com/2018/day/13

The problem is that you have a bunch of carts on a big map and you're asked to move them around and see what happens. All the carts move using the exact same logic, so it makes sense to use OOP to make a cart object.

It simplifies things because now you're just keeping track of abstracted "cart objects". The movement logic is all handled internally by these objects and you don't have to really keep track of it. Instead you can focus on what you really want to track which is where collisions are taking place.

There's a follow up challenge to this which operates similar but adds a lot more complexity and rules to follow. https://adventofcode.com/2018/day/15
You need someway to abstract out the complexities of these objects so that they're just an "object" that operates internally.
>>
I've been trying to think about a way to do a Markov Chain simulation (polymerisation example in last thread) using matrices instead of if statements. Can't figure out how I would go about this. Was thinking about generating random matrices and using these as the steps. Seems like it would be faster in terms of being able to be more parralel.
>any ideas /g/men?
>>
>>69756721
>Try to avoid class inheritance. On the other hand, use interface inheritance a lot.
class inheritance is faster than interface inheritance
>>
>>69756893
https://yanniss.github.io/117-15/oopsla01.pdf
>>
>>69756801
Management involves going to a lot of meetings and conforming to gant charts. Better to stay a rich developer with less things to worry about when you go home.
>>
>>69756854
Why wouldn't you just use some basic data structure to hold records of carts and then update the structure using pure functions? I don't see how using OOP semantics adds anything here
>>
>>69756903
singly inherited methods dont need to be virtual
multiply inherited methods always do
>>
>>69756912
If you update something, the function is not pure.
>>
>>69756943
That was a bad choice of words, obviously the root variable containing the data needs to be mutated, and using pure functions wasn't even central to the point I was trying to make, use them where it makes sense.
>>
>>69756854
OP here, thanks.
>>
>>69756912
because OOP grants you the power of polymorphism by overriding methods
>>
>>69756982
existentials and closures are at least as powerful while being simpler and more basic
>>
File: kk.png (269 KB, 699x701)
269 KB
269 KB PNG
hmmmm
>>
>>69756982
Yuck, it works but I really wish generics were handled better in mainstream languages. Interfaces is ok but something like typeclasses would make more sense so that you wouldn't need to shove any functions into your records if you don't wish to.
>>
>>69757001
no idea what an existenial is
closures aren't really simpler
people seem to have a hate-boner for OOP and act like other methods of polymorphism are superior when they all do basically the same thing
>>
>>69757021
typeclasses are the same shit except you write your code in a different place
>>
>>69757038
Yep, not much difference in practice but like I said they're just nicer(tm)
>>
Hello, can you recommend me a book about writing drivers in Windows?
>>
>>69757067
sounds like baby duck syndrome to me
>>
>>69757023
An existential lets you hide some type information. There's a more restricted version of this in Java using ?. I could go into more detail but existentials aren't strictly necessary (though they're quite useful). Basically all you want in this case is something like std::function. Now you could implement that using void*, or using OOP virtual methods, or using existentials. Or you could have it as a language feature.
Closures are very simple, it's just a function. It's one of these "basic" building blocks like a struct or a union.
The problem with OOP is it combines all of these things with its notion of object and internal logic, when this isn't necessary.
>>
is there no point anymore in learning C to do actual noticeable projects?
does anyone even makes desktop software or everything became web app except for few big softwares like photoshop etc.
>>
>>69757085
Huh? Having a preference is baby duck?
>>
File: bjarne-bldl-opening.jpg (52 KB, 897x429)
52 KB
52 KB JPG
"People write this ugly pointers-and-array kind of code which they then think is more efficient. It often isn't."
>>
>>69756912
Of course anything that can be programmed using OOP principles can also be programmed without using them. It's just a matter of style and readability. Personally I like that all the methods of an object are all in one spot or at least easy enough to find. If you're doing everything just with functions, data in, data out, it can be more difficult to keep track of.

cart.tick() seems pretty straightforward. You can tell cart is an object and you're calling it's tick method. There's nothing else it could be.

tick(cart) is more ambiguous. "cart" can be anything. Is it a boolean? string? struct? How can you be sure you're giving tick() the right data in the right format? Especially if you don't write the program yourself.

And if you're using an IDE typing "cart." should pop up a list of suggested methods and properties, whereas typing tick( will probably just give the declaration "tick(cart)" which isn't as helpful.

Again it all comes down to preference really.
>>
>>69757093
a closure is a function with an attached context
>>
>>69757130
Yeah, I know.
>>
>>69757127
>tick(cart) is more ambiguous. "cart" can be anything. Is it a boolean? string? struct? How can you be sure you're giving tick() the right data in the right format? Especially if you don't write the program yourself.
that's what a type system is for dumbass
>>
>>69757127
Noted.
>>
File: иван.jpg (21 KB, 480x360)
21 KB
21 KB JPG
>>69756638
Your words are empty, this is either a provocation, or your terrible nonsense, fucking degradant.
>>
>>69756588
We have zero-costed abstractions. (Your words are empty, this is either a provocation, or your terrible nonsense, fucking degradant.)
>>
>>69757095
It's nice to know a bit of C to get an idea of what programming was like before languages came with abstract data structures by default and before you could just import 90% of your project. C is just a bit too cumbersome to actually use as a daily programming language since more modern languages can accomplish the same thing with much shorter and more readable code.

Lots of desktop apps are created, especially if you're into using open-source software. If you're into proprietary stuff then yeah most have switched to web apps since you can't pirate those.
>>
File: C grugs.png (345 KB, 1200x699)
345 KB
345 KB PNG
>>
>>69757145
Not every language has a robust type system that will warn you that you're mixing types at compile time (if there even is a compile time). Many languages will allow you to program something that obviously won't work and will then only crash during run-time when you attempt to do it.
>>
>>69757095
desktop applications still exist
mainly video games
>>
>>69757188
>Not every language has a robust type system that will warn you that you're mixing types at compile time
any statically typed language will tell you when you're calling a method that object doesn't have and you the programmer will know that ahead of time because you know what type something is
where the fuck do people like you even come from
are you another Haskell and JavaScript programmer expert
>>
>>69757209
He means that free functions won't warn you about this sort of thing but methods will.
>>
>>69757230
all functions will
in a statically typed language
which is most OOP languages
why are you even talking about this if you've never used one
>>
>>69757232
>equating static typing with pOOP
>bragging about using pOOP languages as if it's an accomplishment
My sides

Stay uneducated m8
>>
>>69757178
>>69757190
>only open source and video games
my god, javascript and the internet will be the end of it all
>>
>>69757249
The discussion is about OOP you stupid fuck
The big OOP languages are statically typed
>>
>>69757255
The "big" languages you're probably referring to are also all-around terrible.

Smalltalk is dynamically typed.
Python is dynamically typed.
Ruby is dynamically typed.
>>
>>69757252
there's probably alot of boring business software programmed in C++ if that's what you perfer
big desktop applications are all C++ too
>>
>>69757272
apples and oranges
if you use dynamically typed scripting languages then that's what you're gonna get
>>
C++

char *temp = (char*)"abc";

struct->voidp = &temp;

// Later

char* temp = (char*)struct->voidp;


Can someone tell me what I'm doing wrong here? Garbage is printed
>>
>>69757178
>C is just a bit too cumbersome to actually use as a daily programming language
I dont agree.
even C elites expect 90% of the job to be library or API written by someone else.
That is simply wanting to shoot yourself in the ass.
With C if you want something to work you have to write it yourself and that a task nobody wants to do.
>>
>>69757302
There's no practical reason to use C over C++
>>
>>69757288
All of those are prime examples of pOOP. Also what are you using the term "scripting language" for?
>>
>>69757311
I dont know,I use it because I have the time to use it and i cant be bothered to learn a new language.
>>
>>69757301
You're casting it to a char* not a char** (which is the type of &temp).

Also, if &temp is a local variable it may be going out of scope.

You probably just want to do struct->voidp = "abc"
>>
>>69757311
I can respect that people who are paranoid about implicit memory allocation (kernel/firmware developers) choose to use C where things have to be spelled out.

The difference in ergonomics between the languages is palpable though. I don't know how long I would last if I had to go back to C.
>>
>>69757301
you're setting char* temp to a double pointer.
replace
struct->voidp = &temp; 
with
struct->voidp = temp; 

also for the love of god don't use void pointers in C++. they break type safety and they're much slower for generic functions
>>
>>69757314
OOP doesn't make as much sense in dynamically typed languages for the reasons already pointed out
The "prime examples" of OOP are Java and C++
if scripting langs are using OOP that's their mistake, not OOPs
>>
File: confused-sakura.gif (61 KB, 260x200)
61 KB
61 KB GIF
>>69757350
>OOP doesn't make as much sense in Smalltalk
>>
>>69757095
>is there no point anymore in learning C to do actual noticeable projects?
no
>>
>>69757350
>dissing the father of OOP and shilling Java
You're a lost cause, quite frankly

Also, OOP doesn't make much sense in any language.
>>
What is OOP and why is it bad
>>
>>69757384
afaik OOP in Smalltalk pretty different to the ubiquitious version of OOP implemented in Java and C++
I'm not shilling Java, I'm saying it's popular
>>
>>69757396
It helps nothing and gives the programmer useless busywork over just using functions and data structures like a normal person.
>>
i seriously wonder if it's just the same people arguing about oop for years or if there's a steady flow of people that are new to the thread that discuss oop once they're comfortable and then never again.
seriously, almost every single thread over the past five years or something has discussed the same garbage; oop, c, haskell, dynamic typing, etc.
i haven't visited this thread in years and literally nothing changed
>>
>>69757408
haskelltards are definitely the same people
>>
>>69757408
it's good this way anon
>>
File: 1439061543070.jpg (162 KB, 1920x1080)
162 KB
162 KB JPG
>>69757255
>The big OOP languages are statically typed

javascript
ruby
python
php
clojure
dart
>>
>>69757408
How about you keep another five year break now?
>>
>>69757435
She said big not memes
>>
>>69757435
Webdevs are like the Americans of programming
they think they're the only people that matter and are hilariously ignorant of anything outside their domain
>>
>>69757339
>>69757342
Thx O_O
>>
>>69757209
Yeah that's what my post was saying. If you're using object and methods than you're less likely to call a function with improper arguments. If you do everything using "just functions" then there's the chance the language won't warn you of this and as a programmer the error will be harder to spot since everything is valid syntactically.
>>
>>69757453
sure i'll probably get bored of the thread again in a few days and fuck off
>>
>>69757475
statically typed languages will warm you whenever you make a typing mistake, OOP has nothing to do with it
>>
>>69756177
Golang is such a shit language. It's basically unreadable.
>>
>>69757095
embedded and systems programming are the area of C. Also high performance/real time systems in general (C++ may also apply)
>>69757190
>games in C
>>69757252
JavaScript won't be the end, it will be the beginning.
The future is going to be running programming languages on top of JavaScript. Look up Wasm.
>>
>>69757497
imagine being dumber than the average gotard
you're the exact kind of person that rob pike made go for, anon
>>
>>69757497
Literally the only benefit of Go is that it's so incredibly easy to read.
>>
Don't learn C for games unless you want to write the engine. Just go use Unity or Unreal and get on with making your game.
>>69757506
>>69757515
Any language that has me using => or other hieroglyphics to write code is shit.
>>
File: aaaaa.png (49 KB, 1039x449)
49 KB
49 KB PNG
I've recently started doing leetcode and pretty much every time my memory usage is higher than 99.5% of submissions. How is this using 11mb of memory when other submissions are almost the same?

Even if it's a problem where I'm only swapping elements in an array it's the same. Is there something wrong with the memory usage checker?
>>
>>69757526
Unreal uses C++ genius
>>
>>69757526
what does => have to do with go
>>
>>69757530
test it yourself? try printing it out to make sure it's not adding more than you'd expect
>>
File: hi2.gif (1.59 MB, 960x1152)
1.59 MB
1.59 MB GIF
Writing some elisp
>>
>>69757538
And you can do 90% of the game without touching C++.
>>
>>69757553
no, C++ is the only programming language it uses, unless you mean blueprints
>>
>>69757547
>>
>>69757530
idk. If the majority of submission have the exact same memory usage count, one byte more or one byte less can send you from the 99th percentile to the 1st. We'd more information to say what's going on (say median, mean, variance, etc.)
>>
Friendly reminder that it's "Hello, World!", not "Hello World!".
>>
>>69757547
>>69757564
I just copied and submitted the code from a submission that had 800kb memory usage and it used 11.8mb memory for me. Can't find anyone complaining about this anywhere though.
>>
>>69757561
You know that there is more to the game than the engine right?
>>
>>69757566
friendly reminder that it's "Goodbye, World!"
>>
>>69757569
Like I said, ALL programming in Unreal takes place in C++
>>
File: 1538644063084.png (176 KB, 821x1011)
176 KB
176 KB PNG
>>69757552
GNU bless anon
>>
File: reboot.jpg (41 KB, 650x520)
41 KB
41 KB JPG
>>69757577
What part of this is Unreal ?
>>
>>69757561
But blueprints are fine for most gameplay programming. You really only need to use C++ for the more computationally intensive parts and you can pretty seamlessly interop with blueprints.
>>69757577
Don't discriminate against blueprints!
>>
>>69757588
their skin color looks pretty unreal
>>
>>69757588
terrifying
>>
>>69757592
Blueprints are for amateurs who haven't programmed, once you know what you're doing writing the code is faster
>>
>Looking at 72 an hour
>Company uses web forms
I'm already at 100k a year but that's about 50k more a year on a 2 year contract and it's W2'd...

/prog/ what says you?
>>
>>69757619
jobs are for faggots
>>
File: movietricks.webm (1.97 MB, 340x600)
1.97 MB
1.97 MB WEBM
>>69757609
Yeah man totally. Instead of using a pre-built engine with pre-built things that are already tested 1000 times over by hundreds of companies. It's way faster to run into all these problems yourself and fix them while you also create the code.
Totally bro.
>>
>>69757619
what do you want in life?
>>
>>69757643
what the fuck are you talking about?
Blueprints accomplish the same function in Unreal as writing code, they're just easier for beginners. It's like using cutouts of words instead of typing them yourself
>>
File: money.jpg (45 KB, 623x221)
45 KB
45 KB JPG
>>69757619
Yawns.
>>
>>69757568
Good way to prove that their measurement process is inconsistent. It's true that it doesn't tell us how that happened.
>>
File: Capture.jpg (1 KB, 48x38)
1 KB
1 KB JPG
>>69757658
"Amateurs" hur hur.
>>
>>69757692
Are you replying to the wrong person?
>>
>>69757609
Writing blueprints as code would be faster than visual blueprint programming, but writing C++ is slower than visual blueprint programming.
>>
File: 1549453119433.jpg (28 KB, 450x450)
28 KB
28 KB JPG
https://github.com/ghc/ghc/blob/a5373c1fe172dee31e07bcb7c7f6caff1035e6ba/libraries/ghc-prim/GHC/Tuple.hs#L170
>>
File: 1549349771504.jpg (29 KB, 320x320)
29 KB
29 KB JPG
>>69757721
don't look!!
>>
>>69757721
>https://github.com/ghc/ghc/blob/a5373c1fe172dee31e07bcb7c7f6caff1035e6ba/libraries/ghc-prim/GHC/Tuple.hs#L170
Fucking what?! Lol.
Pajeet will never complete his code class with this.
>>
>>69757721
DELET!!
>>
>>69757645
To be content and die of old age with a loving family
>>
File: 1549007875199.png (76 KB, 200x275)
76 KB
76 KB PNG
>>69757721
>>
>>69757764
>>
>>69757754
>[...] die [...]
sounds good
>>
File: 1549010118457.png (648 KB, 724x712)
648 KB
648 KB PNG
>>69757721
https://github.com/Marwes/haskell-compiler
doesn't have this problem
>>
>>69757754
then you probably don't want to be working too many hours
>>
>>69757721
can someone explain me why is this a bad thing, or what is the program supposed to do
>>
>distributing scripts that can't handle spaces in paths
Stop this.
>>
>>69757829
it just defines a bunch of tuple types
>>
>>69757830
Special characters should also be handled, as well as leading "-"
>>
File: 1546644735971.jpg (13 KB, 235x283)
13 KB
13 KB JPG
>>69757721
Someone put a CS undergrad meme on it
>>
Which database is well suited for batch membership in a large set?
>>
Is it wrong that seeing data annotations in a model sends me into a deep depression. I mean it's one thing when it's a Jr developer but when the senior dev that interviewed you is doing it as well. I had to explain to him why it's a validation of SOLID and a code smell
>>
File: 1547875587298.jpg (168 KB, 1280x720)
168 KB
168 KB JPG
>>69757856
pls do not bully haskell
>>
>>69757721
That note is actually outdated. You can actually set the tuple limit arbitrarily high now, but you still need to supply the definitions in Tuple.hs

>>69757829
Tuple definitions for lengths 1 to 62.
Ideally you would just have a single definition for abirtrary lengths, but nobody cares enough.

>>69757856
You know that his was automatically generated, right? It's literally the easiest way to do it.
>>
>>69757721
Even C++ does this better
>>
>>69757926
I'm not even sure how you'd implement std::tuple outside of multiple inheriting wrapper structs
>>
Function A

type original; // parameter

type *a = new type(original);


Does a exist outside of this function? If not can I make it exist?
>>
>>69757993
Yes.
Remember to delete it when you're done.
>>
How can R*stlets claim they have a "safe" language and then go and use lazy typing? Absolute mongs.
>>
>>69757993
yes. whenever you use the new operator the object created will exist without a lifetime on the heap, therefore you also need to delete it yourself. You should check out
std::unique_ptr
as turns a into a scoped variable and will delete it for you so that you don't have memory leaks.
>>
>>69758035
define lazy typing
>>
>>69757941
Recursion over a variadic template.
>>
>>69757829
You have to define tuples of X number of items if they don't exist. It is the same shit in Java except you have to name them Tuple1, Tuple2, Tuple3..etc because of type erasure.
C++ doesn't have this problem because of variadic templates since C++11 which is pretty cool and C# went slightly further since C#7 introduction of ValueTuple which allows for optional compile time names of items.
TL;DR programming languages should have tuples baked in or have ways to easily and safely express them.
>>
https://youtu.be/iSmkqocn0oQ
HASKLELTARDS ON SUICIDE WATCH
HOW WILL THEY EVER RECOVER?
>>
>>69757941
I've done it.
>>
>>69758052
Not declaring type during variable declaration.
>>
>>69758322
Type inference does not affect safety.
>>
>>69758287
SPJ seems nice
>>
>>69758287
he cute
>>
>>69758364
you too a cutie
>>
>>69758287
Fuck off Simon, nobody likes you.
>>
File: 1520019389770.gif (256 KB, 275x179)
256 KB
256 KB GIF
http://www.winestockwebdesign.com/Essays/Lisp_Curse.html
reading this really discouraged me from using lisp
>>
Can someone help me understand radix sort?
Why does the line *copyfirst++ = *it++ change the input iterator?
template <typename ForwardIterator>
void radixsort(const ForwardIterator first, const ForwardIterator last, int factor = 10)
{
// partitionieren
std::map<int, std::vector<int> > buckets;
for (ForwardIterator i = first; i != last; ++i) {
// die gewünschte Ziffer ermitteln und im Bucket mappen
if (factor == 10) buckets[*i%factor].push_back(*i);
else buckets[(*i/(factor/10)) %10].push_back(*i);
}

// sammeln
ForwardIterator copyfirst = first;
for (int i = 0; i < 10; ++i) {
for (std::vector<int>::const_iterator it = buckets[i].begin(); it != buckets[i].end(); )
// Sammeln und Änderungen auf den Iteratorbereich [first, last) anwenden
*copyfirst++ = *it++;
}


if (factor > *std::max_element(first, last)) {
// Höchstwertigste Ziffer bereits erreicht
return;
} else {
factor *= 10;
radixsort(first, last, factor);
}
}
>>
Doing an Intro to Algorithm Design and Analysis class. How am I supposed to approach questions like these? I'm retarded and don't even know where to start.
>>
>>69758487
Pay attention in class.
>>
>>69758435
fuck off nazi
>>
>>69758501
I did. Professor and textbook only show examples where the variables are actually defined, and not arbitrary. That's what screwing me up.
>>
File: TypeMan.jpg (325 KB, 2136x3216)
325 KB
325 KB JPG
>>69758287
what would spj know about hasklel
>>
>>69758527
It doesn't make a difference.
>>
>>69758487
How many times do you need to multiply b^2 by itself for it to equal to 1, i.e., for n/(b^2)^k to be 1 or less?
>>
>>69756505
I think c++11 fixed a bunch of things in the language. I think if you learn how to use it by reading modern c++ or some other book you can do a lot with it. However I will agree that it is a very bad to learn it first.
>>
>>69758541
>for it to equal to 1
*to equal n
>>
>>69758527
If you find it difficult to get started, try to just put in numbers to get a feeling for how it works. Once you have that figured out you can start to think about the general case.
>>
>>69758536
how do I do it then niggy? should I just pick an arbitrary b and n and calculate how many iterations it takes for n = 1?
>>
File: qtooltip.png (171 KB, 1230x932)
171 KB
171 KB PNG
any cpp/qt gurus know what is wrong with the below segment?
        foreach(const Model::Annotation* annotation, m_annotations)
{
if(m_normalizedTransform.mapRect(annotation->boundary()).contains(event->pos()))
{
setCursor(Qt::PointingHandCursor);
//QWidget::setToolTipDuration(5000);
setToolTipDuration(5000);
QToolTip::showText(event->screenPos(), annotation->contents()); //, m_annotations, QRect(), 5000);
return;
}
}

sources/pageitem.cpp: In member function ‘virtual void qpdfview::PageItem::hoverMoveEvent(QGraphicsSceneHoverEvent*)’:
sources/pageitem.cpp:414:17: error: ‘setToolTipDuration’ was not declared in this scope
setToolTipDuration(5000);
^~~~~~~~~~~~~~~~~~
sources/pageitem.cpp:414:17: note: suggested alternative: ‘setToolTip’
setToolTipDuration(5000);
^~~~~~~~~~~~~~~~~~
setToolTip
sources/pageitem.cpp: In member function ‘void qpdfview::PageItem::addAnnotation(QPoint)’:


setCursor(Qt::PointingHandCursor);
and
setToolTipDuration(5000);

both seem to come from the same base class, but compilation fails when I add the duration line.
https://doc.qt.io/qt-5/qwidget.html#details
I have qt 5.11, which should be more recent than 5.2 where duration was added.

I have also grepped the source tree for "cursor", and the only references to it I find are calls to setcursor and unsetcursor, without any specific redefinitions or includes in header files, so specifically including setdooldip duration does not seem like the issue.
>>
>>69758554
>should I just pick an arbitrary b and
Sure, do that. After you're done, replace your arbittrary b with b and arbitrary n with n, and calculate how many steps k it takes for n to become 1.
>>
File: 1463364140492.jpg (95 KB, 724x720)
95 KB
95 KB JPG
Employed Idris programmer reporting in
>>
>>69758487
in this case:
- find the closed form for n_i (value of n at iteration i)
- set n_i = 1
- solve for i
>>
>>69758528
Cute
>>
File: dbs_broly.jpg (103 KB, 1500x844)
103 KB
103 KB JPG
Employed C programmer reporting in.
>>
>>69758592
You're lying right
>>
Unemployed C programmer reporting in.
>>
>>69758528
awwww
>>
>>69758567
Those are probably member functions of the object, so you need to access them with something like widget.setToolTipDuration().
>>
>>69758592
Just because he writes Idris and is employed doesn't necessarily mean he is employed to write Idris.
>>
File: 1463363949111.jpg (36 KB, 511x509)
36 KB
36 KB JPG
>>69758651
>>
employed
>use whatever technology you want, just deliver me the project
programmer reporting in
>>
>>69758689
Haxe
>>
File: 1548350087270.jpg (102 KB, 600x823)
102 KB
102 KB JPG
C++26 is the ideal programming language.
>>
>>69756461
god that guy is a horrible speaker... wanted to give it a shot but i can't be fucked to listen to such fucking weanie
>>
>>69758487
n_i = n/(b^2)^i = 1 => i ln (b^2) = ln n => i = (ln n) / (2 ln b) = c ln n. It's bounded below and above with log n.
>>
File: 1529258026591.jpg (37 KB, 445x546)
37 KB
37 KB JPG
>>69756527
>reporting posts
don't be a shitter
>>
>>69758740
doubt
>>
>>69758740
W-what is she watching?
>>
>>69756255
>Disliking pee fetish
>>
>>69758740
idk man, the syntax is to complicated too me
>>
>>69758767
You
>>
>trying to teach retarded kid C
>he cant even figure out what the fuck a return does even when its spelled out multiple times for him and he gets all angry
This is actually fucking impossible to deal with
>>
File: anime girls3.png (901 KB, 1037x1056)
901 KB
901 KB PNG
>>69758794
>>
>>69758798
>>trying to teach retarded kid C
why though?
>>
>>69758567
>that deceptive "cute" cookie message
Anger.
>>
>>69758567
Qt is vomit. Stop using it.
>>
>>69758820
Hes suddenly all interested in making a game and he kept pestering me about it so I’m attempting to teach him but I have to say it it retard terms because “hes not a nerd” as he puts it
>>
>>69758754
Why would it be natural log?
>>
>>69757462
>ruby, clojure, dart, python
>web development
>>
>>69758860
Just wait until you have to explain pointers and memory to him
>>
>>69758541
>>69758576
So the amount of iterations would just be logb^2(n), then, right?
>>
>>69757675
>c@$h money
I'd take that.
>>
>>69758860
try teaching him js, retards love it
>>
>>69758866
Come on. Do some thinking yourself.
>>
>>69758860
>making a game
>C
Do you want to make him resent you later in life?
>>
>>69758919
I tried teaching js but he insisted on C, god knows why.
>>
>>69758918
Spoonfeed please.
>>
>>69758742
They are all so goddamn aggressive on the mailing lists, yet look how weak and unimposing they are irl.
>>
>>69756177
linus ebinedict torvalds
>>
>>69758846
I did not decide to write this in qt :c

>>69758674
I have no idea what widget to use desu.
so setCursor is not a member function? it works without using an object to access it.

captcha is being an absolute fucking shit today
>>
>>69758950
A logarithm in one base is equivalent to a logarithm in another base multiplied by some constant.
>>
>>69758939
>is a retard
>oddly insistent on using C
Made me think.
>>
File: 1529592260787.jpg (48 KB, 467x531)
48 KB
48 KB JPG
>>69758985
kek
>>
>>69756177
sigh.. I already knew rust was full of muts but a fucking Cow? Really?
>>
>>69758985
I kek’d for real
>>
>>69759021
>sigh
>>
File: 1526805251635.jpg (73 KB, 700x700)
73 KB
73 KB JPG
>>69759021
But cowtits are the best
>>
File: 1509887318116.png (499 KB, 1834x1200)
499 KB
499 KB PNG
>>69758985
>>
>>69758487
What about these?
>>
>>69759116
I think Loop2 is (n-100)/b
>>
>>69759116
>>69758612
seriously, those things are for you to practice, not for others to solve for you
>>
>>69759147
I'm a brainlet whose been working on this for hours, and this shit community college has jackshit for resources. I just need hints.
>>
Generally, how would you recommend to structure Go programs?
i.e. when to make a new file, new package etc.
Coming from a Java background where new class = new file generally.
>>
>>69759163
>>69758612
is literally an exact list of instructions on how to solve these problems. this has got nothing to do with "lacking resources", all you need to do is think for a second and apply some algebra you learned in school (extremely basic algebra).
you find the closed form by looking at some examples and then inferring the pattern (n, n - b, n - b - b, ... -> n - b*i).
if you gotta prove it correct as well, you use induction.
there aren't "algorithms" for everything in math/cs, you need to learn to think to solve problems ad hoc
>>
>>69759202
For Go programs I generally put them in the trash can.
>>
>>69759163
Look at successive values of n as a sequence. You have n_0 which is whatever, then n_i+1 = n_i - b given the code. Find a closed formula (n_i = something that doesn't refer to any previous value of n) for n_i. Then look at when the loop condition (n > 100) becomes false. And run the code on paper a couple time, that's the ultimate standard of what the solution to these kinds of problems is.
>>
>>69759116
2:
n_i = n - ib = 100 => i = (n - 100) / b = cn + k, i.e., linear.

3:
n_i = n x b^i = 100 000 => i ln b = ln 100 000 - ln n => i = (ln 100 000 - ln n) / ln b = c ln n + k, i.e., logarithmic
>>
>>69759202
>Coming from a Java
Go has an equally awful design so keep doing your thing
>>
>>69756177
>it's another "I have to make my own goddamn tools to solve a simple problem because everyone on the internet is a drooling retard mongoloid who can't write properly functioning code" episode
>>
>>69759202
it's similar to java. functionality that belongs together gets thrown into the same package, functionality that works together (uses private members or closely belongs together logically) gets thrown into the same file.
>>
>>69759202
Doesn't matter. Either way you're still going to get shitty overheadful codegen so why care about literally anything at all.
>>
>>69759279
https://www.reddit.com/r/iamverysmart/
>>
>>69759279
will you share your tools with everyone then anon?
>>
>>69757643
I thought they were gonna cosplay as rms
>>
>>69759231
For 2, what does
>n - ib
stand for exactly? Getting confused in the notation.
>>
>>69759442
i is the iteration
n_i (n at the ith iteration) = n - i * b
>>
>>69759442
jesus christ
is it really possible to be able to go to college in the us and have that little experience with math?
>>
>>69759481
yes
t. brainlet
>>
File: 1378166489927.gif (2 MB, 388x268)
2 MB
2 MB GIF
>>69759298
>>69759322
Stop making your fucking APIs with the final declaration so I can extend them and we wouldn't have this problem. I bet you fuckasses don't even document your code. Plus what's it matter if I share my tools? What're you gonna fucking do with them? 9 out of 10 times I'm using them for very specific problems. Dumb fucks
>>
>>69759497
Aren't you part of the problem then?
>>
>>69759497
All classes should be final, only interfaces should be inherited from. Don't @ me.
>>
>>69759539
>I want my API to be useless

>>69759521
Shut the hell up with your retarded strawmans. If you need my tools you can easily find them on Google.
>>
>>69759568
Maybe you should think more about other people
>>
>>69759568
>I enjoy strong coupling
>>
>>69759568
inheritance is a dirty hack to partially break encapsulation, might as well complain about encapsulation as a whole then
>>
>>69756177
Wrote a Java RSS reader so I can manage all the YouTube channels I like without an account. What should I use to display the feeds? Right now I am using just terminal output so it's hard for it to be very useful. Should I look into Java GUI shit or is there a easier way to display stuff in a formatted way in the terminal?
>>
>>69759679
https://github.com/mabe02/lanterna exists

learning java gui won't be difficult, if you don't care about your ui looking outdated.
>>
>>69756238
https://www.youtube.com/watch?v=bKgf5PaBzyg

Take McCafee's advice..
>>
>>69758882
>ruby and python primarily used for web dev
woah
>>
>>69759280
But for instance in my web application I have a handler.go file for all the handler files. A lot of the work they do also requires helper functions and it's getting a bit silly with how many functions I have in there that aren't explicitly handler functions, so I'm wondering if it's worth extracting some of them out that belong in the same sort of grouping?

e.g. have a filehandler.go file or something in the same package which the handler functions would use. I think it'd make the handler.go file a lot cleaner and cohesive.
>>
>>69757178
>It's nice to know a bit of C to get an idea of what programming was like before languages came with abstract data structures by default
Hahahahahaha
>what are lisp and fortran
>>
>>69756461
>Reminder that C is the only serious programming language.
Can someone post the suckless zoomer saying cat -v is harmful? I don't have it saved
>>
>>69759787
you can group together the handlers and the utility functions or have a file for each handler, the choice is up to you.
big files aren't necessarily bad, though, as long as you still understand how the file is structured. maybe you can restructure the file itself to be better?
>>
C is actually wicked fun, all this memory shit is super useful to learn I think.
>>
>>69759894
>all this memory shit is super useful to learn I think
it definetly is, even if you're never gonna use C professionally
>>
>>69759894
It is, but you can get by just as well without knowing it if you go into general OOP dev i.e. Java.
>>
>>69759820
cat-v *is* harmful, though.
>>
#include <stdio.h>
int main() {
char B[]="c%d%s%s%s%s, %d%s%s%s.\n%s. %d %s%s%s%s.\n\n\0 bottle\0s\0 of beer\0 on the wall\0Take one down and pass it around\0%s\0"
"No more\0bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.\n";
while(B[0]--){printf(B+1,B[0]--,B+42,B+(B[0]==1)+50,B+52,B+61,B[0],B+42,B+(B[0]==1)+50,B+52,B+74,B[0]++?B[0]:(B+110),B+42,B+(B[0]==1)+50,B+52,B+61);
if(B[0]==1)B[28]=115;}B[117]=32;printf(B+107,B+110);
}
>>
>>69760044
beerOnWall.c: In function ‘main’:
beerOnWall.c:5:113: warning: pointer/integer type mismatch in conditional expression
52,B+61,B[0],B+42,B+(B[0]==1)+50,B+52,B+74,B[0]++?B[0]:(B+110),B+42,B+(B[0]==1)+50,B+52,B+61);
>>
>>69760086
>warning
>>
>>69760086
>executing random obfuscated code found on 4chan
>>
>>69760129
Compiling != executing
>>
>>69760143
why compile when you don't want to execute?
>>
>>69760162
To see if it compiles. Duh.
>>
File: 1459658201.png (17 KB, 394x450)
17 KB
17 KB PNG
>>69760002
>cat-v is harmful, though.
>>
>>69757178
>implying programming was still in the dark ages of machine code/assembly before c
I'm amazed at how utterly clueless cniles are with respect to computer science history.
>>
>>69760268
cat-v has a good core idea in principle (reduce software bloat), but they are merely treating the symptoms instead of addressing the cause, which is decades of C and Unix.
Notice that I'm only talking about their "software" section. The rest is pants on head retarded.
>>
>>69756177
bitstring *code = load_assembly_file("main.asm");
CPU *cpu = get_cpu();
cpu->exec(code);
>>
>>69757178
>It's nice to know a bit of C to get an idea of what programming was like before languages came with abstract data structures by default and before you could just import 90% of your project.
LISP has been around since the 50s. The absolute state of C babyducks.
>>
>>69757552
>not using emacs as your operating system
>>
File: 1417633700781.jpg (3.08 MB, 4272x2848)
3.08 MB
3.08 MB JPG
>>69757178
lel, wtf? pascal, lisp, fortran, simula, algol, ML ,... they all predate C.
>>
File: 1547818803978.png (149 KB, 325x410)
149 KB
149 KB PNG
>>69760375
CPU *cpus[12];
for (int i = 0; i < 12; ++i)
cpus[i] = cpu;
// clone more cpus
>>
File: haskell is useless.png (1.01 MB, 790x960)
1.01 MB
1.01 MB PNG
>>69758528
Simon is the hero we need. His lectures are great.
>>
test
>>
>>69761468
test
>>
Do we have some cambrian explosion of languages this decade[spoiler][/spoiler]? Rust, Go, D, Nim, Crystal, Elixir, Zig, Julia and others

Were the 90s also like this (and only few languages gained general traction) or is it thing of new era?
>>
File: 305126.jpg (28 KB, 225x350)
28 KB
28 KB JPG
>>69761481
no just an explosion of meme lang shitposting
>>
I'm working on this:
https://github.com/johnch18/vm_v1
>>
>>69761481
D is less active this decade than the last.
>>
>>69761500
can't spell dead without D (twice)
>>
>>69761487
Why are you working on it? Have you considered working on a fizzbuzz?
>>
>>69761511
>>69761500
doubledouble (good)
>>
>>69761512
I just find the concept of a VM fun, and I want to see how far I can take my own implementation.
>>
>>69761481
It's calming down now, though. I mean, a thousand toy languages are marketed each year as serious projects, but they aren't catching on. I'd like to write a language but it's for a particular niche and I don't expect more than 100 users in the best case.
I feel bad for someone these days who has a brilliant idea for a general purpose language because it's essentially impossible to market. It's kind of like if somebody finally invented a miracle penis enlargement pill but they could only advertise it via gifs on porn sites.
>>
>>69761526
You know that VMWare already has a working virtualization software, right? You don't have to reinvent the wheel anon.
>>
>>69761526
I've been writing VMs for 3 years now. It is very fun but employers won't find it impressive.
>>
>>69761558
you think languages like Crystal or Nim won't catch on?
>>
new thread

>>69761586
>>69761586
>>69761586
>>
File: Figure 1_105.png (264 KB, 1352x714)
264 KB
264 KB PNG
Just reading up on embedded systems programming to get a jumpstart on a new job.

It's going decently well, but if anyone has good material on UART and I2C usage, hit me up

pic unrelated
>>
>>69758528
based and typeclassed
>>
>>69759734
I tried laterna, but it does not let me do what I want, in this case I want clickable links, which it can't do.



Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

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.