problem:
i am running ant 1.6.5 and using the scp task. When the task starts, it stops responding, breaking the rest of my ant build in the process. Sometimes the task transfers one file (out of a few 100) and hangs.
solution:
From doing a bit of research i found out that some versions of the library required by this task - jsch - cause ant build to hang. The trick is finding a version of this lib which works with your version of ant.
I know that jsch version 0.1.29 works with ant 1.6.5.
get jsch-0.1.29.jar here
Tuesday, June 26, 2007
Tuesday, June 19, 2007
css problems
Ive gotta write this stuff down before i forget it all:
problem:
z-index does not work. div with a higher z-index is getting overlapped by a div with lower z-index
solution:
one of the divs need to have this set -> position:absolute;
problem:
i need IE and Firefox styles on the same style sheet using a hack
solution:
#someId {
/* IE can only see this rule, IE uses this rule */
position: relative;
top: -15px;
}
html>body #someId {
/* Firefox can see this rule, rule overrides previous rule */
position: relative;
top: 25px;
}
problem:
i want to change the position of a div, lift it up by 100 pixels
solution:
there are 2 ways to do this,
margin-top:-100px;
or
position:relative;
top:-100px;
these have slightly different results, and i should try both.
problem:
z-index does not work. div with a higher z-index is getting overlapped by a div with lower z-index
solution:
one of the divs need to have this set -> position:absolute;
problem:
i need IE and Firefox styles on the same style sheet using a hack
solution:
#someId {
/* IE can only see this rule, IE uses this rule */
position: relative;
top: -15px;
}
html>body #someId {
/* Firefox can see this rule, rule overrides previous rule */
position: relative;
top: 25px;
}
problem:
i want to change the position of a div, lift it up by 100 pixels
solution:
there are 2 ways to do this,
margin-top:-100px;
or
position:relative;
top:-100px;
these have slightly different results, and i should try both.
Thursday, May 24, 2007
UNIX: get the last modified file in a dir
problem:
i need a command that will tell me the last modified file or dir
solution:
ls /the/dir/ -1 -t | head -1
i need a command that will tell me the last modified file or dir
solution:
ls /the/dir/ -1 -t | head -1
Tuesday, April 24, 2007
teamsite: passing parameters from javascript to perl
Teamsite (the evil abomination called software it is) allows the unfortunate souls using it to call perl scripts for javascript and pass parameters to the perl script.
the syntax looks something like this:
var params = new Object();
params.val = "some string";
var server = window.location.hostname;
IWDatacapture.callServer("http://"+server+"/iw-bin/somescript.ipl",params);
problem:
sometimes the params dont carry over correctly from javascript to the perl script, ie, all params have values in the javascript, but on the perl script side, they have no values - ""
the problem manifests if you do this:
when you assign the params in this way:
var params = new Object();
params.val = SomeFunctionWhichReturnsAString();
now chances are that params.val = "" in the perl script.
solution:
this problem stinks of pointers. params.val is set given a reference to something in the javascript heap, when perl takes over, that references points to nothing. Either way, this is how you get around it:
var params = new Object();
params.val = SomeFunctionWhichReturnsAString()+"";
now everything works. why? well... because teamsite is evil.
the syntax looks something like this:
var params = new Object();
params.val = "some string";
var server = window.location.hostname;
IWDatacapture.callServer("http://"+server+"/iw-bin/somescript.ipl",params);
problem:
sometimes the params dont carry over correctly from javascript to the perl script, ie, all params have values in the javascript, but on the perl script side, they have no values - ""
the problem manifests if you do this:
when you assign the params in this way:
var params = new Object();
params.val = SomeFunctionWhichReturnsAString();
now chances are that params.val = "" in the perl script.
solution:
this problem stinks of pointers. params.val is set given a reference to something in the javascript heap, when perl takes over, that references points to nothing. Either way, this is how you get around it:
var params = new Object();
params.val = SomeFunctionWhichReturnsAString()+"";
now everything works. why? well... because teamsite is evil.
Friday, April 20, 2007
links i enjoy lately
bunch of links which i have been finding useful:
bunch of music
addictive game
hit counter for this blog
cool pictures/art?
lastly, google mp3 quick search link for firefox:
location:
http://www.google.com/search?q={-inurl:(htm|html|php) intitle:%22index of%22 %22last modified%22 %22parent directory%22 description size (wma|mp3) %22%s%22}
keyword:
m
addictive game
hit counter for this blog
cool pictures/art?
lastly, google mp3 quick search link for firefox:
location:
http://www.google.com/search?q={-inurl:(htm|html|php) intitle:%22index of%22 %22last modified%22 %22parent directory%22 description size (wma|mp3) %22%s%22}
keyword:
m
Friday, April 13, 2007
Teamsite: IWDataDeploy FAILED TDbSchemaSynchronizer create failure

