Simple element blocker with and without jQuery

If you’re using jQuery the best (the only reasonable?), in my opinion, way to block an element or entire page (for example for updating it contents) is to use blockUI plugin. But, if you only have to block one or two small elements then you may consider writing your own, very simple blocker instad of using blockUI. And if you’re using jQuery only for that purpose (really small project or task), the you may try to do the same without jQuery at all.

Read More “Simple element blocker with and without jQuery”

Test page for Markdown on Save Improved plugin

This is a dummy example post body, that can be used for testing Markdown rendering in any WordPress post or in any Markdown supporting page at all. I wrote it months ago and started using it for testing Markdown on Save Improved plugin. But then in turned out, that this quick sheet can be used virtually everwhere, where Markdown can be used. Just paste everything or selected part to test and verify Markdown in your blog, website, service etc.

Read More “Test page for Markdown on Save Improved plugin”

Print correct date in languages other than English

Unlike in English, full date written in many other languages (i.e. in Polish) has month written in genitive case. Neither WordPress (the_time()) nor PHP itself (date() on which the_time() is built on) supports writing dates in such format, so you’ve got to help yourself. This isn’t a hard task and there are many approaches to solve this problem across Internet. Here, I present on of the solution, ready to be used both in one, single theme or across entire WordPress Network.

Read More “Print correct date in languages other than English”

Hiding blog from guests or setting up ‘Under Construction’ site

WPRecipes has a quick and clean example of using shortcodes in WordPress in general and a particular example of restricting part of post (text, media or anything) to be visible only to registered users. This is quite nice example of doing so, without need of extra plugin for this purpose. You could also learn from here an overall knowledge of using shortcodes in WordPress, if you’re not familiar with that.

Keep in mind that this tips is for hiding part of post from guests. If you want to hide entire post, simply publish it as Private (all posts and pages are published as Public by default) — look in post or page settings.

Read More “Hiding blog from guests or setting up ‘Under Construction’ site”

My favorite AI Factory’s Chess Free games

I’m playing Chess Free by AI Factory Limited on my mobile devices. Games has an option to export gameplays in PGN format. Though I’m pretty weak player, I wanted to write down myself most interesting games I played.

If you’re anything more than beginner in chess, you probably won’t find anything interesting in this post. Sorry! :]

Read More “My favorite AI Factory’s Chess Free games”

Fixing small but annoying issues in Dashboard in WordPress Network

There are three small, but annoying things in Admin Dashboard that I always encounter, when dealing with WordPress Network installation:

  • My Sites menu items order,
  • slow loading of that menu,
  • WordPress sites’ Dashboards language.

All three issues can be easily fixed. But, you’ll need some deeper knowledge of WordPress and deal with some plugins (both hand-written and downloadable).

Alphabetic order of My Sites menu

First thing is how to sort My Sites menu items alphabetically?

The question, what order is used to sort My Sites menu in WordPress Network Dashboard remains unanswered. Items order in that menu changes as you’re making changes to your sites, but probably even WordPress authors can’t answer what sort order is used there. We only know for sure, that it isn’t alphabetical — the most wise and most obvious.

Here is a simple solution (network plugin) to solve this problem. Just copy this:

/*
 * Plugin Name: Sort My-Sites
 * Description: Sorts the My Sites listing alphabetically.
 * Author: Otto
 */

add_filter('get_blogs_of_user','sort_my_sites');

function sort_my_sites($blogs)
{
    $f = create_function('$a,$b', 'return strcasecmp($a->blogname, $b->blogname);');

    uasort($blogs, $f);

    return $blogs;
}

and paste it into text editor.

Save it under any name (sort-my-sites.php for example), put to a subdirectory (sort-my-sites) and ZIP it (sort-my-sites.zip). Then install and network enable such plugin. And voila!

This solution is a slight modification of this WordPress StackExchange answer.

My Sites menu items count

