There must’ve been a flexbox bug in Firefox 45. Today, it was brought to my attention that nav was getting cut off on a site. I added a flex-shrink: 0
to ensure the logo shrank to accommodate, fixing the problem in Safari, but not Firefox. Thinking it odd that Firefox was behaving so differently from other browsers, I decided to check for an update, and 46 happened to be available. After updating, the problem disappeared. I’ve ran into browser bugs with flexbox before.
WWW posts page 27
Globbing files including dot-files
Normally globbing for the wildcard *
will find all files in a directory except for ones beginning with a .
. Sometimes I need to get all files including the dot-files. The pattern .*
will find these hidden files, but will also include .
and ..
, referring to the directory and its parent. As I’ve learned in the past, this can be dangerous with commands like rm
, (i.e. you running rm -rf .*
to remove dot-files will remove more than expected). Today, needing to get all files in a particular path in PHP, I sought a solution. A post on a Perl forum gave me a solution using curly braces: {.??*,.[!.],*}
. Braces basically allow multiple comma-separated patterns to be evaluated. The three patterns are:
.??*
matches a dot followed by two characters followed by any number of characters..[!.]
matches a dot followed by a single character that isn’t a dot. This is needed since the previous pattern doesn’t match this case.*
is the normal wildcard glob, matching all non-dot-files.
In PHP, the glob()
function requires the GLOB_BRACE
flag to use braces. An example might look like: $files = glob($path . '/{.??*,.[!.],*}', GLOB_BRACE);
. This did exactly what I wanted.
WordPress plugin: changing rel-canonical
I serve my site over both HTTP and HTTPS to support older browser that can’t support modern or any HTTPS protocols. I prefer HTTPS for search engines and general use though, as it is more secure, increases user privacy, and is factored into SEO rankings. Due to an issue with my sitemap, Google ended up indexing all of my blog pages as HTTP. The first thing I’m going to try to get Google to show my blog pages as HTTPS is to set the rel-canonical
link to the HTTPS version regardless of which protocol the visitor uses. WordPress doesn’t have a built in way to change the canonical URL, and I didn’t want to install a heavy SEO plugin just for this, so I wrote my own.
This simple plugin removes WordPress’s rel_canonical
action, then replaces it with its own. I basically re-implemented WordPress’s own functionality, replacing the http
with https
before outputting the link. It looks like:
Tax worries again
This past night I worked on my taxes, a stressful endeavor. I am an independent contractor, which has made things way more complicated than they used to be. I’ve been using the Free File program to use online applications for filling out taxes for years now, usually using TurboTax or H & R Block. They abstract from the forms and walk me through everything, and often provide help when I’m confused, but they can sometimes be worded confusingly. I just do the best I can. The biggest problem with the abstraction is that everything is trapped in this interface, so it’s hard to review it yourself and make sure everything is right.
Every year I worry that I’ve done something wrong, and this year is no exception. Since becoming an independent contractor, having to pay estimated taxes, I don’t really get a “return”, either applying my over-payments to next year or often having to pay additional. This year, though, I have a rather large over-payment, more than enough to pay my first quarterly estimates for 2016. That worries me. I’ve made a fair amount less than last year, so it may be right, but I’m still unsure. I’m going to sit on it and come back to it another night, see what I can do to review it.
Another thing I do every year is say that next year I’m going to work with an accountant. Every next year I wait until it’s too near tax time to comfortably figure out how to do that. I don’t really know how that works or what it would cost. It’s more of a consultation and review of how I’m doing the taxes myself that I need. Maybe next year. We’ll see.
Got moved to a new server in a new datacenter by Dreamhost this weekend. Seems to be significantly faster than the old one for first page load, like an order of magnitude. It’s more in line with what I get when testing locally. I assume the server I was on was just overloaded. It had often had a load average in the 6’s or 7’s. I had been wondering what was wrong and if I should swtich to VPS. This one’s been at less than one. Hopefully it stays snappy and doesn’t get too loaded up over time.
I was using Jetpack’s sitemap plugin and even submitted it to Google until I noticed that it had the wrong protocol for all of the post URL’s. Now Google has a bunch of ‘http’ URL’s for my posts in its listings, even though they are available over ‘https’. I couldn’t figure out how to change the protocol (there is no config or documentation about where that is coming from) so I just disabled the sitemap for now.
WordPress code plugin, a quick solution
I’m slowly copying the markdown versions of my posts after my recent move of this blog. It really is tedious, and I don’t think I’ll finish anytime soon, so in the meantime I created a plugin to output the [ code]
shortcode that wordpress.com put in my post export in the same way that markdown does. This is the first plugin and shortcode I’ve created in a long while, but it was relatively quick to do working off of my posts on plugins and shortcodes. The biggest time consumer was figuring out how to deal with whitespace issues. Apparently, WordPress sometimes will add <p>
and <br />
to shortcode content. Also, there were leading and trailing line breaks adding unnecessary space. My quick solution:
Blogs moved and merged
This weekend, I moved my wordpress.com “professional” (web development) blog and my “personal” blog both to my main website and merged them together. I had been planning on moving my blog from wordpress.com for a while, but recent problems with writing posts with code blocks pushed me to finally take the plunge. I’ve also been feeling like maintaining a separate personal and professional site might be more trouble than it’s worth. I do worry that the different sort of audiences that would go to the one wouldn’t want to see the content from the other and vice versa. I might be less inclined to write some personal stuff on my professional blog. But I think I will be able to find ways to mitigate those issues and make it work well.
Both sites are now redirecting to my main site. I had to pay wordpress.com ($13 a year) for the privilege, but I think it is worth it considering the “link juice” I have with that blog. I will probably continue paying for at least several years. With the use I’ve gotten out of WordPress so far, they’ve probably earned it.
There are still some things to fix:
- The content imported from my professional blog didn’t bring over the markdown formatting, and thus all of the code blocks are messed up. I am going to have to manually copy them over one by one from the wordpress.com admin as far as I can tell. A pain.
- I accidentally deleted all of the media files imported from the wordpress.com due to the way I deploy my site. I’m going to have to reimport on a local install and upload, then make sure my deploy ignores that directory. Hopefully the redirect I set up doesn’t cause problems for this.
- There is plenty of non-blog content on my personal site that I will need to move to my main site. I don’t have any real “link juice” with that site, so I can move things wherever I see fit or not copy it at all if it doesn’t seem worth keeping.
- The theme is just a slightly modified ‘twenty fifteen’. I’m going to have to decide what I want to do with it to better integrate it into the rest of my site.
My eventual plans are to move my blog out of WordPress and into the same system I’m using for the rest of my site. I may lose some things in the process, including possibly my connection to the WordPress project, but I will gain control.
I had a number of problems during my move, but am way too tired to write about them currently. Hopefully they’ll make for a few posts this upcoming week.
Just one day after writing that I would try to post once a day, I missed posting. Certainly contributing to my difficulties in posting is the amount of time I spend thinking about and composing posts. Sometimes when I have a topic that I could easily write a short post about, I have a desire to hold off until I can write a more in-depth version. But really, I’d prefer to write more and get my ideas and experiences out sooner, even if the results are imperfect and more open to criticism. I can always revisit later. If I don’t write when it’s on my mind, there’s a chance it just will never get written. I have tons of blog post ideas or partial drafts written down that are old enough now that I don’t remember enough about them anymore to easily write about them.
Also contributing to my difficulties is the never-ending stream of new blog posts and other information other people are creating for me to read. I tend to get sucked into reading them, ignoring getting my own things done. A while back, I wrote on my whiteboard “Less reading, more writing”. I haven’t been following that advice, but that’s part of my goal with this post-per-day idea. We’ll see how I do.
I am going to try to post something once a day for a while, either on this blog or my personal blog, even if it is just a short, tweet-sized post. I think posting helps me document what I’m working on, techniques, things I find, etc. for my future self to more easily find. It’s surprisingly easy to forget things when I figure them out for one project, then don’t use that same thing again for a little while. My site will eventually have something more advanced for these purposes, but for now simple blog postings will work.
Also, I’ve noticed a strange SEO / traffic benefit to my site wherein my traffic is much more likely to be on the higher side on the day or day after I post, even though those posts are almost never the ones being visited. Perhaps the search-engine algorithms see the site as more “fresh”, even though the articles that get the bump aren’t fresh at all.
The biggest problem with this is that even a post I intend to be quick often takes an inordinately long time as I look up things and add more to it. Like this post. We’ll see how well I do with my goal.