vijendra singh

Greenhorn
+ Follow
since Oct 31, 2006
geocities.com
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by vijendra singh

I need to map secondry elements with its matching primary elements if they both have same id.
How can this be achieved in xslt.
If ids are not matching then not a single element of secondry sholud be shown.
If ids matching, then other fields of secondry elements, should be mapped to similar fields of primary elements.
Eg: Its like some program running and in between some add on programs started (may be trailor or advertisement).
the add on program is not always shown (optional), and whenever shown it has its own data information etc etc.

Please provide me some input, how to map and proceed.


Not sure what this code is really doing.

<xsl:template match="SECONDARY_EVENT_LIST">
<xsl:variable name="secondaryElements" select="ancestor::SCHEDULE/SECONDARY_ELEMENT_LIST"/>
<xsl:for-each select="SCHEDULE_ELEMENT_ID">
<xsl:variable name="id" select="."/>
<xsl:apply-templates select="$secondaryElements/SCHEDULE_ELEMENT[(@ID=$id)]"/>
</xsl:for-each>
</xsl:template>

Is this having any relation with what my requirement is all about?
I have a situation here.
Want to bypass database connection if caching disabled. If caching found enable, only then try to establish a database connection.
One part of application should work when database is down as it doesn't require connection to database at all.
While other parts should throw exception when database connection not available.
the piece of code looks like this:


Now this code is working as per my requirement. for the time being.
But have two major problems to be solved here.

1) this piece of code :


is getting called in other class as well. i.e. inside this:

have initialise method. which internally calls this method:

Because StageAccessService is the real entry point for all other classes to access information about stage (staging). (So making StageConfig singleton, won't help me)

Now is there any way i can avoid :
this.stageConfig = new StageConfig(stage, channel, date);
getting called twice in my code.

why this is required is this method checks for caching real values.


2) Other workaround can be like: check if database connection is there or not. log the exception in catch block. but don't throw back.
So that the part which doesn't require database connection can work. But if request is not calling that part, then better throw exception also.

I don't know which approach is good in this case.

Can anyone suggest anything better then this.

Thanks.
VIJENDRA
13 years ago
In normal words the input xml does have NO tag with values in recursive order. So the structure, which shows the contents will be something like


Here i have shown only 1 level of recursion.
now after making this structure flat
we can expect the output to be shown in output xml as


But what i really need to modify is



and so on.

DO you think it is really possible.
Or by using any loop which can ignore real value of NO tag initially
and then we generate our own values and insert them in output xml.
Am i clear now.
YOu can ask me if any clarification required.
Hi starting form output values for NO tag what i normally get is :

and it goes on ...
this is coming directly from xml (input file ) to output after transformation.

Now what i need is to generate new numbers from 1 to n, so that i can put those numbers instead of this ugly looking structure which makes technically no sense.

