Author: ozzy
last month data usage 226 gb
eclipse being eclipse
since 2006 I am using eclipse on and off, I am using intellij more in work but I dont have license for home so I decided to check eclipse back. I am trying to write some aspectj and installed the editor to latest eclipse and exception is
“AJCompilationUnit tried to access private field org.eclipse.jdt.internal.core.JavaElement.parent (org.eclipse.ajdt.core.javaelements.AJCompilationUnit is in unnamed module of loader “
decided to get latest from https://github.com/eclipse/org.aspectj/blob/master/docs/developer/IDE.md#eclipse
and finally aj editor works
oci provides free oracle database
FFar more better then installing oracle in your local 🙂
trying to run oracle driver with h2
getting error below,
Driver oracle.jdbc.OracleDriver claims to not accept jdbcUrl, jdbc:h2:mem:testdb;Mode=Oracle
minikube dashboard
bash
below how the dashboard looks
minikube how to see service url “minikube service app-version-checker –url”
finding an electrician is hard in glasgow
took me 1 month to find a decent electrician in Glasgow and this morning they came 3 guys 🙂 I had only 3 light switches problem, I think one guy was like trainer and other 2 were interns 🙂 anyway they worked 20 minutes and find out my problem is about old fueses. I did not know I have new fuses for heaters and old fuses for other appliences.
anyway he wired the old fuse and switches started working. now waiting for bill. he said next week they can replace this old box and do the ICR test. probably that will take 600. and today bill I am expecting 80. being a electrician in glasgow is very good job, they are hard to find.
graalvm run js from node
first install all requirements
gu install nodejs
gu install native-image
gu rebuild-images libpolyglot
then run
node –native –polyglot -e ‘var array = Polyglot.eval(“ruby”, “[1,2,42,4]”); console.log(array[2]);’
https://www.graalvm.org/22.2/reference-manual/js/NodeJS/
linux mint install snapcraft
sudo snap install snapcraft
regular apt source did not work.
reorder an int as big as possible
I found https://www.codewars.com/ and solving a algorithm question, reorder given number as big as possible, example given 123, ordered biggest version is 321, so we just need to order digits separately and concatenate them, I wrote 2 approaches
public void testStreamCode() {
int num = 123;
AtomicReference<String> str = new AtomicReference<>();
String.valueOf(num).chars().boxed().sorted(Collections.reverseOrder()).forEach(c -> str.updateAndGet(v -> v + (c - 48)));
int parseInt = Integer.parseInt(str.get().replaceAll("null", ""));
assert parseInt == 321;
}
public void testArraysSortCode() {
int num = 7657585;
char[] c = String.valueOf(num).toCharArray();
Arrays.sort(c);
String s = "";
for (int i = c.length - 1; i >= 0; i--)
s += c[i];
Integer integer = Integer.valueOf(s);
assert integer == 8776555;
}
then CW gave another solution
public void cw() {
int num = 7657585;
int i1 = Integer.parseInt(String.valueOf(num)
.chars()
.mapToObj(i -> String.valueOf(Character.getNumericValue(i)))
.sorted(Comparator.reverseOrder())
.collect(Collectors.joining()));
assert i1 == 8776555;
}
I know java stream api looks cool and I decided to benchmark this. here is the result
Benchmark Mode Cnt Score Error Units
DemoApplicationTests.cw avgt 2 0.808 us/op
DemoApplicationTests.testArraysSortCode avgt 2 0.194 us/op
DemoApplicationTests.testStreamCode avgt 2 0.884 us/op
fastest is using arrays.sort(0.194) second is CW and last one is "testStreamCode".