Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #15918 > unrolled thread

Updating code from jdk1.2 to recent jdk SE 1.6

Started bySanny <softtanks22@hotmail.com>
First post2012-07-10 10:07 -0700
Last post2012-07-11 15:15 -0700
Articles 20 on this page of 22 — 10 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  Updating code from jdk1.2 to recent jdk SE 1.6 Sanny <softtanks22@hotmail.com> - 2012-07-10 10:07 -0700
    Re: Updating code from jdk1.2 to recent jdk SE 1.6 Lew <lewbloch@gmail.com> - 2012-07-10 11:26 -0700
      Re: Updating code from jdk1.2 to recent jdk SE 1.6 Luuk <luuk@invalid.lan> - 2012-07-10 20:32 +0200
        Re: Updating code from jdk1.2 to recent jdk SE 1.6 Lew <lewbloch@gmail.com> - 2012-07-10 11:56 -0700
          Re: Updating code from jdk1.2 to recent jdk SE 1.6 Luuk <luuk@invalid.lan> - 2012-07-10 21:05 +0200
            Re: Updating code from jdk1.2 to recent jdk SE 1.6 Lew <lewbloch@gmail.com> - 2012-07-10 12:56 -0700
            Re: Updating code from jdk1.2 to recent jdk SE 1.6 Roedy Green <see_website@mindprod.com.invalid> - 2012-07-11 15:19 -0700
              Re: Updating code from jdk1.2 to recent jdk SE 1.6 Lew <lewbloch@gmail.com> - 2012-07-11 15:50 -0700
                Re: Updating code from jdk1.2 to recent jdk SE 1.6 Gene Wirchenko <genew@ocis.net> - 2012-07-11 16:41 -0700
                  Re: Updating code from jdk1.2 to recent jdk SE 1.6 Lew <lewbloch@gmail.com> - 2012-07-11 17:03 -0700
              Re: Updating code from jdk1.2 to recent jdk SE 1.6 Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2012-07-12 00:51 +0200
          Re: Updating code from jdk1.2 to recent jdk SE 1.6 Arne Vajhøj <arne@vajhoej.dk> - 2012-07-11 23:13 -0400
      Re: Updating code from jdk1.2 to recent jdk SE 1.6 Sanny <softtanks22@hotmail.com> - 2012-07-11 00:27 -0700
        Re: Updating code from jdk1.2 to recent jdk SE 1.6 Silvio Bierman <silvio@moc.com> - 2012-07-11 13:12 +0200
        Re: Updating code from jdk1.2 to recent jdk SE 1.6 Lew <lewbloch@gmail.com> - 2012-07-11 14:02 -0700
          Re: Updating code from jdk1.2 to recent jdk SE 1.6 Lars Enderin <lars.enderin@telia.com> - 2012-07-12 00:06 +0200
            OT Google Groups formatting.  Was Re: Updating code from jdk1.2 to recent jdk SE 1.6 markspace <-@.> - 2012-07-11 15:16 -0700
              Re: OT Google Groups formatting.  Was Re: Updating code from jdk1.2 to recent jdk SE 1.6 Lars Enderin <lars.enderin@telia.com> - 2012-07-12 11:00 +0200
                Re: OT Google Groups formatting.  Was Re: Updating code from jdk1.2 to recent jdk SE 1.6 markspace <-@.> - 2012-07-12 10:36 -0700
          Re: Updating code from jdk1.2 to recent jdk SE 1.6 Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2012-07-12 00:54 +0200
            Re: Updating code from jdk1.2 to recent jdk SE 1.6 Lew <lewbloch@gmail.com> - 2012-07-11 16:25 -0700
    Re: Updating code from jdk1.2 to recent jdk SE 1.6 Roedy Green <see_website@mindprod.com.invalid> - 2012-07-11 15:15 -0700

Page 1 of 2  [1] 2  Next page →


#15918 — Updating code from jdk1.2 to recent jdk SE 1.6

FromSanny <softtanks22@hotmail.com>
Date2012-07-10 10:07 -0700
SubjectUpdating code from jdk1.2 to recent jdk SE 1.6
Message-ID<725fbc58-fab7-4e70-9f1a-b2e393fdeca9@googlegroups.com>
Well I had a program/ Applet in Java 1.2 I want to migrate the code to Java 1.6

Will I see any benefit with the migration?

1st what are the things that I can use/ redesign for improvements?

Does compiling with a new version improve performance?

I want to use Vectors/ Search / Sort Algorithm/ etc.

Currently I put data in String.

Will it be faster if I define Classes instead?

Problem with classes is that searching/ copying an array of classes is very time consuming.

