| AspectJ: solution to Java's repetitiveness? |
|
 |
Index ‹ java-programmer
|
- Previous
- 1
- java.sql.SQLException: ORA-00020: maximum number of processes (100) exceededHello Friends,
I am getting the following error.
java.sql.SQLException: ORA-00020: maximum number of processes (100)
exceeded
I am closing all my resultsets and all my connections in the try
block.
should i close ResultSets and Connections in the catch block aswell?.
or the problem is due to the connection pool settings in weblogic or
on the oracle side instead of in my application.
Thanks in Advance
s
- 1
- how do I encode image as stringI am trying to pass an image that I am manipulating in a java applet to
a javascript fuction, to be used there as either the source for an img
tag, or to save and/or print. Another possibility is to pass the image
up to a php script for further processing on the server. I know that
you can use ImageIO to save the image to a ByteArrayOutputStream, and
then use the stream's toString to get a string, but passing that string
to javascript truncates the image after the first 4 characters, due to a
null character (hex 0). I have been able to encode the string to
base64, but I do not know if anything more is needed to be done for the
javascript function to use it as an image.
I know that you can embed images in HTML by storing a special string
representation of the image in a javascript variable, but I do not know
what this format is. If I knew this format, I could encode the image in
Java, and then pass this string on. Any one know anything that could
help me?
Darcy Kahle
- 1
- Java license explanationCan someone explain to me if Java can be used freely like other
softwares like C++.Perl, PHP or I have to pay for its license once I
used it in programming in a company or in a website or e-commerce.
Is Java really opensource or not?
And so when will be the time you have to pay for its license?
Thanks!!!
- 3
- Download file problem in netscapeConsider this example..
I have a pdf file which is embedded in the browser and I have a
download link which is used to download that pdf file. When I click on
the download link, it is not functioning since it is the same url as
the embedded pdf and because the adobe reader is already there in the
browser it will automatically opens or the embedded pdf will goes off.
To prevent this scenario, we can use a mechanism. First create a
hidded iFrame in the same window using the following code..
<iframe style="DISPLAY: none" name="iframe1" src="">
Now make a small change to your download link so that the url target
is pointing to the hidden frame as shown below..
<a href="..." target="iframe1">Download</a>
This will solve the problem. However this method will not work with
Internet Explorer. For IE we can use another method and that method
can be choosen automatically by the browser.
More java tips @ http://sourcecentral.blogspot.com
- 3
- How Can I put XSL tag inside HTML form tag?Hello Dudes,
Sorry I couldn't find a XML/XSL group
I can only post these groups close to my subject.
In JSP (Java Server Page) you can do something
like this
<%
String v = myBean.getValue();
%>
<form .... >
<input name="myTag" value="<%= v %>">
</form>
You can do the similar thing in PHP.
But when I try in XSL I got error.
I have an XML file
<myTag attribute1="value1" />
Now I want to transform it into HTML form tag used XSL template
But XSL doesn't like this
<input name="myTag" value='
<xsl:value-of select="@attribute1" />
'></input>
How can I solve this problem?
Thank Q very much in advance!
- 3
- print a db field with html tagJ've developpe a java web application (jsp,tomcat,java) and j've used a
replacement for field "textarea" and it work fine but store in a db (oracle)
field information with html tag ... there is a program (freeware or
shareware) can j use to print this field without loss this information?
crystal report is OK but it's too expensive!!!
thank in advance
Marco
sorry for my poor english
- 6
- garbled JFrame
Ive got a a JFrame class displaying many JLabels with images inside.
It displays fine and I can drag it around the desktop ok.
But when I drag another window over the JFrame my JFrame gets garbled.(get
multiple images of the labels)
Even when i minimize it and maximize it is still garbled.
why would that be?
TIA
patrick
- 7
- JSplitPane/JScrollPane Problem?Hey,
I'm writing an interface that has a verticle split pane, the top
and bottom of which both contain JScrollPanes with JEditor panes inside
each scrollpane. It sits within a JTabbedPane which is in a
JInternalFrame on a JDesktopPane.
JDesktopPane --> JTabbedPane --> Tab --> JSplitPane --> 2 ScrollPanes
--> 2 JEditorPanes.
The first EditorPane is a source area and the second is an error
output area. It's been working fine for me, which makes my current
dilema even worse.
I need to do the same format of error for an output tab so that
the output area is on top and the error output is on bottom. I took
the code from the previous working implementation and ported it and for
some reason it didn't work. The top component JScrollPane-->
JEditorPane does not show, but the bottom one does. Also, if I just
add the JScrollPane instead of the JSplitPane to the tab, it still
doesn't show, leading me to believe that it is a problem with the
implementation of the JScrollPane. Here are the code snippets of the
working and non-working portions of my code.
-----Working-----
source = new JEditorPane();
sourceError = new JEditorPane();
sourceError.setEditable(false);
JScrollPane scrollPane = new JScrollPane(source,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
scrollPane.setBorder(BorderFactory.createEmptyBorder());
JScrollPane errorScrollPane = new
JScrollPane(sourceError);
errorScrollPane.setBorder(BorderFactory.createEmptyBorder());
sourceSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
scrollPane,
errorScrollPane);
sourceSplit.setBorder(BorderFactory.createEmptyBorder());
-----Not Working-----
expressionOut = new JEditorPane();
outputError = new JEditorPane();
expressionOut.setEditable(false);
outputError.setEditable(false);
JScrollPane outputScroller = new
JScrollPane(expressionOut,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
outputScroller.setBorder(BorderFactory.createEmptyBorder());
JScrollPane outErrorScroller = new
JScrollPane(outputError);
outErrorScroller.setBorder(BorderFactory.createEmptyBorder());
sourceSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
outputScroller, outErrorScroller);
outputSplit.setBorder(BorderFactory.createEmptyBorder());
-----How They Are Added-----
tabFrame.addTab("Source", sourceSplit);
tabFrame.addTab("Output", outputSplit);
---------------
Any Ideas on why it isn't showing expressionOut?
- 8
- CVS checkout doesn't work in Eclipse v3.0.1Hi,
Since the CVS functionality of NetBeans doesn't appear to work for
me, I'm trying Eclipse. However, the CVS functionality of Eclipse
doesn't appear to work either. When I try to do a CVS checkout in
Eclipse, a "project" does get created in my workspace, but the
contents of the CVS modules aren't actually in the project. Now, the
contents of the module are only directories to this point, because I
was looking to work on the module with Eclipse. Should this be a
problem? Should I add a least one file to the project before Eclipse
will properly checkout the module with all its subdirectories?
Thanks,
Jason
- 9
- Download the JAVA , .NET and SQL Server interview question with answersDownload the JAVA , .NET and SQL Server interview sheet and rate
yourself. This will help you judge yourself are you really worth of
attending interviews. If you own a company best way to judge if the
candidate is worth of it.
http://www.questpond.com/InterviewRatingSheet.zip
2000 Interview questions of .NET , JAVA and SQL Server Interview
questions (worth downloading it)
http://www.questpond.com/InterviewQuestions.zip
Core Java and OOP's Interview questions
http://www.questpond.com/OOPsAndCoreJava.zip
Servlets / JSP Interview questions
http://www.questpond.com/ServletsJSP.zip
Architecture Interview Question
http://www.questpond.com/ArchitectureInterviewQuestions.zip
Project Management Interview questions must to read for all aspiring
project managers
http://www.questpond.com/ProjectManagementInterviewQuestions.zip
Full Address book application in C# with technical specification ,
estimation and test cases
http://www.questpond.com/AddressbookProject.zip
Web services Interview questions
http://www.questpond.com/WebServicesAndRemoting.zip
SQL Server 2005 Database optimization Interview questions
http://www.questpond.com/DatabaseOptimization.zip
SQL Server 2005 DTS Interview questions
http://www.questpond.com/DTSInterviewQuestions.zip
SQL Server datawarehoue and Data mining Interview questions
http://www.questpond.com/DatawareHousingandDataMining.zip
SQLCLR Interview questions
http://www.questpond.com/SQLCLRInterviewquestion.zip
SQL Server XML Interview questions
http://www.questpond.com/SQLServerXML.zip
Basic .NET Framework interview questions
http://www.questpond.com/FrameWorkSampleInterviewQuestions.zip
.NET Interop and COM Interview questions
http://www.questpond.com/InteropdotnetInterviewQuestions.zip
ASP.NET Caching Interview questions
http://www.questpond.com/CachingInterviewQestions.zip
Do not know how estimations are done here's a complete book on it
http://www.questpond.com/HowtoPrepareSoftwareQuotations.zip
- 10
- help with multidimensional arraysHi
I am a newbie in the world of Java programming. I have recently started
learning the language. Apart from other hickups one which has been on
my nerves is the concept of multidimensional arrays. As far as my
understanding goes these are array of arrays.
1. WHAT DOES THIS MEAN?
2. ARE ARRAYS RESTRICTED TO THREE DIMENSIONS ONLY OR THERE IS ANY OTHER
LIMIT AND HOW DOES THREE DIMENSIONAL OR HIGHER DIM ARRAYS WORK?
Does two dim arrays represent a pigeon hole type thing in which you
find a particular hole by giving row and column address e,g. box
located at row 5 and column 2.
3. IF THIS CONCEPT OF TWO DIMENSIONAL ARRAYS IS CORRECT THEN HOW DOES
THREE DIMENSIONAL OR HIGHER DIM ARRAYS WORK.
Presently I am going through a book written by Herber Schildt known as
Java 2 complete reference, Following is a program which demonstrates
the two dim arrays. I am unable to understand the make of the program
may be so many loops are troubling me. I am especially confused about
the functioning of the question mark steps please help me out there.
// Demonstration of concept of two dimensional arrays
class twoD {
public static void main (String args [ ]) {
int [ ][ ] twoD = new int [4][5];
int i,j,k = 0;
for (i=0; i<4; i++)
for (j=0; j<5; j++) {
twoD [i][j] = k; ?
k++; ?
}
for (i=0; i<4; i++) {
for (j=0; j<5; j++)
System.out.println (twoD[i][j] + " ");
System.out.println();
}
}
}
4. HOW AND WHY SO MANY LOOPS ARE FUNCTIONING TOGETHER?
(While replying please be patient and keep in mind that u r talking to
an absolute beginner in the world of Java programming)
- 16
- In Swing, using the RTFEditorKit, how to copy/cut Formatting *and* text to the Clipboard?Hi Folks:
Any idea on the best approach to support copy/cut of all style/formatting as
well as plain text for a JTextPane? I googled quite a bit and located a
word processing program that supports JTextPane but they specifically
mention it only places "plain text" to the Clipboard and ignores the
formatting information when transfering.
I was thinking about implementing the Transferable interface and using the
Clipboard.setContents(..) method but I'm not sure yet by which procedure I
implement the getTransferData() as it wants to return an Object. I could
use a byte[] stream and return a ByteArrayOutputStream who's contents would
be filled with the Document's data (ie, plain text *and* the control/style
information). I just don't know if that would work yet but I plan to try
that.
Seems like there's very little (if anything) mentioned in the sun
developer's forum on how to do this as well as in google...
First of all, is Java's support for RTF still somewhat "primative"??? I
have a full blown word processor going which looks like Word and supports
font changes, size changes, find/replace operations, etc... It's just that
the cut/copy only transfers the plain text (despite my attempts to call
setContentType("text/rtf")) to the clipboard and not the style information.
thanks for any insight, Theron
- 16
- importing classs without package in JSP ?Hi,
i am working on apache server web based project and i want to import a
class without package in my JSP file.
All my classes are in "WEB-INF/classes"
if i use a package (such as "project") in a class (such as "match" )
then i can import class "match" in jsp using
<%@ page import="
java.util.*,
project.*
"%>
But if i dont have package then i dont know how to import my class in
JSP. Thats what i want to know .
PLease help me. i am really thankful to you guys.
Sincerely,
Jeff
- 16
- Critical Problem with Tomcat 3.3.1 and SSLHello,
I am having a serious problem trying to set up SSL on Tomcat 3.3.1 on
Windows 2000. I am following the jakarta guidelines exactly as they
propose, but I am having absolutely no luck. What am I doing wrong?
Here is the procedure I follow:
First, I run the following command -
keytool -genkey -keyalg rsa -alias name -keystore name
- I then answer the questions. I tried setting the common name as
my name, and a second time as the the URL used to access the site in
question, ie: sitename.com
Then, I issue the following command -
keytool -certreq -keystore name -alias name -file name.csr
Next, I send the name.csr file to the CA, and recieve 3 certificates.
The 3 certificates I receive are RootCert.cer, IntCert.cer and
NewCert.cer. So, I then issue the following commands in this order:
keytool -import -trustcacerts -file RootCert.cer -alias rootcert
-keystore name
keytool -import -trustcacerts -file IntCert.cer -alias intcert
-keystore name
keytool -import -trustcacerts -file NewCert.cer -alias newcert
-keystore name
After each command I receive confirmation that the certification was
properly inserted. I then copy the 'name' file to TOMCAT_HOME/conf
and edit the server.xml file. I add the following lines to the
server.xml file:
<Http10Connector
port="8443"
secure="true"
keystore="c:\tomcat\conf\name"
keypass="password"
clientauth="false"/>
Now, I restart tomcat and assume that everything should be in order.
When starting tomcat via the batch file, I see that an Http10Connector
is correctly sitting on port 8443. So, I try accessing the site
normally, and everything works fine. However, if I attempt an HTTPS
request to the site, I receive a page cannot be displayed error. This
is strange, because I figured that at this point it should work.
Well, I then attempted to access it manually by addressing
localhost:8443 .... this is where I noticed a problem. Once the
request is sent to Tomcat, Tomcat throws the following exception:
PoolTcpEndpoint: Handshake failed
javax.net.ssl.SSLException: Unrecognized SSL handshake.
at com.sun.net.ssl.internal.ssl.InputRecord.read(DashoA6275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
at com.sun.net.ssl.internal.ssl.AppOutputStream.write(DashoA6275)
at java.io.OutputStream.write(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(DashoA6275)
at org.apache.tomcat.util.net.JSSESocketFactory.handshake(JSSESocketFactory.java:270)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:479)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:516)
at java.lang.Thread.run(Unknown Source)
ThreadPool: Caught exception executing
org.apache.tomcat.util.net.TcpWorkerThread@3a8602, terminating thread
java.lang.NullPointerException
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:498)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:516)
at java.lang.Thread.run(Unknown Source)
What is going on? Luckily, I have access to a CA, so this process
isn't costing me anything, however I have attempted this multiple
times with various certificates and various settings on the
certificate and I always get this same exception. What's more, I
tried creating a self signed certificate and I still get this
exception. Am I doing something wrong? I have scoured the net
countless times and it seems like all the instructions say the same
thing. When I search for this error, none of the recomendations fit
my situation. If no one knows how to fix this, could someone please
recomend where I can go so that I can find the answer to this problem?
Please help me out, this is driving me nuts. Thanks in advance,
Dan
- 16
- Running a servlet with TomcatHi,
When I use the following URL in Internet Explorer:
http://localhost/servlet/HelloWorldExample
I get an error message:
-----8<------------
HTTP Status 404 - /servlet/HelloWorldExample
--------------------------------------------------------------------------------
type Status report
message /servlet/HelloWorldExample
description The requested resource (/servlet/HelloWorldExample) is not
available.
--------------------------------------------------------------------------------
Apache Tomcat/5.5.17
-----8<------------
I have the HelloWorldExample.class file in
C:\Tomcat5.5\webapps\ROOT\WEB-INF\classes.
Can anyone help me please?
Best regards,
Matheas Manssen
|
| Author |
Message |
Wayne

