HN user

ramen

413 karma
Posts25
Comments52
View on HN
www.bloomberg.com 12y ago

Facebook is selling stock for some reason

ramen
2pts0
www.bitlisten.com 12y ago

Listen to realtime Bitcoin transactions

ramen
1pts0
www.bbc.co.uk 12y ago

'Diamond rain' falls on Saturn and Jupiter

ramen
3pts0
news.cnet.com 13y ago

Prosecutors want to be able to remotely brick smartphones

ramen
2pts0
www.nytimes.com 13y ago

Is There Life After Work?

ramen
5pts0
github.com 13y ago

Chaos Monkey source code on GitHub

ramen
4pts0
threatpost.com 14y ago

AutoCAD Worm Stealing Designs, Blueprints

ramen
3pts0
community.skype.com 14y ago

Skype Home is user-hostile and staying that way

ramen
2pts0
rmurphey.com 14y ago

JavaScript: It's a Language, Not a Religion

ramen
8pts1
www.readwriteweb.com 14y ago

How Casual Sexism Put Sqoot in the Hotseat

ramen
6pts3
www.nytimes.com 14y ago

Police Begin Clearing Zuccotti Park of Protesters

ramen
26pts9
www.techdirt.com 14y ago

MPAA Helped Police Seize 'Pirated' DVDs That Were Actually Fully Authorized

ramen
3pts0
www.emacswiki.org 14y ago

Elscreen: Emacs Lisp Screen

ramen
4pts0
news.stanford.edu 14y ago

Stanford engineers build a nanoscale device for brain-inspired computing

ramen
5pts0
searchenginewatch.com 14y ago

Facebook’s Cookiegate: Controversial Tracking Cookie is Back

ramen
3pts1
www.pcworld.com 14y ago

Which Social Networks Fight for Your Rights?

ramen
1pts0
www.itworld.com 14y ago

Windows 8 OEM specs may block Linux booting

ramen
275pts139
ohthatjames.github.com 15y ago

There are no special cases

ramen
3pts0
www.patentlyo.com 15y ago

Proposed legislation to prevent "secret" prior art in US patent applications

ramen
1pts0
blogs.plos.org 15y ago

Can Sitting Too Much Kill You?

ramen
3pts0
www.doof.me.uk 15y ago

Using SLIME with Chicken Scheme

ramen
1pts0
wordpress.org 15y ago

WordPress plugin: PHP Floating Point DoS Attack Workaround

ramen
2pts0
arstechnica.com 15y ago

Internet Explorer 9 to require Windows 7 users to install SP1

ramen
1pts0
www.computerworld.com 15y ago

Gmail promo for Priority Inbox creeps out Chrome users

ramen
10pts7
www.nytimes.com 15y ago

Ted Stevens in plane crash

ramen
3pts0

Modernizr does a lot of things, and creating CSS classes to mark the existence of features is just one of those things. Another thing that Modernizr does is allow you to style new HTML5 elements like <section>, <header>, etc. - I think that there is a similar issue here, and I'm really on the fence about it. Depending on the browser to execute Javascript so that CSS is able to style a new element seems risky, and for quite a marginal benefit. I guess people are just trying to make the future happen sooner, but it seems foolish to introduce an external dependency and scripting requirement just because <header> looks better than <div class="header">. What do we really gain here by being more "semantic"? Aren't we just trading reliability for fashion?

Also see delete-selection-mode. If you have:

    (delete-selection-mode 1)
    (transient-mark-mode 1) ; enabled by default in emacs 23+
you can mark a region and press delete or backspace (or start typing replacement text) to delete the region without affecting the kill ring.

That's essentially what it does, but if you use the "autocd" option as well, you don't need to type "cd" - you can just use the name of a directory as a command. So, "autopushd" would ensure that these operations use the directory stack also.

A related issue is the fact that many drivers show up in the Add/Remove Programs list (or whatever they call it these days), so you can't just remove everything or you will find that your keyboard, touchpad, media card reader, etc. no longer work. Sometimes it can be really difficult to determine if a program is an essential driver or useless bloat.

Another great tool for movement is next-error, bound to C-x ` by default, though I bind it to M-` for convenience. Despite its name, it's not just useful for jumping to error locations in source code. It also jumps to matches from M-x occur and M-x rgrep, making it very easy to hop around from one regex match to another. A negative prefix argument can be used to navigate in the reverse direction, in case you go too far.

