skysight-inc/HackerNews huggingface dataset:
REST Tutorial
Hi,
I have started using Amazon S3 for a web application I have been developing. I recently discovered a PHP class (s3.class.php) that helps store, retrieve and delete files on S3.

However, the class does not work well in a few cases. Therefore I thought I'll learn REST so that I can create my own PHP class for interacting with S3 servers.

Does anyone know of a good introduction/tutorial for REST with php examples? I found a good tutorial but it was based on Ruby.
Thanks
Why your site sucks ?
Still no Erlang comments?
He has some valid points, but I think a more accurate title is: "Why I don't like Ruby"

"Migration to Ruby 1.9/2.0"

Won't python dev's have the same problem with Python 3000?

"Performance (or lack of)"

JRuby and Ruby 1.9/2.0 already address this issue

"Scoping"
"There’s more than one way to do it"

I don't see this as a weakness. This is more about style and preference, though I admit I like Python's philosophy better (Ruby code just looks more beautiful to me)

overall I still think it's well written criticism (at times I cringe looking at the horrible stuff people in the ruby community write)
As someone who spends most of his time working in Python, the section called One nice thing about Ruby’s scoping made me a little bit jealous. I hate the way Python handles default parameters.

Also, I think glyphobet is a little hard on Ruby's range objects. He says:

Python’s xrange() can also be passed around like a variable, but you test for membership with value in myrange instead of ===.

An important difference there is that "value in xrange(10000)" iterates to find the value, while "(1..10000) === value" does something O(1), like 1 <= value < 10000. Range objects are handy, and different from list constructors like range() and generators like xrange(). But I agree that the ".." and "..." syntax is weird.
Facebook to Settle Thorny Lawsuit Over Its Origins
Search engines warned over data
All the news that’s fit to print on a map: The New York Times in Google Earth
The Complete Field Guide to Testing Firefox 3
If there are libraries for doing biological computation written in Perl that do not have available bindings for other languages then that would constitute a reasonable excuse for using Perl. This would be just as true if the library was only available 1990s Visual Basic, and is just as irrelevant a factor in the assessment of a language as a whole.

Beyond the availability of some particular piece of code (in my case the tens or hundreds of thousands of lines of legacy systems that I lack the resources to replace) there is literally no excuse for using Perl or for inflicting its insanity on another hapless generation of web programmers.

All of Perl's admirable qualities (convenient object-literal notation, first-class functions, correct Scheme-style lexical scoping, powerful and seamless regular expressions, convenient string processing and Unix integration) are available in other languages. All of them, period. Many of these languages do not share Perl's unforgivable faults (sigils to dereference variable namespaces, contexts, typeglobs, references, dismal error handling facilities, confusing and nonstandard object facilities). The only way to use Perl to build a large system is to lean on Conway's methodology, which consists of a book that reads like an airtight indictment of Perl by one of its chief implementors and a collection of CPAN modules that demonstrate a brilliant mind with a perverse allegiance to a cult-like cause. Do sensible class hierarchies without Class::Std, I dare you. Do reasonable try-catch-finally exception semantics without Error.pm, I dare you.

try { ... } otherwise { ... } finally { ... }; # works
try { ... } otherwise { ... } finally { ... } # no trailing semicolon, oops I just clobbered your next statement and produced a catastrophic failure that even an experienced hacker could stare at for hours without seeing

It only takes about two hours reading 'Perl Best Practices' to realize that it's a brilliant book, written by a brilliant mind to attempt to make Perl a workable language for building large systems. It's a shame because he comes so close, but it turns out you can't rewire a language like Perl with libraries alone, even if only because you can't compel others to use them.

Perl is a language for expert hackers only, no one else should be allowed near it. And even expert hackers are working harder than they need to because there is a constant intellectual tax on the inconsistency of the language. It only offers a little bit more power than Python, and actually less than Ruby at a much higher cost.