Every time a class is to be sent to a function a new class has to be created and all values need to be copied.

.clone() is also very time consuming.

Does the latest version of java has done something So that I can use Classes efficiently? 

Also String comparison and assignments are inefficient.

lastly will I be able to use setchar() in Strings? using Bufferstring is very problematic.

Sending String and Class Variables to functions is very time consuming.

Does new version of Java gives any good things for Applets? 

Can I use multilingual? Can I use 3d graphics in Java Applets?

==============

Topic Changed.

I want some way for my website visitors to automatically download java when not present in their system instead of them getting puzzled.

My web Visitors are very common people with no tech knowledge. And they do not want to risk by downloading Java. As they think Java may create problems?

How can I download JVM and give them in a .zip folder? Current version of Java is too techy for common man to download?

What if their firewall do not allow it?

I find out of 10 people visiting my site only 1 uses my programs rest run away without playing.

Is there any way to show them a flash screen and show download progress? Instead of the Java Logo?

Can I create 4 applets that run on a quad core cpu each using different cores?

How to assign different thread to different cores in Java. Can I force the program to use a separate core? Sothat program take use of all four cores in CPU instead of rinning in single core at 1/4th speed?

Bye
Sanny

Wandering in Java Forest.
Fireman Game: http://www.GetClub.com/Fireman.html





[toc] | [next] | [standalone]


#15920

FromLew <lewbloch@gmail.com>
Date2012-07-10 11:26 -0700
Message-ID<de29d6dc-c1e0-43ae-af74-0f0675a744f1@googlegroups.com>
In reply to#15918
Sanny wrote:
> Well I had a program/ Applet in Java 1.2 I want to migrate the code to Java 1.6

It should be forward compatible. 

> Will I see any benefit with the migration?

One hopes. It depends on many things, but in general terms 
Java 6 is more stable and performant than earlier versions.

> 1st what are the things that I can use/ redesign for improvements?

That depends on your current design and what it uses.

> Does compiling with a new version improve performance?

Probably not.

> I want to use Vectors/ Search / Sort Algorithm/ etc.

When you say "Vector", do you mean the Java class 'java.util.Vector' 
or the general concept of "vector" (in which case you use lower case).

'java.util.Vector' is overkill and out of date. For most (not all) purposes 
you should prefer 'java.util.ArrayList'.

> Currently I put data in String.

What do you mean by "data"?

> Will it be faster if I define Classes instead?

Faster? That depends on the data. Better? Unless your data are inherently 
strings, then 'String' is the wrong type.

> Problem with classes is that searching/ copying an array of classes is very time consuming.

How time consuming is "very"?

How did you measure it?

Under most circumstances, searching structures of objects with a well-
crafted type will be orders of magnitude faster than searching 'String' 
structures.

Hash-based algorithms eradicate much of this difference when available.

On what did you base your assertion?
 
> Every time a class is to be sent to a function a new class has to be created and all values need to be copied.

In what language are you working? This is simply not true for Java 
(which, by the way, calls its functions "methods", which only matters if 
you have a tendency to think of functions as they work in other 
languages).

> .clone() is also very time consuming.

What does that have to do with anything?

Very few programs need 'clone()'. To answer your question about 
what redesigns will help, eliminate all 'clone()' invocations.

> Does the latest version of java [sic] has done something 
> So that I can use Classes [sic] efficiently? 

No, that depends entirely on the programmer, and always has.

> Also String comparison and assignments are inefficient.

Are they?

What is "efficient" and how inefficient are these in your program, 
and how does that damage anything?

> lastly will I be able to use setchar() in Strings? using Bufferstring [sic] is very problematic.

<http://docs.oracle.com/javase/7/docs/api/java/lang/String.html>

Did you mean 
<http://docs.oracle.com/javase/7/docs/api/java/lang/StringBuffer.html>
?

Don't use that. For the really very rare cases when you need something 
different from 'String' use 
<http://docs.oracle.com/javase/7/docs/api/java/lang/StringBuilder.html>

> 
> Sending String and Class Variables to functions is very time consuming.

No, it isn't. Where do you get your information?

> Does new version of Java gives any good things for Applets? 

Check the docs. 

> Can I use multilingual? Can I use 3d graphics in Java Applets?

Yes.

> ==============
> 
> Topic Changed.

Then post in a different topic.

-- 
Lew

[toc] | [prev] | [next] | [standalone]


#15921

FromLuuk <luuk@invalid.lan>
Date2012-07-10 20:32 +0200
Message-ID<539uc9-7jg.ln1@luuk.invalid.lan>
In reply to#15920
On 10-07-2012 20:26, Lew wrote:
> Sanny wrote:
>> Well I had a program/ Applet in Java 1.2 I want to migrate the code to Java 1.6
> 
> It should be forward compatible. 
> 