Possibilities are replace orginal values (don't read from xml)
and put new values by yourself.(generating some values using loop or increment order or whatever feasible in xslt.)

Can you please provide me some help on this.
trying to generate values for NO tag like this:
<xsl:template name="SCHEDULE_ELEMENT">
<xsl:element name="SCHEDULE_ELEMENT">
<xsl:variable name="preceding_element" select="preceding-sibling::SCHEDULE_ELEMENT[1]"/>
<!--- something inside -->
<xsl:element name="NO">
<xsl:for-each select="SCHEDULE_ELEMENT_INFO">
<xsl:variable name="no" select="."/>
<xsl:apply-templates select="forloop"/>
</xsl:for-each>
</xsl:element>

Now for loop part:--

<xsl:template name="forloop">
<xsl:param name="no" select="1"/>
<xsl:param name="increment" select="1"/>
<xsl:param name="operator" select="'='"/>
<xsl:param name="testValue" select="1"/>
<xsl:param name="iteration" select="1"/>

<xsl:variable name="testPassed">
<xsl:choose>
<xsl:when test="starts-with($operator,'=')">
<xsl:if test="$no = $testValue">
<xsl:text>true</xsl:text>
</xsl:if>
</xsl:when>
<xsl:when test="starts-with($operator,'>=')">
<xsl:if test="$no >= $testValue">
<xsl:text>true</xsl:text>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:message terminate="yes">
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>

I know this is not the best way to get my answer.

Please suggest me something more proper.
Well you understood true.
I have NO tag with some different values (its a unique number always coming from some input xml file) but the xml file was having recursive structure, so after making it flat, the values of No tag are not quite in sequence. The values are may be like 1,2, 1,2,3, 1,5,6,7, 8,9,1,2,3 or so on. I just want a sequence to be followed, for that purpose i was trying to generate some loop with standard numbers. like 1,2,3,4,5,6,7,8,9
& so on. I have one more option, from input file, i can ignore getting the NO(Number) tag values and put my own.If it is possible.
Please suggest me.
In my xslt there is one condition with TAG called NO (generates some number everytime)
<xsl:element name="SCHEDULE_ELEMENT">
<xsl:variable name="preceding_element" select="preceding-sibling::SCHEDULE_ELEMENT[1]"/>
<xsl:element name="NO">
<xsl:value-of select="NO"/> </xsl:element>

But the number in xml comes very random like
1
1
3
1
5 or anything
now i need to generate a list of numbers,in creasing order from 1 to any (may be using for loop) the number of times this condition met. It can be any number of times.

and if it gets stored anywhere (in kind of buffer or so) the time NO tag ends it should go back to 0 or 1, so that for next xml, it won't create anything starting from, except 0 or 1.

I tried something like this:-

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:output method="xml"/>
<xsl:variable name="NO"></xsl:variable>

<xsl:template match="NO">
<xsl:param name="no"/>
<xsl:if test="$no = 1">
<!--to generate the next value-->
<xsl:for-each select="NO" >
<xsl:value-of select="NO + 1"></xsl:value-of>
</xsl:for-each>
<xsl:call-template name="for-loop">
<xsl:with-param name="no" select="1"/>
<xsl:with-param name="increment" select="1"/>
<xsl:with-param name="operator" select= "'='" />
<xsl:with-param name="testValue" select="1"/>
</xsl:call-template>
</xsl:if>
</xsl:template>

<xsl:template name="for-loop">
<xsl:param name="no" select="1"/>
<xsl:param name="increment" select="1"/>
<xsl:param name="operator" select="'='"/>
<xsl:param name="testValue" select="1"/>
<xsl:param name="iteration" select="1"/>

<xsl:variable name="testPassed">
<xsl:choose>
<xsl:when test="starts-with($operator,'=')">
<xsl:if test="$no = $testValue">
<xsl:text>true</xsl:text>
</xsl:if>
</xsl:when>
<xsl:when test="starts-with($operator,'>=')">
<xsl:if test="$no >= $testValue">
<xsl:text>true</xsl:text>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:message terminate="yes">
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
</xsl:template>


</xsl:stylesheet>

Please guide me to proceed further.

Vijendra
In my xslt there is one condition with TAG called NO (generates some number everytime)
<xsl:element name="SCHEDULE_ELEMENT">
<xsl:variable name="preceding_element" select="preceding-sibling::SCHEDULE_ELEMENT[1]"/>
<xsl:element name="NO">
<xsl:value-of select="NO"/> </xsl:element>

But the number in xml comes very random like
1
1
3
1
5 or anything
now i need to generate a list of numbers,in creasing order from 1 to any (may be using for loop) the number of times this condition met. It can be any number of times.

and if it gets stored anywhere (in kind of buffer or so) the time NO tag ends it should go back to 0 or 1, so that for next xml, it won't create anything starting from, except 0 or 1.

I tried something like this:-

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:output method="xml"/>
<xsl:variable name="NO"></xsl:variable>

<xsl:template match="NO">
<xsl:param name="no"/>
<xsl:if test="$no = 1">
<!--to generate the next value-->
<xsl:for-each select="NO" >
<xsl:value-of select="NO + 1"></xsl:value-of>
</xsl:for-each>
<xsl:call-template name="for-loop">
<xsl:with-param name="no" select="1"/>
<xsl:with-param name="increment" select="1"/>
<xsl:with-param name="operator" select= "'='" />
<xsl:with-param name="testValue" select="1"/>
</xsl:call-template>
</xsl:if>
</xsl:template>

<xsl:template name="for-loop">
<xsl:param name="no" select="1"/>
<xsl:param name="increment" select="1"/>
<xsl:param name="operator" select="'='"/>
<xsl:param name="testValue" select="1"/>
<xsl:param name="iteration" select="1"/>

<xsl:variable name="testPassed">
<xsl:choose>
<xsl:when test="starts-with($operator,'=')">
<xsl:if test="$no = $testValue">
<xsl:text>true</xsl:text>
</xsl:if>
</xsl:when>
<xsl:when test="starts-with($operator,'>=')">
<xsl:if test="$no >= $testValue">
<xsl:text>true</xsl:text>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:message terminate="yes">
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
</xsl:template>


</xsl:stylesheet>

Please guide me to proceed further.

Vijendra
how to add username , role , password to jboss the way we do in tomcat conf/tomcat-users.xml

i need to add <tomcat-users>
<role rolename="licensing"/>
<user username="licensing" password="admin" roles="licensing"/>
</tomcat-users>

to jboss
what i did is
in login-config.xml having content as
<application-policy name = "jmx-console">
<authentication>
<login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule"
flag = "required">
<module-option name="usersProperties">props/jmx-console-users.properties</module-option>
<module-option name="rolesProperties">props/jmx-console-roles.properties</module-option>
</login-module>
</authentication>
</application-policy>

<application-policy name = "web-console">
<authentication>
<login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule"
flag = "required">
<module-option name="usersProperties">props/web-console-users.properties</module-option>
<module-option name="rolesProperties">props/web-console-roles.properties</module-option>
</login-module>
</authentication>
</application-policy>

now i added in jmx-console-roles.properties
admin=admin
licensing=licensing,admin

and in jmx-console-users.properties
admin=admin
licensing=admin

same as this in web-console-roles.properties
admin=admin
licensing=licensing,admin

and in web-console-users.properties
admin=admin
licensing=admin

but not getting desired results with application which works well with tomcat.

any suggestions please.

vijendra
15 years ago
how to add username , role , password to jboss the way we do in tomcat conf/tomcat-users.xml

i need to add <tomcat-users>
<role rolename="licensing"/>
<user username="licensing" password="admin" roles="licensing"/>
</tomcat-users>

to jboss
what i did is
in login-config.xml having content as
<application-policy name = "jmx-console">
<authentication>
<login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule"
flag = "required">
<module-option name="usersProperties">props/jmx-console-users.properties</module-option>
<module-option name="rolesProperties">props/jmx-console-roles.properties</module-option>
</login-module>
</authentication>
</application-policy>

<application-policy name = "web-console">
<authentication>
<login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule"
flag = "required">
<module-option name="usersProperties">props/web-console-users.properties</module-option>
<module-option name="rolesProperties">props/web-console-roles.properties</module-option>
</login-module>
</authentication>
</application-policy>

now i added in jmx-console-roles.properties
admin=admin
licensing=licensing,admin

and in jmx-console-users.properties
admin=admin
licensing=admin

same as this in web-console-roles.properties
admin=admin
licensing=licensing,admin

and in web-console-users.properties
admin=admin
licensing=admin

but not getting desired results with application which works well with tomcat.

any suggestions please.

vijendra
15 years ago
Hi all,
My objective is to log only those contents which are really modified through update button, by comparing the previous existing contents from content list. If a person just go to edit page and without modifying anything he saves the page and comes out log should not do anything here. but whatever he modifies like name, content, description it sholud get compared with previously found data and modified content sholud get reported and logged to file system.
People says using thread in backgroud to compare objects can do this but will cost the speed of application and if you kill the deployed applcation at any stage process gets killed and logging will not take into effect.

Anyone have any better suggestion or any proper idea which is been implemented somewhere.

thanks
vijendra
[ August 03, 2007: Message edited by: Bear Bibeault ]
15 years ago
I don't have much idea whatis the real benefit i am going to get from WRM monitoring. I have got some jsp with very few lines of code. Here it is:-
1)appcheck.jsp contains

