skysight-inc/HackerNews huggingface dataset:
I have minimal exposure to PHP, but recently helped a friend out with a small project on the weekends, that someone else he knew had built. When I first saw the codebase I found a veritable mess of very unreadable unmaintainable code. No functions - no OOP of any kind - no separation of concerns - nothing reusable - SQL calls (probably vulnerable to injection) mixed with HTML - a hulking mess of spaghetti.

Can tools like these fix code like that, or at least help? It would have taken me about a day per page just to make it readable - and there were dozens of pages. I don't plan on going back into that minefield if I can help it, but it would be good to know in the future.

--EDIT-- Thanks for all the helpful replies. Luckily I'm pretty sure the project is behind me. Seeing that PHP reminded me of old bad ASP (pre .NET) - it was easy to get away with lots of really bad stuff (on error resume next anyone?). It makes me wonder if auto-refactoring spaghetti is a crackable problem. When I dared look I did see lots of things that I could have fixed with a little bash and sed, but of course I am human so I understand the 'intent' of the code. Fascinating stuff.
yes. At the time, I was listening to music, so I used to think that sounds were part of the music. Then I realized that from the website
Mind sharing what libraries you used for this?
Is this really needed? I get away with :%s/$abcd/$this->abcd/gc just fine.

When you leave vim and do this:

$ php refactor.phar convert-local-to-instance-variable tests/FooServiceTest.php\
6 dependency | patch -p1

I stay in vim and simply do this:

:%s/$dependency/$this->dependency/gc

And hit y a couple of times.

Pros:

I dont need to install, trust and learn a new tool.

I dont have to worry if i broke somthing. Because of edge cases the tool did not handle or because I messed up the syntax.
I wonder what's more expensive, putting up carrier-grade NAT (which sounds like a lot of work) or implementing IPv6 and buying IPv4 addresses for the time being.
WhatsApp Could Be Google’s Next $1 Billion Acquisition
So you spend your entire wallet minus the price of what you bought every time you make a purchase?

If the ratio of 'money spent'/'total volume' is 1/5, does that mean that people are, on average, spending one fifth of their wallet?
I'm a CA Dem, but wish that the CA GOP would get its act together so there would be a credible threat to this voodoo economics.

Right now, the CA GOP is in such a sorry state that many people seeking office switch to Dem to even have a shot. My party is crawling with GOP defectors.

The Republican Party has become the Tea Party, Anti Immigrant, Anti Abortion, Anti Tax, Anti Gay party. There's no room for compromise.
That's awesome - great work! :)
Improve your R.O.P. (Return On Projects)
So, what happens with the mining task after all the bitcoins have been introduced?
Looking for my old works?
Historically speaking, this is completely correct: before there were compilers, a "programmer" was someone who did what is now done by compilers. The actual software was designed by engineers. (Earlier than that, even, a programmer was someone who physically toggled the switches to input programs written by engineers into a computer.)

The only reason there are any jobs left in this category is that there are companies who still believe (incorrectly) that we should have "programmers" doing the mechanical task of translating UML diagrams drawn by "architects" into code. I am glad to see this category shrinking (in favour of the software development/engineering categories) - because everybody in this industry deserves to have the creative value of their work recognised - and I hope to see it approach zero in the near future.

http://www.zerobanana.com/essays/reclaiming-software-enginee...
The Four Hour Workweek
It's based of that 40 megahashes per second consumes 1 joule of power (1watt)
They seem to be using CloudFlare. That's good PR!
Can you elaborate a bit on said psychological structure?
Aaaaand of course there are downsides to every convenient feature.

Ability to install plugins directly from the admin interface? Instantly enable them without restarting anything? This is only possible because your plugins directory and everything in it is writable by the web server. In other words, any plugin can mess with any other plugin, or even WordPress itself. The only reason this doesn't happen is because you have yet to come across a malicious plugin.

