comp.lang.java.programmer
http://groups-beta.google.com/group/comp.lang.java.programmer
[EMAIL PROTECTED]

Today's topics:

* ODBC Java Firebird - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4bd89240060c298f
* Question to experienced java developers - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/821bea335295193e
* How to use JAVA access Serial Port connecting to POS system? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f817de121825512b
* error - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e3bad886ebb7fc1a
* Updating JTable Cells with Custom Renderer - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5d8646feddd7c1e2
* Bah. Struts problem. Validation -- or lack thereof. - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5d69560b1a7cfa47
* getLoginName() getHomeDir() getHostName() - 3 messages, 3 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b3b96679cee9ac6e
* Understanding error - Java returned: 137 - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/20835eb83ea2fb1e
* Would like a preprocessor. - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f8d589c27ece424e
* Access to Wireless LAN ... - 2 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4b6710a272f95e58
* Thread synchronization - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/172837b7b0667fd1
* Serial Port problem - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1579f4366502d6e6
* What is happening when a thread releases a lock on an object ? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ab88ccc99bc9495b
  
==========================================================================
TOPIC: ODBC Java Firebird
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4bd89240060c298f
==========================================================================

== 1 of 2 ==
Date:   Thurs,   Sep 2 2004 7:53 pm
From: "P.Hill" <[EMAIL PROTECTED]> 

Fernando Grassi wrote:

> Alguém pode me ajudar?
no hay personas aqui que hablan Espanol y Java :-)
que neccista usar es.comp.... newgroups.

-Paul




== 2 of 2 ==
Date:   Thurs,   Sep 2 2004 8:32 pm
From: Lāʻie Techie <[EMAIL PROTECTED]> 

On Thu, 02 Sep 2004 16:00:31 -0700, Fernando Grassi wrote:

> Olá... gostaria de saber se alguém poderia me ajudar.. Estou interessado
> em saber como devo fazer para acessar o Banco de Dados Firebird, no
> windows, via driver ODBC. Baixei o XTG.
> 
> Alguém pode me ajudar?
> 
> Obrigado

Fernando,

Visitei o site do Firebird.  Vc quer o JDBC, nao o ODBC.  JDBC eh para
acessar Firebird usando java.  o ODBC eh para acessar o banco de dados com
c/c++.

Se precisar de mais ajuda, mande-me um email (tira _remove_ e _nospam_).

Boa Sorte,
La'ie Techie





==========================================================================
TOPIC: Question to experienced java developers
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/821bea335295193e
==========================================================================

== 1 of 2 ==
Date:   Thurs,   Sep 2 2004 7:55 pm
From: "P.Hill" <[EMAIL PROTECTED]> 

Marty U. wrote:

>I am wanting to see the view from someone who 
> can hold a good argument if they were provoked in discussion. 

You might try comp.lang.java.advocacy the folks over there love
that kind of thing and it's the courteous place for such discussions.

-Paul




== 2 of 2 ==
Date:   Fri,   Sep 3 2004 12:14 am
From: Tor Iver Wilhelmsen <[EMAIL PROTECTED]> 

"P.Hill" <[EMAIL PROTECTED]> writes:

> You might try comp.lang.java.advocacy the folks over there love
> that kind of thing and it's the courteous place for such discussions.

Well, currently it's dead except for the occasional off-topic
political post from our resident troll.

To the OP: Since Java is "multi-vendor" you have a great choice in
frameworks et al for web development: Jakarta Struts, Spring, Java
Server Faces, etc.




==========================================================================
TOPIC: How to use JAVA access Serial Port connecting to POS system?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f817de121825512b
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Sep 2 2004 7:57 pm
From: [EMAIL PROTECTED] (GARY CHAN) 

Hello,

I am a newbie on writing interface program, my name's GARY from HK.~

I have the spec. of the POS system. That system can be connected to PC
using serial port RS232. Something like boud rate, control signals
(e.g. 00x0F) and message format can be foud in the spec.

However, I have no exp. on writing interface program at all.

