Site Sponsors:
Downgrading Java on Ubuntu 16.x 
Just a quick note to let everyone know that - after installing LTS 16.04 (so far a very pleasant & stable release - recommended!) that I discovered that the default JDK ("9 internal") does not work.

java -version
openjdk version "9-internal"

--The failures are so bad, that the kernel actually dumps core!



(Forgive the imp, yet note the bug -Halloween is around the corner!)

Sadly, removing the "9 internal" by conventional means results in only a partial removal... very nasty. What will work however, is to remove everything via a hand-grenade:

sudo apt remove --purge "^openjdk.*"

Followed by a dependency purge:
sudo apt-get autoremove

Then re-install a version that actually works:
sudo apt-get install openjdk-8-jre

Ultimately, once we have what we need installed, don't forget to associate that new JRE by right-clicking on a .jar file, so as to:



In addition to those old 'ol reliable versions of Oracle (I like to test under many JVM's), here is the OpenJDK that worked for me on LTS 16.04.1:
openjdk version "1.8.0_91"
OpenJDK Runtime Environment (build 1.8.0_91-8u91-b14-3ubuntu1~16.04.1-b14)
OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode)


Sharing is caring!


-Rn


[ view entry ] ( 641 views )   |  permalink
Helicopter Attack 
It was Pope Innocent the 3rd who first noted that a little knowledge is a dangerous thing.

Whilst we can be confident that he was not talking about the Internet at the time (he lived in the 18th century ;), for the record I just wanted to let those whom might find that their site is being hijacked know about the quick fix.

Not Found

The requested URL /dom_s9k/helicopter-attack.php was not found on this server.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
Apache Server at soft9000.com Port 80

Hacked as it was by obvious & rank noobs (i.e. they were unable to do anything else to my server and their date + time stamp allowed me to pinpoint their IP Address), by way of a mindless diversion this day I noted that Google Analytics had been telling me that allot of my pages were presently being 404'ed.

After looking at my .htaccess, I noted that the date was no where near when I had last messed with it's content. Indeed, since I had recently deleted the same for similar demonstrative reasons, I decided to blow the silly thing away, then re-add a new, access-constrained, .htaccess file in it's stead.


(original quote was in Latin - might have gotten it wrong ;)


So for the 'butinski who thought that it was being smart, please allow me to thank you for the opportunity to add yet another helpful blog entry to my site. Providing us with such fatuous & puerile diversions from time to time not only helps keep the day a little more interesting, but also allows us to make the Internet a better place for everyone else.


Cheers!

-Rn




[ view entry ] ( 599 views )   |  permalink
Fiark: Unicode & Valid File / Folder Names 
Sitting down to update Fiark this weekend, once again I came across the notion of detecting invalid directory & filenames. With a heavy sigh, I realize the advent of Unicode meant that there would be far, far more to check for than the usual "{}", "]", "/", "\", "&", "*" and others from our ASCII / UTF8 past.

If you have run across a similar problem, then you probably need no further explanation of the problem domain. Submitted for your fair use enjoyment therefore, here is what will be coming soon to a Fiark near you:


package com.soft9000.file;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

/**
*
* @author profnagy
*/
public class LiveNodeName {

private String nodePathName = "";
private boolean isDirectory = false;

public LiveNodeName() {

}

public LiveNodeName(String nodePathName, boolean isDirectory) {
this.nodePathName = nodePathName;
this.isDirectory = isDirectory;

}

public String getName() {
return this.nodePathName;
}

public boolean isDirectory() {
return this.isDirectory;
}

public boolean isNull() {
return nodePathName.isEmpty();
}

public void asNull() {
this.nodePathName = "";
}

public static List<LiveNodeName> GetNodes(final LiveNodeName ref) {
String zName = ref.getName();
if (com.soft9000.Text.Contains(zName, "\\".getBytes())) {
zName = com.soft9000.Text.ReplaceAll(zName, "\\", "/"); // No RE's
}
while (zName.startsWith(".")) {
zName = zName.substring(1);
}
while (zName.startsWith("/")) {
zName = zName.substring(1);
}
String[] array = com.soft9000.Text.Split(zName, '/');
List<LiveNodeName> results = new ArrayList<LiveNodeName>();
for (String leaf : array) {
results.add(new LiveNodeName(leaf, true));
}
if (results.size() > 0 && ref.isDirectory == false) {
results.get(results.size() - 1).isDirectory = false;
}
return results;
}

/**
* With the advent of Unicode, the range of valid / invalid file names has
* become truly infinite! Rather than crafting a plethora of OS-centric RE
* tests, surely the best strategy is to simply let the operating system
* itself tell us the final score?
*
* @param ref a LiveNodeName
* @return True if the node can be hosted on this O.S!
*/
public static boolean CanCreate(final LiveNodeName nodei) {
if (nodei == null || nodei.isNull()) {
return false;
}
List<LiveNodeName> array = LiveNodeName.GetNodes(nodei);
try {
for (LiveNodeName oneSeg : array) {
if (oneSeg.isNull()) {
return false;
}
if (oneSeg.isDirectory) {
Directory dir = new Directory(oneSeg.getName());
if (dir.exists()) {
return true;
}
if (dir.mkdir() == true) {
return dir.delete();
}
} else {
File file = new File(oneSeg.nodePathName);
if (file.exists()) {
return true;
}
File pFile = file.getParentFile();
if (pFile == null) {
if (file.createNewFile() == true) {
file.delete();
return true;
}
}
boolean bShoulRemove = false;
Directory dir = new Directory(pFile);
if (dir.exists() == false) {
if (dir.mkdir() == false) {
return false;
}
bShoulRemove = true;
}
if (file.createNewFile() == true) {
if (file.delete() == false) {
return false;
}
if (bShoulRemove) {
return dir.delete();
} else {
return true;
}
}
}
}
} catch (Exception ex) {
}

return false;
}

/**
* Check a list of LiveNodeName, assigning any error-nodes to the result
* list.
*
* @param input List for LiveNodeName to test.
* @param results List of invalid LiveNodeName (rejects.)
* @return True of all NodeNames are okay - false if there were rejects.
*/
public static boolean CanCreate(final List<LiveNodeName> input, List<LiveNodeName> results) {
boolean br = true;
for (LiveNodeName ref : input) {
if (CanCreate(ref) == false) {
results.add(ref);
br = false;
}
}
return br;
}

/**
* For my problem domain (ONLY :)
* @param foo
*/
public static void main(String... foo) {
LiveNodeName node = new LiveNodeName("/foo/bar", true);
if (CanCreate(node) == false) {
System.out.println("Error 1000001!");
}
node = new LiveNodeName("foo", true);
if (CanCreate(node) == false) {
System.out.println("Error 1000002!");
}
node = new LiveNodeName("foo", false);
if (CanCreate(node) == false) {
System.out.println("Error 1000003!");
}
node = new LiveNodeName("/foo/bar.txt", false);
if (CanCreate(node) == false) {
System.out.println("Error 1000004!");
}
node = new LiveNodeName("/foo/\\bar.txt", false);
if (CanCreate(node) == false) {
System.out.println("Error 1000005!");
}
}
}


Enjoy the journey!

-Randall


[ view entry ] ( 537 views )   |  permalink  |  related link

<<First <Back | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Next> Last>>