WordPress plugins can do anything and everything. They are very powerful. Therefore, they should be treated with the same level of caution that any powerful yet relatively unrestrained program deserves. Like ActiveX controls on IE6 (shudder). You don't simply search n' download them for a test drive, unless you really really trust the competence and moral integrity of the author and the repository.
The Ruby/Python fanboys might downvote me for this, but the author here states the biggest advantage of the PHP ecosystem in general: most popular software is unpack-and-it-works! And that on near every OS/server combination out there.
I was seriously considering going to pastebin and writing up "How brushing my teeth boosted my productivity". Maybe also add a follow-up article on dental-driven-development.
It is unfair, but it would be better to focus on how to lift more people up to the level of teacher retirements than to bring teachers down. Trying to lift all boats strengthens and enlarges the middle class.
I would be interested in the answer.
In my experience this applies to every feature. Doing a small chunk tends to improve estimates - somehow they tend to go up rather than down, go figure :-)

This creates a sort of an impedance mismatch if you do your work in sprints - it's good to do the initial chunk in one sprint and the actual body of work in the next one. Unfortunately this means that features' implementation latency goes up.
One could argue that a removal of secrecy and a trend towards transparency are major forces on the road towards a more peaceful world. One could of course also argue the opposite point.

Either way he took a major personal risk and stepped up for what he thought was the right thing to do. Even if you don't agree with what that thing is it is already a pretty good indicator to get by the "first round" imo

It's basically a PR price for political gamesmanship anyways (imo)
Mining is also used to register transactions. The miners gain from this by charging a small fee per transaction.
Not a great advert for Perl, that, since it doesn't implement the quoted action correctly...
> Our society is deviant if not sick in the way that we push old people to the side and avoid them instead of honoring them.

The way the US treats old people isn't exemplary, but reading Jared Diamond's "The world until yesterday" has kinda opened my eyes a bit - in some societies old people are abandoned, or just killed outright
I don't like the situation because authors doesn't get an honest compensation for their work and you can't easily create new works based on old copyrighted oeuvre.

I think it would be in the interest of the public that you have a more limited in time copyright and after a certain delay an obligation to let other creator reuse assets with a compensation schema that allows new creations.
Not at all :) The frontend is built with d3.js and geometry.js. Backend is node running express with browserify and less to bundle the client.
Teachers get paid OK and have a lot of job security compared to the average workers. I think they deserve it, for the most part, but let's not fool ourselves into thinking they are paupers or working class. It's a solid middle class job with a great retirement package.
1Password and Login Rot
To be quite honest, I dislike GetText() quite a lot. Drupal re-implements it as t(), but it still is fundamentally lacking in context, which Drupal later had to add as a second parameter. The English word 'order' can be translated to »sortering« or »bestilling« depending on context in Danish.

I much much more prefer MediaWiki's approach, by naming all message strings something related to their purpose, this often results in a name structure, that defines their grouping and purpose, takes up less space, and does not require context definitions, because it does per default.

As a result, you contain all your messages - per default at least - in a message file, such as this: https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/core.git;a...

But each message can be altered, which is then saved in the database; if a message is not in the database, its default is used.
DOM vs Canvas
http://www.hnstore.co/ might be useful for seeing the most referenced books on HN.
This is a common argument, that I've seen at lot here on HN as well. It boils down to "every country should act in only its own direct best interest, and assume that every other country will or should the same". If I'm not mistaken, that's called classical realism[1] by political scientists.

Now, why do things have to be this way? Are you certain that, even while we the people are perfectly capable of being nice to each other, the countries that represent us must act like immorally self-centered egoists? Why is that a justification for crap behavior?

Despite all its flaws, the EU has shown that it does not have to be this way. Countries can cooperate and look beyond their own immediate interests. I'm not saying that that's the only right way, and I'm very much not saying that the EU is doing it right, but classical realism isn't the only approach to international relations out there. Saying that something must be so "because countries should act in their own interests only" is a sloppy argument.

