u/qwop - 9 Archived Voat Posts in v/programming
u/qwop
  • home
  • search

u/qwop

0 posts · 9 comments · 9 total

Active in: v/programming (9)

  • ‹‹‹
  • ‹‹
  • ‹
  • 1
  • ›
  • ››
  • ›››
Comment on: What is WebAssembly? And can you really compile C/C++ to it? And it'll run in browsers? Allow us to explain in this gentle introduction

Good rant. I noticed a long time ago that whenever you introduce marketing into any engineering effort, it all turns to shit. As soon as the marketing goblins figured out you could do stuff with it that makes money, it was doomed.

0 05 Feb 2020 06:41 u/qwop in v/programming
Comment on: This is a pretty good BSD licensed UI library for C++ if you're looking for something easier to program for than Qt.

Does the GUI framework provide any sort of layout manager like Qt has with VBoxes, HBoxes etc. that can stretch automatically?

0 18 Dec 2018 20:59 u/qwop in v/programming
Comment on: How can one Collect the details of articles from websites?

Extracting the title of a web page is a very simple process.

The HTML specification says each web page should have a <title> section in the header of the page document. This <title> section is what you see on the top of your web browser as the name of the web page of whatever tab you have open.

All Voat is doing when you post a link, is load the target web page, then look at the HTML code, and extract the text in the <title> tag.

Here's an example in Python, using lxml (or you could use beautifulsoup too):

import lxml.html
# Load and parse the target web page
doc = lxml.html.parse(url)
# Search for the <title> tag, and extract the text within + print the result
print doc.find(".//title").text
0 25 May 2018 23:22 u/qwop in v/programming
Comment on: Time has come to switch to alt-tech web hosts please recommend options

Support has left chat. LOL. Bunch of SJWs venturing into hosting services now?

0 29 Oct 2017 14:05 u/qwop in v/programming
Comment on: How Marxists took over Academia, Hollywood, and Tech

Did they take over medium too? Article is removed. This appears to be the original video:

https://www.youtube.com/watch?v=mqSV72VNnV0

0 11 May 2017 17:32 u/qwop in v/programming
Comment on: Stackoverflow needs to be circumvented. rant + ramble

This is an important point. The SO community is very intolerant of "lazy questions". I.e. people asking questions where they did not do their homework prior to asking the question.

This is often very hard for newbies to understand, because they often do not yet even understand the real concept of how to isolate a problem properly. So sometimes when I see lazy newbie questions I still answer them, because you have to realize that it also takes experience to know how to troubleshoot. Troubleshooting in itself is an art. But often SO as a whole does not tolerate lack of troubleshooting skills, so this becomes a little bit of a chicken and egg problem for newcomers to the site.

1 02 Aug 2016 19:33 u/qwop in v/programming
Comment on: "Can we please get rid of the brain-damaged stupid networking comment syntax style, PLEASE?" Linus Torvalds rants against ugly commenting styles

Linus is responsible for the Linux kernel development. That is no small feat. He is responsible for keeping some pretty big coding egos in check, otherwise things would very quickly spiral out of control. You can't be wishy-washy with those guys, and you certainly need to be OCD, otherwise you'd very quickly have a big pile of spaghetti code on your hands. By keeping super-high standards, and requiring everyone else to do so too, you have everyone on their toes, and then stuff gets done properly (for the most part). I think people shouldn't take his rants too personally. It's a style that is just very much to the point, with no unnecessary sugar coating.

3 13 Jul 2016 11:08 u/qwop in v/programming
Comment on: 0 experience, getting into C++, really just not understanding why you'd want/need to use void

Sort of. The compiler always pays attention. That's its job :) By telling it "this function will never return a value", you give it a lot of information to work with, and that way it can better know HOW to compile your code correctly, and also WHEN you have made a mistake (e.g. trying to use a return value from a function that you just told the compiler doesn't return anything).

In a similar fashion if you tell the compiler the function returns int (a number) and then later try to use this function in a place where a string or a pointer or something else is required, the compiler also knows that you just made an error and can warn you about that too.

So in order for the compiler to 1) compile your code correctly, and 2) warn you about errors, the compiler always needs to know the type of everything. A type of void is a way to tell the compiler that this function doesn't return anything.

void could just as easily have been made to be called doesnt_return_anything, and then you'd write code like this:

doesnt_return_anything my_fancy_function()
{
   do some fancy stuff here....;
}

Instead now you write:

void my_fancy_function()
{
   do some fancy stuff here....;
}

Think of void as "a word which I use to tell the compiler that this function returns nothing".

Similar as you would think of int as "a word which I use to tell the compiler that this functions returns an integer".

It's the same thing: tell the compiler what your intentions are so it can do its job better.

See the compiler is not very smart. It can't read your mind. So you need to constantly keep telling it explicitly what you mean. Maybe thinking about it this way you understand better what is going on. You need to s-p-e-l-l everything out for it like you're talking to someone that's not very smart.

9 10 Jun 2016 00:04 u/qwop in v/programming
Comment on: 0 experience, getting into C++, really just not understanding why you'd want/need to use void

C++ is a strongly typed language, meaning in general you need to declare the type of things (int, float, string, void) before using them.

Declaring a function with a return type of void is just a way to tell the compiler that this is a function that is not supposed to return any value. That way the compiler can potentially introduce optimizations to your code, and also warn you of cases when you would accidentally do something like my_variable = function_that_returns_void();. In a case like this the compiler knows function_that_returns_void() is not supposed to return anything (if you declared it void when you wrote it), and can therefore tell you the code you just wrote is invalid.

In the original C-language you were allowed to declare functions without declaring the return type. The compiler would then assume automatically that this function is supposed to return an integer. Today in C++ functions MUST always declare the return type in advance (unless you explicitly allow undeclared types with special compiler settings). This ensures better type safety and consistency across your code.

So in order to always declare the return type of all your functions, you have to declare a function that returns nothing to be of type void.

Hope that helps. If not, ask and I'll try and clarify further.

23 09 Jun 2016 23:30 u/qwop in v/programming
  • ‹‹‹
  • ‹‹
  • ‹
  • 1
  • ›
  • ››
  • ›››

archive has 9,592 posts and 65,719 comments. source code.