I think the proper way to say this is:
The newer version is backwards compatible


[toc] | [prev] | [next] | [standalone]


#15922

FromLew <lewbloch@gmail.com>
Date2012-07-10 11:56 -0700
Message-ID<e4256c67-0761-40fc-ac35-115c2cddae44@googlegroups.com>
In reply to#15921
On Tuesday, July 10, 2012 11:32:39 AM UTC-7, Luuk wrote:
> On 10-07-2012 20:26, Lew wrote:
> &gt; Sanny wrote:
> &gt;&gt; Well I had a program/ Applet in Java 1.2 I want to migrate the code to Java 1.6
> &gt; 
> &gt; It should be forward compatible. 
> &gt; 
> 
> I think the proper way to say this is:
> The newer version is backwards compatible

Which is more correct - the car is moving faster than the pedestrian, 
or the pedestrian is moving slower than the car?

Since the OP asked about his Applet, the antecedent for "it" was 
the program, which would be *forward* compatible with Java 6.

If we had been talking about Java 6, the proper way to say 
that would have been *backward* compatible, not backward*s* 
compatible.

To correct someone, you must yourself be correct.

-- 
Lew

[toc] | [prev] | [next] | [standalone]


#15923

FromLuuk <luuk@invalid.lan>
Date2012-07-10 21:05 +0200
Message-ID<s0buc9-tvg.ln1@luuk.invalid.lan>
In reply to#15922
On 10-07-2012 20:56, Lew wrote:
> On Tuesday, July 10, 2012 11:32:39 AM UTC-7, Luuk wrote:
>> On 10-07-2012 20:26, Lew wrote:
>> &gt; Sanny wrote:
>> &gt;&gt; Well I had a program/ Applet in Java 1.2 I want to migrate the code to Java 1.6
>> &gt; 
>> &gt; It should be forward compatible. 
>> &gt; 
>>
>> I think the proper way to say this is:
>> The newer version is backwards compatible
> 
> Which is more correct - the car is moving faster than the pedestrian, 
> or the pedestrian is moving slower than the car?
> 
> Since the OP asked about his Applet, the antecedent for "it" was 
> the program, which would be *forward* compatible with Java 6.
> 
> If we had been talking about Java 6, the proper way to say 
> that would have been *backward* compatible, not backward*s* 
> compatible.
> 
> To correct someone, you must yourself be correct.
> 


Forward compatible does not exist,
Because one can never know what next version does.
or how it behaves....

[toc] | [prev] | [next] | [standalone]


#15925

FromLew <lewbloch@gmail.com>
Date2012-07-10 12:56 -0700
Message-ID<ec55ac28-5886-4c2e-96c4-b5ecf316942e@googlegroups.com>
In reply to#15923
Luuk wrote:
>  Lew wrote:
>  Luuk wrote:
> &gt;&gt; On 10-07-2012 20:26, Lew wrote:
> &gt;&gt; &amp;gt; Sanny wrote:
> &gt;&gt; &amp;gt;&amp;gt; Well I had a program/ Applet in Java 1.2 I want to migrate the code to Java 1.6
> &gt;&gt; &amp;gt; 
> &gt;&gt; &amp;gt; It should be forward compatible. 
> &gt;&gt; &amp;gt; 
> &gt;&gt;
> &gt;&gt; I think the proper way to say this is:
> &gt;&gt; The newer version is backwards compatible
> &gt; 
> &gt; Which is more correct - the car is moving faster than the pedestrian, 
> &gt; or the pedestrian is moving slower than the car?
> &gt; 
> &gt; Since the OP asked about his Applet, the antecedent for &quot;it&quot; was 
> &gt; the program, which would be *forward* compatible with Java 6.
> &gt; 
> &gt; If we had been talking about Java 6, the proper way to say 
> &gt; that would have been *backward* compatible, not backward*s* 
> &gt; compatible.
> &gt; 
> &gt; To correct someone, you must yourself be correct.
> &gt; 
> 
> 
> Forward compatible does not exist,

And yet most Java 1.2 code is forward compatible with Java 6.

Wonders never cease.

> Because one can never know what next version does.
> or how it behaves....

But one does know how Java 6 behaves with respect to Java 1.2 
code.

Maybe there is one who can never know that, but the rest of us do.

-- 
Lew

[toc] | [prev] | [next] | [standalone]


#15950