If you have many sites in your network and number of My Sites menu grows, you may even face the problem that your entire Dashboard loads visually slower only because Network Admin bar consumes much time and resources to build up My Sites menu.

In this case you may consider Joshua Lynch’s solution.

It utilizes similar approach as above and introduces some new filters, that removes all sites from My Sites menu and places commonly used items to it instead.

Dashboards’ Language

Very irritating (at least to me) is that when you (or your user) sets blogs language to different than English, not only blog is translated, but also is admin’s dashboard. Translations authors are paying much less attention to quality and update of dashboard’s translations, so translated dashboard may not only be confusing, but also improperly translated or with missing strings.

All these problems can be avoided, by forcing each dashboard to English, no matter, what language blogs are using. This can be done with a small and simple plugin called Admin in English.

Note: If you search the web for this plugin name, you may find some sites, outside WordPress.org, that shows some nice examples on how to force all dashboards to use the same, non-default (not English) language. I remember, that I run into article showing how to have all dashboards in Russian, while network blogs were all in Russian, English and German.

Free Javascript chess engines and notation board presenters

I had to find a free Javascript based chess engine for one of my projects. I must admit, that I’m a low-level player and much, much lower level chess developer, so I assumed, that there is no chance, you can write such advanced thing like complete chess engine in such simple language like Javascript.

Turned out, I was wrong. I was actually devatated (again and again) with the power and possibilities behind Javascript.

Read More “Free Javascript chess engines and notation board presenters”

Remove some pages from PDF and other PDF-editing operations

Acrobat Reader is a free program, but does not contain nothing around editing (with small exception). So operations like removing some pages, rotating some or all pages, converting PDF to other format, extracting pages to graphic format like JPEG, merging two and more PDF files etc. are not available in Acrobat Reader. For these you have to either purchase a paid, full version of Adobe PDF or seek for some other tools or options.

This post discuss a variety of ways and methods of removing certain pages from PDF document and doing some other editing operation on such docs.

Read More “Remove some pages from PDF and other PDF-editing operations”

Getting iCloud (me.com) emails to Gmail

I’ve got an iPad Mini. It looks great (at some points — even fantastic)! But due to my current situation, I’ll stay with my Android and Gmail and will treat iPad as additional toy. At least for a while. Since I still had an empty slot in Gmail to add one another external mail server, from which I want to get all emails, I tried this trick with my iCloud / me.com / Apple ID mailbox. And failed.

If you’re looking for a quick answer to question “How can I sync my iCloud / me.com mailbox in Gmail“, the answer is quick, but you’re not going to like it: You can’t. Fortunately, there’s a workaround to this problem.

Read More “Getting iCloud (me.com) emails to Gmail”

Downloading Google Play applications directly to your PC [updated]

Yes, it seems, that with a little bit help from Vietnameese developers, there is a fairly easy way to download Google Play applications to your PC. Why you would like to do this? There are at least few reasons.

It is a faster way, that does not require Internet connection. You copy a bunch of *.apk files from your PC to your Android-based device, and install them directly from there, without touching Google Play.

If you have ever read this article before then read it again and notice extremely important security update.

Read More “Downloading Google Play applications directly to your PC [updated]”

Self-adapting images in responsive design

In my humble opinion, responsive design is a future. One layout, carefully designed, will look beautiful and by user-friendly, no matter, which device user will use to view it. Of course, you can craft responsive designed website by hand, but the easiest way is to use some framework. But what about non-framework elements, like for example images? How to style them, what size should they have, to be responsive and look exactly like other, framework elements, on any device?

There are at least few approaches to solve this problem, among which one or two are not that famous.

Read More “Self-adapting images in responsive design”

Application compiled with PhoneGap fails to update, but can be re-installed

If you ever encounter problem, that you can’t update (on your mobile device) applicatation compiled with PhoneGap or PhoneGap Build, first what you should do, is to try to uninstall it and then perform fresh install.

