13

How To Fix Incomplete WordPress (WXR) Exports


Posted by Artem Russakovskii on April 13th, 2012 in PHP, Programming, Tips, Wordpress

Having spent way more time on this problem than I really should have, I'm going to make sure everyone can actually find a solution instead of useless WordPress support threads.

The Problem

I wanted to export all the data from WordPress using its native export mechanism (located at http://YOURBLOG/wp-admin/export.php), but since the blog I was working on was pretty large (6k posts, 120k comments), I kept getting XML files that ended prematurely and for which xmllint spit out this error:

Premature end of data in tag channel

Upon closer inspection, I saw the XML file ended with a random, yet always fully closed, </item> tag, but was missing the closing </channel> and </rss> tags, as well as a whole …

Share

Updated: August 27th, 2012

Today's snippet is tremendously helpful if you are using an XML-RPC WordPress interface to read and publish your articles and are running into 500 Server Error issues due to running out of memory, manifesting themselves in something like this error message: "Invalid Server Response – The response to the metaWeblog.newMediaObject method received from the weblog server was invalid".

For example, my regular PHP memory allocation is 32MB or so, but if I load up Windows Live Writer, my favorite publishing tool, and ask it to load 1000 of the latest blog posts, I will undoubtedly get a server error back.

One solution would be to increase the memory allocated to PHP to something higher, like 256MB, which is how …

Share

Updated: February 2nd, 2011

WordPress has a great way of letting you use simple text tags called shortcodes to provide a whole bunch of functionality, including custom PHP code. In this article, I'm assuming that you already know what shortcodes do and how they operate (if you don't, head over here: Shortcode_API).

One glaring omission in the way shortcodes are set up by default is that they only get triggered in the content of your post, leaving the sidebar and comments out. I'm sure this is done for security, so that your readers can't screw something up by posting shortcodes they're not supposed to – after all, shortcodes are PHP snippets on the backend.

However, let's assume you really know what you're doing …

Share

Updated: December 25th, 2011

imageAs a developer, I both love and hate Eclipse for its chaotic nature, buggy and sometimes unusable interface, but at the same time incredible usefulness and ability to serve as a single tool for all of my development, be it C++, PHP, Java, Android, Perl, etc.

One of the biggest problems with Eclipse is that there is no clear upgrade path from major versions, for example 3.5->3.6. What I ended up having to do for years is back up the old release, download and unpack the new release, and then try to migrate all the settings by importing and exporting left and right. Not so pleasant.

