Win a copy of Mastering Corda: Blockchain for Java Developers this week in the Cloud/Virtualization forum!

Gobind Singh

Ranch Hand
+ Follow
since Aug 04, 2006
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 Gobind Singh

I've been thinking about picking up a functional programming language like Scala.
However since the introduction of Lambdas in Java 8, I'm trying to decide whether it might be best to stick with Java 8 and learn to use Lambdas.
In comparison with scala, which do you think is easier to learn and use?
6 years ago
will this book be useful for a developer looking to become an architect?
7 years ago
The following seems to work:
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name = "connectionInitSqls">
<list><value>PRAGMA foreign_keys = ON</value></list>
</property>
...
</bean>
8 years ago
Anyone had any success in getting sqlite and spring working with foreign key support enabled? By default foreign key support is disabled in sqlite. The documentation at http://www.sqlite.org/foreignkeys.html mentions that you have to enable it for each database connectiion separately. I am sure that the version of sqlite I have got supports foreign keys (downloaded it only last week).

to test: If I key in PRAGMA foreign_keys; I get back 0. Which means foreign keys is switched off but support for it exists.

My datasource is defined in spring as :

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="${jdbc.driverclass}"/>
<property name="url" value="${jdbc.url}"/>
</bean>
How do I enable foreign keys through spring configuration?
8 years ago
As part of my build process, I need to produce a set of DTD's.
Is there an ANT task which tells me if a DTD file is valid i.e well-formed?
8 years ago
I have a struts 2 application which has many JSPs that display a list of results on the screen.
The process is as follows:

DisplayCriteriaForm: - This action class simply goes to a JSP that displays some fields on the screen for the user to enter
DisplayResultsAction - This action takes the request parameters from the JSP mentioned above and displays the results by querying the database and returning a collection
ValidationSelectionAction - The idea is the user can select one of the results returned and this action simply validates if one of the checkboxes was selected. If nothing was selected I want to remain on the same page (i.e. the results jsp) with a actionError at the bottom saying "please select a item".

The problem I have is that ValidationSelectionAction needs to have access to the list of results the DisplayResultsAction had retrieved from the Database so it can redisplay the same page upon encountering an actionError. The only way I can do it at the moment is to store the results in the HTTPSession object so that ValidationSelectionAction can retrieve them and return them in a getter method.

While this solution does work, it is not scalable due to the heap being utilized with HTTPSession. In a multi-user environment it is known to crash the system when the sessions gets too full. There are many J2EE best practices that I have seen that also say not to overuse the session. But no-one has mentioned alternatives.
Is there anyway to pass complex data between actions without using the session? Are there any other frameworks that handle this responsibiity for you out there?
11 years ago
I am trying to determine if there is any advantages/disadvantages between using the followingg approaches to populate a collection.

Firstly doing pass-by-reference:

Collection col = new ArrayList();

populateCollection(col);


//carry on using col in someway

....
...

public void populateCollection(Collection c)
{
//add to the collection
}


Or is it better to do the following:

Collection d = populateCollection();

//carry on using col in someway

....
...

publiic Collection populateCollection()
{
Collection col = new ArrayList();
//add stuf to col
}

11 years ago
Is it because the value you are passing to setMaxInactiveInterval() is in milliseconds but it expects it in SECONDS. So it will take longer to expire. Try converting your milliseconds to seconds before passing to the setMaxInactiveInterval() method.
13 years ago
ok guys you have confused me. All I want to be able to do is read something in the WARs Manifest.MF file and display it on the JSP.
13 years ago
JSP
I have a link on every page of my web app called "About". Clicking on this link brings up a pop up which shows the details of all the developers who contributed to the development of this webapp.

I want to be able to show the version of the webapp too. The only thing is that the version changes each time a deployment is done.

One possible option is let the ant build script modify the about.jsp file (at build time) that shows the version number by doing a token replace using the version number from the repository (SVN).

But that would mean that the about.jsp has changed and I have to check it into the version control system again.

I dont want to do this. Is there anyway I can read the version information from the Manfiest file in the war and show it on the JSP?
13 years ago
JSP
Thanks,

I will try what you suggested.
13 years ago
I have a requirement to create a DAT file from data that I have already read in a java.sql.ResultSet.

I need to be able to write the data out to a .DAT file using the below format. (I am not a C programmer so I dont know how these type defs works)

typedef struct tagEntRecord
{
unsigned long code;
unsigned short pack_size:14;
unsigned short price_change:2;
unsigned short trade_price;
unsigned short retail_price;
char description[39];
char width;
}EntRecord


Can anyone explain to me how to go about doing this?
13 years ago
Thanks, I followed your suggestion and found some good examples.
Hopefully I will be able to incorporate them into my webapp.
13 years ago
The printer is on another server.
13 years ago
You need to write some sort of clever javascript to invalidate the session on browser kill. Have a look at this forum: http://forum.java.sun.com/thread.jspa?threadID=537660&messageID=2640996
13 years ago