Fix cordova update problems

The best solution is to
A. remove all existing installations of cordova, node and npm. Then
B. reinstall latest node
C. update npm
D. install latest cordova

A. To uninstall node and npm follow the steps –

1. Uninstall from Programs & Features with the uninstaller.

2. Reboot (or you probably can get away with killing all node-related processes from Task Manager).

3. Look for these folders and remove them (and their contents) if any still exist. Depending on the version you installed, UAC settings, and CPU architecture, these may or may not exist:
C:\Program Files (x86)\Nodejs
C:\Program Files\Nodejs
C:\Users\{User}\AppData\Roaming\npm (or %appdata%\npm)
C:\Users\{User}\AppData\Roaming\npm-cache (or %appdata%\npm-cache)
4. Reboot, for good measure.

B. Download latest version of node from and install it. npm version must be in the PATH variable
C. Update npm using command “npm install -g” for windows “sudo npm install -g” for mac and linux
D. Install latest version of cordova using the command “npm install -g cordova” for windows “sudo npm install -g cordova” for mac and linux

Changing the default site of a WordPress multisite/network installation


1) In Network Admin -> Sites and edit the site you want to be the new ‘main’ domain so it’s url is (remove the subdomain or subfolder path totally).

2) Change the define(‘BLOG_ID_CURRENT_SITE’, 1); to whatever you want. Save it, upload it. DO NOT CHANGE SITE ID, YOU WILL BREAK THINGS.

3) Go BACK to Network Admin -> Sites and edit the site of the ‘OLD’ main site. Edit it so it has a sub-folder pathing. /edition2011/ or whatever you want. Save it.

Create Android Phonegap 3.x Application on Windows “The Easy Way”

1. Install Node.js from link

2. Download and unzip ant at a preferred directory. Download from link

3. Create the following environmental variables in windows

ANT_HOME set to the unzipped ant directory

JAVA_HOME set to the installed jdk folder (Not Jre)

[Ensure that ANT_HOME and JAVA_HOME variables are set, and that they do not have quotes (either ‘ or “) and they do not end with or with /.]

4. Install phonegap (Not cordova) using nodejs command in cmd

C:> npm install -g phonegap

5. Add the following path variables to windows – <your-directory>apache-antbin;<your-directory>AppDataRoamingnpm;<your-directory>android-sdk-windowsplatform-tools;<your-directory>android-sdk-windowstools (Change <your-directory> with your desired directory addresses)

6. cd from cmd to your preferred directory to create project

7. Use the following commands in the cmd to create project

 phonegap create my-app
 cd my-app
 phonegap run android

8. Cut and paste the folder ‘CordovaLib’ at  (<Your Project Folder>platformsandroid) to a separate place

9. Import ‘CordovaLib’ as library project to Eclipse

10. Import the other project from ‘<Your Project Folder>platformsandroid’ and select the library project in Eclipse

11. Enjoy!

N.B. I have assumed that you have already installed the Android SDK and Eclipse ADT

 english portuguese translator

WordPress p2p plugin problem: Connected posts are not shown in admin panel

I have come to this situation when I was using p2p (Post to post) plugin with a theme “Superstore” from wootheme. The problem is in the theme. If I change the theme it works well. For my situation it was solved using the instruction from wordpress support.

Add the code below in the theme “functions.php” as shown in the screenshot.

function my_canvas_hotfix_remove_filters($query = NULL)
remove_filter('pre_get_posts', 'woo_exclude_categories_homepage', 10);
return $query;
add_action('init', 'my_canvas_hotfix_remove_filters', 999);


The problem should be solved.english hindi translation

HTML tags aware version of PHP substr

If you need a  html-tags aware version of substr, this one should do the job. It works fine for me

