Neat trick with the ps Command

I’m fond of using the ps command to help me get an estimate of the time a running programm is spending. The ps Command with the -o option can be used to find relevant information about processes. For example, the command ;

ps -o etime process_ID

gives the elapsed time of the process since its creation. Cool Ah ?

Moving from Solr to Lucene in Alfresco 4.0.e ( FULL REINDEX)

I decided to change the indexing subsystem from Solr  to Lucene since Solr was getting stuck on some nodes. There was a script that was moving and renaming folders in Alfresco and this seemed to get Solr broken during indexing.

In order to change over from Solr to Lucene the following procedure should suffice.

-> Stop Afresco.
-> Open the /tomcat/shared/classes/alfresco-global.properties file.
-> Comment out the solr section like this;

### Solr indexing ###
#index.subsystem.name=solr
#dir.keystore=${dir.root}/keystore
#solr.port.ssl=8943

-> Add the following lines

 ###lucene###
 index.subsystem.name=lucene
 dir.indexes=C:/Alfresco/alf_indexes/lucene-indexes
 dir.indexes.backup=C:/Alfresco/alf_indexes/backup-lucene-indexes
 index.recovery.mode=FULL

-> Create the above folders if they do not exist.
-> Start alfresco
-> Stop alfresco.
Change from index.recovery.mode=FULL to index.recovery.mode=AUTO in the said file.

Start afresco again if you please.

Ephesoft and OpenLDAP issues

It is very frustrating to install, uninstall and reinstall Ephesoft all in the name of trying to fix OpenLDAP issues. The problem here is that sometimes the OpenLDAP service does not get removed on uninstallation. It is the one from the previous installation that lingers in the services list.

A very neat quick fix to the removal of the OpenLDAP service problem is the Autoruns program. Upon installation, click on the services tab and remove the associated service and it will be done.

You may also try this

Connecting Java to Mysql (JDBC) on Debian

I woke up about 6am today trying to tie Mysql and Java together without much success. At about 12:30 I finally got it to work and this is how I fixed it.

1. Download the mysql/Java connector from Mysql’s site. If you are using debian do like this.

          apt-get install libmysql-java
        

2. After you write you program compile (HelloConnect.java) it like any regular java file because the classes will be automatically pulled in for you.

3. Critically on the commandline do like this;

java -classpath .:/usr/share/java/mysql-connector-java-5.1.10.jar HelloConnect

Haha, now you are laughing !

Programming assembly for x86-64 bit machines

Following assembly books which are written for x86-32 bit machines on a 64 bit machine can be a pain in the ass. Thankfully I found this site http://www.x86-64.org/documentation/assembly.html
that really clarified things for me. Thus this is a short example of an assembly program written for an x86-64 bit machines demonstrating how a function can be called. The sample function takes a number a returns the square of that number.

# A program to call a function a compute 
# the square of a number.

.section .data

.section .text

.globl _start

_start:

	push $5			#push first argument	

	call square		# call the square function
	movq $1, %rax    #Call to exit

	int $0x80

# Square Function.
# takes a number and squares it.
# returns the squared number.

.type square, @function
square:
	push %rbp			# save old base pointer
	movq %rsp, %rbp     		# make stack pointer the base pointer
	movq 16(%rbp), %rcx   		# Copy the first argument from the
					# stack which is on position two. 
					# Thus its 2 quad-words which requires 16
	imul %rcx, %rcx   		# Square and store the number
	
	mov %rcx, %rbx			# store the return value
						
	movq %rbp, %rsp			# restore the stack pointer
	pop %rbp
	ret

Setting Up libcdio for Ruby on Debian Lenny

I am on the verge of a writing a program to read a list of tracks from an audio CD in C but since i also program Ruby i am playing around with it using an already existing library. This is how to set it up on a debian machine.

% apt-get install libcdio

% apt-get install libcdio-dev

% apt-get install libcdio-cdda-dev

% apt-get install iso9660-dev

% gem install rbcdio

% apt-get install libcddb-dev

% irb

%

irb(main):001:0> require ‘rubygems’

irb(main):002:0> require ‘cdio’

And that is that.