Apparently, it’s out there. go check it out. I will as soon as I get a moment. Still working from netbeans mostly, but using Kate more and more.
L.
Map<String,String> map = new HashMap<String,String>();
for (Entry<String,String> entry : map.entrySet()){
String key = entry.getKey();
String value= entry.getValue();
}
I get annoyed having to import apache commons everytime I want to do a simple join when all I need is a simeple method that does this:
private String join(String[] array, String separator){
StringBuilder toReturn=new StringBuilder("");
for (String element : array) {
if (!"".equals(toReturn.toString())){
toReturn.append(separator);
}
toReturn.append(element);
}
return toReturn.toString();
}
Here’s a quick example on how to do a regular expression matching in scala for a DCR
scala> val regexString="templatedata/category/type/data/(.*?)/(.*)"
regexString: java.lang.String = templatedata/category/type/data/(.*?)/(.*)
scala> val regex=regexString.r
regex: scala.util.matching.Regex = templatedata/category/type/data/(.*?)/(.*)
scala> val regex(language,file)=”templatedata/category/type/data/en_gb/mydcr”
language: String = en_gb
file: String = mydcr
scala> println(language)
en_gb
scala> println(file)
mydcr
If the file does not match the pattern, this happens:
scala> val regex(language,file)=”templatedata/category/type/data/en_gb”
scala.MatchError: templatedata/category/type/data/en_gb (of class java.lang.String)
at .<init>(<console>:11)
at .<clinit>(<console>)
at .<init>(<console>:11)
at .<clinit>(<console>)
at $print(<console>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.call(IMain.scala:704)
at scala.tools.nsc.interpreter.IMain$Request$$anonfun$14.apply(IMain.scala:920)
at scala.tools.nsc.interpreter.Line$$anonfun$1.apply$mcV$sp(Line.scala:43)
at scala.tools.nsc.io.package$$anon$2.run(package.scala:25)
at java.lang.Thread.run(Thread.java:679)
In order to avoid the exception, a quick check that it does match is in order:
scala> “templatedata/category/type/data/en_gb”.matches(regex.pattern.toString)
res4: Boolean = false
scala> “templatedata/category/type/data/en_gb/mydcr”.matches(regex.pattern.toString)
res5: Boolean = true
If you have problems installing TeamSite with an error that the Common Services package cannot be found, the iwpkg file may be corrupted (as in something not quite right happened during the download).
Autonomy provide a md5sum file containing the md5 signature of the file. All that we need to do is re-calculate the checksum of the local file and compare it with the one provided by Autonomy.
On windows, this article explains how to do this: http://support.microsoft.com/kb/841290
“C:\Program Files\md5check\fciv.exe” ”IWOVTeamSite-Windows-7.1.0.iwpkg”
> // File Checksum Integrity Verifier version 2.05.
> //
> 03a5f24c8de61c12ea78b5a87fcb20e3 iwovteamsite-windows-7.1.0.iwpkg
This does not match the content of the file supplied below.
337b46566de732425c81b0f16a2add4f patch_pkgs/RQA-Build1427-IWOVTeamSite-Windows-7.1.0-P10694.iwpkg
On linux, we have the md5sum command which takes a file name as a parameter.
md5sum IWOVTeamSite-Linux-7.1.0.iwpkg
If the md5 hashes do not match, you have to re-transfer the file because the installer won’t be able to do anything with it.