Could anyone give me tips on writing this kind of interface program?
I just know that i can use the JavaComm ext. package. but how to
write? what steps i should take and plan?

Thanks Very Very much !




==========================================================================
TOPIC: error
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e3bad886ebb7fc1a
==========================================================================

== 1 of 2 ==
Date:   Thurs,   Sep 2 2004 8:59 pm
From: "juicy" <[EMAIL PROTECTED]> 

Does anyone knows what cause an error as below
"Error :
com.ms.security.SecurityExceptionEx[fileTransfer.actionPerformed]: cannot
access "127.0.0.1":1053".
I have done a file transferring program, when i called the client applet
from html file, error has occured.




== 2 of 2 ==
Date:   Thurs,   Sep 2 2004 11:16 pm
From: "KC Wong" <[EMAIL PROTECTED]> 

> Does anyone knows what cause an error as below
> "Error :
> com.ms.security.SecurityExceptionEx[fileTransfer.actionPerformed]: cannot
> access "127.0.0.1":1053".
> I have done a file transferring program, when i called the client applet
> from html file, error has occured.

1. Applets are not allowed to access many system resources, like writing
files. Or we'll be seeing lots of computer hacked and files erased by
applets. Applets are also not allowed to connect to web sites other than the
one the applet is downloaded from.

2. Stop using Microsoft's VM. It's not standard Java, it's full of bugs,
it's full of security risks (there are virus targetting MSJVM). Download a
Java Runtime Environment (JRE) from java.sun.com. See
http://physci.org/jvmclean.jsp on how to remove MSJVM completely.

3. Source code would help people find out the problem and solution.
http://physci.org/codes/sscce.jsp

4. Stating what you're trying to accomplish will help a lot also. The
problem may not be in your code... it could be in the method you used to
solve the case.

5. This group is archived in groups.google.com. Please use a better subject
line like "SecurityExceptionEx in my applet" instead of just "error", which
means nothing. Doing so will help others to find questions already answered
through the use of Google Groups. Likewise you should search Google Groups
first before posting a question.






==========================================================================
TOPIC: Updating JTable Cells with Custom Renderer
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5d8646feddd7c1e2
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Sep 2 2004 9:24 pm
From: [EMAIL PROTECTED] (Bryan R. Meyer) 

I currently have a JTable object that utilizes the DefaultTableModel
and has three columns.  For simplicity, I'll call them "Column A",
"Column B", and "Column C" and all are text cells.  In a for loop in
my class, I'm testing a flag condition, and I'm setting a global
boolean variable that is equal to that flag.  I then add my data to
the table.  I have a custom renderer for "Column B" that colors the
text red for that particular row if the flag is true.

Unfortunately, it appears that the cells are not rendered until all of
the iterations of the loop are complete.  So, if the last value of
testFlag was true, all of the text in Column B is red.  If the last
value was false, all of the text in Column B is the standard color. 
Why are these cells not rendered immediately after the addRow method
is called?  Is there any way to force the update?  I thought my
solution was the easiest to color the individual cell.

Any ideas are appreciated.  The code is below.

Thanks,
Bryan

boolean testFlag;
for(int i; i<vector.size(); i++) {
  if(test condition is true) 
    testFlag = true;
  else
    testFlag = false;
  Object[] curMedia = {string1, string2, string3};
  data.addRow(curMedia);
}

class ColoredCellRenderer extends DefaultTableCellRenderer {
  public Component getTableCellRendererComponent(JTable table, Object
value,
    boolean isSelected, boolean hasFocus, int row, int column) {

    if(testFlag) {
      setForeground(Color.red);
    }
    else {
      setForeground(table.getForeground());
    }
    return this;
  }
}




==========================================================================
TOPIC: Bah. Struts problem. Validation -- or lack thereof.
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5d69560b1a7cfa47
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Sep 2 2004 9:38 pm
From: Steve Sobol <[EMAIL PROTECTED]> 