There is no excuse for Perl in the 21st century, and you clearly have not spent time trying to use it to build large and complex systems or else you would feel the same outrage that I do than anyone would continue to contemplate it.
Angels the real VCs of Silicon Valley?
I know craig. I can promise you that SEO is no something he is going for.
I'm going the opposite direction: after having done two non-trivial RoR apps I have a Pylons project on my hands right now. What can I say? Pylons is a baby Rails and Python is a baby Ruby. Language issues aside, Pylons' architecture seem to be a little cleaner than Rails, but even that advantage largely goes away with all these cleanups done in Rails 2.0.

Pylons/Python are more ugly and less complete than Rails/Ruby:

a) Ugliness: passing "self" to each method, deriving from Object all the time and having __foo__() method names is ugly, ugly, ugly.

b) Incompleteness: URL generation/routing and SQLAlchemy are too primitive and require more coding comparing to Rails. Stuff like form_for(Model.new) isn't possible as far as I can tell. Moreover, Pylons application requires a lot of bootstrapping to get going, setting up DB access is especially tedious comparing to ActiveRecrod's magic. Ralis' soft inforcement and helpers' assistance with RESTful controllers can't be seen anywhere in Pylons as far as I can tell. The list goes on: Pylons is more like a very very old Rails version distorted by ugly Python's object system.

Pylons probably looks pretty sweet to someone who's starting on it with a fresh head, but after two years on Rails I am less than thrilled to work with it. I may not be Pylons expert by now, but man... it's been two months and it still doesn't show me any love :-)

I love Python though. I like CPython implementation and quality of the libraries. Right now it's my language of choice for any stand-alone piece of software, but I try as hard as I can to avoid Python's object system.
He brings up a good point w/ documentation. Ruby's has left me wanting in more than a few situations.
Overactive Structure Sets
Ruby's syntax is by far more complex than Python's. By "complex" I mean it from a parser's grammar point of view.
Cool! Here's ours: http://feedity.com - Create RSS feeds for any webpage. Track webpage changes in real-time. Pull data for mashups.
> Won't python dev's have the same problem with Python 3000?

Read that section. It outlines why Python won't have the same problem.
This advice is working great for Microsoft ;)
I got the same feeling reading that just now as I did reading PG's Hiring Is Obsolete[1].

Really wish it made financial sense to walk in and quit my job tomorrow. Only 46 more days!

[1] http://www.paulgraham.com/hiring.html
that's assuming the conversion program works well... It may work well for snippets, but I have to see it work well with larger/mature python code bases to believe it.
wtf at submission headline.

im paying no tax on this deal.

the stock price hasn't been finalised on the deal yet either (related to point 2 above).
Ok, that's fair enough. Who knows how well the conversion program will work. Still, for Python 3, there's a clear plan... and there's no clear plan for Ruby 2 (yet).
I think the test is a good idea but the 'relevance raters' are only looking at the listing results - not the actual page. The relevance of the actual page is far more important to the user experience than the listing text. A clever 'made for adsense' site could scam the listing but obviously not the actual content.
Ah... You're right. I thought value in xrange(10000) just checked the endpoints, but it appears to iterate. Someone should write a PEP. :)
Fixing the Reddit Frontpage
Won't somebody please think of the parsers?!
Everything appears to be a matter of taste:

Ruby has two range operators, .. and .... Why? The only difference is that the shorter one, with two periods, returns a longer range, and the longer one returns a shorter range, not including the endpoint. Can this possibly get any more confusing? 2 The language should have one, not two. It is not hard to add or subtract one when you want a range with, or without, its endpoints.

I like the shortcut. Then again, I like the English language. I like the fact that you can express things in a myriad of (yes, you can say "myriad of") different ways depending on how you want to express them.

A Pythonista friend of mine once complained over the simple fact that Ruby had so many ways to express a conditional but none as elegant as what was used in Python.

Python:

- if foo: bar()

Ruby:

- if foo then bar end

- if foo; bar end

- if foo: bar end # deprecated

- foo if bar

- foo && bar

- foo unless !bar

I love the diversity, however. Really, the first thing that sticks out to me with Python are those superfluous parentheses. Taste, taste, taste.
I highly recommend Perkins Coie (www.perkinscoie.com)
hm. restful is a way of doing things, not really something that you can read a tutorial on how to do step-by-step.

