Tag: WordPress

Code snippets and syntax highlighting

I’ve been looking for a decent WordPress plugin to handle syntax highlighting for my code so that it will format neatly. I’ve tried a bunch of them so far, and am still not completely satisfied.

Requirements

  1. Has to correctly highlight GML syntax.
  2. Should support automatic line numbering
  3. Should work in both <pre> (for correctly-indented code blocks) and <code> (for inline textual elements in the middle of a paragraph that should be formatted as code.
  4. Nice if it treats <code> as an inline tag (this is definable via CSS, but it seems that WordPress’s TinyMCE visual editor will convert the entire paragraph into a <code> element, rather than just the content that is actually selected, making it annoying when you want to include some inline text in the middle of a paragraph and have it formatted as <code>.
  5. The font used for inline <code> tags should be typographically not-ugly when nested inside normal text.

After trying out a number of plugins, I’m currently using WP-Syntax, which seems to be the best out of the plugins I’ve tried so far. Overall this is a very good code formatting/syntax highlighting plugin, but for some reason the every-other-line background coloring doesn’t line up cleanly with each line of code, and it works using <pre> tags only, not <code> tags. WP-Syntax works with a couple other plugins as well, which integrates with the TinyMCE visual editor, and enables me to make a formatted code object downloadable.

I’m still looking for ways to improve the presentation of code, so if you’re reading this and have suggestions, please drop me a comment.

A few quick updates

Did not complete Ludum Dare 28

I even liked the theme this time: You Only Get One. I came up with an idea pretty quickly: a platformer in which you are given the choice of several power-ups, but you only get to have one. Once you made your choice, you have to get through the level using that ability.

Alas, I did not get very far and did not complete the game. I started out trying to build a platforming engine from scratch, ran into bugs, and a few hours later concluded that without declaring a pre-existing base code for a working, tested platform engine, I just wasn’t going to have any hope of completing a game in 48 hrs.

really needed to do this in order to free me up to do things like come up with the various power up items, and devise level designs that would be solvable with each of them, just in some different, uniquely challenging way. That’s a rather tall order, really — level design in platformers takes a lot of talent and testing.

Once I realized that I wasn’t going to be able to finish that project idea, I could have scrapped it and started something else, but I opted not to — mainly because I was very frustrated by that point by a couple of technical problems.

This culminates a year of mostly failed projects for me: I was sick the weekend of Global Game Jam 2013 and didn’t partake, then the wheels fell off my computer just in time for our local Cleveland Game Developers Summer Jam event, when a dying hard drive put me out of commission for the weekend as I struggled (mightily, and successfully) to move my OS to a SSD. I blew off LD26 because I hated the theme “Minimalism”, and then skipped LD27 entirely because I hated the theme “10 Seconds”.

Of course on the plus side, I helped put out a book on GameMaker, and am currently working on another, but in terms of releasing finished products, this has been a bust year. Nothing to do about it but pick myself up and get back into it, though.

Site has been down a lot lately, hasn’t it?

Since I went and registered this domain name in 2010, I’ve been hosting on a server that a friend of mine generously provided me some space on for free. At first I had no idea what I was going to do with my domain, at all — I just wanted a web server of my own to play with in my spare time, and learn from. I dabbled briefly with trying to build a native HTML website before realizing how not-fun that really is, and switched to using WordPress, and have been blogging with it ever since.

This year, the server started having issues with downtime. I’ve been in contact with the server administrator, who at various points has explained that the outages have been caused by all sorts of things: database server disk storage full, upgrades, DDoS attacks, aging hardware, you name it. It seems the problems have gotten worse over time rather than better, and so a few weeks ago I began shopping around for a new hosting service. I’ve got one now, and am in the process of migrating the site over to the new server. I’m hopeful that I’ll be through doing that sometime this week, and then I can cut over the DNS registration to point to the new server, and all will be well again. This weekend there was another bad outage, and the site was down for about 24 hours. Dealing with that had me distracted, anxious, and frustrated, and not at all in the right frame of mind to be focused on my LD48 project.

Despite the ease of setting up WordPress initially, I’ve found it fairly difficult to migrate the site over to the new host, mainly due to differences between the hosts, but also due to my relative lack of experience in doing this sort of thing. So I’d like to say I’m learning a lot from this, but really at the moment I’m just learning that it sucks to do something when you don’t really know how, and the documentation and tools that you have available to you are not all pertinent to what you want to do, and it’s up to you to figure it out. I’m muddling through, and perhaps by the time I’m done I’ll understand how stuff works a lot more than I did before I started, but I haven’t seen that payoff just yet. I haven’t yet resorted to the tech support at the new host, but I plan to this week when I can get to it. Getting the current host to be up at the same time when I have a large block of time to throw at migrating seems to be an issue, and I don’t want to waste my time talking to tech support when the old host is down and something that I may need to pull off of there isn’t accessible.

So that sucks.

YoYoGames Support rocks

On top of that, I also had a bit of frustration with GameMaker Studio this weekend while I was still trying to work on my LD48 project.

Somehow or other, the auto-suggest feature in the GML code editor went glitch on me, drawing a super-tall suggestions box that drew off the top of the screen, and wouldn’t allow me to scroll up to see any of the suggestions.

Tl;dr: it turns out that the autosuggest box is resizable by dragging the edge with the mouse, making this quite easy to fix. However, I did not know that at the time, as there’s no UI widget that hints at this functionality, and I expected that it was like a regular “Tool Tip” widget in Windows, which are not normally resizable. I tried exiting/relaunching, and even removing/reinstalling GM:S to no avail, before resorting to tweeting my SOS. I also submitted a bug report with YYG.

Within an hour or so of my SOS tweet, xot of GMLscripts.com had offered me some suggestions which fixed my problem. I really appreciated him taking the time to do it. I don’t know who xot is in real life — if he’s connected in any way to YYG, a former employee, or just a long time GameMaker developer, but I’ve gotten a lot of use out of gmlscripts.com over the last couple years, and so I donated $25 to him for providing such a valuable resource to the community, and since then he’s been quite friendly and generous with his time — he also contributed quite a bit to the draw_text_rtf() script that I posted about earlier this year. So, three cheers for xot, wherever you are — you’re a great guy.

This morning, I woke up to find an email from YYG Support in my inbox:

Hi there,

Reading through the twitter feed you linked it looks like you managed to solve the issue.
Is this correct?

Thanks

Peter
YoYo Games Customer Support Technician

Since the bug report tool doesn’t let you upload files, I had pasted the url of the twit pic, and Peter had apparently followed up, reading the conversation, and, seeing that I’d apparently sorted things out on my own, checked in with me to make sure I was doing OK. Awesome!

I wrote back to him:

I don’t know what caused it to happen in the first place, though, so you still may want to investigate that end of it, in order to prevent a recurrence of the issue. It seems to me that while it makes sense for the height of the auto-complete suggestion box to size itself dynamically, it ought to have some “sanity checks” to make sure it’s not sizing itself larger than the display resolution, and more specifically to size itself to no larger than needed to display the suggestions.

To which, he replied:

I’ll let our coding team know about this issue so they can add some checks to prevent this sort of thing happening again.

I’m extremely pleased with this exchange.

A year or so ago, back when YYG’s Mantis bugtracker was still open to anyone to submit bugs, it often took a long time for anyone to respond to a bug report, and often that response was unsatisfying — you felt like you’d annoyed someone with a concern or question that they felt was stupid, or that you were guilty of misusing the bug reporting system to ask for help merely using the tool rather than reporting a genuine bug, bug reports would often be closed prematurely, before allowing you to engage their developers who were working on it to communicate about the issue, and if the issue did merit a fix, it could be months before someone got around to it, because there’s a zillion bugs and they have to be properly prioritized, planned, and implemented.

By contrast, this experience left me feeling that they cared about my problem, not just the bug report, that they were interested in taking care of it the right way, and that it was their pleasure to do so. Submitting issues is also simplified compared to what it used to be in the Mantis system, which is also appreciated.

I really, really can’t say enough good things about how it feels to be using GameMaker these days.

Site update: New theme

There are always N+1 problems, where N = the number of problems you think you have.

Yesterday, I updated some WordPress plugins and the site broke:/ Some kind of CSS problem, as though a stylesheet failed to load.

I determined that the most recent update to JetPack apparently causes the problem, though exactly what the bug is I haven’t determined — all I know right now is that if I install and activate Jetpack, everything is fine, but the moment I connect my site to wordpress.com, which is necessary to make any meaningful use of Jetpack, something happens to cause the .css from my wp theme to fail to load and/or render. Update 2013/12/15: I have determined the cause of the problem to be a conflict between Jetpack and an outdated extension called Scripts Gzip, which I have since discontinued using.

In troubleshooting, I noticed that the theme I’d been using for the last year plus, Fudo, hasn’t been updated in a few years, and may not be compatible with the latest WP. Potential problem #2.

So I ditched it, and am currently running the 2013 WP theme until I figure out what I like. But actually I might like 2013 just fine. It’s typographically attractive, and I assume it should be well supported by Automattic since it’s an official theme.

But whatever the problem is that is being caused by JetPack 2.7 on my site, it seems to affect all themes (or at least all that I have tried so far) so I’m guessing WP will release an update to JetPack in short order and fix the problem. In the meantime I’ve started a dialog with their support and am attempting to work with them through the issue.

Until then, I’m running with JetPack disabled, so the features it provided will be absent until I turn it back on. Yay.

So, wp support advised me to delete the jetpack directory from my plugins, and try manually re-installing to see if that will fix the problem. Only thing is, right now I can’t, because for some reason I’m being denied when I try to delete the files. Not sure what’s going on there, but I surmise it may be due to some server migration issues that my current host has been experiencing lately. Regular readers (ha!) may have noticed considerable problems with uptime lately, and the host is working on migrating the server to new hardware in order to alleviate the issue. I’m not very aware of the details of this, but it seems to be an ongoing issue that has been getting worse in recent weeks. Problem #3.

Due to these problems with uptime, I’ve decided that it’s time for me to move the site to a more capable host. I’ve been with my current host since the site went up in late 2010, and I don’t feel like I have a right to complain about the recent problems because I’m not paying for the hosting service. But considering how google pagerank treats sites with poor uptime, I really can’t accept it, either, so it’s time for this site to move. I’m coming up on my 60,000th visitor, according to my wordpress stats, and the daily site traffic continues to grow (although thanks to the frequent downtime of late my monthly numbers have been rather flat.)

So hopefully, I’ll be updating soon from the new host, just as soon as I get files and database moved over, and working, and switch DNS over.

Stay tuned:)

Recent site problems

A few days ago, I noticed site traffic had suddenly dropped.

Graph of recent site traffic stats for csanyk.com

Day 1 and 2, I didn’t do anything. I had noticed that the traffic was unusually low midway through the day on the first day, and thought it was curious, but I didn’t really worry about it. I was pretty busy those days and didn’t have time to look into things. I figured it might just be a fluke, much like I will occasionally see a traffic spike, and that it might correct itself.

After the second day, I wondered what was up. Had I been de-listed from google? I checked, I had not. I started googling “sudden traffic drop wordpress” and read a few articles.

Then I noticed that wordpress wasn’t serving the site properly. I had only been in the admin console and didn’t check the actual site, but when I went to read the home page, the web server just spat out a bunch of encoded gunk.

At first, I wondered whether the site had been hacked. I logged into the admin console and now WordPress reported that one of the plugins I use was giving an error. I disabled the plugin, and the site started serving properly again. Phew! I removed the offending plug-in entirely, and things seem to be back to normal.

Traffic bounced back almost immediately — yesterday I lost about a half day’s worth of traffic because I fixed the problem around the middle of the day. Today, at around 10am I already had a little over 50 hits, which seems about normal. By the end of the day I’d expect to have somewhere over 100 hits, which is back within the normal range of what I have been seeing in recent weeks.

I’m still not 100% sure about a few things.

Site stats during the “outage” days were very low, but still not zero. If wordpress was serving corrupted junk, I would expect that the stats should have been exactly zero. Stats for those days show that certain articles were still able to be reached, albeit by a much smaller number of visitors than previously. So, I’m not entirely sure when the plug-in error began or when it resulted in wordpress serving corrupted pages. It could be that stats counting is off somehow (wordpress documentation suggests that it is somewhat inexact, although I don’t fully understand the causes), or it could be there’s some other explanation (does a visit to a google cache of my site somehow increment my stats, perhaps?)

I think it would have been nice if WordPress could have been a little more active in notifying me of the error. I liked that it displayed an error message when I logged into the admin console, but it didn’t do that until three days into the low traffic — I think probably because the account I normally use to log in with is just an authoring account that doesn’t have full administrative privileges. When I logged in with my account that had admin privileges, I saw the errors, and it immediately told me where the problem was so I was able to fix the problem quickly. Which, is great and all, but even better would have been if WordPress had sent a notification email to me, so that I would have been aware of the problem right away, without having to log into the site.

Managing Categories and Tags in WordPress

For the longest time, I’ve paid little attention to the categories and tags on this site. I played with the features a bit, but didn’t really understand them well enough to feel like I knew what to make a category, what to make a tag, how to do it consistently, and so on.

As often happens, I figured it out “naturally”, by just using the site and over time the purpose became more clear. Then for a long time I just didn’t feel like going through the tedium of going through all the old posts and re-doing everything. I hated feeling like “If I had to do it all over again, I’d do things differently”, though, so eventually I had to do something about it.

I’m here to share the lessons I learned.

Know your purpose, or if you don’t know your purpose, find it

When I started this site, I wasn’t entirely sure what I wanted to use it for. I knew I wanted it to be a site for promoting and blogging my professional activities, but beyond that I wasn’t sure how I wanted to do it. This was something that developed for me over time, as I became more comfortable. At first I was very risk averse about putting up any content at all. Putting my real name up on the web made me feel inhibited and over-cautious. I didn’t want to make a mistake, embarrass myself, offend someone, lose my job, etc.

As time went on, I began to get over these fears, and it allowed me to post more frequently, feel more free about saying what I want to say, and knowing what I wanted to talk about. I surmise that most web sites develop their purpose over time, and refine what they do. I couldn’t have known how to do everything before I started.

Doing it is an essential part of the process of learning how to do it.

This means making mistakes, and you shouldn’t let yourself be inhibited from making them. Learning from them quickly and doing things better is more important. But sometimes lessons take a while to sink in, and when that happens it is not always the best thing to start making changes right away. You don’t have the time and you quickly lose energy if you put yourself through a comprehensive overhaul several times in quick succession. So before doing a drastic overhaul, take time to think about it, and before you do the whole thing, do a small part of it first and see how it works. Iterate a few times until you think it’s just about right. Then do the overhaul.

Categories

Here’s how I think about WordPress Categories: If my WordPress site was a book, the Categories would be the headings I would use for my Table of Contents. This isn’t quite right, but it’s a close enough way of looking at it.

If your site has a relatively narrow purpose, you should have relatively few categories. Categories should be broad. Think of your categories as sorting bins for your posts. Your posts fit into or under them. It’s OK if your posts fit into multiple categories, since there’s often overlap. You can create a hierarchy of categories as well, which can be helpful if you have a number of closely related category topics.

If you find that you are constantly writing posts that fit into the same group of categories, you should think about whether those categories would be better off consolidated into a single, broader category, and perhaps your former categories re-done as Tags.

Tags

Tags are like index keywords that help describe the major ideas that are contained within your post. You should think about the content of your post, and what the main ideas or topics were, and tag appropriately. This is not a SEO game, where you want to try to guess all the variations of words that people search by and include them. So skip the -s/-ing/-ly game.

Tags should be short, single words or phrases of two or three words. Try to avoid redundancy, but some small amount is probably OK. WordPress separates tags with commas, so you don’t have to worry about using spaces. It’s OK to use spaces between words, rather than running words together.

I frequently see tags being misused as a sort of meta-commentary on the content of the post or page. This is witty, entertaining, gives some personality to the site. I’m not sure that it’s helpful, but the occasional humorous tag might be amusing.

Witty tags work when you’re reading at the bottom of a post, or reading the summary or digest of an article before you click to Read More. But the intended way for your readers to use tags is to find other related content on your site that is of interest to them. If you over-do the witty tags, you’re not giving the reader useful ways to find a reason to spend more time reading your site.

How your site’s users use Categories and Tags

How, indeed? You can guess, and you can assume, but the truth is unless you have some system of measuring that can watch your readers behavior while they’re on your site, you don’t have too much of a clue how a site’s users actually use the category and tag features.

With WordPress sites, typically it’s the authors who are doing the tagging and categorizing. Readers merely consume them. Some sites, where there is an element or even an emphasis on user-generated content, give users the capability to creating their own tags and categories. If your site does this, you absolutely need to observe and track your users’ behavior. It’s fascinating, amusing, and will give you a lot of insight.

If you retain sole control the category and tag features, you need to think about what your readers need and how useful you are making your site through these features. If you can, try NOT to have to rely on guessing or “common sense” to tell you this — find ways to observe user behavior (though logging, perhaps), or solicit user feedback, and use that to influence your planning and decisions.

Another useful thing to do is to monitor the way people are searching your site, or the search engine query that brought them to your site. The most common search terms your users used to find you should jump out as terms that you should use for tags, possibly for categories as well. And if you’re advertising your site, or using advertising to generate revenue on your site, knowing what terms users are searching for is crucial to drawing traffic and generating revenue.

WP-Admin and the Category/Tag Renovation

My experience with this was that it could have been faster and less tedious. It’s probably my host more than anything, but it seemed that reloading the post, tag, and category administration pages took longer than I had patience for. Clicking update, then waiting a few seconds for the refresh, times however many posts I updated, adds up.

If I wanted to apply the same changes to multiple posts, there’s no way to do this through the web interface. A “mass action” feature to allow adding/removing the same category or tags to multiple posts at once would be very useful.

I could have attempted to directly manipulate the database through building a custom update query, but I didn’t want to sink time into doing that, didn’t want to run the risk of messing it up, and in any case, it’s probably beyond the capability of most WordPress bloggers, so I don’t recommend it. If you have an absolutely HUGE site that needs hundreds or thousands of changes to be made the same way, look into it. If you’re just dealing with dozens, just do it manually.

The other thing that would have been helpful was some kind of redundant tag merging. It’s not uncommon to apply very similar tags inconsistently over the history of your site.

For example, I used the tags “GameMaker” and “Game Maker” quite a bit. I had a few other GameMaker-related tags, which included a specific version, such as 8.0, 8,1, etc.

My first attempt at merging these was to simply re-name the “Game Maker” tag to match the label of my “GameMaker” tag. This did not merge the tags, though; it just created two identical tag labels, which were still separate as far as my WordPress site was concerned. A reader clicking on the “GameMaker” tag from one of my posts would only find about half of the posts I’ve written about Game Maker. Not good!

In order to fix this, I had to remove the redundant tag from my tagging system. To avoid losing the posts that I wanted to be tagged, though, I had to go through and re-tag those posts with the correct tag. At that point, I had a bunch of posts that had BOTH “GameMaker” tags — the correct one, and the incorrect tag that I’d re-labeled. I still needed to remove the incorrect tag to get rid of the redundancy, but looking at my Posts I couldn’t tell which was the redundant tag! So, I went back to the tag admin page, and changed the label of the incorrect GameMaker tag to “dup”, and then went through my posts and removed the “dup” tag.

It would have been much simpler, easier, and faster, if I could have simply navigated to the tag admin page, selected both the “Game Maker” and “GameMaker” tags, hit a button to merge the two tags, and specified which label I preferred to keep. I hope they include that feature in a future WordPress release.

Conclusion

I’m sure there’s still more room for improvement with the way I’ve done it, but I’ve managed to clean up my categories considerably, and applied tags much more consistently through all of my posts. It took a couple hours, but I hope it is worth it. I see a few benefits worth mentioning:

  • Users will have an easier time finding content that is relevant to their interests or related to something they came to the site to read.
  • It will increase the amount of time users spend using the site.
  • It will decrease the amount of time users waste on the site.
  • Better organization will convey to users that the site is of good quality.