[1] http://en.wikipedia.org/wiki/Realism_in_international_relati...
Unfortunately, things seem to be moving the other way, with PC FPSs (traditionally using dedicated servers) adopting the lobby model - it's why I never moved beyond CoD 4.
I've meant to get back into assembly for quite some time now. This might be the motivation I need. I don't really have any need to build anything since I work on extremely high level stuff but assembly always had a neat "oh cool look what I can do" feel to it.

I always preferred AT&T syntax but Intel is the wide spread one. From quickly browsing the site it seems they provide examples for both which is cool.

If anyone has any interesting ideas for some smallish to midsize just for fun projects post away :)
I started coding 18 months ago, and now I'm a lead developer at a funded startup and a two-time contributor to Rails

As someone in an unrelated career looking to transition to development, I'd be very interested to hear more about your journey and how you achieved this in such an impressively short timeframe.
Thats to deal with the fact their init scripts blindly call "fsck.fstype", and zfs doesn't have a fsck nor needs one.
Hipchat is hosted and you pay them monthly. This has the ASP.net source that you can host yourself.
Selection bias.
The problem is you only hear about surprising results. Nobody writes about a benchmark where c++ beats python. Now the reason for such a surprising result may very often be poorly written code in the contender language.
GiffGaff in the UK is a bit more radical with "fixing wireless". £12 for unlimited texts and data and 250 minutes. But any calls to other GiffGaff customers don't count towards your limit. There's other plans as well, including data only ones http://giffgaff.com/index/offer
MySQL analysis with AnalyzeMySQL
Those problems are not related to PHP but to inexperienced developers. Refactoring such code is always a pain. So unless there is nice money involved: don't refactor, just fix what's broken.

I don't think refactoring of spaghetti can be automated. But there are other tools that can help you to find bad code. Some that come in mind:

https://github.com/fabpot/PHP-CS-Fixer
http://pear.php.net/package/PHP_CodeSniffer/redirected

Those tools are used for coding standards (PSR-x), but those standards are also helpful to track down bad code.
Yeah I loved those "back in the day". I've never been good at reversing stuff but there is a certain zen-like quality that I appreciate about the process :)

Has anyone ever figured out who +orc was/is? That was one of the fun riddles of the day :)
...so one of the basic security things one must do on a webserver is separating the vhost unix accounts (to avoid compromised installs overtaking other vhosts), as well as separating the web server virtual account from the FTP account.

Wordpress then can update itself using your FTP credentials, but a malicious or hacked plugin can not compromise the site.
You need SSL accelerators or pretty fast hardware to handle more than a few thousand SSL handshakes per second on a single machine.

That's not true - or rather it conflates two unrelated problems.

1) HTTPS/SSL (even with larger certificates) isn't computationally expensive:

In January this year (2010), Gmail switched to using HTTPS for everything by default. Previously it had been introduced as an option, but now all of our users use HTTPS to secure their email between their browsers and Google, all the time. In order to do this we had to deploy no additional machines and no special hardware. On our production frontend machines, SSL/TLS accounts for less than 1% of the CPU load, less than 10KB of memory per connection and less than 2% of network overhead. Many people believe that SSL takes a lot of CPU time and we hope the above numbers (public for the first time) will help to dispel that.[1]

2) The HTTPS initial handshake is slow. However, this isn't because of the power of the machine, or the certificates size. It's cause by round-trip overheard (See [2]). The solution for that is to reuse HTTPS connections as much as possible (which both your server and the browser should try to do for you anyway. But doing things like using the same hostname can help)

[1] http://www.imperialviolet.org/2010/06/25/overclocking-ssl.ht...

[2] http://pic.dhe.ibm.com/infocenter/tivihelp/v2r1/index.jsp?to...
whoiswinning

