IBS Helpdesk

Professionelle IT-Lösungen

Mehrere Thunderbird-Instanzen mit verschiedenen Profilen starten

Wie kann ich mehrere Thunderbird-Instanzen starten um bspw. geschäftliche und private Mails zu trennen?

Ganz einfach! Das Stichwort lautet: “Profile”. Hängen Sie (bspw. in der Verknüpfung Ihres Thunderbirds) folgende Parameter an und verwenden Sie dabei verschiedene Profilnamen. Legen Sie verschiedene Verknüpfungen für Ihre Profile an! Danach können Sie Add-Ons und Konfiguration völlig individuell einstellen.

...\thunderbird.exe -no-remote -p <profilname>

(Der Parameter -no-remote sorgt dafür, dass Thunderbird mehrfach gestartet werden kann)

JFormattedTextfield: Display double values as time format

Here you can find a Formatter-Implementation which is able to format double values in JFormattedTextfield as time format like “01:30″ and vice versa, i.e. needed for duration inputs. Furthermore you don’t need to input the :-separator, “0130″ will be automatically translated to “01:30″ . The formatter is also able to allow ‘native’ double inputs like “1.5″ or even “1,5″.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import java.text.ParseException;
import javax.swing.text.DefaultFormatter;
 
/**
 * <p>
 * This format converts a double value into a time format like 10:30 and vice versa.
 * </p>
 * <p>
 * Furthermore it checks if the input string<br />
 * a) can be assumed as time format without :-separator ("1030" -> 10:30)<br />
 * or<br />
 * b) is parseble as 'native' double value (like "0.5" = 00:30). It allows also inputs like "1,5".
 * </p>
 * 
 * @author denis[@]ibs-aachen.de
 */
public class DoubleTimeFormatter extends DefaultFormatter {
	private static final long serialVersionUID = -60169060463898543L;
 
	@Override
	public Object stringToValue(String string) throws ParseException {
		string = string.replace(',', '.');
 
		if (string.length() == 4) {
			try {
				Integer.parseInt(string); // check that it does only contain numbers
				String newString = string.substring(0, 2);
				newString += ":";
				newString += string.substring(2, 4);
				string = newString;
			} catch (NumberFormatException e) {
				// not possible/necessary to manipulate string to time-format
			}
		}
 
		Double d;
		try {
			d = Double.parseDouble(string);
			return d;
		} catch (NumberFormatException e) {
			// continue trying to parse time-format
		}
 
		d = new Double(0.);
		if (string.contains(":")) {
			String[] parts = string.split("[:]");
			if (parts.length > 0) {
				d += ("".equals(parts[0].trim()) ? 0 : Integer.parseInt(parts[0].trim()));
			}
			if (parts.length == 2) {
				d += ("".equals(parts[1].trim()) ? 0 : Integer.parseInt(parts[1].trim()) / 60.);
			}
		} else {
			d += ("".equals(string.trim()) ? 0 : Integer.parseInt(string.trim()));
		}
		return d;
	}
 
	@Override
	public String valueToString(Object value) throws ParseException {
		if (value == null) {
			return "";
		}
		StringBuffer toAppendTo = new StringBuffer();
		try {
			Double d = (Double) value;
			int n = d.intValue();
			toAppendTo.append(String.format("%02d:%02d", n, (int) ((d - n) * 60)));
		} catch (ClassCastException e) {
			throw new NumberFormatException("Need double value!");
		}
		return toAppendTo.toString();
	}
}

Add it to your textfield like this:

1
JFormattedTextField textfield = new JFormattedTextField(new DoubleTimeFormatter());

Feedback appreciated ;o)

Windows 7: Im Windows-Explorer die Baum-Struktur mit dem Ordnerinhalt verknüpfen

Im Windows-Explorer von Windows 7 ist die Baumstruktur auf der linken Seite standardmäßig nicht mehr mit dem Verzeichnisinhalt rechts synchron.