<FORM METHOD="Post" NAME="TestForm" ACTION="Test">
<TABLE class="maintable">
<TR>
<TD>
<%@ include file = "setup.jsp" %>
<%@ include file = "jboss_health_test.jsp" %>
<%@ include file = "showoutput.jsp" %>
</TD>
</TR>
</TABLE>
</FORM>

2) setup.jsp contains

<%@ page import = "com.ca.gis.util.*, com.ca.gis.ldap.dao.*, org.apache.log4j.Logger" %>
<%
//set values for getting connections
ApplicationContext appctx = new ApplicationContext(application);

//set up fields for tests
String email = "abc@xyz.com";
CAUserKey userKey = new CAUserKey();
userKey.setUserId(email);
CAUserModel userModel = new CAUserModel(userKey);
String currenttime = DateUtil.getSQLCurrentTime();
boolean allSuccessful = true;
String errors = "";
Logger logger = Logger.getLogger(this.getClass().getName());
%>

3)jboss_health_test.jsp

<%
out.println("SYSTEM TEST SUCCESS");
%>

4)showoutput.jsp

<%
if(allSuccessful)
out.println("SYSTEM TEST SUCCESS");
else
out.println("<!--" + errors + "-->");
%>


I don't know how much effective its going to be for getting info like:
A)I need to check if there is any problem with application while running.
B)I don't think it can give me info if jboss is really down as if server is not up application will also be down.

