HNHacker News
TopNewBestAskShowJobs

jdnier

2,542 karma · joined January 8, 2009

submissionscomments
jdnier··on Pyret: A new programming language from the creators of Racket
> Most “scripting” languages don't support annotations for checking parameters and return values

PEP 3107 introduced function annotations to Python 3. The following syntax is valid:

    >>> def square(n: int) -> int:
    ...     return n * n
    ...
    >>> square(3)
    9
Nothing is done with annotations by default. Here's an article discussing this "unused feature": http://ceronman.com/2013/03/12/a-powerful-unused-feature-of-...
jdnier··on Starship Troopers: one of the most misunderstood movies ever
A comment to the article paraphrases Verhoeven's DVD commentary track as "yes, this was a satire, and I'm baffled that people don't get that".
jdnier··on Avoiding Heart Disease
The simplicity of "switch to a whole foods, plant-based diet and you simply won't die from heart disease" has eased my similar anxieties. http://www.heartattackproof.com/ See also the related documentary, http://www.forksoverknives.com/.
jdnier··on Isn't it impossible to place work into the public domain? Nope
For a practical application of abandoning your copyrights, see http://unlicense.org/.
jdnier··on Isn't it impossible to place work into the public domain? Nope
I remember reading Lawrence Rosen's article and had always assumed he was correct that there was no way to "place" a work in the public domain. Here's Rosen's recent admission:

"I admit that I have argued for years against the "public domain" as an open source license, but in retrospect, considering the minimal risk to developers and users relying on such software and the evident popularity of that "license", I changed my mind."

jdnier··on Nicotine as a useful stimulant
A great quote from the appendix: "In philosophy, one is taught to not try to prove too much (inviting people to modus tollens your modus ponens), to not do more philosophy than one has to; in programming, you learn to not become an architecture astronaut solving some hugely abstract version of your actual problem - such overreach invites disaster."
jdnier··on Don’t Slurp: How to Read Files in Python
It would also be more idiomatic to write

    for i, line in enumerate(sys.stdin):
        print '{:>6} {}'.format(i, line[:-1])
jdnier··on The Frameless Geodesic Dome I currently live in
Any concerns about living surrounded by all that polystyrene blueboard? Either indoor air quality or flammability? http://en.wikipedia.org/wiki/Polystyrene#Fire_hazards
jdnier··on Hacker Scouts is served Cease and Desist letter from Boy Scouts of America
I wonder if BSA has a similar problem with the Madison Scouts Drum & Bugle Corps, which has been around for 75 years? http://www.madisonscouts.org/
jdnier··on 1936: GM, Firestone, Standard Oil. "Perhaps you can guess where this is going."
Both are really good articles. Thanks.
jdnier··on 1936: GM, Firestone, Standard Oil. "Perhaps you can guess where this is going."
This was a conspiracy theory I always heard growing up in Michigan -- that the auto companies had bought up the trolleys in Detroit so people would have to buy cars. It's good to finally see the historical basis.
jdnier··on 1936: GM, Firestone, Standard Oil. "Perhaps you can guess where this is going."
"Starting in the 1920s, a company called National City Lines started buying up street car lines, then mostly privately owned. In 1936, the company became a holding company owned equally by General Motors, Firestone Tire, Standard Oil of California, and Phillips Petroleum. Perhaps you can guess where this is going."
jdnier··on Why I am building a product with a tiny market
I fed it a favorite regex... Bravo. Unfortunately, the permalinking fails with this particular regex, or I'd include it here. The visualization is so large, it more than fills my large screen. Still, pretty cool to see it render instantaneously and to watch it match example text. The regex is described here: http://www.cs.sfu.ca/~cameron/REX.html It will match either text or XML markup (it's used to tokenize XML), so try example text like '<div id="123">abc' or 'abc<?xml target?>'.