|
Posted: 2008-4-27 0:12:00 |
Top |
java-programmer, AspectJ: solution to Java's repetitiveness?
thufir wrote:
> On Sat, 26 Apr 2008 06:51:43 -0400, Lew wrote:
>
>>> attrib_writer :foo, :bar #getter and setter for foo and bar attributes,
>>> #getter setter methods aren't actually written
>> Well, Java cannot do that because it's not in the language definition
>> and because the colon character already serves three other purposes in
>> Java.
>
> That Ruby syntax doesn't work in Java isn't the point at all.
>
>> I would just go with getters/setters. What's the big deal? My IDEs
>> generate them for me, so there's no typing, and it sure helps
>> maintainers to see them.
>>
>> It would be a huge waste of energy to retrofit Java with such a feature.
>
> The point is that getter/setter methods are boilerplate. Adding such a
> feature to Java would be worth it, and Java is constantly in flux.
>
>
> -Thufir
Can't you just add a (custom) annotation, e.g. "@JavaBean", and use
apt to generate the getters/setters? (Or possibly the newer
javax.annotation* stuff?) You could add options to such an
annotation e.g., read-only.
Then add the one extra line in your ant script to build code.
Note JavaEE defines many such annotations, including for an
MX Bean. Adding a standard annotation "@JavaBean" doesn't seem
like it would be that much effort, for a large convenience payoff.
<waffle>
Like Lew I use an IDE that does that for me. Still, I don't like
dependencies on particular tools that provide special features, if
the language could easily support them with little effort.
OTOH as others have pointed out in previous threads, the JavaBean
spec is rarely used, so maybe adding more standard annotations
isn't worth it.
If the OP thinks it should be used, create or modify a JSR for this
feature; if enough others agree it will be added.
</waffle>
-Wayne
|
| |
|
| |
 |
