Here is a library I wrote to make querying WordPress easier: https://github.com/ramen/wp-find
It has a more conventional builder-style API that may answer the complaints of those wishing for a more straightforward way to write loops.
HN user
Here is a library I wrote to make querying WordPress easier: https://github.com/ramen/wp-find
It has a more conventional builder-style API that may answer the complaints of those wishing for a more straightforward way to write loops.
Next up: Why web server logs violate HTTP.
What a shameful waste of a good front-end developer's time.
Not until you mentioned it. Thanks for pointing this out.
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?
I assume that my ancient iPhone 3G will be exempt from this privacy update.
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.You have to use the "getlist" method instead of "get" if you are expecting multiple values.
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.
What's the bash equivalent to zsh's "setopt autopushd"?
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.
That page would look nicer if the text were vertically centered. I know a really easy way to do that using tables.
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.
XHTML is proper HTML5.
I prefer Python.
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):
The idempotency of PUT is supposedly useful with caching web proxies, but I don't know of any caching web proxies that support PUT. Are there any?
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.
That article is a nice find. Thanks!
He didn't. He used <abbr title="for example">f.ex.</abbr>. You know, an abbreviation.
You have. Thank you.
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.