Sudsy wrote:
> Postscript: I got to thinking about this after my reply as there was a
> nagging memory about LC_ environment variables. If you're running some
> variant of *NIX then there's probably a man page for setlocale(3) which
> discusses some of these issues.
> If everything is "in sync" then you shouldn't encounter problems... ;-)

Redhat can bite me. They suck big hairy wet donkey nads.

I can't get it not to tag the encoding onto the end of the locale name.

And yes, I've tried the often-recommended 'edit /etc/sysconfig/i18n' and I even 
just rebooted...

**making mental note to build my next server on SuSe**

-- 
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: getLoginName() getHomeDir() getHostName()
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b3b96679cee9ac6e
==========================================================================

== 1 of 3 ==
Date:   Thurs,   Sep 2 2004 9:50 pm
From: shea martin <[EMAIL PROTECTED]> 

getLoginName() getHomeDir() getHostName()
Are there any functions in the Java API that acomplish the above?  I 
know I could probably use System.getenv(), USER/LOGNAME, HOME, HOSTNAME, 
but these variables are not always reliable, escpecially on windows 
where they only exist if the user sets them.

I have only recently returned to the world of java (after a 4 year LOA), 
but in the meantime I have been using Qt.  Qt is x-platform and provides 
these functions, so I am sure that java does as well.  But my googles 
kept turning up JSP and Jscript stuff.

Thanks,

~S



== 2 of 3 ==
Date:   Thurs,   Sep 2 2004 11:50 pm
From: Paul Lutus <[EMAIL PROTECTED]> 

shea martin wrote:

> getLoginName() getHomeDir() getHostName()
> Are there any functions in the Java API that acomplish the above?  I
> know I could probably use System.getenv(), USER/LOGNAME, HOME, HOSTNAME,
> but these variables are not always reliable, escpecially on windows
> where they only exist if the user sets them.

Not true. Various versions of Windows treat these values differently, but it
has little to do with the user's choices.

Just look at the output of System.getProperties() in each relevant platform
and adjust your code as required to accommodate the differences.

import java.util.*;

public class SystemProperties {
   
   static String tab(String s,int t)
   {
      StringBuffer sb = new StringBuffer(s);
      while (sb.length() < t) {
         sb.append(" ");
      }
      return sb.toString();
   }
   public static void main(String[] args) {
      Properties p = System.getProperties();
      for (Enumeration e = p.propertyNames() ; e.hasMoreElements() ;) {
         String key = (String) e.nextElement();
         System.out.println(tab(key,36) + " = " + p.getProperty(key));
         
      }
   }
};

-- 
Paul Lutus
http://www.arachnoid.com




== 3 of 3 ==
Date:   Thurs,   Sep 2 2004 11:44 pm
From: jungi <[EMAIL PROTECTED]> 

shea martin wrote:
> getLoginName() getHomeDir() getHostName()
> Are there any functions in the Java API that acomplish the above?  I 
> know I could probably use System.getenv(), USER/LOGNAME, HOME, HOSTNAME, 
> but these variables are not always reliable, escpecially on windows 
> where they only exist if the user sets them.
> 
> I have only recently returned to the world of java (after a 4 year LOA), 
> but in the meantime I have been using Qt.  Qt is x-platform and provides 
> these functions, so I am sure that java does as well.  But my googles 
> kept turning up JSP and Jscript stuff.
> 
> Thanks,
> 
> ~S

System.getProperties().store(System.out, "");

--list of current properties,
find out there keys which you want (user.home,...) and get it via 
System.getProperty(propertyName);

HTH

--jungi




==========================================================================
TOPIC: Understanding error - Java returned: 137
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/20835eb83ea2fb1e
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Sep 2 2004 11:28 pm
From: "Manish Hatwalne" <[EMAIL PROTECTED]> 

My application (which POLLs the remote server) fails giving error -
Java returned: 137
What does that mean????

- Manish






==========================================================================
TOPIC: Would like a preprocessor.
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f8d589c27ece424e
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Sep 2 2004 11:24 pm
From: Paul Lutus <[EMAIL PROTECTED]> 

Bent C Dalager wrote:

