Win a copy of The Career Toolkit this week in the Jobs Discussion forum!

Harsha Pherwani

Ranch Hand
+ Follow
since Jul 11, 2005
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
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Harsha Pherwani

Ah I thought it was something like that, but I just couldn't see the round brace, it seemed like a curly brace to me!

thanks!
Harsha
Moving my question to the correct forum -


Hi,

I am going through the OCA Exam from the CD included with Kathy and Bates's OCA / OCP Java SE 7 Study guide.





This question has me confused - A is one of the valid answers but I believe option B is valid too, apparently it isnt. I am unable to figure out why! (I think its probably something very simple that I am unable to see - maybe its not a curly brace?).

Thanks in advance!
Harsha


Thanks David. I got the ServletContext instance from ServletActionContext and it works as I want it to.
Thanks!
11 years ago
Hi all,

In the action class, I would like to access the images folder located in the application alongside WEB-INF.
The directory structure looks like this -

Tomcat -> webapps -> app
-> images
-> jsp
-> WEB-INF

Is there a struts api that gives me the absolute path till the application?

Thanks!
Harsha


11 years ago
Hi All,

I would like to validate the integrity of the session before any action is invoked. I am presently creating an application with Struts2 and Tiles.

A couple of years ago when I had used Struts1 and Tiles, I was able to extends a TilesRequestProcessor class before an action mapping was processed.

What is the right way to do something similar with the new Struts framework?

Appreciate your help!

Thanks,
Harsha
11 years ago
Thanks Jim!

I created a dummy cleaner thread in case a command in the pipeline does not expect an input. This would just keep reading the input stream so that the output connected to it does not block. And it works beautifully
13 years ago
Thanks for your response Joe.

This means whether a command can be piped to or not, I have to make sure the Piped reader end is somehow emptying the pipe contents.
13 years ago
Hello,

I am implementing the unix shell pipe feature in java.
These are multi processed pipes that are connected with the java pipe streams. Only if the commands expect to use an input stream (like more, grep etc.) then then read from it else commands like ls etc that do not need the i/p stream ignore it and just write to the output stream provided (std out / piped output).

The problem I'm facing now is that if ls output is huge (if the final string is about 2000+ characters), then while flushing to the piped output stream, my code hangs. This is the case only when ls is being piped to a command that does not read input.

So ls | more works fine but ls | alias does not since alias not not read the input stream that ls is writing to.

Is there a limitation to the number of bytes that can be written to the piped output stream that is not being read? Is there an easier solution to this?

If anyone has faced this issue before or knows the right way of handling this, please do let me know.

Appreciate your help.

Harsha
13 years ago
Has anyone resolved this issue of the naming convention? I am facing a similar situation now.

Here is my code in JSP:
<%@ page contentType="application/vnd.ms-excel" %>
<% response.setHeader("Content-Disposition", "attachment; filename=\"abc.xls\""); %>

When this code is executed, an open save dialog box opens up. If I hit save, it saves my file correctly as "abc.xls" BUT if I hit open, it opens the excel file with name "abc[1].xls" and the sheet name is ".xls]abc[1]".
Due to this, when user hits save on the excel sheet, it fails saying there shouldn't be any special characters like "[", "]". User has to now rename the file to save it (which I dont want).

This issue is only with IE. I'm using IE6 version currently. Firefox opens and saves it correctly.

If anyone can throw some light as to what I should do to resolve this and have the file name be correct as specified with the trailing numbers ans brackets and not have the user to rename the file and then save, it'll be great!

Thanks in advance.

Harsha
13 years ago
Yes Edwin. I wanted all dates (either as date objects or as strings) between 2 date objects.

I spent some time on it, doing it the hard way (long code but does it all), and then found an easy way to do it! Heres the easy code.

while (!calStart.equals(calalEnd)) {
// Add the date/cal to a list object
// add 1 day to the calStart.
}

I realise now, Calendar.add does it all for you! (The roll over between the month and the year.)

Thanks Jeff.
14 years ago
Hi All,
I have 2 dates as input (start and end). I need to generate a list of all dates in this range.

Does anyone have the code for this?
Any help is appreciated!

Thanks in adv.
14 years ago
Hi,
We have a web application designed using MVC framework. Besides a web view, we now need to support mobile users using WML.

We are considering JSF and struts (customising struts to handle WML client).
I have read that JSF supports disparate clients efficiently using RenderKits.

Can anyone suggest whether JSF has an easy to use WML RenderKit. How does a renderkit work? Is there any good documentation online?

Thanks,
Harsha
14 years ago
JSF
Or does anyone know how to use the CaseFragment stmt (which I am assuming is for Case when stmt) using the criteria API ?
Hi,
I have to implement a SQL query (with case when stmt) in HQL.
HQL documentation says that HQL supports the case when statement.
But when i converted the query to HQL, it gives me errors ..

Here is the query:
select prod,
case when length(prod.category) > 0 then prod.category
when length (prod.iTax.icCategoryId) > 0 then
(select pt.portalPcategoryName from Products p join p.iTax ic join ic.pim pim join pim.pT pt where pt.portals.portalId = ortalId and p.productId = prod.productId) end as category
from Products prod where prod.clients.feedId = :feedId and prod.deadUrlLink = :bln1 and prod.active = :bln2

==========================================================
The exception i receieve is :
org.hibernate.hql.ast.QuerySyntaxError: unexpected AST node: query
==========================================================

This query works correctly in postgresql.
Can someone point out where I am going wrong.
Thanks a lot.

Harsha