Archive for the ‘en-US’ Category
Java 7 diamonds
Tiger (Java 5) introduced new syntax, among which generics are the most used. Mustang (Java 6) did not offer anything new. Dolphin (Java 7) will introduce a new scheme, the “diamond syntax”. We deal of diamond because of the look of theses characters: “<>
”
To sum up quickly, in Java 5 we have to write:
[java]
List<Integer> myList = new ArrayList<Integer>()
Map<String, List<Double>> myMap = new Hashmap<String, List<Double>>();[/java]
On last Dolphin development releases, we can simply write:
[java]
Lis<Integer> myList = new ArrayList<>()
Map<String, List<Double>> myMap = new Hashmap<>();[/java]
There’s nothing revolutionary, but developpers will save a little more time ;-).
Copy recursively a folder in MS-DOS
Abstract: we need copy all Java files in a folder and its subdirectories.
Solution:
xcopy C:\<source folder>\*.java C:\<destination folder>\
weblogic.management.ManagementException: Unable to obtain lock
Exception:
weblogic.management.ManagementException: Unable to obtain lock on /$HOME/.../myDomain/tmp/myServer.lok. Server may already be running at weblogic.management.internal.ServerLocks.getServerLock(ServerLocks.java:159) at weblogic.management.internal.ServerLocks.getServerLock(ServerLocks.java:58) at weblogic.management.internal.DomainDirectoryService.start(DomainDirectoryService.java:75) at weblogic.t3.srvr.ServerServicesManager.startService(ServerServicesManager.java:374) at weblogic.t3.srvr.ServerServicesManager.startInStandbyState(ServerServicesManager.java:125) at weblogic.t3.srvr.T3Srvr.initializeStandby(T3Srvr.java:630) at weblogic.t3.srvr.T3Srvr.startup(T3Srvr.java:402) at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:361) at weblogic.Server.main(Server.java:67)
Fix:
- If possible, ensure you have admin rights
- else:
- delete
/$HOME/.../myDomain/cache
- delete
/$HOME/.../myDomain/data/ldap/ldapfiles/*.lok
- delete
/$HOME/.../myDomain/data/stores/diagnostics/*
- delete
/$HOME/.../myDomain/data/stores/default/*
- delete
/$HOME/.../myDomain/tmp/*.lok
- delete
How to launch a single Unit Test with Maven 2?
Use this:
mvn -Dtest=MyPersonnalUnitTest test
(unlike with Maven 1, you do not need specify the complete package name!)
Automatic update with TortoiseSVN
On my current position, I had to update my project with Subversion every morning. It took half an hour every day ; some other guys prefered to update only once a week or twice a month… But they accepted to spend half a day for merges etc.
Yet, I found a way to make this update automatically, thanks to a planned task in Windows XP.
The command that is launched is
"C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe" /command:update /path:"C:\the\path\of\my\project" /notempfile /closeonend
Thanks to another planned task, I rebuild the complete project with Maven. And on breakfast I find my project up-to-date with all jars compiled and available.
Comment supprimer tous les accents, cedilles, etc. d’un texte en francais sous Unix?
Il suffit de lancer la commande suivante, en passant eventuellement en parametre le fichier source (sinon c’est l’entree standard qui sera utilisee):
tr "àçéèêëîïôöùüÂÇÉÈÊËÎÏÔÖÙÜ" "aceeeeiioouuACEEEEIIOOUU"
How to replace all lower case with upper case in Unix?
Use one of the three following commands:
tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
tr a-z A-Z
tr '[:lower:]' '[:upper:]'
Remove duplicated lines from a file
Abstract: you have to remove duplicate lines in one file. For instance, you have a file:
foo1
foo2
foo2
Solution: use this command:
uniq myFile.txt
You’ll get:
foo1
foo2
uniq myFile.txt |
Sort the content of a file
Case: you have to sort the content of a file in Unix.
Solution
sort -d sourceFile > destinationFile