| Anonymous inner Classes accessing final variables? |
|
 |
Index ‹ java-programmer
|
- Previous
- 2
- Eclipse 3.08 problemEclipse show not problems, it means when I write code must every time
rebuild to view compiler errors.
How it fix?
- 2
- Corrupted JPEG: DataInput/OutputStreamHi!
I download a JPG and write it to disk; this is rather old code which
certainly worked. The only thing I'm aware of that changed is JDK 1.4 ->
1.5b2. The written file is corrupt:
URL u = new URL ("http://foo/bar.jpg");
DataInputStream in = new DataInputStream
(u.openConnection().getInputStream());
File f = new File (foo);
FileOutputStream fs = new FileOutputStream (f);
DataOutputStream out = new DataOutputStream (fs);
for (int b; (b = in.read ()) != -1;)
{
out.write (b);
}
in.close();
fs.close();
out.close();
What's wrong? And, can I repair the corrupt files?
- 3
- Reading data from a file using AntHi Everyone,
Im new to Ant and I am encountering some problems.
I have a text file which contains a value in there. I need that value
to be set into another file.
I tried using Javascript but Javascript does not support I/O for files.
Is there any command in Ant that can read a value from a text file (
eg. output.txt ) and then use that value to replace into another file (
eg. jsp ).
Thanks,
Marvin
- 8
- 8
- Java Developer - Oracle, UML, Spring, Hibernate -HOT HOT OPENINGSTitle: Java Developer - Oracle, UML, Spring, Hibernate
Company: Trinity Consultancy Services
Skills: Java Developer, Software Engineer, Java Programmer, Software
Developer, Software Programmer, Java Engineer, UML, Hibernate, Spring
- Java Developer, Software Engineer, Java Programmer, Software
Developer, Software Programmer, Java Engineer, UML, Hibernate, Spring
Trinity Consultancy Services is seeking applications from qualified
and experienced software engineers with above skills for various
requirements with their Clients.
Job description and Skills:
* Java Developer, Software Engineer, Java Programmer, Software
Developer, Software
* Programmer, Java Engineer, UML, Hibernate, Spring
* Java Developer- Oracle, UML, Spring, Hibernate
* 4+ years of Java experience
* Oracle expertise
* Knowledge of Spring and/or Hibernate and/or Tapestry
* UML experience
* Experience in creating database intensive applications from the
ground up
* Full life cycle software development
* Design and deliver complex web applications
Trinity Consultancy Services is a leading source of Information
Technology, Engineering and Management Experts that corporations of
all sizes turn to, from Global 2000 corporations to mid-sized and
small organizations nationwide. With the commitment to excellence, is
subtly managed to find, recruit, screen, submit and effectively
organize a technical workforce anywhere in the United States for
various Technical needs of corporation irrespective of its size.
Trinity Consultancy Services is one of its unique kind of the leading
information technology consulting services, and business process
outsourcing organizations committed for excellence.
Trinity provides business consulting, systems integration, application
development, staffing services and managed services to Global 2000
Corporations, medium-sized businesses, and government organizations
throughout the United States.
Trinity can mobilize the right resources, skills and technologies to
enable our clients to reach their dreams by enhanced performance. With
deep industry and business process expertise and broad global
resources, Trinity Consultancy Services is committed for excellence.
Please contact our Human Resource Manager Ms. Ann and send your
detailed Resume with your work authorization status, current salary
and expectations.
Mention the position you are applying in the subject line.
Email: email***@***.com
www.trinityconsultancy.com
- 8
- Interested in ai project in java ??hi, anybody interested in long term artificial intelligence software
project to develop an intelligent bot for stock market trading in india
?, the project is to be implemented in java using the bea weblogic
application server platform on almost all paltforms
(windows/linux/solaris/bsd), with a capability of handling the trading
accounts of thousands of clients with their perferances. if u r
interested plz let me know. i will put all the project requirements and
tools and programming languages required for the project in my project
page at http://www.aistockbot.ravichoudhari.worldfreeweb.com after 22nd
jan 2k6. if u r interested then send me a mail at
email***@***.com.
- 10
- java with swinghello to all,
I have done a java component in Swing
I have included the java component as plugin and
embedded in applet for web based access. But it is not
visible in other clients.
It is visible in Only the server.
I read javaweb start's JNLP can do that (since I
didnot want to install anything jre like in client )
is it possible.
thank you in advance,
vishnu.
- 11
- thread status jdk 1.3How can I know thread status with jdk 1.3?
It doesn't have thread.getStatus().
How can I do?
Thanks
Palmis
- 12
- log4j - openning a new fileHi,
I need to open a new log file in a specific location in the code, how
can I do that?
Log file size and number of records are unknown so I cannot use this
information.
- 14
- Make Java plugin SysTray icon visible ?I have a java plugin (for IntExp) browser which is currently for version 1.4.2_14b05
On some machines I noticed that the plugin shows an icon in the SysTray
on others not. How can I hide/unhide this Java plugin SysTray icon ?
Where are the files for this java plugin physically stored (in which directory) ?
Lars
- 14
- Instant dragging from JTreeHi NG,
I cannot drag an unselected element of a JTree. First I have to select
it, then I can drag it. Is there a way to implement that? I think I can
spare that extra click.
Best regards, Christoph
- 15
- illegalMonitorStateExceptionhello everybody!
it is well known that one has to be in the monitor of an object to call
myObj.wait(), f. E. by putting it into a synchronize(myObj) block.
my questions:
- is it bad programming style to just catch the exception without doing
the synchronize? because if i do this my program still perfectly does
what it should.
- why does this exception exist?
thanx a lot,
moritz.
- 16
- getting starting with ...... Java
I am newbie of sorts: I'm familiar with java to a some extent, but I have
never had the chance to use it. Which means, I'm not as comfortable with
it as I am with other languages (php,asp,python,c,perl,etc). What is the
best way to get comfortable? Is there any particular direction I should be
heading? I never read a book from start to end, unless it's a novel, so
with other programming languages I've learnt the fundamentals, and the
bits and pieces here and there as needed. Database connectivity, web
(server based) apps are of interest as most work I do is related to these.
Current projects include pulling stats from a database (Postgres,mysql) in
python and, a web credit card payment system in php. Im also maintaining
one of our "legacy" systems in perl.
I have lots of time, and I want use doing something productive in java,
that is my aim.
Directions will be helpfull....
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
- 16
- jsp:setProperty, java.io.File, and I thoroughly confusedHi,
I'm writing a webapp based on JSP technology. I've been doing
some reading and from what I've read, it isn't possible to use
jsp:setProperty to set a File property. So, I created a BeanInfo class
for the Bean I had the File variable in. I also created a class that
extended PropertyEditorSupport to assign the BeanInfo class to the
Bean. But, those don't appear to get called. I CAN, however with
Tomcat 5.0.28 on Windows XP, simply set a File property with
jsp:setProperty. The Bean ends up looking for the file in the Tomcat
bin directory, and I can thus set a relative path to the file. So, I'm
completely confused. What is going on? Is this expected behavior?
Thanks,
Jason Mazzotta
- 16
|
| Author |
Message |
rmn190

