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

lundi 14 mai 2012

ps2png or pdf2png how to create high quality images from just about anything in Linux

I had this PDF I had to sign for the company I work for. It is a pain to print it out, sign it and scan it to send it out again. So I thought I would use ps2png, which works with PDF's as well, BTW, and use Gimp to insert a scan of my signature at the required position.

The problem we all come across is that ps2png sucks in terms of quality.

Linux (Unbuntu 11.10) comes with the print to svg feature, which is cool. Print the PDF, or whichever file you have, to SVG and use inkscape.

Emacs was bad, inkscape sets new records in ui complexity ... it is the first graphical editor I have come across where you just cannot select a portion of the image to copy and paste it into another. It is also the first graphical editor where you cannot use the mouse to move an inserted image around without invoking some obscure incantations, so use the arrow keys.

The bug (?) I came across was, that the page of the PDF was displayed hundreds (thousands?) of times in the SVG. When you print the resulting image to PDF, you only see it once. In inkscape, you need to edit the image on the bottom left. Click the blue arrow to insert your image, move it to the appropriate location and you can print it. You could also at this point export it to png, In the export dialog, click [Page].


EDIT: inkscape makes PDF's so crisp they make professional marketing guyz shit their pants.

lundi 7 février 2011

Oracle 10R2 on Mac OS X

I wanted to install Oracle 10.2 on Mac OS X 10.6.6 64Bit and found a couple of issues that you might encounter as well. I could not get it to link the Oracle binaries, so this is all a bit moot, for the moment. Will post as soon as I have found a solution for that - I use db2 instead, also a post on installing db2 on darwin in the works.

First of all, create the users and groups as described in the installation instructions:
1. find free id's for groups:
dscl . -list /groups gid | awk '{print $2}' | sort -n
2. find free id's for oracle user:
dscl . -list /users uid | awk '{print $2}' | sort -n
I used uid/gid's 300, 301, 301 for oracle and oinstall, dba, oper, respectively

3. create the groups

dscl . -create /groups/oinstall
dscl . -append /groups/oinstall gid 300
dscl . -append /groups/oinstall passwd "*"


dscl . -create /groups/dba
dscl . -append /groups/dba gid 301
dscl . -append /groups/dba passwd "*"
dscl . -append /groups/dba GroupMembership hans

dscl . -create /groups/oper
dscl . -append /groups/oper gid 302
dscl . -append /groups/oper passwd "*"
dscl . -append /groups/oper GroupMembership hans

4. create the oracle user

You could also use system preferences to create the user, in which case you only have to execute the last three of the dscl commands.
dscl . -create /users/oracle
dscl . -append /users/oracle uid 300
dscl . -append /users/oracle shell /bin/bash
dscl . -append /users/oracle home /Users/oracle
dscl . -append /users/oracle realname "Oracle software owner"

dscl . -append /users/oracle gid 302
dscl . -append /groups/dba GroupMembership oracle
dscl . -append /groups/dba GroupMembership hans

mkdir /Volumes/oracle
chown oracle:oinstall /Volumes/oracle
passwd oracle
5. Next, specify the kernel parameters:

I created a file named /etc/sysctl.conf with the following contents:

kern.sysv.semmsl=87381
kern.sysv.semmns=87381
kern.sysv.semmni=87381
kern.sysv.semmnu=87381
kern.sysv.semume=10
kernel.shmall=2097152
kernel.sys.shmmax=2147483648
kernel.sys.shmmni=4096
kern.maxfiles=65536
kern.maxfilesperproc=65536
net.inet.ip.portrange.first=1024
net.inet.ip.portrange.last=65000
kern.corefile=core
kern.maxproc=2068
kern.maxprocperuid=2068
6. Reboot, log on as oracle
In terminal, you want to start the 32bit Java VM:
Run:
java -version
If java -version shows it is running a 64Bit JVM, you need the 32Bit one:
./runInstaller -J-d32

I got the following error when trying to start runInstaller with the 64Bit JVM:

Install2011-02-08_07-12-16AM/oui/lib/mac_osx/liboraInstaller.dylib: no suitable image found. Did find: /private/tmp/OraInstall2011-02-08_07-12-16AM/oui/lib/mac_osx/liboraInstaller.dylib: mach-o, but wrong architecture