Lou Pelagalli

Ranch Hand
+ Follow
since Nov 11, 2003
Cows and Likes
Cows
Total received
1
In last 30 days
0
Total given
0
Likes
Total received
5
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 Lou Pelagalli

Hi Guattam,

Thank you for your prompt reply!

Unfortunately I don't see how that's done. Can you give me some instructions please?

Thanks,

Lou
Hi All,

I'm trying to install the Glassfish 4 plugin to Eclipse Luna. http://marketplace.eclipse.org/content/glassfish-tools-luna#.U8HhVrFllZo

I drag the install icon to my Eclipse window and I get

Cannot open Eclipse Marketplace

Cannot install remote marketplace locations:
Connection failed

This is most often cause by a problem with your internet connection. Please check you internet connection and retry.

I'm connected just fine. Is there something I need to do, like install Eclipse Marketplace?

Thanks,

Lou

Thanks Jeanne that's the results I got too.
6 years ago
Hi All,

I hope I don't annoy too many people with this post. I'm looking for a specific J2EE Tutorial. I have searched the web for several hours over the last several days without success. I last saw it just a couple of years ago my then life got in the way and I didn't get to complete it.

It covered the basics of file servers (mysql), web servers (Tomcat), and servlets using the localhost. It used database eMotherEarth and provided the setup and for all parts. The database initiation and load was provided so a person would use the real data. It centered around a retail application where you could purchase eMotherEarth compnents: trees, volcanoes, oceans, etc., view your shopping cart, add change or delete shopping cart items, and check out.

I thought is was an excellent, simple, and clearly written tutorial well designed for a beginner. If anyone could provide a link to it I would greatly appreciate it.

Thanks,

Lou Pelagalli
6 years ago
Hi Knute,

I still get the same message when installing java_ee_sdk-7-jdk7-windows-x64.exe.

First I uninstalled j2ee and j2se.

Then I installed jdk-8u5-windows-x64.exe

Next I set up my environment variables

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\Owner>ECHO %JAVA_HOME%
C:\Program Files\Java\jdk1.8.0_05

C:\Users\Owner>WHERE JAVA
C:\Program Files\Java\jdk1.8.0_05\bin\java.exe

C:\Users\Owner>

Successfully tested Hello World with Eclipse.

Then tried to install java_ee_sdk-7-jdk7-windows-x64.exe.
and got the same message
Error: Could not find the required version of the Java(TM) 2 Runtime Environment in '(null)'

Why would it think the JRE is null?

Thanks,

Lou
6 years ago
Hi Knute,

I think you're on to something.

Here's the result after changing the path variable.

C:\Users\Owner>where java
C:\Program Files\Java\jre8\bin\java.exe
C:\Windows\System32\java.exe

C:\Users\Owner>

I noticed that I actually have two path variables, one Environment and the other System. Apparently the System variable is use first because when I first moved it from Environment it still showed up in Windows/System32, so I moved it again to the first variable in System Path.

I am going to uninstall everything I installed and start over. I don't know what to do about C:\Windows\System32\java.exe.

Thanks,

Lou
6 years ago
Hi,

I have installed and tested j2se jdk8 u5 on my Windows 7 64 bit laptop and successfully tested in Eclipse with a quick Hello World.

JAVA_HOME = C:\Program Files\Java\jdk1.6.0_25

When I try to install j2ee jdk7 sdk7 I get

Error: Could not find the required version of the Java(TM) 2 Runtime Environment in '(null)'

Can someone please tell me what I have missed?

Thanks,

Lou
6 years ago
Hi Junilu,


1. Do some research on double checked locking. Start here: http://en.wikipedia.org/wiki/Double-checked_locking#Usage_in_Java . Again, I have to question why you even have to worry about things like lazy initialization at this point. This is premature optimization. Try to stop doing it. It's the root of all evil (per Donald Knuth).
2. Converter class violates the Single Responsibility Principle. You mix concerns of converting with concerns of formatting. Leave formatting out of it.
3. Code is not very object-oriented. Note that if you follow advice in #2, you will be left with no "internal state" for the Converter class. And all the "knowledge" about conversions is actually kept outside of the Converter class. This code is leaning more towards Functional Programming than Object-Oriented Programming.