rails tutorials are tutorial form because you're implementing rest through a predefined framework.

the wikipedia article on it has good info:
http://en.wikipedia.org/wiki/Restful
I haven't found the argument about backwards compatibility to be true of Python, but it has been true of Perl. Code that I wrote 5-6 years ago in Python has needed at least three updates to run in newer versions of Python (1.5->2.0 and 2.0->2.2 and 2.2->2.4--I no longer work in Python, so I don't know if they'd need an update to run on newer versions). On the other hand, code that I wrote ten years ago in Perl still runs unmodified on Perl 5.10. The only major upgrade problem I've seen has been the introduction of native Unicode in Perl, which caused anything that assumed scalars to be made up of 8-bit bytes to break, but that's a pretty broken assumption, anyway.

So, in short, I don't think Python is exactly a paragon of backward compatibility. It may be better than Ruby, but it isn't a solved problem.

I also disagree with the assessment that TIMTOWTDI is a bug. But, me being a Perl coder may have warped my judgment. I find Ruby very intuitive--moreso than Python, even though I've written more Python code than Ruby.

That said, there are some serious deal-breakers in Ruby. Lack of Unicode is one of them. I wasn't among the folks criticizing Arc when it didn't have Unicode at first release...but if it had gone more than a year without Unicode, I would have joined the bandwagon of critics. And, once again, I think Perl has solved Unicode better than Python.
The connectU guys really illustrate the true character of Harvard rowers.

/Last famous Harvard oarsman was Ted Kaczynski.
"... When Auctomatic began negotiating, it put its efforts for a second funding round on hold—and just about ran out of money. ..."

Why did this happen?

As for the sale, well I think the decision not to hold out showed good judgement, an appreciation of the current credit squeeze. Is it always worth to hold out for "double" or nothing? Only time will tell if eBay market will be hit by the downturn. Is there any reason another startup in this area could not try a similiar tack?
I would sell carbon-neutral, zero-environmental-footprint water. A portion of the price of every bottle offsets the manufacturing/transport costs to the environment, so people are free to enjoy the water totally-guilt free.
Ideas are worthless: Here's mine
Well, this was interesting. My team just finished a Rails project that used Racc extensively (with multiple different grammars), made extensive use of cryptography, and spent several weeks up on blocks being tuned with ruby-prof.

Obviously, it also used ranges, keyword arguments (like every other Ruby program ever written), strings and string conversions, blocks, private methods, and yes, even Unicode.

I did notice that the documentation for these features was lacking. What I didn't realize was how much Ruby sucked, compared to Python.

I am now steeling myself to begin typing "self" in front of every instance variable, write ten lines of code every time I need a "method_missing", fish the gettimeofday equivalent out of 19 different libraries that return and manage time, re-learn whether I want to call popen, popen2, popenN, or create a Popen class, wrap my data types up in a list when I need code to close over them, condense all my anonymous functions to single expressions to work around Python's accidental support for lambdas (which, according to GvR, are evil), write my oh-so-thread-safe-code for an interpreter that serializes around a global interpreter lock, pretend that my classes have private methods by naming them differently, just like I do in my object-oriented C code, marvel over the amazing things I can accomplish with "generators", continue to format strings using "printf" semantics the way Kernighan and Richie want me to, and track down bugs that are literally invisible due to semantic whitespace.

Can't. Wait. You know what I miss most? Twisted.
I couldn't disagree more. Having tried both platforms, I felt like I was coding with one hand tied behind my back when I was learning Python, Pylons and Django. Web tools and the stack is a lot less mature than RoR stack and the amount of various plugins/gems available for both platforms was not even close. RoR plugins were so much more mature and multitudinous that after we started planning our app, we realized that we'd have to spend about 6 months(!!!) just writing the functionality in Django/Pylons that we were getting for free with Rails. Now this was about one year ago so things might have changed.

Since I don't have the time to go over each point that the author makes, I'll concentrate on a couple.

