comp.lang.java.programmer http://groups-beta.google.com/group/comp.lang.java.programmer [EMAIL PROTECTED]
Today's topics: * TOMCAT/MYSQL/JSP - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6cfdfa12d76632b1 * An efficient computation idea. Please comment - 4 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5d714c128b46864f * Help me improve parsing trick? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8ba6b745fd0b06de * Java and inlining - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b13dd1cb6d5e4bd0 * JNI , shared stubs, CFunction (not CFunc) ? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7e1c6074e9e71a98 * (Un)compatibility between files generated from C++ and Java - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/758fcb121f984496 * db connections - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9796781dceede8f6 * sorting method for 2D Object array? - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3767d257f5325632 * sort method for a 2D object array? - 4 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/aa57c8d4fc850caf * Java, Swing, JSP Code Free! - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c7bd64dc94156cca * Some Programing Required - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d1ca4090cec7a67a * Connection Pooling - c3p0 - Tomcat. - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8bdefe9f4a95f2fb * Looking for simple rectangle drawing source code - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d60e3ea701323ebb * 100+ proprietary Java software ownership for sale by "The J Maker" at www.thejmaker.com - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2016a68da30632ef ============================================================================== TOPIC: TOMCAT/MYSQL/JSP http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6cfdfa12d76632b1 ============================================================================== == 1 of 1 == Date: Fri, Dec 17 2004 4:13 pm From: "Ryan Stewart" "atishay kumar" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > if username n password is not needed, how will the db know which user > is trying to connect to the db and does it have access of not > You can access the database anonymously, or the username and password can be included in the connection string. Please quote the relevant parts of the post to which you are replying so that we can understand what you're saying. ============================================================================== TOPIC: An efficient computation idea. Please comment http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5d714c128b46864f ============================================================================== == 1 of 4 == Date: Fri, Dec 17 2004 10:33 pm From: "Aaron Fude" "Mark Thornton" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Patrick May wrote: >> "Aaron Fude" <[EMAIL PROTECTED]> writes: >> >>>In my program I evaluate long trigonometric polynomials a lot! For >>>example, >>> >>>final int N = 1000; >>>double[] c = new double[N]; >>>// Populate c >>>double x = .5, sum = 0.0; >>> >>>for (int i = 0; i < N; i++) >>> sum += c[i]*cos(i*x); >>> >>>And this function is evaluated very many times (about 100,000). So >>>why not create a java snippet, compile it, load it as a class and >>>use the compiled version. So I would have something like; >>> >>>String sum = "0"; // A String buffer, of course... >>>for (int i = 0; i < N; i++) >>> sum += "+" + c[i] + "*cos(" + i + "*x)"; >>>sum += ";"; >>> >>>I think it's a pretty cool idea. But before I implement it, I would >>>like to know what you think about it! >> >> >> Greenspun's Tenth Rule of Programming: >> "Any sufficiently complicated C or Fortran program contains an >> ad-hoc, informally-specified, bug-ridden, slow implementation of >> half of Common Lisp." >> >> You have added Fude's Lemma: "Java programs, too." >> >> Look up defmacro in the Common Lisp Hyperspec >> (http://www.lispworks.com/reference/HyperSpec, among others). Java >> doesn't allow you to do this particularly well. Lisp does. >> > > However in this particular case there is a much better way of evaluating > the required function. A good understanding of mathematics is what is > required. > > Mark Thornton Your comment about unwrapping cosines is undoubtedly correct. To tell you the truth, I don't even have cosines, I have elementary polynomials. I have contrived the cosine example so I wouldn't get responses about summing the series in inverse order - and it backfired. (BTW, how many flops does a cosine take? I have no idea, but I would guess about 50. Wouldn't that mean that by the time you get to cos(50*x) it's cheaper to evaluate the cosine?) In any case, now that we know that I have polynomial, perhaps you could answer the posed question in the context of polynomials. Is there added value to the compilation trick if my series has about 1000 terms and needs to be evaluated 100k times? Aaron Fude == 2 of 4 == Date: Fri, Dec 17 2004 11:01 pm From: Mark Thornton Aaron Fude wrote: > "Mark Thornton" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>Patrick May wrote: >> >>>"Aaron Fude" <[EMAIL PROTECTED]> writes: >>> >>> >>>>In my program I evaluate long trigonometric polynomials a lot! For >>>>example, >>>> >>>>final int N = 1000; >>>>double[] c = new double[N]; >>>>// Populate c >>>>double x = .5, sum = 0.0; >>>> >>>>for (int i = 0; i < N; i++) >>>> sum += c[i]*cos(i*x); >>>> >>>>And this function is evaluated very many times (about 100,000). So >>>>why not create a java snippet, compile it, load it as a class and >>>>use the compiled version. So I would have something like; >>>> >>>>String sum = "0"; // A String buffer, of course... >>>>for (int i = 0; i < N; i++) >>>> sum += "+" + c[i] + "*cos(" + i + "*x)"; >>>>sum += ";"; >>>> >>>>I think it's a pretty cool idea. But before I implement it, I would >>>>like to know what you think about it! >>> >>> >>>Greenspun's Tenth Rule of Programming: >>> "Any sufficiently complicated C or Fortran program contains an >>> ad-hoc, informally-specified, bug-ridden, slow implementation of >>> half of Common Lisp." >>> >>>You have added Fude's Lemma: "Java programs, too." >>> >>>Look up defmacro in the Common Lisp Hyperspec >>>(http://www.lispworks.com/reference/HyperSpec, among others). Java >>>doesn't allow you to do this particularly well. Lisp does. >>> >> >>However in this particular case there is a much better way of evaluating >>the required function. A good understanding of mathematics is what is >>required. >> >>Mark Thornton > > > Your comment about unwrapping cosines is undoubtedly correct. To tell you > the truth, I don't even have cosines, I have elementary polynomials. I have > contrived the cosine example so I wouldn't get responses about summing the > series in inverse order - and it backfired. (BTW, how many flops does a > cosine take? I have no idea, but I would guess about 50. Wouldn't that mean > that by the time you get to cos(50*x) it's cheaper to evaluate the cosine?) No, because in practice a recurrence relation is used to compute each successive term from previous values. Just as with evaluating polynomials you don't compute x^n from scratch at each term. It is in fact very similar as exp(iz) = cos(z) + i.sin(z) (where 'i' here is the sqrt of -1). Now note that exp(i.n.z) = exp(iz)^n > In any case, now that we know that I have polynomial, perhaps you could > answer the posed question in the context of polynomials. Is there added > value to the compilation trick if my series has about 1000 terms and needs > to be evaluated 100k times? It still isn't worth generating byte code. Many JIT compilers will have been tuned to recognise this type of loop and may do some unrolling themselves. More seriously you need to consider the numerical stability of a power series with 1000 terms. There are a number of methods to 'improve' such series, which would then usually leave you with a much smaller polynomial to evaluate. However this a complex subject which filled many lectures during my maths degree (25 years ago). I suggest you find a mathematician to help economise the series, and evaluate it in the straight forward manner. Mark Thornton == 3 of 4 == Date: Sat, Dec 18 2004 3:29 am From: "Aaron Fude" Mark, Here's some funny code for you which shows that compiled code may run faster (typically by a factor of 3 on my machine). In really, the effect will be even greater for me since the series would have coefficients that come from some kind of a list with potentially significant access time. Now, as you wisely noted, .999^555 is quickly computed as .999^554*.999. That's very true, but perhaps it won't change the fact that the compilation trick on top of your keen observation is a good idea. Aaron public static void main(String[] inStr) { int N = 0; int M = 0; try { N = Math.max(1000, System.in.read()); // To prevent simple unwrapping... M = Math.max(100, System.in.read()); } catch (Exception inE) { } { long start = System.currentTimeMillis(); double sum = 0; for (int m = 0; m < M; m++) for (int n = 0; n < N; n++) sum += Math.pow(.999, n); System.out.println(System.currentTimeMillis() - start); } { long start = System.currentTimeMillis(); double sum = 0; for (int m = 0; m < M; m++) sum = 0 + Math.pow(.999, 0) + Math.pow(.999, 1) + Math.pow(.999, 2) + Math.pow(.999, 3) + Math.pow(.999, 4) + Math.pow(.999, 5) + Math.pow(.999, 6) + Math.pow(.999, 7) + Math.pow(.999, 8) + Math.pow(.999, 9) + Math.pow(.999, 10) + Math.pow(.999, 11) + Math.pow(.999, 12) + Math.pow(.999, 13) + Math.pow(.999, 14) + Math.pow(.999, 15) + Math.pow(.999, 16) + Math.pow(.999, 17) + Math.pow(.999, 18) + Math.pow(.999, 19) + Math.pow(.999, 20) + Math.pow(.999, 21) + Math.pow(.999, 22) + Math.pow(.999, 23) + Math.pow(.999, 24) + Math.pow(.999, 25) + Math.pow(.999, 26) + Math.pow(.999, 27) + Math.pow(.999, 28) + Math.pow(.999, 29) + Math.pow(.999, 30) + Math.pow(.999, 31) + Math.pow(.999, 32) + Math.pow(.999, 33) + Math.pow(.999, 34) + Math.pow(.999, 35) + Math.pow(.999, 36) + Math.pow(.999, 37) + Math.pow(.999, 38) + Math.pow(.999, 39) + Math.pow(.999, 40) + Math.pow(.999, 41) + Math.pow(.999, 42) + Math.pow(.999, 43) + Math.pow(.999, 44) + Math.pow(.999, 45) + Math.pow(.999, 46) + Math.pow(.999, 47) + Math.pow(.999, 48) + Math.pow(.999, 49) + Math.pow(.999, 50) + Math.pow(.999, 51) + Math.pow(.999, 52) + Math.pow(.999, 53) + Math.pow(.999, 54) + Math.pow(.999, 55) + Math.pow(.999, 56) + Math.pow(.999, 57) + Math.pow(.999, 58) + Math.pow(.999, 59) + Math.pow(.999, 60) + Math.pow(.999, 61) + Math.pow(.999, 62) + Math.pow(.999, 63) + Math.pow(.999, 64) + Math.pow(.999, 65) + Math.pow(.999, 66) + Math.pow(.999, 67) + Math.pow(.999, 68) + Math.pow(.999, 69) + Math.pow(.999, 70) + Math.pow(.999, 71) + Math.pow(.999, 72) + Math.pow(.999, 73) + Math.pow(.999, 74) + Math.pow(.999, 75) + Math.pow(.999, 76) + Math.pow(.999, 77) + Math.pow(.999, 78) + Math.pow(.999, 79) + Math.pow(.999, 80) + Math.pow(.999, 81) + Math.pow(.999, 82) + Math.pow(.999, 83) + Math.pow(.999, 84) + Math.pow(.999, 85) + Math.pow(.999, 86) + Math.pow(.999, 87) + Math.pow(.999, 88) + Math.pow(.999, 89) + Math.pow(.999, 90) + Math.pow(.999, 91) + Math.pow(.999, 92) + Math.pow(.999, 93) + Math.pow(.999, 94) + Math.pow(.999, 95) + Math.pow(.999, 96) + Math.pow(.999, 97) + Math.pow(.999, 98) + Math.pow(.999, 99) + Math.pow(.999, 100) + Math.pow(.999, 101) + Math.pow(.999, 102) + Math.pow(.999, 103) + Math.pow(.999, 104) + Math.pow(.999, 105) + Math.pow(.999, 106) + Math.pow(.999, 107) + Math.pow(.999, 108) + Math.pow(.999, 109) + Math.pow(.999, 110) + Math.pow(.999, 111) + Math.pow(.999, 112) + Math.pow(.999, 113) + Math.pow(.999, 114) + Math.pow(.999, 115) + Math.pow(.999, 116) + Math.pow(.999, 117) + Math.pow(.999, 118) + Math.pow(.999, 119) + Math.pow(.999, 120) + Math.pow(.999, 121) + Math.pow(.999, 122) + Math.pow(.999, 123) + Math.pow(.999, 124) + Math.pow(.999, 125) + Math.pow(.999, 126) + Math.pow(.999, 127) + Math.pow(.999, 128) + Math.pow(.999, 129) + Math.pow(.999, 130) + Math.pow(.999, 131) + Math.pow(.999, 132) + Math.pow(.999, 133) + Math.pow(.999, 134) + Math.pow(.999, 135) + Math.pow(.999, 136) + Math.pow(.999, 137) + Math.pow(.999, 138) + Math.pow(.999, 139) + Math.pow(.999, 140) + Math.pow(.999, 141) + Math.pow(.999, 142) + Math.pow(.999, 143) + Math.pow(.999, 144) + Math.pow(.999, 145) + Math.pow(.999, 146) + Math.pow(.999, 147) + Math.pow(.999, 148) + Math.pow(.999, 149) + Math.pow(.999, 150) + Math.pow(.999, 151) + Math.pow(.999, 152) + Math.pow(.999, 153) + Math.pow(.999, 154) + Math.pow(.999, 155) + Math.pow(.999, 156) + Math.pow(.999, 157) + Math.pow(.999, 158) + Math.pow(.999, 159) + Math.pow(.999, 160) + Math.pow(.999, 161) + Math.pow(.999, 162) + Math.pow(.999, 163) + Math.pow(.999, 164) + Math.pow(.999, 165) + Math.pow(.999, 166) + Math.pow(.999, 167) + Math.pow(.999, 168) + Math.pow(.999, 169) + Math.pow(.999, 170) + Math.pow(.999, 171) + Math.pow(.999, 172) + Math.pow(.999, 173) + Math.pow(.999, 174) + Math.pow(.999, 175) + Math.pow(.999, 176) + Math.pow(.999, 177) + Math.pow(.999, 178) + Math.pow(.999, 179) + Math.pow(.999, 180) + Math.pow(.999, 181) + Math.pow(.999, 182) + Math.pow(.999, 183) + Math.pow(.999, 184) + Math.pow(.999, 185) + Math.pow(.999, 186) + Math.pow(.999, 187) + Math.pow(.999, 188) + Math.pow(.999, 189) + Math.pow(.999, 190) + Math.pow(.999, 191) + Math.pow(.999, 192) + Math.pow(.999, 193) + Math.pow(.999, 194) + Math.pow(.999, 195) + Math.pow(.999, 196) + Math.pow(.999, 197) + Math.pow(.999, 198) + Math.pow(.999, 199) + Math.pow(.999, 200) + Math.pow(.999, 201) + Math.pow(.999, 202) + Math.pow(.999, 203) + Math.pow(.999, 204) + Math.pow(.999, 205) + Math.pow(.999, 206) + Math.pow(.999, 207) + Math.pow(.999, 208) + Math.pow(.999, 209) + Math.pow(.999, 210) + Math.pow(.999, 211) + Math.pow(.999, 212) + Math.pow(.999, 213) + Math.pow(.999, 214) + Math.pow(.999, 215) + Math.pow(.999, 216) + Math.pow(.999, 217) + Math.pow(.999, 218) + Math.pow(.999, 219) + Math.pow(.999, 220) + Math.pow(.999, 221) + Math.pow(.999, 222) + Math.pow(.999, 223) + Math.pow(.999, 224) + Math.pow(.999, 225) + Math.pow(.999, 226) + Math.pow(.999, 227) + Math.pow(.999, 228) + Math.pow(.999, 229) + Math.pow(.999, 230) + Math.pow(.999, 231) + Math.pow(.999, 232) + Math.pow(.999, 233) + Math.pow(.999, 234) + Math.pow(.999, 235) + Math.pow(.999, 236) + Math.pow(.999, 237) + Math.pow(.999, 238) + Math.pow(.999, 239) + Math.pow(.999, 240) + Math.pow(.999, 241) + Math.pow(.999, 242) + Math.pow(.999, 243) + Math.pow(.999, 244) + Math.pow(.999, 245) + Math.pow(.999, 246) + Math.pow(.999, 247) + Math.pow(.999, 248) + Math.pow(.999, 249) + Math.pow(.999, 250) + Math.pow(.999, 251) + Math.pow(.999, 252) + Math.pow(.999, 253) + Math.pow(.999, 254) + Math.pow(.999, 255) + Math.pow(.999, 256) + Math.pow(.999, 257) + Math.pow(.999, 258) + Math.pow(.999, 259) + Math.pow(.999, 260) + Math.pow(.999, 261) + Math.pow(.999, 262) + Math.pow(.999, 263) + Math.pow(.999, 264) + Math.pow(.999, 265) + Math.pow(.999, 266) + Math.pow(.999, 267) + Math.pow(.999, 268) + Math.pow(.999, 269) + Math.pow(.999, 270) + Math.pow(.999, 271) + Math.pow(.999, 272) + Math.pow(.999, 273) + Math.pow(.999, 274) + Math.pow(.999, 275) + Math.pow(.999, 276) + Math.pow(.999, 277) + Math.pow(.999, 278) + Math.pow(.999, 279) + Math.pow(.999, 280) + Math.pow(.999, 281) + Math.pow(.999, 282) + Math.pow(.999, 283) + Math.pow(.999, 284) + Math.pow(.999, 285) + Math.pow(.999, 286) + Math.pow(.999, 287) + Math.pow(.999, 288) + Math.pow(.999, 289) + Math.pow(.999, 290) + Math.pow(.999, 291) + Math.pow(.999, 292) + Math.pow(.999, 293) + Math.pow(.999, 294) + Math.pow(.999, 295) + Math.pow(.999, 296) + Math.pow(.999, 297) + Math.pow(.999, 298) + Math.pow(.999, 299) + Math.pow(.999, 300) + Math.pow(.999, 301) + Math.pow(.999, 302) + Math.pow(.999, 303) + Math.pow(.999, 304) + Math.pow(.999, 305) + Math.pow(.999, 306) + Math.pow(.999, 307) + Math.pow(.999, 308) + Math.pow(.999, 309) + Math.pow(.999, 310) + Math.pow(.999, 311) + Math.pow(.999, 312) + Math.pow(.999, 313) + Math.pow(.999, 314) + Math.pow(.999, 315) + Math.pow(.999, 316) + Math.pow(.999, 317) + Math.pow(.999, 318) + Math.pow(.999, 319) + Math.pow(.999, 320) + Math.pow(.999, 321) + Math.pow(.999, 322) + Math.pow(.999, 323) + Math.pow(.999, 324) + Math.pow(.999, 325) + Math.pow(.999, 326) + Math.pow(.999, 327) + Math.pow(.999, 328) + Math.pow(.999, 329) + Math.pow(.999, 330) + Math.pow(.999, 331) + Math.pow(.999, 332) + Math.pow(.999, 333) + Math.pow(.999, 334) + Math.pow(.999, 335) + Math.pow(.999, 336) + Math.pow(.999, 337) + Math.pow(.999, 338) + Math.pow(.999, 339) + Math.pow(.999, 340) + Math.pow(.999, 341) + Math.pow(.999, 342) + Math.pow(.999, 343) + Math.pow(.999, 344) + Math.pow(.999, 345) + Math.pow(.999, 346) + Math.pow(.999, 347) + Math.pow(.999, 348) + Math.pow(.999, 349) + Math.pow(.999, 350) + Math.pow(.999, 351) + Math.pow(.999, 352) + Math.pow(.999, 353) + Math.pow(.999, 354) + Math.pow(.999, 355) + Math.pow(.999, 356) + Math.pow(.999, 357) + Math.pow(.999, 358) + Math.pow(.999, 359) + Math.pow(.999, 360) + Math.pow(.999, 361) + Math.pow(.999, 362) + Math.pow(.999, 363) + Math.pow(.999, 364) + Math.pow(.999, 365) + Math.pow(.999, 366) + Math.pow(.999, 367) + Math.pow(.999, 368) + Math.pow(.999, 369) + Math.pow(.999, 370) + Math.pow(.999, 371) + Math.pow(.999, 372) + Math.pow(.999, 373) + Math.pow(.999, 374) + Math.pow(.999, 375) + Math.pow(.999, 376) + Math.pow(.999, 377) + Math.pow(.999, 378) + Math.pow(.999, 379) + Math.pow(.999, 380) + Math.pow(.999, 381) + Math.pow(.999, 382) + Math.pow(.999, 383) + Math.pow(.999, 384) + Math.pow(.999, 385) + Math.pow(.999, 386) + Math.pow(.999, 387) + Math.pow(.999, 388) + Math.pow(.999, 389) + Math.pow(.999, 390) + Math.pow(.999, 391) + Math.pow(.999, 392) + Math.pow(.999, 393) + Math.pow(.999, 394) + Math.pow(.999, 395) + Math.pow(.999, 396) + Math.pow(.999, 397) + Math.pow(.999, 398) + Math.pow(.999, 399) + Math.pow(.999, 400) + Math.pow(.999, 401) + Math.pow(.999, 402) + Math.pow(.999, 403) + Math.pow(.999, 404) + Math.pow(.999, 405) + Math.pow(.999, 406) + Math.pow(.999, 407) + Math.pow(.999, 408) + Math.pow(.999, 409) + Math.pow(.999, 410) + Math.pow(.999, 411) + Math.pow(.999, 412) + Math.pow(.999, 413) + Math.pow(.999, 414) + Math.pow(.999, 415) + Math.pow(.999, 416) + Math.pow(.999, 417) + Math.pow(.999, 418) + Math.pow(.999, 419) + Math.pow(.999, 420) + Math.pow(.999, 421) + Math.pow(.999, 422) + Math.pow(.999, 423) + Math.pow(.999, 424) + Math.pow(.999, 425) + Math.pow(.999, 426) + Math.pow(.999, 427) + Math.pow(.999, 428) + Math.pow(.999, 429) + Math.pow(.999, 430) + Math.pow(.999, 431) + Math.pow(.999, 432) + Math.pow(.999, 433) + Math.pow(.999, 434) + Math.pow(.999, 435) + Math.pow(.999, 436) + Math.pow(.999, 437) + Math.pow(.999, 438) + Math.pow(.999, 439) + Math.pow(.999, 440) + Math.pow(.999, 441) + Math.pow(.999, 442) + Math.pow(.999, 443) + Math.pow(.999, 444) + Math.pow(.999, 445) + Math.pow(.999, 446) + Math.pow(.999, 447) + Math.pow(.999, 448) + Math.pow(.999, 449) + Math.pow(.999, 450) + Math.pow(.999, 451) + Math.pow(.999, 452) + Math.pow(.999, 453) + Math.pow(.999, 454) + Math.pow(.999, 455) + Math.pow(.999, 456) + Math.pow(.999, 457) + Math.pow(.999, 458) + Math.pow(.999, 459) + Math.pow(.999, 460) + Math.pow(.999, 461) + Math.pow(.999, 462) + Math.pow(.999, 463) + Math.pow(.999, 464) + Math.pow(.999, 465) + Math.pow(.999, 466) + Math.pow(.999, 467) + Math.pow(.999, 468) + Math.pow(.999, 469) + Math.pow(.999, 470) + Math.pow(.999, 471) + Math.pow(.999, 472) + Math.pow(.999, 473) + Math.pow(.999, 474) + Math.pow(.999, 475) + Math.pow(.999, 476) + Math.pow(.999, 477) + Math.pow(.999, 478) + Math.pow(.999, 479) + Math.pow(.999, 480) + Math.pow(.999, 481) + Math.pow(.999, 482) + Math.pow(.999, 483) + Math.pow(.999, 484) + Math.pow(.999, 485) + Math.pow(.999, 486) + Math.pow(.999, 487) + Math.pow(.999, 488) + Math.pow(.999, 489) + Math.pow(.999, 490) + Math.pow(.999, 491) + Math.pow(.999, 492) + Math.pow(.999, 493) + Math.pow(.999, 494) + Math.pow(.999, 495) + Math.pow(.999, 496) + Math.pow(.999, 497) + Math.pow(.999, 498) + Math.pow(.999, 499) + Math.pow(.999, 500) + Math.pow(.999, 501) + Math.pow(.999, 502) + Math.pow(.999, 503) + Math.pow(.999, 504) + Math.pow(.999, 505) + Math.pow(.999, 506) + Math.pow(.999, 507) + Math.pow(.999, 508) + Math.pow(.999, 509) + Math.pow(.999, 510) + Math.pow(.999, 511) + Math.pow(.999, 512) + Math.pow(.999, 513) + Math.pow(.999, 514) + Math.pow(.999, 515) + Math.pow(.999, 516) + Math.pow(.999, 517) + Math.pow(.999, 518) + Math.pow(.999, 519) + Math.pow(.999, 520) + Math.pow(.999, 521) + Math.pow(.999, 522) + Math.pow(.999, 523) + Math.pow(.999, 524) + Math.pow(.999, 525) + Math.pow(.999, 526) + Math.pow(.999, 527) + Math.pow(.999, 528) + Math.pow(.999, 529) + Math.pow(.999, 530) + Math.pow(.999, 531) + Math.pow(.999, 532) + Math.pow(.999, 533) + Math.pow(.999, 534) + Math.pow(.999, 535) + Math.pow(.999, 536) + Math.pow(.999, 537) + Math.pow(.999, 538) + Math.pow(.999, 539) + Math.pow(.999, 540) + Math.pow(.999, 541) + Math.pow(.999, 542) + Math.pow(.999, 543) + Math.pow(.999, 544) + Math.pow(.999, 545) + Math.pow(.999, 546) + Math.pow(.999, 547) + Math.pow(.999, 548) + Math.pow(.999, 549) + Math.pow(.999, 550) + Math.pow(.999, 551) + Math.pow(.999, 552) + Math.pow(.999, 553) + Math.pow(.999, 554) + Math.pow(.999, 555) + Math.pow(.999, 556) + Math.pow(.999, 557) + Math.pow(.999, 558) + Math.pow(.999, 559) + Math.pow(.999, 560) + Math.pow(.999, 561) + Math.pow(.999, 562) + Math.pow(.999, 563) + Math.pow(.999, 564) + Math.pow(.999, 565) + Math.pow(.999, 566) + Math.pow(.999, 567) + Math.pow(.999, 568) + Math.pow(.999, 569) + Math.pow(.999, 570) + Math.pow(.999, 571) + Math.pow(.999, 572) + Math.pow(.999, 573) + Math.pow(.999, 574) + Math.pow(.999, 575) + Math.pow(.999, 576) + Math.pow(.999, 577) + Math.pow(.999, 578) + Math.pow(.999, 579) + Math.pow(.999, 580) + Math.pow(.999, 581) + Math.pow(.999, 582) + Math.pow(.999, 583) + Math.pow(.999, 584) + Math.pow(.999, 585) + Math.pow(.999, 586) + Math.pow(.999, 587) + Math.pow(.999, 588) + Math.pow(.999, 589) + Math.pow(.999, 590) + Math.pow(.999, 591) + Math.pow(.999, 592) + Math.pow(.999, 593) + Math.pow(.999, 594) + Math.pow(.999, 595) + Math.pow(.999, 596) + Math.pow(.999, 597) + Math.pow(.999, 598) + Math.pow(.999, 599) + Math.pow(.999, 600) + Math.pow(.999, 601) + Math.pow(.999, 602) + Math.pow(.999, 603) + Math.pow(.999, 604) + Math.pow(.999, 605) + Math.pow(.999, 606) + Math.pow(.999, 607) + Math.pow(.999, 608) + Math.pow(.999, 609) + Math.pow(.999, 610) + Math.pow(.999, 611) + Math.pow(.999, 612) + Math.pow(.999, 613) + Math.pow(.999, 614) + Math.pow(.999, 615) + Math.pow(.999, 616) + Math.pow(.999, 617) + Math.pow(.999, 618) + Math.pow(.999, 619) + Math.pow(.999, 620) + Math.pow(.999, 621) + Math.pow(.999, 622) + Math.pow(.999, 623) + Math.pow(.999, 624) + Math.pow(.999, 625) + Math.pow(.999, 626) + Math.pow(.999, 627) + Math.pow(.999, 628) + Math.pow(.999, 629) + Math.pow(.999, 630) + Math.pow(.999, 631) + Math.pow(.999, 632) + Math.pow(.999, 633) + Math.pow(.999, 634) + Math.pow(.999, 635) + Math.pow(.999, 636) + Math.pow(.999, 637) + Math.pow(.999, 638) + Math.pow(.999, 639) + Math.pow(.999, 640) + Math.pow(.999, 641) + Math.pow(.999, 642) + Math.pow(.999, 643) + Math.pow(.999, 644) + Math.pow(.999, 645) + Math.pow(.999, 646) + Math.pow(.999, 647) + Math.pow(.999, 648) + Math.pow(.999, 649) + Math.pow(.999, 650) + Math.pow(.999, 651) + Math.pow(.999, 652) + Math.pow(.999, 653) + Math.pow(.999, 654) + Math.pow(.999, 655) + Math.pow(.999, 656) + Math.pow(.999, 657) + Math.pow(.999, 658) + Math.pow(.999, 659) + Math.pow(.999, 660) + Math.pow(.999, 661) + Math.pow(.999, 662) + Math.pow(.999, 663) + Math.pow(.999, 664) + Math.pow(.999, 665) + Math.pow(.999, 666) + Math.pow(.999, 667) + Math.pow(.999, 668) + Math.pow(.999, 669) + Math.pow(.999, 670) + Math.pow(.999, 671) + Math.pow(.999, 672) + Math.pow(.999, 673) + Math.pow(.999, 674) + Math.pow(.999, 675) + Math.pow(.999, 676) + Math.pow(.999, 677) + Math.pow(.999, 678) + Math.pow(.999, 679) + Math.pow(.999, 680) + Math.pow(.999, 681) + Math.pow(.999, 682) + Math.pow(.999, 683) + Math.pow(.999, 684) + Math.pow(.999, 685) + Math.pow(.999, 686) + Math.pow(.999, 687) + Math.pow(.999, 688) + Math.pow(.999, 689) + Math.pow(.999, 690) + Math.pow(.999, 691) + Math.pow(.999, 692) + Math.pow(.999, 693) + Math.pow(.999, 694) + Math.pow(.999, 695) + Math.pow(.999, 696) + Math.pow(.999, 697) + Math.pow(.999, 698) + Math.pow(.999, 699) + Math.pow(.999, 700) + Math.pow(.999, 701) + Math.pow(.999, 702) + Math.pow(.999, 703) + Math.pow(.999, 704) + Math.pow(.999, 705) + Math.pow(.999, 706) + Math.pow(.999, 707) + Math.pow(.999, 708) + Math.pow(.999, 709) + Math.pow(.999, 710) + Math.pow(.999, 711) + Math.pow(.999, 712) + Math.pow(.999, 713) + Math.pow(.999, 714) + Math.pow(.999, 715) + Math.pow(.999, 716) + Math.pow(.999, 717) + Math.pow(.999, 718) + Math.pow(.999, 719) + Math.pow(.999, 720) + Math.pow(.999, 721) + Math.pow(.999, 722) + Math.pow(.999, 723) + Math.pow(.999, 724) + Math.pow(.999, 725) + Math.pow(.999, 726) + Math.pow(.999, 727) + Math.pow(.999, 728) + Math.pow(.999, 729) + Math.pow(.999, 730) + Math.pow(.999, 731) + Math.pow(.999, 732) + Math.pow(.999, 733) + Math.pow(.999, 734) + Math.pow(.999, 735) + Math.pow(.999, 736) + Math.pow(.999, 737) + Math.pow(.999, 738) + Math.pow(.999, 739) + Math.pow(.999, 740) + Math.pow(.999, 741) + Math.pow(.999, 742) + Math.pow(.999, 743) + Math.pow(.999, 744) + Math.pow(.999, 745) + Math.pow(.999, 746) + Math.pow(.999, 747) + Math.pow(.999, 748) + Math.pow(.999, 749) + Math.pow(.999, 750) + Math.pow(.999, 751) + Math.pow(.999, 752) + Math.pow(.999, 753) + Math.pow(.999, 754) + Math.pow(.999, 755) + Math.pow(.999, 756) + Math.pow(.999, 757) + Math.pow(.999, 758) + Math.pow(.999, 759) + Math.pow(.999, 760) + Math.pow(.999, 761) + Math.pow(.999, 762) + Math.pow(.999, 763) + Math.pow(.999, 764) + Math.pow(.999, 765) + Math.pow(.999, 766) + Math.pow(.999, 767) + Math.pow(.999, 768) + Math.pow(.999, 769) + Math.pow(.999, 770) + Math.pow(.999, 771) + Math.pow(.999, 772) + Math.pow(.999, 773) + Math.pow(.999, 774) + Math.pow(.999, 775) + Math.pow(.999, 776) + Math.pow(.999, 777) + Math.pow(.999, 778) + Math.pow(.999, 779) + Math.pow(.999, 780) + Math.pow(.999, 781) + Math.pow(.999, 782) + Math.pow(.999, 783) + Math.pow(.999, 784) + Math.pow(.999, 785) + Math.pow(.999, 786) + Math.pow(.999, 787) + Math.pow(.999, 788) + Math.pow(.999, 789) + Math.pow(.999, 790) + Math.pow(.999, 791) + Math.pow(.999, 792) + Math.pow(.999, 793) + Math.pow(.999, 794) + Math.pow(.999, 795) + Math.pow(.999, 796) + Math.pow(.999, 797) + Math.pow(.999, 798) + Math.pow(.999, 799) + Math.pow(.999, 800) + Math.pow(.999, 801) + Math.pow(.999, 802) + Math.pow(.999, 803) + Math.pow(.999, 804) + Math.pow(.999, 805) + Math.pow(.999, 806) + Math.pow(.999, 807) + Math.pow(.999, 808) + Math.pow(.999, 809) + Math.pow(.999, 810) + Math.pow(.999, 811) + Math.pow(.999, 812) + Math.pow(.999, 813) + Math.pow(.999, 814) + Math.pow(.999, 815) + Math.pow(.999, 816) + Math.pow(.999, 817) + Math.pow(.999, 818) + Math.pow(.999, 819) + Math.pow(.999, 820) + Math.pow(.999, 821) + Math.pow(.999, 822) + Math.pow(.999, 823) + Math.pow(.999, 824) + Math.pow(.999, 825) + Math.pow(.999, 826) + Math.pow(.999, 827) + Math.pow(.999, 828) + Math.pow(.999, 829) + Math.pow(.999, 830) + Math.pow(.999, 831) + Math.pow(.999, 832) + Math.pow(.999, 833) + Math.pow(.999, 834) + Math.pow(.999, 835) + Math.pow(.999, 836) + Math.pow(.999, 837) + Math.pow(.999, 838) + Math.pow(.999, 839) + Math.pow(.999, 840) + Math.pow(.999, 841) + Math.pow(.999, 842) + Math.pow(.999, 843) + Math.pow(.999, 844) + Math.pow(.999, 845) + Math.pow(.999, 846) + Math.pow(.999, 847) + Math.pow(.999, 848) + Math.pow(.999, 849) + Math.pow(.999, 850) + Math.pow(.999, 851) + Math.pow(.999, 852) + Math.pow(.999, 853) + Math.pow(.999, 854) + Math.pow(.999, 855) + Math.pow(.999, 856) + Math.pow(.999, 857) + Math.pow(.999, 858) + Math.pow(.999, 859) + Math.pow(.999, 860) + Math.pow(.999, 861) + Math.pow(.999, 862) + Math.pow(.999, 863) + Math.pow(.999, 864) + Math.pow(.999, 865) + Math.pow(.999, 866) + Math.pow(.999, 867) + Math.pow(.999, 868) + Math.pow(.999, 869) + Math.pow(.999, 870) + Math.pow(.999, 871) + Math.pow(.999, 872) + Math.pow(.999, 873) + Math.pow(.999, 874) + Math.pow(.999, 875) + Math.pow(.999, 876) + Math.pow(.999, 877) + Math.pow(.999, 878) + Math.pow(.999, 879) + Math.pow(.999, 880) + Math.pow(.999, 881) + Math.pow(.999, 882) + Math.pow(.999, 883) + Math.pow(.999, 884) + Math.pow(.999, 885) + Math.pow(.999, 886) + Math.pow(.999, 887) + Math.pow(.999, 888) + Math.pow(.999, 889) + Math.pow(.999, 890) + Math.pow(.999, 891) + Math.pow(.999, 892) + Math.pow(.999, 893) + Math.pow(.999, 894) + Math.pow(.999, 895) + Math.pow(.999, 896) + Math.pow(.999, 897) + Math.pow(.999, 898) + Math.pow(.999, 899) + Math.pow(.999, 900) + Math.pow(.999, 901) + Math.pow(.999, 902) + Math.pow(.999, 903) + Math.pow(.999, 904) + Math.pow(.999, 905) + Math.pow(.999, 906) + Math.pow(.999, 907) + Math.pow(.999, 908) + Math.pow(.999, 909) + Math.pow(.999, 910) + Math.pow(.999, 911) + Math.pow(.999, 912) + Math.pow(.999, 913) + Math.pow(.999, 914) + Math.pow(.999, 915) + Math.pow(.999, 916) + Math.pow(.999, 917) + Math.pow(.999, 918) + Math.pow(.999, 919) + Math.pow(.999, 920) + Math.pow(.999, 921) + Math.pow(.999, 922) + Math.pow(.999, 923) + Math.pow(.999, 924) + Math.pow(.999, 925) + Math.pow(.999, 926) + Math.pow(.999, 927) + Math.pow(.999, 928) + Math.pow(.999, 929) + Math.pow(.999, 930) + Math.pow(.999, 931) + Math.pow(.999, 932) + Math.pow(.999, 933) + Math.pow(.999, 934) + Math.pow(.999, 935) + Math.pow(.999, 936) + Math.pow(.999, 937) + Math.pow(.999, 938) + Math.pow(.999, 939) + Math.pow(.999, 940) + Math.pow(.999, 941) + Math.pow(.999, 942) + Math.pow(.999, 943) + Math.pow(.999, 944) + Math.pow(.999, 945) + Math.pow(.999, 946) + Math.pow(.999, 947) + Math.pow(.999, 948) + Math.pow(.999, 949) + Math.pow(.999, 950) + Math.pow(.999, 951) + Math.pow(.999, 952) + Math.pow(.999, 953) + Math.pow(.999, 954) + Math.pow(.999, 955) + Math.pow(.999, 956) + Math.pow(.999, 957) + Math.pow(.999, 958) + Math.pow(.999, 959) + Math.pow(.999, 960) + Math.pow(.999, 961) + Math.pow(.999, 962) + Math.pow(.999, 963) + Math.pow(.999, 964) + Math.pow(.999, 965) + Math.pow(.999, 966) + Math.pow(.999, 967) + Math.pow(.999, 968) + Math.pow(.999, 969) + Math.pow(.999, 970) + Math.pow(.999, 971) + Math.pow(.999, 972) + Math.pow(.999, 973) + Math.pow(.999, 974) + Math.pow(.999, 975) + Math.pow(.999, 976) + Math.pow(.999, 977) + Math.pow(.999, 978) + Math.pow(.999, 979) + Math.pow(.999, 980) + Math.pow(.999, 981) + Math.pow(.999, 982) + Math.pow(.999, 983) + Math.pow(.999, 984) + Math.pow(.999, 985) + Math.pow(.999, 986) + Math.pow(.999, 987) + Math.pow(.999, 988) + Math.pow(.999, 989) + Math.pow(.999, 990) + Math.pow(.999, 991) + Math.pow(.999, 992) + Math.pow(.999, 993) + Math.pow(.999, 994) + Math.pow(.999, 995) + Math.pow(.999, 996) + Math.pow(.999, 997) + Math.pow(.999, 998) + Math.pow(.999, 999); System.out.println(System.currentTimeMillis() - start); } // StringBuffer s = new StringBuffer(" sum = 0"); // for (int n = 0; n < N; n++) // s.append(" + Math.pow(.999, " + n + ")"); // s.append(";"); // System.out.println(s); } == 4 of 4 == Date: Sat, Dec 18 2004 3:39 am From: "Aaron Fude" For the record, the computational efficiency you are suggesting speeds up the code by a factor of 100. All I'm saying, why not speed it up by a factor of 2 or 3 on top of that. (I think it would be even better than a factor of 2 or 3 on top of that since it's obvious that most of the time is spent computing powers and not performing the loop. Once computing the powers is removed and only looping remains, unwinding and compiling should make a big difference.) ============================================================================== TOPIC: Help me improve parsing trick? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8ba6b745fd0b06de ============================================================================== == 1 of 1 == Date: Fri, Dec 17 2004 10:42 pm From: Andrew Thompson >>> "Andrew Thompson" <[EMAIL PROTECTED]> wrote in message >>>> On Thu, 16 Dec 2004 22:33:21 GMT, Aaron Fude wrote: >>>> >>>>> ..Is there a way to speed this up by doing >>>>> everything in memory and avoid writing to files and running compilation >>>>> scripts. >>> >>> You can avoid the last part by invoking javac from within Java itself. ... > Thank you. But is there a way to avoid writing the code to a file but > compile it directly from a String? Not that I know of, though I heard some rumble of perhaps accepting String or other arguments in 1.6 assuming Sun makes the compilation classes public, as opposed to not supporting direct compilation from within Java. -- Andrew Thompson http://www.PhySci.org/codes/ Web & IT Help http://www.PhySci.org/ Open-source software suite http://www.1point1C.org/ Science & Technology http://www.LensEscapes.com/ Images that escape the mundane ============================================================================== TOPIC: Java and inlining http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b13dd1cb6d5e4bd0 ============================================================================== == 1 of 2 == Date: Sat, Dec 18 2004 12:12 am From: "Skip" > Actually, thowing in "final" speeded up the code tremendously. > Interesting... I also used to think that "final" makes little difference, > but the difference turned out to be tremendous is this case! Which VM? On the most recent VMs (Suns 1.4 / 1.5) it shouldn't really matter. == 2 of 2 == Date: Sat, Dec 18 2004 2:39 am From: "Aaron Fude" "Skip" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >> Actually, thowing in "final" speeded up the code tremendously. >> Interesting... I also used to think that "final" makes little difference, >> but the difference turned out to be tremendous is this case! > > Which VM? On the most recent VMs (Suns 1.4 / 1.5) it shouldn't really > matter. > > 1.4.2 ============================================================================== TOPIC: JNI , shared stubs, CFunction (not CFunc) ? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7e1c6074e9e71a98 ============================================================================== == 1 of 1 == Date: Fri, Dec 17 2004 3:15 pm From: "Curt Cox" I'm having trouble building disp.dll. Does anybody have pre-built binaries, or know where I can get them? ============================================================================== TOPIC: (Un)compatibility between files generated from C++ and Java http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/758fcb121f984496 ============================================================================== == 1 of 2 == Date: Fri, Dec 17 2004 3:22 pm From: [EMAIL PROTECTED] (Maria) Hi is there (Un)compatibility between files generated from C++ and Java? i think there is since the datatypes can have different representation. In Java for instance integer type takes 4 bytes, whereas it is just 2(i think!) in C++ so when writing in a language and reading the generated integer file with other language mismatch occurs? what about strings-type files (un)comaptibility between the two languages? is it worse between Java (C++) and Cobol/pascal? if you can give me examples i 'll be delighted :) thanks == 2 of 2 == Date: Fri, Dec 17 2004 11:40 pm From: Joona I Palaste Maria <[EMAIL PROTECTED]> scribbled the following: > Hi > is there (Un)compatibility between files generated from C++ and Java? > i think there is since the datatypes can have different > representation. In Java for instance integer type takes 4 bytes, > whereas it is just 2(i think!) in C++ > so when writing in a language and reading the generated integer file > with other language mismatch occurs? > what about strings-type files (un)comaptibility between the two > languages? > is it worse between Java (C++) and Cobol/pascal? > if you can give me examples i 'll be delighted :) Files do not carry inherent notions of what created them. The exact same kind of file can be created by Java, C++, COBOL, Pascal, assembler, whatever. It is true, as you say, that Java and C++ can have different-sized integers, but this is not a problem. As long as you realise what sizes different languages have for integers, you can develop a system of always writing integers the same way. Every language has a way of writing individual bytes. Just use this to write integers in a uniform way across languages. -- /-- Joona Palaste ([EMAIL PROTECTED]) ------------- Finland --------\ \-------------------------------------------------------- rules! --------/ "B-but Angus! You're a dragon!" - Mickey Mouse ============================================================================== TOPIC: db connections http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9796781dceede8f6 ============================================================================== == 1 of 2 == Date: Fri, Dec 17 2004 5:23 pm From: "Ryan Stewart" "Big Jim" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Guys, > > In a a stateful session bean I'm looking up a data source that wraps a > connection pool and using it to retrieve a connection. > How do I return the connection to the pool when I'm done? Is conn.close() > the right thing to do here? > > If I just let it go out of scope I eventually get an exception in the pool > with an "out of resources" error. > Read your connection pool's documentation. == 2 of 2 == Date: Fri, Dec 17 2004 10:28 pm From: Sudsy Big Jim wrote: > Guys, > > In a a stateful session bean I'm looking up a data source that wraps a > connection pool and using it to retrieve a connection. > How do I return the connection to the pool when I'm done? Is conn.close() > the right thing to do here? Absoutely right! Closing it releases it back to the pool. ============================================================================== TOPIC: sorting method for 2D Object array? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3767d257f5325632 ============================================================================== == 1 of 2 == Date: Sat, Dec 18 2004 12:18 am From: "Jeff" I need a sorting method for a 2 dimensional object array. Does anyone know of a publicly available one? Thanks -- Jeff == 2 of 2 == Date: Fri, Dec 17 2004 7:28 pm From: Starshine Moonbeam In article <[EMAIL PROTECTED]>, Jeff ([EMAIL PROTECTED]) dropped a +5 bundle of words... > I need a sorting method for a 2 dimensional object array. Does anyone know > of a publicly available one? You could make your own with nested for loops. (1 for the first dimension, which is really an array, and 1 for the array being held in the slot. <sscce> public class Test { int [][] thing = { {1,2,3}, {4,5,6}, {7,8,9} }; public void findNumber() { int number = 5; for (int a = 0; a < 3; a++) { for (int b = 0; b < 3; b++){ if (number == thing[a][b]) { System.out.println("\n" + number); } else { System.out.print("\nCouldn't find it."); } // end if/else } //end inside for loop } // end outside for loop } // end findNumber public static void main(String[] args) { Test drive = new Test(); drive.findNumber(); } } </sscce> -- Starshine Moonbeam mhm31x9 Smeeter#29 WSD#30 sTaRShInE_mOOnBeAm aT HoTmAil dOt CoM ============================================================================== TOPIC: sort method for a 2D object array? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/aa57c8d4fc850caf ============================================================================== == 1 of 4 == Date: Sat, Dec 18 2004 12:30 am From: "Jeff" Does anyone know of a publicly available sort method for a 2 dimensional object array? I have a 2 dimensional object array which I would like to sort according to the values in the second column. There's a Swing example using TableModels, but a TableModel is a convoluted solution to my simple problem. Thanks -- Jeff == 2 of 4 == Date: Fri, Dec 17 2004 6:34 pm From: Chris Smith Jeff <[EMAIL PROTECTED]> wrote: > Does anyone know of a publicly available sort method for a 2 dimensional > object array? I have a 2 dimensional object array which I would like to > sort according to the values in the second column. Depending on your conception of "row" and "column" in the array, Arrays.sort may work with a custom Comparator. Remember that a so- called "two-dimensional array" is really nothing but an array whose elements are arrays. -- www.designacourse.com The Easiest Way To Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation == 3 of 4 == Date: Sat, Dec 18 2004 2:14 am From: "Tony Morris" > Remember that a so- > called "two-dimensional array" is really nothing but an array whose > elements are arrays. Not quite. A 2-dimensional array is one that has 2 dimensions e.g. in C#, a int[,] is a 2-dimensional array; and in COBOL, a TABLE is a 2-dimensional array. Java has no 2 dimensional arrays (despites false claims, even by the JLS itself); it only has arrays of arbitrary type - they are not synonymous. http://www.xdweb.net/~dibblego/java/faq/answers.html#q45 -- Tony Morris http://xdweb.net/~dibblego/ == 4 of 4 == Date: Fri, Dec 17 2004 8:38 pm From: Chris Smith Tony Morris <[EMAIL PROTECTED]> wrote: > > Remember that a so- > > called "two-dimensional array" is really nothing but an array whose > > elements are arrays. > > Not quite. > A 2-dimensional array is one that has 2 dimensions e.g. in C#, a int[,] is a > 2-dimensional array; and in COBOL, a TABLE is a 2-dimensional array. > > Java has no 2 dimensional arrays (despites false claims, even by the JLS > itself); it only has arrays of arbitrary type - they are not synonymous. I'm not sure what distinction you're trying to make. As near as I can tell, what you said is exactly identical to what I said. Yet you say you don't agree with me. Can you clarify? -- www.designacourse.com The Easiest Way To Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation ============================================================================== TOPIC: Java, Swing, JSP Code Free! http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c7bd64dc94156cca ============================================================================== == 1 of 1 == Date: Fri, Dec 17 2004 4:42 pm From: "Last Timer" Planning on making some code available free. The code organized as Java and JSP files. Not well commented though. Several build scripts for ant exist. Lots of JavaScripting embedded with JSP. It has POIHSSF calls for creating Excel files. Uses JDBC with embedded SQL. If someone has an FTP site from where people can easily download please post here. Thanks! ============================================================================== TOPIC: Some Programing Required http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d1ca4090cec7a67a ============================================================================== == 1 of 1 == Date: Fri, Dec 17 2004 4:50 pm From: [EMAIL PROTECTED] (Murray J) I am not sure if this is the proper group for this, however, I am sure someone will redirect me if necessary. I have an HTML page which is an image map with a 4 X 4 grid of 'hot spots', linking to other HTML pages, each of which contains a large (3200px X 2560px) image. I would like to capture the co-ordinates of the mouse at the instant when it is clicked on the first image, apply some mathematics based on which 'hot spot' was clicked, and come up with a new set of co-ordinates. When the destination page is opened, I would like the viewport to be at those new co-ordinates on the 3200px X 2560px image on the page. I suspect this will require some programing in languages I know nothing about, and haven't the time to learn at the moment. If anyone is interested in this project for the challenge and/or cash, please give me a shout at [EMAIL PROTECTED] . Thanks, Murray ============================================================================== TOPIC: Connection Pooling - c3p0 - Tomcat. http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8bdefe9f4a95f2fb ============================================================================== == 1 of 1 == Date: Fri, Dec 17 2004 9:33 pm From: Sudsy Rico wrote: <snip> > I'm wondering, creating a new DataSource each time we need a connection is > the right way, isn't it? If so, what could make it so cheap? > How come the DataSource is new and cheap, yet the Connection likely isn't? The whole point is that you /don't/ create a new pooled DataSource every time. All you do is obtain a reference to the DataSource and invoke getConnection on the object. The DataSource manages a pool of connections and simply returns one which is currently unused. It's cheap because you don't create a new connection; you obtain one which has been created previously. Same when you invoke Connection#close; you're actually returning the connection to the pool, making it available for reallocation at some time in the future. ============================================================================== TOPIC: Looking for simple rectangle drawing source code http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d60e3ea701323ebb ============================================================================== == 1 of 2 == Date: Fri, Dec 17 2004 7:43 pm From: "Ramon" I need to write a very simple "visual" widget drawing application. The app user will select an item from a palette and then by click and drag, create a rectangle. This must be the most common (after a simple click) operation in all the GUI environments. Anyway, I am looking for the code that implements the reactangle drawing/erasing as the mouse is dragged around. Any pointers?? TIA, -Ramon == 2 of 2 == Date: Fri, Dec 17 2004 8:03 pm From: [EMAIL PROTECTED] You might look at MouseMotionListener and MouseListener. The method for drawing a rectangle is simple. The method is drawRect and accepts 4 parameters. The first two are the x and y coordinates of the upper left corner of the rectangle. The third is the width, and the fourth is the height. ============================================================================== TOPIC: 100+ proprietary Java software ownership for sale by "The J Maker" at www.thejmaker.com http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2016a68da30632ef ============================================================================== == 1 of 1 == Date: Fri, Dec 17 2004 7:55 pm From: [EMAIL PROTECTED] Hello, Just pass on the info. It was posted at eBay with the following link: http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&rd=1&item=3861015041&ssPageName=STRK:MESE:IT Bidding price starts at $30,000 USD. It's barely 1 / 3 salary for a skilled software engineer. ============================================================================== You received this message because you are subscribed to the Google Groups "comp.lang.java.programmer" group. To post to this group, send email to [EMAIL PROTECTED] or visit http://groups-beta.google.com/group/comp.lang.java.programmer To unsubscribe from this group, send email to [EMAIL PROTECTED] To change the way you get mail from this group, visit: http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe To report abuse, send email explaining the problem to [EMAIL PROTECTED] ============================================================================== Google Groups: http://groups-beta.google.com
