mardi 3 mai 2016

Subversion fails due to power outage

Hi there,

Here I am again, fighting with subversion.

So, I had a power outage today while updating subversion and that broke the central point of failure in subversion, the wc.db.

I got the following error:

$ svn cleanup
$ svn up
$ svn: E200030: sqlite[S11]: database disk image is malformed


I have Gb's of data checked out and have a home office ... no fun checking that out again, so I simply got sqlite from the repositories, created a new db with subversion, truncated all tables, and populated with the data I recovered from the corrupt db.

If you are a poor man (Windows users), you download a version of sqlite from http://sqlite.org. A subversion sqlite database has the following type:

"SQLite 3.x database, user version 31"

You can see this if you issue "file" against it:

file .svn/wc.db

You will need Linux, Unix (incl. Mac OS X), Windows+Cygwin, or Windows 10 with Ubuntu subsystem for that "file" command to work.

Furthermore, a subversion sqlite database has the following tables:

"ACTUAL_NODE", "NODES", "PRISTINE", "REPOSITORY", "sqlite_sequence", "sqlite_stat1", "WCROOT"

As you can see, only a few. Since the db is corrupt AND I can still access the data, I will need a new db; I checked I could access the data with the following:
 
$ sqlite3 .svn/wc.db
sqlite> select * from NODES

Note that sqlite3 can create a blank db for us, however, it will not be the version subversion wants :-(, unless you take a really old sqlite3.

So, I move the wc.db out of the way and checkout a folder into a temporary directory, move the newly subversion-blessed db into position:

$ mv .svn/wc.db .svn/wc_bad.db
$ cd /tmp
/tmp $ svn co -N http://myServer/myfolder
/tmp $cp .svn/wc.db /path/to/subversion/checkout/


Now I need to populate the db ... I open the old sqlite db, dump its contents, open the new db, truncate all tables, and finally, populate all tables with data from old db:

$ sqlite3  .svn/wc_bad.db
sqlite> .mode insert
sqlite> .output dump_all.sql
sqlite> .dump
sqlite> .exit
$ sqlite3  .svn/wc.db
sqlite> delete from "ACTUAL_NODE"
sqlite> delete from "NODES"
sqlite> delete from "PRISTINE"
sqlite> delete from "REPOSITORY"
sqlite> delete from "WCROOT"
sqlite> delete from "sqlite_sequence"
sqlite> delete from "sqlite_stat1"
sqlite> vacuum
sqlite> .read dump_all.sql
sqlite> .exit
$ svn up
A some/amazing/newly/added/awesome/file.txt 
...


Hope this helps you.

Note that I got the dump commands from http://techblog.dorogin.com/2011/05/sqliteexception-database-disk-image-is.html, great entry, although in my case, the sqlite3 created db was not accepted by subversion, I got the following error:

svn: E235000: In file '..\..\..\subversion\libsvn_wc\wc_db_wcroot.c' line 269: assertion failed (format >= 1)


jeudi 6 février 2014

Avaya IP Office SoftPhone ? WTF ? Don't, don't, don't !!!

My occasional rant about software, today Avaya software ...

I don't know what happened here, but I have been kindly asked to install some software written by complete utter n00bs.

1. It only runs on Macs or consumer OS's (Windows) - great for a softphone, remember though, that it is the type of software you are supposed to install on your "workstation" - Tablet ui's are for consumers, imho. What about Linux ?
2. It does not remember your settings, as in, how you sort your contacts ... WTF? Seriously ??? The contact list is clogged up with built-in groups and default contact sort is alphabetically, regardless of who is online or not.
3. It clogs up your Windows registry by creating a node guess where? HKCU\Avaya - this is BAD PRACTICE, it should be under HKCU\Software\Avaya, but wait, they have a node there, too ... utter n00bs. Imagine every software company did that ...
4. Their server runs on Linux as they claim better TCO, gossh, at last one thing they got right, what about the client software, though ? It would allow their customers to decrease their TCO even more, don't you think ?
5. How about smartphone support ?

In the end, I assume we got it because they have good hardware phones ...

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