Lack of Unicode in Ruby 1.8.x. OK, so this might have been an issue before RoR 1.2 came out but since 1.2, RoR has introduced Multibyte and has been a lifesaver. Now, I don't have a clue how many Rails Unicode apps the author has written in his career but I can tell you for a fact that Unicode is not an issue in Rails anymore. We have an app in beta that uses Unicode for every string that we handle and we handle so many strings for so many languages that your head will spin. We haven't had any huge issues with RoR's Unicode support at all. So that argument is really a moot point.

As for language performance, who really cares?! Programmer's time is so much more expensive than servers so the last thing I worry these days is how fast some specialized benchmark runs. As long as the latency is acceptable and you can solve the problem by parallelizing it, the performance of an interpreter is completely irrelevant.
The Social Web Browser
If you're working professionally with RoR buy few commercial books on Ruby and Rails. The cost is negligible when you consider the savings in time that you will get when learn from a good Rails/Ruby book. Sure, Django has a free book on the basics of it and there is Dive into Python series but the number of books on Rails is much greater and they are professionally edited and are of better quality.

The lack of free books is an issue but you get what you pay for.
College Board drops AP comp sci & latin for racial diversity reasons
Three useful genetic algorithms
Imagine how much good code in either language is currently not getting written ;-)
Here is another ~ http://www.mazeworks.com/mazegen/maze_faq Has some obfusticated C examples.
Ruby pwns Python. word.
Cutting these exams certainly won't get more minority students involved in these subjects. Seems like a crude hack to improve the College Board's diversity ratings. One is led to believe that they do not care about the students at all from this statement.
Google faces loss of talent
College isn't just about making more money afterwards. It's about meeting people you'll keep in touch with for the rest of your life, learning from interesting people that excel in their field and networking with people that you might be able to help in the future and/or might be able to help you. It's priceless IMO.

Not to mention being able to avoid the "so you don't go to college?" conversation with dates..
What if you are not interested in math?
From an ex-Pythonista a year in to Ruby, point-by-point:

* Ruby's Unicode support is indeed inferior to Python's; unlike Python, you need to explicitly use library calls to work with UTF-16 strings. Python does indeed bake this in to the language.

* I don't use multiline regexps. On the other hand, I do use normal regexps, all the time, and the fact that I don't have to call out to a library to use them, or deal with special "match" objects with their own API, is a plus. Ruby has more natural support for regular expressions than Python, where regular expressions are an afterthought.

* Ruby's documentation sucks. Full stop.

* I have no idea why I'm meant to care about what this guy thinks of Ruby 1.9 or Ruby 2.0. There's a Ruby 2.0?

* Python is way faster than Ruby. Not by a little bit.

* Ruby's scoping rules are a dream compared to Python's; it support real closures, instance variables and methods with encapsulation, and coroutines that were designed for more than just iteration.

* Ruby and Python are equivalent when it comes to internal consistency. Python delegates virtually everything to a sprawling standard library for which there is, most certainly, "more than one way to do it". Calling out the difference between "print" and "puts" is particularly amusing if you know how Python handles the same distinction.

* Ruby has a cleaner object model than Python, where virtually every feature of the language appears to have been built by exposing the raw symbol table to the language. The simplest way to observe the difference is by taking an existing class and wrapping it with an object that catches all method invocations, a la "method_missing".

* Both Ruby and Python support keyword arguments by giving functions a dictionary type of keyword/value pairs; Ruby has the added benefit of a Symbol type, like Lisp and Smalltalk. No Ruby program fails to use them.

* I'm guessing about, oh, zero people on Hacker News give a shit about SAP support.

* I never noticed that Ruby didn't print the actual line of code that threw an exception. It's true! Python does! I never noticed that, either! That's pretty neat.

* Apparently, despite having been largely ported from Rails, Pylons is more mature than Rails. Awesome.
How is a society going to advance with a bunch of people majoring in b.s

How is society going to advance with a bunch of calculating automata without any taste for what is worth solving in the first place?

