 |
 |
Index ‹ java-programmer
|
- Previous
- 1
- splitting up huge (1 GB) xml documentsDear all,
I am facing the problem that have to handle XML documents of approx. 1
GB. Do not ask me which sane architecture allows the creation of such
files - I have no control over the creation and have to live with it.
I need to split this massive document up into smaller chunks of valid
XML:
The structure of the XML is quite easy:
<businessHeader>Bla, bla -> only about 10 tags</businessHeader>
<businessInformation>info goes here</businessInformations>
<!--the tag business information is repeated a couple of hundred
thousand times... -->
<businessInformation>info goes here</businessInformations>
<businessFoolter>about 10 tags footer</businessFooter>
My current approach is to use SAX to parse the document and write the
businessInformation into different files. Before that the header gets
inserted into each file and after that the footer.
This obviously consumes quite a lot of time since the entire file is
parsed sequentially.
Can you think about a way of how to speed this process up ? I was
thinking of jumping randomly into the <businessInformation>-section of
the file (Random Access File) and then start parsing from there on with
SAX (potentially in parallell by using threads) but I am not sure if
this works.
Any hint is appreciated.
Cheers
Torsten
- 1
- Cariage returnHello,
I would like to know if there is a way in my Java application to know what
characters are used in the cariage return of text files on the machine the
application works. Is is 13, 10? Is it 10? is it 13? How can I find this?
Thanks for your input.
Francois
- 1
- Java Applet Background ColorHi,
I am trying to set the background color of my applet to white but it
keeps coming up gray.Strangely when I open the applet on a local web
page (not live on the web), applet viewer (thru eclipse) or even live
on the web from my own home PC it appears white as expected. But from
every other machine that I access it the background is grey. Even when
i run it thru Eclips on other PCs the background is gray.I have tried
to set the background to white by calling
setBackground(Color.white)
and
setBackground(Color.WHITE)
from the init() method. In the HTML that calls the applet i also set
the <body bgcolor=#FFFF></body> and i do the same for the <HEAD>.
However from every other machine that I access my webpage/applet
except my own home PC the background still appears as gray.
Any ideas?
Thanks
WS
- 2
- Creating XSD filesHello,
I am very new to XML and XSD. I am to create an application that can
generate a new XSD file from a set of tag names that the user
provides. Any guidlines will be appreciated.
Thanks.
- 5
- problem getting the java VM to runPatrick Zesar <email***@***.com> wrote in message news:<405b0a79$0$8016$email***@***.com>...
> i just posted this problem to
> http://forum.java.sun.com/thread.jsp?forum=30&thread=504742&tstart=0&trange=15
> with a reference to this thread here.
I just ran into the same problem. Upgraded two win98se machines to XP
Pro SP1. Prior to applying any hotfixes first thing I did was to
install the 1.4.2_04 jre. I have the same jre running flawlessly on
two preinstalled Dells with xp pro sp1. Very interested in a fix,
will post here if I find it.
- 6
- [strus] tiles, menu static?Hello,
I am building a struts application with tiles. The side is built as follows:
menu,footer, head and contents.
In my tiles def I have the following entries:
<tiles-definitions>
<definition name="webladen.welcomeLayout" path="/layouts/welcomeLayout.jsp">
<put name="title" value="Welcome..." />
<put name="header" value="/view/tiles/header.jsp" />
<put name="menu" value="/view/tiles/menu.jsp" />
<put name="footer" value="/view/tiles/footer.jsp" />
<put name="content" value="/view/tiles/contentFirst.jsp" />
</definition>
<definition name="webshop.katalog" extends="webshop.welcomeLayout">
<put name="content" value="/view/katalog.jsp"/>
</definition>
</tiles-definitions>
But when I click on the catalogue button, every area on the side is loading
new, but of course I only want the content-are to be loaded.
Could anybody tell me what I do wrong?
Thank you very much for your action!
Dennis
- 8
- Display xml file in JTree: Select information to be shown in node labelHi there,
I have managed to write a small java program that display an xml file
in a JTree. This was achieved by defining a suitable tree model. THe
program works...somehow. The nodes (elements and texts) are correctly
recognized, and the corresponding branches in the JTree can be opened
and closed. However, when I run the program, all the non-leaf nodes
(e. g. the element nodes) are displayed from the start tag to the end
tag including the tag delimiters. Is there any way to control what is
used as a "node label" in a JTree? Of course that could be done by
brute (e.g. by building the JTree from simple strings) but I believe
that this approach will destroy the tree structure of the underlying
xml file.
I have tried for some time to display xml data in a tree view, and a
java solution seemed to be the most "organic" one. So it would be
great if that program to be really made to work properly. Many thanks
for any idea how to achieve this! Piet
Here is the code:
import java.awt.*;
import java.awt.event.*;
import java.util.List;
import javax.swing.*;
import javax.swing.tree.*;
import javax.swing.event.*;
import javax.xml.parsers.*;
import org.w3c.dom.*;
public class XmlTreeDemo extends JFrame {
XmlTreeDemo(String title){
super(title);
try{
DocumentBuilderFactory IDocumentBuilderFactory
= DocumentBuilderFactory.newInstance();
DocumentBuilder IDocumentBuilder
= IDocumentBuilderFactory.newDocumentBuilder();
Document IDocument = IDocumentBuilder.parse("c:/test1.xml");
Node root = IDocument.getDocumentElement();
XmlTreeModel model = new XmlTreeModel(root);
JTree IJTree = new JTree();
IJTree.setModel(model);
getContentPane().add(new JScrollPane(IJTree),BorderLayout.CENTER);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
catch (Exception e){
System.err.println(e);
}
}
public static void main(String[] args){
XmlTreeDemo IJTreeDemo = new XmlTreeDemo("Xml tree demo");
IJTreeDemo.pack();
IJTreeDemo.show();
}
}
class XmlTreeModel implements TreeModel{
protected Node root;
public XmlTreeModel(Node root){
this.root = root;
}
public Object getRoot(){
return (Object)this.root;
}
public boolean isLeaf(Object node){
if ((((Node)node).getNodeType() == 7) || (((Node)node).getNodeType()
== 1)) return false;
return true;
}
public int getChildCount(Object parent){
return ((Node)parent).getChildNodes().getLength();
}
public Object getChild(Object parent,int index){
Node child = ((Node)parent).getChildNodes().item(index);
return (Object)child;
}
public int getIndexOfChild(Object parent, Object child){
NodeList childs = ((Node)parent).getChildNodes();
if (childs.getLength() == 0) return -1;
for (int i=0; i<childs.getLength(); i++){
if (childs.item(i) == (Node)child) return i;
}
return -1;
}
public void valueForPathChanged(TreePath path, Object newValue){
}
public void addTreeModelListener(TreeModelListener l){
}
public void removeTreeModelListener(TreeModelListener l){
}
}
- 8
- Web Application Works on Windows, Not on Linux (Needs a file)I've been using a web application to find part numbers and info for an
antique car I've been working on for a while. I used to go to the
manufacturer's website, log in ($20 a year fee, otherwise I'd link to it),
click on the link, and the program would run just fine under Linux.
Recently I upgraded my system (from Ubuntu Edgy to Ubuntu Feisty) and now
this app will run in Firefox on Windows XP but won't run on Linux. Now I
get an error that it can't find the file hpwin32 in the java.library.path.
(The full stack trace is below.)
I searched my hard drives on the WinXP system and there's no trace of this
file, so I'm guessing it's a file on their end that isn't loading. This
worked fine when I was using Java 1.4.2 but won't work now, with Java 6
installed.
Any ideas on what I can do to make this work again? What other info would I
need to provide that might help track this problem down? (The supplier
doesn't officially support Linux, so I can't get help from them.)
Hal
--------------Stack Trace from Error Message--------------
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.javaws.Launcher.executeApplication(Launcher.java:1205)
at com.sun.javaws.Launcher.executeMainClass(Launcher.java:1151)
at com.sun.javaws.Launcher.doLaunchApp(Launcher.java:998)
at com.sun.javaws.Launcher.run(Launcher.java:105)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.UnsatisfiedLinkError: no hpwin32 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1030)
at
com.hp.tis.ewo.common.win32.Hpwin32DllLoader.loadLibrary(Hpwin32DllLoader.java:63)
at com.hp.tis.ewo.common.win32.Environment.<clinit>(Environment.java:257)
at com.hp.tis.ewo.setup.ContextController.<init>(ContextController.java:54)
at
com.hp.tis.ewo.setup.cookie.CookieEngine.getWorkshopID(CookieEngine.java:181)
at
com.hp.tis.ewo.clienttools.trigger.CookieTrigger.execute(CookieTrigger.java:89)
at com.hp.tis.ewo.clienttools.trigger.TriggerLoop.run(TriggerLoop.java:82)
at
com.hp.tis.ewo.clienttools.connectivity.http.EwaHttpUrlConnection.getBaseHttpConnection(EwaHttpUrlConnection.java:312)
at
com.hp.tis.ewo.clienttools.connectivity.http.EwaHttpUrlConnection.<init>(EwaHttpUrlConnection.java:251)
at
com.hp.tis.ewo.clienttools.ServiceFactory.getConnection(ServiceFactory.java:165)
at
com.proquest.epc.view.bl.ServerConnectionBL.sendToAppServer(ServerConnectionBL.java:110)
at
com.proquest.epc.view.bl.ServerConnectionBL.sendRequest(ServerConnectionBL.java:65)
at com.proquest.epc.view.rh.LoginRequestor.execute(LoginRequestor.java:24)
at
com.proquest.epc.view.impl.MBEPCApplication.main(MBEPCApplication.java:310)
... 9 more
- 8
- 8
- Where to find the Java source files?Hi,
I remember Java source files are installed somewhere and I can take a
look at them. For example, right now I hope to look at JFrame's file,
JFrame.java. I forgot where to it is installed. Could you give me a hint?
Thank you.
- 13
- 13
- Single Threaded EnvironmentHi,
I know this might not be the best place to ask this but.. umm I know
Java is a multithreaded environment. what do you call a single threaded
environment where there are no multiple threads or scheduler? Please
tell me because I can't seem to recall the term :( Is it just "single
threaded environment"? Or is the term something else? Thanks!
Rick
- 13
- Mozilla Firefox bookmarks exporting.
Hi,
I use mozilla firefox and feel very comfortable with that. I have
accumulated a lot of interesting websites in my bookmarks. Now if I
want to switch to a other machine how can preserve my old set of
bookmarks?
Thank you in advance,
Shaji.
- 13
- 13
- ThreadPoolExecutor implementation questionHi,
I have a question about Sun's implementation of
java.util.concurrent.ThreadPoolExecutor, specifically the execute(
Runnable ) method. The runState field is read before the Runnable task
is added to the workQueue (BlockingQueue), however there is no
synchronization in place. It seems that it might be possible for
another thread to invoke shutdown after runState is checked, but before
the task is added to the queue. Is it not then possible that the queue
is cleared by the shutdown process, the executor left as terminated,
only for the task to finally be added to the queue, something like:
Thread 1 | Thread 2
execute( t1 ) |
runState==RUNNING |
| shutdown
| runState=SHUTDOWN
| clear out workQueue
| return
| executor now terminated
|
workQueue.add(t1) |
return |
At this point, t1 is stuck in a queue that will never be cleared, but
no feedback to that effect was given on Thread 1.
Looking at Doug Lea's PooledExecutor at
http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/PooledExecutor.java
I see that PooledExecutor.execute uses a synchronized block which would
prevent the above case from occuring.
Am I missing something?
cheers
Allen
|
| Author |
Message |
ccssales