|
Posted: 2007-12-2 9:48:00 |
Top |
java-programmer, Anonymous inner Classes accessing final variables?
Hi
When a write an inner class inside a method , it can access the
variables in the enclosing method if and only if they are final ...
Why is the compiler enforcing this ??
What might be the reason for java doing this ?? Is it that these Local
Variables will be cached for Inner class usage ??
Thanks a lot in advance!
|
| |
|
| |
 |
Patricia Shanahan

|
Posted: 2007-12-2 9:56:00 |
Top |
java-programmer >> Anonymous inner Classes accessing final variables?
rmn190 wrote:
> Hi
>
> When a write an inner class inside a method , it can access the
> variables in the enclosing method if and only if they are final ...
> Why is the compiler enforcing this ??
>
> What might be the reason for java doing this ?? Is it that these Local
> Variables will be cached for Inner class usage ??
>
> Thanks a lot in advance!
The inner class object may still exist long after the method has
completed. The value it sees for local variables is the value they had
when the object was created.
If non-final variables had been permitted, people would have wasted time
debugging obscure run-time failures due to a variable having changed value.
Note that you can always have a final variable that exists only for the
sake of the inner class object:
{
final int innerValue = someChangingVar;
...
}
Patricia
|
| |
|
| |
 |
ram

|
Posted: 2007-12-2 10:17:00 |
Top |
java-programmer >> Anonymous inner Classes accessing final variables?
rmn190 <email***@***.com> writes:
>What might be the reason for java doing this ??
籊uy Steele wrote:
Actually, the prototype implementation *did* allow
non-final variables to be referenced from within inner
classes. There was an outcry from *users*, complaining
that they did not want this!?
http://madbean.com/2003/mb2003-49/
|
| |
|
| |
 |