1. Ok.
2. Ok.
3. I agree the converter is a function. Servlets are coming.

Thanks,

Lou
7 years ago
Hi All,

I finally got a couple of simple conversions working properly. Had trouble with BigDecimal.divide(BigDecimal) scaling the decimal points correctly. Seems that if you don't have the BigDecimal.scale(int) set correctly the divide method returns the numerator - ick.

Junilu wrote

Maybe you could show your proposed XML for defining the factors you'd use for converting Fahrenheit to Celcius and vice versa. What about the XML for converting Kelvin, Rankine, and all the other temperature scales listed here: http://en.wikipedia.org/wiki/Comparison_of_temperature_scales#Comparison_of_temperature_scales? Then, when you have that, show some sample code that would use the objects you deserialize from that XML. Would that code have a lot of conditional statements and checks for specific classes of conversions? If it does, then it's smelly, brittle code. That would be my point. Hope this helps clarify my ramblings a little.



All the code is posted below, with the exception of simple-xml-2.7.jar. I tried to upload it all in a zip file but that's not allowed.

MeasurementTest.java is the main class.

Feedback would be appreciated.

Winston wrote

Please DontWriteLongLines. It makes your thread very hard to read.



No long lines Winston, max = 80 characters, but I can't figure out how to get Eclipse to use 62 characters.

Thanks,

Lou

MeasurementTest.java


MKSFactors3.xml


Converter.java


Measurement.java


Scheme.java


Category.java


Conversions.java

7 years ago
Hi Junilu,

Not sure what you mean by that first part. Dimensional analysis aside, reciprocals are a pretty straightforward concept. Unless you tried to use multiplication both ways (thus yielding a correct result in only one direction), you should get correct results both ways using the same number: multiply by it one way, divide by it going the other way.



That's exactly what I meant - trying to use reciprocal multiplication in both directions.

Using units allowed for the input to decide when to do the conversion and provided correct results in both directions with a single process.

Less code = less stink!

Lou
7 years ago
Hi Richard,

I can't see the logic in that !



The only logic I have in that is that it works for temperature, but you're right it is arbitrary.

As long as all the other units are relative to the base unit then it doesn't matter.

Maybe I'll make it grams for Weight and Mass, that's about in the middle. But I think for Winston's suggestion to work,

F/C = ((C/F + 40) * K) - 40

, for temperature the base would have to be Kelvin.

Lou
7 years ago
Richard, Junilu and Winston,

Here's what I learned.

Richard's and Junilu's posts about reciprocals are more about units than the mathematical definition of reciprocals, which produced correct results in one direction only.

(Value / fromMks) = units, then (units * toMks) yields the correct results in both directions.

Winston's temperature formula will work with units too.

The only thing is that you need to choose your "base" unit fairly carefully.



Yes Winston, and you're temperature formula proves that. With that information I have decided that the base units should be the smallest unit available for a measurement. Except I'm not going to get into "atomic mass unit (amu)" because my head hurts enough already, and that would yield some rather massive results for the larger units.

I earned my first cow working on this project!

Thanks to all who replied!

Lou



7 years ago
Thank you again Jeanne!

I have a cow!
7 years ago
That was easy, thanks Internet Detective Marshal Jeanne!

Posting my test code and result below in case anyone cares.

Note that the default number of decimal places for NumberFormat.getInstance() is 3.

That can be changed with NumberFormat.setMaximumFractionDigits(int).

In my case
BigDecimal bd = new BigDecimal("00000123456.7891234541000");
NumberFormat nf = NumberFormat.getInstance();
nf.setMaximumFractionDigits(bd.scale());

Thanks,

Lou



Result
fieldValue.toString() = '123456.7891234541000'
fieldValue.toPlainString() = '123456.7891234541000'
fieldValue.toEngineeringString() = '123456.7891234541000'
Formatted bd = '123,456.7891234541'
7 years ago