The JavaScript form of the regex follows: [^<]+|<(!(--([^-]-([^-][^-]-)->?)?|\[CDATA\[([^]]]([^]]+])]+([^]>][^]]]([^]]+])]+)>)?|DOCTYPE([ \n\t\r]+([A-Za-z_:]|[^\x00-\x7F])([A-Za-z0-9_:.-]|[^\x00-\x7F])([ \n\t\r]+(([A-Za-z_:]|[^\x00-\x7F])([A-Za-z0-9_:.-]|[^\x00-\x7F])|"[^"]"|'[^']'))([ \n\t\r]+)?(\[(<(!(--[^-]-([^-][^-]-)->|[^-]([^]"'><]+|"[^"]"|'[^']')>)|\?([A-Za-z_:]|[^\x00-\x7F])([A-Za-z0-9_:.-]|[^\x00-\x7F])(\?>|[\n\r\t ][^?]\?+([^>?][^?]\?+)>))|%([A-Za-z_:]|[^\x00-\x7F])([A-Za-z0-9_:.-]|[^\x00-\x7F]);|[ \n\t\r]+)]([ \n\t\r]+)?)?>?)?)?|\?(([A-Za-z_:]|[^\x00-\x7F])([A-Za-z0-9_:.-]|[^\x00-\x7F])(\?>|[\n\r\t ][^?]\?+([^>?][^?]\?+)>)?)?|/(([A-Za-z_:]|[^\x00-\x7F])([A-Za-z0-9_:.-]|[^\x00-\x7F])([ \n\t\r]+)?>?)?|(([A-Za-z_:]|[^\x00-\x7F])([A-Za-z0-9_:.-]|[^\x00-\x7F])([ \n\t\r]+([A-Za-z_:]|[^\x00-\x7F])([A-Za-z0-9_:.-]|[^\x00-\x7F])([ \n\t\r]+)?=([ \n\t\r]+)?("[^<"]"|'[^<']'))*([ \n\t\r]+)?/?>?)?)

jdnier··on Process Managers: The Good, the Bad, and the Ugly
Another recent comparison: http://tech.cueup.com/blog/2013/03/08/running-daemons/
jdnier··on Welcome PyT. Python DSL for fast (X)HTML generation
I like his advice:

"""You probably know this feeling when you think that code is not ready for public release yet and you need to implement at least 50% of your huge todo.txt to make it good enough.

Today in the morning news on TV was said that we all need to finish postponed stuff because Mayan 'End of Time' is too close to postpone again. I said: "Well, if even Maya need this, I will release today". """

jdnier··on Sh.py
Plumbum is the latin name for lead, periodic table symbol "Pb", perhaps memorable enough considering Plumbum was inspired by an earlier project called PBS.
jdnier··on Microgravity-induced intracranial hypertension may prevent human space travel.
Maybe it's not so surprising that an Earth-evolved land mammal wouldn't thrive in microgravity. From the article: "33 percent of [Shuttle/ISS] astronauts had expansion of the cerebral spinal fluid space surrounding the optic nerve, 22 percent had flattening of the rear of the eyeball, 15 percent had bulging of the optic nerve, and 11 percent had changes in the pituitary gland and its connection to the brain."
jdnier··on White House Iraq page: Fascinating scrolling layer effects
Make sure to scroll the page (wheel or arrow keys) rather than page up/down.
jdnier··on WTF Is Up At Twitter?
I thought the same thing just this Saturday afternoon when the Twitter home page (i.e., http://twitter.com/) showed nothing but a plain black and white Cherokee 405 error page for at least a couple minutes: http://oi41.tinypic.com/1085ypx.jpg
jdnier··on Ask HN: Anyone know where Mark Pilgrim went?
So check this out: Google "http error code 410" and the second hit is from diveintomark.org circa 2003.

""" Let’s all talk about HTTP error code 410. ... Error 410 means Resource gone, as in, a resource used to exist at this location, but now it’s gone. Not only is it gone, but I don’t know (or I don’t want to tell you) where it went. ... Now, there is not a lot of information about error 410... I suppose because it addresses a condition that doesn’t come up very often. Also, we’ve all been brainwashed into believing that all resources should be permanent, which simply isn’t true. """ Google cache: http://bit.ly/qxdBi5

His servers are returning 410 errors but also the same very deliberate HTML:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>410 Gone</title> </head><body> <h1>Gone</h1> <p>The requested resource<br />/<br /> is no longer available on this server and there is no forwarding address. Please remove all references to this resource.</p> </body></html>

Clearly Mark's invocation of the 410 error is deliberate.

jdnier··on Recycled plastic bottles bring light to homes in Filipino slums
Intuitively cool as soon as you see the video.
jdnier··on Oh Yes You Can Use Regexes to Parse HTML
REX is most useful is when you're focusing on lexical details of a document -- for example, when transforming one kind of text document (e.g., plain text, XML, SGML, HTML) into another, where the document may not be valid, well formed, or even parsable for most of the transformation. It lets you target islands of markup anywhere within a document without disturbing the rest of the document.
jdnier··on Oh Yes You Can Use Regexes to Parse HTML
If you enjoy reading about regular expressions, Cameron's paper is fascinating. His writing is concise, thorough, and very detailed. He's not simply showing you how to construct the REX regular expression but also an approach for constructing any complex regex.

I've been using the REX regular expression on and off for 10 years to solve the sort of problem the initial poster on Stack Overflow asked about (how do I match this particular tag but not some other very similar tag?). I've found the regex he developed to be completely reliable.

jdnier··on Oh Yes You Can Use Regexes to Parse HTML
In the spirit of Tom Christiansen's lexer solution, here's a link to Robert Cameron's seemingly forgotten 1998 article, "REX: XML Shallow Parsing with Regular Expressions".

  http://www.cs.sfu.ca/~cameron/REX.html
"""

Abstract

The syntax of XML is simple enough that it is possible to parse an XML document into a list of its markup and text items using a single regular expression. Such a shallow parse of an XML document can be very useful for the construction of a variety of lightweight XML processing tools. However, complex regular expressions can be difficult to construct and even more difficult to read. Using a form of literate programming for regular expressions, this paper documents a set of XML shallow parsing expressions that can be used a basis for simple, correct, efficient, robust and language-independent XML shallow parsing. Complete shallow parser implementations of less than 50 lines each in Perl, JavaScript and Lex/Flex are also given.

The syntax of XML is simple enough that it is possible to parse an XML document into a list of its markup and text items using a single regular expression. Such a shallow parse of an XML document can be very useful for the construction of a variety of lightweight XML processing tools. However, complex regular expressions can be difficult to construct and even more difficult to read. Using a form of literate programming for regular expressions, this paper documents a set of XML shallow parsing expressions that can be used a basis for simple, correct, efficient, robust and language-independent XML shallow parsing. Complete shallow parser implementations of less than 50 lines each in Perl, JavaScript and Lex/Flex are also given.

"""

jdnier··on "Thanks a billion, cheeseheads."
Wisconsin's Republican governor elect has forgone $900 million in stimulus spending for a high-speed train line from Milwaukee to Madison. Californians are pleased.
jdnier··on Lala shut down by Apple last night, May 31st
Lala's streaming catalog was huge (>8 million songs) and included music not available on iTunes. I enjoyed using the service and have since lost any infatuation with downloading and storing MP3s. Being able to listen to anything once was great but the day has already come where you'll be able to rent access (cheaply) to an entire collection and listen to what you want, when you want (e.g., mog.com). Still to come: better tools for organizing the music you're interested in, learning about artists, and finding new music.
jdnier··on How The World Almost Came To An End At 2PM On September 18
But as I said, its four months later. Government shouldn't keep secrets from it's citizens in general. You're the one who introduced the hysterical shouting of "fire." The Bush administration increased the level of secret keeping massively and look what we've gotten for it. Don't you think what happened in September should inform the decisions being made this week about the continuing bailout? Four months is way too long for this to be kept quiet. I'm glad a US representative is talking about it now but wish it had come out three months ago. Fortunately, we have a new administration now and they've already begun the change:

http://www.propublica.org/article/obama-begins-rollback-of-b...

jdnier··on How The World Almost Came To An End At 2PM On September 18
I'll only point out that this happened last September. It's the first I've heard about the details. It's not shouting "fire", it's waiting four months to explain why there's a burnt-out hole in the ground where the theater used to be.
jdnier··on How The World Almost Came To An End At 2PM On September 18
Holy freaking cow! I've not heard anyone explain/disclose the details of what actually happened before. Cheers to Representative Kanjorski for disclosing the details. The government shouldn't keep secrets.
jdnier··on Napping: the expert's guide
See especially the last bit about whether you're a lark or an owl. (Owl definitely!)
← PreviousPage 12 of 13Next →