> In article <[EMAIL PROTECTED]>,
> Paul Lutus  <[EMAIL PROTECTED]> wrote:
>>
>>My point is that an ideal compiler will produce the same object file
>>(trivial reorderings aside) regardless of which of the legal syntax
>>choices the programmer makes in designing a specific algorithm. Same
>>speed, same size, or whatever trait was regarded as most important.
> 
> What you seem to be saying, then, is that an ideal compiler will
> always produce the exact same output for a given problem and that if
> we ignore all other possible outputs that yield the same performance,
> there is one and only one specific output such a compiler can yield.

That is not what I said. My remark obviously means that all compiled results
that produce the exact algorithm and meet all the specified requirements
are members of a set, any of which might be the result of the compilation,
and the use of different syntax approaches should not affect that outcome.

> 
> Of course, I then understand "trivial reordering" to mean "a
> difference that doesn't impact on performance". If you have a
> different definition of "trivial reordering" in mind it would help if
> you described it. On its own it is a very vague term.

See above.

> 
> If this is the case, however, then your statement isn't really of much
> interest. It's basically a bit like saying "Ford is the only car
> company in the world, given that we ignore everyone else who makes
> cars".

Yes, except that is not remotely what I said.

-- 
Paul Lutus
http://www.arachnoid.com





==========================================================================
TOPIC: Access to Wireless LAN ...
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4b6710a272f95e58
==========================================================================

== 1 of 2 ==
Date:   Thurs,   Sep 2 2004 11:26 pm
From: Paul Lutus <[EMAIL PROTECTED]> 

Michael Borgwardt wrote:

/ ...

>> You were intent on proving me wrong,
> 
> No, I was intent to explain you what I meant.

Wow. And you thought spelling corrections constituted a diversion, not
anything of substance. Guess again.

-- 
Paul Lutus
http://www.arachnoid.com




== 2 of 2 ==
Date:   Thurs,   Sep 2 2004 11:28 pm
From: Paul Lutus <[EMAIL PROTECTED]> 

Michael Borgwardt wrote:

> Paul Lutus wrote:
>>>Spelling flames. Your paltriness apparently knows no bounds.
>> 
>> 
>> It was a correction, not a flame.
> 
> It was meant to be offensive, not relevant or helpful.

If you could spell, the correction would have been unnecessary. As has been
said by many, usually to little effect, the surest way to remain illiterate
is to take offense when people try to help you.

-- 
Paul Lutus
http://www.arachnoid.com





==========================================================================
TOPIC: Thread synchronization
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/172837b7b0667fd1
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Sep 2 2004 11:46 pm
From: "Thomas G. Marshall" <[EMAIL PROTECTED]> 

Lee Fesperman coughed up:
> Chris Uppal wrote:
>>
>> Thomas G. Marshall wrote:
>>
>>> It is not the object in total that is protected.  It is a section
>>> of code that you specifically force blockage into.  If you instruct
>>> people to think that synchronization is protecting objects, then
>>> you are misleading them horribly.  The bottom line is not that they
>>> are objects.  The bottom line is that a section of executable code
>>> is protected from re-entrance by another thread.
>>
>> I disagree with this completely.
>>
>> First off, it is not -- no matter what your stance on OO, or even
>> whether you are using an OO language -- code that is being
>> protected, it is /state/.  There are one or more variables whose
>> values must be "managed" to allow correct concurrent access.  So at
>> minimum it is misleading to talk of protecting code, you should be
>> talking about protecting data.
>
> Agreed, except that you should say 'shared' state. Shared state is
> shared references and class and instance variables (but not local
> variables). Local variables can't be shared with other threads.
>
> Protecting code is the wrong concept. Perhaps it comes from the term,
> "critical section". Basically, you only synchronize threads because
> they are accessing shared state ... and you want to *protect data*
> against simultaneous access.

Commonly, but no, not just data.  For example, say you have a group of
things that you'd rather were executed all together without any one of them
being executed within another thread until you were done.  You can make the
claim that there is data /somewhere/ being kept sane, but that "data" might
be just the total output to the user, or something equally vague, but that
is of no use here.  For example, two threads executing these statements
(pseudo code):