Wayne

|
Posted: 2008-4-27 0:12:00 |
Top |
java-programmer >> AspectJ: solution to Java's repetitiveness?
thufir wrote:
> On Sat, 26 Apr 2008 06:51:43 -0400, Lew wrote:
>
>>> attrib_writer :foo, :bar #getter and setter for foo and bar attributes,
>>> #getter setter methods aren't actually written
>> Well, Java cannot do that because it's not in the language definition
>> and because the colon character already serves three other purposes in
>> Java.
>
> That Ruby syntax doesn't work in Java isn't the point at all.
>
>> I would just go with getters/setters. What's the big deal? My IDEs
>> generate them for me, so there's no typing, and it sure helps
>> maintainers to see them.
>>
>> It would be a huge waste of energy to retrofit Java with such a feature.
>
> The point is that getter/setter methods are boilerplate. Adding such a
> feature to Java would be worth it, and Java is constantly in flux.
>
>
> -Thufir
Can't you just add a (custom) annotation, e.g. "@JavaBean", and use
apt to generate the getters/setters? (Or possibly the newer
javax.annotation* stuff?) You could add options to such an
annotation e.g., read-only.
Then add the one extra line in your ant script to build code.
Note JavaEE defines many such annotations, including for an
MX Bean. Adding a standard annotation "@JavaBean" doesn't seem
like it would be that much effort, for a large convenience payoff.
<waffle>
Like Lew I use an IDE that does that for me. Still, I don't like
dependencies on particular tools that provide special features, if
the language could easily support them with little effort.
OTOH as others have pointed out in previous threads, the JavaBean
spec is rarely used, so maybe adding more standard annotations
isn't worth it.
If the OP thinks it should be used, create or modify a JSR for this
feature; if enough others agree it will be added.
</waffle>
-Wayne
|
| |
|
| |
 |