FromRoedy Green <see_website@mindprod.com.invalid>
Date2012-07-11 15:19 -0700
Message-ID<bpurv7djej2mp14l52ob48etckqqs2ksec@4ax.com>
In reply to#15923
On Tue, 10 Jul 2012 21:05:33 +0200, Luuk <luuk@invalid.lan> wrote,
quoted or indirectly quoted someone who said :

>Forward compatible does not exist,
 
The words forward and backward don't add anything but confusion.  Some
people say backward and some forward.

In theory you might have a kind of compatability where you could
compile a 1.6 program on a 1.6 compiler and run it on a 1.2 run time
if you did not use any of the new features.  It does NOT work that
way.
-- 
Roedy Green Canadian Mind Products
http://mindprod.com
Mathematicians and computer scientists are far more interested 
in impressing you than informing you. If this were not
so, the tutorials on building a robots.txt file, for example,
would consist primarily of an annotated example. What you get 
instead are nothing but inscrutable adstract fragments in some 
obscure dialect of BNF.

[toc] | [prev] | [next] | [standalone]


#15956

FromLew <lewbloch@gmail.com>
Date2012-07-11 15:50 -0700
Message-ID<a3abdc56-b519-40cb-a2ec-cb605f452af2@googlegroups.com>
In reply to#15950
Roedy Green wrote:
>Luuk wrote, quoted or indirectly quoted someone who said :
> &gt;Forward compatible does not exist,
>  
> The words forward and backward don&#39;t add anything but confusion.  Some
> people say backward and some forward.

The terms have definitions. "Backward compatible" means that the new product
or framework will work with artifacts generated or created for an earlier version.
"Forward compatible" means that an artifact from an earlier version works in 
a later version of the product or framework.

The terms are only confusing if you don't know the meanings. That is true 
for all terminology, of course.

> In theory you might have a kind of compatability where you could
> compile a 1.6 program on a 1.6 compiler and run it on a 1.2 run time
> if you did not use any of the new features.  It does NOT work that
> way.

Yes, it does, provided you use the "-source", "-target" and "-bootclasspath" 
options.

Why would you spread misinformation about that?

-- 
Lew

[toc] | [prev] | [next] | [standalone]


#15963

FromGene Wirchenko <genew@ocis.net>
Date2012-07-11 16:41 -0700
Message-ID<al3sv7tvadnga2ruc5k3dnrf63b0161l2i@4ax.com>
In reply to#15956
On Wed, 11 Jul 2012 15:50:24 -0700 (PDT), Lew <lewbloch@gmail.com>
wrote:

>Roedy Green wrote:
>>Luuk wrote, quoted or indirectly quoted someone who said :
>> &gt;Forward compatible does not exist,
>>  
>> The words forward and backward don&#39;t add anything but confusion.  Some
>> people say backward and some forward.
>
>The terms have definitions. "Backward compatible" means that the new product
>or framework will work with artifacts generated or created for an earlier version.
>"Forward compatible" means that an artifact from an earlier version works in 
>a later version of the product or framework.

     I believe you have miswritten the latter.  As you have written
them, they would mean about the same.

     Wikipedia has a nice explanation under "Backward compatibility".

[snip]

Sincerely,

Gene Wirchenko

[toc] | [prev] | [next] | [standalone]


#15965

FromLew <lewbloch@gmail.com>
Date2012-07-11 17:03 -0700
Message-ID<73841a99-e9ae-4267-8b83-a881a8e63202@googlegroups.com>
In reply to#15963
Gene Wirchenko wrote:
> Lew wrote:
>> The terms have definitions. "Backward compatible" means that the new product
>> or framework will work with artifacts generated or created for an earlier version.
>> "Forward compatible" means that an artifact from an earlier version works in 
>> a later version of the product or framework.
> 
>      I believe you have miswritten the latter.  As you have written
> them, they would mean about the same.
> 
>      Wikipedia has a nice explanation under &quot;Backward compatibility&quot;.

http://en.wikipedia.org/wiki/Backward_compatibility

Thanks. I stand corrected.

-- 
Lew

[toc] | [prev] | [next] | [standalone]


#15957

FromDaniele Futtorovic <da.futt.news@laposte-dot-net.invalid>
Date2012-07-12 00:51 +0200
Message-ID<jtl02t$3d5$1@dont-email.me>
In reply to#15950
On 12/07/2012 00:19, Roedy Green allegedly wrote:
> On Tue, 10 Jul 2012 21:05:33 +0200, Luuk <luuk@invalid.lan> wrote,
> quoted or indirectly quoted someone who said :
> 
>> Forward compatible does not exist,
>  
> The words forward and backward don't add anything but confusion.  Some
> people say backward and some forward.
> 
> In theory you might have a kind of compatability where you could
> compile a 1.6 program on a 1.6 compiler and run it on a 1.2 run time
> if you did not use any of the new features.  It does NOT work that
> way.

