Category: Programming

Learning how to do raw logic programming

Learning how to do raw logic programming, convert the programming logic directly into logic gates. Found these two book in central library. The first one teach you everything you need to build up logic design. In undergrade year one, i remember uni was teaching us k-map and state diagram but without telling us why they are important and the use-case. I totally get messed and lost in space. Now I finally know how to use them. The verilog book  teach you how to convert programming looping into logic gates, but this book has too much text.

read count : 14

Netbeans in my 2017 MacBook Pro 15 keep CPU over 100% for nothing

Netbeans in my 2017 MacBook Pro 15 keep CPU over 100% for nothing, no task in progress window and the “slowness detection” has nothing, if using it without AC power, it eats up the battery very quick.

netbeans is not optimize for power
If netbeans detected it is running slowly, it will show a notification. But in this case, no notification at all !

read count : 8

[Solved] JRebel can’t reload jsp in netbeans of spring boot project

JRebel can’t reload jsp in netbeans of spring boot project, asked in jrebel forum but seems no one can answer. I finally found a way to fix it. Don’t execute the “spring-boot:run” goal, directly run your main class, this make jrebel able to reload jsp/css/class, just tested. No matter you put your static files in src/main/webapp or src/main/resources, it just works.

dont touch the jrebel.xml

read count : 36

netbeans api to read bookmark line numbers

Below code can read out bookmark line numbers for netbeans. For Java project, the bookmark line number are stored in nbproject/private/private.xml. If it is maven project, the private.xml is not exist but this code still work, there must be some place to store the bookmark info but I just don’t know. These code has a weak point, it won’t read the latest line numbers unless you close the project/netbeans.

			Project project = NetbeansUtil.getProject();
			AuxiliaryConfiguration config = ProjectUtils.getAuxiliaryConfiguration(project);
			org.w3c.dom.Element element = config.getConfigurationFragment("editor-bookmarks", "", false);
			ModuleLib.log("element=" + element);
			if (element != null) {
				NodeList list = element.getElementsByTagNameNS("", "bookmark");
				for (int x = 0; x < list.getLength(); x++) {
					org.w3c.dom.Element enEl = (org.w3c.dom.Element) list.item(x);
					String lineNo = enEl.getTextContent().trim();
					ModuleLib.log("line no=" + lineNo);

read count : 9

Netbeans plugins, able to compile and build != able to install in a clean netbeans

People reported my minimal plugins can’t install in their netbeans. I concluded these:

1) able to compile and build NOT EQUAL to able to install in a clean netbeans
2) able to install your plugin in your netbeans NOT EQUAL to able to install in a clean netbeans

When you meet this error : Project depends on packages not accessible at runtime

Just add the library to in pom

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="" xmlns:xsi="" xsi:schemaLocation="">
        <description>Display the code minimap, programmer can overlook their code.</description>

read count : 20

old netbeans api code to get each line

		int lastLineNo = -1;
		while (hq.moveNext()) {
			AttributeSet as = hq.getAttributes();
			if (as != null) {
				try {
					lineNo = NbDocument.findLineNumber((StyledDocument) document, hq.getStartOffset());
					if (lineNo != lastLineNo) {
						lastLineNo = lineNo;
						g.drawString(String.valueOf(lineNo + 1), 0, fontHeight * (lineNo + 1) - 3);
				} catch (Exception ex) {

read count : 16