Wer dieses Verhalten wieder herstellen möchte, muss im Registrierungseditor folgenden Eintrag anlegen:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\NavPaneExpandToCurrentFolder = 1 (REG_QWORD)

Eclipselink, MS SQL Server & @@IDENTITY

When you are using the Eclipselink JPA implementation with a replicated MSSQL database (or a database with more complex triggers on some tables) you’re running probably into major problems when persisting objects, especially when you would like to use the cascaded persisting mechanism. Sometimes the database returns a wrong generated primary key which results in a foreign key constraint violation.

Reason is, that Eclipselink internally uses the query

SELECT @@IDENTITY

to fetch the generated primary key. The database uses this field to memorize the last generated ID but, and that’s the point, it doesn’t matter in which table the insert statement is been executed.

Let’s see an example:
You have a table T1 on which you defined a trigger. This trigger inserts a record into table T2.
Now, you insert your record into T1 and expect to find the generated ID of the inserted record in @@IDENTITY. But you won’t. Because of the trigger, which inserted a new record into T2, you’ll find the generated ID of T2 in @@IDENTITY.

Therefore you should use one of those methods to get the newly generated ID when you’re extensively working with triggers or the like:

SELECT SCOPE_IDENTITY()
-- OR
SELECT IDENT_CURRENT('tablename')

SCOPE_IDENTITY returns the last generated id in the same scope, whereby a scope is a stored procedure, trigger, function, or batch. IDENT_CURRENT returns the last generated id for the specified table.

Since you know in which table your record has been inserted the most secure way to fetch the id is to use IDENT_CURRENT, imho.

See some further links:
http://msdn.microsoft.com/en-us/library/ms187342.aspx
http://msdn.microsoft.com/en-us/library/ms190315.aspx
http://msdn.microsoft.com/en-us/library/ms175098.aspx

But how to fix this issue in Eclipselink?

You can implement a custom sequence strategy which uses the new query and attach this strategy to your entities. In my implementation I use the old mechanism (with @@IDENTITY) as fall-back-solution if there is no custom sequence strategy specified to an entity.

Here’s some code. First of all you need to implement the custom sequence.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package de.ibs.persistence.sequencing;
 
import org.eclipse.persistence.queries.ValueReadQuery;
import org.eclipse.persistence.sequencing.NativeSequence;
 
public class IdentCurrentSequence extends NativeSequence {
 
 public IdentCurrentSequence() {
 super();
 }
 
 // ... all other constructors
 
 @Override
 public ValueReadQuery getSelectQuery() {
 String query = "SELECT IDENT_CURRENT('#tablename#')";
 query = query.replaceFirst("(#tablename#)", this.getName().substring(9));
 return new ValueReadQuery(query);
 }
}

To declare the new sequences (one for each table), I use a separate SessionCustomizer class.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package de.ibs.persistence.sequencing;
 
import org.eclipse.persistence.config.SessionCustomizer;
import org.eclipse.persistence.sessions.Session;
 
public class IdentCurrentSessionCustomizer implements SessionCustomizer {
 
 public void customize(Session session) throws Exception {
 String[] identCurrentSequences = {
 "CUST_SEQ_tdtaLagerTransfer",
 "CUST_SEQ_trelServiceArtikel"
 };
 
 for (int i = 0; i<identCurrentSequences.length; i++) {
 IdentCurrentSequence sequence = new IdentCurrentSequence(identCurrentSequences[i]);
 session.getLogin().addSequence(sequence);
 }
 }
}

This IdentCurrentSessionCustomizer has to be published to the persistence unit so that it can be used.

properties.put(PersistenceUnitProperties.SESSION_CUSTOMIZER, "de.ibs.persistence.sequencing.IdentCurrentSessionCustomizer");

or in XML:

<property name="eclipselink.session.customizer" value="de.ibs.persistence.sequencing.IdentCurrentSessionCustomizer"/>

To use the sequences, add following to your entities:

