tangara goh

Ranch Hand
+ Follow
since Dec 27, 2009
I am a beginner in Java and hope to pick up the trade secrets so that I can move on to Android development
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
0
Total given
101
Given in last 30 days
1
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by tangara goh

I have problem in getting the solution for this question :


Given a list of strings, return a list where each string has "y" added at its start and end.

moreY(["a", "b", "c"]) → ["yay", "yby", "ycy"]
moreY(["hello", "there"]) → ["yhelloy", "ytherey"]
moreY(["yay"]) → ["yyayy"]



And here's my attempt so far :



I am stuck as I can't define a Sting first and then using index of before using sub string...

Am not I trying hard enough ?

Hope someone can give me some hints...

Tks.
17 hours ago
I keep getting the above error from Tomcat log even though I checked and re-checked I have everything in the right place.

The custom tag library tld file is created in a folder name tlds and it is inside WEB-INF, so where have I done not correctly ?


This was included in the jsp page where there is a red x at a line which need to made use of the custom tag.




I really hope someone can point out any blind spot that I can't see.....

Thanks again.
1 week ago
JSP
Today, the project which I have been working on in Netbeans ide for quite sometime is gone after I re-set the windows as the navigational pane gone awry.

The problem is that I do not know where netbeans store the project which I have imported from a zip file.

Can someone tell me where is the location so that I don't have to start all over again?

Many thanks.

1 week ago
I hope I am posting at the right place because this has to do with Expression Language in jsp.

Basically, I am getting this error below :


"${sessionScope.LoginUser !=null && LoginUser.role ='user' }" contains invalid expression: javax.elException: Unable to find ExpressionFactory of type: org.apache.elExpressionFactoryImpl



Now, I googled and found the solution as per https://stackoverflow.com/questions/17314384/tomcat-7-javax-el-elexception

However, I couldn't find any version behind el-api jar inside Tomcat.

And I am not sure where to download el-api impl jar since I do not know the version of el-api jar that I have in my Tomcat - 9.0.30.

Hope someone can advise me. Tks.

1 week ago
Hi,

I went thru the below link :

https://docs.oracle.com/cd/E19879-01/819-3669/bnbyb/index.html

and there is this part which completely baffled me:

If your server certificate is self-signed, you must install it in the Application Server keystore file (keystore.jks). If your client certificate is self-signed, you should install it in the Application Server truststore file (cacerts.jks).



Can someone explain what is a self-signed certificate ?  Do I need to install it at server end will do ?  I will be using Tomcat and most likely try Amazon for hosting.

Tks.
1 week ago

Sherin Mathew wrote:There is a deprecated source map syntax in a JavaScript source.

JavaScript sources are often combined and minified to make delivering them from the server more efficient. With source maps, the debugger can map the code being executed to the original source files.

The source map specification changed the syntax due to a conflict with IE whenever it was found in the page after //@cc_on was interpreted to turn on conditional compilation in the IE JScript engine. The conditional compilation comment in IE is a little known feature, but it broke source maps with jQuery and other libraries.



Hi Sherin,

Does that mean that I can ignore this 'error message' ?  I am using firefox running in Windows OS....Tks.

Stephan van Hulst wrote:I have a lot of questions.

You say you're browsing though someone's project. It is not your project? Are you working on somebody else's project? Are you forking a project?

Why do you think the issue is related to jQuery? What makes you think upgrading will help? What version are you using? What version do you want to migrate to?




Hi,

As mentioned, the web developer tool told me I need to upgrade it...

Using //@ to indicate sourceMappingURL pragmas is deprecated. Use //# instead
While going thru some of the layout etc in someone's project, I notice this line.




And then I learnt that I may need to upgrade to higher or latest version.

But, googling thru this https://github.com/jquery/jquery-migrate/#readme I am still clueless.

I hope someone can guide me how to do the migration properly.

