News for hackers. Stuff that matters.

owlish

Re:Vim Anti-Patterns on Wednesday October 05, 2016 @06:23PM (#12648485)
I've found it helpful to use relative numbering in normal mode and switch to absolute numbering in insert mode:

  set relativenumber nonumber
  autocmd InsertEnter * :set norelativenumber number
  autocmd InsertLeave * :set relativenumber  nonumber
IIRC this tip was from the Practical Vim book
Re:Ask HN: How do you handle DDoS attacks? on Sunday August 28, 2016 @07:59PM (#12379162)
If you're getting more traffic than 1 request/s, it's less work to generate a static cached version on the cadence of ~1 second than to dynamically generate the content for each request.
Re:Why your favorite apps are designed to addict you on Monday February 01, 2016 @06:40PM (#11016592)
As developers, many of us work everyday on increasing page hits, creating more engaging user experiences. What are the ethical implications of this? At what point do we become responsible for users' addictive behavior?
There was an interesting overview talk on predictive policing at 32c3: https://www.youtube.com/watch?v=wIQ2Xhov7D4
Could this not also be used in the near future by, say, the LinkedIn app to identify "People You May Know"?
Re:Better Java – Resources for Writing Modern Java on Sunday September 20, 2015 @12:29AM (#10246563)
This doesn't solve the problem where the parameters aren't checked at compile-time. Now, hopefully all your codepaths are tested so your builder doesn't throw exceptions in production.
Re:Better Java – Resources for Writing Modern Java on Sunday September 20, 2015 @12:26AM (#10246558)
This is contrary to the OP's example, where he passes data and num to the constructor, which is how I've seen it used frequently. The Builder pattern is often recommended to "make code easier to read" and wouldn't be useful if many/most of those parameters were required.
Re:Better Java – Resources for Writing Modern Java on Saturday September 19, 2015 @09:26PM (#10246217)
I used to be a fan of the Builder pattern (or Fluent Interface), but the ease of use for developers comes at the cost of no compile-time checking. Before, you just had to look up the constructor to see which parameters go where, with the benefit of type-checking. Now, you have to look up the Builder's methods to make sure you've filled in all required fields. The only case where I can actually advocate using Builders is when you have a mess of telescoping constructors.
Re:Efficient Tabular Storage on Saturday August 29, 2015 @01:00AM (#10139124)
How do databases like MySQL store data efficiently for querying? It seems like something like protobuf would do well here, though you'd need to generate code for each dataset.
Re:Decertifying the worst voting machine in the US on Monday August 17, 2015 @09:06PM (#10077060)
I'm curious, what security measures are in place for human vote counters?
Re:Crunchbang is not dead on Sunday February 15, 2015 @01:44PM (#9053541)
Posting this from #! right now.

> Philip has mentioned that, since CrunchBang has been his project from the beginning, he would like to see the name separated from any derivative that succeeds it.

Not sure if the people responsible for this fork are aware

Re:Ask HN: How do you analyze logs? on Saturday January 31, 2015 @07:40PM (#8978645)
As others have said, the classics awk, grep, cut, sort, uniq, and scripting languages (perl/ruby for on the fly one-liners) are great for log analysis. One additional tool I've found particularly useful (three actually) is zgrep/zcat/zless. You'll often be searching through archived gzipped logs, so it's nice being able to work with the files without needing to pipe everything through tar.
Re:Retiring Python as a Teaching Language on Wednesday January 21, 2015 @01:52AM (#8921879)
A lot of the discussion in here revolves around "not being able to get an interactive GUI up and running quickly". If this is indeed the main problem with teaching programming with Python, there are many ways of tackling this problem without resorting to teaching Javascript. Don't get me wrong, Javascript is an interesting language, but it has many oddities that could throw off a newcomer.

Sites like OpenProcessing[1] and ideone[2] already allow users to compile and share code in the browser. Why not create a Python GUI "toolkit" that interacts with the browser and can be accessed from an interpreter implemented in Javascript? Granted, this isn't the "vanilla" Python experience, but if you're just ramping up, having shiny bells and whistles to show off to friends is definitely a plus.

[1]: http://www.openprocessing.org/

[2]: https://ideone.com/

Re:Intro to Distributed Hash Tables on Wednesday November 12, 2014 @01:19AM (#8594259)
What is the accepted identifier for nodes? I did a rough implementation of Chord once using IP address as the identifier and ran into the issue where the node would see itself at a different IP than others. The obvious solution is just "don't use it through NAT" I'm guessing.
Re:A programming language in 450 lines of JavaScript on Tuesday November 04, 2014 @04:05AM (#8555656)
Peter Norvig's lis.py[1] is an oldie but a goodie. It really shows you the beauty and simplicity of Scheme/Lisp interpreters.

[1]: http://norvig.com/lispy.html

Re:Inside the Starbucks at CIA HQ on Sunday September 28, 2014 @12:38AM (#8378949)
According to the article, the receipt just says "Store Number 1", nothing about Starbucks.
Re:Emoji One on Thursday September 11, 2014 @01:56PM (#8304046)
I think you're looking for something more like :|
The issue is more significant than just changing a simple browser user-agent string. To completely prevent fingerprinting, you must also eliminate all browser differences (e.g. vender prefixes). Additionally, remember that the lack of information can also be information.

Also keep in mind that it's quite difficult to prevent leaking of other information. An example: OS type can be determined from lower-level protocol information like TTL and window size.

Re:Oraculum – Enterprise JavaScript MVC Framework on Friday August 15, 2014 @06:57PM (#8184748)
Guessing they intend to submit a pull request in the near future. You can see examples on their GitHub[1], but I agree, it's rather odd to post the blog post before submitting the PR to TodoMVC.

[1] http://hackers.lookout.com/oraculum/

Most of the time, you can just Google "golang" instead.
I've been looking at MIT's Distributed Systems class which uses Go (posted here about a year ago).

Original Link: http://css.csail.mit.edu/6.824/2014/labs/lab-1.html

HN comments: https://news.ycombinator.com/item?id=5192650

Re:Lightspeed – A Browser Experiment on Thursday August 07, 2014 @11:54PM (#8151395)
Disappointed that there isn't any innovation wrt tabs; they aren't mentioned at all.

I understand Lightspeed aims to be minimalistic, but many of these defaults are just illogical. Default click-to-play at the moment already ruins many audio sites where the flash applet is hidden, and turns others into a game of Where's Waldo.

Completely dropping extensions is antithetical to the central idea as well. Ideally, the browser would be barebones and fast (what Firefox once was) and any features would be an addon. Otherwise, you get sucked into the mentality of "if only there was this one feature".

All in all, there seem to be several inconsistencies in the central idea, but it could definitely turn out to be an interesting idea.

Older »