/Code/ is (at best) forward-compatible. /Compilers/ or /runtimes/ are
(at best) backward-compatible.

-- 
DF.

[toc] | [prev] | [next] | [standalone]


#15970

FromArne Vajhøj <arne@vajhoej.dk>
Date2012-07-11 23:13 -0400
Message-ID<4ffe40c1$0$288$14726298@news.sunsite.dk>
In reply to#15922
On 7/10/2012 2:56 PM, Lew wrote:
> On Tuesday, July 10, 2012 11:32:39 AM UTC-7, Luuk wrote:
>> On 10-07-2012 20:26, Lew wrote:
>> &gt; Sanny wrote:
>> &gt;&gt; Well I had a program/ Applet in Java 1.2 I want to migrate the code to Java 1.6
>> &gt;
>> &gt; It should be forward compatible.
>> &gt;
>>
>> I think the proper way to say this is:
>> The newer version is backwards compatible
>
> Which is more correct - the car is moving faster than the pedestrian,
> or the pedestrian is moving slower than the car?
>
> Since the OP asked about his Applet, the antecedent for "it" was
> the program, which would be *forward* compatible with Java 6.

????

If java 6 is backwards compatible with 1.2 then 1.2 programs
run in 6.

If Java 1.2 is forward compatible with 6 then 6 programs
run in 1.2.

The first is true for binary and true for most source.

The second is false for binary and false for a lot
of source.

So Luuk is correct.

Arne

[toc] | [prev] | [next] | [standalone]


#15935

FromSanny <softtanks22@hotmail.com>
Date2012-07-11 00:27 -0700
Message-ID<b9acd499-b09d-4fe4-ba3a-91f46258a88c@googlegroups.com>
In reply to#15920
> &gt; Currently I put data in String.
> 
> What do you mean by &quot;data&quot;?

Say I have employee data: Name, Tel, City, Salary.

Either I can put them in a class or Comma Separated in single String.

Creating a class then sending that class to a function or database is not much efficient.

But comma separated String you just have to send one string and each Value is separated in the String using "separator comma".

But addition and removing data from String is very inefficient.

Say I have to change tel number. 

1. function changetelnum(String ss, long new_tel, long old_tel)
{
//STEPs LIST
// search old_tel number in all strings
//replace old_tel number by new_tel
// Create a newString with "Name, Tel, City, Salary."
//return newString
}

If I use Classes I have to send Employee class to function

1. function changetelnum(EmployeeClass ss, long new_tel, long old_tel)
{
//STEPs LIST
//Search Class with old tel number
//replace tel number by new_tel
// return(ss);
}

What do you think which one is faster Sending String or Sending a Class? for changing tel number in an Emplyee data?

Is there any other data stricture that does it better?

When I pass a parameter Class "EmployeeClass" Does the Java Compiler create a new Class ss "EmployeeClass".

Is there any other way to change telnumber?

Is there something in new versions of Java that can do these things faster?

Other thing is How much memory does a class take and a String will take.

Say I have an array of 1 million Employees.

String[1million] How many MB this array will take?

EmployeeClass[1million] How many MB this array will take?

{
Name:
Tel:
City:
Salary:
}

Is there a way to save memory for shorter Strings. Say having just 15 digit string? Or all strings are of 256 char size?

How much Max memory an Applet can take in an ordinary computer.

If a Computer has 1 GB RAM can my applet utilize all that RAM? or the Browser will only give a few MB? Is there any way to request more memory by Applet from web-Browser if Available RAM in Computer is 2GB or 4GB?

How can my Applet know how much Memory is available to the applet?

How can an Applet know how many cores are present in System and assign each thread to a separate Core?

Bye
Sanny

Wandering in Java Forest.
Fireman Game: http://www.GetClub.com/Fireman.html 

[toc] | [prev] | [next] | [standalone]


#15936

FromSilvio Bierman <silvio@moc.com>
Date2012-07-11 13:12 +0200
Message-ID<4ffd5fb3$0$6987$e4fe514c@news2.news.xs4all.nl>
In reply to#15935
On 07/11/2012 09:27 AM, Sanny wrote:
>
> Say I have employee data: Name, Tel, City, Salary.
>
> Either I can put them in a class or Comma Separated in single String.
>
> Creating a class then sending that class to a function or database is not much efficient.
>

Wrong, it is extremely efficient. The only thing that is passed to the 
function (method) is a reference (pointer, if you will) that allows the 
function access to the object.


> But comma separated String you just have to send one string and each Value is separated in the String using "separator comma".

