 |
 |
Index ‹ java-programmer
|
- Previous
- 2
- problems with getting blob from databaseI`m writing from file to blob. Than I need to get blob content again
and write it to file. When I open this file, I see the wrong symbols.
Can anybody help me?
Here is my code:
////////////////////////////
to update file content
///////////////////////////
private void updateFileContent(File serverFile, java.io.File
clientContentFile) throws MainException
{
PreparedStatement preparedStatement = null;
try
{
connection = connect();
String query = "update panta_file_substance\n" +
"set content = ?\n" +
"where\n" +
" file_id = ?"
preparedStatement = getPreparedStatement
(query, connection);
int fileLenght = (int) clientContentFile.length();
InputStream is = new FileInputStream(clientContentFile);
preparedStatement.setBinaryStream(1, is, fileLenght);
preparedStatement.setLong( 2,
serverFile.getId().longValue() );
int result = preparedStatement.executeUpdate();
is.close();
}
catch (SQLException e)
{ throw new MainException(e.getMessage(), e); }
catch (FileNotFoundException e)
{ throw new MainException(e.getMessage(), e); }
catch (IOException e)
{ throw new MainException(e.getMessage(), e); }
finally
{
disconnect(null, preparedStatement, null);
}
}
//////////////////////////////////////////////////////////////////////////
to get file
/////////////////////////////////////////////////////////////////////////
public static void getFile(Connection connection) throws
SQLException
{
String query = "select \n" +
" panta_file_substance.content \n" +
"from \n" +
" panta_file_substance\n" +
"where \n" +
" file_id=?";
PreparedStatement preparedStatement = connection.
prepareStatement(ServerSQLProjectDAO.getFileContent());
preparedStatement.setLong(1, 7801295236381635588l);
ResultSet resultSet = preparedStatement.executeQuery();
Blob content = null;
if (resultSet.next())
{
content = (Blob) resultSet.getBlob("CONTENT");
}
java.io.File contentffFile = new java.io.File("C:\\Temp\\new");
try
{
OutputStream os = new FileOutputStream(contentffFile);
int bufferSize = 2048;
byte[] array = new byte[bufferSize];
BufferedOutputStream bos = new BufferedOutputStream(os,
bufferSize);
InputStream is = content.getBinaryStream();
BufferedInputStream bis = new BufferedInputStream(is);
int nBytes;
while ((nBytes = bis.read(array)) != -1)
bos.write(array, 0, nBytes);
bos.close();
bis.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
- 3
- Server-side tools surveyI'm currently working with JBoss/Tomcat, PostgreSQL, NetBeans, Struts,
XDoclet, Ant, JUnit, JUnitEE...and a few things I've probably forgotten
to mention.
What tools do *you* consider necessary for web application development?
--
Phillip Mills
Multi-platform software development
(416) 224-0714
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
- 4
- Problems with tomcatHi guys, I have some problems, I'm trying to run tomcat in windows
2000 pro and actually it runs but when I use the browser http://localhost:
doesn't work, What should be the problem? I've changed the port to 80
but still having the same problem. Thx in advance
- 5
- Open Source Distributive Cache solutionHi,
I am looking for an open source's distributive cache solution. One that
can be used for a clustered weblogic servers environment, the cache has
to be read and write, and the cache itself need to be fail-safe.
Anyone has some recommandations?
Thanks,
Edmond
- 5
- How to stop output to stdoutHi,
I am using RXTXcomm to communicate with the serial interface. My
programs output this everytime the RXTXcomm library is loaded:
Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version = RXTX-2.1-7
I don't like this output anytime the program runs. I tried to redirect
System.out but it didn't work. Does anybody know how to put RXTXcomm
into "silent mode"?
Thanks, Juergen
- 5
- Cannot draw on mutable imageHi,
I got a problem with drawing on an image created with the
createImage(int width, int height) method. I use MIDP 1.0 and
everything works fine in the emulator. But when running it on my
T-630, I just get a white image with the defined size. It doesn't
matter what I draw on the Graphics-object, my phone just displays a
white rectangle.
The code should be ok, since it works in the emulator. I also used
several examples from the internet - all with the same result.
Any ideas what might be wrong?
Thanks in advance
Dirk
- 5
- As an added bonus, cacti come in unique shapes and sizes, and many even show off colorful blooms.Those unevolved men truly irritate me.
Having twice defeated the counterrevolution, the revolution is faced
with a new and furious offensive. Perhaps unbeknownst to him, the stance
he has adopted seems to reinforce the negative image of Islam, that of
rabid militancy against all other faiths. This week, I have some great
ideas on how to make your own plant markers from common household items.
If you haven't noticed, a lot of garden centers and nurseries are
running clearance sales on plants and other garden supplies.
ss
*** CNHC *** CNHC *** CNHC ***
Trade Date: Friday, November 24, 2006
Company: China Health Management Corp.
Symbol: CNHC
Price: $1.34
Target: $10
CNHC BREAKING NEWS:
China Health Management Corp. Announces the Hospital's Setup Proposal
Received Additional Approval from Kunming City, Yunnan, China
CNHC IS BOUND TO BLOW UP! THIS AMAZING NEWS ALONG WITH HEAVY PR PROMOS
ARE DRIVING IT NUTS! WATCH CNHC GO OFF THE CHAIN ON FRIDAY NOV 24!
ss
Does the mere mention of these ailments make your skin itch? His efforts
were all the more heroic for being nonviolent. As an added bonus, cacti
come in unique shapes and sizes, and many even show off colorful blooms.
That's why I was so thrilled when I came across this tip that makes slow
watering my plants easier than ever. Zakaria might not be enhancing the
global image of Islam in the manner majority world Muslims would prefer:
an image of peace.
Sometimes they were sweet, sometimes they were bitter, and they were
always difficult to harvest after a snowfall.
But US scientists report they have now isolated these cell-like
structures in tissue from diseased human arteries.
Well, don't head to your local drugstore for relief - go to your garden.
Find out how to make a charming and unique windchime that will make your
garden a haven for your senses.
His efforts were all the more heroic for being nonviolent. The article
published in The Toronto Star describes the harsh reality that millions
of poor are facing in India.
Zakaria might not be enhancing the global image of Islam in the manner
majority world Muslims would prefer: an image of peace.
His efforts were all the more heroic for being nonviolent.
Daffodils, also known as jonquils or narcissus, are my favorites.
Daffodils, also known as jonquils or narcissus, are my favorites.
The wives or kiths and kin of the Ministers or MPs, her beloved
sycophants are flocking in her or the BNP offices may be at Hawa Bhaban
also, to try their luck.
Click on the link below for more poinsettia information. Does the mere
mention of these ailments make your skin itch? Click on the link below
to find a great way to reuse your tree in the garden.
If the allegations in this article are true, things look bleak for peace
in the Middle-East.
That's why I was so thrilled when I came across this tip that makes slow
watering my plants easier than ever. So the Americans are cutting off
money to Chalabi. The moral of the story, according to Aesop: it is
easier to get into the enemys toils than out again. The article
published in The Toronto Star describes the harsh reality that millions
of poor are facing in India. This week I'll show you four simple things
you can add to get your soil started down the road to perfection.
Zakaria might not be enhancing the global image of Islam in the manner
majority world Muslims would prefer: an image of peace.
I beg your Majesty's pardon, replied the fox, but I noticed the track of
the animals that have already come to you, and while I see many hoof
marks going in, I see none coming out. How come they were so gullible
that they had overlooked his scam filled past and now all of a sudden
the good man is becoming an evil man? If the allegations in this article
are true, things look bleak for peace in the Middle-East. Here are four
simple things that can help you keep your garden balanced visually. But
a little basic know-how can make the job a breeze.
--
To UNSUBSCRIBE, email to email***@***.com
with a subject of "unsubscribe". Trouble? Contact email***@***.com
- 6
- Mac version of IE tires to download sounds rather than playing them.
I've done a web site which encorporates javascripted sound behaviors.
On the PC version of Internet Explorer they do what they're supposed
to do. That is, play the sound on both "mouse over" and "mouse up"
events.
On the Macintosh version of IE it triggers off an automatic download
attempt. I have also seen this on some PC's running Netscape, but
rarely.
Opera doesn't even seem to do anything with the sound events on the
Mac. The PC version of Opera seems to work correctly.
So, my question: is there a way to code this using Dreamweaver or
some other authoring program, so it can be controlled on these
different combinations of browsers, and Computer Platforms?
I've found this most frustrating.
Thanks for any help you might give on this.
S.
- 6
- use my JSP custom tag on click of buttonI have written a custom tag in a jsp
<test:attribs attribNames="<%=aenum%>">
<li> <b><%=aenum.nextElement()%></b>
</test:attribs>
It lists the request attributes.
Now i want the to list the same on click of a button or say on clicking
on an image( or consider for some specified event of a HTML component)
Can i use the custom tag for the same and if yes how?
Regards,
- 7
- Trying to create a database in a MS Access DB via JDBC drivers. I am trying to create a database in a MS Access DB via JDBC drivers.
I have tried both sun.jdbc.odbc.JdbcOdbcDriver and ids.sql.IDSDriver
From some reason both drivers Exceptions tell me 'Syntax error in
CREATE TABLE statement' even though I am not creating a table, but a
Database
// - - - - - - - - - - - - sun.jdbc.odbc.JdbcOdbc
aSQL=CREATE DATABASE dbtest;
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]
Syntax error in CREATE TABLE statement.
at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcStatement.execute(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(Unknown
Source)
at JDBCDL00.createCtlg(JDL00.java:200)
at JDL00.main(JDL00.java:505)
// - - - - - - - - - - - - ids.sql
aSQL=CREATE DATABASE dbtest;
java.sql.SQLException: [42000][Microsoft][ODBC Microsoft Access
Driver] Syntax error in CREATE TABLE statement
at ids.sql.IDSSocket.error(IDSSocket.java:374)
at ids.sql.IDSSocket.verify(IDSSocket.java:320)
at ids.sql.IDSStatement.submit(IDSStatement.java:157)
at ids.sql.IDSStatement.execute(IDSStatement.java:479)
at ids.sql.IDSStatement.executeUpdate(IDSStatement.java:270)
at JDBCDL00.createCtlg(JDL00.java:200)
at JDL00.main(JDL00.java:505)
Does it mean MS Access does not have a concept of a BD, since it is
kind of a file base Data Store?
There is also something I don't quite know how to interpret.
When you ask the JdbcOdbc driver for Catalogs it gives you
. . .\Office\Samples\ADDRBOOK
. . .\Office\Samples\CONTACT
. . .\Office\Samples\INVENTRY
. . .\Office\Samples\Northwind
even if you declare the a USer DSN only to
. . .\Office\Samples\Northwind
Experimentally I dropped a copy of
. . .\Office\Samples\Northwind.mdb
in
. . .\IDS\File\examples
and set up a system DSN to got IDSExamples.mdb
However, while query the DBMS for catalogs, I got
. . .\IDS\File\examples\IDSExamples
. . .\IDS\File\examples\Northwind
Does it mean Access considers the folder containing the '.mdb' file
as sort of a 'schema'?
How could u still create a Database using JDBC in a MSAccess DB?
- 9
- SourceDataLine ProblemA while back I implemented sound using javax.sound.sampled into my Tandy
Color Computer 2 applet.
The Color Computer had a 6-bit DAC used to generate audio. I basically
take the values written to the DAC and then feed them (although at a
much higher rate) into a SourceDataLine.
The problem is that the sound can crackle or break up depending on the
program emulated. I can prevent this by either feeding the data to the
SorceDataLine at a higher rate or by reducing the sample rate on the
AudioFormat. Both of these methods fix the breakups but then the pitch
drops enough that the sound is no longer accurately emulated.
I just don't understand the workings of javax.sound.sampled well enough
to figure out a workaround for this problem - it seems like it should be
possible.
Any ideas?
Brad
Mocha - The Tandy Color Computer 2 Applet
http://members.cox.net/javacoco/
- 14
- Basic java program structure; Was: Problems with multidimensional arrays and global variables<top posting seemed more appropriate for this post>.
Being a Java newbie and having been struggling with the basic concepts of
the structure of a java program (as well as "static") I would like to say
that this is the best example I have seen so far of the basic form of a java
program. Nice, simple and after reading it I think I finally understand
what is going on. I have read far too many books and examples that seem to
enjoy obfuscating the concept they are trying to explain with way too many
extraneous details.
Thank you.
Don Freeman
If this group has a FAQ I nominate the following for entry:
"Carl" <email***@***.com> wrote in message
news:fS8Pd.3241$email***@***.com...
> In short, static members do not belong to an object. You do not need to
> create an object to access the members. The main() method must be static
> since it will be the first method called and there will not yet have been
> a chance for you to create any objects. IMO, the main method should then
> proceed to operate on OBJECTS, unless you have a good reason for using
> static.
>
> A simple class example would be as follows:
> // code -->
> public class Foo {
>
> // this can be accessed by any of Foo's methods
> private int someVariable;
>
> // This gets called when a new Foo object is created.
> public Foo(){
> // do initial setup
> }
>
> public void runProgram(){
> // start doing your processing
> }
>
> public static void main(String[] args) {
> // process args[]
>
> Foo foo = new Foo(); // create an instance of the Foo class.
> foo.runProgram(); // start running the Foo class.
> }
> }
> // <-- end code
- 15
- best approach for transaprent boxes
I'm hoping for some guidance on the best way to do the following, since I am fairly new to the Java language.
I am building an applet that uses a canvas to show a map (awt only - no swing). I want to display semi-transaparent boxes over the top of the map to show things like status, or have options, and the boxes should be able to process mouse events. The canvas is using a double-buffered strategy and uses Graphics2D.
My first thought was to simply design lightweight components - but they require a container, which the Canvas is not.
So then I thought I would extend the Canvas class to work with another completely custom "decorator" class that would be able to buffer the area of the canvas it covers for quick updating if it changes, and draw it's own info on top - but I just can't figure out how to grab a part of the rendered parent canvas to store offscreen and paint again later.
So my question is: Is the second method a good way to go about this, or is there a better "Java" way of doing this (I'm still probably thinking in a Delphi mindset)? And if the second way is ok, then how do I buffer just part of the parent canvas?
Phil.
- 15
- Using a JList with a cell renderer within an applet/cell renderer not workingI have a cell renderer for a JList that is supposed to render the foreground
color in blue, and also insert tabs into the lines. When this code is
changed to run as an application, the cell renderer performs as expected.
When the code is run as an applet, the cell renderer has no impact at all.
Any help would be appreciated.
I am using SDK 1.4.0, Windows XP Professional.
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import java.text.DecimalFormat;
import javax.swing.text.MaskFormatter;
import java.text.ParseException;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
import java.util.StringTokenizer;
public class TempConvert extends JApplet {
public JFormattedTextField low;
public JFormattedTextField high;
public JFormattedTextField incr;
public TempConvert() {
getContentPane().setLayout(new BorderLayout());
createGrid();
setSize(270,400);
}
private void createGrid() {
JPanel panel = new JPanel(new BorderLayout());
// add selection panel
MaskFormatter mf1 = null;
MaskFormatter mf2 = null;
try
{
mf1 = new MaskFormatter("####");
mf1.setPlaceholderCharacter('_');
//mf1.setCommitsOnValidEdit(true);
mf2 = new MaskFormatter("###");
mf2.setPlaceholderCharacter('_');
//mf2.setCommitsOnValidEdit(true);
}
catch (ParseException e){
}
low = new JFormattedTextField(mf1);
low.setFocusLostBehavior(JFormattedTextField.COMMIT);
high = new JFormattedTextField(mf1);
high.setFocusLostBehavior(JFormattedTextField.COMMIT);
incr = new JFormattedTextField(mf2);
incr.setFocusLostBehavior(JFormattedTextField.COMMIT);
JPanel select = new JPanel(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.fill = GridBagConstraints.NONE;
addgbc(select, new JLabel("Low Temperature Range . . ."),gbc,0,0);
addgbc(select, low,gbc,1,0);
addgbc(select, new JLabel("High Temperature Range . ."),gbc,0,1);
addgbc(select, high,gbc,1,1);
addgbc(select, new JLabel("Increment Degrees . . . . ."),gbc,0,2);
addgbc(select, incr,gbc,1,2);
panel.add(select, BorderLayout.NORTH);
// add temperature list
final JList list = new JList();
TabListCellRenderer renderer = new TabListCellRenderer();
//renderer.setTabs(new int[] {50,200,300,});
list.setCellRenderer(renderer);
JScrollPane scroller = new JScrollPane();
scroller.getViewport().add(list);
panel.add(scroller, BorderLayout.CENTER);
// add buttons
JPanel buttons = new JPanel(new FlowLayout(FlowLayout.CENTER,5,5));
JButton ok = new JButton("OK");
JButton cancel = new JButton("Cancel");
buttons.add(ok);
buttons.add(cancel);
panel.add(buttons, BorderLayout.SOUTH);
getContentPane().add(panel);
//pack();
setVisible(true);
// register action listeners for the buttons
ok.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (verifyData())
{
list.setListData(calculateTemps());
list.revalidate();
list.repaint();
}
}
});
cancel.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
// stop();
// destroy();
}
});
}
private int getIntValue(JFormattedTextField field)
{
try
{
return Integer.parseInt(field.getText().toString().replace('_','
').trim());
}
catch (NumberFormatException e){}
return 0;
}
private boolean verifyData()
{
int lowTemp = getIntValue(low);
int highTemp = getIntValue(high);
int incrTemp = getIntValue(incr);
if (lowTemp < 0)
{
JOptionPane.showMessageDialog(this, "If low temperature is entered, must
be greater than zero");
return false;
}
if (highTemp == 0)
{
JOptionPane.showMessageDialog(this, "High temperature must be entered");
return false;
}
if (highTemp <= lowTemp)
{
JOptionPane.showMessageDialog(this, "High temperature must be greater
than low temperature");
return false;
}
if (incrTemp == 0)
{
JOptionPane.showMessageDialog(this, "Increment degrees must be
entered.");
return false;
}
return true;
}
private void addgbc(Container cont, JComponent comp, GridBagConstraints
gbc, int x, int y) {
gbc.gridx=x; gbc.gridy=y;
cont.add(comp,gbc);
}
private TempData[] calculateTemps() {
int lowTemp = getIntValue(low);
int highTemp = getIntValue(high);
int incrTemp = getIntValue(incr);
int range = highTemp-lowTemp;
TempData[] tempdata = new TempData[range/incrTemp +1];
int j=0;
for (int i=lowTemp; i<=highTemp; i+=incrTemp) {
tempdata[j] = new TempData(i);
j++;
}
return tempdata;
}
public static void main (String[] args) {
new TempConvert();
}
public class TempData {
int fahrenheit;
int celsius;
public TempData(int fahrenheit) {
this.fahrenheit = fahrenheit;
calculateTemp();
}
private void calculateTemp() {
double temp = 5/9 * (fahrenheit-32);
celsius = (int)temp;
}
public String toString() {
return fahrenheit + "\t" + celsius;
}
}
}
class TabListCellRenderer
extends JLabel
implements ListCellRenderer {
protected static Border m_noFocusBorder;
protected FontMetrics m_fm = null;
protected Insets m_insets = new Insets(0, 0, 0, 0);
protected int m_defaultTab = 50;
protected int[] m_tabs = null;
public TabListCellRenderer() {
m_noFocusBorder = new EmptyBorder(1, 1, 1, 1);
setOpaque(true);
setBorder(m_noFocusBorder);
}
public Component getListCellRendererComponent(JList list,
Object value, int index, boolean isSelected, boolean cellHasFocus) {
setText(value.toString());
System.out.println("getText = " + getText());
setBackground(isSelected ? list.getSelectionBackground() :
list.getBackground());
//setForeground(isSelected ? list.getSelectionForeground() :
list.getForeground());
setForeground(Color.blue);
//setBackground(Color.blue);
setFont(list.getFont());
setBorder((cellHasFocus) ?
UIManager.getBorder("List.focusCellHighlightBorder") : m_noFocusBorder);
return this;
}
public void setDefaultTab(int defaultTab) {
m_defaultTab = defaultTab;
}
public int getDefaultTab() {
return m_defaultTab;
}
public void setTabs(int[] tabs) {
m_tabs = tabs;
}
public int[] getTabs() {
return m_tabs;
}
public int getTab(int index) {
if (m_tabs == null)
return m_defaultTab*index;
int len = m_tabs.length;
if (index>=0 && index<len)
return m_tabs[index];
return m_tabs[len-1] + m_defaultTab*(index-len+1);
}
public void paintComponent(Graphics g) {
super.paintComponent(g);
Color colorRetainer = g.getColor();
m_fm = g.getFontMetrics();
g.setColor(getBackground());
g.fillRect(0, 0, getWidth(), getHeight());
getBorder().paintBorder(this, g, 0, 0, getWidth(), getHeight());
g.setColor(getForeground());
g.setFont(getFont());
m_insets = getInsets();
int x = m_insets.left;
int y = m_insets.top + m_fm.getAscent();
StringTokenizer st = new StringTokenizer(getText(), "\t");
while (st.hasMoreTokens()) {
String sNext = st.nextToken();
System.out.println("next token = " + sNext);
g.drawString(sNext, x, y);
x += m_fm.stringWidth(sNext);
if (!st.hasMoreTokens())
break;
int index = 0;
while (x >= getTab(index))
index++;
x = getTab(index);
}
g.setColor(colorRetainer);
}
}
- 15
- integration with JSTL
Hallo, here is my question. I have a Java API
to access some data (collections and strings).
How do I make sure that my API is such that i can access data trhough
the JSTL?
I want to be able to do things like the following
in my JSPs:
<c:if test="$someobj.property == 'john'">
Hallo John
</c:if>
Thanks
Luca
|
| Author |
Message |
michele bergo

|
Posted: 2003-8-21 23:34:00 |
Top |
java-programmer, Parallel port in Java...
Is it possible to read or write from the parallel port of PC with Java? And
how?
Thanks
|
| |
|
| |
 |
Gerrit Kuehn

|
Posted: 2003-8-21 23:43:00 |
Top |
java-programmer >> Parallel port in Java...
michele bergo wrote:
> Is it possible to read or write from the parallel port of PC with Java? And
> how?
You can use the java.comm.api for that. See
http://java.sun.com/products/javacomm/
Hope it helps.
cu
Gerrit
|
| |
|
| |
 |
michele bergo

|
Posted: 2003-8-23 16:49:00 |
Top |
java-programmer >> Parallel port in Java...
Thank u very much!
michele bergo
"Roedy Green" <email***@***.com> ha scritto nel messaggio
news:email***@***.com...
> On Thu, 21 Aug 2003 15:34:06 GMT, "michele bergo"
> <email***@***.com> wrote or quoted :
>
> >Is it possible to read or write from the parallel port of PC with Java?
And
> >how?
>
> see http://mindprod.com/jgloss/parallelport.html
>
> --
> Canadian Mind Products, Roedy Green.
> Coaching, problem solving, economical contract programming.
> See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- IE AutomationI am working on developing a test application in java. I use java for UI
only. I use JNI to communicate with a VC MFC DLL. I launch an IE browser
instance in one JNI method (init()), which works fine.
OleInitialize(NULL);
CLSID clsid;
CLSIDFromProgID(OLESTR("InternetExplorer.Application"), &clsid);
HRESULT hr = CoCreateInstance(clsid, NULL, CLSCTX_LOCAL_SERVER,
IID_IWebBrowser2, (void**)&m_spBrowser);
I store the browser pointer (IWebBrowser2 *) as a C++ class instance
variable. BTW, I start a
thread on the native side (_beginthread) which in turn calls the method that
launches the browser.
Previously I was facing the problem of marshalling, the IWebBrowser2 pointer
was getting correupted, when used in different methods (even the simple
properties of IWebBrowser2 (like IWebBrowser2::fullname) were not
accessible). So now I have added the code of marshalling after the browser
is launched. In almost all the other methods, I first unmarshall the
interface and then marshall it back at the end of it. This solved my earlier
mentioned problem.
void CIECanvas::MarshallInterface()
{
HRESULT hr;
if(SUCCEEDED(hr = ::CreateStreamOnHGlobal(NULL, TRUE, &pstm)))
{
LARGE_INTEGER bZero = {0, 0};
pstm->Seek(bZero, STREAM_SEEK_SET, NULL);
if(SUCCEEDED(::CoMarshalInterface(pstm, IID_IWebBrowser2, m_spBrowser,
MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL)))
{
pstm->Seek(bZero, STREAM_SEEK_SET, NULL);
}
}
}
void CIECanvas::UnmarshallInterface()
{
LARGE_INTEGER bZero = {0, 0};
pstm->Seek(bZero, STREAM_SEEK_SET, NULL);
HRESULT hr = ::CoUnmarshalInterface(pstm, IID_IWebBrowser2,
(void**)&m_spBrowser);
if(FAILED(hr))
{
showMessageBox("CIECanvas::UnmarshallInterface()", "%s %ld", "FAILED.
ERROR CODE = ", GetLastError());
}
}
Then for recording I use AfxConnectionAdvise(), which is working fine.
The problem I am facing is in Replaying the events.
1)The VM crashes with a hotspot error, when on the first page some link
click event is present, which loads a new page. One observation here is the
VM crashes after onBeforeNavigate2 or TitleChange events are fired.
2)I also tried Yahoo's registration page (having a lot of dropdowns and
checkboxes), it works fine for the first few events, but then the VM
crashes.
My questions are
1)Does IE handle the events like page loading (tiltle change etc.) and click
on some link in different threads? How are the events handled (any useful
info on this)?
2)How should I fix the problem?
3)Is it related to marshalling of IE COM pointers?
Please replay ASAP,
Nikhil
- 2
- JAX-RPC: Strange Exception with Dynamic Proxy ClientHello there
I am using currently SUN's Webservice Development Kit 1.4 and try to
realise a JAX-RPC "rpc/encoded" webservice.
My applicatio is currently running if I am using a static client
(stubs geenerated by wscompile). If am going forward to use a dynamic
proxy client, I am getting a strange exception during the
deserialization of the xml data on the client: "trailing block
elements must have an id attribute". see stack trace at the end of the
messsage.
As far as I understand is that it must somewthing be with the
"ArrayList" or arrays which I am using in my JavaBean which I sent
from the server to the client. Here my extract from my JavaBean:
public class Article
{
long id;
Date date;
String category;
String title="";
String lead="";
List texts;
}
If I am taking out the member "List texts" then it will work
correctly. The list contains only Strings. I tried also to use
String[] array, but this didn't help either.
So here, my questions perhaps someone has some ideas what I did wrong.
- Why does it work with the stastic cleint but not with the dynamic
proxy?
- Does anybody know an example on the net where in JavaBeans Lists or
Arrays has been used?
- Anybody an idea why this error appears? Did I something wrong?
Thank you in advance
Mark Egloff
trailing block elements must have an id attribute
at com.sun.xml.rpc.encoding.SOAPDeserializationContext.deserializeMultiRefObjects(SOAPDeserializationContext.java:81)
at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:226)
at com.sun.xml.rpc.client.dii.CallInvokerImpl.doInvoke(CallInvokerImpl.java:80)
at com.sun.xml.rpc.client.dii.BasicCall.invoke(BasicCall.java:489)
at com.sun.xml.rpc.client.dii.CallInvocationHandler.doCall(CallInvocationHandler.java:122)
at com.sun.xml.rpc.client.dii.CallInvocationHandler.invoke(CallInvocationHandler.java:86)
at $Proxy0.getArticle(Unknown Source)
at tagesanzeiger.client.ManagerDynamicClient.main(ManagerDynamicClient.java:43)
- 3
- 4
- 5
- [ANNOUNCE] Apache Derby 10.4.1.3 releasedThe Apache Derby project is pleased to announce a new feature release
of Derby, 10.4.1.3.
Apache Derby is a subproject of the Apache DB project.
Derby is a pure Java relational database engine which conforms to the
ISO/ANSI SQL and JDBC standards. Derby aims to be easy for developers
and end-users to work with.
Derby 10.4.1.3 can be obtained from the Derby download site:
http://db.apache.org/derby/derby_downloads.html.
Derby 10.4.1.3 introduces the following new capabilities:
* Asynchronous Replication
Allows you to maintain an up to date copy of your (master) database on
a different host (the slave). In the case of a crash on the master
database you can perform failover to the copy (slave database) and
continue serving client requests against your database.
* Security
o Shutting down the Network Server now supports user authentication,
and in fact requires credentials when authentication is enabled.
* SQL
o Table Functions. Using table functions and standard SQL, you can pose
sophisticated queries against in-memory collections, flat files, web
resources, non-relational databases, etc.. Table functions also let
you efficiently import data from web feeds, sensor logs, and other
relational databases.
o Unique constraints on nullable columns.
o SQL ROW_NUMBER() window function, (for an empty, inlined window
specification).
o Bracketed comments (/* ... */).
* Performance and Memory Usage
o New buffer manager with better concurrency.
o Statement cache in the client driver.
o Caching of isolation level and current schema in the client
driver.
* Administration
o Java Management Extensions (JMX) for Derby, allowing
local and remote monitoring and management of running Derby instances
(embedded or Network Server).
o Continuation prompt. ij adds a short "> " prompt to the next line
after a newline has been entered by the user without ending the
statement with a semicolon.
Derby 10.4.1.3 also has many bugfixes, including the fix for
DERBY-3347 which can cause unrecoverable database corruption. All
10.3 users are encouraged to upgrade to avoid potential corruption
issues.
--
Regards,
Dyre
- 6
- JMS and httpsHi all,
Have JMS to use with https
It says in documentation to supply these four arguments,
javax.net.ssl.trustStore, javax.net.ssl.keyStore,
javax.net.ssl.keyStoreType and javax.net.ssl.keyStorePassword
Here's my sample below:
System.setProperty("javax.net.ssl.trustStore", "C:\\Program
Files\\Java\\j2re1.4.2_03\\lib\\security\\cacerts");
System.setProperty("javax.net.ssl.keyStore",
"D:\\Projects\\certificates\\tomcat.keystore");
System.setProperty("javax.net.ssl.keyStoreType", "jks");
System.setProperty("javax.net.ssl.keyStorePassword",
"changeit");
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY,
"org.exolab.jms.jndi.InitialContextFactory");
properties.put(Context.PROVIDER_URL,
"https://localhost:8443/");
jndiContext = new InitialContext(properties);
For some reason after creating the new initial context, its reporting:
Default SSL context init failed: null
Did I set my trustStore path correctly?
Thanks
- 7
- Sending Hop Limited UDP packetsIs there a way to send a UDP packet with a specific TTL however it
must be a unicast address instead of multicast address. Any ideas?
regards
Usman Ismail
- 8
- mozilla and firefox java plugins on jdk1.5.0 Hi all
Have java plugins to firefox and mozilla browsers jdk1.5.0 on Freebsd?
this not work already...
ln -s /usr/local/jdk1.4.2/jre/plugin/i386/ns610/libjavaplugin_oji.so \
/usr/X11R6/lib/browser_plugins/
I have jdk1.5.0 and the dir /plugin is dissapeared :-(
%pwd
/usr/local/jdk1.5.0/jre
%ll
total 36
drwxr-xr-x 2 root wheel 512 14 feb 22:12 .systemPrefs
-r--r--r-- 1 root wheel 2487 14 feb 21:53 COPYRIGHT
-r--r--r-- 1 root wheel 969 14 feb 21:53 CHANGES
-r--r--r-- 1 root wheel 9223 14 feb 21:53 LICENSE
-r--r--r-- 1 root wheel 11172 14 feb 21:53 README
-r--r--r-- 1 root wheel 969 14 feb 21:53 Welcome.html
drwxr-xr-x 2 root wheel 512 14 feb 22:11 bin
drwxr-xr-x 14 root wheel 1024 14 feb 22:11 lib
I have installed too...
%java -version
java version "1.5.0-p1"
linuxpluginwrapper-20050119_1
thanks in advance!
_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"
- 9
- Certificate Login ModuleHi All,
If I am correct JBoss has added a SSL certificate login module in
version 4.0. I wanted to have a peek in it, but the source code of JBoss
4.0 is not available.
Can anybody please let me know from where can I get the source code of
JBoss 4.0? Or better, can anybody please send me the source code of such
a Login Module.
Any pointers in this direction will be highly appreciated.
Thanks in Advance,
-DN
- 10
- JNDI Authenticate UserHi All,
I have the below code which is supposed to return a true if the user is
authenticated against active directory and false if the user is not.
This works fine if you send it a correct username and correct password. It
also works if you send it a correct username with an incorrect password. It
also works if you send it an in-correct username with a password.
My problem is that a few accounts in the directory don't have passwords set.
I.e. password is blank. If I send any username without a password then it
always returns true, even if that user has a password set or the user
doesn't exist. Does anyone have any ideas why this is?
<code>
public boolean authenticateUser(String userName, String password){
//Try to log in with the supplied username and password
//If it fails then either the user doesn't exist or the wrong
crudentials where supplied
try{
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, ldapConnectionString);
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, userName + "@" +
ADName);
env.put(Context.SECURITY_CREDENTIALS, password);
DirContext ctx = new InitialDirContext(env);
return true;
}catch(Exception ex){
//Authentication failed
return false;
}
}
</code>
- 11
- Something FunHere's something fun that you may find interesting. I don't really have
enough know-how to do anything with it yet, but some of you might.
http://mtg.upf.edu/reactable/
One of the releases is in Java. Here's a video of it finished.
http://youtube.com/watch?v=0h-RhyopUmc
If anyone does anything with this, let me know!
- 12
- 13
- Scroll JList to bottom automatic .
Hi,
How to automatic scroll a JList to bottom of the list, i.e when inserting
new elements. My list have i created like this:
JList jlist = new JList(objectArray);
JScrollPane scroll = new JList(jlist);
Any simple code to do this?
Best Regards
/Jonny
- 14
- Static Variables and JAR FilesI am curious - does the scope of static variables carry across
different JAR files?
Here's the issue:
BaseClass is in "BaseClasses.jar"
ExtendedClassA extends BaseClass is in "AnotherPackage.jar"
ExtendedClassB extends BaseClass is in "EvenAnotherPackage.jar"
BaseClass has a static object (ObjectX). Now, normally, this static
object is static across all of the subclasses. However...
These JAR files (AnotherPackage and EvenAnotherPackage) are being read
in by a separate tool. When ExtendedClassA and ExtendedClassB are
used within the context of this tool, ObjectX is instantiated twice
and has two separate values. As far as I can tell, the tool runs
ExtendedClassA and ExtendedClassB within the same JVM, so I am unsure
of what is going on.
Does anybody have any insight into what is going on here? (Sorry for
being vague. I'm not actually working the project, but I'm curious
from an academic standpoint. Another group ran across this problem
today.)
- 15
- [RFE] Access to Field, Method and Constructor without the use of Strings
Hi all,
I submitted the following RFE to Sun's RFE page.
As a reply I received a mail from Girish Manwani at Sun that I
should start a discussion in one of the Java newsgroups (Huh?).
To my knowledge, this is the most appropriate group. Here gos:
A DESCRIPTION OF THE REQUEST:
It should be possible to obtain references to Field, Method and
Constructor objects without the use of strings. Proposed syntax:
// Assuming the following class
public class Foo {
String bar;
public Foo(String bar) {
this.bar = bar;
}
public void fly(String to) {
bar = to;
}
}
Field fooBarField = Foo.class.bar.field;
Method fooFlyMethod = Foo.class.fly.method(new Object[]{String.class});
Constructor fooConstructor = Foo.class.constructor(new Object[]{String.class});
There are other possible options for the syntax. I would just like to see
this principally possible.
The construct is similar to the ClassName.class syntax and it can be treated
by the Compiler in the same way:
It could produce the getDeclaredField, getDeclaredMethod and getConstructor
bytecode. No modifications to the JVM would be necessary.
JUSTIFICATION :
The existance of the field/method/constructor could be checked during compile
time. Typos would no longer be possible.
A notation without strings could be very easily refactored by IDEs.
We would specifically need the feature for our typesafe querying system,
so it could work completely without strings.
http://sodaquery.sf.net/
The possibility to get Method objects without strings, would encourage many
developers to use them for more dynamic programming and would result in lots
of more flexible libraries for the Java platform.
Thanks in advance for your attention and for positive comments.
Kind regards,
Carl
Carl Rosenberger
db4o - database for objects - http://www.db4o.com
|
|
|