1:
        while (true)
        {
            for (i=0; i<10; i++)
            {
                System.out.print("-");    // Dashes
                sleep(10 ms);
            }
            System.out.println();
        }

2:
        while (true)
        {
            for (i=0; i<10; i++)
            {
                System.out.print("X");    // X's
                sleep(10 ms);
            }
            System.out.println();
        }

To get these two threads to cooperate so that your output consists of
unbroken 10 character lines of dashes or x's, you need something akin to the
following.  Basically add the synchronized() block to both threads
executions...

        while (true)
        {
            // lineLock is java.lang.Object common instance between
            // all threads executing this...
            synchronized(lineLock)
            {
                for (i=0; i<10; i++)
                {
                    System.out.print("-");    // Dashes
                    sleep(10 ms);
                }
                System.out.println();
            }
        }

So where's the data being protected?  Just the output as data?  See, it's
the lines of code within the synchronized block that are of issue here.
What you want to say that is protected as a result of it is up to you.

If anyone wants to point out that this in general doesn't strictly enforce
/alternating/ lines, we can discuss that later.  You need a slightly
different mechanism for that, but this as is /does/ keep the lines whole.

IMHO the term "protect"{ing,ion} is what's leading us astray here.

In the following snippet:

        synchronized(blaLock)
        {
            bla1;
            bla2;
            bla3;
        }

The 3 lines within the synchronized block are "protected" from concurrent
access by another thread (using the same blaLock instance).  And sure, given
this, protecting those 3 lines from re-entrance will protect the object or
whatever shared resource affected by the lines.

...[rip]...

-- 
Onedoctortoanother:"Ifthisismyrectalthermometer,wherethehell'smypen???"







==========================================================================
TOPIC: Serial Port problem
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1579f4366502d6e6
==========================================================================

== 1 of 1 ==
Date:   Fri,   Sep 3 2004 12:00 am
From: Tor Iver Wilhelmsen <[EMAIL PROTECTED]> 

"<- Chameleon ->" <[EMAIL PROTECTED]> writes:

> Enumeration portList = CommPortIdentifier.getPortIdentifiers();
> 
> this command returns an empty Enumeration. Why?

Sadly, the API implementation silently fails if the DLL isn't found.

Try locating the COMM-API related DLL and put it in a directory you
reference in the "java.library.path" system property.




==========================================================================
TOPIC: What is happening when a thread releases a lock on an object ?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ab88ccc99bc9495b
==========================================================================

== 1 of 1 ==
Date:   Fri,   Sep 3 2004 12:01 am
From: [EMAIL PROTECTED] (Razvan) 

> That brings up one very important point one should always remember while using 
> the wait/ notify mechanism.  You should always be prepared for unexpected 
> notify() calls to arrive when you are "wait()ing". Receiving a notify is not
> sufficient indication that a condition that you're looking for has been 
> satisfied.  There is never a guarantee that the super class of the object you 
> are using as the monitor will not call notify() or notifyAll() on itself during 
> the execution of some of its instance methods.

        Thanks for your answer. Indeed, this seems to be the case:
previously I was synchronizing on an Object and I got the predicted
behavior. Later when I synchronized on a Thread I got the above
mentionated behavior.


> That is the reason why the construct
> 
> synchronized (object)
> {
>       while (somecondition)
>       {
>               object.wait();
>       }
> }
> 
> is the most commonly employed one (InterruptedException handling skipped for 
> clarity).  If you want to avoid this, use a new Object() constructed for just 
> synchronization purposes as your monitor.

       You are saying that there are 2 solutions to this problem:

1. use an Object (this will guarantee that you will not receive
unwanted notifications);
2. test for a certain condition in a while loop and each time you
received a notification check the condition; if the condition is not
met then call wait() again;


       Thanks again.




Regards,
Razvan



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

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/prefs

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 



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/BCfwlB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/kumpulan/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to