$ alias whoiswinning
whoiswinning='git shortlog -s -n'
$
I cannot flag any more posts. Please flag this one.
Size, ability to have a single executable, requirement to display their copyright, and probably a few technical ones I can't remember anymore; I vaguely recall stuff about DOS4GW being more strict with certain CONFIG.SYS and HIMEM settings, but it was almost 20 years ago. :)
> Therefore, they should be treated with the same level of caution that any powerful yet relatively unrestrained program deserves.

A friend of mine's mother routinely compromises his vps simply by installing themes which include the popular TimThumb (https://code.google.com/p/timthumb/) plugin. Through the plugin, it's easy for an attacker to install web shells etc.

This is true of many plugin systems, and RubyGems for example is not immune from this. The difference between installing a new gem however, is that as a software engineer or developer it's your job to have confidence in the security of the gem. With a Wordpress plugin, any user of Wordpress can easily install it, and sometimes it's the theme which includes the plugin.
I think you're right, but I 100% reject this article. Maybe it is good advice for small- or middle-scale products, apps., etc., but it will never hold for a project whose goal is to make a global impact.

I'm actually thinking about Fabrice Bellard, who was featured in a article that was met with success here two months ago[1].

> Bellard made it seem natural to pull together his mathematical insight, broad experience at instruction-level coding, and careful engineering to advance the field this way

When you look at his achievements[2], I have trouble finding one that would have succeeded with OP's "advice". Between an app for coffee-lovers and QEMU, I think the careful thinking and engineering crushes the hype of "let's do it". Sure it sounds good, but that is not the way you will achieve something meaningful.

I may sound like an ass while it is not my goal, but

- I'm kind of surprised to see the success of this article (50 votes for 2 hours) given the low level and amount of content it offers

- I distrust analogies, and this gamma-correction one is definitely unsound (not to say dumb)

1: https://news.ycombinator.com/item?id=5187585

2: http://bellard.org/
You picked the simplest refactoring, for converting local to instance variable I agree with you, this is easy in Vim.

But still there are some potential problems:

1. The variable already exists in the class.
2. You accidently mark to much or to few lines with ":<,>%"

For refactorings such as extract method the number of preconditions and information to gather is much bigger, such as input and output variables, existance of return statement etc.

We plan to integrate the tool into vim as well, so that you can call the refactorings through vim directly.
In my experience this applies to every feature.

Heh, I think it depends on the feature ;)

Past the first few projects, you should have a pretty good feel for how long standard CRUD, user auth, email fun and other such things should take.

Basically, the more experience you have, the fewer times you should need to sacrifice time for proof-of-concepts - but there'll always be a need for them :)
as one who is owned by a dog ... I will categorize this post under the 'bleeding obvious' epiphany ... cue 3 mths from now a new startup whose main product is 'puppies for productivity'.

really folks, I mean this in the best possible way ... get a life (and a dog).
Wow that Fravia link brings me back a few years
They're also working with just Tegra 2 hardware so far (is asking for Tegra 3 testers in http://lists.freedesktop.org/archives/dri-devel/2013-April/0...).

The headline is completely wrong in implying that this is a pre-existing Nvidia driver.
Sure, you can use that however you wish.
You seem to have an integer overflow error or something.

> Coins in circulation

> 10994200

> that's 224,516,226.80 kr

That's not right, $2,049,318,880.00 ~ 13,192,490,290.00 SEK
You would trade them for gbp/usd on one of the exchanges. Mtgox.com is by far the biggest.

As for tax, this is probably taxed as any other profit you make on buying and selling stuff, at least in my country (Norway). If I buy an art painting and sell it with a profit, I am obliged to inform on this on my tax sheet. And the same goes for bying/selling other currencies as well, but bitcoins are harder to track for the government (but not impossible).
Should have said iPod then as I don't think iPhone ever attained "default" status outside of SF.
Currently the refactoring available for extracting code is "extract method". "extract function" is not available yet and may even be implemented as "extract static class" or something, because it may be safer to achieve.
It would mean they are, on average, spending 1/5 of the sum of the transactions' inputs.