If someone have good idea on this please let me know
what are the major advantages of wrm monitoring.
can i do what i am really looking for.

send me any link any good lines of code using which something useful can be done here.

thanks
vijendra
15 years ago
need to filter data from log files and insert into xl sheet using POI? how Is there any interface between these two which can support this feature. Earlier i was getting data from database and one by one kept it in POI so that xl sheet can be generated easily, there resulset.getcolumn() helped getting data one by one. Now someone has filtered data using some logic and kept it in GUI format using TableModel i.e. javax.swing.table.TableModel; here it able to hold values easily. But i don't have option to use anything like TableModel. If anyone has worked on any similar stuff please suggest me something useful. any supporting API.
thanks.
vijendra
15 years ago
Hi I don't know how the Hibernate Filter works and how does it maintain cache.
But i would like to maintain cache for my application.
In Hibernate when i am using two different application using same database.there when i insert some value in table using hibernate(here i think it maintains some internal cache.)Now when i enter 2nd value(its generating some internal id [reading from and/storing to cahe])
Now when in second application using hibernate again i try to insert some third value to same table i doesn't permit to insert this new value(As what we are thinking here internal hibernate cache is having some conflict with these two self generated ids.)

Can this kind of problem be resolved if i seriously want to use hiberate cache mechanism.

the other thing is that if i create my own cache mechanism (not by hiberanete) maintenane or say the speed will vary as every time updating
values will upload and next time will be able to read from cache.

For big application the time will increase.


Any suggestions.

Thanks.
Hi I don't know how the Hibernate Filter works and how does it maintain cache.
But i would like to maintain cache for my application.
In Hibernate when i am using two different application using same database.there when i insert some value in table using hibernate(here i think it maintains some internal cache.)Now when i enter 2nd value(its generating some internal id [reading from and/storing to cahe])
Now when in second application using hibernate again i try to insert some third value to same table i doesn't permit to insert this new value(As what we are thinking here internal hibernate cache is having some conflict with these two self generated ids.)

Can this kind of problem be resolved if i seriously want to use hiberate cache mechanism.

the other thing is that if i create my own cache mechanism (not by hiberanete) maintenane or say the speed will vary as every time updating
values will upload and next time will be able to read from cache.

For big application the time will increase.


Any suggestions.

Thanks.
15 years ago