Fix the WordPress post editor with Greasemonkey

way too small

The WordPress post editor is way too small. Look:

That’s like, 10 lines of text. Anything but a very short post, and you have to scroll.

Scrolling won’t kill you of course, but unless you’re browsing on your phone, you probably have lots of vertical space to spare, so why not use it?

One way to increase it is the setting in your WordPress dashboard :

Settings > Writing > Size of the post box

You can also just drag the bottom right corner of the post editor!

So it turns out WordPress has this covered. (So if you came here looking for how to change that height, you’re done – if you want to learn how to make any change to a website, setting or none, read on!)

But what if there was no such setting? Is there a way to change things like this on websites you visit?

enter the monkey

Greasemonkey is made for stuff like this: customising web pages to suit your needs. It’s a firefox extension that allows you to store little snippets of javascript that run on certain pages (or whole sites).

You could change the fonts and backgrounds, or make your wordpress post editor bigger or pretty much any change you can imagine. Some people have even made scripts to play tedious facebook games for them (pro tip: if you’d rather have the computer play it for you, it’s not a “game”).

There’s a whole bunch of neat scripts other people have made on userscripts.org.

Go get it now and I’ll show you how I fixed the post editor.

fixing the post editor

After you’ve installed Greasemonkey and restarted Firefox, you should see a little monkey on the bottom right of the browser:

Right-click on it and choose New user script. Give it a meaningful name, and under includes, put

http://whateveryoublognameis.wordpress.com/wp-admin/post.php*

(the asterisk makes this script work with any URL starting with http://whateveryoublognameis.wordpress.com/wp-admin/post.php)

You’ll have to choose a text editor the first time you run it (I recommend notepad2, you’ll get nice syntax highlighting, but any plain text editor, like windows Notepad, will do)

Your text editor will appear with a nice header. Put the following line under it:

document.getElementById('content').rows = 30;

Like this:

Change the 30 if you want the post editor to be even larger (WordPress’s default is 20).

Hit save, and your done. Next time you edit a post in wordpress, it should look more like this:

Ahhhhhhhhh. Much more room.

Enjoy!

Overkill: The problem of over-modding on StackOverflow

A place for programming questions

StackOverflow was originally designed to be about simple programming questions, as defined in the FAQ. Specific questions that have a correct answer and often contain code. Like experts-exchange, but done right. Got a compiler error you don’t understand? Trying to do something in code but not sure how? That sort of thing. Questions like:

Can I add a public function to objects in JavaScript? How?

How can we set the background color in a datatable through codebehind?

The other official sites seem to keep this kind of question as their main focus. I agree with this direction, and I’ve asked and answered plenty of questions like this (that first question is mine). Stackoverflow includes tools allowing the community to close questions that don’t fit these guidelines, like obvious spam, exact duplicates of existing questions, anything that’s not a question, etc.

Other Questions

However, from very early on there was an unintended side-effect: some questions emerged that didn’t exactly fit that mould (for example, somewhat subjective, or discussion style questions) but were still interesting, and got interesting answers. They weren’t completely outside the official guidelines, but they weren’t completely inside them, either. The quality and size of the programmer community combined with the ability to vote and edit created something unique which many users considered to be worthwhile. Many of these questions became very popular.

A few examples:

In fact, looking at the top 15 questions on StackOverflow while I write this, at least 12 are subjective (e.g.: Strangest-language-feature), not strictly programming problem questions (e.g.: what is your best programmer joke) or not questions at all (e.g.: I’m graduating with a Computer Science degree but I don’t feel like I know how to program.).

Overkill

Only moderators and users with fairly high reputations can vote to close questions. I’ve noticed that some of them, apparently thinking they’re “doing the right thing”, are taking the official question guidelines to the extreme – so much so that they’re actually doing more harm than good.

Once again, I’m not talking about legitimately bad questions here – spam, real duplicates, totally off-topic stuff. They need to go (of course). But I’ve noticed that any question that could be even a little bit subjective, anything that has no source code in it, anything sounding similar to an existing question (even if they are actually totally different) will get close votes and terse comments.

Some questions have survived in spite of this, but it’s frustrating to see interesting questions shot down so often. Even 2 of the top 15 questions above have been closed.

It’d be hard to argue that there was nothing interesting, important or valuable in Alan Kay’s question above (and it’s answers). And yet, the very first comment calls it “not programming related”. Another curtly states it should be closed as a discussion question.

This problem has spread to many of the other sites on StackExchange, too. At one point, if you asked a question on StackOverflow and a couple of people thought it would be better on SuperUser, it would be migrated there even though SuperUser was still in private beta. Your question would disappear and, as far as you knew, there was no way for you to see your own question, let alone any answers.

I know I’m not alone on this. There are highly upvoted comments on Kay’s question like “If this gets closed, I may never come back to this site again” and “Yeah, can we please not show Alan Kay what a bunch of children we are by having a close/open war right in front of him?” and “144 votes, 8k views, 93 favorites, a positive mention in the SO podcast, a topic of Jeff’s Coding Horror blog, and a driver for a change in functionality of the site. Yeah, this question shouldn’t be here! :rolleyes:”

Don’t get me wrong, I understand that spam, real duplicates, truly off-topic questions, and pointless opinion wars hurt the site (and if they got out of control, that would be much worse than this).

But these sites exist for the benefit of their communities. Please, think twice before voting to close.

And if you’re unsure – why not just leave it alone?

Online .epub converter

I often find myself wanting to save a book, story or article to my phone so I can read it later (on the train to work, for example).

Unfortunately most phones don’t handle large plain-text or html files very well. My Android is OK, but not ideal – it won’t remember where I’m up to, for instance. So I try to get content in the .ePub format and import it into Aldiko, my current favourite Android eBook reader.

I found a good, free, online .ePub converter today:

http://www.2epub.com/

It allowed me to quickly turn a book I had in plain text format into an ePub file. It supports a bunch of different formats and was easy to use. No fuss. Recommended.

ASP.NET AJAX Scriptmanager error

I recently had a problem using ASP.NET AJAX where I got an error message something like this:

The base class includes the field ‘ScriptManager1’, but its type (System.Web.UI.ScriptManager) is not compatible with the type of control (System.Web.UI.ScriptManager).

I had no idea how a particular type could be incompatible with itself, so I checked Stack Overflow (easily the best question and answer site for programmers). I found a question about this problem, but none of the existing answers worked for me. I googled around a bit, and eventually solved the problem. So here’s the answer for anyone else who might have this problem:

I managed to fix it by adding this to web.config:

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
            <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
                <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
        </dependentAssembly>
        <dependentAssembly>
            <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
            <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
        </dependentAssembly>
    </assemblyBinding>
</runtime>

I believe it forces the .net runtime to use the new versions of those assemblies.

I added this to the Stack Overflow question too, for posterity. That’s one of the cool things about Stack Exchange sites, the platform encourages questions to be solved properly, once and for all, and then easily found by anyone coming later.

Obviously it helped a lot of people – my answer fast became the top answer (by far) and I earned the rare “necromancer” badge for resurrecting an old question with a popular answer.

So there you go: if you found this through searching for answers to the above problem, I hope I’ve helped you solve it. If you’re in need of answers for programming, or a heap of other things, see if there’s a stack exchange site for you. If not, propose one.

Follow

Get every new post delivered to your Inbox.