Android / CyanogenMod : moving contacts between accounts

Contacts in Android are stored in one or more address books. One of them it the “Local” address book.

I needed to move my local contacts to a remote account, using CyanogenMod 12. I found out it’s not obvious, and Google didn’t help. This looks like the most straight-forward method:

  • Start the Contacts app
  • First, export the contacts:
    • In the context menu, select “Contacts to display”
    • Select the source address book
    • In the context menu, select “Import/export”
    • Export to storage
  • Now delete all contacts in the source address book:
    • In the context menu, select “Delete”
    • In the context menu, select “All”
  • Now import your contact in the target address book:
    • In the context menu, select “Contacts to display”
    • Select the source address book
    • In the context menu, select “Import/export”
    • Import from storage

Voilà!

 

Posted in Android | Leave a comment

Shell scripting: triming text from start to end markers with sed or awk

Let’s assume you have a huge log file looking like this:

some more log
2015-09-07 12:10 some log
some more log
...
2015-09-07 12:11 some log
...
some more log
2015-09-07 12:15 some log
some more log

Let’s assume you are interested only in the part between 2015-09-07 12:10 and 2015-09-07 12:15.

Here is a sed script that will do the job:

sed -n '/2015-09-07 12:10/,/2015-09-07 12:15/p' file.log

Here is also an awk script that does the same job:

#!/bin/sh                                                                       

awk -v "FROM=$1" -v "TO=$2" '($0 ~ FROM) {i=1} ($0 ~ TO) {i=0} (i) {print $0}' $3 

Save it and call it like this:

trim "2015-09-07 12:10" "2015-09-07 12:15" file.log

You can even use regular expressions as markers.

Posted in Linux | Leave a comment

BTRFS: moving data between subvolumes efficiently

If you move files naively between BTRFS subvolumes like this:

cd /btrfs
mv volume1/dir volume2/dir

… the data will be effectively read from and written back to the physical storage, which can become a problem if you have many or big files, especially when the partition is encrypted.

Instead, you should use “reflink”‘s, creating effectively lightweight a copy of your data, e.g. a copy that shares initially the physical data of the original files. Only when you modify the original or copy, the data will be physically duplicated.

cd /btrfs
cp -pr --reflink=always volume1/dir volume2/dir
rm -rf volume1/dir

I usually prefer rsync over cp, because it can resume easily when aborted, and also because of the –progress option, but unfortunately, it doesn’t support reflink’s yet, even though some work has been done on this.

Posted in Linux | Leave a comment

Lightroom hanging at start, showing splash screen and spinning Beach Ball of Death

That just happened to me, I spent 1h trying several things, including starting Lightroom as different user (that worked), and deleting all Lightroom related files in my home dir (that didn’t work). Google wasn’t of any help this time.

In the end, the only thing that fixed the problem was to reinstall the application.

Posted in Uncategorized | Leave a comment

OSX/Java: “To open … you need to install the legacy Java SE 6 runtime.”

Don’t follow Apple’s stupid advice to install Java 6, which is deprecated for years, rather follow these instructions:

sudo vi `/usr/libexec/java_home`/../info.plist

Change:

<key>JVMCapabilities</key>
 <array>
  <string>CommandLine</string>
 </array> 

To:

<key>JVMCapabilities</key>
 <array>
  <string>BundledApp</string>
  <string>CommandLine</string>
 </array>

“BundledApp” was enough for me, you may also use:

  • WebStart
  • Applets
  • JNI
Posted in Java, Mac | Leave a comment

JIRA: how to delete global transitions

Recently, I need to delete in JIRA a transition reachable from “all states”, known as “Global transitions” in the documentation.

I didn’t find a way to do this in the “Text” view of the workflow editor, but it’s trivial in the graphical editor. Just click on it and hit “Delete”.

Posted in Uncategorized | Leave a comment

iCal reports CalDAVAccountRefreshQueueableOperation

This seem to be a very generic error message. You should check in Console.app for more concrete information.

In my case, I had a firewall rules that blocked the connections to the server.

 

Posted in Uncategorized | Leave a comment

Terratec Noxon iRadio “Track not found”

Since a few days, most of the internet radios won’t play anymore on my Terratec Noxon iRadio. It looks like the Terratec servers are down. There are some other problems with other streams (for instance the french radio France Inter), which play fine on a computer. After a session of troubleshooting and network capturing, I found out a workaround that works well for me :

  • Go the web page of the radio you want to listen to
  • Download the PLS or M3U file of the radio. There are typically reachable by choosing an alternate player to the web player, like WinAmp, iTunes or VLC
  • Open this file with a text editor
  • Copy the URL of the MP3 stream
  • Open the web interface of your iRadio
  • Go to favorites
  • Enter a name, and the URL of the MP3 stream
  • Add the favorite
  • Play it

The favorites page is really really slow on my device. Pages take 30 seconds or more to refresh. I don’t know why, the workaround is to be patient 😉

Posted in Uncategorized | 5 Comments

Exchange: BAD Command received in Invalid state

When sending the LOGIN command and valid credentials, you might get the following error message from Exchange:

BAD Command received in Invalid state

In my case, it was because I was trying to LOGIN without encryption. Activating STARTTLS on the client fixed the issue (still using the port 143 though).

Posted in Uncategorized | Leave a comment

Archiving a WordPress blog in a human-readable form

When a blog must be taken offline, it is still nice to keep a copy in a form that is easily readable. I gave wget and its mirroring option a try, but I wasn’t happy with the results. There is a much better approach if the blog contains mainly text posts. Just set the number of posts per page in the section “Settings/Reading” of the administration to the total number of posts on the blog (or more), then open the main page of the blog with your browser (Firefox in my case), and save it as the complete page. This will keep the CSS and embedded images.
Advantages:

  • really simple
  • keeps the layout and design of the blog

Drawbacks:

  • ignores the blog pages
  • ignores the linked medias
Posted in Uncategorized | Tagged | Leave a comment