Roedy Green

|
Posted: 2007-12-2 12:22:00 |
Top |
java-programmer >> Anonymous inner Classes accessing final variables?
On Sat, 1 Dec 2007 17:48:28 -0800 (PST), rmn190 <email***@***.com>
wrote, quoted or indirectly quoted someone who said :
>When a write an inner class inside a method , it can access the
>variables in the enclosing method if and only if they are final ...
>Why is the compiler enforcing this ??
see http://mindprod.com/jgloss/anonymousclasses.html
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
|
| |
|
| |
 |
getsanjay.sharma

|
Posted: 2007-12-3 0:36:00 |
Top |
java-programmer >> Anonymous inner Classes accessing final variables?
On Dec 2, 6:55 am, Patricia Shanahan <email***@***.com> wrote:
> The inner class object may still exist long after the method has
> completed. The value it sees for local variables is the value they had
> when the object was created.
>
> If non-final variables had been permitted, people would have wasted time
> debugging obscure run-time failures due to a variable having changed value.
Hello Patricia,
Can you give a real time example on what kind of complexities can
arise if non-final variables were permitted inside inner classes /
anonymous classes?
Thanks and regards,
/~STS
|
| |
|
| |
 |
Daniel Pitts

|
Posted: 2007-12-3 2:08:00 |
Top |
java-programmer >> Anonymous inner Classes accessing final variables?
email***@***.com wrote:
> On Dec 2, 6:55 am, Patricia Shanahan <email***@***.com> wrote:
>> The inner class object may still exist long after the method has
>> completed. The value it sees for local variables is the value they had
>> when the object was created.
>>
>> If non-final variables had been permitted, people would have wasted time
>> debugging obscure run-time failures due to a variable having changed value.
>
> Hello Patricia,
>
> Can you give a real time example on what kind of complexities can
> arise if non-final variables were permitted inside inner classes /
> anonymous classes?
>
> Thanks and regards,
> /~STS
I sure can. Imagine this situation:
public void stuff() {
String foo = "Hello";
Runnable r = new Runnable() {
public void run() {
while (foo.size() < 1000) {
foo += ".";
}
}
};
new Thread(r).start();
System.out.println(foo);
foo = null;
return r;
}
So, what is the behavior of this snippet when someone calls "stuff"? Is
it obvious or did you have to think about it for a while? Imagine that
the runnable returned was used from some other place in this class?
--
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
|
| |
|
| |
 |
curt