I worked at Borders after the dot-bomb, since my car was broken down and it was the only job I could find that I could ride my bike to. I bought a bunch of programming books with my employee discount and then realized what a complete chump I was - the exact same books, online at Amazon, were cheaper including (free!) shipping than in the store with my employee discount. I quit soon after and got a job writing code.

I doubt I'll ever be a heavy vim user because it just doesn't fit my brain well, but this video is an example of why I have great respect for people who have truly mastered vim and can use it quickly and effectively. The rapid click-clack of the keyboard--as he pounds out commands as fast as he can think them up--is the same familiar sound I remember from vim experts I've known in the past.

Here is an emacs function I use, which does the reverse of the refactoring in the screencast. I use it by marking an expression and typing M-x extract-variable, which asks me what I want to call the variable. It then replaces the expression with the variable I named and puts "<varname> = <expression>" into the kill buffer. I navigate to where I want to define the variable and type C-y to yank, which completes the refactoring. It's a useful tool for breaking apart deeply nested code, pulling out constants to make things configurable, and improving the readability of long lines.

    (defun extract-variable ()
      "Micro-refactoring: replace the region with a variable and save an
    assignment statement in the kill ring. After calling this function, find a
    good destination for the assignment and yank."
      (interactive)
      (let ((var-name (read-string "Variable name: ")))
        (kill-region (region-beginning) (region-end))
        (kill-append " = " t)
        (kill-append var-name t)
        (unless (eq major-mode 'python-mode)
          (kill-append ";" nil))
        (insert var-name)))

"I once asked Ivan, 'How is it possible for you to have invented computer graphics, done the first object oriented software system and the first real time constraint solver all by yourself in one year?" And he said "I didn't know it was hard." -- Alan Kay on Ivan Sutherland.

Emacs, artist mode 16 years ago

If you use transient-mark-mode (which is on by default these days), you can mark a region and then use replacement commands like query-replace (M-%) that affect just that region.

I wrote something like this a few years ago. It's hard to get all the edge cases right, but it works well enough for my purposes. I still use it occasionally as a format string generator - I paste the format strings into my code rather than doing the natural language parsing thing every time.

Here's a demo with source (PHP):

http://ramenlabs.com/dbe/

Until I read this comment, I didn't realize it was a Zed Shaw post. I must have skimmed right past the byline. I read the whole article without even knowing it was written by a famous programmer.

The existence of "hooks" further complicates things. WordPress themes are essentially collections of event handler scripts, and those scripts can register callbacks such that when core WordPress functions are called, those callbacks are executed. So, you have WordPress calling the theme calling WordPress calling the theme...

Possible, but exceedingly rare. For a theme to provide a top-level script, it would be referenced with a URL like mysite.com/wp-content/themes/mytheme/scriptname.php, which would be ugly, brittle, and contrary to the clean-URL style that WordPress promotes. It is nearly universal that WordPress's code responds to a request first, and then dispatches to the appropriate files in a theme depending on the type of request.

I hope I'm not beating up a straw man here, but I have seen many claim that REST is a good solution that scales well because the web is built on the REST philosophy. The principles of REST are why the web is a success, and so if we use REST, we can attain the same benefits. What you seem to be proposing is that the web is not a good example of REST.

If this is the case, is there any good example of REST? I have yet to see a web service API that does not require one to read the docs to do URL construction, which violates the HATEOAS principle. The only examples I know of where HATEOAS is satisfied are HTML forms, as I mentioned, Atom feeds, and OpenSearchDescription. None of these are elaborate APIs (or APIs at all) where one would even need to consider something like XML-RPC.

I think HTML forms are a perfect example of REST, since they supply the client with all necessary information to build the next request, and URLs do not need to be constructed manually. The way 302s are used to redirect to the newly-created resource makes web browsers behave more RESTfully, since they prevent reloads from resubmitting POST requests. This is a very common practice today, and I would consider it one of the best examples of REST done right, and yet it uses a different HTTP response code than the proposed standard of 201 Created.

All I'm trying to do is show that there are at least two codes, 201 and 302, that properly RESTful services might return, to support my argument that response codes are not uniform across all REST services.

XML-RPC is still supported by more languages, and doesn't require third-party libraries for Python or Ruby users. But this looks interesting, thanks for mentioning it.

This is why some of us still prefer to use XML-RPC. We just want to make an API, and don't need any of the other baggage, especially if we can no longer map our existing software design to a REST approach.

At least with real object-oriented programming you can come up with your own method names.