That is why using strings for such data in memory is a bad idea. Note 
that in a data-file it might be completely sensible.

>

REST SNIPPED

>

You seem to have a completely flawed idea of how Java (and for that 
matter many other object systems like CLI/.NET) handles and passes 
object instances.
I think you have this mixed up with how C++ passes objects. And even 
there using a class/struct is by far the better approach.

Putting record like data in String variables like you describe is almost 
without exception a very bad idea.

> Bye
> Sanny
>
> Wandering in Java Forest.
> Fireman Game: http://www.GetClub.com/Fireman.html
>

[toc] | [prev] | [next] | [standalone]


#15945

FromLew <lewbloch@gmail.com>
Date2012-07-11 14:02 -0700
Message-ID<9e6d548c-2aec-400d-84ac-1ee21421264f@googlegroups.com>
In reply to#15935
On Wednesday, July 11, 2012 12:27:43 AM UTC-7, Sanny wrote:
> &gt; &amp;gt; Currently I put data in String.
> &gt; 
> &gt; What do you mean by &amp;quot;data&amp;quot;?

Please attribute your quotes.
 
> Say I have employee data: Name, Tel, City, Salary.
> 
> Either I can put them in a class or Comma Separated in single String.

Creating a type is better.

> Creating a class then sending that class to a function or database is not much efficient.

It's extremely efficient, as Silvio and I have both pointed out.

> But comma separated String you just have to send one string and each Value is separated in the String using &quot;separator comma&quot;.

Antipattern.

> But addition and removing data from String is very inefficient.
> 
... [snip] ...
> 
> If I use Classes I have to send Employee class to function

No, you don't. You send a *reference* to an *instance* of that class.

> 1. function changetelnum(EmployeeClass ss, long new_tel, long old_tel)
> {
> //STEPs LIST
> //Search Class with old tel number

You don't search any class (let alone 'Class').

> //replace tel number by new_tel
> // return(ss);
> }
> 
> What do you think which one is faster Sending String or Sending a Class? for changing tel number in an Emplyee data?

It's not a question of what anyone thinks, but of what is true.

> Is there any other data stricture that does it better?

The data structure that matches the entity you're modeling.

Either you have modeled your domain or you have not.

This is objectively verifiable (i.e., disprovable). Look at the logical 
description of any given entity in your model. Does your class definition
match the logical definition? Then it's the right structure, otherwise 
not.

> When I pass a parameter Class &quot;EmployeeClass&quot; Does the Java Compiler create a new Class ss &quot;EmployeeClass&quot;.

No.

As you would know if you read the documentation.

RTFM.

> Is there any other way to change telnumber?

The right way.

E.g., 

public class Person
{
  private String name;
  private String telephone;
  public String getName()
  {
    return name;
  }
  public void setName(String name) 
  {
    this.name = name;
  }
  public void setTelephone(String telephone) 
  {
    this.telephone = telephone;
  }
  public String getTelephone()
  {
    return telephone;
  }
}

> Is there something in new versions of Java that can do these things faster?

What was wrong with earlier answers to this very question?

> Other thing is How much memory does a class take and a String will take.

That depends.

> Say I have an array of 1 million Employees.
> 
> String[1million] How many MB this array will take?

That depends.

> EmployeeClass[1million] How many MB this array will take?
> 
> {
> Name:
> Tel:
> City:
> Salary:
> }

That's not Java.

> Is there a way to save memory for shorter Strings. Say having just 15 digit string? Or all strings are of 256 char size?

'String's are of varying length, and we don't call the characters 
in a 'String' "digits". 
 
Read the Java tutorials.

RTFM.

> How much Max memory an Applet can take in an ordinary computer.

That depends.
 
> If a Computer has 1 GB RAM can my applet utilize all that RAM? or the Browser will only give a few 

No.

> MB? Is there any way to request more memory by Applet from web-Browser if Available RAM in Computer is 2GB or 4GB?

No.

> How can my Applet know how much Memory is available to the applet?

There are some calls in the API, but it smells like this is the wrong 
approach.

Your applet should not care.

> How can an Applet know how many cores are present in System and assign each thread to a separate Core?

It cannot.

It should not.

Some of what you're asking you already asked and got answers.

Why are you asking again?

Did you read the earlier answers?

Why not?

-- 
Lew

[toc] | [prev] | [next] | [standalone]


#15947

