Showing posts with label stackoverflow. Show all posts
Showing posts with label stackoverflow. Show all posts

2018-05-23

Exceptions will rule the world… and “all” goes lazy.

Python has an odd tolerance for try - except controlling the flow. They have also an ancronym to justify it: EAFP, which is Easier to ask for forgiveness than permission.

2013-04-24

Just another thought about how patent can be silly

Occasionally (sometimes often, sometimes rarely) I try to do my best to answer some question on stackoverflow.

Recently I have answered this question but at first I had interpreted badly the OP request: in fact my first proposed solution told him to use grep to eliminate the lines containing final asterisk. But the user wanted the asterisk to be ignored, not the line to be deleted. So I fixed my answer to use sed to delete the asterisk and let diff make its work.

The edit has timestamp 2013-04-23 13:28:19Z.

Soon after I posted it, I saw another answer which proposed the same "double pipe" solution I gave but with the correct sed. Its timestamp was 2013-04-23 13:28:50Z, i.e. it came after the fix of my answer; in the same time it cites my previous wrong answer, so it was "built" on the shoulder of it (the one with the grep instead of sed).

That was interesting and made me think about a reason to be strongly against some kind of usage of patents (and maybe the whole patent industry), and how these can stop indeed independent innovation and ideas. Patent advocates state exactly the opposite, but it's of course a matter of defending their interests (and/or protegees)... a matter of money and not of innovation, progress, expanding human knowledge and so on.

The point is this: we proposed the right sed-solution independently. (He credited me just for the structure of the command line, i.e. the way the sed command is invoked in order to obtain the diff). Saying it differently, the functional part of the answer (the sed trick) was "produced" independently by each others.

This shows that having the same problem to be solved, having similar knowledges, similar shared informations and similar set of tools can make two minds to propose solutions that are similar if not identical.

That's why patents to "protect" intellectual properties are a very dangerous lie and stop innovation, giving the key to it in the hand of "who came first" in order to make money, prohibiting other minds to arrive to similar solutions independently.

The simpler is the "object" of the patent, the higher the probability two or more people produce the same solution. So that allowing patents can prevent others from using shared, common, widely available human knowledge to reach any result, lock the consumers of a solution to one solution provider (for a long time) and so promote differences, cutting the less rich out from the game and make it possible price control to maximize earning despite the intrinsic value of the "object" (when applicable), in detriment of the consumers.

2010-12-08

Traffic stats

I've just seen that there are stats about blog traffic! And I've just discovered a lot of traffic came from StackOverflow, a place I've almost discontinued to frequent — good place for practical solutions to practical problems, but absolutely deaf and blind for reasoning, "theoretical" analysis of hypothesis, exploring knowledge and so on (like any other Q&A site, no matter how much technical they call themselves)...

Anyway since it can produce traffic to this very "useful" blog, the piece of me allured by net popularity (!) is suggesting me not to forget the place... Now that I am thinking about it, I've left alone a war-speech about the output of a (intentionally) wrong piece of C code and distinction between "undefined" and "unspecified" behaviour in the standard paper for the language. It's enough for today, but in the weekend, if I'll own a brand new laptop, I'll poke the fire until someone can explain for real and competently why that code outputs what many people expect, as if it would be "unspecified behaviour", and what should realistically happen under the cover of the compiler in order to manifest the "undefined behaviour" — my position was that the specific code will output always what indeed it outputs, despite the "undefinition", and so, in the specific case, for the specific code, no "undefined behaviour" can manifest itself (and indeed even the unspecified behaviour would be hidden by the way the code was written, it was about passing a "problematic" argument to a printf with a format string that would take only one argument, details on SO, but I'll be back on the topic, don't be afraid).

Wo, two posts in a day, I am growing the statistics!

2010-06-10

Q/A sites

Question/Answer sites are always the same. I mean, there they happen always the same kind of things that can be summarized with few words: biased subjectivity, misunderstandings, personal battles using the voting system. I am not saying I don't fall in those traps too, except for the last one and the first one(!): I do not use the voting or flagging system to fight my personal battles or to "destroy" an answer that does not convince me, but which I recognize as having its own "rightness". Instead, I use often the possibility of commenting (our freedom of speech).

My english is far from being perfect, perfectly unambiguous and grammatically correct, maybe sometimes the hurry makes it even worse...; nonetheless it seems to me it is not so bad. But it seems to me sometimes I get misunderstood because of it.

Recently I am losing a little bit of my time on StackOverflow. Appearing as a site for technical questions, it seems free from all those absolute crap often existing in many low level Q/A sites (I mean question like: where I can get The Program registration key, how can I cancel a file, how can I program a word-processor like Commercial-Wordprocessor in few lines of code, ...), and in fact it is.

But as said, it is run by people, who are defective by design and so the typical aspects of social interactions can arise, altogether with all kind of possible misunderstandings and arbitrariness.

I have a good example where of course I am the protagonist.