Bitcoin wallets generally contain multiple addresses, and transactions will be created with inputs associated with only a subset of these addresses.
I made a quick test for the C versions to try out flags and such: https://gist.github.com/floodyberry/5335542

I found out gcc supports -fprefetch-loop-arrays, although it is not guaranteed to have a positive effect. In this case, it does appear to run faster than without prefetching. AVX versions also run faster than the standard SSE counterparts even with 128 bit registers. ymm regs are faster than xmm.

gcc is faster than icc actually, and icc runs faster with the plain c version than the vectorized versions. I can't figure out how to make icc prefetch either, the switch that controls it doesn't seem to have an effect.
You will probably find comments from me here dismissing the language when it was initially announced, but after watching the MIT presentations on its current state I think the language has a future in technical computing.

http://julialang.org/blog/2013/03/julia-tutorial-MIT/
Can tools like these fix code like that, or at least help?

If you're working with PHP professionally, invest in PHPStorm. The time savings it brings - not to mention, the improved reliability - make it an instant win.
I did not pick anything. It is your example. Right from your page. And the only one you provide. If you have a better one: show us.
Good advice, with a couple of caveats about PSRs:

- They're not all about coding standards: only two of them are. PSR-0 is a class autoloading standard and PSR-3 is a common interface for loggers. The next PSR is likely going to be a common caching interface.

- PSR-1 and PSR-2 are controversial (although PSR-1 less so than PSR-2), and don't necessarily represent best practices amongst the larger PHP community. They're useful insofar as the PHP Framework Interoperability Group (PHP-FIG, http://www.php-fig.org/), the people crafting the PSRs, needed an internal standard and really shouldn't be represented as anything more than that. Much of both standards are an amalgam of individual practices produced via an internal survey of PHP-FIG member projects.

If you have nothing, PSR-1 and PSR-2 aren't bad places to start, but diverging from them is more likely to happen than not, especially if you're working with projects or teams that have existing coding standards.
In pictures: Duke of Lancaster art project grows
It follows an exponential decay curve, so we'll never mine the last bitcoin; rather, each year we mine half the ones that are left. (I'm not sure how the quantization works when we do get to the literal last one, but that's many decades away).
@begurken you've been hellbanned since this post https://news.ycombinator.com/item?id=5466310, no idea why

https://en.wikipedia.org/wiki/Hellbanning
You spend the results of previous transactions. Each transaction can have multiple inputs and multiple outputs, so when you make a purchase, you select enough payments that you have received to cover the cost as the inputs of the transaction, and make the purchase price (to the recipient) and whatever is leftover (back to yourself) as the outputs. (I imagine software would take care of all the complexity; and whatever is leftover, typically 0.01, is given to the miners to incentivise them to spend the processing power to authenticate the transaction.)

This means that the Bitcoins in somebodies wallet is conceptually the list of transactions that have been made to them (that haven't been spent yet). It also means that a nice big graph can be made of how money is (or isn't) flowing through the system.
Bubble or no, from a personal perspective I will not use bitcoin as a currency to exchange goods - things like purchasing items or paying salaries. Bitcoin's value is just too volatile, why would I pay someone a certain amount in bitcoins, when it'll probably rise up to 10 times the current value in a few weeks? But as a medium for investment, like buying stocks, bitcoin does provide a novel and alluring option.
Everything I know about startups I learned playing World of Warcraft
It runs on Mono too.
Spam email is out of control.
The blog post shows extract method as well as a second refactoring

Edit: Also see the screenshot here for a more complex extract method refactoring: http://qafoolabs.github.io/php-refactoring-browser/
SEEKING WORK - Remote / Russia

Web development - Python, Javascript, django, node.js, relational and NoSQL databases, OpenSource, HTML5.

http://dbran.me/

dmitry [dot] branitskiy [at] gmail.com