FromLars Enderin <lars.enderin@telia.com>
Date2012-07-12 00:06 +0200
Message-ID<4FFDF8E9.6090804@telia.com>
In reply to#15945
2012-07-11 23:02, Lew skrev:
> On Wednesday, July 11, 2012 12:27:43 AM UTC-7, Sanny wrote:
>> &gt; &amp;gt; Currently I put data in String.
>> &gt; 
>> &gt; What do you mean by &amp;quot;data&amp;quot;?
> 
> Please attribute your quotes.
>  
>> Say I have employee data: Name, Tel, City, Salary.
>>
>> Either I can put them in a class or Comma Separated in single String.
> 
> Creating a type is better.
> 
>> Creating a class then sending that class to a function or database is not much efficient.
> 
> It's extremely efficient, as Silvio and I have both pointed out.
> 
>> But comma separated String you just have to send one string and each Value is separated in the String using &quot;separator comma&quot;.
> 
> Antipattern.
> 
>> But addition and removing data from String is very inefficient.
>>
> ... [snip] ...
>>
>> If I use Classes I have to send Employee class to function
> 
> No, you don't. You send a *reference* to an *instance* of that class.
> 
>> 1. function changetelnum(EmployeeClass ss, long new_tel, long old_tel)
>> {
>> //STEPs LIST
>> //Search Class with old tel number
> 
> You don't search any class (let alone 'Class').
> 
>> //replace tel number by new_tel
>> // return(ss);
>> }
>>
>> What do you think which one is faster Sending String or Sending a Class? for changing tel number in an Emplyee data?
> 
> It's not a question of what anyone thinks, but of what is true.
> 
>> Is there any other data stricture that does it better?
> 
> The data structure that matches the entity you're modeling.
> 
> Either you have modeled your domain or you have not.
> 
> This is objectively verifiable (i.e., disprovable). Look at the logical 
> description of any given entity in your model. Does your class definition
> match the logical definition? Then it's the right structure, otherwise 
> not.
> 
>> When I pass a parameter Class &quot;EmployeeClass&quot; Does the Java Compiler create a new Class ss &quot;EmployeeClass&quot;.
> 
> No.
> 
> As you would know if you read the documentation.
> 
> RTFM.
> 
>> Is there any other way to change telnumber?
> 
> The right way.
> 
> E.g., 
> 
> public class Person
> {
>   private String name;
>   private String telephone;
>   public String getName()
>   {
>     return name;
>   }
>   public void setName(String name) 
>   {
>     this.name = name;
>   }
>   public void setTelephone(String telephone) 
>   {
>     this.telephone = telephone;
>   }
>   public String getTelephone()
>   {
>     return telephone;
>   }
> }
> 
>> Is there something in new versions of Java that can do these things faster?
> 
> What was wrong with earlier answers to this very question?
> 
>> Other thing is How much memory does a class take and a String will take.
> 
> That depends.
> 
>> Say I have an array of 1 million Employees.
>>
>> String[1million] How many MB this array will take?
> 
> That depends.
> 
>> EmployeeClass[1million] How many MB this array will take?
>>
>> {
>> Name:
>> Tel:
>> City:
>> Salary:
>> }
> 
> That's not Java.
> 
>> Is there a way to save memory for shorter Strings. Say having just 15 digit string? Or all strings are of 256 char size?
> 
> 'String's are of varying length, and we don't call the characters 
> in a 'String' "digits". 
>  
> Read the Java tutorials.
> 
> RTFM.
> 
>> How much Max memory an Applet can take in an ordinary computer.
> 
> That depends.
>  
>> If a Computer has 1 GB RAM can my applet utilize all that RAM? or the Browser will only give a few 
> 
> No.
> 
>> MB? Is there any way to request more memory by Applet from web-Browser if Available RAM in Computer is 2GB or 4GB?
> 
> No.
> 
>> How can my Applet know how much Memory is available to the applet?
> 
> There are some calls in the API, but it smells like this is the wrong 
> approach.
> 
> Your applet should not care.
> 
>> How can an Applet know how many cores are present in System and assign each thread to a separate Core?
> 
> It cannot.
> 
> It should not.
> 
> Some of what you're asking you already asked and got answers.
> 
> Why are you asking again?
> 
> Did you read the earlier answers?
> 
> Why not?
> 

