comp.lang.java.programmer http://groups-beta.google.com/group/comp.lang.java.programmer [EMAIL PROTECTED]
Today's topics: * Clipboard Function - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e8562b5a222df908 * Newbie needs help building project & loading/running an executable - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bb5633262bca3f87 * Java trick - 5 messages, 4 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bfd25be52dc6a3ad * J2SE 5.0 generics question - 3 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/34434161a91e61bb * Select and Edit a Record in a Table of JSP page - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/67c119eda64e5709 * JSP: Can I use something other than "jsessionid"? - 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/878ad312eb351c44 * what u program? - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ee20f99e67fd5410 * Thread for doFilter and service - is it the same ? - 2 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4d3c0ecd8f126018 * How to set Http Request Header? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b191146c7bfc3a03 * From 0 to "SUN CERTIFIED PROGRAMMER FOR THE JAVA 2" in 1 month? - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6b63d2ac9ab490fe * Is there a known algorithm for this? - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7782dfb489fc3ca6 * 'long' integer of 19 digits will not compile - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7f5887b55eeaa33c * So what is the max length of a String? - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/14481b1cace3fa93 * Can I implement INSERTs and DELETEs in DAOs or only in EntityBeans? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/44068d680f903d5e ========================================================================== TOPIC: Clipboard Function http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e8562b5a222df908 ========================================================================== == 1 of 2 == Date: Sun, Sep 19 2004 1:08 pm From: [EMAIL PROTECTED] (Aaron Crouch) I am working on a system to where I could click a button and it would insert text into the clipboard and add a timestamp. The problem I am running into is that I can not seem to incoporate variables. This is three segements of the program. How would I incorporate the todaystring into the text range being copied. var today=new Date() var todayh=today.getHours() var todaymin=today.getMinutes() var todaysec=today.getSeconds() var todaystring=todayh+":"+todaymin+":"+todaysec function ClipBoard1() { holdtext.innerText = copytext.innerText; Copied = holdtext.createTextRange(); Copied.execCommand("Copy"); } <SPAN ID="copytext1" STYLE="height:20;width:400;background-color:#041943"> <font color="#041943">text i want copied. </font></SPAN> == 2 of 2 == Date: Sun, Sep 19 2004 1:45 pm From: Andrew Thompson <[EMAIL PROTECTED]> On 19 Sep 2004 13:08:34 -0700, Aaron Crouch wrote: > I am working on a system .. ... > function ClipBoard1() > { You have the wrong group. <http://www.physci.org/codes/javafaq.jsp#js> -- 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: Newbie needs help building project & loading/running an executable http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bb5633262bca3f87 ========================================================================== == 1 of 2 == Date: Sun, Sep 19 2004 1:20 pm From: Andrew Thompson <[EMAIL PROTECTED]> On 19 Sep 2004 13:08:18 -0700, angusyoung1000 wrote: > http://www.dsptutor.freeuk.com/analyser/SpectrumAnalyser.html IE? Alt V | C (view source) Ctrl F (Find) <applet enter The applet call in the page shows you how to call the applet class. > So far I've created a project which includes the 6 files and done a > rebuild More commonly referred to as compiling. >..with no errors. How do I actually run the executable? Java programs are generally referred to as either applets or applications, rather than 'executables'. [ Follow-ups set to c.l.j.help. Please restrict your posts to c.l.j.help for the moment, though it is a good idea to read c.l.j.programmer ] -- 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 == 2 of 2 == Date: Sun, Sep 19 2004 5:25 pm From: Chris Smith <[EMAIL PROTECTED]> angusyoung1000 wrote: > I am interested looking at some java FFT source code & rebuilding some > files to get an executable. I have no experience with java but am > looking to come up to speed hopefully pretty quickly. The source code > (6 .java files zipped together) is that I'm interested in studying is > for an FFT analyzer found here: > So far I've created a project which includes the 6 files and done a > rebuild with no errors. How do I actually run the executable? Any help > will be appreciated. The code you've downloaded is something called an "applet", and it is not a stand-alone program. It's designed to be embedded into a web page. For information on how to embed an applet into a web page, see http://java.sun.com/docs/books/tutorial/applet/index.html. If you want this to run outside of a web page, then most of the code will still be usable, but you'll need to write an application-style entry point for it. Any introductory book on Java will be a good reference for writing basic Java code. -- www.designacourse.com The Easiest Way to Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation ========================================================================== TOPIC: Java trick http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bfd25be52dc6a3ad ========================================================================== == 1 of 5 == Date: Sun, Sep 19 2004 1:39 pm From: Timo Kinnunen <[EMAIL PROTECTED]> On Fri, 17 Sep 2004 17:46:22 -0600, Chris Smith wrote: > If you need to change a static constant to an instance field in a way > that you didn't anticipate, there's a LOT of vetting of existing client > code that needs to happen anyway, and the compile errors would help you > considerably. Of course, if you did anticipate the change, then the > value wouldn't be a static field in the first place. You get those compile errors simply by renaming the variable, so not getting errors is not an argument for removing that feature. Here's a usage I just thought up: class Util1 { static void foo() {} } class Util2 { static void bar() {} } class Util3 { static void baz() {} } class Main { main() { Util1.foo(); Util2.bar(); Util3.baz(); } } To move the static methods into Main, it could be changed to: class Main { static void foo() {} static void bar() {} static void baz() {} static Main Util1, Util2, Util3; main() { Util1.foo(); Util2.bar(); Util3.baz(); } } I haven't had a chance to use this, but I find it pleasing in a perverse way. == 2 of 5 == Date: Sun, Sep 19 2004 5:10 pm From: Chris Smith <[EMAIL PROTECTED]> Timo Kinnunen wrote: > I haven't had a chance to use this, but I find it pleasing in a perverse > way. I, on the other hand, don't, and I'm suprised to hear that you do (unless you mean that comment in a somewhat sarcastic way). In fact, this seems like so obviously a very bad idea that I would seriously question the wisdom of leaving someone employed after they pull a stunt like this. If a couple people have been allowed to do things like this over an extended period of time, it may well be time to scrap the project and rewrite from scratch. Competent software people do sustainable work. That's the bottom line. -- www.designacourse.com The Easiest Way to Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation == 3 of 5 == Date: Sun, Sep 19 2004 5:27 pm From: "Thomas G. Marshall" <[EMAIL PROTECTED]> Chris Smith coughed up: > Timo Kinnunen wrote: >> I haven't had a chance to use this, but I find it pleasing in a >> perverse way. > > I, on the other hand, don't, and I'm suprised to hear that you do > (unless you mean that comment in a somewhat sarcastic way). The way he phrased this makes it very clear to me that /of course/ he was being sarcastic. ...[rip]... -- Iamamanofconstantsorrow,I'veseentroubleallmyday.Ibidfarewelltoold Kentucky,TheplacewhereIwasbornandraised.ForsixlongyearsI'vebeenin trouble,NopleasureshereonearthIfound.ForinthisworldI'mboundtoramble, Ihavenofriendstohelpmenow....MaybeyourfriendsthinkI'mjustastrangerMyface, you'llneverseenomore.ButthereisonepromisethatisgivenI'llmeetyouonGod's goldenshore. == 4 of 5 == Date: Sun, Sep 19 2004 5:30 pm From: Lee Fesperman <[EMAIL PROTECTED]> Thomas G. Marshall wrote: > > Lee Fesperman coughed up: > > Thomas G. Marshall wrote: > >> The variable is declared with a type somewhere, or passed in as a > >> formal parameter of some type, etc. It is that type that determines > >> the static used, not the actual polymorphised object underneath. > > > > You completely missed my point. It is about the reference. A variable > > is not necessary. There is no 'thing' declared. Try these: > > > > new String().valueOf("*"); > > > > "".valueOf("*"); > > > > ((String) null).valueOf("*"); > > > > String.valueOf("").valueOf("*"); > > > > There are no variables involved. These all use reference expressions. > > The compiler uses the type of the reference expression to call the > > appropriate static method -- String.valueOf(). > > To me, when someone says "it's about the reference", they are in effect > saying that it's about the object that that references points to, since > that's what a reference does. No wonder you're confused. It's not about variables or declarations or about objects (since the reference could be null). It's about the type of the reference or better, the reference expression. The general form is {reference expression}.{static member} The compiler uses the type of the reference expression to determine which class/interface to find the static member in. -- Lee Fesperman, FFE Software, Inc. (http://www.firstsql.com) ============================================================== * The Ultimate DBMS is here! * FirstSQL/J Object/Relational DBMS (http://www.firstsql.com) == 5 of 5 == Date: Sun, Sep 19 2004 5:46 pm From: Lee Fesperman <[EMAIL PROTECTED]> Gary Labowitz wrote: > "Lee Fesperman" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > You completely missed my point. It is about the reference. A variable > > is not necessary. There is no 'thing' declared. Try these: > > I'm going to hit you with my semantic issue. There "sorta" is a variable > involved, but it is a "constant variable" over there in the literal pool. > And the constant variables in the literal pool have type. > > How's that for weaseling?? In my view, a string literal is different from a variable in the Java Language; the fact that it could be considered a constant variable because of the literal pool is an implementaion detail. However, I will accept your 'weasel' (I half expected such a challenge but kept the example in because it was cute) since it only requires removing one of my 4 examples: "".valueOf("*"); ... my point is still intact with the other 3 examples ;^) BTW, all of my examples have type; they have to! -- Lee Fesperman, FFE Software, Inc. (http://www.firstsql.com) ============================================================== * The Ultimate DBMS is here! * FirstSQL/J Object/Relational DBMS (http://www.firstsql.com) ========================================================================== TOPIC: J2SE 5.0 generics question http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/34434161a91e61bb ========================================================================== == 1 of 3 == Date: Sun, Sep 19 2004 1:55 pm From: Daniel Sjöblom <[EMAIL PROTECTED]> Jeff wrote: > Can anyone tell me why the following doesn't work? > > class test <T extends ArrayList> { > private T e = new ArrayList(); > } > > com\examples\test.java:28: incompatible types > found : java.util.ArrayList > required: T > private T e = new ArrayList(); > > Looking at the decompiled output from JAD, I see: <snip> You are comparing two wholly separate things: the way generics are implemented in bytecode and the generic semantics in the language. In your source, you are saying that e is of type T, where T could possibly extend ArrayList. Assigning a value of type ArrayList to e clearly violates java semantics, as specified in chapter 5.2 : <QUOTE> Assignment of a value of compile-time reference type S (source) to a variable of compile-time reference type T (target) is checked as follows: ... If T is a class type, then S must either be the same class as T, or S must be a subclass of T, or a compile-time error occurs. </QUOTE> Generics are an attempt to increase, not decrease type safety, so of course the same rules apply to generic types as well. > Is there a mailing list specifically for JDK 1.5 discussions? Not that I have heard of. You may also want to take a look at the forums at java.sun.com. == 2 of 3 == Date: Sun, Sep 19 2004 5:00 pm From: Chris Smith <[EMAIL PROTECTED]> Jeff wrote: > Can anyone tell me why the following doesn't work? > > class test <T extends ArrayList> { > private T e = new ArrayList(); > } Yep. The only thing the compiler knows about "T" is that it's assignable *to* a variable of type ArrayList, but not necessarily *from* an expression of type ArrayList. Here you are trying to assign *from* an expression of type ArrayList to T, and that's not guaranteed to be valid. To make that clearer, consider this example: class MyArrayList extends ArrayList { ... } test<MyArrayList> t = new test<MyArrayList>(); At this point, the constructor would set t's field 'e' (which is of type MyArrayList) to point to the result of the expression "new ArrayList()". That's not possible, because the result of that expression *isn't* a MyArrayList instance. Incidentally, 'test' is a poor name for a class, and especially confusing in short bits of sample code on a newsgroup. Your question and my answer would be far clearer if the class were called 'Test' instead. > Looking at the decompiled output from JAD, I see: I'm not sure what you're doing with JAD, so I can't comment on the result. It looks you've posted a type erasure of the generic type, but that isn't sufficient to prove that the original code is correct (since, after all, the whole point of generics are to be more restrictive than the type erasure). Now, if the type erasure were invalid, then that *would* prove that generic code is also invalid; but not vice versa. -- www.designacourse.com The Easiest Way to Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation == 3 of 3 == Date: Sun, Sep 19 2004 5:12 pm From: Chris Smith <[EMAIL PROTECTED]> Jeff wrote: > P.S. > > Is there a mailing list specifically for JDK 1.5 discussions? Here is fine. Newsgroups are not divided in such a topical way. Hopefully, you'll run across other interesting discussions while you're here, too. -- www.designacourse.com The Easiest Way to Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation ========================================================================== TOPIC: Select and Edit a Record in a Table of JSP page http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/67c119eda64e5709 ========================================================================== == 1 of 2 == Date: Sun, Sep 19 2004 2:07 pm From: Sudsy <[EMAIL PROTECTED]> Colin Hartill wrote: <snip> > I want to select anyone of the record and perform Edit operation. When > I press Edit button, a new screen open up and take all values of the > selected row. Where I can make changes and send the data back to > database. > I am wondering if someone can help me or sends Java and JSP code or > provides any link where I can find information. <snip> This is a fairly common paradigm, but I'm not about to give away my code for free. If you want something in the public domain then feel free to dig through the Pet Store sample application from Sun: <http://java.sun.com/developer/releases/petstore/petstore1_1_2.html> == 2 of 2 == Date: Sun, Sep 19 2004 2:24 pm From: Andrew Thompson <[EMAIL PROTECTED]> On 19 Sep 2004 12:45:49 -0700, John Rizzo wrote: > I am displaying the following Database records in a Table of my JSP > page. So you were saying on c.l.j.help, please do not multi-post John. <http://www.physci.org/codes/javafaq.jsp#xpost> -- 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: JSP: Can I use something other than "jsessionid"? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/878ad312eb351c44 ========================================================================== == 1 of 3 == Date: Sun, Sep 19 2004 1:52 pm From: Oscar kind <[EMAIL PROTECTED]> Steve Sobol <[EMAIL PROTECTED]> wrote: > PHP allows you to set the name of the session parameter. It defaults to > PHPSESSID (I believe) but you can use something else if you want. > > JSP's session handling is much more transparent but I was wondering if the spec > says there is a way to use a parameter name other than JSESSIONID to hold the > session ID. AFAIK, the spec doesn't specify its name. Also, I've worked with IBM's Websphere Application Server, which allows you to change it. Maybe another application server allows it too, but I haven't come that functionality yet. -- Oscar Kind http://home.hccnet.nl/okind/ Software Developer for contact information, see website PGP Key fingerprint: 91F3 6C72 F465 5E98 C246 61D9 2C32 8E24 097B B4E2 == 2 of 3 == Date: Sun, Sep 19 2004 5:04 pm From: Chris Smith <[EMAIL PROTECTED]> Steve Sobol wrote: > PHP allows you to set the name of the session parameter. It defaults to > PHPSESSID (I believe) but you can use something else if you want. > > JSP's session handling is much more transparent but I was wondering if the spec > says there is a way to use a parameter name other than JSESSIONID to hold the > session ID. No, it doesn't. The servlet specification (not JSP; JSP has nothing to do with session tracking) specific requires that the parameter be called jsessionid, and provides no way to choose an alternative. -- www.designacourse.com The Easiest Way to Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation == 3 of 3 == Date: Sun, Sep 19 2004 5:42 pm From: Steve Sobol <[EMAIL PROTECTED]> Chris Smith wrote: > No, it doesn't. The servlet specification (not JSP; JSP has nothing to > do with session tracking) specific requires that the parameter be called > jsessionid, and provides no way to choose an alternative. 'k. Not a big deal. -- JustThe.net Internet & New Media Services, http://JustThe.net/ Steven J. Sobol, Geek In Charge / 888.480.4NET (4638) / [EMAIL PROTECTED] PGP Key available from your friendly local key server (0xE3AE35ED) Apple Valley, California Nothing scares me anymore. I have three kids. ========================================================================== TOPIC: what u program? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ee20f99e67fd5410 ========================================================================== == 1 of 2 == Date: Sun, Sep 19 2004 2:20 pm From: Peter Ashford <[EMAIL PROTECTED]> andreas wrote: > well, > network applications mainly > also programs with a gui. > > for fast programs, there is no way around c/assembly > > andreas Hmmmm.... I've done object tracking from video in Java as long with real time 3D graphics and both of them were well fast. Not that I'm saying there's no place for assembly, but it's a very very very small place. == 2 of 2 == Date: Mon, Sep 20 2004 1:30 am From: Elspeth Thorne <[EMAIL PROTECTED]> Peter Ashford wrote: > andreas wrote: > >> well, >> network applications mainly >> also programs with a gui. >> >> for fast programs, there is no way around c/assembly >> >> andreas > > > Hmmmm.... I've done object tracking from video in Java as long with real > time 3D graphics and both of them were well fast. > > Not that I'm saying there's no place for assembly, but it's a very very > very small place. Yes, 8-bit processors and smaller. In my opinion. Elspeth. ========================================================================== TOPIC: Thread for doFilter and service - is it the same ? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4d3c0ecd8f126018 ========================================================================== == 1 of 2 == Date: Sun, Sep 19 2004 2:18 pm From: Sudsy <[EMAIL PROTECTED]> Ken Carroll wrote: <snip> > If I have something plugged in as a filter which sets some logging > context for the thread servicing the request or does something with a > ThreadLocal on that thread. Currently this is done using a master > servlet which receives the request (service) and which then delegates > real request processing to a delegate (eg struts action servlet). Well I'm no expert, but wouldn't pragmatic design principles suggest that the logging be initialized in the "master servlet"? I wouldn't recommend the use of ThreadLocal in a server framework in any case. Can't you achieve the same goal by storing a variable in the request context? Just wondering out loud... == 2 of 2 == Date: Sun, Sep 19 2004 3:38 pm From: Sudsy <[EMAIL PROTECTED]> Ken Carroll wrote: <snip> > If I have something plugged in as a filter which sets some logging > context for the thread servicing the request or does something with a > ThreadLocal on that thread. Currently this is done using a master > servlet which receives the request (service) and which then delegates > real request processing to a delegate (eg struts action servlet). I should really add something to my previous reply, since the OP explicitly mentioned ThreadLocal. From the javadocs (always the best, and should be the first, point of reference) for ThreadLocal: "ThreadLocal instances are typically private static fields in classes that wish to associate state with a thread (e.g., a user ID or Transaction ID)." Are you trying to specify a session-specific identifier? In which case my previous advice is even more applicable: put the information into the session context. I can still see no justification to create a unique identifier for each individual request. Perhaps you need to re-think your architecture? Just an idea... ========================================================================== TOPIC: How to set Http Request Header? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b191146c7bfc3a03 ========================================================================== == 1 of 1 == Date: Sun, Sep 19 2004 2:25 pm From: Asher Blum <[EMAIL PROTECTED]> In article <[EMAIL PROTECTED]>, Yuri Mikhel wrote: > I have 2 problems: > > 1. The returned page has images, files, and URL links that is relative > to the server I am connecting to. But, the client is actually > connected to my servlet on my machine. So, all the links are broken > and I can't get the images. Do I need to do URL re-writing for the > images/links to work? Can I do a sendRedirect() on the response and > yet still authenticated to the server? Are the images, files and URLs relative or absolute? Example of a relative URL: "/images/up_arrow.gif". Example of an absolute URL: "http://some.org/images/up_arrow.gif". If they are relative, you can add a <base href> element to the head of the document before returning it to the client. Example: <base href="http://www.some.org/"> > > 2. I copied an URL that I know exist on the application to the > browser. Since my servlet (not the browser) was sending the auth > header, I was not able to go to that page on that application. The > application is asking me to login again with the Basic Auth dialog. > This tells me that the browser did not send the authorization header > on my next request. How do I store the authorization header created by > the servlet INTO THE BROWSER, so that it will be sent on all > subsequent requests? You can insert authentication into a URL: http://joebob:[EMAIL PROTECTED]/somefile.html If you return such a modified URL to the client, the client should be able to access the URL without further authentication. Hope this helps. ========================================================================== TOPIC: From 0 to "SUN CERTIFIED PROGRAMMER FOR THE JAVA 2" in 1 month? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6b63d2ac9ab490fe ========================================================================== == 1 of 2 == Date: Sun, Sep 19 2004 3:09 pm From: "Bart Verdonck" <[EMAIL PROTECTED]> Well, it isn't a solid programmer education program. And it's realy a good school, it was only for the interested ones. "Chris Smith" <[EMAIL PROTECTED]> schreef in bericht news:[EMAIL PROTECTED] > Bart Verdonck wrote: > > Everything is possible! > > > > but, don't underestimate the test. It ain't easy... > > You're right that the SCJP test isn't easy (or, in any case, wasn't last > time I took it, which was over three years ago). That said, it's not > difficult to pass, assuming that you know Java. That's because of the > ridiculously low passing score. If you wanted to make a decent score > (say, 80% or so), then the task would become more formidable. > > > Last year my school got 40 free vouchers for the exam. As far as I know, > > only two (including myself) pasted the test. > > That's really scary, but I'm afraid it might say more about school > educations in programming than about the test. > > -- > www.designacourse.com > The Easiest Way to Train Anyone... Anywhere. > > Chris Smith - Lead Software Developer/Technical Trainer > MindIQ Corporation == 2 of 2 == Date: Sun, Sep 19 2004 5:14 pm From: Chris Smith <[EMAIL PROTECTED]> Bart Verdonck wrote: > Well, it isn't a solid programmer education program. And it's realy a good > school, it was only for the interested ones. I suspect that the problem is more with CS education in general than with your specific school. Universities turn out surprisingly few students who are capable of learning and understanding technical details in a reliable way. -- www.designacourse.com The Easiest Way to Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation ========================================================================== TOPIC: Is there a known algorithm for this? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7782dfb489fc3ca6 ========================================================================== == 1 of 2 == Date: Sun, Sep 19 2004 3:32 pm From: Paul Lutus <[EMAIL PROTECTED]> Gerald Rosenberg wrote: / ... > Did "need to determine whether any two adjacent text lines are single > spaced, 1.5 spaced, or multiple spaced" not relate what I am trying to > accomplish? No, that is a statement of a bit of data you need to solve the problem you don't state. > >> >> Another poster has recommended a fourier transform, but I think this is >> overkill. A histogram approach will work for any case except many >> integers with little in common with each other. I don't think this is >> what you face. >> >> > >> > Seems like there should be an analytic solution, but auto-correlation >> > doesn't seem right. Some kind of quantized best-fit? >> >> Why not state the problem to be solved before hypothesizing about a >> solution? > > Sure: In practical terms, I have the Y-axis pixel locations of lines of > text on a page (which are approximations) and need to determine whether > any two adjacent text lines are single spaced, 1.5 spaced, or multiple > spaced. What problem is this a part of? What good thing are you slowly working toward by categorizing these line spacings? -- Paul Lutus http://www.arachnoid.com == 2 of 2 == Date: Sun, Sep 19 2004 4:22 pm From: Gerald Rosenberg <[EMAIL PROTECTED]> In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says... > Gerald Rosenberg wrote: > > / ... > > > Did "need to determine whether any two adjacent text lines are single > > spaced, 1.5 spaced, or multiple spaced" not relate what I am trying to > > accomplish? > > > OK. World peace through analysis of existing imaged document > > collections. ;-) Documents are imaged, OCR'd, and PDF'd. The PDF is a > > given. Now I need to figure out the document structure from an analysis > > of the PDF command and data stream. > > Your suggestion regarding histograms was helpful. Thanks, Gerald ========================================================================== TOPIC: 'long' integer of 19 digits will not compile http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7f5887b55eeaa33c ========================================================================== == 1 of 1 == Date: Sun, Sep 19 2004 4:22 pm From: "Thomas G. Marshall" <[EMAIL PROTECTED]> VisionSet coughed up: > "Keith Valentine" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> I am learning about integer types and I have found that when I try to >> compile code that assigns the highest or lowest 'long' integers to a >> 'long' type variable I receive the errors: >> >> "integer number too large: -9223372036854775808" >> >> Or >> >> "integer number too large: 9223372036854775807" >> >> These values contain 19 digits, however values containing a maximum >> of 9 digits will compile without a problem. >> > > You are probably doing this: > > long lng = 9223372036854775807; > > which you can't do because the literal value 9223372036854775807 is > being taken as an integer which it obviously isn't. > You must do this: > > long lng = 9223372036854775807L; > > which tells the compiler you wish to have the literal treated as a > long. All literals are taken as an int unless you specify otherwise. Yes, always been that way. But in the OP's defense, IMHO the jls really /should/ have allowed for implicit type conversion when the immediate value is very large. > > The error message gives you a clue: > > "integer number too large" it has failed to recognise that you want > it to be a long. -- "It's easier to be terrified by an enemy you admire." -Thufir Hawat, Mentat and Master of Assassins to House Atreides ========================================================================== TOPIC: So what is the max length of a String? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/14481b1cace3fa93 ========================================================================== == 1 of 2 == Date: Sun, Sep 19 2004 5:05 pm From: [EMAIL PROTECTED] (Kaidi) Anyone has any idea? The reason is: when I try to use the writeUTF of ObjectOutputStream to write out a String, I get the error of UTFDataFormatException exception. I traced it to the ObjectOutputStream class, and found the lines where the exeception happens look like: void writeUTF(String s, long utflen) throws IOException { if (utflen > 0xFFFFL) { throw new UTFDataFormatException(); } ..... ... } So it only allows the String to be at max 0xFFFFL? Why has such a restriction? PS: actually I am not writing out a too large String, it is only a String which is the content of a 90K plain text file! Thanks. == 2 of 2 == Date: Sun, Sep 19 2004 5:19 pm From: Chris Smith <[EMAIL PROTECTED]> Kaidi wrote: > Anyone has any idea? > The reason is: when I try to use the writeUTF of ObjectOutputStream to > write out a String, I get the error of UTFDataFormatException > exception. > I traced it to the ObjectOutputStream class, and found the lines where > the exeception happens look like: > > void writeUTF(String s, long utflen) throws IOException > { > if (utflen > 0xFFFFL) { > throw new UTFDataFormatException(); > } > ..... > ... > } > > So it only allows the String to be at max 0xFFFFL? Why has such a > restriction? A String can be up to 2 billion or so characters long (2^31 - 1, actually). However, a string longer than 65535 (2^16 - 1) characters cannot be written in the format used by DataOutputStream.writeUTF. That's because the format used by writeUTF is byte-counted, and leaves only a 16-bit space for the count. You will need to find a different format to write in. > PS: actually I am not writing out a too large String, it is only a > String which is the content of a 90K plain text file! Are you sure you want the binary format used by writeUTF? Perhaps you mean to write a plain text String instead? The latter would be fairly simple. -- www.designacourse.com The Easiest Way to Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation ========================================================================== TOPIC: Can I implement INSERTs and DELETEs in DAOs or only in EntityBeans? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/44068d680f903d5e ========================================================================== == 1 of 1 == Date: Sun, Sep 19 2004 4:57 pm From: Andrew Tyson <[EMAIL PROTECTED]> <snip> > DAOs anyway, including the additional functionality there would achieve > the same goal. You will have to manage transactions programmatically > (using JTA) rather than declaratively, however. <snip> Why is that ? We have Stateless Session EJB components that use DAOs that implement JDBC for updates and inserts, however the container demarcates the trx. As long as your using a pooled connection that can participate in the container managed trx this is a perfectly valid approach. Regards, AT ======================================================================= You received this message because you are subscribed to the Google Groups "comp.lang.java.programmer". comp.lang.java.programmer [EMAIL PROTECTED] Change your subscription type & other preferences: * click http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe Report abuse: * send email explaining the problem to [EMAIL PROTECTED] Unsubscribe: * click http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe ======================================================================= Google Groups: http://groups-beta.google.com