|
Posted: 2007-12-3 3:27:00 |
Top |
java-programmer >> Anonymous inner Classes accessing final variables?
rmn190 <email***@***.com> wrote:
> Hi
>
> When a write an inner class inside a method , it can access the
> variables in the enclosing method if and only if they are final ...
> Why is the compiler enforcing this ??
>
> What might be the reason for java doing this ?? Is it that these Local
> Variables will be cached for Inner class usage ??
>
> Thanks a lot in advance!
I think it's mostly just the issue that the stack frame where the local
variables live won't stay around as long as the inner class object created
will live. This means it can't work unless the compiler creates code to
allocate a new hidden object to hold the local variables instead of putting
them on the stack so that the local variables could live for as long as the
inner class object lives.
Just because the compiler won't do it for you doesn't mean you can't do it
for yourself like this:
instead of doing:
void someMethod(int a)
{
int b;
int c;
b = a + 2; // use local vars in method
c = b + 1;
new Inner() {
void method() {
System.out.prinln(a, b, c); // use local vars in inner class
}
}
}
Do it like this:
class LocalVars {
int a;
int b;
int c;
}
void someMethod(int a)
{
LocalObject locals = new LocalObject();
locals.a = a;
locals.b = locals.a + 2; // use local vars in method
locals.c = locals.b + 2;
new Inner() {
LocalVars locals;
void setLocal(LocalVars locals) {
this.locals = locals;
}
void method()
{
System.out.prinln(locals.a, locals.b, locals.c); // use local vars
}
}.setLocal(locals);
}
The second example is what the compiler would have to do for you every time
you accessed local variables from within an inner class. Any variable you
access would have to be moved into a local variable object and shared by
both the inner class and the outer method. That local variable object
would live as long as the method was active, or as long as the inner object
was still alive - whichever lived longer.
In practice, when we need to pass local data into the inner class, we don't
normally create yet another object to hold the local vars but just create
more local vars in the inner class and create setter methods so we can pass
local data into the inner class from the method which created it. Or we put
the data into instance vars of the outer class and make the inner class
access the data in the instance vars instead of accessing local vars.
I'm not sure if Patricia's example of the problems that can arise is really
all that important. That type of problem can happen no matter how you pass
the data into the inner class.
It's really just a question of whether you want the compiler creating
hidden objects for you without it being obvious in the code you have asked
it to do that. Stack frames are expected to go away when the method ends,
but to make this work, stack frames would end up living much longer (or at
least the part which was touched by the inner class). If you create a new
inner class object every time a method is called, the part of the stack
frame which the inner class touched would have to live on as well. It adds
a new dimension of behind-the-scene complexity which is questionable.
The other option is for the compiler to do what it's doing now - treating
the local vars as constants which get compiled into the inner class code or
cached in the inner class object, but do it without the restriction of the
var being final. This means it makes a copy of the current values of the
local variables at the time the inner class object is created. That could
work as well, but again, it creates confusion because syntactically that's
not what people would expect to be happening. They would expect that if
you had a long lived method that the method and the inner class object
would be accessing the same variable instead of different copies of it. So
that's why they put the final restriction on it - to make it clear because
of how it's implemented, that the inner class and outer method are not in
fact accessing the same variable even though syntactically it looks as if
they are.
--
Curt Welch http://CurtWelch.Com/
email***@***.com http://NewsReader.Com/
|
| |
|
| |
 |
Wayne