If that succeed, any following updates should run without problems.

This is caused, by PhoneGap version change (either manually, if you’re building by-hand, or automatically, if you’re building using PhoneGap Build). This is one of documented bugs in PhoneGap and hasn’t been fixed as of writing this article.

Convert NTFS to FAT32 without losing data [updated]

Many people on many forums and websites claims that this or that piece of software is able to convert NTFS partition to FAT32 without losing data. In most cases this turns out to be only a blunt lie and results in a huge time waste on installing software that is only able to achieve such conversion by formatting partition.

Here you have the only known to me method of getting your drive from NTFS to FAT32 under Windows, while keeping your data safe.

One small note. Before I was really able to perform NTFS-to-FAT32 conversion without losing data I wasted hours on installing and uninstalling crappy software which was expected to be able to do such conversion, but eventually turned out not. This irritated me a little bit, so expect (and please, forgive me for) a harsh language in this article.

Read More “Convert NTFS to FAT32 without losing data [updated]”

PhoneGap Build’s apps fails to open links in external browser

Ever since PhoneGap 2.1.0, every application build with PhoneGap Build always opens all links in WebView on Android. No matter what configuration changes has been done. This is a reported issue, but though we already have PhoneGap 2.4.0, nothing has been actually done around this.

Details and some workaround follows.

Read More “PhoneGap Build’s apps fails to open links in external browser”

Catch back button and exit PhoneGap application

This article shows an example, how to respond, when user of your mobile application taps on Back button and how to exit application, after getting user confirmation, that he or she is willing to do so. It also explains, why you shouldn’t do it at all, if you plan to ship your application to multiple platforms, including Apple iOS.

Read More “Catch back button and exit PhoneGap application”

Very simple alternative to jQuery

Often, in many small or very small projects, you include jQuery only to have a conviniend DOM-selectors access via $(selector) and except this, you don’t use jQuery at all. In cases like that using neither jQuery nor smaller Zepto.js isn’t pretty wise.

Here is an example on how to achieve same effect in pure JS with querySelector and querySelectorAll.

Read More “Very simple alternative to jQuery”

Icon and splash screen sizes for PhoneGap applications

Since PhoneGap is used to build mobile applications for many destination platforms, out of one source files package, and since each platform contains many mobile devices, with different screens sizes and orientations, it is fairly hard task to design set of mobile application icons and splash screens to suit all needs.

This post is meant to help you with solving this problem, but it is nothing more than a bunch of links to an external sources plus some comments.

Read More “Icon and splash screen sizes for PhoneGap applications”

Hiding splash screen in PhoneGap application

There are various things you have to consider, when developing a PhoneGap application, if you want to control when and how your application’s splash screen will be shown or hidden. This post summarizes all my knowledge in this area. Most information presented here are obvious to more experienced PhoneGap developers, so this post works more like memo to myself.

Read More “Hiding splash screen in PhoneGap application”

Developing PhoneGap applications on Windows

When I first time checked PhoneGap I immediatelly felt in love with it. That was something just amazing and nearly impossible. Use well known HTML5, CSS and JavaScript to build mobile applications with direct out-of-the-box support for eight different mobile apps platforms? No Java, no Objective-C? Hard to believe!

But it was true… Then I moved to famous Getting Started Guides and actually died! Oh, my f*king goodness! Eclipse? Insane number of SDKs? And then PhoneGap Build has been born and my soul has been saved! :]

Read More “Developing PhoneGap applications on Windows”

Fixing graphic problems in Diablo I and Diablo II

I’m so sucking and low player that actually for past fifteen (!) years I’ve been playing in actually four games: Diablo I, Diablo II, Civilisation and Transport Tycoon. The first two caught my heart so deeply that I even try to run them (Diablo I!) on Windows 7. And… I actually managed to do this.

Since, this involved a lot of googling and asking, here is a summary of my findings.

Read More “Fixing graphic problems in Diablo I and Diablo II”