
Main Menu

User Info
 Welcome Anonymous

Top Ranked Feeds

Random Feeds
|
View the feed - Absorb:Rethink:Create
Main - Uncategorized - Feeds that are not yet Categorized - Absorb:Rethink:Create
[Comments | Printer Friendly Page | Send to a Friend | Is this your feed/content? | Feature this Feed ]
- Failed to activate local (project-level) build profiles - Mon, 22 Mar 2010 10:55:48 -0400
- In my new MacBook, the preinstalled maven version is 2.2.0. This is different from the version I have in my Windows Vista machine, which is 2.0.9. The same code that compiled in Windows Vista, when checked out in my MacBook will break when running maven with the following statement
Failed to activate local (project-level) build profiles:Cannot parse profiles.xml resource from directory:
After some checking, it appears that in Maven 2.2.0 the namespace for profiles.xml needs to be specified. After adding the following around the existing profiles tag, the mvn build succeeded as before.
<profilesXml xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
- extjs DatePicker too wide in FireFox - Wed, 18 Feb 2009 02:21:16 -0500
- I encountered the problem of the ExtJS Date Picker in FireFox being too wide when popped-up some time ago, and the post at http://vacskamati.blogspot.com/2008/04/extjs-datepicker-patch-for-firefox-3.html helped to solve the problem.
I recently upgraded to ExtJS 2.2, and tried to apply the same patch as before, but somehow it did not work as well. I took the idea and added the width property value to the CSS instead of the code itself, at ext-all.css:
Change from
.x-date-picker{border:1px solid #1b376c;border-top:0 none;background:#fff;position:relative;}
to
.x-date-picker{border:1px solid #1b376c;border-top:0 none;background:#fff;position:relative;width:10px;}
- Balsamiq Mockups - interesting new way to do mockups - Sun, 14 Dec 2008 23:16:02 -0500
- As an Atlassian partner/reseller, I periodically scan the list of plugins available for their products, especially JIRA, Crowd and Confluence.
It was during one of these scans that I discovered an interesting software that can probably save many hours of Photoshopping (or Gimping in my case), or HTML/CSS coding to produce mock ups for clients - Balsamiq Mockups.
More examples here: http://www.balsamiq.com/products/mockups/examples
Making use of hand-drawn diagrams to depict the common widgets we see on web applications nowadays, the user is able to quickly create a mockup, focusing on the task of making the application more usable. When I was working with my previous employer, the mockups were done by designers using Photoshop. One round of nightmare came when Clients request for changes, and the designers will scurry back to their workstation to work on the next version. Eventually, after Clients approved the visually pleasing mockups, it came to translating the mockups to code. The second round of nightmare started: the struggle between the designer and the developer, over what is aesthetically nicer, and what is practically codeable. This struggle sometimes lead to the end result where the client is not too satisfied with the delivered site because it is not what the client visualised.
The next option then was to use HTML and CSS coding to make mockups look as close to the final product as possible. This is a workable approach, since we skip the first problem of spending time on Photoshop mockups, and the HTML and CSS code can be reused for subsequent coding. However, the draw back was that with this presentation, the Client seem to expect the mockup to have the same level of interactivity as the final product, and changes to the layout take a longer time to change than with Photoshopping. However, this is the mode I have sticked to for some time, since there was no better alternative to this.
I tried out Balsamiq Mockups (the AIR version, which is quite fast) for some time, and found that it could possibly be the answer to my problems. Without any photoshopping and coding, it is possible for me to be able to draw up a mock up, run it through the client, and make changes quickly before going back for verifications. And if the change is minor, I could even make the change on the spot right in front of the client!
- Same configuration, different results - Thu, 3 Apr 2008 00:11:23 -0400
- One of the basic understanding in programming is that we always expect the same behaviour under the same conditions. This is definitely true, since coding is not voodoo magic, but the underlying assumption of "same conditions" is usually overlooked, causing much frustrations.
I working on a project on my development machine A running Eclipse 3.3, JDK1.6.0 and Maven 2.0.6. Build was successful, the JUnit test ran properly, and everything was going fine. Checked in the code and moved over to my deployment machine B (the one I bring to my client's site to do some last minute troubleshooting).
Machine B was also running Eclipse 3.3, JDK1.6.0 and Maven 2.0.6, but somehow, after checking out the code and doing a "mvn clean package", I began to get problems. First, a dependency (jmock) that was needed much earlier on, but not needed anymore on Machine A, is again reported as needed for surefire to run. After adding the jmock dependency, I was not able to go past any of the test. All the JUnit tests failed with errors. At least there was a pattern to the error: all of them are NullPointerExceptions, indicating that the Spring-managed objects that I was expecting to be injected in the test automatically was not being injected.
I was using Unitils and defining the objects to be injected by using the annotation @SpringBeanByType. Ok, since this feature requires JUnit4, I looked at whether I defined JUnit4 in my pom. Yes, it is there, so it is not the cause of the problem.
After quite some time of aimless building and re-buildin (which yielded the same set of errors), it finally chanced upon me to check what version of the surefire plugin I was running. Comparing my .m2 repository on Machine A vs my .m2 repository on Machine B, I noticed that Machine A has a folder surefire-junit4, whereas Machine B did not, and Machine A has version 2.4 and 2.0, whereas Machine B has only version 2.0. A quick check using Google shows that surefire started to support JUnit4 from version 2.3.
Adding the following line to my pom
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4</version>
</plugin>
and running mvn package again, everything went well.
So, what happened in the first place? After I found out the root cause of the problem, I recalled that I installed Maven 2.0.8 on Machine A some time ago, and it probably downloaded surefire 2.4 when I ran it. Just because was lazy to upgrade the maven in the other machines, I went back to using maven 2.0.6. So, what appeared to be "same conditions" was not really exactly the same conditions after all.
- Ext 2.0 Final Released - Wed, 5 Dec 2007 10:56:18 -0500
- I have been using the fantastic ExtJS libraries in my projects for a while. The developers has done a great job at delivering a nice javascript library that is easy to learn, but very powerful. Try it out and you would love it.
They have exceeded themselves and delivered a version 2.0 of the library, see
Ext 2.0 Final Released.
- Prevent cleartext password in Spring datasource configuration - Tue, 6 Nov 2007 03:47:45 -0500
- It is not an uncommon requirement for the database password to NOT be stored as cleartext in the Spring configuration for the datasource. However, I was 'lucky' enough to only meet it in a recent project. After some research, I learnt from http://caterpillar.onlyfun.net/Gossip/SpringGossip/BeanPostProcessor.html that I could make use of a spring BeanPostProcessor that allows manipulation of configuration property before and after the initialisation of beans.
I extended org.springframework.beans.factory.config.BeanPostProcessor and created a class PasswordBeanPostProcessor. How this works is that once PasswordBeanPostProcessor is defined in a Spring configuration, upon initialization, Spring will check that it implements the BeanPostProcessor class, and will call the two methods postProcessBeforeInitialization() and postProcessAfterInitialization() before initializing the bean.
The following is the relevant code of my PasswordBeanPostProcessor:
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
if ((bean instanceof BasicDataSource) || (bean instanceof DriverManagerDataSource)){
Field[] fields = bean.getClass().getDeclaredFields();
try {
for (int i=0;i<fields.length;i++){
if(fields[i].getName().equals ("password") ) {
fields[i].setAccessible(true);
String original = (String) fields[i].get(bean);
fields[i].set(bean, encryptionUtil.decrypt(original));
}
}
}
catch(IllegalAccessException e) {
throw new BeanInitializationException("IllegalAccessException encountering during decrypting password for: " + beanName, e);
}
catch (Exception e) {
throw new BeanInitializationException("could not decrypt password for: " + beanName, e);
}
}
return bean;
}
Basically, the code above will be called before the initialization of every bean, so there is a need to check for the type to see if it is a class type we want to handle:
if ((bean instanceof BasicDataSource) || (bean instanceof DriverManagerDataSource)){
The reason for checking the above two classes is a lazy way for me, but it covers most cases. The two classes I use for Spring datasource configuration are org.springframework.jdbc.datasource.DriverManagerDataSource (for development purposes) and org.apache.commons.dbcp.BasicDataSource (for production purposes). The if-statements checks that we have reached either of these classes.
After that, it is a matter of looping through the fields in the class to look for the field with the name "password". I applied the decrypt() function from my own encryptionUtil class to restore the password from a symmetric cipher. Once the password is restored from the cipher, it is set back into the password property field of the bean and the bean is returning to Spring, which will use the restored password to initialize the bean.
- Generic Error with IE - Thu, 17 May 2007 17:42:41 -0400
- Tested my application with IE7 and hit the "Internet Explorer cannot open the Internet site. Operation aborted" problem. How generic can an error message get!
Googling led me to this post, and thanks to mysticcoders for pinpointing the root cause of the problem, otherwise I am really lost about how to even start to troubleshoot this problem.
Ok, so IE6 and 7 needs the whole DOM to be loaded before running javascript. I did not use mootools, but I use dojo, so what I did was essentially to load my javascript using dojo.addOnLoad(init). Worked for me. :)
- Windows Vista extended desktop - Thu, 3 May 2007 06:24:53 -0400
- This has been bugging me for a while, so I hope someone can give me a hint on how I can solve this problem.
Recently I purchased a new Acer Notebook that comes with Windows Vista Home Premium. When I started working on it, I hooked up my Philips 190S monitor and extended my desktop to the monitor. With my old Windows XP notebook, there was absolutely no problem. With the new Windows Vista notebook, the monitor switches to complete darkness after a few seconds, stay that way for half a second, and the desktop appears again. I tweaked the refresh rate settings on my PC and also on the monitor, but the same flickering behaviour will come on and off, sometimes as often as once per few seconds, somethings once per minutes.
One observation was that if I watch a DVD on my PC on the monitor, the flickering does not happen so frequently, about once every ten or twenty minutes.
Of course there could be other reasons for the problem, like incompatible hardware, but my intuition tells me it has to be something about Windows Vista. Hopefully someone can show me how I can start to solve my problem.
- Upgrading from struts2-core-2.0.2-SNAPSHOT to struts2-core-2.0.6 / maven-2.0.4 to maven-2.0.5 - Tue, 27 Mar 2007 05:42:30 -0400
- Just keeping notes of the changes I needed to make to a specific project. Some of these changes are due to the change in version for struts2, and some of these changes are due to changes in version for maven.
- Maven plugin configuration - In maven-2.0.4, the plugin configuration in pom.xml for my maven2-xdoclet2-plugin is defined using (e.g.):
<config>
<plugin>
org.xdoclet.plugin.hibernate.HibernateMappingPlugin
</plugin>
</config>
Now in maven-2.0.5 the configuration is:
<config>
<components>
<component>
<classname>org.xdoclet.plugin.hibernate.HibernateMappingPlugin</classname>
</component>
</components>
</config>
-
Some how the spring plugin is de-coupled from the struts2-core jar between struts2-core-2.0.2-SNAPSHOT and struts2-core-2.0.6, so we need to add the definition for struts2-spring-plugin in pom.xml:
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-spring-plugin</artifactId>
<version>2.0.6</version>
</dependency>
- And of course we need to change the version tag for struts2-core and struts2-core-sitemesh-plugin from 2.0.2-SNAPSHOT to 2.0.6
-
The dojo libraries have been changed, so instead of calling:
var custGrpFormDiv = window['custGrpForm'];
To retrieve a div element with id custGrpForm, we will need to call:
var custGrpFormDiv = dojo.widget.byId('custGrpForm');
-
Similiarly, to refresh the retrieved div, we have to change from
custGrpFormDiv.bind();
To:
custGrpFormDiv.refresh();
- (This point should be specific only to my code)Instead of using a relative path in <s:div href="">, use a variable defined using <s:url> earlier in the code. E.g. %{editUrl}.
-
In <s:submit>, the tag library now accepts the attribute targets instead of resultDivId.
- Encountered some problems with <result type="xslt">, once a page using this result type is called, I keep getting a java.sql.Exception that says "Positioned Update not supported". Did not manage to find out the problem, but applied a workaround which uses a result type of stream with contentType text/xml.
- (This might be a known bug in struts2-core-2.0.6, but I have not spent the time to search through the JIRA database to see if it exists) Some how in the ajax theme templates for struts2-core-2.0.6.jar, (look for \template\ajax\form-close.ftl in the jar file), the dojo package dojo.widget.html.Tooltip is required. However, this package is only found in the path dojo.widget.Tooltip. With the original jar file, I keep getting errors with javascripts that are not loaded. In the end, I modified the form-close.ftl and re-jar the files to be used in my project. This is a workaround, the best way forward is still to get someone in struts2 to make the change to the code itself. (I can also write my own theme template to override the ajax theme, but was too lazy.)
- Migrating Thunderbird to Windows Vista - Fri, 16 Mar 2007 14:09:18 -0400
- I bought myself a new Acer notebook recently, and was busy migrating my stuff from the old WinXP machine to my Windows Vista machine.
Thunderbird is my email client of choice (but lately I have been using more and more of GMail), and I have tons of emails that I would want to refer to. Migrating between WinXP machine was a breeze:
- Copy folder C:\Documents and Settings\[username]\Application Data\Thunderbird (which includes the Profiles folder, profiles.ini and registry.dat)
- Install Thunderbird in new machine
- Start up Thunderbird for the first time
- Paste (replace) copied folder to new machine's Documents and Settings folder
- Start up Thunderbird and voila, the emails all appears, with the settings and saved passwords unchanged.
I tried the same approach with my Windows Vista machine, where the user home is now C:\Users\[username]. Initially I found the Thunderbird Profiles folder under C:\User\[username]\AppData\Local\Thunderbird, but when I copied the files to this folder and opened Thunderbird, the emails did not appear. After some probing, I realised that somehow in Windows Vista the emails are stored under C:\Users\[username]\AppData\Roaming\Thunderbird. Apparently quite a number of other application specific data are also under the Roaming folder.
Copying the Thunderbird folder with Profiles, profiles.ini and registry.dat to the Roaming folder completed my Thunderbird migration to Windows Vista.
- NoSuchMethodError problem in Hibernate - Mon, 12 Feb 2007 12:32:45 -0500
- I deployed a new project on Linux running Java 1.5. The application runs well for a while, but will typically fail with a NoSuchMethodError from Hibernate, usually at the method getHibernateLazyInitializer().
Many thanks to Dave, who gave us Roller and is also the person that solved my problem.
I added the -jvm server flag to jsvc that my server was running, and it seems to be running fine for now.
I was wondering how to add the server flag for jsvc, and was lucky to find this.
- MYSQL Root password for ultimateLAMP VMWare image - Thu, 9 Nov 2006 22:04:21 -0500
- Am running an image of a LAMP stack in VMWare lately. Was trying to find out the root password of MYSQL and finally stumbled on the fact that the root password is stored in cleartext in config.inc.php under phpMyAdmin. Logging down so that I remember in future. The root password for MySQL in ultimateLAMP is 'dolphin'.
From others' postings, I also learnt that the root password for the OS in ultimateLAMP is 'vmware'.
- Resizing YUI Grids - Fri, 15 Sep 2006 07:18:29 -0400
- Yahoo released a set of developer tools for easy UI development. This includes javascript libraries and UI components that enables cool new ways to interact with a web site. The tools also include a set of CSS grids that takes away a lot of painful work (especially a Java developer who is not so into CSS).
The widths of the grids is fixed at 750px, and I would like to have a larger screen area for my contents, preferably 900px.
The solution I found on the web shows that the following two steps needs to be done:
1. Make sure your own css style definition comes after the yui css definitions
2. In your own css style definition, specify the following:
#doc {
width:69.2em;
*width:67.5em; /* IE */
min-width:900px;
}
This approach enables you to make your own customisations without needing to modify the files from Yahoo, making any upgrades later easier.
I know this is quite trivia, but I guess I wanted to document this for my own future reference. :)
- Making an existing project in Eclipse3.1 appear as a WTP project in Eclipse3.2 - Wed, 26 Jul 2006 14:19:41 -0400
- I recently installed Eclipse3.2 and like the WTP feature a lot, since it presents a native plugin to start and stop tomcat. Following the tutorial, it was pretty easy to set up a new WTP project, but I was not able to find the appropriate settings in project properties for existing projects to set up the existing projects as WTP projects.
After some hacking, trial and error, I found the following steps to change Eclipse 3.1 projects into Eclipse 3.2 WTP projects.
1) Add a project nature:
- Add the following line between <natures> tag in your .project file
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
2) Add project facets:
- Open Project->Properties for the properties dialog box
- Click "Project Facets"
- Click "Add/Remove Project Facets"
- Choose "Dynamic Web Module" and "Java"
- Click "Next" if you want to configure the settings for the web module, but this can also be hacked in a later step.
- Click "Finish"
- Eclipse will take some time to process and add a folder ".settings" at teh root folder of the project
3) Modify Web Module Settings
- After adding the Dynamic Web Module facet, the .settings/org.eclipse.wst.common.component file contains the following default information: (note my project name is 'painkiller'):
<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="painkiller">
<wb-resource source-path="/WebContent" deploy-path="/"/>
<wb-resource source-path="/src/main/java" deploy-path="/WEB-INF/classes"/>
<wb-resource source-path="/src/test/java" deploy-path="/WEB-INF/classes"/>
<property name="java-output-path" value="build/classes"/>
<property name="context-root" value="painkiller"/>
</wb-module>
</project-modules>
- The <wb-resource> source-path attribute tells Eclipse which folders to copy to the temporary folder for the webapp before launching Tomcat. For some reasons of my own, I set the source-path to be my target folder, so my file looks like:
<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="painkiller">
<wb-resource source-path="target/painkiller-1.0-SNAPSHOT" deploy-path="/"/>
<property name="context-root" value="painkiller"/>
</wb-module>
</project-modules>
4) Run project on Server
- Click Run->Run As->Run on Server from the menu. I assume you have set up your server according to the WTP tutorial.
- In my case, I installed Tomcat v4.1 Server previously, but the dialog box for Run On Server indicated "The server does not support version 2.4 of the J2EE Web module specification". To get around this, I basically change the value in .settings/org.eclipse.wst.common.project.facet.core.xml for jst.web from 2.4 to 2.3. At the same time, since I am still using JDK1.4 (I know I am a laggard), I changed jst.java from 6.0 to 1.4.
- After the change in .settings/org.eclipse.wst.common.project.facet.core.xml, I attempt to "Run on Server" again and the Run On Server dialog allowed me to choose Tomcat v4.1 Server.
- Click "Next" to see the projects that are already configured to run with this server, and click "Finish" when done.
- The web server is now started and the Internal Web Browser view is opened with the configured web context
5) Troubleshooting
- If you encounter any problem with your webapp after launching tomcat, you can find the deployed files at %workspace%/.metadata/.plugins/org.eclipse.wst.server.core/. You will see a number of temp folders named tmp0, tmp1 etc. You files should be in the latest one.
- Change into one of the tmp? folders and you will find folders like conf, log, temp, webapps and work, which maps to the respective files you will usually find under your tomcat folder. The most useful folders would be logs and webapps.
I simply jotted down quick notes as I applied these steps to a second project I wanted to convert into a WTP project, so if I missed any step, kindly let me know and I can improve on the above.
- Calling Gimp from within Java - Mon, 15 May 2006 13:12:39 -0400
- In one of my projects I needed to perform the following:
- extract images from a multi-layer tiff file, and save them into individual jpg files
- from each jpg file, crop the image to obtain a certain area, and save the area into pgm format
- call a barcode-ocr program to recognise the barcode and rename the jpg file according to the barcode read
In another of my projects I have to convert JPG images into BMP based on a pre-defined indexed color palette.
For both projects I started with trying to use JAI, but hit certain obstacles (somehow the barcode-ocr program cannot recognise the cropped barcode area, and I could not find an operation in JAI to convert images using a certain indexed color palette). I had to look for alternatives, and finally decided to use Gimp to solve my problem.
Using Gimp is not without its own obstacles. The first obstacle is the steep learning curve of the Scheme dialet Script-fu that is used to manipulate images in Gimp. After many hours, I finally was able to write the script-fu scripts that does the magic for me. The second obstacle was to figure out a way to call these script-fu scripts from within Java.
I used the Windows version of GIMP. The first instinct was to call the command-line from within Java to accomplish the job. However, the stable version of Gimp for Windows, Gimp version 2.2.x, did not support the command-line interface in the Windows OS. I tried my luck with the yet-to-be-stable version 2.3.x available at sourceforge, and was happy to find the gimp-console-2.3.exe file under the bin folder of Gimp. The console interface worked, but there was one other problem: every command I issue loads and unloads Gimp from the memory, which proves to be very very slow.
I scoured the Internet, and finally remembered that there is one menu function in Gimp with the label "Start Server...". Basically this is a simple server that listens at the specified TCP port for script-fu commands, runs the script, and returns a return code. This also means that I only need to start up Gimp once with the Script-fu server listening, eliminating the problem of loading and unloading Gimp.
Now comes the next obstacle: there is no documentation of the protocol used by the Script-fu server, at least not on the official Gimp web site. Luckily for Google caching articles, I was able to find this article which outlines the script-fu server protocol.
With that, the following class was used to connect to the Script-fu server:
package sg.com.arcworks.gimp;
import java.io.*;
import java.net.*;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class GimpClient {
private static Log log= LogFactory.getLog(GimpClient.class);
private Socket sock = null;
private String gimpServer = "localhost"; //default gimpServer location to localhost
private int gimpPort = 10008; //default gimp port to 10008;
public GimpClient(){}
public void init() {
try {
sock = new Socket(getGimpServer(), getGimpPort());
} catch (UnknownHostException e) {
log.error(e);
} catch (IOException e) {
log.error(e);
}
}
public void cleanup() {
try {
sock.close();
} catch (IOException e) {
log.error(e);
}
}
public synchronized String sendOneCommand(String command) throws UnknownHostException, IOException {
int intA = command.length() % 256;
int intB = command.length() >> 8;
if (intA > 128) {
command = StringUtils.rightPad(command, ((intB + 1) * 256), " ");
}
if (sock.isClosed()) {this.init();}
if (!sock.isConnected()) {this.init();}
byte[] header = new byte[2];
char[] reply = new char[255];
PrintStream dat = new PrintStream( sock.getOutputStream());
BufferedReader dis = new BufferedReader(new InputStreamReader(sock.getInputStream()));
StringBuffer retString = new StringBuffer();
header[0] = (byte) (command.length()>>8);
header[1] = (byte) (command.length() % 256);
try {
dat.print("G" + new String(header) + command);
dat.flush();
int len = dis.read(reply);
for (int i = 0; i < len; i++){
retString.append((char)reply[i]);
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
dat.close();
dis.close();
sock.close();
return retString.toString();
}
/**
* Method to escape a string for filePath.
* Rules:
* - Convert \ to \\ (which in the end will be what we need to pass to gimp
* - Convert " to \"
* - Convert / to \\
* @param inStr
* @return
*/
public String escapeString(String inStr) {
String outStr = inStr.replaceAll("\\\\", "\\\\\\\\");
outStr = outStr.replaceAll("\"", "\\\"");
outStr = outStr.replaceAll("/", "\\\\\\\\");
return outStr;
}
/**
* Takes the response string from a script-fu server call and
* determines if it is a sucesss or failure
* @param respStr
* @return true if the response is a success, false if otherwise
*/
public boolean parseResponse(String respStr) {
int index = respStr.indexOf("Success");
// Successful responses will always have a 'G' character, followed by 3 bytes, and then
// the string "Success"
if (index == 4) {
return true;
}
return false;
}
public int getGimpPort() {
return gimpPort;
}
public void setGimpPort(int gimpPort) {
this.gimpPort = gimpPort;
}
public String getGimpServer() {
return gimpServer;
}
public void setGimpServer(String gimpServer) {
this.gimpServer = gimpServer;
}
}
One more additional point, the script-fu server can either be started from the Gimp GUI, from Xtns->Script-Fu->Start Server ..., or using the following commandline:
gimp-console-2.3.exe -i -b "(plug-in-script-fu-server 1 10008 \"c:\\\\script-fu.log\")"
where 10008 is the port to listen at and c:\script-fu.log contains the log statements.
- Update of frequently searched page - Tue, 25 Apr 2006 05:14:23 -0400
- Updated the right navigation with two new entries for frequently searched page. Most probably you are searching for these entries but you'd not find them in the current home page of this blog.
- Installing JAI into my JDK - Tue, 28 Feb 2006 21:37:49 -0500
- Had a need to manipulate images in my Java application, and after some looking around, it looks like the Java Advanced Imaging API is the way to go. Although it is currently only in ver 1.3 beta, I proceeded to download it. However, as I have a number of different JREs and JDKs in my machine, I mistakenly install it for the wrong JRE (not the one I used for my development). Somehow the convenience of the one-click exe installer worked against me in this case because I did not want to run the .exe installer again on my JDK. I did a compare of the files before (luckily I kept a copy of that) and after installation and found that there are 3 jar files in the ext folder: jai_codec.jar, jai_core.jar and mlibwrapper.jar. I copied these 3 jar files from the original location to my copy of JDK, find the ext folder (under jre\lib\ext of the JDK installed folder) and pasted the jar files. Restarting my eclipse IDE reloads the jar files from JDK and I was able to access the JAI classes.
- FeedFlare for jroller - Tue, 14 Feb 2006 13:35:36 -0500
- I am trying out the FeedFlare service from FeedBurner. However, jroller is not listed in their instructions for adding the javascript to blog templates.
Initially I used the showPermaLink macro in jroller to generate the permanent link to be used as the parameter for flareitem in the FeedFlare url, however showPermaLink generated more than only the permalink.
From both this post and this post I got some ideas and did some tweaking to find the following to work for jroller:
<script src="http://feeds.feedburner.com/[feedburner_id]?flareitem=
$absBaseURL/page/$userName?entry=$entry.anchor" type="text/javascript">
</script>
Where [feedburner_id] is my userid for FeedBurner, and remember to put the line within the #foreach( $entry in $entries ) loop.
- Thunderbird Inbox blank problem - Wed, 25 Jan 2006 23:12:52 -0500
- I managed to convince a client to use Firefox, Thunderbird and OpenOffice 2.0 in their 10-men office. A small victory for the open source solutions world. :) So far their experience has been ok, with only a handful of users complaining about certain additional steps needed in OpenOffice 2.0 when compared to MS Office to perform the same task.
However, this week a problem that I have not encountered before occurred: the director's Thunderbird on her notebook refuses to work! Basically, the symptoms are as follows:
- When Thunderbird is opened, Inbox is displayed as blank, with the message "Building summary file" in the status bar
- The memory usage of Thunderbird grows to a very big value.
- The CPU Usage soars.
- Other applications cannot response with the usual speed.
After a very long time building the summary file, the Inbox is displayed with around 1000+ files, but once I clicked on another folder and click back to Inbox, the same long building started again. It puzzled me because I remember also having large folders with more than 8000 emails, and I never encountered that problem before. I first thought it was a virus/spyware problem, but after scanning for everything, the machine was reported as clean from such problems. I even upgraded her Thunderbird client to version 1.5, but still the same problem appeared.
Took me a while with different search strings at google to finally find the mozillazine article on Inbox stays blank. Apparently the Inbox file was corrupted, and Thunderbird was not able to complete the building of the summary file properly. And the reason I did not encounter the problem was because I have more than 8000 emails in a folder but my folders are never larger than 50MB, whereas her single Inbox file was more than 200MB.
I followed the article until the point where it says "if this succeeds, you can move .....", and the next point at that time was "if this also fails, you may have to take your loss". The problem is when I tried to import the Inbox file the MboxImport extension reports that the file is not a valid mbox format file.
No way for my client to lose her 1000+ emails though, so I have to find another way to solve the problem. Knowing that the mbox file format is just a plain text, I proceeded to open it with Vim (which resulted in my other problem with Vim), and finally was able to see that the first line was corrupted and somehow became a very long time. I removed the first line and corrected the From statement (looking at other emails down the file and copied the From statement). I repeated the import using MboxImport and luckily now the file was recognised as an mbox file!
After being about to recover the emails in the one big Inbox, I proceeded to compact folders and moved older mails into separate folders, with the aim to keep individual mbox files small. Problem was solved, but I believe it will recurr some time in the future if the user is not educated to perform housekeeping regularly.
I updated the mozillazine article with 2 additional points to summarize my solution, hoping it would help someone else with a similar problem. However, it is quite puzzling that Thunderbird does not suggest a limit on the mailbox size so that users will know that keeping all emails in one folder is going to be hazardous to their "informational health".
Lesson learnt: (1) Compact your Thunderbird folders often. (2) Split up mails into folders to avoid single large mbox files. Maybe when I figure out how to submit enhancements/bugs to Thunderbird, I will submit a suggestion for Thunderbird to remind users to archive and compact emails (MS Outlook has such a reminder, but I almost never say yes to "Do you want to archive your emails" though. :P).
- Memory problem with VIM - Wed, 25 Jan 2006 22:19:20 -0500
- I love Vim, and I use it for all of my text editing until Eclipse came along. Now I program in Eclipse but still do a large portion of my text editing in Vim. Recently I was troubleshooting a problem with Thunderbird email, and had to open an Inbox file that was more than 200MB in size. With the past experiences with Vim opening large files, I did not hesitate before opening the Inbox file with Vim.
It took a long time (try more than 20 minutes) for Vim to load the whole file into memory, although I have 1GB of physical RAM on my notebook, but at least I was able to load the file and fix the problem. One thing that I observed is that the Mem Usage was 200MB, but the VM Size was around 400MB, double the Mem Usage.
Subsequently, when I tried to open another text file with Vim, the surprising fact is that my task manager still reports that Vim is trying to take up more than 400MB of memory to load the small 5KB text file!
A little research reveals that the _viminfo file stores the register for the last edit, and my last edit was the first line of the corrupted Inbox file, which I suspect to be a very long line. My _viminfo file was now also 400MB+ and every time I try to load Vim, it tries to load the registers into memory before allowing me to edit the text file.
Next logical thing for me to do was to either to delete the _viminfo file (which I think will be regenerated by Vim), or to open the _viminfo file to edit out the one long long line. With some time on my hands, I tried the second approach, just to see what happens.
It turned out that this was quite a bad idea. Now the file loads with more than 400MB under Mem Usage, and the VM Size climbed for more than 40 mins to around 1.3GB!! And the anti-climax was that at the end of 40mins, Vim loaded with the message that my machine has run out of memory. However, somehow Vim still loaded the _viminfo file, but I guess it has truncated a large portion of the file. I tried looking for the long line and it is not there, so I saved _viminfo, and noted that the size dropped to 2KB.
Next surprise is that when I closed Vim this time round, I was expecting everything to go back to normal. I was wrong because Vim still took a long time to close, and _viminfo went back to 400MB! Apparently after I saved _viminfo with the 2KB size, the application wrote back whatever it stored in memory and overwrote my changes.
Enough with the experimenting, I deleted _viminfo file and opened the small text file. Vim loaded with its usual fast speed, and a new (small) _viminfo file was generated when I closed Vim.
Lesson learnt: (1) If I opened a large file with a long line in Vim, I need to check the size of _viminfo before trying to open any other text files. (2) Never be so stupid as to try to open _viminfo with vim when _viminfo is very large. :)
- IE Z-Index bug - Wed, 18 Jan 2006 04:28:17 -0500
- Was working with an problem with drop-down menus not covering the elements they should be covering. The same code worked in Firefox, but once I render the same page in IE, the bug appears. After much trial and error, I finally stumbled upon this article, which suggests that I should remove unneccesary position:relative elements. Solved my problem immediately!
- Hack to enable InspectElement in Firefox 1.5 - Wed, 11 Jan 2006 01:55:00 -0500
- After upgrading to Firefox 1.5, everything was fine, except that one of my favourite extensions - InspectElement - ceased to work. Luckily someone tried and came up with a hack to enable it in Firefox 1.5, just by simply changing the maxVersion number in the rdf file. See details of the hack at the InspectElement page. I tried it and it worked perfectly.
- GMail background upload of attachments - Fri, 21 Oct 2005 14:27:33 -0400
- Some time ago Gmail launched the new feature of automatically saving a draft of the email you are typing. Works very well and helped me once when my hand was too quick to click on the 'X' to close the browser, before my mind told me I was closing the wrong browser window.
Lately I have been uploading a fair amount of attachments via Gmail. On one occasion, I selected a file to be uploaded, and was distracted by something else and only came back to the email a few minutes later. Apparently in the mean time when I was busy with something else, the attachement was uploaded and cached somewhere even before I have complete typing the email.
After this, I notice that whenever a file attachment have been chosen by clicking on the "Browse" button, a small red box (probably 2x2 pixels) will appear on the top right hand corner of my Firefox browser, and the status bar will inform me that the browser is communicating with some site in google.
With this knowledge, a small tip for using Gmail is to select your file attachements before typing the email body. In this way, by the time you finish typing your email, the file attachment could already be uploaded completely and it will only take seconds to send out the email. Compare this with the typical behaviour of uploading the file only when the "Send" button is clicked, and you will find that this is a bit time-saver when you are talking about large file attachments.
- Moving projects into a new workspace - Thu, 20 Oct 2005 22:39:58 -0400
- I was transitioning between Eclipse 3.0.1 and Eclipse 3.1 for a few weeks now, testing the features in Eclipse 3.1 to see if they are compatible with my projects created in Eclipse 3.0.1. Glad to say that so far I have not encountered any problems with Eclipse 3.1. Workspaces created using E3.0.1 can be opened with E3.1 with no issue.
This morning I decided to complete the migration to E3.1 so that I can free up some free space on my hdd, but found that previously I had created a workspace in the \workspace folder under e3.0.1 to store some of my other smaller projects. That was before I started the practice of creating a new workspace for each set of related projects and keeping them in a folder separate from the Eclipse installation. So I had to move these projects to a new workspace before removing the installation of e3.0.1.
I created a new workspace and tried to import projects using File->Import. Since I have existing projects, I selected "Existing Projects Into Workspace". The following dialog box allowed me to choose the root folder and the specific project to import. I tried one project, and it was imported properly into the new workspace - with one gotcha: the project files are still residing in the old folder, the new workspace only points to the old folder, allowing me to access the files from the e31 workspace. This is not what I want. What I want is to copy the projects physically to the folder where the new workspace is created.
I noticed that there is another option at the "Import Projects" dialog box for "Select archive file", so I tried zipping up my project in the old workspace and import using the .zip file into the new workspace. It works, with another glitch - somehow some of the subversion meta-data files (under the respective .svn folders) were not zipped up or unzipped properly, and the project is not recognised as an svn project.
Last approach I tried, which is the one that is working for me now: - create an empty project in the new workspace.
- Copy the project using the filesystem from the old workspace to the empty folder in the new workspace, over-writing the .classpath and .project files created by creating the new project.
- refresh the project in eclipse
There must be a better way to do this, but since it is working for me, I am too lazy to explore the other approaches.
[After note: one day after posting the above, I rethink the post, and thought to myself: why did I not think of the approach to simply copy the workspace folder from under E3.0.1 to another location and open the workspace with E3.1. That could be the most time efficient way of solving my problem, but since I have deleted the E3.0.1 installation, there is no way I can verify whether this works.]
- Adding Spring to my webapp - Sat, 8 Oct 2005 14:10:41 -0400
-
Have started to learn about Spring, and am excited about integrating it with my current projects. Today I started making small changes to some of the classes to use the Spring Core package, more for the IoC features. My objective is to make my changes as unobtrusive as possible, and to affected only the few classes that I am changing.
Just to note down the few changes I have made.
1. First, I added the dependency for the Spring Framework in my maven 1 project.xml:
springframework
spring
1.2.2
jar
true
2. After this, I added the my context definition file applicationContext-main to the folder under which I store my util classes at src/java/com/mydomain/util. The application context definition can be anyway, as long as it can be found by the context loader later.
3. All my JUnit test classes extend from a BaseTestCase, so I added the following code block in BaseTestCase:
protected final static ApplicationContext ctx;
// This static block ensures that Spring‘s BeanFactory is only loaded
// once for all tests
static {
String pkg = ClassUtils.classPackageAsResourcePath(Util.class);
String[] paths = {“classpath*:/” pkg “/applicationContext-*.xml“,
“classpath*:META-INF/applicationContext-*.xml”};
ctx = new ClassPathXmlApplicationContext(paths);
}
I got the block of code above from Matt Raible's AppFuse, a great project that uses Spring extensively.
The only change I made was to specify Util.class, which tells ClassUtils to return a string converted from the package name of the class. I don‘t really have any use for specifying the META-INF path yet, but I guess there is no harm leaving it in.
4. In my JUnit tests, I get the references to the objects I need by calling ctx.getBean().
5. In building the classes for running the unit tests, there are two approaches that I take – one is to build the project from within Eclipse, and another is to build the project from the command line using maven.
Somehow in Eclipse the applicationContext-*.xml files are copied to the target folder under the same location as that in the src folder, but in maven, I needed to specifically write a postGoal to perform the copying as follows:
description=“copy applicationContext-*.xml files to the appropriate package”>
includes=“**/applicationContext-*.xml” />
5. To enable the loading of the application context in the web app, I had to modify the web.xml file with the following additions:
MVC framework is using Struts, and I don‘t want to change the whole application to Spring MVC overnight. At the same time I hope to introduce Spring IoC little by little. So in this case, I added the call to get application context to the BaseAction class from which all Struts action class in my application extends.
To do this, I added the following lines in my BaseAction class:
protected WebApplicationContext _springCtx = null;
...
// Under setServlet, add
_springCtx = WebApplicationContextUtils.getRequiredWebApplicationContext(getSerlvetContext);
7. In the action class that we need the Spring beans, we call the application context directory to return the object:
private DateUtil dateUtil = null;
...
dateUtil = (DateUtil) _springCtx.getBean(“dateUtil”);
where dateUtil is the id of the bean wired in the context file.
With these steps done, I can start to do IoC in seleted struts action files, and move the code gradually to Spring.
- Web 2.0 is going on - Thu, 6 Oct 2005 04:03:38 -0400
- The Web 2.0 conference is being held now in San Francisco. A little too far and too expensive for me to make the trip to be there physically, but I have been listening to podcasts from IT Conversations for last year's seminars. Really inspiring speeches (most of them), and makes me learn a lot more about all the new and exciting developments.
I must say that IT Conversations is one of the two podcast sites (the other being Adam Curry's DailySourceCode) that really got me hooked on the idea of utilising my "drive-time" with podcast listening. IT Conversations is funded by listener contributions, and I think I am really going to contribute to their TipJar. Kudos to IT Conversations executive producer Doug Kaye and his Team ITC volunteers for bringing such a valueable service to all!
- Google Maps - the first Web 2.0 platform - Thu, 6 Oct 2005 03:49:56 -0400
- Got this from the O'Reilly Radar article.
Has been looking cursory at Google Maps, but the issue that is stopping me from spending more time on it is that for where I living (Singapore), the map information is not as detailed as that available for the States.
shooperman showed my his installation of Google Earh today and I realised that the information is out there, but somehow it is not included in Google Maps. Anyone out there knows if it is possible to send a request to Google to include that information in Google Maps?
- Eclipse Tip: refresh plugins - Wed, 28 Sep 2005 11:59:25 -0400
- I am sure this is a tip that has been going around for a while, but I think I should blog it down so that I can remember it in future when I encounter the same problem.
I recently upgraded to Eclipse 3.1 (only to find that Eclipse 3.2M2 is already released later, but that later), and wanted to use the Sysdeo Tomcat Plugin with e3.1. After downloading the new Sysdeo plugin file for e3.1, I place the unzipped folder in the plugin folder of e3.1, but the tomcat plugin was not detected.
Searched for a solution and I came upon this article that tells me the solution straight away: to start eclipse with java -jar startup.jar -clean. However, in my case, because I installed a copy of Oracle on my machine, and Oracle messed up my path by adding the path to a JDK1.3 installation at the front of the path, I have to start e3.1 with %JAVA_HOME%\bin\java -jar startup.jar -clean at the e3.1 folder, with %JAVA_HOME% pointing to the correct java SDK version I want.
The same command can be used to refresh eclipse whenever a new plugin is installed.
- My first GreaseMonkey script - Sat, 24 Sep 2005 02:53:49 -0400
- I have two other blogs on blogger: Happy Eternally, where I blog about my 18-month boy, and TotallyConfused, where I blog about random thoughts.
Before I found out about the captcha functionality in Blogger, I encountered a few cases of comment spams, and the only thing I could do was to delete the comment entirely. I don't really like to do that, because I don't want other genuine readers to think that I am a blog owner that delete comments that I don't like. My preferred way was to edit the comment to remove the href links, but keep the original comment with a remark from me.
I found out a way to do this from Blogger Templates, but I would prefer a one-click solution to the problem. Along with this, I recently discovered GreaseMonkey and thought why not try my hand at adding the comment edit link using greasemonkey?
So the result of a few hours' experimentation yields my first user script - Add Comment Edit Link in Blogger, hosted now at userscripts.org
- First look at AppFuse - Thu, 25 Aug 2005 03:37:04 -0400
- After trying out Ruby on Rails yesterday, and deciding that I should not be spending time to learn about a whole new universe of code, tools etc, I started looking at AppFuse today. Both RoR and AppFuse (correct me if I am wrong) have the key value proposition of allowing me to build a simple web app quickly. RoR did not wow me as much as it did others, not sure about AppFuse because I just started.
After downloading the 1.8.2-RC1 zip file and extracted it into my folder, I realised one thing about AppFuse - it does not use maven. Quite puzzled by this, because I have the impression that most of the active Java opensource projects have already moved to maven. So I had to go back to download a copy of Ant 1.6.5 (my copy is 1.6-alpha, and AppFuse requires 1.6.2+).
A few minutes later, I tried to run ant setup-db, but was told that ReloadTask is not found. In my Ant1.6alpha's lib folder I found catalina-ant.jar, which contains the ReloadTask class. However, I cannot remember if I copied it into the folder from elsewhere, or it came shipped with the ant distribution.
I took a while to look in the net where I can get the relevant latest jar file for ReloadTask, but was unsuccessful. In the end I copied the catalina-ant.jar file from the ant1.6alpha folder to the ant1.6.5 folder. So we have docjar.com, koders.com and maven repo search engines, but I don't know of a search engine that will take a class name as a parameter and return the jar files that contains the class. [Idea for a new search engine?]
Ok, on to the next step in the AppFuse tutorial, more later.
- Google Talk - Wed, 24 Aug 2005 12:37:10 -0400
- Everyone is talking about it, so why shouldn't I?
A quick download from http://www.google.com/talk and even faster installation. The application runs with quite a small foot print, smaller than that of Yahoo IM and Skype.
Downside is that my friends are probably too busy to try it out, so none of the people I invited are registered with Google Talk yet, and I can only stare at the IM window with nothing I can do.
One additional feature Google included in Google Talk is to have a new mail notification much like that in Thunderbird - when there are new emails received by the gmail account, the subject appears above the system tray and disappears after a few seconds.
- Google Account Signup Page - Wed, 24 Aug 2005 12:23:48 -0400
- Just got to know this from a comment on another blog: you don't need to rely on an invite now to get a Gmail account, although there should be enough gmail invites going around.
Google has announced a number of services and they are using the same account to integrate all these services, so they are providing an account sign-up page.
- [Not Tech-Related] You want a free trip to Singapore? - Wed, 24 Aug 2005 12:09:33 -0400
- I am from Singapore, and the Singapore Tourism Board (STB) is currently running a promotion for Singaporeans to send postcards to friends overseas. A free lucky draw will be held by STB to invite 5 overseas friends to a dream holiday in Singapore. More details can be found at http://visitsingapore.com/projectpostcard.
If you are interested in receiving a post card from me, drop me an email at choongyong.koh at gmail.com with "STB" in the subject. Even if you don't get to win the dream holiday, I think it would be a good way for me to know new friends from overseas. :)
- Google Search History - Mon, 22 Aug 2005 04:46:12 -0400
- Ever had the problem of knowing a piece of information in somewhere in a web page that you came across while searching the web a few days ago, but just simply don't remember which URL the web page is on, or even the search string that was used to search the page?
I have such problems, and thanks to the good folks at Google, the Google Search History is a fantastic tool that has solved my problems.
There are two major selling points in Google Search History: first it remembers, and then it filters.
It remembers by automatically tracking the search strings, when the search is performed, and the links that you traversed from the search results. This in effect creates an automatic bookmark of pages that you might be interested with the "tags" made up by the search terms in the search string.
It filters by allowing you to search within your search history. I just began using this tool for a few days, so my search history that is tracked is quite short. When the search history gets too long, the search within search history helps to filter down the list to go through
This feature is very close to, but functionally different (as far as it works for me), to the system provided by del.icio.us. In Google, the bookmark list is automatic, no user intervention is needed to add bookmarks, all I need to do is to click on a search result. In del.icio.us, the bookmarking is done consciously. So when I want to go back to a link that I recognised as useful the first time round, I would go back to del.icio.us, but when I want to recall a link which I have come across, but only recognised that I needed it some time later, I can still go back to Google.
Addition: another added feature that Google Search History provides is that it becomes a barometer of how much I have worked in a day - by showing the number of searches performed using colour codes on a calendar.
- Velocity throws NullPointerException if not initialized - Tue, 26 Jul 2005 17:08:29 -0400
- I was trying to write a JUnit testcase and attempted to load a velocity template using
Velocity.getTemplate(). However, I keep getting a NullPointerException even if I used the correct path.
Searching yields this bug report saying that Velocity.init() needs to be called first to allow Velocity to initialize its ResourceManager.
Tried it and adding the call to init() works for me. :)
- Cygwin SSHD - Tue, 26 Jul 2005 07:24:33 -0400
- I like WinXP Pro because it is easy to administer and I am familiar with it. At the same time, I like to be able to ssh into a remote machine to manage the applications I am running on it. Cygwin allows me to have the best of both worlds, and I just tried installing SSHD on Cygwin using the instructions posted by someone here.
However, I just wonder if there is any security concerns running SSHD on WinXP Pro?
- Installing WinXP Pro on Dell PowerEdge 750 - Mon, 25 Jul 2005 13:26:39 -0400
- I purchased a Dell PowerEdge 750 server for a client, with the plan to install WinXP Pro on the machine. In the customisation section of the server, the OSes offered for out-of-the-box configuration are Windows Server 2003, Windows Server 2000 and Redhat Linux Enterprise Edition.
So implicitly (although it is not told to us during purchase), it means that Dell does not support installation of WinXP Pro. When I tried to install the Dell-specific server administration software, the only OS choices are those listed above, and there is no way I could choose another OS to be installed.
Ok, so I gave up and tried to install WinXP Pro by the old-fashioned way, booting up from the CDROM. After some time spent loading system files, I was told that no HDD was detected. Oops, that means I am in a fix, because I just spend a few hundred dollars buying the WinXP Pro license, and now I am looking at spending another few hundred dollars (about 3 times that of the WinXP Pro CDs) to buy a Windows Server 2003 or 2000 license. Bad situation!
A few google searches confirms the fear - it seems like no one has been able to successfully install WinXP Pro with the Dell PowerEdge 750 (and other similar server products). I tried to create floppy disk drivers of the SATA RAID drives, which I downloaded from Dell's support site. However, apparently they are missing a txtsetup.oem file. *sigh*
Luckily I persisted, and finally found a forum post that suggests using the Windows 2000 drivers. Going back to the Dell support site, I chose Windows 2000 as the OS, and found the Windows 2000 drivers for SATA RAID used in the PowerEdge. With this, I was able to install WinXP Pro, following steps similar to that listed in this article, substituting WinXP with Win2K.
Installation completed after approx 45 minutes, and the next obstacle was that no drivers could be found for the onboard Gigabyte NIC onboard. This is an easier problem to solve, since it is discussed in this forum post. Download the PRO2KXP.EXE driver file and run it, and the NIC driver is easily detected.
Called it a day after this, continuing tomorrow.
- SVNService - running svn as a windows service - Thu, 21 Jul 2005 08:28:15 -0400
- In continuation to what I was trying to do, I wanted to run my svn repository process as a windows service on the Win2k machine.
On the Subversion FAQ site there are two recommended links. I tried the SVNService, since it does not require much tweaking of the registrty.
Installation is easy, basically I unzip the downloaded file, and copied SVNService.exe to the same folder where svnserve.exe resides. The next thing to do is just to install the service, which for me is the following:
SVNService -d -r e:/myrepos --listen-port 1234
The SVNService will than be installed in your Windows services with the name SVNService. It is created to be started up manually, so you will need to modify this in the services mmc panel if you want to run it upon startup.
One question I have, but I did not find out: what if I am running more than one svn repository on the same machine listening at different ports? Will SVNService install two services with different parameters, or will it override the first installation with the parameters of the second installation? Will find out when I need to install another repository.
[Update on 21 Jul 2005 20:22]:
Found a site with good detailed descriptions of installing svn on Windows
- MySQL timestamp updated automatically - Thu, 21 Jul 2005 08:21:22 -0400
- In one of my projects I mistakenly used the TIMESTAMP datatype for columns that I instead to store DATETIME information. The problem was not obvious, as torque converted the TIMESTAMP datatype in MySQL to the Date type in Java, and everything worked normally.
The problem surfaced only today when my wife noticed there was something wierd with the test database she was working on. Apparently one of the TIMESTAMP columns was updated without the application doing anything to the particular column. We did a little experiment and found when we used the MySQL Query Browser to update a row in the table, without touching the TIMESTAMP column, the TIMESTAMP column will be updated with a new time value that looks suspiciously to be the current time. I tried the same operations on my version of mysql (4.1.8-nt-max) and the same thing happened.
Interestingly, when the same database schema and application was run on another machine running MySQL 4.0.23, the TIMESTAMP column behaved as expected - the value was not updated when we don't explicitly update the column.
After some research, we finally realised that the root of the issue lied with the default behaviour of the TIMESTAMP database in since MySQL 4.1.
So in our case, what we defined in torque was:
<column name="PICKUP_FROM_DTM"
required="false"
type="TIMESTAMP"/>
<column name="PICKUP_TO_DTM"
required="false"
type="TIMESTAMP"/>
Torque generated the schema creation sql to be:
... other columns ...
PICKUP_FROM_DTM TIMESTAMP,
PICKUP_TO_DTM TIMESTAMP,
... continue other columns ...
However, after the table was created in MySQL 4.1, we did a show create table <table_name>, and we see:
... other columns ...
`PICKUP_FROM_DTM` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`PICKUP_TO_DTM` timestamp NOT NULL default '0000-00-00 00:00:00',
... continue other columns ...
The same schema creation sql in MySQL 4.0.23 yields:
... other columns ...
`PICKUP_FROM_DTM` timestamp NOT NULL,
`PICKUP_TO_DTM` timestamp NOT NULL default '00000000000000',
... continue other columns ...
Basically in MySQL 4.0.23 there was no logic to add defaults if none is declared. However, from MySQL 4.1 onwards, the first TIMESTAMP column in the table will have its default set to default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, if no default is declared explicitly. This explains the reason for the column to be updated with new time values even when we were updating other columns in the same row.
After some discussion, we decided to change the datatype for these columns to DATETIME, which is equivalent to TIMESTAMP as far as our application is concerned.
- Found a GoDaddy Buddy - Mon, 18 Jul 2005 23:59:03 -0400
- I have been spending quite a bit of my time lately to try to configure my GoDaddy VPS and am glad to find another fellow blogger Rick Hightower who is attempting similar tasks.
- TDI FW - Free firewall for Win2K Server - Mon, 18 Jul 2005 04:49:54 -0400
- I was trying to set up a SVN repository on a machine currently running Win2k. Before opening up the machine on a public IP, I thought it is a good idea to install a firewall to at least have some sense of security.
A quick look at the few common firewall products that have a free edition for personal use did not yield a good result. Most of the free firewalls do not support Win2k server, which is considered a Server product. Anyway, I did a google and found this free and open-source firewall - TDI FW.
Installing was easy because the batch file basically does everything. The installation was not graphical like other products, so there was no feedback about what was done. But a quick look at the readme file tells me that the config file is in %SYSTEM%\WINNT\System32\Drivers\etc (the same folder the hosts file is found) and the log files is found in %SYSTEM%\WINNT\System32\LogFiles.
Armed with this two pieces of information, all I had to do was to try to understand the configuration in the tdifw.conf file, which is cryptic at first, but simple enough when I got to understand it later.
After a few rounds of trial and errors, which includes the following steps:
- Change config file
- Stop service by "net stop tdifw"
- Start service by "net start tdifw"
- Check log file to see if the configuration worked properly
I was finally able to at least be confident about opening up the machine on a public IP.
- Mysql Root password in my GoDaddy Account - Mon, 18 Jul 2005 03:57:48 -0400
- I was trying to set up a web application in my GoDaddy Account and require access to mysql root to be able to set up the correct permissions and schema. However, the only way I was able to manage the mysql database was via Plesk, and I have absolutely no idea with the root password was.
After trying to about half and afternoon, I came across this faq which tells me that when Plesk was installed the root account was disabled (in fact later I realised they removed the root account) and an account with 'admin' username was created, with the same password as the Plesk admin password.
[tag: rememblog]
- Migrating Subversion Repository - Thu, 14 Jul 2005 16:06:53 -0400
- I was hosting my svn repositories on a linux box running in my home network. Recently I got a VPS subcription and started to migrate my svn repositories to this new box I have. When I tried to use both Subclipse and Tortoise to make an "svn switch", I get errors telling me "svn://old.repository.my.com is not the same repository as svn://new.repository.my.com".
After consulting the SVN book, I learnt that there is a commandline "svn switch" switch for relocate. Basically, all I have to do was to navigate to the root of the working copy and issue:
svn switch --relocate svn://old.repository.my.com svn://new.repository.my.com
Note: I use the svn:// protocol for my repositories, but I believe the above command will work similarly for repositories with http:// protocol - the SVN book says that the operation is equivalent to running a perl script across your .svn files replacing the old repository url with the new repository url.
- DNS Host File setting on GoDaddy - Thu, 14 Jul 2005 04:42:03 -0400
- I registered some of my domain names through GoDaddy.com, and recently obtained a Virtual Private Server subscription from them too. With my own server, I thought why not serve the DNS records out from the same server, so I proceeded to mirror the DNS records in this new server with those on the existing nameservers.
When I was ready, I tried to change the nameserver setting for my domain name in GoDaddy by going to My Account->Manage Domains->Nameservers Summary. However, when I tried to enter the name of my new nameserver, I always get the error messages:
Unavailable error in field Host name1
Unavailable error in field Host name2
I tried contacting GoDaddy support via email, but after a few days of non-reply (got similar kind of service from my previous hosting provider, that's why I changed.....sigh, at least GoDaddy's servers seems more stable than the last provider's), I tried to do a little googling, and found one forum posting where someone was kind enough to answer the solution to the problem.
The root of the problem was that GoDaddy requires me to sort of register my custom nameservers' IP address with them before they can be used as nameservers for my domain. The way to register the IP addresses was to go to My Account->Manage Domains->Domain Host Summary (on the right column). The description in this section is not very helpful, and with its warning, I shyed away from it when I first saw it, but this is where the solution lies.
I clicked on the link to "Click to see details or modify", and added the nameserver and the IP address for both my new nameservers. After this, I went back to My Account->Manage Domains->Nameservers Summary to add the nameserver, and the nameserver information was correctly captured. I did a whois and a dig command to doouble-check and the nameservers were updated correctly. :)
- Maven Repo Search - Tue, 5 Jul 2005 01:57:59 -0400
- Was reading Carlos Sanchez's blog and came across this link he provided for a Maven Repo Search engine.
Very helper tool when there are now so many jars hosted at ibilio.org. However, maybe one improvement should be to also include links to the respective jars on the ibiblio repo in the search results.
- Getting Started with Maven2 - Wed, 22 Jun 2005 03:51:05 -0400
- Recently I had a little spare time between my crazy projects and I decided to start playing a little with Maven 2, or M2.
I downloaded both the binary and source versions of M2 and tried to follow the documentation at http://maven.apache.org/maven2/getting-started.html to get the hang of the new tool, since it is vastly different from the Maven 1 which I am more familiar with.
After I ran the line
m2 archetype:create -DgroupId=com.mycompany.app -DartifactId=my-app
to create a project skeleton, I tried the next command to run
m2 install
However, I was greeted with a "Error assembling JAR" from MojoExcecutionException (have yet to find out what a Mojo is, but it sounds a lot like what Austin Power talked a lot about). Puzzled, I tried to look at the source code of M2 to try to figure out a reason for the problem.
I found a jira issue on this (http://jira.codehaus.org/browse/MNG-393) which sounds a lot like my problem, but the person reporting it suspect it is something to do with his JDK version. I am running 1.4.2_04 still, so I was not sure if it was the cause of the problem.
After some time spent, and some attempts to rebuild M2 (learnt something else from this though), I finally realised I missed out one step. After running the archetype:create goal, I did not change directory into the "my-app" folder that was created. As I was not running m2 from a folder with a valid pom.xml, m2 was not able to find any config data and of course failed.
So the simple solution was to: follow the documentation to the dot. After a close inspection of the documentation, I found the line:
" Let's now change into the project's directory and try a few things...". So the only person to blame was myself. ;)
- TCP/IP problem on WinXP - Tue, 24 May 2005 13:49:34 -0400
- A client of mine asked me to help purchase an Acer Travelmate 3001 some time last week. Cool lightweight notebook with a nice display, something good enough for her. One week of smooth operations on the notebook, and suddenly today she gets the "Limited or no connectivity" on her wireless network connection systray icon.
Thinking it was simple problem that requires some releasing and renewing of ip, I asked her to do a repair on the connection, just to have the same problem coming back after the repair operation.
I tried to use fixed IP addresses, but that only allows me to perform pings to IP address that I know of. When trying to ping domain names, somehow all the DNS servers (regardless of which server I point to) do not return any results. Pinging a domain like www.google.com or yahoo.com will always result in a line like "Pinging oy at [IPaddress]", where the o is a degree sign.
nslookup does not return any results for any domain names requested too, and a command line ipconfig /renew yields "An operation was attempted on something that is not a socket".
Searching google suggests a few solution. The most authoritative one is from Microsoft, but since the notbook comes with its WinXP recovery disks and not the original WinXP installation CDs, I was not able to reinstall TCP/IP.
As a last resort, I tried the WinSock XP Fix tool, and luckily it worked fine for me. A reboot and the problem is gone.
Apparently the root of the problem was that some spyware messed up something on the notebook. Sigh, the things that people make with too much time on their hands, as it causes us to expend so much time to solve these problems. :(
- Running JAMES as a Windows Service - Thu, 12 May 2005 14:03:33 -0400
- I have been playing with Apache James recently to make use of the FetchMail functionality. One of the issues I have is that James is invoked from the command line console and I needed to run it as a Windows Service in my target deployment environment. Luckily, I found this post where someone shared the use of Wrapper.exe found in the James distribution.
In case the post is removed in future, I am repeating the command here.
To install the service
Wrapper.exe -i ..\conf\wrapper.conf
To uninstall the service
Wrapper.exe -r ..\conf\wrapper.conf
- Oracle causing Eclipse to raise exception when starting - Wed, 6 Apr 2005 21:42:13 -0400
- Recently I pick up the project that required me to play with Oracle again. Being very unfamiliar with Oracle (I am more familiar with MSSQL and MySQL), I took some time to figure out a lot of things that do not work properly with my copy of Oracle.
I installed a copy of Oracle 9i in my development machine, and realised that I have problem starting Eclipse. In the beginning I did not realise that Oracle was the root cause of the problem, as the symptom was that upon starting Eclipse, an exception was raised (I cannot remember, but I think it was a simple "An error has occurred, please see log file" dialog box from Eclipse) and logged into the log file as:
!SESSION Apr 06, 2005 16:38:56.855 ---------------------------------------------
eclipse.buildId=M200503110845
java.version=1.3.1_01
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
!ENTRY org.eclipse.osgi Apr 06, 2005 16:38:56.855
!MESSAGE Error registering XML parser services.
!STACK 0
java.lang.ClassNotFoundException: javax.xml.parsers.SAXParserFactory
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Luckily a quick google search shows that many others have had the same problem. The reason was that Oracle modified the path variable and puts the 1.3.1_01 jdk version in front of whatever JDK version I was running, and I guess Eclipse requirements a later version than 1.3.1_01.
The solution given by a kind soul (cannot remember which site I got this from) is to make the following changes to the shortcut used to start Eclipse:
D:\eclipse3.0.2\eclipse.exe -vm %JAVA_HOME%\jre\bin\javaw.exe
This effectively tells Eclipse to use the JVM at %JAVA_HOME% instead of the one specified in the path.
- Converting from CVS to SVN using cvs2svn - Tue, 5 Apr 2005 05:45:44 -0400
- Have been using Subversion for a few months on some of my projects and it has been quite a good experience. Thankfully the folks at tigris.org wrote the convenient tool cvs2svn to make conversion from CVS to SVN a breeze. Recently I followed the steps in the documentation to convert a whole CVS repository to SVN and was able to continue work within a few hours on the new SVN repository.
Today, I planned to move one remaining project I have that is running on a CVS repository to my SVN repository, so I thought it is a good idea to blog the steps I go through for future reference.
The project to be moved is one module amongst a number of other modules I have in the CVS repository.
Step 1: Making copies of my CVS and SVN repositories
I made a filesystem copy of my /cvsroot folder to /cvsroottemp. For SVN, I did a svnadmin dump /svnrepos --incremental > repos.20050405.dumpfile to dump the svn contents to a dump file. I suggest you stop both the CVS and SVN processes before performing the backups.
Step 2: Running CVS2SVN on the CVS repository
Before running cvs2svn, the required packages like python 2.0 needs to be installed on the machine (see cvs2svn documentation for more information). Running the CVS2SVN on the CVS repository basically means running the following line:
cvs2svn --fs-type=fsfs /svnfromcvs/ /cvsroottemp/my_project_module
The fs-type parametere creates a filesystem type svn repository. I prefer this to the default Berkeley DB repository.
The cvs2svn script will run a number of passes to create the necessary files. The first 7 passes are pretty fast, but the last pass where each svn commit is processed takes a while, depending on the length of history in your repository.
Step 3: Verifying the new svn repository contains the correct files
To verify the files, I run the command to serve the new svn repository using the svn protocol:
svnserve -d -r /svnfromcvs --listenport 9999
The port is an arbitrary port I use, it is up to you to assign your own ports.
After svn is running, I connect to the svn repository to check the files:
svn list svn://localhost:9999/trunk
The listed files should be the same as those in the original project from the CVS repository.
If I intend to host the SVN repository using the new /svnfromcvs folder, I can now make the necessary configuration to host either through svn:// protocol or through Apache (which should be discussed in another post.)
Step 4: Dumping the svn from /svnfromcvs into a dump file
I dump the contents of /svnfromcvs again into a dump file.
svnadmin dump /svnfromcvs --incremental > new.dumpfile
Note: Somehow I think the 8 passes in cvs2svn could have one of the passes creating the dumpfile I need in this step anyway. However, I was too lazy to go and figure out how the passes work.
Step 5: Load the new.dumpfile into the existing svn repository
I issued the following command:
svnadmin load /svnrepos < new.dumpfile
and regretted immediately! Basically what this command did was to replay the commits in the dumpfile to my /svnrepos folder, but without the "module" name! This causes my /svnrepos tree to contain folders for the rest of the modules and also the /trunk /branches and /tags folders for the new project.
I did not want to reverse the change, so I have to do some damage control in the following steps to make the folder structure right. However, you can try something like this
svnadmin load /svnrepos/new_project_module_name < new.dumpfile
And let me know if all works well.
Step 6: Start SVN and connect to the repository as normal
This step is self explanatory. For me, after I started SVN, I had to do the usual svn move to right the wrong I did in Step 5.
Generally these should be the steps to convert from CVS to SVN. Feel free to give me you comments on this. :)
|
|