News for hackers. Stuff that matters.

thelastnode

Re:Modern Java – A Guide to Java 8 on Tuesday November 17, 2015 @01:51AM (#10579552)
You can use a good number of these today with Retrolambda: https://github.com/orfjackal/retrolambda
Yes, the initial parts of the example could be accomplished with awk and xargs, but as the article goes on to demonstrate, even doing something like printing every nth element would be difficult.

I think the intent was for this to be more of a demonstrative example, and with a more complex, evolving, real-world processing pipeline, Akka streams could be really useful.

It looks like the TodoMVC[1] example has a bug:

1. Create an entry "foo"

2. Check the box, observe strikethrough on "foo"

3. Check the "check/uncheck all" box (left of input box)

4. Observe strikethrough still present on "foo"

Digging in to the code[2], it looks like the "model-less" tenet caused the CSS class on the text and checkbox to go out of sync. In React, this would be a re-render and change in the virtual DOM, or in Angular, both would be bound to a shared model/scope.

If the simple TodoMVC example has a bug like this, the framework might not work too well for larger applications.

[1]: http://t3js.org/examples/todo/

[2]: https://github.com/box/t3js/blob/gh-pages/examples/todo/live...

Re:Chesscademy, a free chess learning site on Monday August 19, 2013 @01:00AM (#6235700)
The videos are hosted on Dropbox. Dropbox disabled the videos because there has been too much public traffic.
Re:Useful GitHub patterns on Wednesday July 10, 2013 @08:57PM (#6023870)
True, but sometimes there isn't a choice, e.g., working with a clowntown library, poorly designed legacy code, etc.
Re:Useful GitHub patterns on Wednesday July 10, 2013 @08:02PM (#6023656)
I like to put a summarizing comment in the code for lines that require justification like the ones you mention. That way the discussion happens on GitHub and the conclusion is in the code, where future developers will see it.
Re:Come join us for the biggest hackathon in New Jersey on Friday April 20, 2012 @12:42AM (#3866525)
Best tweet: "Code so hard, VC's wanna find me"
Re:All about Linux signals - Linux Programming Blog on Monday April 02, 2012 @03:28PM (#3789659)
Took me a second to find, but here's the all-on-one-page version: http://www.linuxprogrammingblog.com/all-about-linux-signals?...
Re:Overthinking on Wednesday March 28, 2012 @05:38AM (#3765395)
Even in the movie 3 Idiots, at the end of the movie, the man with the pen points out that there's a reason for the complexity: bits of graphite flying around in zero gravity near instrument panels and people's eyes, etc.

Simplicity is great, but sometimes complexity is warranted. More importantly, assuming other smart people (many other smart people) are wrong without deep thought is not a good idea.

Re:Books Programmers Don't Really Read But Recommend on Sunday March 25, 2012 @11:21PM (#3754823)
Why?

While I have worked through a decent amount of CLRS myself, I think there are much better ways to learn how to solve algorithmic problems. For example, programming competition books like Programming Challenges[1] forces students to solve real-world-ish problems according to performance constraints - a time constraint, either artificial (e.g., problem statement requires execution within 2 seconds) or actual (e.g., choosing an algorithm that is too slow means the sun will burn out before the algorithm terminates).

Books and contests of this nature teach algorithmic thinking, which is far more important than the actual algorithms themselves. It also provides a context for implementing these algorithms, which means the student gets to see the more practical aspects as well: testing it on corner cases, fighting with the chosen implementation language, relying on compiler optimization, etc.

If the goal of the undergraduate program is to develop practitioners of computer science, or even graduates headed for academia, algorithmic thinking is essential. I don't think CLRS is necessarily the best way to teach that, and it certainly isn't the only way.

[1]: http://www.programming-challenges.com/pg.php?page=index

Regarding the Coffeescript-Javascript difference, Coffeescript and Javascript can be used transparently in node. Once require('coffee-script') is run, the module replaces the require function with one that can load both Coffeescript and Javascript.

This means that if there is a file ./lib/foo.coffee, the following code in bar.js will work:

    require('coffee-script');
    var foo = require('./lib/foo');
Yes, some people may not like Coffeescript anywhere in their project, but this functionality makes it easy to add Coffeescript to an existing Javascript project or use Coffeescript modules as a blackbox in a Javascript project.
Re:AppHarbor adds node.js support on Thursday January 19, 2012 @10:06PM (#3488108)
How does this compare to Heroku?

Neither seem to support WebSockets (though the Heroku article I found was a bit dated[1]) for the time being.

From the article, it seems like AppHarbor doesn't automagically pull in the dependencies from the package.json, which Heroku does.

Add-ons wise, there is a lot of overlap, but Heroku definitely has more at the moment.

Heroku lets you run one-off processes, which is nice for debugging. I couldn't find this functionality on AppHarbor.

[1]: http://blog.heroku.com/archives/2011/6/22/the_new_heroku_2_n...

Re:Reducing Code Nesting on Sunday January 01, 2012 @11:01PM (#3414733)
For Javascript, async.js[1] offers some good tools for different kinds of control flow with callbacks.

[1]: https://github.com/caolan/async

Re:Code Year on Sunday January 01, 2012 @10:47PM (#3414697)
A fix to the halting problem?

Jokes aside, timing out would be useful.

Re:Interactive shell to a running Python process on Sunday December 11, 2011 @06:00PM (#3341416)
What are the consequences of running this in production? What's the performance hit like, is it unsafe, etc.?
Re:What's the one Linux command you wish you knew years ago? on Sunday November 20, 2011 @02:41AM (#3257554)
For find, you need to use single quotes so your shell doesn't automatically expand the .java glob into the names of all the files. Also, find uses one dash for parameters, and can take an exec parameter: find . -name .java -exec wc -l {} \;

The {} means "replace with filename" and the semicolon (escaped so your shell doesn't eat it). This will run wc -l <filename> for every file that matches.

The -regex flag lets you do the same thing as -name with regular expressions.

The problem with this is we run n different wc's, as opposed to just one with all the parameters. We can use xargs to fix this: find . -name .java | xargs wc -l

This even gives you a total!

The really* simple solution (which is probably best) is to just use shell globbing: wc -l *.java

While find and xargs are definitely useful, the easy solution here works better

Re:Join /r/LearnAndroid on Wednesday May 11, 2011 @04:32PM (#2538300)
This is an interesting alternative to StackOverflow, though I think that you might be able to hit a wider and more skilled audience in an already established community.
Re:Face detection in static images with Python on Wednesday May 11, 2011 @04:14PM (#2538222)
This also works with live camera feed because of how OpenCV handles video streams. You can extract frames from the stream and then run the same face detection code on those extracted frames.

This is a great post given that a lot of the OpenCV functions, while powerful, are either missing documentation or have outdated documentation.

Re:MIT is a national treasure on Wednesday March 23, 2011 @08:54PM (#2362287)
I definitely agree; it's just a matter of finding the right people.

Anecdote: attending some of the tech talks that companies give at Tech, there is always a gradient of people, from the people that are there for free food to the people that are there to ask questions and get something out of it. These tech talks are thinly veiled recruiting events, and the latter set of people are always approached afterwards for interviews or networking purposes.

Re:MIT is a national treasure on Wednesday March 23, 2011 @08:45PM (#2362244)
No idea where this came from (or if it's a good idea to feed the trolls; "hn_is_dumb" - really?), but Tech does have the policy to accept most and then fail out those who don't belong there. Only 29% of incoming freshman graduate in 4 years.

I'm glad Tech has this policy because there are lots of bright people here that did the same thing I did in high school and they do well here for similar reasons.

Re:MIT is a national treasure on Wednesday March 23, 2011 @05:43AM (#2358710)
This is the problem that I had when I was applying to colleges: I used to ignore classes that bored me but were required and instead spent time that should have been spent on homework, etc. doing programming side projects and learning CS concepts.

When application season rolled around, I had to compete with candidates who had a much shallow understanding of their area of study, but had a much stronger overall GPA, loads of random APs, etc. While I did mention my side projects and depth in my area of interest, I didn't think to submit code or the actual projects; I usually just mentioned it in the questions or essays (which I'm not certain anyone even reads). This lead to quite a few rejections.

I'm at Georgia Tech now and doing well, because all my classes, more or less, are related to what I'm interested in. While I'm very happy here, I'm curious if I would be as happy if I wasn't accepted to Tech, and were instead studying in a place without such abundance of opportunity. I'm sure there are others in similar situations.

Re:Marble Paint: Canvas+accelerometer drawing experiment on Saturday March 19, 2011 @06:08AM (#2343283)
Does not work on a Thinkpad T410 on Arch Linux.

With Chrome I can see the marble but it doesn't move, with Firefox 4 nightly I can't even see the marble.

Re:The blind man who taught himself to see on Saturday March 05, 2011 @03:55AM (#2291127)
Which then opens the print dialog, so actually two :P
Re:Custom Vim Refactorings (screencast) on Tuesday December 28, 2010 @02:58PM (#2046548)
Another great resource for learning about vim is the Vim Tips Wiki [1]. The have a LOT of content on there, most of which will be useful at some point.

The best tips page [2] has a good set to get started.

[1]: http://vim.wikia.com/wiki/Vim_Tips_Wiki [2]: http://vim.wikia.com/wiki/Best_Vim_Tips

Re:Ask HN: How to force myself to learn emacs? on Wednesday December 15, 2010 @03:49AM (#2007498)
I actually did this recently! I kept vim as vim though, so if I REALLY needed to edit something quickly, I still could.

It's very natural to type "vi <filename>", so it certainly helped.

Re:Ask HN: Best way to auto-organize 16GB of pics on Saturday November 20, 2010 @11:51PM (#1926342)
The regular way to do this would be just trudging through them after grouping by date or something.

A cooler way (albeit significantly harder, at least until it's working) way to do this would be to consider it an AI classification problem... maybe with enough training (as you go, since you'll be organizing anyways), it can start to suggest categories, so you can just hit accept as you fly through your pictures!

Older »