Interwoven Teamsite is the worst piece of software i have ever used, and googling its errors gives you 0 hits. I am going to do the world a favor and change that!
Problem: I needed to deploy DCT data to the table which teamsite uses for its own record keeping. The file which takes care of this deployment is called AREA_dd.cfg where area is the name of the DCT. After making sure that teamsite is using the correct db info, and that all fields i was deploying existed i was getting the error: IWDataDeploy FAILED, where the root cause might have been:
(from the log in OD_HOME/OpenDeployNG/log/iwddd_something.log)
DBD: SELECT * FROM USER_TABLES WHERE TABLE_NAME='IWTRACKER'
DBD: Table [iwtracker] exists.
DBD: DEFAULT__DEVICE__MAIN_STAGING not registered
DBD: Error occured in TDbSchemaSynchronizer
DBD: ERROR:TDbSchemaSynchronizer create failure.
(DEVICE is the name of my DCT)
Solution:
This solution is a hack, but it works. Open the database you are trying to commit to from teamsite, and run the following SQL query:
INSERT INTO IWTRACKER (NAME) VALUES('DEFAULT__DEVICE__MAIN_STAGING');
COMMIT;
where instead of 'DEFAULT__DEVICE__MAIN_STAGING' put the thing which the previous error claims is not registered. Save the DCT again and tail the log, the deployment should succeed. (if it fails, you are probably screwed because the support is terrible and the documentation is teh suck)
edit 11/6/2009: I no longer use teamshite, so please dont ask me any questions about this evil thing, i wont know the answers.
Friday, April 06, 2007
Find and replace with VI
this will replace all occurrences of match_pattern in the file
:g/match_pattern/s//replace_string/g
alternatively, you can use ' : ' instead of ' / ' to make path (/) slashes easier to manage (no escape (\) character needed)
:g:match_pattern:s::replace_string:g
:g/match_pattern/s//replace_string/g
alternatively, you can use ' : ' instead of ' / ' to make path (/) slashes easier to manage (no escape (\) character needed)
:g:match_pattern:s::replace_string:g
Monday, March 26, 2007
Using EL in custom tags as attributes
Problem:
I was working on a custom tag and i needed to pass it a bean from a JSP page kind of like this:
<customtag var="${somebean.something.else}">
I realized that what i was getting inside my custom tag was a String, not my bean.
Solution:
You need to use the ExpressionEvaluator to evaluate the expression, and get the bean, here is the code i used in my SimpleTag: (i was getting a Date object by the way)
Edit Aug 7, 2008:
It has come to my attention that in jsp 2.0 the EL expressions are evaluated before being passed to the custom tags, so you dont need to do any of this crap anymore.
I was working on a custom tag and i needed to pass it a bean from a JSP page kind of like this:
<customtag var="${somebean.something.else}">
I realized that what i was getting inside my custom tag was a String, not my bean.
Solution:
You need to use the ExpressionEvaluator to evaluate the expression, and get the bean, here is the code i used in my SimpleTag: (i was getting a Date object by the way)
Edit Aug 7, 2008:
It has come to my attention that in jsp 2.0 the EL expressions are evaluated before being passed to the custom tags, so you dont need to do any of this crap anymore.
Tuesday, March 20, 2007
how to make .so files load in unix
Ive had this problem too many times and so i should blog the solution. The problem usually looks something like this: You try to run something and you get an error screaming about failing to load some file ending in .so
example:
failed: Can't load '/app/teamsite/iw-perl/site/lib/auto/DBD/Oracle/
Oracle.so' for module DBD::Oracle: ld.so.1: perl: fatal: libnnz10.so: open failed: No such
file or directory at /app/teamsite/iw-perl/lib/DynaLoader.pm line 229.
solution:
All these .so problems seem to be have a common solution. You need tell unix where to look for your libraries. This is how you do it.
crle -c /var/ld/ld.config -l /usr/lib:/your/directory/where/the/so/files/are:/another/lib/path
Important: if you remove the /usr/lib part from the Default Library Path, shit will hit the fan.
Use this at your own risk.
example:
failed: Can't load '/app/teamsite/iw-perl/site/lib/auto/DBD/Oracle/
Oracle.so' for module DBD::Oracle: ld.so.1: perl: fatal: libnnz10.so: open failed: No such
file or directory at /app/teamsite/iw-perl/lib/DynaLoader.pm line 229.
solution:
All these .so problems seem to be have a common solution. You need tell unix where to look for your libraries. This is how you do it.
- Figure out where your application has its .so files. Usually this is in a directory called lib, and it usually contains more then one .so file.
- You need to become root, and run this command:
- crle
- write down everything which is output, because if you break things you will need to go back to this. On solaris 10 this is the important piece which has to always be in the output: Default Library Path (ELF): /usr/lib
- Now we need to add our library locations to the Default Library Path, run this as root:
- crle -c /var/ld/ld.config -l /usr/lib:/your/directory/where/the/so/files/are
- exit root
crle -c /var/ld/ld.config -l /usr/lib:/your/directory/where/the/so/files/are:/another/lib/path
Important: if you remove the /usr/lib part from the Default Library Path, shit will hit the fan.
Use this at your own risk.
Wednesday, March 14, 2007
Flash in IE6 xml compression problem
Problem:
There seems to be a problem with flash player running on IE6 loading XML files from a web server which has compression enabled. It seems like the XML is never decompressed correctly, so whatever flash that is using it breaks. Everything seems to work fine if you use firefox or IE7 to access the same flash swf. I found one page talking about this problem, right here:
http://blog.mediacatalyst.com/pivot/entry.php?id=281
Solution:
First let me say, that on our servers the XML was generated by a JSP, so i had a bit more control over html headers and such. This is what i did to solve this problem:
There seems to be a problem with flash player running on IE6 loading XML files from a web server which has compression enabled. It seems like the XML is never decompressed correctly, so whatever flash that is using it breaks. Everything seems to work fine if you use firefox or IE7 to access the same flash swf. I found one page talking about this problem, right here:
http://blog.mediacatalyst.com/pivot/entry.php?id=281
Solution:
First let me say, that on our servers the XML was generated by a JSP, so i had a bit more control over html headers and such. This is what i did to solve this problem:
- Set Cache-Control HTML header to nothing ("")
- Set Pragma HTML header to nothing
- Make sure that the XML file had the XML declaration as the very first thing in the file
- Set the JSP page content-type to text/xml
Thursday, March 08, 2007
How to backup firefox plugins
I needed to back up my plugins to install the DOM inspector, which requires a firefox reinstall. Here is how to back up the firefox plugins:
C:\Documents & Settings\USERNAME\Application Data\Mozilla\Firefox\Profiles\
there are directories in there
copy those out to save them
then.... after you reinstall, copy them back and run "firefox -profilemanager"
and create a "NEW" profile using the directory you just copied
It works cross platform also... put the stuff on a jumpdrive and have the same profile in Linux and Windows
source: www.jacobsylvia.com
C:\Documents & Settings\USERNAME\Application Data\Mozilla\Firefox\Profiles\
there are directories in there
copy those out to save them
then.... after you reinstall, copy them back and run "firefox -profilemanager"
and create a "NEW" profile using the directory you just copied
It works cross platform also... put the stuff on a jumpdrive and have the same profile in Linux and Windows
source: www.jacobsylvia.com
Friday, February 16, 2007
How To: Implement RMI from scratch
The java.lang.reflect.Proxy class will let you provide an arbitrary implementation for an interface.
So, start with that on the client. Figure out how to produce a factory for interface objects. Understand how the proxy invocation works.
Then, create a socket connection to the server. Wrap it with an ObjectInputStream/ObjectOutputStream.
Now you need to define a protocol between client and server. For example, let's say that the client sends an integer object ID, followed by a method name, followed by an array of parameters. The server needs to find the object, and invoke the appropriate method. Then it needs to send the result back to the client.
Then you can get into distributed GC ...
source: java dev forums
So, start with that on the client. Figure out how to produce a factory for interface objects. Understand how the proxy invocation works.
Then, create a socket connection to the server. Wrap it with an ObjectInputStream/ObjectOutputStream.
Now you need to define a protocol between client and server. For example, let's say that the client sends an integer object ID, followed by a method name, followed by an array of parameters. The server needs to find the object, and invoke the appropriate method. Then it needs to send the result back to the client.
Then you can get into distributed GC ...
source: java dev forums
Friday, February 09, 2007
JSP: custom tag to modify its body
This is a skeleton of what is needed to build a custom jsp tag which does something to its body. For example a tag could change the urls of all the links found in its body.
make a file called CustomTag.tld and put it into WEB-INF:
use it like this on your JSP:
<%@ taglib uri="com.mycompany.CustomTag" prefix="x"%>
<x:ct>
here is some stuff inside the tag!
<c:out value="${someparam}"/>
</x:ct>
make a file called CustomTag.tld and put it into WEB-INF:
use it like this on your JSP:
<%@ taglib uri="com.mycompany.CustomTag" prefix="x"%>
<x:ct>
here is some stuff inside the tag!
<c:out value="${someparam}"/>
</x:ct>
How to make a redirect servlet
make a servlet which calls the following method on doPost() and on doGet()
Wednesday, February 07, 2007
improve eclipse performance in windows
this eclipse plugin forces windows keep eclipse in memory / reduces thrashing
http://suif.stanford.edu/pub/keepresident/
http://suif.stanford.edu/pub/keepresident/
UNIX: list what sudo permissions you have
> sudo -l
Password:
You may run the following commands on this host:
(root) /usr/local/apache/bin/
(root) NOPASSWD: /app/teamsite/iw-home/opendeploy/bin/iwsyncdb.ipl
(root) NOPASSWD: /etc/init.d/smb
(root) NOPASSWD: /usr/local/samba/bin
(root) NOPASSWD: /bin/vi /etc/group
(root) NOPASSWD: /usr/local/bin/top
(root) NOPASSWD: /bin/vi /etc/group
(root) NOPASSWD: /usr/bin/ls
(root) NOPASSWD: /usr/ucb/vipw
(root) NOPASSWD: /usr/local/bin/top
(root) /bin/tail
Password:
You may run the following commands on this host:
(root) /usr/local/apache/bin/
(root) NOPASSWD: /app/teamsite/iw-home/opendeploy/bin/iwsyncdb.ipl
(root) NOPASSWD: /etc/init.d/smb
(root) NOPASSWD: /usr/local/samba/bin
(root) NOPASSWD: /bin/vi /etc/group
(root) NOPASSWD: /usr/local/bin/top
(root) NOPASSWD: /bin/vi /etc/group
(root) NOPASSWD: /usr/bin/ls
(root) NOPASSWD: /usr/ucb/vipw
(root) NOPASSWD: /usr/local/bin/top
(root) /bin/tail
Javascript: matching with regex
There seem to be 3 ways to use regular expressions in javascript:
1.
var val = document.getElementById("some_id").value;
val.replace(/^\s+|\s+$/g, ""); //trim using regex
2.
var alpha = /^[A-Za-z]+$/ ;
var val = document.getElementById("some_id").value;
if(alpha.test(val)){
//val matches alpha
}
3.
1.
var val = document.getElementById("some_id").value;
val.replace(/^\s+|\s+$/g, ""); //trim using regex
2.
var alpha = /^[A-Za-z]+$/ ;
var val = document.getElementById("some_id").value;
if(alpha.test(val)){
//val matches alpha
}
3.
var val = document.getElementById("some_id").value;
var alpha ='((?:[a-z][a-z]+))'; // Word 1
var p = new RegExp(alpha,["i"]);
var m = p.exec(val);
if (m.length>0)
{
var word=m[1];
//word is the capture group 1
}if anyone knows a better way, feel free to share.
Monday, January 29, 2007
NoClassDefFoundError: com/sun/mail/util/SharedByteArrayInputStream
problem:
when trying to send mail i get error: NoClassDefFoundError: com/sun/mail/util/SharedByteArrayInputStream
solution:
get mail.jar and put it on your classpath
http://java.sun.com/products/javamail/downloads/index.html
when trying to send mail i get error: NoClassDefFoundError: com/sun/mail/util/SharedByteArrayInputStream
solution:
get mail.jar and put it on your classpath
http://java.sun.com/products/javamail/downloads/index.html
Friday, January 26, 2007
Java: find nested balanced tags
Problem:
I needed to parse out some divs from a html page, and java's regex cant do it. atleast when you have arbitrary number of nested balanced elements.
Solution:
Use at your own risk.
I needed to parse out some divs from a html page, and java's regex cant do it. atleast when you have arbitrary number of nested balanced elements.
Solution:
Use at your own risk.
Tuesday, January 16, 2007
UNIX: dd trick to speed up disk access times
This was stolen from the Lucene mailing list as a strategy to warm up an IndexSearcher:
Something like dd if=/path/to/index/foo.cfs of=/dev/null
Basically, force the data through the kernel preemptively, so FS caches it.
Run vmstat while doing it, and if the index hasn't been cached by the FS, you should see a spike in IO activity while dd is running.
source: (something in the middle of the thread)
http://www.gossamer-threads.com/lists/lucene/java-user/43418
Something like dd if=/path/to/index/foo.cfs of=/dev/null
Basically, force the data through the kernel preemptively, so FS caches it.
Run vmstat while doing it, and if the index hasn't been cached by the FS, you should see a spike in IO activity while dd is running.
source: (something in the middle of the thread)
http://www.gossamer-threads.com/lists/lucene/java-user/43418
Subscribe to:
Posts (Atom)