HN user

bite_victim

0 karma
Posts0
Comments22
View on HN
No posts found.

Isn't the word 'array' quite obvious that it will create an array? Since PHP 5.4 you actually have the shorthand "[]" version available but it is still obvious to anyone who is using PHP or JavaScript (though JS arrays aren't hash maps like PHP's -- you need an object for that).

But I agree, it's crystal clear for anyone with a minor PHP knowledge. For the rest it's just "clear". (It will still work calling $a['1'] with the quotes so what exactly is the issue? If you mean the drawbacks of type coercion not sure if this example is the best one.)

You are absolutely right, strictly speaking it is the same thing. Getting a simple 'Hello World!' from the server though is a different thing but it is by no fault of Apache, Python is just not PHP when it comes to web development in the sense that you need this:

  def wsgi_app(environ, start_response):
      output = 'Hello World!'
      status = '200 OK'
      headers = [('Content-type', 'text/plain'),
                ('Content-Length', str(len(output)))]
      start_response(status, headers)
      yield output

  # mod_wsgi need the *application* variable to serve our small app
  application = wsgi_app
Instead of this:
  <?php

  echo 'Hello World!';

Given any programming task, you're just going to end up with better code in pretty much any other language, especially a functional one.

This is the exact bull* that good hearted Haskell and Lisp guys have to face and fix because of arrogant people like you.

First of all, a good PHP programmer is a good programmer. End of story. You can write crystal clear code in PHP that anyone who started with C (how many I wonder?) or a C inspired language can read. Spreading information and knowledge IS FAR MORE IMPORTANT than debating the language.

Let me ask you a question, did you just happen to read that post that was recently on the front page of HN? The one that showed how much awesome is Lisp comparing to Python? How Python's creator seems to hate Lisp (functional programming)? Did you read it and got to the conclusion that since (perhaps) you are using a functional language then you are entitled to spew crap like that since you are the holder of truth?

Congratulation! PHP is worse than a functional language (you can write functional code in Python and PHP btw) and you are the winning lord of programming languages debates!

[dead] 11 years ago

I think the author got it wrong with the last sentence. The restaurant would be full with people that believe the complexity of said turd is proof of the craftsmanship of that developer and hence he is an Expert(TM). It doesn't matter that the turd adds ZERO to the project (in fact it makes it worse since turd is turd) they all need to feel they belong somewhere and in this case the majestic turd brought them together. Hence the turd is good. This should be a question when you go to an interview for a company: "Do you like turd here? Do you worship the dark lord turd?" If the answer is yes then you definitely don't want to work there.

Yes, the internet is full of these so called experts. How do they end up being upvoted here is telling about the quality of the average reader unfortunately.

Sorry if I am hurting feelings here but it is true. You have to be a special flake if you think this is quality content. So please, go ahead with your reactions, they speak volumes about who exactly is the gross of HN.

I am a bit reluctant about asking this but where do we stand in terms of real world performance? This is such a broad topic, I know, but surely there has to be some in-house metric system about this (perhaps popular web and scientific frameworks, game dev frameworks etc).