Mark Space

|
Posted: 2008-4-27 1:52:00 |
Top |
java-programmer >> AspectJ: solution to Java's repetitiveness?
Wayne wrote:
> Can't you just add a (custom) annotation, e.g. "@JavaBean", and use
> apt to generate the getters/setters? (Or possibly the newer
> javax.annotation* stuff?) You could add options to such an
> annotation e.g., read-only.
> Then add the one extra line in your ant script to build code.
>
> Note JavaEE defines many such annotations, including for an
> MX Bean. Adding a standard annotation "@JavaBean" doesn't seem
> like it would be that much effort, for a large convenience payoff.
It's also extra linguistic, which might help to keep the language small
while at the same time preserving readability. It's not one or two
getters/setters that the issue. It's when a class has twenty or thirty
that it starts to impinge on readability.
For more flexibility, something like this (syntax totally invented):
import javax.some.annotaion.framework.*;
public class PlentyAttributes {
private final static int SOME_CONST = 2;
private String internalValue;
@AttribReadOnly
{
private String value1;
private String value2;
private String value3;
private String value4;
}
@AttribMutator // = getter + setter
{
private String valueA;
private String valueB;
private String valueC;
private String valueD;
private String valueE;
private String valueF;
}
@AttribWriteOnly
{
private String valueX;
}
}
I think something like this, with braces to group fields, would improve
readability of classes with large numbers of properties, and also not
require any modifications to the core language. It could be stuffed in
a framework and left for the folks who think it would be useful.
|
| |
|
| |
 |
jhc0033@gmail.com

|
Posted: 2008-4-27 2:33:00 |
Top |
java-programmer >> AspectJ: solution to Java's repetitiveness?
mv discussion comp.lang.scheme
On Apr 26, 6:27 am, email***@***.com (Stefan Ram) wrote:
> For example, in Lisp, one can write macros for reoccuring
> idioms, but anyone who wants to read a program using them has
> to learn these macros first (or at least, when he is reading a
> usage of one of these macros).
The answer to this old argument is that this is no different from
procedures.
|
| |
|
| |
 |
ram

|
Posted: 2008-4-27 3:19:00 |
Top |
java-programmer >> AspectJ: solution to Java's repetitiveness?
"email***@***.com" <email***@***.com> writes:
>>For example, in Lisp, one can write macros for reoccuring
>>idioms, but anyone who wants to read a program using them has
>>to learn these macros first (or at least, when he is reading a
>>usage of one of these macros).
>The answer to this old argument is that this is no different from
>procedures.
In most programming languages, parameters of procedures are
strict (they are evaluated at the time of the call). This
gives the reader of an invocation of a procedure some basic
information that is always valid. (In languages with
call-by-value only, one even can deduce that a call will never
alter an argument variable.)
Macros might have lazy parameters (they do not need to
evaluate all of their arguments), which opens more
possibilities for the interpretation of a macro call than for
the interpretation of a procedure name - even in the presence
of a good mnemonic macro name. They also might modify an
argument variable or do other things procedures can't do
and are overall more powerful than procedure calls.
(In languages with more syntax than Lisp, macros or language
extensions also might add additional syntax, which also makes
reading them more difficult.)
|
| |
|
| |
 |
Mark Space

|
Posted: 2008-4-27 3:23:00 |
Top |
java-programmer >> AspectJ: solution to Java's repetitiveness?
email***@***.com wrote:
> mv discussion comp.lang.scheme
>
> On Apr 26, 6:27 am, email***@***.com (Stefan Ram) wrote:
>
>> For example, in Lisp, one can write macros for reoccuring
>> idioms, but anyone who wants to read a program using them has
>> to learn these macros first (or at least, when he is reading a
>> usage of one of these macros).
>
> The answer to this old argument is that this is no different from
> procedures.
Then why not forego macros, and use procedures?
The answer is that macros do things that procedures don't, are extra
linguistic, and are frequently abused in ways that not available in
procedures.
|
| |
|
| |
 |
Abdulaziz Ghuloum