Turns out, as of Eclipse 3.3 (though I've only tried it with Eclipse 3.5), …

Share

Updated: February 9th, 2014

image

Introduction

I don't know about you, but I can't imagine doing my PHP development without an IDE with a debugger anymore.

It autocompletes for me, it lets me step through each line of code, jumping around the project, execute and change the code flow on the fly, and does many other things that make me feel cozy, comfortable, and efficient at PHP development (as opposed to, say, CPP which makes me feel cold and lonely).

There are many PHP IDEs out there and I've tried most of them (including the free PHPEclipse and PDT for Eclipse) but kept coming back to NuSphere's PHPEd every time. The other ones just don't do as good of a job and don't have the …

Share
5

Follow-up To Loading CSS And JS Conditionally


Posted by Artem Russakovskii on January 15th, 2010 in Programming, Wordpress

First of all, I'd like to thank everyone who read and gave their 2 cents about the [Wordpress Plugin Development] How To Include CSS and JavaScript Conditionally And Only When Needed By The Posts post. The article was well received and will hopefully spark some optimizations around loading styles and scripts.

Here are some discussions and mentions around the web:

Sure, there are drawbacks to this method and it does require some more processing on the backend and it's not for everyone, which is why we should always strive for an even better solution.

I stand by my point of view that, for instance, my dedicated …

Share

It's always important to know for developers what browsers they are developing for, who dominates the market, and what the current trends are.

I have gotten my hands on the Plaxo.com visitors' browser stats for December of 2009.

This information is valuable because Plaxo has a relatively general demographics, as it's not a site only geeks or only moms visit, and the statistics tends to not be skewed. Therefore, as you can see, Firefox doesn't occupy the same share as you might see on a techy site (on this site, more than 50% of users visit in Firefox).

Also, since Plaxo has a couple million monthly visitors and therefore a couple million data points, statistically speaking these numbers are relatively …

Share
14

How To Fix Intermittent MySQL Errcode 13 Errors On Windows


Posted by Artem Russakovskii on January 5th, 2010 in Databases, MySQL, PHP, Programming

Updated: September 16th, 2012

13

The Problem

I've had MySQL on my Windows 7 laptop for a bit (as part of wampserver), mostly for local offline WordPress development.

However, even though MySQL is relatively stable, I've been observing a vast quantity of intermittent MySQL errors, as reported by WordPress in the PHP error log (C:\wamp\logs\php_error.log). Here are some examples:

[05-Jan-2010 09:47:51] WordPress database error Error on delete of
'C:\Windows\TEMP\#sql17e0_1a2_6.MYD' (Errcode: 13) for query SELECT t.*, tt.*
FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON tt.term_id = t.term_id
INNER JOIN wp_term_relationships AS tr ON tr.term_taxonomy_id =
tt.term_taxonomy_id WHERE tt.taxonomy IN ('category') AND tr.object_id IN (3)
ORDER BY t.name ASC made by require, require_once, include, get_footer,
locate_template, load_template, require_once, dynamic_sidebar,
call_user_func_array, widget_rrm_recent_posts, RecentPosts-&gt;execute,
ppl_expand_template, 

Share

image As a backend developer, I don't get to work with JavaScript much anymore. However, from time to time, a project would come along that uses JavaScript (specifically, AJAX) to load some backend data on the fly. Of course, nothing works 100% right away*, so I would often have to tweak this JavaScript and massage it until it does what I need.

Here's where Firebug comes in with its JavaScript debugger. I'm used to using a debugger in every language I deal with, so using Firebug is a no brainer. Since it supports breakpoints, stopping execution and inspecting local variables and the rest of the scope generally beats alerts and console.logs for me.

Here's what a typical breakpoint looks …

Share

image When I visited Mozilla's offices about 6 months ago, I saw a mobile testing station which included about 20-30 different phones lounging around, with their chargers plugged in. I knew something serious was coming soon. There were rumors about Firefox for Mobile for a while but nothing to really show for it. That was then…

Today, however, we know a lot more. Firefox for Mobile, codenamed Fennec, is coming next month (see More Info below) and looks very promising.

Here is a recent video of the Firefox's mobile and design teams discussing and showing the features of Mobile Firefox:

Feature Highlights

For the busy folks, here are the highlights from the video:

Share
7

[Android] Auto Formatting Android XML Files With Eclipse


Posted by Artem Russakovskii on November 4th, 2009 in Android, Eclipse, Java, Programming, Tips, Tutorials

image In this article I will describe the problem I've had with Eclipse's handling of XML file formatting as well as the best way to fix it.

 

I use Eclipse to do my Android development for a few reasons:

  • it's the only IDE fully supported by the Android dev team
  • it has a visual Layout/Resources builder that transforms XML files into corresponding visual representations
  • it's free and open source
  • I've been using Eclipse for many years and am very familiar with it

In order to use the visual features in Eclipse when developing for Android, you need to install the ADT plugin provided by Google

The Problem

However, one thing about Eclipse Android development has bothered me for a while …

Share

Updated: January 29th, 2010

image Today I found out something entirely new about framebusting and specifically clickjacking protection techniques.

I was working with a site that was using frames. Suddenly, one of the frames (which was hosted on a domain that differed from the one it was embedded in) displayed the following message (in Firefox 3.5.4):

This content cannot be displayed in a frame
 
To protect your security, the publisher of this content does
not allow it to be displayed in a frame.
 
Click here to open this content in a new window

image

Notice how this is a native Firefox window and not a web page rendering. Quite stumped, I started looking at the frame response and finally found that it included this …

Share

What Is This All About?

imageIf you, like me, love StackOverflow, SuperUser, ServerFault – the community programming/software/sysadmin Q&A sites built by Joel Spolsky and Jeff Atwood and you are an active member of these sites, you owe it to yourself to install this underappreciated and unadvertised greasemonkey script: StackOverflow – User Info Aggregate. I really think it should get more attention. All credit goes to Jon Erickson.

(What? You've never heard of the sites mentioned above and you call yourself a programmer? Shame on you – go check them out immediately!)

Once you install the script, the top bar that normally shows only single site statistics, like so:

image

will turn into a multi-site bar, with all …

Share

I just got back from the StackOverflow's DevDays conference in the rainy (at least today) San Francisco.

I was really glad to see Joel Spolsky, Jeff Atwood, and the whole StackOverflow team in person, as well as listen to great talks in the following topics:

9:00 – 9:50    Joel Spolsky Opening Keynote
9:50 – 10:45    Mark Harrison Python
11:00 – 11:55    Rory Blyth iPhone
11:55 – 12:25    Joel Spolsky Fogbugz
13:30 – 14:25    Scott Hanselman ASP.NET-MVC
14:25 – 14:45    Jeff Atwood Stack Overflow
14:45 – 15:40    Daniel Rocha Qt
16:10 – 17:05    James Yum Android
17:05 – 18:00    Yehuda Katz jQuery

My own favorite topics were in the following order of fun/usefulness level:

Share
9

Installing The Android Plugin For Eclipse


Posted by Artem Russakovskii on October 15th, 2009 in Android, Java, Programming

Updated: October 16th, 2009

image Today is my first day looking at Android development. My first encounter with the Android plugin for Eclipse has not been very smooth, to say the least. I am not sure if it's Android's or Eclipse's fault but I just wasted 2 hours on errors during the plugin installation and would like to pass on the time savings to you.

The plugin install page provides initial instructions and the location of the plugin to give Eclipse (https://dl-ssl.google.com/android/eclipse/). This is very standard stuff and I've installed many plugins exactly the same way. However, here's when problems started.

Problem #1: Error while loading manipulator

Eclipse just shows a cryptic Install failed box. Here are the highlights:

Share