Any chance he suffered a profound trauma being under surgery? I imagine an utter fear of surgery and this could have been triggered by something really insignificant like a small tingling or just the thought of surgery, of a foreign element cutting deep in your tooth canal. That, amplified over and over (he might even have lost conscience if his jaw was being held in place by a device -- the doctor wouldn't have known it this way) could have given birth of some kind of mechanism of memory wipe, sort of like the one victims of rape or horrible accidents develop as a self defence mechanism to (not?) cope with what just happened. Only in this case it went terribly wrong.

Uhm, I just went and had a look at learntomod.com. Are all of the kids these days software engineers? The "Blocks" language / tool looks waaay to complicated, how on earth are kids learning that?! This video for example: https://www.youtube.com/watch?v=IFi2Xr5uQow well that would be a perfect candidate for a college level class, I believe, in teaching how to use visual programming software.

And even if kids somehow really grasp what is going on in there, aren't they damaged in some profound way when they will actually have to deal with code? I remember the shock and horror my colleagues had when in college we went from a visual Java builder software to actual coding in the data structures course.

And also, learning JavaScript as a beginning language? With all of the callbacks / asynchronous paradigm traps? Wow, that is really incredible for a kid to understand!

Python Is Not C 11 years ago

Java doesn't have any optimization flags and the debugging info slowdown makes sense I suppose. That is the exact difference between them, GCC with -O3 is almost 100x faster in another test I just did: 10s for Java, 0.1 for C. When you turn off the optimization flags C jumps right at the same 10s figure though.

Really cool interesting stuff!

Python Is Not C 11 years ago

PHP is no better, if you add an intval call it will add almost 4 seconds to the result! This is an extraordinary proof that being a little sloppy can cost you a lot when using interpreted scripting languages!

Also, I am thinking if and how much speed gain could one inject by not using OOP in PHP...

Python Is Not C 11 years ago

I am a clumsy individual. Dropping the int call resulted in shaving 3.5 seconds. But how is this possible?! It's ridiculous, really!

Python Is Not C 11 years ago

I have updated the test with the new figures that I got. Initially I only tested with Python 2 with math.pow. I have to say I am quite disappointed with the performance of Python 3 though and even using the built-in pow function, PHP 5.6 still is the fastest in this particular case.

Python Is Not C 11 years ago

Some time ago I wrote a really simple code snippet to see the performance differences between Python, PHP, C and Java (the languages I tinker in) on my particular machine (i3 M 330, 2.13 GHz / 4 GB RAM / Ubuntu 15.04 x64).

The results were as follows:

~ 14.2 seconds for Python 3.4.3 [1]

~ 9.0 seconds for Python 2.7.9 [1]

~ 9.0 seconds for PHP 5.6 [2]

~ 2.3 seconds for C [3]

~ 2.3 seconds for Java 8 [4]

Again, this was on my machine with out of the box settings. I have linked the test code that I wrote and perhaps there is something wrong with my Python and PHP code but to me the results were quite revealing. Also it's interesting to see that on my configuration C and Java both hit the limit of my CPU (I can't explain the score otherwise) and I can't know for sure if on a more powerful CPU Java would still be on pair with C.

[1] https://gist.github.com/anonymous/7edafa3889be967a1e1d

[2] https://gist.github.com/anonymous/56ff76849f5a312340d9

[3] https://gist.github.com/anonymous/5717ba935b43bad09e1d

[4] https://gist.github.com/anonymous/6b0c2f11609b951b64f3

But isn't the title enough: "Calculating the intersection area of 3 or more circles"? What else do we need besides some numbers for the radius(es), x,y center coordinates etc? (I haven't visited the page and will try to see if I can find the solution on my own)

I don't believe God made me specifically and I don't believe in God because I own him something. Also, God isn't slowly killing me by poisoning my body. Other people do that though (pollution). Other people do that whose end product(s) my life depends on (for instance electricity or food) and I don't believe them to be some kind of a deity.

That is pretty awesome that you've wrote a such a tool (although I can only imagine how long it took to create such a tool and how it affected the project time frame).

From a web developer's mind: the coll thing is that the tool can be further developed and taken to new directions. For example implement the capability to take snapshots of pages and see if they've changed in layout and notify the user of changes (pretty awesome for scrapping).

I totally agree, unit testing is such a small cog in the wheel of software quality that it is truly a shame how something like this takes all the scene.

Side rant:

I just cannot believe people praising 'Unit Test'-ing. Fellow programmers, how exactly do you unit test a method / function which draws something on the canvas for example? You assert that it doesn't break the code?!

I see some really talented people out there who write unit test as proof that their code works without issues, that it's awesome and it cooks eggs and bacon etc. They write such laughable tests you cannot even tell if they are joking or not. They test if the properties / attributes they are using in methods are set or not at various points in the setup routine. Or if some function is being called after an event is being triggered.

My point is this: unit testing can only cover such tiny, tiny scenarios and mostly logic stuff that it is almost useless in understanding what is going on in the big picture. Take for example a backbone application like the Media Manager in WordPress. Please tell me how somebody can even begin to unit test something like that.

Unit testing is a joke. And sometimes a massive time consuming joke with a fraction of a benefit considering the obvious limitation(s).