|
Posted: 2008-4-27 3:33:00 |
Top |
java-programmer >> AspectJ: solution to Java's repetitiveness?
Mark Space wrote:
> Then why not forego macros, and use procedures?
>
> The answer is that macros do things that procedures don't, are extra
> linguistic, and are frequently abused in ways that not available in
> procedures.
In comp.lang.scheme, we frequently abuse procedures as well.
(see Guy Steele's ``Lambda: the ultimate goto''). Should we
ban lambda too by that argument?
Aziz,,,
|
| |
|
| |
 |
Mark Space

|
Posted: 2008-4-27 3:51:00 |
Top |
java-programmer >> AspectJ: solution to Java's repetitiveness?
Abdulaziz Ghuloum wrote:
> Should we
> ban lambda too by that argument?
Java did....
|
| |
|
| |
 |
QXJuZSBWYWpow7hq

|
Posted: 2008-4-27 4:18:00 |
Top |
java-programmer >> AspectJ: solution to Java's repetitiveness?
Kenneth P. Turvey wrote:
> On Sun, 20 Apr 2008 22:18:23 -0400, Arne Vajh酶j wrote:
>> You missed the point.
>>
>> Verbose does not mean repetitive.
>
> That's the thing. In Java it often does mean repetitive.
Not in my understanding of those two words.
Arne
|
| |
|
| |
 |
Arne Vajh鴍

|
Posted: 2008-4-27 4:29:00 |
Top |
java-programmer >> AspectJ: solution to Java's repetitiveness?
email***@***.com wrote:
> On Apr 21, 10:44 pm, "Arved Sandstrom" <email***@***.com>
> wrote:
>> Nobody writes code or documentation so fast
>> that their typing prowess (or lack of it) should be a drawback.
>
> Some people do. Read the first comment there:
>
> http://hathawaymix.org/Weblog/2004-06-16
>
> "I recall how one day I walked out of work and my hands hurt so much
> from typing Java code, because Java is so needlessly verbose."
If the complexity of the task is so that it is possible to type
code all day, then Java is very likely not the optimal
language. Java was not intended for such trivial tasks.
The average productivity for a Java programmer are
probably in the 10-50 lines per day range as average.
Software development is about thinking not about
typing.
Arne
PS: The article is rather funny. Statements like "Zope, it turns out,
had already solved most of the problems I had with my homegrown
application server" gives a good impression of why this person
did not like Java.
|
| |
|
| |
 |
Abdulaziz Ghuloum

|
Posted: 2008-4-27 4:32:00 |
Top |
java-programmer >> AspectJ: solution to Java's repetitiveness?
Mark Space wrote:
> Abdulaziz Ghuloum wrote:
>
>> Should we ban lambda too by that argument?
>
> Java did....
No argument then.
Aziz,,,
|
| |
|
| |
 |
QXJuZSBWYWpow7hq

|
Posted: 2008-4-27 4:33:00 |
Top |
java-programmer >> AspectJ: solution to Java's repetitiveness?
RedGrittyBrick wrote:
> Sometimes I tire of typing code like
>
> CleverGreenThing<WingNut, CorkScrew, BathTub> foo
> = new CleverGreenThing<WingNut, CorkScrew, BathTub>();
>
> I wonder if my IDE can (be trained to) expand "= new();"?
Eclipse does come with a suggestion if you type:
new CTRL/SPACE
Arne
|
| |
|
| |
 |
ram

|
Posted: 2008-4-27 5:42:00 |
Top |
java-programmer >> AspectJ: solution to Java's repetitiveness?
"Arved Sandstrom" <email***@***.com> writes:
>Nobody writes code or documentation so fast that their typing
>prowess (or lack of it) should be a drawback.
籋e used this funky ergonomic keyboard
http://www.kinesis-ergo.com/essential.htm
and when he typed it sounded like one of those ratcheting
noisemakers you spin over your head at new years.
I once came to ask him a question that I thought would
take me half an hour to figure out on my own and he
replied, "Well, let's find out" and in less than a minute
he whipped up a piece of code that answered my question.
My jaw was on the floor.?
http://xooglers.blogspot.com/2005/12/they-say-its-darkest-before-dawn.html
|
| |
|
| |
 |
Andreas Leitgeb

|
Posted: 2008-4-27 6:44:00 |
Top |
java-programmer >> AspectJ: solution to Java's repetitiveness?
Mark Space <email***@***.com> wrote:
> @AttribReadOnly
> {
> private String value1;
> private String value2;
> private String value3;
> private String value4;
> }
When I think of how Java and C++ treat differently the
"range" of a public/protected/private keyword, I'd be
very much surprised by one instance of an Annotation
being ever defined to be applied to each of a group of
items.
|
| |
|
| |
 |
Andreas Leitgeb

|
Posted: 2008-4-27 6:51:00 |
Top |
java-programmer >> AspectJ: solution to Java's repetitiveness?
Lew <email***@***.com> wrote:
> The boilerplate code is an advantage, not a problem.
You should really add that to your signature,
as it seems to be your mantra :-)
PS: You surely never omit the "value=" boilerplate when
applying such a single-argument annotations, right?
|
| |
|
| |
 |
Mark Space

|
Posted: 2008-4-27 6:53:00 |
Top |
java-programmer >> AspectJ: solution to Java's repetitiveness?
Arne Vajh鴍 wrote:
> PS: The article is rather funny. Statements like "Zope, it turns out,
> had already solved most of the problems I had with my homegrown
In Python! Lots of Java solutions out there too if you just want a
quick download. (Not you personally, you-generically. You<P> as it
were. :))
<http://java-source.net/open-source/content-managment-systems>
Lots of CMS out there, not to mention other web frameworks. Me thinks
the author of the article is setting up straw men that he can easily cut
down. I wonder how his arguments would fare against a more reasonable
opponent....
|
| |
|
| |
 |
Arne Vajh鴍

