Opening a New Window From a Web Page with Javascript that is SEO Friendly

The days of <a href=”#” target=”_blank”></a> are long gone. The way to open a new window with a link is to do it using the javascript window.open() method via an onclick callback.

However, you still want to make your pages SEO friendly, so you don’t want to go about generating links with href=”#”. The way to do it is as follows:

Javascript:

<script>

function openNewWindow(url) {

   window.open(url);

}

</script>

HTML:

<a href=”someURL.html” onclick=”openNewWindow(‘someUrl.html’);return false;”>Link</a>

When implementing links this way, → Continue reading “Opening a New Window From a Web Page with Javascript that is SEO Friendly”

Using bash Shell to Rename Files With Spaces

The following is a shell command that you can use to rename any file that contains spaces. Without the quotes surrounding the $file reference and the echo command it will fail.

In this example, we rename anything that is .htm to .html

for file in *.htm ; do mv “$file” “`echo “$file” | sed ‘s/\(.*\.\)htm/\1html/’`” ; doneContinue reading “Using bash Shell to Rename Files With Spaces”

java.lang.reflect.UndeclaredThrowableException When Attempting to Invoke a Remote Method on an EJB Singleton Instance

I am building an EJB Singleton that generates and maintains data that I want accessible to multple clients. Since the data is not based on any client interaction but based on the status of a single server-side application I went with an EJB Singleton.

When attempting to invoke a method via the Remote interface on the bean instance from a servlet in a separate .war which was returning a LinkedList of a custom Object that I wrote, I was getting → Continue reading “java.lang.reflect.UndeclaredThrowableException When Attempting to Invoke a Remote Method on an EJB Singleton Instance”

Updating the URL of a Subversion Repository in a Currently Checked Out Copy of Your Repository

Let’s say you have a server who’s IP address or domain name changes on which you have a Subversion repository. Furthermore, you have checked out the copy over an ssh connection using svn+ssh.

If you have checked-out copies of your repo, and the path to the repo on the file system hasn’t changed, but only the IP or domain name has changed you need to issue the following command in the root of your checked out copy:

svn switch –relocate Continue reading “Updating the URL of a Subversion Repository in a Currently Checked Out Copy of Your Repository”

Setting the Screen Resolution of a Linux Guest in VMWare vSphere Client

I am currently working with virtual machines via Vmware vSphere on a Windows 2008 server. Initially I was unable to get the guest to render full screen and did not have all of the screen resolutions that I would have thought I should. What I was trying to do was have the guest Linux (in this case RedHat Enterprise Linux 6) run full-screen. It was not as straight forward as setting the screen resolution in the VM guest settings dialog.→ Continue reading “Setting the Screen Resolution of a Linux Guest in VMWare vSphere Client”

Import javax.ejb cannot be resolved Error in Eclipse Helios

If you have installed the latest and greatest JBossAS tools into eclipse, try using the following version instead:

?2.2.0.v20110216-175

It seems as though there are some problems with the latest and greatest that causes compilation problems. → Continue reading “Import javax.ejb cannot be resolved Error in Eclipse Helios”

Accessing an EJB 3.1 Singleton Bean with @Startup from a Servlet in the Same JVM Instance

I am building a project whereby I have a Singleton Bean that I want to fire up when the .jar is deployed in the EJB container, thus I have it annotated as follows:

package com.ryanchapin.ejbTest

@Startup
@Singleton

public class SingletonTest{}

Of course, I have the requisite Local and Remote interfaces set, up, I’ve just left that off for brevity. I am attempting to do a JNDI lookup, from a Servlet in the same JVM using the Local interface which results → Continue reading “Accessing an EJB 3.1 Singleton Bean with @Startup from a Servlet in the Same JVM Instance”

Disabling JavaScript Validation in Eclipse Helios 3.6.1

The Helios JavaScript validator does not seem to like the jquery-1.5.min.js (or for that matter a number of other know good js libraries). As a result Eclipse complains a lot when building a project.

The quick fix that I found was to disable JavaScript validation under the Builder preferences, for your project:

Project/Properties/Builders

Simply, uncheck the “JavaScript Validator” and you should be all set.→ Continue reading “Disabling JavaScript Validation in Eclipse Helios 3.6.1”

Simple Network Speed Command Line Test for Linux

Let’s say that all that you have access to is the command line on a Linux box and you want to know what the network throughput is. If you have another Linux box you can use netcat to do a quick test:

On box a:? Set up netcat to listen to a given port:

nc -l 12345 > /dev/null

Fire up netcat to listen on port 12345 and to dump the output to /dev/null.

On box b:? Send data via → Continue reading “Simple Network Speed Command Line Test for Linux”