Naseem Khan

Ranch Hand
+ Follow
since Apr 25, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
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 Naseem Khan

Hi Ranchers,

I am trying to configure Apache Webserver 2.2.6 on Windows XP machine.
I have a situation where my application lets my users to upload images into non-webroot folder (that is folder other than my apache webroot). So lets say my Apache Webroot is E:\Softwares\Apache2.2.6\htdocs and my upload directory is E:\uploads. For every user, my application (on the runtime) creates a folder (folder name will be same as that of user's profile id) inside E:\uploads\<new_folder>.

So lets say a user's profile id is : tom, then his images will be uploaded to the following directory

E:\uploads\tom\image1.jpg
E:\uploads\tom\image2.jpg
E:\uploads\tom\image3.jpg
E:\uploads\tom\image4.jpg
E:\uploads\tom\image5.jpg
E:\uploads\tom\image6.jpg

Question : How do I access these images using the http protocol?

I have done following R&D :

In the apache's httpd.conf file, I have done the following settings :

<Directory "E:/uploads">
AllowOverride All
Options Indexes
Order Allow,Deny
Allow from all
</Directory>


and under <IfModule alias_module> tag :

ScriptAlias /profile_images/ "E:/uploads/"

Restarted my apache, and I am tried to access the image as follows from the web browser :

http://localhost/profile_images/tom/image1.jpg

I am getting 403 Forbidden error :
You don't have permission to access /profile_images/tom/image1.jpg on this server.


Appreciate if anyone can please shed some lights onto this.

Thanks a lot in advance.
Naseem Khan
15 years ago
Hi,

Could anyone please tell me how to append the different excel sheets content in a single xls file.

I have different excel sheets and I want to write the records of all excel sheets in a single master.xls

I have tried writing it by apache POI, but it�s not appending the files in a single file rather it is updating the same master.xls with different input source xls file

Many Thanks,
Regards,
Naseem
[ September 12, 2008: Message edited by: Naseem Khan ]
Hi,

I have a requirement where I have to store files of following formats in oracle database as a Blob.

File Formats are: .txt, .rtf, .doc, .xls, .pdf, .gif, .jpeg, .png.

Technologies which I am using are flex, spring and hibernate. Backend is oracle with thin driver. System allows user to choose file from flex mxml page, it makes a HTTPService call to a servlet where I am getting inputstream object from the request.

Now my question is how do I use this inputstream object with blob.

I know if I can do it by writing simple jdbc code then I can do the same by hibernate.

Few ways which I found from google are:

1. insert a empty_blob() in that column,
2. load that column to get its pointer. Get it from ResultSet
3. Read byte from inputstream and write it in the outputstream pointing to the blob column.

I am able to write the data in the database column by above approach but not more than 3 kb. I don't know what is the problem. In my case file size is maximum 12 MB.

Second approach which I got from google is by class SQLUpdate. But it did not work.

Please help me guys.

Waiting for your reply

Rgds,
Naseem
[ August 26, 2007: Message edited by: Naseem Khan ]
Hi,

I am working on a application where I am using adobe flex. I have a requirement wher I have to upload file to the server. System allows user to browse file from local machine and flex uploads it to the server.

Now there is a upload url, its a jsp page which gets mutipart/form-data content from the request, opens an outputstream and writes the content of the inputstrem to the file.





Above jsp writes the content of browsed file to d:/naseem.txt

Problem which I am facing is besides the actual content, it also write something else.


Actual file:


My Text



upload txt file which I got:


------------cH2ei4GI3ae0KM7cH2GI3ei4ae0cH2
Content-Disposition: form-data; name="Filename"

test.txt
------------cH2ei4GI3ae0KM7cH2GI3ei4ae0cH2
Content-Disposition: form-data; name="author=Author"; filename="test.txt"
Content-Type: application/octet-stream

My Text
------------cH2ei4GI3ae0KM7cH2GI3ei4ae0cH2
Content-Disposition: form-data; name="Upload"

Submit Query
------------cH2ei4GI3ae0KM7cH2GI3ei4ae0cH2--




My question is how do I remove these content-disposition, content type i.e., extra things from my file. I need only content to be written in the file.

Regards,
Naseem
16 years ago

Originally posted by Eric Pascarello:
The problem is you are using a block element. A div is a block element so it has a line break after it. You need to use an inline element. Try a span. If that does not work than I have another idea.

For that you can use css float.

Eric



Hi Eric,

I have one more query. Now I want to rotate the same charater by 180 degree by css float which you are talking about.

For that do I have to write a css for that?

Regards,
Naseem Khan
Hi Eric,

I have one concern regarding HTML post on Javaranch. Most of the time I face problem in posting html tags on Javaranch. Is this problem related to parsing html tags? Even the suggestion, which it gives, is not very helpful.

In my case, it says replace < with & lt; (without internal space) which I did, but still it was giving the same error with the same suggestion. Next it says problem could be using name cookie. There is no cookie used in my html code.

Problem was actually with onload attribute of body tag which you pointed out.

I faced a problem in using html tags in xml file. There is a mail tag that I have to use in an xml file. That mail tag is having certain mailing attributes like from, to, cc, subject and body.

In the body attribute, we want to use html tags. Since it�s an xml file so I have to escape < in the xml. There what I did is I used [ in the xml file instead of < tag. Then in java code, I replaced all [ with < by regex pattern in order to get correct html code.

Why Javaranch is not having that flexibility in posting HTML codes?

Warm Regards,
Naseem Khan
Yeah, Thanks first with span it worked. I just changed my div tag with span.

Secondly as per your post I did the same by changing o of onload and then I am able to post my html tag.



[ July 12, 2007: Message edited by: Naseem Khan ]

[ July 12, 2007: Message edited by: Eric Pascarello ]
[ July 12, 2007: Message edited by: Naseem Khan ]
Hi,

Finally I am able to add code. Not fully because its not allowing me. I did all sort of rnd. Replaced all html tags with [ and ], then with { and }, < with and without internal space, but its not allowing html tags. Could be problem with attrbiute as well. I renamed all attributes.
Hi,

I want to rotate a character of an html text. Say in Javaranch, I want to rotate J by 180, then rest of the character as it is in the same line.

Currently what I am getting:

[Inverted j]
avaranch (comes in the next line)

By following code:



How to get the rest of the character in the same line instead of the next line?

Regards,
Naseem Khan

Edited: Code added
[ July 12, 2007: Message edited by: Naseem Khan ]

Originally posted by Gabriel Claramunt:
immediate="true" skips the validation step. Look at the JSF lifecycle.



Yeah its working fine now.

Rgds,
Naseem
16 years ago
JSF
Hi, I am using JSF with xhtml files. I am not able to perform validation on the form fields in JSF.

In my xhtml file , this is what I have written.



why there is no required validation when I submit the form. required attribute is set to true in the html text field.

Warm Regards,
Naseem Khan
16 years ago
JSF

Originally posted by Marilyn de Queiroz:
Are these html/jsp pages?



Yeah. These are jsp/xhtml pages. I thought, java thread could be one approach to achieve this. Thats why I posted it here.

I googled it and I got another way of doing this. Well, this is Java intermediate forum and this approach is based on browser's redirect feature.

I set META tag in the html title tag.



Rgds,
Naseem
16 years ago
Hi,

I am developing a module called forgot password where password is sent to the user entered email address. After user submits the forgotpassword page, password is sent to user email address by java mailing API.

In between I have a transition page with description that "we are sending your password to your email address. Please check your mail to get your password". Then user is redirected to login page.

Now I want some waiting time between the transition and login page. Login page should come up after the specified time. What would be the best way to do that?

One solution which comes in my mind is put current Thread in sleep state for some time.

Is this ok? Or should I go with JavaScript and call JavaScript inbuilt functions for the wait?

Warm Regards
Naseem Khan
16 years ago
Hi,

I need some help in handling application errors. I have a registration module in my application. Flow is something like this:

Register.xhtml calls RegistrationBean's register action method. This method calls a Helper class for inserting user records in the database.

Now if user entered record already exist in the database, unique constraint error I get from the oracle. This in turn throws org.hibernate.exception.ConstraintViolationException.

Now what I did so far is I caught this exception in my RegistrationHelper class, retrieved the facescontext, added a message in that and returns string "failure". Then my RegistrationBean class simply forwards to the configured failure page.




My question: Is it the right approach in handling exception using JSF?
16 years ago
JSF
Hi Tim,

So you mean to say that if I have to make a java call, I have to write a custom tag for that.

I was surprised to see that for the custom tags written by jBPM (different faclet tags), there is no tag handler class for that.

Warm Regards,
Naseem Khan
16 years ago
JSF