Should I just copy the js query 1.4.1 and past it onto the existing js and then run and build it before the copy the latest version js onto the existing jquery.js in my project ?

Tks.

Paul Clapham wrote:

tangara goh wrote:My plan (correct me if I am wrong) :

After that, if you run into other problems then come back and post again. Actually you might want to post back and ask about your design first before trying to write code for it.



Thanks Paul.

Actually, I forgot to mention I tried to test it out using a hardcoded path but of course it isn't effective because if this is deployed then the way it is done is not very robust.

I am changing my code to read in the Path and File, but I am stuck now in setting the outputStream to String.



I understand that toByteArray() is already deprecated but I can't find any alternative.

Could you let me know how to go about doing that part to convert it to ByteArray() ?

Thanks for your help in advance.
2 weeks ago

Jj Roberts wrote:The error message tells you what the issue is; getProperty() is an instance method, so you can only call it on an instance of Properties. You are trying to call it on the Properties type, i.e. call it as a static method.



Thanks Robert, I managed to get problem resovled with your help.

Could you help me out on the problem which I have posted in :

https://coderanch.com/t/731509/java/converting-String-Image-rendered-JSTL

My problem now is that I am not sure how to use the Part and path where my images reside, which is basically in my C:\UserName\ where it will accept anything that is PNG or JPEG.

I want it to use it with InputStream to upload it to location in my properties file.

Could you let me know how to accomplish this part ?

Thanks alot for your help in advance.
3 weeks ago
Basically, I am trying to tell the servlet to read a image file and point it to a location in my app.properties.

My plan (correct me if I am wrong) :

I have a servlet which read in the image from my computer drive and then upload it to the location in my app.properties which point it to a folder in the WebContent and then insert the path to the database.

So, after that, when I want to retrieve it, I will read back the path and let the image appear in another jsp.

But, I am getting an error message :


The error message is :


Cannot make a static reference to the non-static method getProperty(String) from the type Properties





I am suspecting it is the wrong library - import java.util.Properties;

Can someone tell me where have I gone wrong ?

Tks a million
3 weeks ago
I have a variable in my POJO class String photo.

I need it read from a folder in a file and then appear in the JSTL of a jsp page as well as insert into the database.

My problem is that I am not sure what are the API to use and the steps to accomplish the above.









I am getting the image rendered in the jsp using jstl as well as how to use it to store it into the database.

Should I use Base64 to encode the String first and store it into database and then set the decoded uploadedpath to String photo ?

Hope someone can guide me how to.  Tks.
3 weeks ago
Hi,

I came across many projects from github that are using ant to do build and deployment.  And I am totally lost.  I have watched youtube tutorial on how to use ant but still I am lost.

Could someone tells me what's the reason these info below are declared in private.properties ?  The author is using netbean and I am using Eclipse so is it necessary for me to use the below or is it ok that I deleted this file away? cos I am using external tomcat as a server.



Also, I am totally lost how to intrepret the below infor....

My question is if I am going to use maven, can I delete the below, as I see that it doesn't contain any dependencies library...



tks.

1 month ago

Junilu Lacar wrote:Why in the world would you declare a numSorted parameter and then as one of the first things you do, reassign 1 to it? What's the point of having a numSorted parameter if you do that?



Oyeah...thanks for highlighting to me cos your explanation mentioned that numSorted can be at any index right ? and if I were to declare as 1 then it defeat the whole purpose of the Algorithm..right ?

But, how do the computer figure out numSorted is at which index ?

Sorry...I am getting more confused now...
2 months ago

Junilu Lacar wrote:I'll try to explain by way of examples:


I'll give you a chance to work through this on your own and if you still don't understand it, maybe giving you the answer will be more helpful.



Thank you for explaining the above to me.  I took a peek at someone's answer and modified as follows :


The code that I reference wrote :


and he did not add this line : numSorted = 1;

So, if possible, I'd appreciate if you could let me  know any difference between the 2 ways that was written cos the result is the same.

2 months ago