Categories
Java linux

Java Scripting on JDK 11

JDK 11 make java command can directly run source code like other scripting language or interpreter. Lets say we have a java source file called hello.java as follow.

public class Hello {
 
  public static void main(String[] args) {
    System.out.println(“Hello World!”);
  }
 
}
 
Run the file by executing :
java hello.java
 
It works!
 
 
 
End.
Categories
Java OpenBSD

Netbeans 12 on OpenBSD 6.7

I have some disappointment on netbeans 11, because plugin activation problems i face. Netbeans 12 i feel different, no errors on plugin activation. Beginning my trials for Netbeans 12 LTS (yes its a long term support version), i downloaded a platform independent zip file and extract it on my home folder. I saw on the website that older version no longer supported, including Netbeans 11 ???

This trials run on OpenBSD 6.7 laptop. Open terminal and cd to netbeans12/bin. Execute ./netbeans& [enter]. The Netbeans 12 run with JDK 8 just fine (oldest JDK version supported by Netbeans 12). First time first , activate all installed plugin to see if any errors happen. No errors, its good down the road. Right away Netbeans 12 do a task of downloading repository, hmmm. This downloading stuff is new and it takes long time to complete, i leave it over night, maybe just my slow old laptop cant handle it :). So far its a positive experience and i will say its a good job to the developers.

Categories
tcl

Tcl catch command

Catch command used to execute a script and handle if any error happen. Catch command will return 0 on success and 1 on error. Catch command will give error message to a variable. 

For examples we will execute expr command to raise divide by zero error to examine what a catch command will do.

Here we can see on error catch will return 1 and error message variable will be filled.

We can also use catch to simply ignore error on executed script !

Categories
editor

Emacs : accessing menu bar

Lately im struggling to find how we can access emacs menu bar. Its visible on top of screen but i cant do anything on it. The menu bar can not be clicked by mouse (im installing no x emacs anyway and open it on mate terminal). Alt key will access mate terminal menu bar … hmm so i cant use alt key. Later i tried Esc key and its work. Press Esc then release, then press ` (backtick, key below Esc) and voila prompt will show on the bottom screen. We can browse using arrow key or page up to go to page containing menu link above the prompt. Press enter to execute selected menu or link. Its better not to memorize Emacs key binding and use menu, isnt it ?

Categories
wisdom

Zawinski’s Law

Every program attempts to expand until it can read mail. Those programs which cannot so expand are replaced by ones which can.” Coined by Jamie Zawinski (who called it the “Law of Software Envelopment”) to express his belief that all truly useful programs experience pressure to evolve into toolkits and application platforms (the mailer thing, he says, is just a side effect of that). It is commonly cited, though with widely varying degrees of accuracy.

 

source:

http://www.catb.org/jargon/html/Z/Zawinskis-Law.html

Categories
tcl Tk

2nd Update : My First Tcl/Tk Application

Tonight i just want to implement searching note by keyword, and its done. Download source code below.

notes_update2

May be this will be the final update for the application.

Execute it using wish not tclsh …

Categories
ubuntu

Ubuntu Server : Turn off Laptop LCD/Monitor

Lately im installing Ubuntu Server 18.04 on laptop and wondering how to turn off the LCD because as a server it need to be turned on for 24 hours but the screen we dont need it as we can ssh from another machine.

To do this we will need vbetool utility. Get it by running sudo apt-get install vbetool from terminal.

Command to turn off LCD : vbetool dpms off

Command to turn on LCD : vbetool dpms on

 

Categories
OpenBSD

HP Ink Tank Wireless 410 Printer on OpenBSD 6.7

Recently i have successfully printing a test page from my HP printer on my OpenBSD 6.7 laptop after reading and practicing an article on website of mp-5 text editor (see it on my other post). I use following step.

1. add required packages using pkg_add cups gtk+3-cups hpcups hplip.

2. edit /etc/rc.conf.local as follow on pkg_scripts section.

3. restart openbsd.

Categories
editor linux OpenBSD

Minimum Profit : A Programmer Text Editor

Minimum Profit is a text editor for programmer available to download from https://triptico.com/software/mp.html. I accidentally found this software from article related to OpenBSD and the author is the creator of this mp editor. The downloads are available in source and windows executable (Wow).

I managed to compile mp 5.38 on debian 10 using ncursesw driver which is already available on my laptop. Compilation step as follow.

Categories
OpenBSD

Upgrade OpenBSD 6.6 to 6.7

This is my first time upgrading OpenBSD. Usually i do full reinstall but it just too time wasting, so i tried these step.

  1. sysupgrade
  2. pkg_add -u

sysupgrade will update your OpenBSD by rebooting and download installation package from internet (i think). Then pkg_add -u will update all of installed program (take a long time). Its a successful upgrade. Thanks to OpenBSD developer who make it so seamless and work beautifully. Great work.