The StackOverflow (SO) question is here. My original answer was downvoted by someone (later the downvoter declared himself and it was the same asker), and this was disappointing to me since another answer, containing basically the same kind of informations/proposals, was voted up (I don't know by who).

I loose time, ok, my choice, but I am not prepared to loose time for an answer that is not appreciated and moreover I can't understand why, since compared to others (voted up) it appears of the same quality. So I wrote a comment, knowing no the voter nor understanding the reason.

The comment was:

can I vote myself up? I find this -1 really stupid, expecially since basically I am saying the same thing of an answer that's got +1 and say no word at all about refactorying the if with a subroutines. I've already said that: no matter the techinicalities, Q/A sites are frequented by the same kind of voters.


and I started writing it before the asker comment (As stated, CAN'T CHANGE RULE) appeared. The long "dialog" that follows in the comments came from two facts: my distraction, and their distraction. As usual I am not interested in pointless debates, I just try to understand.

My recognized distraction was that he stated already he could not modify Rule class, while unluckly I focused my "defense" on the fact that he did not, instead of focusing the attention on the fact that, no matter if he specified it or no, my answer contained already a possible solution that fit the requirement, exactly as another answer. Indeed, better than another answer, the one that was upvoted anyway!!

The original asker felt uncomfortable with my comments and decided to remove the downvote (since it was causing "issues"), later pointing out however that the requirement my answer did not talk about was in the original post. Unluckly I noticed I proposed an answer also for that requirement, but not focused it in time, and another thing that happens on Q/A sites is the lost of attention where things get complicated or too long to read.

As the following Original Poster comment shows, he focused on the "first" part of my answer, which talked about changing Rule class (exactly how another answer did, but was upvoted... again)

My downvote is because that your answer ignores my question. Yes, refactoring the Rule class to use an int would be useful, and in fact, I could keep the "else if(flag == "EXCLUDE") { included = false" given your example. So it's a very good answer to a completely different question


The fact is that my original answer contained already at the beginning the following excerpt:

Now if you want the whole [CODE] as a subroutine, you can make it return boolean value and check for it. The caller "decides" if break/return or not. Of course the caller must pass i also (if looping over i for get_op changed as described before).


This shows that indeed I've not totally ignored the requirement. My if looping over i for get_op changed a described before means exactly that: if (i.e. you are not required to) you change get_op as described, you have to pass i. If you do or not, no matter: you can turn the [CODE] into a subroutine returning true or false, and according to this returned value, the caller decides if to return directly or continue looping.

Moreover the OPer edited the question and added a code that basically do what I suggested, wanting as arguments get_opN and get_niN instead of N to allow the subroutine to pick the right get_op(N) and get_ni(N), but apart this detail (due to the requirement) the code is what one programmer can take from the suggestion I quoted before.

While another downvoter chimed in my answer, another up vote was given to the answer that contained same suggestion of mine (and no citation at all to the subroutine possibility); the author of this answer "defended" me some way, thanks. But of course my critics are not against him, but the illogical incoherence of the voters...

The brand new downvoter wanted also to explain its -1. And someone put +1 to its comment.

@Shin: I think the OP's downvote was fully justified. You wrote an answer entirely based on an assumption that the question clearly specifies is invalid. That means your answer doesn't solve the problem.


This confirms that jalf (the nick of the previous commentator) coherently should have downvoted another answer too (the one similar to the mine), but he did not. He downvoted mine instead, because of comments. Talking about what it can be just or not, it is a subjective thing. But also an imperfect "justice" needs to appear coherent: if A-by-X is wrong, it must be wrong also A-by-Y. An answer can't deserve a downvote where another answer, saying the same thing, deserve an upvote. A coherent "just" person can't vote down an answer A-by-X and let untouched A-by-Y (and A-by-Z and so on...). If he does, the only explanation brings us to the fight personal battles using the voting system, which is unfair. In this case, my "complainings" likely was what have driven jalf to the downvote. He did not evaluate the answer deeply, otherwise he wouldn't have used fully and entirely, and he would have noticed that I talk about subroutine with an if that allows for the other explicitly missing case. At least another answer doesn't solve the problem (here of course it should have been "does not try to solve the problem", or I should see that jalf has a huge amount of downvotes!), but is ignored, meaning this is not the real point.

Unluckly when I read that biased comment I have not realized what's wrong in all the "defense line" (i.e. the fact that indeed I treated also the case matching the requirement)... and when I did, it was too late: attention focus was lost and likely jalf won't realize and recognize his error, and this is normally what makes me put an user on my personal black list (in the sense I have to watch out when they are around, to avoid wasting time and get also downvoted unjustly).

Talking about incoherence, it could seem incoherent the fact that I am focusing on jalf and not the asker. It is not because he retired the downvote (I did not pretend him to do so, but to explain, at least why he did not downvote similar answer); it is because he interfered in the dialog like if he was the Knight of Justice (Restoring the Justice, i.e. the just downvote by the asker), unaware of his incoherence and moreover without reading carefully what was already written. People like that rarely come back and re-ponder, it would be wasting too much time on a single question, or even worse: on comments about an answer to a question.

I am not saying jalf is a bad guy to me of course. I am saying he bahaved the way I don't like people to behave on Q/A sites. Commenting is fine. Voting up or down should be more pondered on the current answer, not biased, and coherent. Since these people could make my "wasted time" less pleasant, I mark them for my black list.

The irony is that the asker mixing up answers or by himself produced a code that is already an answer, and that is contained, as idea, already in my criticized and downvoted answer (and not in the one similar to mine and upvoted)... so that my last vote mixed everything and proposed a solution, which fits fully the requirement. But jalf has not wasted time checking for updates, and no other readers have (currently) upvoted me, except who did it at the beginning (and gave the upvote purposely because of the part of the answer that does not meet the requirement, which is a poor bad requirement after all!)... while as said the other answer, talking no about refactoring in subroutine at all, has 2 votes!