And just where is this advance taking us, by the way? Why?
Was this a strong computer science class?

Maybe it's best if students see less badly taught computer science while in high school?
I think his point about performance was more that the rails developers were not taking significant steps to improve it. From what I understand, they are doing this for Ruby 2.0.

He definitely addresses the programmer time thing a lot, except from the perspective of code readability instead of keystrokes or whatever other metric you might use. Python is generally a much more readable language, and might make for more maintainable large scale systems because of it.
Its funny someone once wrote that Rails should have been written in Python - his main argument was that Ruby gives you so many ways to do things but Python tends to pick "a" way. The Rails framework tends to follow this Python like mentality of Picking a particular way.
I find this trend disturbing; but am at a loss as to how to formulate a politically blameless response. Suffice to say, the converse is inconceivable; and I fail to see how limiting the choices of minorities or majorities serves either.
TED Talks: Jaw-dropping Photosynth Demo
It was really good. I took it 6 years ago and even though I continued on to a non-CS degree, I still feel like I have a good grasp on basic CS topics (data structures, in particular).

This is a really terrible loss. I don't get it at all.
I took AP Comp Sci in high school back 2000. It was a great c++ class and really gave me headstart in the CS program when I went off to college. Of course I benefited by having a great teacher,

In actuality, my enjoyment of that class solidified my decision at the time to major in CS when I went to college.

Sad to see it go, I think it is a big mistake to cut it.
Ruby works for me. I like the language semantics. What I miss are the email libraries/parsers that are available in other languages. Don't you think Ruby will catch up with the missing features in a couple of years? The documentation isn't that bad either.
Our hosting spend is around $1m AUD a year (although a lot of that is bandwidth which is expensive in AU) and the datacentre we use took all its customers offline for 2 hours last week. It happens. Even the to the big guys.
5 Alternatives to the 17" MacBook Pro
"“For us, [the question is], are we able to achieve our mission of reaching a broader range of students?” Mr. Packer said."

If that isn't an ironic statement I don't know what is. The best way to reach a broader range is to reach less? Maybe the AP needs a course offering in logic.
The average 13-year-old white student scores better on the SATs than the average 17-year-old black student.[1] This places minority students at a huge and completely arbitrary disadvantage, since the SAT doesn't correlate with academic performance at all beyond a slight correlation with GPA the first semester of freshman year in college.[2]

And yet somehow I doubt the College Board is going to drop the SAT anytime soon. Dropping AP classes "for racial diversity reasons" is like making Rosa Parks the TV spokeswoman in the front to mask the secret eugenics program going on in the back.

[1] It Takes a City: Getting Serious About Urban School Reform
[2] C.f. the academic research into the validity of the SAT on the College Board website. (There have been plenty of popular press articles written on this too.)
C++ isn't a good way to introduce people to CS. An introductory class should pick a language that doesn't get in the way so much.
I took AP comp sci AB, and later TA'd the class. It was surprisingly good, covering lots of fundamental data structures and some mean pointer logic, and it probably changed the course of my life. It's disgusting to see it killed for the purposes of optimizing College Board Inc's race statistics. (Assuming this article is accurate.)
Other articles indicate that the test was unprofitable: http://www.washingtonpost.com/wp-dyn/content/article/2008/04...

Edit: "In the 2007 administration, 5,064 students took the exam." http://en.wikipedia.org/wiki/AP_Computer_Science#Grade_distr...
Is it really true that SAT scores don't correlate with academic performance?
>From what I understand, they are doing this for Ruby 2.0.

In less than a year's time, you'll have so many choices to choose from. Ruby 1.9 is just one of the Ruby interpreters that you'll be able to pick from. There's also Rubinius (which is already outperforming MRI on so many benchmarks)

Take a look here: http://programblings.com/2008/04/01/rubinius-for-the-layman-...

And you'll also be able to choose from JRuby and IronRuby. The way I see it, I think there's more work being done on improving Ruby's than Python's ecosystem.
Political correctness has a way of distorting reality for many people :)

Actually, it's more likely that political correctness creates a chasm between what people say and what they really think.