|
Posted: 2007-12-3 5:27:00 |
Top |
java-programmer >> Anonymous inner Classes accessing final variables?
Curt Welch wrote:
> rmn190 <email***@***.com> wrote:
>> Hi
>>
>> When a write an inner class inside a method , it can access the
>> variables in the enclosing method if and only if they are final ...
>> Why is the compiler enforcing this ??
>> ...
>
> I think it's mostly just the issue that the stack frame where the local
> variables live won't stay around as long as the inner class object created
> will live. This means it can't work unless the compiler creates code to
> allocate a new hidden object to hold the local variables instead of putting
> them on the stack so that the local variables could live for as long as the
> inner class object lives.
> ...
Does anyone here know how JavaScript implements closures? Just curious.
-Wayne
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- Protected inner classes and inheritanceApologies if I am missing something obvious, but here's the situation. I have
a top-level class with a protected inner class. I have a second-level class
in a different package that extends the top-level class. For example:
package somePackage;
public class TopLevel
{
protected class Inner
{
protected int intField = 0;
protected Inner()
{
// constructor
}
protected void innerMethod()
{
return;
}
}
}
package somePackage.otherPackage;
import somePackage.TopLevel;
import somePackage.TopLevel.Inner;
public class SecondLevel extends TopLevel
{
public SecondLevel()
{
// constructor
}
public void someMethod()
{
Inner inner = new Inner();
inner.intField = 1;
inner.innerMethod();
}
}
When I compile the second class, I get at least 4 errors:
The type somePackage.TopLevel.Inner is not visible
The constructor TopLevel.Inner() is not visible
The field TopLevel.Inner.intField is not visible
The method innerMethod() from the type TopLevel.Inner is not visible
I thought I read the Java docuementation clearly when is says
"The protected modifier specifies that the member can only be accessed within
its own package (as with package-private) and, in addition, by a subclass of
its class in another package."
and
"You can use the same modifiers for inner classes that you use for other
members of the outer class. For example, you can use the access specifiers --
private, public, and protected -- to restrict access to inner classes, just as
you do to other class members."
If I simply make TopLevel.Inner a public class, the errors go away. But I
don't really want to do that... Anything obvious??
thanks
scott
- 2
- Converting String<->byte[] -- No Data Loss?If I have a byte[] and I convert it to string (String sData = new
String(byte[] bData), then convert it back (byte bData = sData.getBytes()),
will all data be intact, or do Strings have problems with bytes that are
not printable characters? I've tested this and it seems to work fine, but
I want to make sure there isn't some condition or situation I'm not aware
of that could cause problems.
I'm doing this because it's easier to do some of my work with strings, so
I'm reading a Zip file, saving each entry as a String, modifying some, then
saving it as a new Zip. I've found with Zip files, you can't always be
sure of how much data you'll be able to read in, so I'm reading in data in
blocks upto 2k, then taking each block and converting it to a String, so I
can concatenate the amount read in onto the end of another string. (With
Strings, I can use sString.substring(), I can't find a way to concatenate
byte[] arrays without continually creating a new array and using
System.arrayCopy().)
Thanks for any info.
Hal
- 3
- operator precedance: new MyClass.method()Hi,
According to the operator precedence table, the dot operator has a higher
precedence than the 'new' operator:
http://java.sun.com/docs/books/tutorial/java/nutsandbolts/expressions.html
Therefore when I write
new myClass.method()
it should, according to this table, be parsed as
new (myClass.method())
which is nonsensical and doesn't compile.
It seems to be parsed as this instead:
(new myClass).method()
Is there an explanation?
****
sample code:
****
public class C {
public int i = 0;
public C(int i) {
this.i = i;
}
public int getI() {
return i;
}
public static void main(String args[]){
System.out.println(new C(20).getI());
// is parsed as:
//System.out.println( (new C(20)).getI() ); ==> ok
// but according to precedance table should be parsed as:
//System.out.println( new (C(20).getI()) ); ==> wrong
}
}
--
Rob
- 4
- java/44922: JVM crashSynopsis: JVM crash
State-Changed-From-To: open->feedback
State-Changed-By: glewis
State-Changed-When: Thu Apr 1 17:07:01 PST 2004
State-Changed-Why:
The submitter has been asked for feedback.
Responsible-Changed-From-To: freebsd-java->glewis
Responsible-Changed-By: glewis
Responsible-Changed-When: Thu Apr 1 17:07:01 PST 2004
Responsible-Changed-Why:
Over to maintainer.
http://www.freebsd.org/cgi/query-pr.cgi?pr=44922
_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"
- 5
- Eclipse Plug-insI have installed Eclipse 2.0.2. In working through the tutorial I came
upon "Creating Your First Java Project." Step #5 says this:
Click the Browse button next to the Zip file field and browse to
select
<workbenchRoot>/plugins/org.eclipse.jdt.ui.examples.projects/archive/junit/junit37src.jar.
Note: This step assumes that the JDT example plug-ins have been
downloaded and installed.
The closest thing within the IDE is this:
<workbenchRoot>/plugins/org.eclipse.jdt.ui
I have looked all through the Eclipse website. I have found several
plug-ins but not this set. Can anybody point me in the right
direction?
Bob
- 6
- weird exception during start of applet... (J2SE5)Hi,
does somebody have an idea what the exception:
java.lang.NoClassDefFoundError: IllegalName: <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
at java.lang.ClassLoader.preDefineClass(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.xml.sax.helpers.NewInstance.newInstance(Unknown Source)
at org.xml.sax.helpers.XMLReaderFactory.loadClass(Unknown
Source)
at org.xml.sax.helpers.XMLReaderFactory.createXMLReader(Unknown
Source)
at Graph.init(Graph.java:465)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
mean?
The weird thing is, i have two pages on the first one i get this
exception
and on the other one, the applet work.
Check it out
not working -> http://www.stephan-zehrer.de/LiveGraph
working -> http://www.stephan-zehrer.de/html/graph/
They both uses the same jar file.
What's wrong?
thx
Steve
- 7
- Please Please Help!!WocBSe1QFHLRlEH2Ki+Gl8DIjHmu9wcQ
Hi all,
Dont know if this is the right place to submit questions. but i need
help :(
I need to convert this pl/sql function to java function so that i can
use it my jsp page.
FUNCTION countItem(adminUser IN STRING,
m_menu IN NUMBER)
RETURN NUMBER IS
cno NUMBER := 0;
CURSOR cAdminMenu(adminUser VARCHAR2 ) IS
SELECT M.menuid,G.pageid,M.description,G.name,G.url
FROM useraccess P, pages G, menues M, submenues T
WHERE P.userid = adminUser
AND T.menuid = M.menuid
AND T.pageid = G.pageid
AND P.pageid=G.pageid
AND G.publicaccess = 'N'
UNION
SELECT M.menuid,G.pageid,M.description,G.name,G.url
FROM groupaccess P, pages G, menues M, submenues T
WHERE P.grpid IN (SELECT GRP_ID FROM GROUPUSERS WHERE USR_ID =
adminUser)
AND T.menuid = M.menuid
AND T.pageid = G.pageid
AND P.pageid=G.pageid
AND G.publicaccess = 'N'
UNION
SELECT M.menuid,G.pageid,M.description,G.name,G.url
FROM pages G, menues M, submenues T
WHERE T.menuid = M.menuid
AND T.pageid = G.pageid
AND G.publicaccess = 'Y'
ORDER BY 1,2;
BEGIN
FOR t IN cAdminMenu(adminUser) LOOP
IF t.menuid = m_menu THEN
cno := cno + 1;
END IF;
END LOOP;
RETURN cno;
END;
I would really appreciate your help.
Regards,
Ayeda
- 8
- Eclipse Javadoc Auto-Formatting: HTML Tags Trailing Spacecomp.lang.java.softwaretools -
I've been using Eclipse for a few years and am currently using 3.1. I've
noticed that whenever I include an anchor (<a>) tag in my Javadoc, the code
formatter always adds a trailing space before the closing tag. E.g.
Before: Go <a href="http://www.google.com">here</a>.
After: Go <a href="http://www.google.com">here </a>.
It doesn't happen with the <code> tag, and I'm hoping that it's configurable
somewhere. It's doesn't appear to be an option in the main Code Formatter
interface.
Thanks,
Josh
--
Josh
- 9
- struts html:checkboxHello
I have a following problem. I want to have both checked in unchecked
checkboxes on my jsp according to values i give them but i dont know how to
force chceckbox that it will be chcecked. I read somewhere that it
corresponds with ActionForm. But how can i set it up before that affect this
checkbox later in form?? I should put it in session ?it doesnt work. when
form is displayed i thought that always a new ActionForm bean is created. So
when can i change values in this bean?? Please help
Marcin Goldyn
- 10
- JNI: Accessing value in an arrayI have a code::
jobject headerVal;
//jsize size = 0;
jclass objClass;
jmethodID mid = NULL;
void * headval;
do
{
/* after this call, headval will contain a pointer to an array.and
HeadID will contain an int value.*/
GetValue( headval,headdID);
if(headval)
{
objClass = (*env)->FindClassenv, "Ljava/lang/Object;");
if(objClass == NULL)
{
break;
}
mid = (*env)->GetMethodID(env, objClass, "<init>", "(J)V");
if(mid == NULL)
{
break;
}
if(headID>0x30 || headID < 0x3F)
{
headerVal = (*env)->NewObject(env, objClass, mid,(jstring)headval);
}
else if(headerID>0x70 || headerID < 0x7F)
{
headerVal = (*env)->NewObject(env, objClass, mid,(jbyteArray)headval);
}
else if(headerID>0xB0 || headerID < 0xBF)
{
headerVal = (*env)->NewObject(env, objClass, mid,
(jbyte)headval);
}
else if(headerID>0xF0 || headerID < 0xFF)
{
headerVal = (*env)->NewObject(env, objClass, mid,
(jlong )headval);
}
}
}while(FALSE);
return headerVal;
}
I know it is not the correct way to assign headerVal. how can i assign
the value contained in array pointed by headval???
I am a beginner in c and dont know much abt pointers...
please do help me...
- 11
- Hiding table columns?Hi,
I'm no professional programmer, but I suppose I know enough about the
Table API to do most of the things I need. Now I'm trying to figure
out a good way to implement a functionality into my apps to toggle the
visibility of table columns.
I wonder if anyone here can provide some tips on how to handle this as
the TableColumn class doesn't seem to provide a setVisible() method.
All my tables use a TableModel, so I suspect that's where I need to do
most of the stuff. I'm thinking of setting up some kind of
two-dimensional array to hold the column names, and a visibility flag
for each column. In the TableModel methods I could then use that flag
to determine what columns and data should be processed.
Any help is much appreciated.
--
Luc Van Bogaert
- 12
- JDK 1.5.0_05 won't load applets from the Internet?I'm setting up a new PC with a brand-new installation of Windows XP and
Fedora Core 3 (each with all the latest updates).
I'm having trouble with the Java plug-in: it won't load any applets
from the Internet (from the local filesystem works fine). I'm behind a
SOCKS v4 proxy; the browsers and DNS are configures appropriately and
surfing the net works fine, using Mozilla and IE under Windows and
using Mozilla under Linux -- but trying to load a page with an applet
just displays the pretty coffee mug image where the applet should be,
and when I try to leave the page, the browser hangs, presumably because
the JVM is stuck trying to download the applet.
I tried reconfiguring the gateway to use plain NAT, so I could take the
proxy out of the picture, but this did not fix things.
I never had problems like these with JDK 1.4.2.*, but with 1.5.0_05, I
just can't get it to work at all. Web Start doesn't work either -- just
sits there "checking for latest version" indefinitely.
I have Java configured to use the browser's settings; configuring the
proxy settings manually makes no difference. (Of course when I use NAT
on the gateway, there is no proxy involved at all, but that does not
work either.)
N.B. The applets themselves do not appear to be the problem -- I tried
some really simple ones, including samples from the Java Tutorial;
nothing even gets pulled across the network.
I'm hoping someone can shed some light on this -- I'm stumped!
Thanks,
- Thomas
- 13
- ANNOUNCE: Ice 2.0 releasedHi,
we've just released Ice 2.0 with quite a lot of new features:
- new language mappings for Visual Basic and Python
- a new light-weight and super-efficient firewall
- a streaming API that allows you to control the encoding and decoding of
objects in arbitrary formats (or the native Ice format)
- dynamic invocation and dispatch interfaces, so you can write generic
clients and server that do not require compile-time type knowledge
- new chapters in the documentation for the new features
- numerous other improvements and bug fixes
See http://www.zeroc.com/vbulletin/showthread.php?s=&threadid=987
for more info.
Cheers,
Michi.
- 14
- type Map does not take parameters ?Hi all,
I got a strange error message from the java 1.5.0 compiler:
"type Map does not take parameters" which Map certainly does.
The complete code was this mini class:
import java.util.*;
class AAA {
public static void main(String[] args) {
Map<Integer, String> map = new HashMap<Integer,String>();
System.out.println(map);
}
}
NB, it does not compile with the original compiler, but compiles happily
within an Eclipse 3.1 environment.
And it does also compile with the original compiler when I change the
reference type from Map to HashMap.
How can this be?
Yours,
Bu.
- 15
- refactoringPatricia Shanahan <email***@***.com> writes:
> Roedy Green wrote:
>> I have always felt that a if a method can have multiple inputs it
>> should be able to have multiple outputs, but very few language
>> designers (Forth and PostScript being exceptions) have agreed.
>
> Matlab is another exception.
As is Common Lisp.
Regards,
Patrick
------------------------------------------------------------------------
S P Engineering, Inc. | Large scale, mission-critical, distributed OO
| systems design and implementation.
email***@***.com | (C++, Java, Common Lisp, Jini, middleware, SOA)
|
|
|