dimanche 13 octobre 2013

Migrate Phone Contacts from Old to New Phone

Background:

Friend had balckberry mobile phone and got a new Sony xperia M. The contacts from the blackberry were exported into a CSV and needed to be imported into the xperia.

The Sony PC companion is utter useless crapware, so you cannot import contacts from a CSV file directly, only other Sony (?) or Windows contacts can be imported. Besides, it kept telling me that I had to detach the old phone although I had specifically specified that I was importing my contacts from Windows.

Anyway, how do you get contacts that are stored in a CSV file into windows in the first place ? Microsoft has, depending on which program you use to open a CSV file, different interpretations to how a CSV file should look.

CSV stands for "Comma-separated Values", however, Excel wants CSV with "tab-separated Values" (you can open Excel and import the file as a workaround), Windows contacts import wizard wants another variant, "semi-colon separated values".

So, open the CSV file in OpenOffice, check comma (or whatever you have as a separator)  in the "Text Import" window, make sure the preview shows each field in a separate field and click Ok.

Click File > Save As and make sure you specify a new name, check "Edit filter settings" and click Save. Click "Use Text CSV format" and in the new window make sure "Field delimiter" is set to semi-colon and click Ok.

This file can now be imported as Windows contacts which you can then sync with your phone. Note that you will have to map fields during import, but that is pretty simple.

insserv: Script jexec is broken: incomplete LSB comment.

 Today I updated my debian wheezy and saw the following error in the terminal:

insserv: Script jexec is broken: incomplete LSB comment. insserv: missing `Default-Stop:'   entry: please add even if empty. insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `jexec'


The fix is very easy:

#
### BEGIN INIT INFO
# Provides: binfmt_misc
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Default-Start: 1 2 3 4 5
# Default-Start: 0 6
# chkconfig: 12345 95 05
# Description: Supports the direct execution of binary formats.
### END INIT INFO
#



Anybody who unerstands LSB comments immediately sees the duplicate Default-Start entries, change # Default-Start: 0 6 to read # Default-Stop: 0 6, this should fix it:

#
### BEGIN INIT INFO
# Provides: binfmt_misc
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Default-Start: 1 2 3 4 5
# Default-Stop: 0 6
# chkconfig: 12345 95 05
# Description: Supports the direct execution of binary formats.
### END INIT INFO
#





Note that the devs who maintain this have already fucked-up their LSB comment ... see http://www.novell.com/support/kb/doc.php?id=7010013.

Some will never learn.

jeudi 15 août 2013

Connecting to Oracle 12c

A couple of weeks ago, I installed Oracle 12c on my Debian amd64 system. It is pretty easy to do, all you have to do is create a few symlinks that fuck up your 32/64 lib dirs and hack the makefiles ... another story for another blog post.

Today, I would like to talk about Oracle's new CDB & PDB architecture.

SID is Viciously dead, they say, but instance name is not - this is crazy, I need the address of Larry's pharmacist, he must have good stuff.

So, I have an Oracle instance named myinstance, it contains the CDB and a few PDB's.


Now, I connect to Oracle using user sys, I immediately end up in the CDB. Usernames/schemas in a CDB require a silly prefix, WTF, this is not the case in a PDB and it gets worse ...

SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
myinstance


So I change to a PDB:

SQL> alter session set container=MyPDB;

Session altered.

SQL>  select instance_name from v$instance;

INSTANCE_NAME
----------------
myinstance



Now, this makes sense, one instance with multiple DB's.

So, Oracle says we are on the same instance as the CDB. When I connect to the instance_name, I will always end up in the CDB .... to reach a PDB, I must connect with the service name, the service name is the name of the PDB, in my case MyPDB.


Now, why, why did they not deprecate connecting with instance_name ?


Always use the service name when you connect to Oracle, this is what they said in the ojdbc drivers for 10g, iirc.

  Connection conn = DriverManager.getConnection
     ("jdbc:oracle:thin:@//localhost:1521/MyPDB", "scott", "tiger");

However, they removed that recommendation in the  12c jdbc driver docs, do they need help or are they stupid ?

vendredi 31 mai 2013

Subversion fails more often

I started using subversion 1.4 back in the day, I got issues here and there, but I could easily just move the files out of the way and svn update the directory, copy the files over again ...

Ever since I upgraded to 1.5 or was it 1.6, I started getting tree conflicts, here and there, not frequent, I agree, but shit, guyz, keep it simple, I do not care about 1 or 2 ms performance increases on a commit, seriously ...

With 1.8, they did away with .svn folders in each checked out folder -it is now all centrally controlled at the root of the checked out folder ... except that now, when something fucks up, you can check the whole 10Gb out again ...


I expect products to improve over time, not seriously fuck up.

The guy who thought putting everything in one sqlite database at the root of the checkout is an IDIOT, no ifs, buts or maybes - (s)he should be Hung, Drawn and Quartered. Like, hey, we have this system where we have no single point of failure, that is bad, lets create one.

jeudi 14 mars 2013

Clear clipboard from the Windows PowerShell command line

I convert a bunch of slide decks to word processor handouts used in our trainings. Since there are over 100 decks and powerpoint ends up using Gb's of RAM once it has finished and is doing nothing anymore, I thought I would clear the clipboard.

Tangent: something uses Gb's of RAM and remains idle? Sounds like Microsoft hired some SAP developers.

Anyway, this is how I chose to solve the problem in a nice powershell script:

$a = [Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
$b = [Windows.Forms.Clipboard]::Clear()


To run this, you must start powershell.exe single-threaded:

powershell -sta myscript.ps1

BTW, sounds strange that powershell starts multi-threaded by default, however, it makes absolutely no sens at all that powershell cannot run this single-threaded shit in a multi-threaded instance.

I can understand that you cannot run multi-threaded shit in a single-threaded instance of powershell, makes sense, but the opposite is just plain fucked up, no ifs, buts, or maybes.


Enjoy