1
2
3
4
5
6
7
8
9
10
@Entity
@Table(name = "tdtaLagerTransfer")
@SequenceGenerator(name="CUST_SEQ_tdtaLagerTransfer", sequenceName="CUST_SEQ_tdtaLagerTransfer")
public class LagerTransfer extends ExtendedModel implements Serializable {
 @Id
 @GeneratedValue(generator="CUST_SEQ_tdtaLagerTransfer")
 private Integer idLagerTransfer;
 
 // ... other fields and methods
}

See also:
http://wiki.eclipse.org/EclipseLink/Examples/JPA/CustomSequencing

Certainly you can implement this more clean that I did it when you understand the problem we’re facing here.

I would be delighted to hear some feedback from you.

Servervirtualisierung mit openSuse11.1 und XEN

In diesen zwei Artikeln wird beschrieben, wie man eine kostenlose Servervirtualisierung mit openSuse11.1 installiert und einrichtet.

Diese Lösung wurde auf einem ASUS Maiboard getestet (DSEB-DG) und dort traten Probleme auf, weswegen wir uns für SELS10 SP2 entschieden haben. Dieses System läuft problemlos und die vorhandene Beschreibung ist auf SELS10 anwendbar.

Die Fehler traten (meiner Meinung nach) nur wegen dieser besonderen Kombination von openSuse 11.1, diesem Raid-System und diesem Mainboard auf.

Servervirtualisierung mit XEN

Erstellung und Einrichtung eines vHosts mit XEN

MySQL root Passwort vergessen

Kann jedem mal passieren… Hier eine Anleitung für Windows-Server:

1. mysql-Dienst stoppen
service mysql stop

2. Wenn MySQL down ist, MySQL wie folgt starten

mysqld-nt --skip-grant-tables

ACHTUNG: Hierbei werden die Zugriffsrechte umgangen, so dass ALLE Benutzer VOLLEN Zugriff auf ALLE Tabellen erhalten!

3. Jetzt kann man sich als root ohne Passwort einloggen

mysql -uroot mysql

4. Im MySQL command line prompt folgende Kommandos eingeben

UPDATE user SET password=PASSWORD("newpw") WHERE user="root";
FLUSH PRIVILEGES;

5. Hierbei wird das root Passwort auf “newpw” gesetzt, mit dem man sich dann einloggen kann

mysql -uroot -pnewpw mysql

6. Nicht vergessen, MySQL-Dienst zu stoppen und wieder im normalen Modus zu starten!

Linux – Zeichenkette in Dateiinhalt suchen

Linux-Befehl, um eine Zeichenkette in Dateiinhalten (Verwendung von Wildcards im Dateinamen) im aktuellen und allen Unterverzeichnissen zu suchen:

find . -name “*.html” -exec grep -Hn “searchstring” {} \; > result.txt

Bildschirmauflösung Ubuntu 8.04+

Problem:
Nach der Installation von Ubuntu 8.04+ steht lediglich eine maximale Bildschirmauflösung von 800×600 Pixel zur Verfügung.

Lösung:
Ubuntu 7.10 von CD starten und die Datei /etc/X11/xorg.conf z.B. auf USB-Stick kopieren. Neu booten und die Datei /etc/X11/xorg.conf durch die alte Version vom USB-Stick ersetzen.

JDBC Verbindung mit MSSQL Server 2005 Express

Problem
Bei dem Versuch eine JDBC mit dem SQL Server 2005 Express aufzubauen erhielt ich folgende Exception:
com.microsoft.sqlserver.jdbc.SQLServerException: Es konnte keine TCP/IP-Verbindung mit dem Host hergestellt werden. java.net.ConnectException: Connection refused: connect

Grund
Bei der Express-Version des SQL Server 2005 sind die Protokolle TCP/IP und Named Pipes standardmäßig deaktiviert.