|
Posted: 2008-4-27 7:10:00 |
Top |
java-programmer >> AspectJ: solution to Java's repetitiveness?
Mark Space wrote:
> Arne Vajh鴍 wrote:
>> PS: The article is rather funny. Statements like "Zope, it turns out,
>> had already solved most of the problems I had with my homegrown
>
> In Python! Lots of Java solutions out there too if you just want a
> quick download. (Not you personally, you-generically. You<P> as it
> were. :))
>
> <http://java-source.net/open-source/content-managment-systems>
>
> Lots of CMS out there, not to mention other web frameworks. Me thinks
> the author of the article is setting up straw men that he can easily cut
> down. I wonder how his arguments would fare against a more reasonable
> opponent....
Java is certainly behind when it comes to number of CMS systems.
But he specifically mentioned app servers. Java is far ahead
when it comes to number of app servers.
Arne
|
| |
|
| |
 |
Mark Space

|
Posted: 2008-4-27 8:30:00 |
Top |
java-programmer >> AspectJ: solution to Java's repetitiveness?
Andreas Leitgeb wrote:
> When I think of how Java and C++ treat differently the
> "range" of a public/protected/private keyword, I'd be
> very much surprised by one instance of an Annotation
> being ever defined to be applied to each of a group of
> items.
>
I think there's other reasons why that would never happen, including
that braces at the class level look a lot like static initializer
blocks, and the language (or the compiler) would have to be extended to
add them.
Still I think it would be worthwhile to add some kind of "annotated
block" at the class and the method level.
|
| |
|
| |
 |
Ken Tilton

|
Posted: 2008-4-27 10:35:00 |
Top |
java-programmer >> AspectJ: solution to Java's repetitiveness?
Stefan Ram wrote:
> "email***@***.com" <email***@***.com> writes:
>
>>>For example, in Lisp, one can write macros for reoccuring
>>>idioms, but anyone who wants to read a program using them has
>>>to learn these macros first (or at least, when he is reading a
>>>usage of one of these macros).
>>
>>The answer to this old argument is that this is no different from
>>procedures.
>
>
> In most programming languages, parameters of procedures are
> strict (they are evaluated at the time of the call). This
> gives the reader of an invocation of a procedure some basic
> information that is always valid. (In languages with
> call-by-value only, one even can deduce that a call will never
> alter an argument variable.)
>
> Macros might have lazy parameters (they do not need to
> evaluate all of their arguments), which opens more
> possibilities for the interpretation of a macro call than for
> the interpretation of a procedure name - even in the presence
> of a good mnemonic macro name. They also might modify an
> argument variable or do other things procedures can't do
> and are overall more powerful than procedure calls.
We might have a forest for the trees situation here, trying to make
sense out of the value of macros by this bizarre metric of how much gets
done with arguments. That is what happens when smart people get to
bullshitting. A simpler approach to the question can be had from simple
application programmers like me, who would point out that we use macros
to hide repetitive boilerplate. Wow. That means the essence of what is
going on at any point in the code is not hard to find, everything that
is not essence is handled by the macro-expansion. The moral of the story
is that the last thing we want to know is what is being done with the
arguments, we just want the name of the macro to be honored by its
performance.
When things go wrong... can you say macroexpand? Sher ya can.
kt
--
http://smuglispweeny.blogspot.com/
http://www.theoryyalgebra.com/
"I've never read the rulebook. My job is to catch the ball."
-- Catcher Josh Bard after making a great catch on a foul ball
and then sliding into the dugout, which by the rules allowed the
runners to advance one base costing his pitcher a possible shutout
because there was a runner on third base.
"My sig is longer than most of my articles."
-- Kenny Tilton
|
| |
|
| |
 |
Lew

|
Posted: 2008-4-27 11:16:00 |
Top |
java-programmer >> AspectJ: solution to Java's repetitiveness?
Andreas Leitgeb wrote:
> Lew <email***@***.com> wrote:
>> The boilerplate code is an advantage, not a problem.
>
> You should really add that to your signature,
> as it seems to be your mantra :-)
Actually, it's your mantra. I'm repeating it to help you.
> PS: You surely never omit the "value=" boilerplate when
> applying such a single-argument annotations, right?
Oh, for crying out loud. What a stupid point.
Getters and setters are not required by Java, so don't blame Java. They're a
convention that leads to all sorts of advantages. Now stop being lazy and go
forth to write good code.
--
Lew
|
| |
|
| |
 |
Lew