|
Posted: 2008-2-12 21:56:00 |
Top |
java-programmer, Cigarette Girl ...
Cigarette Girl
http://www.cigarettes--online.com/promo/cigarette-girl.html
Cigarette Girl brands are without a doubt one of the most renowned
tobacco brands
in the market.
Discount Cigarette Girl Store offers cheap discount US made Cigarette
Girl online.
Cigarette Girl, are available at discount prices from our online US
made cigs shop
for immediate shipment. Our cheap Cigarette Girl are delivered to your
door.
More Info here >>>
http://www.cigarettes--online.com/promo/cigarette-girl.html
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- OutOfMemory on Sun Java 1.4.2 on LinuxHi all,
My application (on JBoss) is experiencing strange problem on one of our
environment - on Linux on Itanium 2 - Sun Java 1.4.2_07 and 64 bit.
On all other platforms (windows, linux, 32 bit) is ok.
After 2-3 http requests the OutOfMemory exception is thrown.
Java is started with -Xmx1024M. In fact the bahaviour is exactly the
same as -Xmx512M.
'uname -a' shows unlimited resources for memory.
There is plenty of free memory in the system (main and swap) - for
example I can run 3 such java processes at the same time - but each is
reporting out of memory after few requests as it is for one java spawned.
'top' shows that java eats ~400M when the OutOfMemory is thrown.
Where to look, what to check?
taab
- 2
- what the problem about this short code?import javax.media.Manager;
import javax.media.bean.playerbean.MediaPlayer;
import java.lang.String;
public class Player1 {
MediaPlayer mp1 = new MediaPlayer();
public Player1(){
mp1.setMediaLocation(new String("file:\\d:\\music\\11.wma"));
}
public static void main(String[] args){
Player1 player1=new Player1();
player1.mp1.start();
}
}
it says that Cannot find a Player for :file:\d:\music\11.wma.what the
problem?
- 3
- Reference sitesDoes anyone have a list of reference websites that are running FreeBSD
and Java?
Or does anyone know of any high volume sites using FreeBSD and Java?
Thanks,
Todd
_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"
- 4
- Mars Rescue Mission ChallengeA new challenge:
http://www.frank-buss.de/marsrescue/index.html
Have fun! Now you can win real prices.
--
Frank Bu? email***@***.com
http://www.frank-buss.de, http://www.it4-systems.de
- 5
- 6
- Runtime - external program visibility
Hello,
i use the getRuntime method to start an external program out of
my Java app: Runtime.getRuntime().exec(cmd);
where cmd is an array of String
String[] cmd =
{ "\"c:/Whatever.exe\"","/user=User","/password=XXX"};
Now the issue is that the program (Whatever.exe) starts, it
accepts the parameters (user,password), - the / is required by
Whatever.exe - but the window of the application Whatever.exe is
not visible! The process is there (one can see it in the
taskmanager).
In Delphi i have the possibility by using Windows.CreateProcess
and passing a "StartupInfo"
(lStartupInfo.dwFlags:= STARTF_USESHOWWINDOW;
lStartupInfo.wShowWindow:= SW_SHOWNORMAL;) but here in Java i dont see a possibility of determining in which way the external app is being started up or determining its visibility.
kind regards
Oliver
- 7
- Two questions about jars1) I need to support installing a Java application from CD on both Windows
AND on the Mac. I have figured out how autorun works on Windows. Is the
method for doing this the same on the Mac as it is for Windows? I am
thinking that what I'd do is create an install "program" (like the Setup
program created by Install Shield on Windows), but make it as an executible
jar file so that the Java VM on either can handle the install process. That
way, a single CD should be able to accomodate both the Mac and Windows.
2) I have found the process of making executible jar files a little
problematic, and the documentation from Sun with the SDK a little lacking in
examples: and the documentation with eclipse and Netbeans IDE is a bit of a
maze (I'd have thought that both would make it easy to create executible
jars, but I haven't found the relevant parts of their documentation yet, so
I am still struggling with hat from Sun). I understand that to make a jar
executible, I need to provide a manifest file, but I have yet to succeed in
adding one. Can anyone point me to a simple example of making an executible
jar containing a Swing application, or provide me with one (if that is
simple enough)? (And/or provide a map pointing out the relevant parts of
the documentation I have acquired) I need this jar to be self contained, so
I do not need to worry about what version of the JRE the client machine has.
I guess I ought to add a third question about whether or not either eclipse
or netbean supports making a distribution as an executible jar file that
will install the application on the client machine and create any necessary
directories and icon on the desktop? I have found, though, a couple tools
that should be able to do this, but I haven't been able to test them because
I got stuck on the question of creating executible jar files.
I am certain I can figure this out on my own, but the big problem is I am
facing significant time pressure, so I ask for aide to help me get this
figured out faster.
Thanks,
Ted
- 8
- OMLETv4: SPAM SPAM SPAM
--
Daniel A. Morgan
University of Washington
email***@***.com
(replace 'x' with 'u' to respond)
- 9
- Refer to current filename and line.Hi,
I remember this was possible in C with macros. Is it possible in Java
to refer to the current file name and line number as in
System.out.println( something.that.returns.current.file.name() + "
printed this line.");
Many thanks in advance!
Aaron
- 10
- Adding JPanel to JLayeredPane - Please help!Hi
I have a problem adding a JPanel to a JLayeredPane.
The class ChartGraphics paints a system of coordinats / Chart on a
JPanel
using the paint() metode. When I add the ChartGraphics object directly
to the Contentpanel of the frame the Chart is shown without any
problems. But as I want to add some buttons on top of the Chart, I
want to place it in a JLayeredPanel, and afterwards add the Jbuttons.
The problem is that the Chart is'nt shown if it is placed in the
JLayeredpane, why? The Button is displayed nicely.
Can anybody tell me how to display my JPanel background from the
JlayeredPane?
/Thanks
Kristian
******************ShowTrendsTest *******************
public class ShowTrendsTest {
public static void main(String[] args) {
JFrame f = new JFrame("ShowTrends");
ChartGraphics Chart = new ChartGraphics();//extends JPanel
JButton button = button("TST"); //Just a JButton
JLayeredPane layeredPane = new JLayeredPane();
layeredPane.add(Chart, new Integer(0));
layeredPane.add(button, new Integer(1));
f.getContentPane().add(layeredPane);
f.pack();
f.show();
}
public static JButton button(String arg){
JButton b1 = new JButton(arg);
b1.setVerticalAlignment(JButton.TOP);
b1.setHorizontalAlignment(JButton.CENTER);
b1.setOpaque(true);
b1.setBackground(Color.red);
b1.setForeground(Color.black);
b1.setBounds(100, 100, 140, 140);
return b1;
}
}
********************************************
- 11
- Resizing images thru a java program
hi
I need to capture an image based on the URL of the image provided by
the user and do the following things
1. Create a thumbnail
2. Resize the image
I may have to store these two images locally or just recreate these two
images and display it in the browse.
What are the best tools to use to achieve this? I need a Linux/java
based solution. Will Imagemagick.org do the magic?
-- Mahesh
- 12
- Signed applet focus problem,.Hello,
I have a jsp page which contains a signed applet which reads some
System properties.
I am using jdk 1.4.2_06. and IE 6.028.
When the signed certificate appears, if I click on the Internet
Explorer icon in the task bar, the certificate goes below the browser.
Now since the certificate is supposedly modal, My browser loses focus.
ie. I cannot bring the certificate to the front sans tabbing and the
browser will not respond to user input. The only way to get the
certificate to the front is by "tabbing" till I get to it.
Any one seen this behavior before? If so any suggestion would be
appreciated.
Thanks
Karl.
- 13
- reference to a jar file inside another jar fileHi, I need create a manifest file for a jar, but I need set the classpath in
the manifest file to reference a jar file inside the current jar file. My
idea is getting a single jar file which contains all the needed jar files.
- 14
- Execute jar in program codeI have a jar file, without source code, say abc.jar.
I have set it in the CLASSPATH
The main execute class in abc.jar is a.class.
In the command prompt, I can execute the program by
issuing "java a < someIOfile"
But I would be like to embed it in my program.
Can I create a "dynamic" instance from it?
- 15
- Java and MySql program example ?I am trying to learn Java and need an example program with MySql
database.
I am sure there are many who have made an invoice program in Java with
MySql database. The program must have routines that are similar to
those an invoice program has: customers, orders, products. Screens
like orders head and orderlines.
Can you please send me a copy of the source files for such a program
or a different program?
|
|
|