Preserving File Permissions When Copying Files with Ant

If you want to retain the file permissions of a file that you copy with ant you must use the <exec> command instead of? <copy>.

So, instead of:

<copy file=”${source.file}” tofile=”${dest.path}/${dest.file}” overwrite=”true”/>

Use:

<exec executable=”cp”>
? <arg value=”-pf”/>
? <arg value=”${source.file}”/>
? <arg value=”${dest.path}/${dest.file}”/>
</exec>
Continue reading “Preserving File Permissions When Copying Files with Ant”

java.lang.OutOfMemoryError: unable to create new native thread Exception When Using SmbFileInputStream

I am writing an application that copies files from a Samba share using the JCIFC Java CIFS Client Library (which, btw, is a very helpful, widely used, and well developed project).

As usual I am under the gun to get something up and running so I do not have the luxury to explore all of the details as much as I would like. My application gets a directory listing of a Samba share and then spawns a new thread for → Continue reading “java.lang.OutOfMemoryError: unable to create new native thread Exception When Using SmbFileInputStream”

Adding a ShutdownHook to a Java Program to Enable Clean Exit on CTRL-C

Often times I will be building a Java program that will either be run from a command-line or as a system service.  In most cases, during development, I’ll be running it directly from the command-line and will want to kill it by pressing control c on the keyboard.

When I do that I want to make sure that my program cleanly exits, closing any open files, socket connections, database connects, or what have you.

To do so, you must invoke → Continue reading “Adding a ShutdownHook to a Java Program to Enable Clean Exit on CTRL-C”

Replacing Smart Quotes (<91> and <92>) in vi

Smart quotes will be displayed as <91> and <92> in vi. A number of other special characters will also be displayed in similar fashion <96>, etc. . . .

To replaced them use do the following:

  1. Type:? ‘:’ 1,%s/
  2. Then, since it is a special character, you can’t simply type ‘<91>’ or that string will not be matched, so:
  1. Press: CTRL and V
  2. Then type: [space] x [space] 91
  3. [Enter]
Continue reading “Replacing Smart Quotes (<91> and <92>) in vi”

Configuring CentOS to run SELinux in Strict Mode

I am in the process of setting up some CentOS/RHEL 6 servers to run SELinux in strict mode. What follows are notes, links to online resources and things that I am discovering along the way. Once I am finished I will go back and re-write it to follow more of a how-to/guide type format. In the meantime, it might seem a bit disjointed.

Links/Resources:

  • http://wiki.centos.org/HowTos/SELinux
  • http://fedoraproject.org/wiki/SELinux
  • http://www.centos.org/docs/5/html/Deployment_Guide-en-US/rhlcommon-chapter-0001.html
  • http://www.nsa.gov/research/selinux/index.shtml

MaintLog Notes:

  • Make sure that the selinux-policy-strict package (and deps) are installed:
Continue reading “Configuring CentOS to run SELinux in Strict Mode”

Getting JavaScript CSS Dropdown Menu to Render Over a Flash Component

If you are having trouble getting a DHTML drop-down menu to display on top of a Flash movie try adding the following to the <object> tag that embeds the .swf file in your .html.

Add the following as a child to the <object> tag:

<param name=”wmode” value=”transparent” />

Add the following as an attribute to the <object> tag:

wmode=”transparent”

I was having trouble getting a JavaScript dropdown to render over a Flash movie under IE and after adding the aforementioned → Continue reading “Getting JavaScript CSS Dropdown Menu to Render Over a Flash Component”

Compiling .jsp Fragments in Eclipse

The ability to generate HTML or .JSP fragments that you can include on multiple pages of your site enables you to re-use code and increase maintainability.

However, if you need to include functions (or methods) and fields (or variables) in one fragment that is included on a page and then utilize them in another fragment included in the same page Eclipse will give you compile errors because it concludes that your references are out of scope.

The solution is quite → Continue reading “Compiling .jsp Fragments in Eclipse”