|
Posted: 2008-4-27 11:20:00 |
Top |
java-programmer >> AspectJ: solution to Java's repetitiveness?
Wayne wrote:
> OTOH as others have pointed out in previous threads, the JavaBean
> spec is rarely used, so maybe adding more standard annotations
> isn't worth it.
Actually, reading over what others have pointed out in previous threads, it's
that the JavaBean spec is nearly always used. Certain aspects of it are less
popular than others, but much of it is so ingrained in the Java zeitgeist that
people don't even necessarily realize that it's JavaBeans.
--
Lew
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- empty interfaces via reflectionOn Oct 14, 12:17 pm, "Aryeh M. Friedman" <email***@***.com>
wrote:
> On Oct 14, 6:01 pm, Steven Simpson <email***@***.com> wrote:
>
>
>
> > Aryeh M. Friedman wrote:
> > > Then how do you handle the return type?!?!?!? Namely I can't do:
>
> > > Class<?> testClass = loadTestClass();
> > > Object testInstance = testClass.newInstance();
> > > Result res=new Result();
>
> > > for (Method method: testClass.getDeclaredMethods())
> > > res.merge((Result) method.invoke(testInstance, new
> > > Object[0])); // cast exception
>
> > > The reason why it is not possible is any Result object created by a
> > > test is <MyClassLoader>.Result and all the results here are
> > > <SystemClassLoader>.Result
>
> > Looking back at an earlier post, your custom MyClassLoader goes like this:
>
> > > public class MyClassLoader extends ClassLoader
> > > {
> > > public Class loadClass(String name)
> > > {
> > > try {
> > > if(name.startsWith("java."))
> > > return super.loadClass(name);
>
> > A custom ClassLoader is expected to override findClass(String) rather
> > than loadClass(String), as the latter (indirectly) accomplishes this
> > behaviour:
>
> > <http://java.sun.com/javase/6/docs/api/java/lang/ClassLoader.html>
>
> > "When requested to find a class or resource, a ClassLoader instance will
> > delegate the search for the class or resource to its parent class loader
> > before attempting to find the class or resource itself."
>
> > MyClassLoader is loading Result instead of delegating to its parent
> > first, which should always find it first.
>
> I just tested:import java.io.*;
> import java.lang.reflect.*;
>
> public class MyClassLoader extends ClassLoader
> {
> public Class findClass(String name)
> {
> try {
> //if(name.startsWith("java."))
> // return super.loadClass(name);
>
> FileInputStream fis=new FileInputStream(name
> +".class");
> byte[] b=new byte[fis.available()];
>
> fis.read(b);
> fis.close();
>
> return defineClass(name,b,0,b.length);
> } catch(Throwable e) {
> e.printStackTrace();
> }
>
> return null;
>
> }
>
> and now the class loader no longer honors recompiled classes:
>
> Script started on Sun Oct 14 15:09:05 2007
> jtest@monster:/home/jtest% java Main
> 1
> ^Z
> Suspended
> jtest@monster:/home/jtest% cat foo
> import java.lang.reflect.*;
>
> public class MyClass
> {
> public MyClass()
> {
> ack=new Integer(2);
> }
>
> public Integer getAck()
> {
> return ack;
> }
>
> private int foo;
> private Integer ack;}
>
> jtest@monster:/home/jtest% cp foo MyClass.java
> jtest@monster:/home/jtest% javac MyClass.java
> jtest@monster:/home/jtest% fg
> java Main
>
> 1
> ^C
> jtest@monster:/home/jtest% exit
> Script ends on Sun Oct 14 15:09:45 2007
>
> Just for ref here is the new main():
>
> public class Main
> {
> public static void main(String[] args)
> throws Throwable
> {
> while(true) {
> ClassLoader loader=new MyClassLoader();
> Class klass=loader.loadClass("MyClass");
>
> MyClass m=(MyClass) klass.newInstance();
>
> System.out.println(m.getAck());
> System.in.read();
> }
> }
>
> }
You should simply use UrlClassLoader and have the system classpath not
include your code that needs to be reloaded, and the URLClassLoader
have the path that DOES need to be reloaded (creating a new instance
of that class loader every time you need to reload the class)
That way, Result will be properly loaded by the System class loader,
and your reloadable class wont.
Hoep this helps,
Daniel.
- 2
- Getting JAVA_HOME at runtimeHello,
The Java ports infrastructure provides JAVA_HOME on build-time to
port's Makefile. But is it possible to get this variable from
/usr/local/bin/java at runtime?
How to change the Java version for a port at runtime in the rc
script? It is possible to set the preferred JDK in
/usr/local/etc/javavms but then JAVA_HOME still needs to be
set manually.
I would like to avoid hard-coding the JAVA_HOME at build time in
the rc scripts.
Any idea?
--
Jean-Baptiste Quenot
aka John Banana Qwerty
http://caraldi.com/jbq/
- 3
- Multiple installs of JDKWhen you do a silent install of the JRE you have the option to pass
PRIVATE=1, resulting in an install which doesn't check the registry
for a prior installation, and doesn't update the registry. You can
therefore have more than one install of the same JRE.
I need to find a similar capability for the JDK, but can't seem to. We
get rc=1603 on the second JDK install.
How can this be done...?
JDK >= 1.5.
{{{ Andy
- 4
- Tomcat on Windows: JAVA_HOME & -Dsun.io.useCanonCaches'Apologies for posting this here, but I couldn't find any Tomcat user
forum.
A colleague is currently trying to run Tomcat 4.1.30 on Windows 2000
Professional. She first installed JRE2 1.4.2_08, and set %JAVA_HOME%
to the directory C:\j2re1.4.2_08 - I've run "java -version" and it
works fine.
(%JAVA_HOME%/home is in the path correctly).
She then installed Tomcat to C:\jakarta-tomcat-4.1.30.
However, when she runs catalina.sh start, she gets the following
error:
The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program
Using CATALINA_BASE: C:\jakarta-tomcat-4.1.30
Using CATALINA_HOME: C:\jakarta-tomcat-4.1.30
Using CATALINA_TMPDIR: C:\jakarta-tomcat-4.1.30\temp
Using JAVA_HOME: C:\j2re1.4.2_08
'-Dsun.io.useCanonCaches' is not recognized as an internal or external
command,
operable program or batch file.
I've even tried adding the following to catalina.bat without success:
if not "%JAVA_HOME%" == "" goto gotJavaHome
set JAVA_HOME=C:\j2re1.4.2_08
:gotJavaHome
Can anyone see where we might be going wrong?
Cheers,
P.
- 5
- JTable and Custom Default Cell Editors
From: "Erica Wheatcroft" <email***@***.com>
Subject: JTable
Date: Thursday, January 20, 2005 4:17 PM
HI -
I have a jtable that uses two custom default cell editors to create combo
boxes for two of the the 4 columns. If the user selects another value from
either of the combo boxes i want to know that so i can indicate a save must
occur. I'm not sure what event i should listen to? Does any one have any
suggestions?
Thanks in advance.
Erica
- 6
- Simple GUI Image ProblemComputing student here, haven't used java for a while. Anyways, could someone put some example code as to how to put an image from a file onto a JPanel or JFrame. I just can't remember.
- 7
- Still looking for a Job?
http://www.xrecruiter.com is a SPAM free Recruiter Community. Post
your resume for free, get noticed directly by recruiters. Register for
free.
- 8
- Problem in configuring SSL in Tomcat5.5Hi,
I have Tomcat5.5 and J2sdk5 installed on my system. I wanted turn on
SSL services in tomcat. I went through the Tomcat Documentation and
did it exactly. I modified server.xml as below,
<!-- Define a SSL HTTP/1.1 Connector on port 8443 -->
<Connector port="8443" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25"
maxSpareThreads="75"
enableLookups="false" disableUploadTimeout="true"
acceptCount="100" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />
I also created certificate using keytool with default password as
"changeit" and alias as "tomcat".
I restarted the tomcat services too, and then tried to access the page
but i am not able to access it using https connection. Where as i am
able to access same page using Http connection.
Secondly, I am not able to access default tomcat Page too using Https
connection. Everything works fine in case of HTTP connection.
Following is the way iam trying to acces the page,
https://localhost:8443
Can any one help me out to find the problem.
I have IE 6 with SP2 installed on my system.
Thanks
Minesh
- 9
- Please help..nu bee correct probable path.. (?)
ahmed khalak wrote:
> Hi
> Thank in advance.... I am getting error when I run from prompt (cmd)..
> I installed Jdk1.5.0_09 path is C:\Program files\Java\Jdk1.......
> I have oracle 9i and oracle 10g installed...
> Path and classpath I have put correctly in windowxp.. as follow
> path=C:\oracle..etc ;C:\Program File\java\Jdk1.5.0_09\bin
> classpath= .;C:\Program File\java\Jdk1.5.0_09\lib\root.jar
> Now when I check version for java and javac.. in other then Jdk1 directory
> I am getting version 1.3.1 where as jdk gives me it version I checked oracle
> directories
> In Oracle directory.. jre show 1.3.1 directory...
> how can I correct this problem.. my simple program compiles but running from
> promp gives error..
>
> would highly appreciate help
> :-) just starting learning Java..
>
> A Khalak
Change the path setting so it reads:
PATH=C:\Program File\java\Jdk1.5.0_09\bin;C:\oracle;...
The OS looks for commands on the PATH from left to right, so starting
with java, then oracle, and so on.
Besides this. The classpath setting isn't really needed. This is a
general note which might bring in problems later. If you don't have a
real need for it, simply remove the classpath setting. You can still
pass it to the java command using the "-classpath" switch.
Regards,
Bart
- 10
- The simplest way to show a large output string?Hi,
What I want to do is quite simple: I want to show a large output String.
The user then will press "OK"; then the output window disappears, and
the program continues.
The following code would be ok for me, but the real String I want to
show is very long (let's say 1000 characters and 100 lines), so I need
scrollbars...
Could you please tell me the simplest way to achieve this? Thanks in
advance for your help.
==========================
package gui;
import javax.swing.*;
public class Prova {
public static void main(String[] args) {
String s = "hello";
JOptionPane.showMessageDialog(null, s);
System.exit(0);
}
}
=====================
- 11
- Running server-side Java on FreeBSD in production environments
So, I've seen a few mentions here of folks using Java server apps on
FreeBSD in production. I've been very happy to watch the progress by the
Java team on the native JDKs from the sidelines, as well as the
improvements to libc_r and such that have been MFC'd, but I'm curious as
to whether the consensus on this list is that it's ready to be used for
production. Anyone want to share good success or horror stories? We're
trying to determine whether the apache.org box can start to run our own
software. :) Speed is definitely less important than proper functioning.
Brian
_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"
- 12
- UK Postcodes anyone know of a service ?Hi
My latest web application provides a search facility.
You sign up as a member and get a free entry in a searchable database.
I would like to offer a postcode search so that if someone is looking for a
particular service they can enter a postcode and return results within a number
of miles of the input postcode(s). I have seen this sort of search on a number
of sites to date and I was wondering if anyone knows of a web service or other
online service that will accept a post code (and some other params of course)
and return a list of postcodes within a parameters distance.
Once I have the list I can search my own database for results.
The service must be available over the network, I'm not intetested in static
databases that I have to install on the server (well I might be if they were
FREE :-).
Has anyone implemented such a thing ?
Does anyone know of such a service ?
Has this got anything to do with the group ? well I suppose not other than I
write in Java.
Cheers
anyway
Duncan
"Process- How will the work and the team be organized?
The team needs to fit the culture in which it will operate,
but you should write software well rather than preserve the
irrationality of an enclosing culture" - Kent Beck
- 13
- An efficient computation idea. Please commentHi,
In my program I evaluate long trigonometric polynomials a lot! For example,
final int N = 1000;
double[] c = new double[N];
// Populate c
double x = .5, sum = 0.0;
for (int i = 0; i < N; i++)
sum += c[i]*cos(i*x);
And this function is evaluated very many times (about 100,000). So why not
create a java snippet, compile it, load it as a class and use the compiled
version. So I would have something like;
String sum = "0"; // A String buffer, of course...
for (int i = 0; i < N; i++)
sum += "+" + c[i] + "*cos(" + i + "*x)";
sum += ";";
I think it's a pretty cool idea. But before I implement it, I would like to
know what you think about it!
Thank you in advance!
Aaron Fude
- 14
- Initialize managed bean with header information?We use Netegrity's SiteMinder for SSO security on all web apps.
Although SiteMinder handles security for accessing the application
itself, restrictions to certain functions and data are handled within
the application based on user type.
The user information (such as name, type, etc.) are passed in from
SiteMinder via header variables. ie:
hddr_user = Joe Blo
hddr_group = Admin
hddr_phone = 555-555-5555
I'm looking at different designs to capture all of this user
information from the headers at one time and store as a bean in the
user's session (so as to not need to continually reference the header
information).
Does anyone know if you can create a managed bean (ie. User) that is
initialized with header information (by using the configuration file
w/ value-binding expressions)?
- 15
- JAXB XML Max SizHello All:
I am using JAXB to reading (unmarshall) a XML feed which
is about 4GB of siz. The JAXB seems
can not doing its job. Any one knows how to solve this problem?
ps: does JAXB has a limitation over XML feed size?
Many Thanks!
|
|
|