* Truncates text.
* Cuts a string to the length of $length and replaces the last characters
* with the ending if the text is longer than length.
* @param string $text String to truncate.
* @param integer $length Length of returned string, including ellipsis.
* @param string $ending Ending to be appended to the trimmed string.
* @param boolean $exact If false, $text will not be cut mid-word
* @param boolean $considerHtml If true, HTML tags would be handled correctly
* @return string Trimmed string.
function substrByLengthRetainingTags($text, $length, $ending = '...', $exact = true, $considerHtml = true) {
if ($considerHtml) {
// if the plain text is shorter than the maximum length, return the whole text
if (strlen(preg_replace('/<.*?>/', '', $text)) <= $length) {
return $text;
// splits all html-tags to scanable lines
preg_match_all('/(<.+?>)?([^<>]*)/s', $text, $lines, PREG_SET_ORDER);
$total_length = strlen($ending);
$open_tags = array();
$truncate = '';
foreach ($lines as $line_matchings) {
// if there is any html-tag in this line, handle it and add it (uncounted) to the output
if (!empty($line_matchings[1])) {
// if it's an "empty element" with or without xhtml-conform closing slash (f.e.
if (preg_match('/^<(s*.+?/s*|s*(img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param)(s.+?)?)>$/is', $line_matchings[1])) {
// do nothing
// if tag is a closing tag (f.e. )
} else if (preg_match('/^<s*/([^s]+?)s*>$/s', $line_matchings[1], $tag_matchings)) {
// delete tag from $open_tags list
$pos = array_search($tag_matchings[1], $open_tags);
if ($pos !== false) {
// if tag is an opening tag (f.e.)
} else if (preg_match('/^<s*([^s>!]+).*?>$/s', $line_matchings[1], $tag_matchings)) {
// add tag to the beginning of $open_tags list
array_unshift($open_tags, strtolower($tag_matchings[1]));
// add html-tag to $truncate'd text
$truncate .= $line_matchings[1];
// calculate the length of the plain text part of the line; handle entities as one character
$content_length = strlen(preg_replace('/&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};/i', ' ', $line_matchings[2]));
if ($total_length+$content_length> $length) {
// the number of characters which are left
$left = $length - $total_length;
$entities_length = 0;
// search for html entities
if (preg_match_all('/&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};/i', $line_matchings[2], $entities, PREG_OFFSET_CAPTURE)) {
// calculate the real length of all entities in the legal range
foreach ($entities[0] as $entity) {
if ($entity[1]+1-$entities_length <= $left) { $left--; $entities_length += strlen($entity[0]); } else { // no more characters left break; } } } $truncate .= substr($line_matchings[2], 0, $left+$entities_length); // maximum lenght is reached, so get off the loop break; } else { $truncate .= $line_matchings[2]; $total_length += $content_length; } // if the maximum length is reached, get off the loop if($total_length>= $length) {
} else {
if (strlen($text) <= $length) {
return $text;
} else {
$truncate = substr($text, 0, $length - strlen($ending));
// if the words shouldn't be cut in the middle...
if (!$exact) {
// the last occurance of a space...
$spacepos = strrpos($truncate, ' ');
if (isset($spacepos)) {
// ...and cut the text in this position
$truncate = substr($truncate, 0, $spacepos);
// add the defined ending to the text
$truncate .= $ending;
if($considerHtml) {
// close all unclosed html-tags
foreach ($open_tags as $tag) {
$truncate .= '';
return $truncate;

sourceуслуги юриста цена

Control Link Description of a WordPress link shared on Facebook

Today I have been facing problem sharing my website link at facebook. It was showing the wrong description, which I have recognized as the previous description of my site. After changing the description google is showing okay, but facebook seems to fail at getting the new description. After some googling I have come to that post at stackoverflow (a great source of help for developers).

So you have to follow the following steps to refresh your page description at facebook –

  1. Go to the facebook debugger link at
  2. Put your site address in the input box
  3. Press debug

Viola! Your site description has been updated on facebook too.cartoon sketh

Google play ‘The server could not process your apk. Try again.’

From yesterday, I was trying to upload my new application to the Google Play, but every time I was trying, I was getting the error message ‘The server could not process your apk. Try again.’ Doing some googling on the internet I have found the cause and successfully repaired the error. The steps you have to follow are given below if you are facing this error. (Steps are for windows PC, but you may use similar approach on another OS)–

  1. Open the command prompt.
  2. Go to the directory “android-sdk-windowsplatform-tools” (Check aapt.exe there) using cd command
  3. Now execute the command — aapt dump badging “(Put here the full path to the exported apk including yourAppName.apk)”
  4. Check whatever error you have and repair and recheck using the command in step 3
  5. Once you have repaired the errors, your app will be successfully uploaded to the play market.

A screen shot of my error is posted with this post.

Error aapt


I have found this solution at link;english to swedish translation