Lösung

  1. Öffnen Sie den SQL Server-Konfigurations-Manager (unter Konfigurationstools; nicht das SQL Server Management Studio Express)
  2. Gehen Sie zu Netzwerkkonfiguration -> Protokolle für SQLEXPRESS
  3. Aktivieren Sie Named Pipes
  4. Aktivieren Sie TCP/IP
  5. Öffnen Sie den Reiter IP-Adressen in TCP/IP
  6. Aktivieren Sie die Schnittstellen, die Sie öffnen möchten und stellen Sie einen TCP-Port ein
  7. Zuletzt müssen Sie noch den Dienst SQL Server (SQLEXPRESS)
  8. neu starten

buy abilify
buy accupril
buy accutane
buy aceon
buy aciphex
buy acomplia
buy acompliex
buy acticin
buy actonel
buy actoplus met
buy actos
buy acyclovir
buy adalat
buy advair diskus
buy alavert
buy albendazole
buy aldactone
buy alesse
buy aleve
buy allegra
buy allopurinol
buy altace
buy amantadine
buy amaryl
buy amitriptyline
buy amoxil
buy ampicillin
buy anacin
buy anafranil
buy antabuse
buy antivert
buy arava
buy aricept
buy arimidex
buy aristocort
buy artane
buy aspirin
buy astelin
buy atacand
buy atarax
buy atrovent
buy augmentin
buy avalide
buy avandamet
buy avandia
buy avapro
buy avodart
buy aygestin
buy ayurslim
buy azulfidine
buy baclofen
buy bactrim
buy bactroban
buy beconase aq
buy benadryl
buy benemid
buy benicar
buy bentyl
buy betapace
buy betnovate
buy biaxin
buy bupropion
buy buspar
buy bystolic
buy cafergot
buy calan
buy capoten
buy carafate
buy cardizem
buy cardura
buy carisoprodol
buy casodex
buy cefadroxil
buy cefixime
buy ceftin
buy celebrex
buy celexa
buy cephalexin
buy chloromycetin
buy cialis
buy cialis jelly
buy cialis professional
buy cialis soft tabs
buy cialis super active
buy cipro
buy citalopram
buy clarinex
buy claritin
buy cleocin
buy clomid
buy clozaril
buy colace
buy colchicine
buy combivent
buy compazine
buy copegus
buy cordarone
buy coreg
buy coumadin
buy cozaar
buy crestor
buy cyklokapron
buy cymbalta
buy cystone
buy cytotec
buy cytoxan
buy danazol
buy decadron
buy deltasone
buy depakote
buy desyrel
buy detrol
buy diamox
buy diclofenac
buy diclofenac gel
buy didronel
buy differin
buy diflucan
buy digoxin
buy diovan
buy dipyridamole
buy ditropan
buy docusate
buy dostinex
buy doxazosin
buy doxycycline
buy dramamine
buy duetact
buy dulcolax
buy effexor
buy elavil
buy elimite
buy emsam
buy endep
buy entocort
buy erythromycin
buy estrace
buy ethionamide
buy etodolac
buy eulexin
buy evista
buy exelon
buy famvir
buy feldene
buy female viagra
buy femara
buy femcare
buy flagyl er
buy flomax
buy flonase
buy florinef
buy flovent
buy floxin
buy fluoxetine
buy fosamax
buy geodon
buy glucophage
buy glucotrol xl
buy glycemil
buy glyset
buy grifulvin v
buy haldol
buy herbal phentermine
buy herbal soma
buy herbal testosterone
buy hoodia
buy hydrea
buy hytrin
buy hyzaar
buy imdur
buy imitrex
buy imodium
buy imuran
buy inderal
buy indinavir
buy indocin
buy innopran xl
buy ismo
buy isoniazid
buy isoptin
buy januvia
buy kamagra
buy keftab
buy keppra
buy kytril
buy lamictal
buy lamisil
buy lanoxin
buy lariam
buy lasix
buy leukeran
buy levaquin
buy levitra plus
buy levitra professional
buy levlen
buy levothroid
buy lexapro
buy lioresal
buy lipitor
buy lipothin
buy lipotrexate
buy lisinopril
buy lopid
buy lopressor
buy lotensin
buy lotrisone
buy lozol
buy luvox
buy lynoral
buy maxalt
buy meclizine
buy medrol
buy mentax
buy mestinon
buy metformin
buy methotrexate
buy methyldopa
buy metoclopramide
buy mevacor
buy mexitil
buy micardis
buy microlean
buy midamor
buy minocin
buy minocycline
buy mircette
buy mobic
buy monoket
buy motilium
buy motrin
buy myambutol
buy mysoline
buy naprosyn
buy neurontin
buy nexium
buy nimotop
buy nirdosh
buy nitrofurantoin
buy nitroglycerin
buy nizoral
buy nolvadex
buy noroxin
buy norpace cr
buy norvasc
buy omnicef
buy orlistat
buy oxytrol
buy pamelor
buy parlodel
buy paroxetine
buy paxil
buy penis growth pills
buy pepcid
buy periactin
buy phenergan
buy phentrimine
buy plavix
buy plendil
buy pletal
buy ponstel
buy prandin
buy pravachol
buy prazosin
buy precose
buy prednisolone
buy prednisone
buy premarin
buy prevacid
buy prilosec
buy prinivil
buy probalan
buy procardia
buy prograf
buy prometrium
buy propecia
buy propranolol
buy proscar
buy protonix
buy proventil
buy provera
buy prozac
buy pulmicort
buy purinethol
buy pyridium
buy ranitidine
buy reglan
buy relafen
buy remeron
buy reminyl
buy revatio
buy revia
buy rhinocort
buy rimonabant
buy risperdal
buy robaxin
buy rocaltrol
buy roxithromycin
buy sarafem
buy serevent
buy serophene
buy seroquel
buy sinemet
buy sinequan
buy singulair
buy skelaxin
buy slimpulse
buy soma
buy starlix
buy strattera
buy stromectol
buy sumycin
buy sustiva
buy synaral
buy synthroid
buy tagamet
buy tegretol
buy tenormin
buy terramycin
buy tetracycline
buy tofranil
buy topamax
buy toprol xl
buy toradol
buy torsemide
buy tramaden
buy tramadol
buy trandate
buy trazodone
buy trental
buy triamterene
buy tricor
buy trileptal
buy trimox
buy ultracet
buy ultram
buy urispas
buy uroxatral
buy valtrex
buy vantin
buy vasodilan
buy vasotec
buy ventolin
buy vermox
buy viagra
buy viagra jelly
buy viagra plus
buy viagra professional
buy viagra soft tabs
buy viagra super active
buy viramune
buy voltaren
buy vpxl
buy vytorin
buy wellbutrin sr
buy xeloda
buy xenical
buy yasmin
buy zanaflex
buy zantac
buy zebeta
buy zelnorm
buy zerit
buy zestoretic
buy zestril
buy zetia
buy zimulti
buy zithromax
buy zocor
buy zofran
buy zoloft
buy zovirax
buy zyban
buy zyloprim
buy zyprexa
buy zyrtec
buy zyvox

Nutzen eines JBoss in einem anderen Netzwerk

Sie möchten einen JBoss in einem anderen Netzwerk nutzen.
z.B. zum debuggen aus der Entwicklungsumgebung heraus.
Bekommen aber immer eine Fehlermeldung, dass getInitialContext nicht funktioniert!
Lösung: Der volle Hostname des entfernten JBoss muss Ihrem Rechner bekannt sein.
Kann beispielsweise in der Datei C:\Windows\System32\drivers\etc\hosts eingetragen werden, in der Form 10.10.10.2 test.test.local test ( [].

Bei getInitialContext(”jnp://10.10.10.2:1099″) wird vom Zielhost 10.10.10.2 der FullQualifiedHostname zurück geliefert, der für die weitere Benutzung Ihrem Rechner bekannt sein muss.