wtorek, 16 czerwca 2009
How to get X.509 certificate from CMS/PKCS#7 signature
sobota, 13 czerwca 2009
Display a command result in new Xfce terminal window
Sometimes you just want to display a result, as for ls:
xfce4-terminal -H -e ls
But sometimes it makes sense to display results continuosly, like for htop or elinks:
xfce4-terminal -e htop
How to get executable shell scripts from Subversion repository
All you have to do is to set svn:executable property on the file
svn propset svn:executable on somescript.sh
svn commit
Especially important when done on Windows (SVN client should set this automatically if executable file is being added to version control on Linux)
Keyboard shortcut for "Add to version control" in eclipse
I am really fed up with right-clicking and choosing "Add to version control". I defined a keyboard shortcut then.
Press Ctrl Shift L twice. On "Keys" preference page find "Add to version control", preferably using the relevant search box. When - "In windows". I chose "Ctrl+Shift+Alt+C" so that it won't interfere with anything (I hope).
piątek, 22 maja 2009
End-of-line characters conversion between Windows and Linux
sudo aptitude install tofrodos
and then
find . -name '*.sh' | xargs dos2unix -d
(could be with exec, but for a small number of files it does not really matter)
sobota, 9 maja 2009
A cryptographic hash of an empty byte array does exist. Honestly.
@Test
public void testNullDigest() throws Exception {
MessageDigest md = MessageDigest.getInstance("SHA1");
System.out.println(ArrayUtils.toString(md.digest(new byte[0])));
}
The output:
{-38,57,-93,-18,94,107,75,13,50,85,-65,-17,-107,96,24,-112,-81,-40,7,9}
Exactly the same as the one I was getting. In particular, different from the expected one (suprise). I should make some constant ;-/
sobota, 2 maja 2009
Prune unnecessary log4j dependencies in maven
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.15</version>
<exclusions>
<exclusion>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
</exclusion>
<exclusion>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
</exclusions>
</dependency>
czwartek, 30 kwietnia 2009
View all Subversion commiters
svn log | egrep 'r[0-9]* ' | cut -f2 -d '|' | sort -u
wtorek, 24 marca 2009
Templates in Thunar (Create document...)
wtorek, 3 marca 2009
How to change the default WPS password in Websphere Integration Developer
~/.eclipse/ibm.websphere.integration.developer_7.0.0_1741360425/configuration/.settings/com.ibm.wbit.runtime.core.prefs
and that context is to be changed:
security.user.wps_61=admin
security.password.wps_61={xor}PjsyNjE\=
For password encoding that entry might be helpful.
UPDATE: From now on you do not have to enter embedded WebSphere user/password every time you start WID. For Windows, the directory and file can somewhere in WID61\configuration\.settings\com.ibm.wbit.runtime.core.prefs. I think it could be in similar place on Linux, but that depends on your user's write rights to WID directory. I should have issued a proper umask prior to the installation apparently - but when you read installation docs few months after the installation, such things happen.
poniedziałek, 2 marca 2009
Oracle not starting after system reinstallation
oracle[SID]: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
ERROR:
ORA-12547: TNS:lost contact
Enter user-name:
The solution was to install libaio1:
sudo aptitude install libaio1
Well, somewhat natural consequence of the decision not to automatically reinstall all the packages present in my previous Hardy installation...
http://forums.oracle.com/forums/thread.jspa?messageID=2797706&tstart=0
piątek, 27 lutego 2009
Splitting and joining large files
mkdir tmpoceans
# split the file
split -b 400k 07\ -\ Oceans.ogg tmpoceans/07\ Oceans.ogg.
# check the created parts
ls -1 tmpoceans
07 Oceans.ogg.aa
07 Oceans.ogg.ab
07 Oceans.ogg.ac
07 Oceans.ogg.ad
# split it back
cat 07\ Oceans.ogg.* > 07\ Oceans.ogg
# and play
ogg123 07\ Oceans.ogg
http://www.techiecorner.com/107/how-to-split-large-file-into-several-smaller-files-linux/
http://www.johnrockefeller.net/?p=195
wtorek, 24 lutego 2009
Thunar - single click instead of the default double
Single click to activate items
http://xfce.jakilinux.org/viewtopic.php?id=19
poniedziałek, 23 lutego 2009
Subversion - repository URL of working copy
# !/bin/bash
# usage:
# svnpath - SVN repo URL for current dir
# svnpath dirname - svn repo URL for given dir
if [ -z "$1" ]
then
grep '//' .svn/entries | head -n1
else
grep '//' "$1"/.svn/entries | head -n1
fi
Other users' Oracle sessions
BLOCKING_SESSION_STATUS, SECONDS_IN_WAIT, lockwait, status
from v$session
where type = 'USER'
and nvl(osuser, 'nomycurrentuser') != 'mycurrentuser'
piątek, 20 lutego 2009
Useful SQL+ commands, part 1
set linesize 200
set pages 0 -- effectively switches off any headers
Useful for displaying long columns - not only LONG but e.g. XMLType
set long 10000 -- ... or so
Import Oracle dump into an existing schema
- First drop all sequences for a user:
declare
cursor cr is select sequence_name from user_sequences;
begin
for c in cr loop
execute immediate 'drop sequence ' || c.sequence_name;
end loop;
end;
/ - Import dump file
impdp appadmin/password directory=dmpdir dumpfile=appadmin.dmp SCHEMAS=appadmin table_exists_action=replace - It uses non-standard directory dmpdir instead of the default one DATA_PUMP_DIR, to create it run sth like:
CREATE OR REPLACE DIRECTORY dmpdir as '/opt/oracle/dmp'
from an account with proper privs (CREATE ANY DIRECTORY, "/ as sysdba" has got it definitely)
Mocp output in Xfce panel
- Get Generic Monitor for the Xfce4 panel
sudo aptitude install xfce4-genmon-plugin # or equivalent - Create a script generating your output, e.g.
echo "mocp -i | egrep 'SongTitle|Artist' | cut -d":" -f2" > ~/bin/mocpinfo4panel - Add Generic monitor to Xfce panel and input the script name into Command field, probably also change label to "mocp" or "now playing" or "what I could listen to if I didn't forgot my earphones" (well, perhaps a bit excessive).