Sergeonclear

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Thursday, July 24, 2008

Struts Magic

Posted on 5:04 AM by Unknown
Had a recurring problem in struts app - passing attributes from one action to another by forward is getting lost, here is a solution :
redirect="true" should solve the issue.
http://strutscollections.blogspot.com/2008/02/action-chaining.html

Read More
Posted in struts magic | No comments

Tuesday, July 22, 2008

Speed typing tips.

Posted on 1:57 PM by Unknown
Here
are a some basic tips, summarized from various typing tutorials and
lessons. These tips are useful for taking tests as well as everyday
keyboarding:
  • Tap on each key crisply but lightly. If you use minimum force (don't bang on the keys), your fingers will move faster.
  • Type as quickly as you are able, but don't "try" too hard or force your speed or you'll make many mistakes.
  • Relax!
  • Use proper posture, sit upright.

  • Keyboard/monitor positioning: your wrist, elbows and keyboard should be
    on the same horizontal plane, and at a 90 degree angle to your upper
    arms.
  • The top of your screen should be near eye level.
  • Stretch your wrists and fingers before starting a typing test (don't laugh, it does help!).
Ref: http://www.calculatorcat.com/typing_test/
Read More
Posted in Speed typing tips. | No comments

Friday, July 18, 2008

I love log4j

Posted on 4:43 AM by Unknown

Logging is a very useful thing. Without this most of our java softwares are like black boxes.
The major problems we face is setting up the log4j. Also trying to decipher the cryptic clues is annoying, like say log4j WARNING No appenders could be found. Who has time to fix these issues..
Well it pays of well if you fix it as I said u cant fix a software problem without seeing what is happening inside. It will be like the movie HAPPENING(Should have been what is happening) ...


A few tricks to get the log4j setup:
Passing VM arguments
-Dlog4j.configuration=file:C:/development/projects/webapp/target/classes/log4j.properties

-Dlog4j.debug=true .....Excellent option to know what is happening inside log4j.


commonly used log4j.properties is below:
---------------------------------------------------------------------------------------------
log4j.rootLogger=debug, stdout, R

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout

# Pattern to output the caller's file name and line number.
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n

log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=example.log

log4j.appender.R.MaxFileSize=100KB
# Keep one backup file
log4j.appender.R.MaxBackupIndex=1

log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
-----------------------------------------------------------------------------------------

More log to come here...

Ref: http://logging.apache.org/log4j/1.2/manual.html
Read More
Posted in log4j setup useful | No comments

Tuesday, July 15, 2008

Print request object using JSTL

Posted on 3:09 AM by Unknown



<p>Headers</p>
<c:forEach var="hdr" items="${header}">
<table bgcolor="lightgreen">
<tbody>
<tr>
<td>
<c:out value="${hdr.key}">
</c:out>
</td>
<td>
<c:out value="${hdr.value}">
</c:out>
</td>
</tr>
</tbody>
</table>
</c:forEach>


<p>Attributes:</p>



<c:forEach var="attr" items="${pageContext.request.attributeNames}">
<table bgcolor="lightgreen">
<tbody>
<tr>
<td>
<c:out value="${attr}"> </c:out>
</td>
</tr>
</tbody>
</table>
</c:forEach>


<p>Parameters</p>



<c:forEach var="pmtr" items="${pageContext.request.parameterMap}">
<table bgcolor="lightgreen">
<tbody>
<tr>
<td>
<c:out value="${pmtr.key}"> </c:out>
</td>
<td>
<c:out value="${pmtr.value}">
</c:out>
</td>
</tr>
</tbody>
</table>
</c:forEach>

Read More
Posted in | No comments

Monday, July 14, 2008

Working with microsoft DLL,ODBC connection and IIS for a java developer

Posted on 8:12 PM by Unknown
DLL's are dynamic link library. They are like .jar files in java.
Normally the error we get in dll's are due to dependency on other dll's. Tools like dependency walker and dll explorer come for the rescue.

To register a dll use(like loading jars to JVM)
regsvr32 [DLL path]

also
rundll32 [dll path]

IIS
  • IIS is web server provided by microsoft.
  • For the IIS we need to configure the components.
  • For this, go to control panel-- admin tools --computer mgmt --component services -- computer--my computer -- COM+ applications -- new application --Add users and imports ...Thats it the IIS will pick it up...

To unit test a package in the dll create a x.vb file with the below code:

set testobj = nothing
set testobj = createobject("IMPORT.Job")

msgbox "PR: " & testobj.PathRemoved("C:\development\miscellaneous\COM\testmdb")

if(testobj.DeleteFile ("C:\development\miscellaneous\COM\test.mdb"))Then
msgbox "Deleted your file!"
End if



--------------------------------------------------------------------------------------------------------------
Oracle connection through microsoft:

update \oracle\product\10.2.0\client_1\NETWORK\ADMIN\tnsnames.ora
Go to control panel-- datasourc(ODBC) connections --add new connection in first tab.Select database name and auth details.Do a test connection. Thats it

-----------------------------------------------------------------------------------------------------------------

I need to set a number of environment variables via a bat file currently I m executing as below.
The user environment variables are updated but I want to set the system ones, what do I have to do.
Also when I try to add paths to the path variable I get an error
@echo on
setx IT_CONFIG_DOMAINS_DIR=C:\Program Files\IONA\etc\domains
setx IT_DOMAIN_NAME=BankWorld
setx IT_LICENSE_FILE=C:\Program
Files\IONA\etc\Orbix_licenses.txt
setx IT_PRODUCT_DIR=C:\Program Files\IONA
setx PATH=%PATH%;C:\Program Files\IONA\bin;C:\Program Files\IONA\asp\6.3\bin
pause
:end
pause

How about using the -m switch?
setx IT_CONFIG_DOMAINS_DIR=C:\P
rogram Files\IONA\etc\domains -m
setx path "%path%;c:\new directory"



Using Cygwin
Where is my windows drive? Ans: inside cygdrive<br />bash$ cd C:/Windows<br />bash$ pwd<br />/cygdrive/c/Windows</pre><br /><b>IIS<br />Changing the default port:<br /></b><table class="list ol"><tbody><tr><td class="number"><small><small></small></small></td></tr><tr><td class="number"><small><small></small></small></td></tr></tbody></table><small><small>Microsoft Internet Information Services versions 4.0 to 6.0</small></small><script type="text/javascript">loadTOCNode(2, 'moreinformation');</script><table class="list ol"><tbody><tr><td class="number"><small><small>1.</small></small></td><td class="text"><small><small>Open Internet Service Manager or Internet Information Services (IIS) Manager.</small></small></td></tr><tr><td class="number"><small><small>2.</small></small></td><td class="text"><small><small>If necessary, expand the Web server that you want, and then expand <b>Web Sites</b>.</small></small></td></tr><tr><td class="number"><small><small>3.</small></small></td><td class="text"><small><small>Right-click the Web site that you want to change.</small></small></td></tr><tr><td class="number"><small><small>4.</small></small></td><td class="text"><small><small>Click <b>Properties</b>.</small></small></td></tr><tr><td class="number"><small><small>5.</small></small></td><td class="text"><small><small>Click the <b>Web Site</b> tab.</small></small></td></tr><tr><td class="number"><small><small>6.</small></small></td><td class="text"><small><small>Change the TCP Port Number in the <b>TCP Port</b> edit box (or click <b>Advanced</b> for multiple Port settings).</small></small></td></tr><tr><td class="number"><small><small>7.</small></small></td><td class="text"><small><small>Click <b>OK</b> to save the changes.</small></small></td></tr></tbody></table><br />Ref:<br /></div><small>Environment variable excellent reference : http://www.wilsonmar.com/1envvars.htm<br />IIS port change ref: http://support.microsoft.com/kb/149605<br /><br />IE browser issues<br />Having made a web application live, the user logoff action doesn't actually log off in IE. It works fine on firefox.. So the problem is obviously with the browser. Crap the microsoft IE doesn't handle caching well inspite of setting the pragma in the head tag. You need to put it in the bottom of the page as well.<br />Put the following in top and bottom under html tag<br /><pre><br /><head><br />   <meta http-equiv="cache-control" content="max-age=0, must-revalidate, no-cache, no-store, private"><br />   <meta http-equiv="expires" content="-1"><br />   <meta http-equiv="pragma" content="no-cache"><br /></head><br />

Here is the fix.
http://support.microsoft.com/kb/222064/

http://www.vbaccelerator.com/insprob.htm







Read More
Posted in microsoft ODBC oracle dll connection issues | No comments

Saturday, July 12, 2008

linux mysql setup quick start

Posted on 5:23 PM by Unknown
To summarize ,

3306 default port of mysql

Login as root.

Start the database: /etc/rc.d/init.d/mysqld start

Databases located in: /var/lib/mysql/
Default config file installed by RPM: /etc/my.cnf

The first task is to assign a password:

[prompt]$ mysqladmin -u root password 'new-password'

Create a database: (Creates directory /var/lib/mysql/bedrock)

[prompt]$
mysqladmin -h localhost -u root -ppassword create bedrock
(or use SQL command: CREATE DATABASE bedrock;)

Add tables, data, etc: Connect to database and issue the following SQL commands:

[prompt]$
mysql -h localhost -u root -ppassword
...
mysql>
use bedrock; - Define database to connect to. Refers to directory path: /var/lib/mysql/bedrock
mysql>
create table employee (Name char(20),Dept char(20),jobTitle char(20));
mysql>
DESCRIBE employee; Shutting down the database:

[prompt]$
mysqladmin -u root -ppassword shutdown - PREFERRED
OR
[prompt]$
/etc/rc.d/init.d/mysqld stop
OR
[prompt]$
service mysqld stoplt;/b> mysqladmin -h localhost -u root -ppassword create bedrock

Ref:
http://www.yolinux.com/TUTORIALS/LinuxTutorialMySQL.html
Read More
Posted in linux mysql, linux mysql setup quick start, setup quick start | No comments

Wednesday, July 9, 2008

Maven - an expert .

Posted on 7:10 PM by Unknown

Basics
set MAVEN_HOME
mvn install
mvn clean install
mvn package -Dmaven.test.skip=true
mvn surefire-report:report mvnrepository.com
It downloads the repository to c:\Documents and Settings\[USER]\.m2\repository

Intermediate
Setting up maven based projects into eclipse
Eclipse needs to find the Maven-downloaded jars for compilation.
Under Preferences > Java > Build Path > Classpath Variable M2_REPO should be set to ..\.m2\repository
Run mvn eclipse:clean --- dletes .class and .project files
mvn eclipse:eclipse --- creates .class and .project files using pom.xml (recursively)
Thats it.

Advanced
Steps to create an archetype project:

Use below to create a sample archetype meta project.
/>mvn archetype:create -DgroupId=[com.biomedcentral] -DartifactId=[archetype-spring-jar] -DarchetypeArtifactId=maven-archetype-archetype

Update the archetype [archetype-spring-jar]\src\main\resources\META-INF\maven\archetype.xml
Keep all the relevant resource in the [archetype-spring-jar]\src\main\resources\archetype-resources\... and update the archetype with its reference.

Install the archetype project itself:
/>mvn install

Now time to use this project generator:
mvn archetype:create -DarchetypeGroupId= -DarchetypeArtifactId= -DarchetypeVersion= -DgroupId= -DartifactId=


This is amazing...From an existing architecture u can clone yours ...

A sample command using above for spring hibernate is below:
#mvn archetype:generate -DarchetypeGroupId=com.webtide -DarchetypeArtifactId=maven-archetype-SpringJpa -DarchetypeVersion=1.0 -DgroupId=c
om.my.package -DartifactId=ImageLibraryCategoryManager

mvn org.apache.maven.plugins:maven-archetype-plugin:1.0-alpha-7:create -DgroupId=com.my -DartifactId=springmvc-hibernate-app -DarchetypeArtifactId=appfuse-basic-spring -DarchetypeGroupId=org.appfuse.archetypes

A bit on Maven Plugins:
1. maven-dependency-plugin : http://maven.apache.org/plugins/maven-dependency-plugin/
Very useful for copying dependency jars for a standalone app,etc.

Reference
:
http://mevenide.codehaus.org/ -- plugin for eclipse
http://maven.apache.org/guides/mini/guide-attached-tests.html

http://www.webtide.com/resources.jsp --samples
For springmvc-hibernate archetypes use http://docs.codehaus.org/display/MAVENUSER/Archetypes+List

http://maven.apache.org/guides/mini/guide-creating-archetypes.html


Debug maven : http://tech.puredanger.com/2009/02/25/maven-tips/

Read More
Posted in maven | No comments
Newer Posts Older Posts Home
Subscribe to: Comments (Atom)

Popular Posts

  • LinuxPerformance Tuning(apache,tomcat,linux) and related
    Web profiling -- HTTPAnalyzer -- -- YSlow --CSS,Javascript report , time/size measurement for individual component is good. -- F...
  • (no title)
    Hardware/Software stack:  iPhone 3Gs having iOS 5.1.1(latest as of today).  The Xcdode 4.2 failed to detect this iphone as it has support on...
  • Spring interceptor ordering
    SimpleUrlHandlerMapping uses a hashMap to hold the interceptors. Ordering can only be guaranteed by setting  order property.. By default it ...
  • SVN/ Subversion Tips and traps
    SVN could be tricky and waste a hell lot of time. Case Issue : Normally we run SVN server in linux. Our dev env will be in windows NT. Windo...
  • Liferay CMS/ web content management/ workflow/ staging
    Liferay out of the box has a web content management system. The web pages can mostly have these web content (articles) as web pages. The web...
  • Cobertura- junit coverage tool
    First, you need to add a task definition to the build.xml file. This top-level taskdef element specifies that the cobertura.jar file is i...
  • XSLT caching Transformers
     The usage of cached transformer objects is recommended here A sample implementation of CachingTransformerFactory is here The above code abs...
  • Rewrite rules in apache and IIS
    Well we can control how the server serves stuff to clients by defining rewrite rules. As servers are dumb, its important to explain well abo...
  • Real-Time Tracking and Tuning for Busy Tomcat Servers
    A very nice article which details on possible options for tomcat server monitoring to tweak its performance. http://www.devx.com/Java/Articl...
  • External Javascript from Java Servlets
    Copied from http://myappsecurity.blogspot.com/2007/01 Like to thank anurag for the content. /breaking-same-origin-barrier-of.html External ...

Categories

  • AJAX javascript
  • All about UK Visa HSMP VS H1
  • All about UK Visa HSMP VS H1 hsmp assistance
  • amazon
  • android apps ship control radio hindi
  • Apache 2.x setup Quick guide for Linux
  • apache commons configurator usage
  • apache commons usage
  • arsenals for developers
  • article
  • Batch script to load developer environment
  • Blind folded chess
  • Castor castor convert dtd to xsd
  • cloud comparision price
  • cloud comparison blog
  • cloud computing monthly price
  • cloud usage
  • Cobertura- junit coverage tool
  • Code generators
  • cron jobs expressions
  • cruisecontrol cruise control
  • debugging eclipse tips
  • developer tools
  • document library
  • easy mock jmock vs mocking java tdd
  • External Javascript from Java Servlets
  • fedora 9 lenovo 3000 n200 windows xp dual boot problem
  • Fire fox plugins and tweaks
  • Free PHP hosting
  • gods debris the religion war scott adams dilbert
  • google app engine
  • gwt javascript
  • hibernate second level cache
  • i18n locale localization internationalization spring liferay portlet locale
  • ibatis sybase mapping
  • image gallery
  • iphone apps bri8 apple
  • iphone shsh 3gs ipsw downgrade ifaith tinyumbrella ios5.1.1 to ios5.0
  • java
  • java JDBC
  • javascript junit testing
  • Javascript trouble shooting tool
  • Jboss overview
  • jmeter load testing custom java sampler javasamplerclient xml test
  • JNDI test JSP page
  • Joomla CMS
  • JProfiler setup jprofiler on linux
  • jquery IE AJAX issues
  • jquery spring AJAX
  • keyboard music java typing soothing notes auto suggest
  • liferay kids version
  • liferay web 2.0 java/j2ee
  • linux - the difference between hard and soft links
  • linux mysql
  • linux mysql setup quick start
  • Linux ssh autologin with putty
  • LINUX usefuls
  • linux)
  • LinuxPerformance Tuning(apache
  • log4j setup useful
  • lucene solr
  • mac m701 android skype not working crash
  • maven
  • maven cut reduce build time
  • microsoft ODBC oracle dll connection issues
  • Mobile Ad Services (adwhirl)
  • opsourcecloud
  • oracle connect by hierarchy
  • oracle table previlege
  • Oracle thin vs OCI(type II/thick) drivers
  • pdf 2 text
  • Pega PRPC
  • php
  • rackspacecloud
  • Rewrite rules in apache and IIS
  • scaffold
  • setting up a static ip on SKY broadband
  • setup quick start
  • Single Sign on - OpenSSO with Liferay
  • smart gwt
  • smtp email test mock server james
  • SMTP MAIL telnet windows
  • Software tools mind map freemind j2ee tools
  • Speed typing tips.
  • Spring + Hibernate Usefuls BaseDAOHibernate
  • Spring annotations with spring-mock not working 2.0 2.5.6
  • spring jndi datasource lookup
  • Spring portlet mvc and spring servlet mvc validation
  • Spyware trojan and virus removal tools
  • struts magic
  • SVN/ Subversion Tips and traps
  • tabbed ms dos console cygwin console
  • Texter - An auto text expander autotyper
  • Textpad tricks
  • The art of debugging
  • tomcat
  • Tomcat Exploded war - cut deployment time
  • Tomcat on linux tips
  • Tomcat on linux tips commands
  • TypeIt4Me
  • Typinator
  • Useful Eclipse Plugins
  • Useful Eclipse Plugins eclipse shortcuts keys
  • Useful tools
  • web content
  • xcode cocos2d iphone box2d
  • xpath xml xquery

Blog Archive

  • ►  2013 (19)
    • ►  August (17)
    • ►  July (1)
    • ►  January (1)
  • ►  2012 (7)
    • ►  August (1)
    • ►  June (4)
    • ►  April (2)
  • ►  2011 (20)
    • ►  November (1)
    • ►  October (1)
    • ►  August (1)
    • ►  July (3)
    • ►  June (1)
    • ►  April (2)
    • ►  March (4)
    • ►  February (1)
    • ►  January (6)
  • ►  2010 (27)
    • ►  December (3)
    • ►  July (2)
    • ►  May (3)
    • ►  April (2)
    • ►  March (5)
    • ►  February (10)
    • ►  January (2)
  • ►  2009 (32)
    • ►  December (5)
    • ►  November (2)
    • ►  September (3)
    • ►  August (6)
    • ►  June (4)
    • ►  May (4)
    • ►  April (3)
    • ►  March (2)
    • ►  February (3)
  • ▼  2008 (28)
    • ►  December (1)
    • ►  October (2)
    • ►  September (2)
    • ►  August (4)
    • ▼  July (7)
      • Struts Magic
      • Speed typing tips.
      • I love log4j
      • Print request object using JSTL
      • Working with microsoft DLL,ODBC connection and IIS...
      • linux mysql setup quick start
      • Maven - an expert .
    • ►  June (1)
    • ►  April (2)
    • ►  March (2)
    • ►  February (2)
    • ►  January (5)
  • ►  2007 (24)
    • ►  December (3)
    • ►  November (2)
    • ►  October (6)
    • ►  September (1)
    • ►  August (3)
    • ►  July (8)
    • ►  June (1)
Powered by Blogger.

About Me

Unknown
View my complete profile