For some reason, there is no text shown in Thunderbird for your (Lew's)
message, which I am commenting on, but the text shows, quoted, when I
compose the comment. It looks like Google Groups does not convert from
HTML to text/plain correctly. My message window for Lew's reply shows
the same header as Sanny's message, and no text. Some structural error
in the mbox-formatted inbox for this group, it seems.



-- 
Lars Enderin

[toc] | [prev] | [next] | [standalone]


#15949 — OT Google Groups formatting. Was Re: Updating code from jdk1.2 to recent jdk SE 1.6

Frommarkspace <-@.>
Date2012-07-11 15:16 -0700
SubjectOT Google Groups formatting. Was Re: Updating code from jdk1.2 to recent jdk SE 1.6
Message-ID<jtku0o$p57$1@dont-email.me>
In reply to#15947
On 7/11/2012 3:06 PM, Lars Enderin wrote:
>
> For some reason, there is no text shown in Thunderbird for your
> (Lew's) message, which I am commenting on, but the text shows,
> quoted, when I compose the comment. It looks like Google Groups does
> not convert from HTML to text/plain correctly. My message window for
> Lew's reply shows the same header as Sanny's message, and no text.
> Some structural error in the mbox-formatted inbox for this group, it
> seems.


It works fine for me, and I use Thunderbird.  I'm not however using 
Google groups in anyway.  Perhaps that's the problem rather than 
Thunderbird?

I'm using eternal-september.org for my server:

http://www.eternal-september.org/

[toc] | [prev] | [next] | [standalone]


#15978 — Re: OT Google Groups formatting. Was Re: Updating code from jdk1.2 to recent jdk SE 1.6

FromLars Enderin <lars.enderin@telia.com>
Date2012-07-12 11:00 +0200
SubjectRe: OT Google Groups formatting. Was Re: Updating code from jdk1.2 to recent jdk SE 1.6
Message-ID<4FFE9219.8070005@telia.com>
In reply to#15949
2012-07-12 00:16, markspace skrev:
> On 7/11/2012 3:06 PM, Lars Enderin wrote:
>>
>> For some reason, there is no text shown in Thunderbird for your
>> (Lew's) message, which I am commenting on, but the text shows,
>> quoted, when I compose the comment. It looks like Google Groups does
>> not convert from HTML to text/plain correctly. My message window for
>> Lew's reply shows the same header as Sanny's message, and no text.
>> Some structural error in the mbox-formatted inbox for this group, it
>> seems.
> 
> 
> It works fine for me, and I use Thunderbird.  I'm not however using
> Google groups in anyway.  Perhaps that's the problem rather than

"not using GG in anyway"? Don't you read posts from GG?

Sanny's posts have serious formatting problems, and I blame Google
Groups for that, or Sanny is misusing GG. Quoted >-s should not be shown
as &gt;.

> Thunderbird?
> 
> I'm using eternal-september.org for my server:

I use news.albasini.net.

-- 
Lars Enderin

[toc] | [prev] | [next] | [standalone]


#15985 — Re: OT Google Groups formatting. Was Re: Updating code from jdk1.2 to recent jdk SE 1.6

Frommarkspace <-@.>
Date2012-07-12 10:36 -0700
SubjectRe: OT Google Groups formatting. Was Re: Updating code from jdk1.2 to recent jdk SE 1.6
Message-ID<jtn1u9$s8s$1@dont-email.me>
In reply to#15978
On 7/12/2012 2:00 AM, Lars Enderin wrote:
>
> "not using GG in anyway"? Don't you read posts from GG?
>
> Sanny's posts have serious formatting problems, and I blame Google


I see some of Lew's quoted text has &gt; instead of ">", but that's the 
only formatting error I noted.  I wouldn't call that serious.  If you 
are seeing other things, I can't really guess what chain of events is 
causing it.

Can you check the source (control-U in Thuderbird) and see if it is 
malformed?

The first post I see that may be malformed is dated Jul 10 11:56 AM and 
starts like this:


On Tuesday, July 10, 2012 11:32:39 AM UTC-7, Luuk wrote:
 > On 10-07-2012 20:26, Lew wrote:
 > &gt; Sanny wrote:
 > &gt;&gt; Well I had a program/ Applet in Java 1.2 I want to migrate 
the code to Java 1.6
 > &gt;
 > &gt; It should be forward compatible.
 > &gt;
 >
 > I think the proper way to say this is:
 > The newer version is backwards compatible

Which is more correct - the car is moving faster than the pedestrian,
or the pedestrian is moving slower than the car?
...

[toc] | [prev] | [next] | [standalone]


#15958

FromDaniele Futtorovic <da.futt.news@laposte-dot-net.invalid>
Date2012-07-12 00:54 +0200
Message-ID<jtl08a$3d5$2@dont-email.me>
In reply to#15945
On 11/07/2012 23:02, Lew allegedly wrote:
> On Wednesday, July 11, 2012 12:27:43 AM UTC-7, Sanny wrote:
>> But comma separated String you just have to send one string and each Value is separated in the String using &quot;separator comma&quot;.
> 
> -Antipattern-. Reason for sacking.

FTFY.

-- 
DF.

[toc] | [prev] | [next] | [standalone]


Page 1 of 2  [1] 2  Next page →

Back to top | Article view | comp.lang.java.programmer


csiph-web