Dummy PC in new GL
Hi Friends,
We have document splitting on Profit center level,still somehow,the dummy PC had been configured and consequently,a few entries had been posted to dummy PC ,since the Cost center master did not have a PC.
How to remove the dummy PC setting or else to deactivate/delete the dummy PC to avoid this in future,since system is not allowing to delete the dummy PC.
regards,
Hi
The idea of having Dummy profit center is to enable posting to this, wherever no profit center entry is possible at the entry level or wherever no profit center is updated in the CO objects.
So locking or deleting the Dummy Profit center is not possible / advisable.
Regards,
Lakshmanan Krishnan
Similar Messages
-
Hi;
Could anyone help me to convert my example code from applet to swing,please, thank
import java.awt.*;
import java.applet.*;
import java.lang.Math;
import java.awt.Font;
import java.lang.Integer;
/*** Main class == Applet ***/
public class Suffix extends Applet implements Runnable {
private Thread main;
public s_tree _tree=null;
public node nd=null;
public boolean userPause=false,resumed=false;
private String str[]={"GOOGOL$","Paused","Resumed","Compacting","Done"};
public Color bl=Color.blue,rd=Color.red;
public Font fnt;
public int mode=3,delay=3000;
private char alph[]={'$','Q','W','E','R','T','Y','U','I','O',
'P','A','S','D','F','G','H','J','K','L',
'Z','X','C','V','B','N','M'};
/*** initialisation function. It is the first Funct to be called ***/
public void init() {
// Temp data
int temp=0,nxx=30;
// Ini. of fnt , the font size + style used by this applet.
fnt=new Font("Denis",1,25);
/*** parsing command parameters ***/
// try {
//DELAY VALUE PARAM
String param=getParameter("DELAY");
if (param!=null) {
temp=Integer.parseInt(param);
if ((temp>500)&&(temp<6000)) delay=temp;
//x LEFTMOST coordinate
param=getParameter("X");
if (param!=null) {
temp=Integer.parseInt(param);
nxx=temp;
//Base String parameter
param=getParameter("STRING");
if ((param!=null)&&(param.length()<15)) {
str[0]=param;
// } catch (ParseException e) { showParseError(e); }
// Allocating mem for _tree + initialize it .
_tree=new s_tree(str[0],fnt);
// Override xx (left_bound) by the caller's or the default value
_tree.xx=nxx;
/*** "animation loop is controled here" ***/
public void run() {
while(true) {
try {
//delay the process for time==delay
Thread.sleep(delay);
} catch (InterruptedException e) {}
//controls animation loop
repaint();
/*** override APPLET's paint function ***/
public void paint (Graphics g) {
//Output graphics
update(g);
/*** Updates the graphics ***/
public void update (Graphics g) {
// Set font
if (g.getFont()!=fnt) g.setFont(fnt);
if ((userPause==false)&&(resumed==false)) // Is the applet paused ?
g.clearRect(0,0,1024,768); //clears the screen
if (_tree==null) { // if tree is not initialised
init();
//_tree.show(g);
} else {
if (mode==3) { // if graphics output mode is 3
if (nd!=null) nd._to_rd(false);
nd=_tree.step_compact(nd); //compacts the tree one step further
if (nd==null) // if tree is totally compacted ...
mode=4; //change the ani. mode to 4 (don't call compact)
else
nd._to_rd(true); //colors the next node to compact in red
// Draw the "titleviewport's" comment
g.setColor(bl);
g.drawString(str[mode],10,15);
_tree.show(g); //show tree
} else {
g.clearRect(0,0,200,25); //clears the "titleviewport to update it"
g.setColor(rd);
if (resumed==true){
resumed=false;
g.drawString(str[2],10,15);
else g.drawString(str[1],10,15);
/*** restart the animation process ***/
public void start() {
main=new Thread(this);
main.start();
/*** stops the animation ***/
public void stop() {
main.stop();
main=null;
/*** Handles the user's events (mouse , kbd , ... ***/
public boolean handleEvent(Event evt) {
if (evt.id==Event.MOUSE_DOWN) { //if mouse button have been pushed ...
if (main!=null && main.isAlive()) {
if (userPause) {
main.start();
resumed=true;
} else {
main.stop();
userPause= !userPause;
} else {
main= new Thread(this);
main.start();
userPause=false;
resumed=true;
repaint();
return true;
} else {
return super.handleEvent(evt);
/*** Linked List of node(s) ***/
class nodelist{
nodelist next=null;
node ptr=null;
public void nodelist(){};
/*** node of a structure tree ***/
class node {
// Relatives
public nodelist children=null;
public node parent=null;
// variables
public int maxchild=12,childnum=0,level=0;
public int center[]={0,0};
public int xlen=20,ylen=10,vspace=15,hspace=8;
public int x[]={0,0};
public boolean _ishidden=false;
private Color bk=Color.black,wh=Color.white,rd=Color.red;
// Node==red toggle variable
public boolean to_rd=false;
// node's text
public String label=null;
/*** initialisation of the node ***/
public node(int nx,int ny,int nxl,int nyl,node nparent,int nlevel,String nstr){
x[0]=nx; x[1]=ny;
xlen=nxl; ylen=nyl;
parent=nparent;
level=nlevel;
label=new String(nstr);
children=new nodelist();
/*** destroys the node ***/
public void destruct() {
// NOTE : not like C++ destructors . Do not confuse .
delete_subtree();
children=null;
parent=null;
bk=wh=rd=null;
label=null;
/*** Node to red toggle switch ***/
public void _to_rd(boolean b) {to_rd=b;};
/*** Adds a child to this node ***/
public void add_child(int nx,int ny,int nxl,int nyl,node nparent,int nlevel,
String nstr) {
if (childnum<maxchild) { // if 'legal' space left ...
if (children==null) { // if no nodelist attached ...
children=new nodelist(); //init. children
children.ptr=new node(nx,ny,nxl,nyl,nparent,nlevel,nstr); //create node
childnum++;
} else {
nodelist dummy=children;
// search for the last nodelist
while (dummy.next!=null) dummy=dummy.next;
dummy.next=new nodelist(); //adds a nodelist
dummy=dummy.next;
dummy.ptr=new node(nx,ny,nxl,nyl,nparent,nlevel,nstr); //create child
childnum++;
// Tree needs to be realigned
/*** adds a child and returns its address ***/
public node add_child_ret(int nx,int ny,int nxl,int nyl,node nparent,int nlevel,
String nstr) {
if (childnum<maxchild) {
if (children==null) {
children=new nodelist();
children.ptr=new node(nx,ny,nxl,nyl,nparent,nlevel,nstr);
childnum++;
return(children.ptr);
} else {
nodelist dummy=children;
// search for the last child
while (dummy.next!=null) dummy=dummy.next;
dummy.next=new nodelist();
dummy=dummy.next;
dummy.ptr=new node(nx,ny,nxl,nyl,nparent,nlevel,nstr);
childnum++;
return(dummy.ptr);
return(null);
// Tree needs to be realigned
/*** adds the node nchild as a new children ***/
public void add_child(node nchild) {
nodelist dummy=null;
dummy=children;
if (childnum<maxchild) {
if (children==null) {
children=new nodelist();
children.ptr=nchild;
childnum++;
} else {
while (dummy.next!=null) dummy=dummy.next;
dummy.next=new nodelist();
dummy=dummy.next;
dummy.ptr=nchild;
childnum++;
//Tree needs to restructured.
/*** deletes all childrens ***/
public void delete_subtree() {
while (childnum>0 && children!=null) { //while child exists , kill it
if (children.ptr!=null) {
children.ptr.destruct();
children.ptr=null;
children=children.next;
} else children=null;
childnum--;
/*** moves this node and its children horizontally ***/
public void move_tree(int nx) {
nodelist dummy=children;
x[0]+=nx;
while (childnum>0 && dummy!=null) {
if (dummy.ptr!=null) {
dummy.ptr.move_tree(nx);
dummy=dummy.next;
/*** removes the node from the tree (do not preserve order of ordered tree ) ***/
public void remove_node() {
nodelist dummy=children;
while(dummy!=null) {
if (dummy.ptr!=null){
parent.add_child(dummy.ptr);
dummy=dummy.next;
children=null;
//could call restructure tree here .
//don't forget to change the node's levels !!!
/*** show all nodes ***/
public void show_all(Graphics g) {
if (_ishidden==false) { //if not hidden
if (children!=null) { //if child exist
nodelist dummy=children; //temp var.
while(dummy!=null) { //while there is a child...
if (dummy.ptr!=null)
dummy.ptr.show_all(g);
dummy=dummy.next;
show_node(g);
/*** show nodes in preorder ***/
public int preorder_show(Graphics g,int label){
if (_ishidden==false) {
show_node(g/*,label++*/);
if (children!=null) {
nodelist dummy=children;
while(dummy!=null) {
if (dummy.ptr!=null) label=dummy.ptr.preorder_show(g,label);
dummy=dummy.next;
return(label);
/** show nodes in postorder ***/
public int postorder_show(Graphics g,int label){
if (_ishidden==false) {
if (children!=null) {
nodelist dummy=children;
while(dummy!=null) {
if (dummy.ptr!=null) label=dummy.ptr.postorder_show(g,label);
dummy=dummy.next;
show_node(g/*,label++*/);
return(label);
/*** show nodes in inorder ***/
public int inorder_show(Graphics g,int label){
if (_ishidden==false) {
if (children!=null) {
nodelist dummy=children;
if (dummy.ptr!=null) label=dummy.ptr.inorder_show(g,label);
dummy=dummy.next;
show_node(g/*,label++*/);
while(dummy!=null) {
if (dummy.ptr!=null) label=dummy.ptr.inorder_show(g,label);
dummy=dummy.next;
} else show_node(g/*,label++*/);
return(label);
/*** Restructure the coordinates of all nodes ***/
public int align(int min,Font fnt,int lev,Graphics g){
int i=min; //left bound
FontMetrics fntm=g.getFontMetrics(fnt); //used to know the text size
level=lev;
// node x and y radius are computed here
xlen=4+(int)(fntm.stringWidth(label)/2);
ylen=4+(int)(fntm.getHeight()/2);
if (children!=null) { //if child present ...
nodelist dummy=children;
while(dummy!=null) {
if (dummy.ptr!=null) i=dummy.ptr.align(i,fnt,lev+1,g); //align them
dummy=dummy.next;
x[0]=min+(int)((i-min)/2); //could be underflow so will be checked
x[1]=lev*(vspace+(ylen*2))+26;
// overflow should happen only when the parent node is larger than its children
if ((x[0]-xlen)<min) { //check uf underflow occurs.
move_tree(min+xlen-x[0]+1);
i=x[0]+xlen+5;
if (childnum==0) x[0]+=2;
return(i);
/*** returns the child following nd ***/
/*** if nd==null -> return 1st child ***/
/*** if nd==last children -> return null***/
public node next_child(node nd) {
nodelist dummy=null;
if (children==null) return(null);
if (nd==null) return(children.ptr);
dummy=children;
while (dummy.ptr!=nd) {
if (dummy.next!=null)
dummy=dummy.next;
else
return(null);
dummy=dummy.next;
if (dummy!=null) return(dummy.ptr);
else return(null);
/*** returns child with first letter==nh ***/
public node get_childd(char ch) {
nodelist dummy=null;
dummy=children;
while (dummy!=null) {
if (dummy.ptr!=null) {
if (dummy.ptr.label.charAt(0)==ch)
return(dummy.ptr);
dummy=dummy.next;
return(null);
/*** returns the nodelist containing nd ***/
public nodelist get_child(node nd) {
nodelist dummy=children;
while (dummy!=null) {
if (dummy.ptr==nd) return(dummy);
dummy=dummy.next;
return(null);
/*** outputs the node to Screen ***/
public void show_node(Graphics g) {
if (_ishidden==false) {
if (level>0) { //if it is not a root then draw link-line
g.setColor(bk);
g.drawLine(x[0],x[1]-ylen,parent.x[0],parent.x[1]+parent.ylen); //from this node to parent node
if (to_rd==false)
g.setColor(wh);
else
g.setColor(rd);
g.fillOval(x[0]-xlen,x[1]-ylen,xlen*2,ylen*2); //draws an oval
g.setColor(bk);
g.drawString(label,x[0]-xlen+4,x[1]+ylen-12); //output the text
/*** class which uses nodes to create a SUFFIX TREE ***/
class s_tree {
node root=null; // root node.
String str=null; // 'search' string
Font fnt=null; // font type
int xx=30; // left limit for graphics
/*** initialize a SUFFIX TREE with string==nstr and Font==nfnt ***/
public s_tree(String nstr,Font nfnt) {
str=new String(nstr);
fnt=nfnt;
create();
/*** uninitialize the structure **/
public void destruct() {
root.destruct();
str=null;
fnt=null;
/*** show the tree ***/
public void show(Graphics g) {
root.align(xx,fnt,0,g); // restructure node's coordinates
root.show_all(g); //show tree
/*** creates a tree structure from String=str ***/
public void create() {
node dummy=null;
root=new node(0,0,0,0,dummy,0," "); //create root
root.parent=null; //just to make sure ...
for (int i=0;i<str.length();i++) {
// Create subtree of root in the following way :
// create subtree ("ASDF$");
// " " ("aSDF$");
// " " ("asDF$"); ...
// where : the UPPERCASE letters is the part of the string sent to insert_string
insert_string(str.substring(i));
//root.align(0,fnt,0); //align root now ?
/*** creates a subtree of ROOT with String=nstr ***/
public void insert_string(String nstr) {
node dummy2=null,dummy=null;
int i=0;
dummy=root;
dummy2=root;
// As long as a children of dummy2 have the letter nstr[i] , dummy==thischildren
// It is used to make sure that a node does not have two children with the
// same letter
while (dummy2!=null) {
dummy2=dummy2.get_childd(nstr.charAt(i));
if (dummy2!=null) {
i++;
dummy=dummy2;
//create the nodes for the rest of the string
for(;i<nstr.length();i++) {
if (dummy!=null) dummy=dummy.add_child_ret(0,0,0,0,dummy,1,nstr.substring(i,i+1));
// Compacts the tree node by node and returns the next node to compact
// if node==null , compacts the first node ...
//Works in POST-ORDER
public node step_compact(node nd) {
node dummy=nd,dummy2=null;
nodelist ndlst=null;
// GOES TO THE LOWER LEFT CHILDREN
if (nd==null) { //first call !
dummy=root;
while(dummy.children!=null) {
if (dummy.children.ptr==null)
dummy.children=dummy.children.next;
else
dummy=dummy.children.ptr;
//*** tries to find a 'compactable' node ***
//*** It uses the POST-ORDER method ***
// if this node is not the last children then try to find next compactable node
// in the next children.
if (dummy.parent.childnum!=1) dummy=next_chain(dummy);
if (dummy==null) return(null); //fully optimized
//remove parent node.
/*** THIS IS WHERE COMPACTING TAKES PLACE **/
dummy2=dummy.parent.parent;
ndlst=dummy2.get_child(dummy.parent);
if (ndlst==null) return(null); //we've got a beeeeg problem if this happens ...
//*** merges the parent string with this one and delete parent .
dummy.label=dummy.parent.label.concat(dummy.label);
ndlst.ptr=dummy;
//delete parent .
dummy.parent=null;
dummy.parent=dummy2;
// root.align(0,fnt,0);
return(dummy);
/*** finds the next chain in the tree (i.e. the next compactable node) ***/
public node next_chain(node nd){
node dummy=null;
if (nd.parent==null) return(null); //finished ! This is the root
if (nd.parent.childnum==1) return(nd); //can be optimized
// finds the nd.parent's child following nd
dummy=nd.parent.next_child(nd);
if (dummy==null) // if OLD_nd==last child
return(next_chain(nd.parent)); //tries to find a chain upwards
else {
// OLD_nd was not the last child . nd==OLD_nd's next brother
// GOES TO THE LOWER LEFT most child of nd's subtree.
while(dummy.children!=null) {
if (dummy.children.ptr==null)
dummy.children=dummy.children.next;
else
dummy=dummy.children.ptr;
return(next_chain(dummy)); // returns the next compactable node
};First, show me the rupees! Show me the rupees!
-
AVI files loaded in Premier Elements 7 only show audio and not video.
I am a new user of Premier Elements 7 and am having problems getting the video into a new project I set up. I have 6 AVI v1.0 clips that play both audio and video in Windows 7, but when I set up a project and import them, I only get the audio side and not the video side. I can drag the audio to the timeline and can play the audio just fine. But it is missing the video. I must be doing something wrong, but am new enough that I don't know where to turn.
I have been reading the forums and taking tutorials, so I think I know the steps to import a video into PRE7. I've tried many things, but still no video. I downloaded GSpot and found that my files have video H264 (H.264/MPEG-4 AVC) and audio oxooo2 (ADPCM). The codecs seem to be installed on my Windows 7 computer.
Can someone point me in the right direction on what to do next. I'm a computer professional with 50 years of experience, so am no dummy, but am new to PRE7. Thanks in advance.I found a mini-CD that came with the product. When I loaded it on my computer, one of the options was to install a device driver. I did this and now I can see the video in PRE7. So, I think this solves my problem.
I applaud the mfgr. of the Insignia. This is the way that it should be with ALL cameras, that do not use a miniDV tape, or precise CODEC, that is mainstream. All too often, the mfgrs. tweak an existing CODEC, and just leave the customer hanging, trying to find a way to edit the footage. A couple of major mfgrs. come immediately to my mind.
Others, who use CODEC's, like Xvid, that is so heavily compressed, that even converting it to an editable format/CODEC results in such horrible footage, that no one would ever be satisfied with the finished product.
<Soapbox Mode Off>
Glad that you are now up and editing. For my education, what does G-Spot say about the CODEC in the Insignia footage? At least next time that I encounter it, I can say - "look in the box, and install the driver to get the CODEC."
Thanks for reporting,
Hunt -
Can you have a look at my code please, where am i going wrong?
Compiles fine but i get a nullPointerException
in the setLayerOne() method and the setInputs() method
the error seems to point to the Neuron[][] network
but i thought it should be ok as i initilised the pointer as static
the Neuron class is compiled and contains both these methods.
also, is this bad design to make all my varibles static like this
thanks for the help
Tim
import java.io.*;
public class Guesser {
static char[] user = new char[100];
static int guess_no = 1;
static int noOfLayers;
static BufferedReader br = new BufferedReader( new InputStreamReader(System.in));
static Neuron[][] network;
static int[] layers;
public static void main(String args[])
throws IOException
guesserNetwork();
///now for the guessing bit
int guess_no = 0;
char guess;
//char dummy;
//BufferedReader br = new BufferedReader( new InputStreamReader(System.in));
char[] user = new char[100];
while (guess_no<10) {
System.out.println("Please think of Heads (H) or Tails (T) then press enter.");
if (guess_no == 1)
guess = 'H';
else if ( user[guess_no] == 'H' )
guess = 'T';
else
guess = 'H';
// now we tell the user what our guess was,
char dummy;
dummy = (char) br.read(); // wait for the return key pressed
System.out.println(guess);
// Find out what the user was thinking of
// and force the user to H or T
user[guess_no] = (char) br.read();
if (user[guess_no] == 'h')
{user[guess_no] = 'H';} //this does not work i dont know why
else if (user[guess_no] == 't')
{user[guess_no] = 'T';}
dummy = (char) br.read(); // clear the stream for the return key press
while ( user[guess_no] != 'H' && user[guess_no] != 'T')
System.out.println("You must enter H or T");
user[guess_no] = (char) br.read();
setLayerOne(); //////HERES WHERE I GET NULLPOINTER EXCEPTION
guess_no++;
while (guess_no<100){
//call update method
//print output of last node
network[0][guess_no].inputGuess(guess_no);
guess_no++;
static void setLayerOne() ////I GET NULLPOINTER EXCEPTION
network[0][guess_no].inputGuess(guess_no); // sets the first layer neurons
static void setInputs ()
for (int i = 1; i < noOfLayers; i++){
for(int j=0; j < layers; j++){
network[i][j].updateInput(i, network[i-1], network[i-1].length); //sets the other neurons
static void guesserNetwork()
int noOfNeurons[] = {10,1,1};
int nodes = 0;
noOfLayers = 3;
int[] layers = new int[noOfLayers];
for (int i =0; i < noOfLayers; i++)
layers[i] = noOfNeurons[i];
System.out.println("layer " + (i + 1) + " has " + noOfNeurons[i] + " neurons");
nodes += noOfNeurons[i];
System.out.println("total no of nodes = " + nodes);
System.out.println("building network...");
//make (noOfLayers)arrays of arrays
Neuron[][] network = new Neuron[noOfLayers][];
for (int i=0; i < noOfLayers; i++)
//for each layer make the desired number of rows(of neurons)
int rows = layers[i];
network[i] = new Neuron[rows];
//instinate neuron objects one by one
for (int j=0; j < layers[i]; j++)
if (i==0)
network[i][j] = new Neuron(noOfLayers, i, j, rows, 1, user[j]);
else
boolean isFirstLayer = false;
network[i][j] = new Neuron(noOfLayers, i, j, rows, layers[i-1], network[i-1]);Main calls guesserNetwork() which initilises the array:-
Neuron[][] network = new Neuron[noOfLayers][];
for (int i=0; i < noOfLayers; i++)
//for each layer make the desired number of rows(of neurons)
int rows = layers;
network[i] = new Neuron[rows];
//instinate neuron objects one by one
for (int j=0; j < layers[i]; j++)
if (i==0)
network[i][j] = new Neuron(noOfLayers, i, j, rows, 1, user[j]);
else
boolean isFirstLayer = false;
network[i][j] = new Neuron(noOfLayers, i, j, rows, layers[i-1], network[i-1]);
later main calls setLayerOne():-
static void setLayerOne()
network[0][guess_no].inputGuess(guess_no); // sets the first layer neurons
}and gives this error:-
NullPointerException:
at Guesser.setLayerOne(Guesser.java:77)
at Guesser.main(Guesser.java:62)
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)
I nave set network[][] to static so that it can be acessed from the main method and the other methods in this class.
thanks again -
Error while loading PDF Preset file
Dear All,
I am trying to create a PDF of the InDesign Document after my process. For that I load the preset file generate the PDF and unload Preset file from the server. On this it gets removed properly from the temporary folder also.
Problem is when I run the process second time using the same preset file InDesign Server throws an error "This file is already open by another user or another application. This file may be stored on a network server and cannot be opened until the other user closes it."
It works only if I restart the server. Can somebody help me on this its urgent.
Thanks in advance.
Regards
Farzana.Dear Tom,
I used your coding, but this is throwing error.
app.open("myJobOptions.joboptions"); -> your coding.
here I can pass the Job option file path and file name, see below my coding
app.open(File("d:\\myJobOptions.joboptions")); -> This is not working.
Question :
(*) I'm having the joboptions in saparate folder, I can Add that Joboption in my InDesign Application.
(*) How to Add the JobOption in my InDesign File.
(*) Use that joboption and export as PDF file.
See my Coding [this is not working]
//=================== Coding =====================//
var myPreset = File("d:\webPDF.joboptions");
var pdfPreset = app.pdfExportPresets.add(myPreset);
pdfPreset.name = "First_JOB";
myFolder = "d:\";
myBaseName = "Dummy";
var myFile= new File(myFolder+"/"+myBaseName +"_web"+ ".pdf");
var result = "exported to: " + myFile.fullName;
if(!myFile.parent.exists && !myFile.parent.create())
result = "Not exported. Unable to create the folder: " + myFile.parent.fullName;
} else {
app.documents.item(0).exportFile(ExportFormat.pdfType, myFile);
//============== End of the Coding =================//
Please make it corrtect and give me the solution.
Pls. I'm struggling this part, so Please as soon as possible explain & give the solutions for the above problem.
Thanks & Regards
T.R.Harihara SudhaN., -
How to create a ms-access database at runtime using java
hi, this is ravi kiran,
i have a situation where i need to create a new ms-access database with one table in it at runtime(when user clicks on some button).
i have been searching many sites to know how to do this in java, but i didnot find any thing useful.
plz tell me how to do this in java.
plz help me, its urgent
thanx in advance.Here's how I did it. Research does help, but sometimes looking at others code does too... You do have to have a dummy file that you made with access though. You can't just make a file file.mdb (it will be corrupt)
public void createDatabase(String database) throws SQLException{
try{
// This file needs to have been created with MS Access
File dbfile = new File(this.dataBaseDir + "dummy.mdb");
// This is the new database file being made
File newFile = new File(this.dataBaseDir + database + ".mdb");
// Copy all bytes from dummy file to new DB file.
FileInputStream instream = new FileInputStream(dbfile);
FileOutputStream ostream = new FileOutputStream(newFile);
int numBytes = instream.available();
byte inBytes[] = new byte[numBytes];
instream.read(inBytes, 0, numBytes);
ostream.write(inBytes, 0, numBytes);
catch(FileNotFoundException e) { e.printStackTrace();}
catch(IOException e) { e.printStackTrace();}
if(DEBUG) System.out.println("creating the " + database + " database");
} -
Error #1007 - attempting to instantiate a non-constructor
I am receiving said message on an actionscript-only project. I tried to reduce the application to a nonsensical example:
package
{ import flash.display.Sprite;
public class zz extends Sprite
public function zz()
var dummies:Array = [];
dummies.push(new dummy());
dummies.push(new dummy());
var newdata:Array = dummy.mixup(dummies);
package
import flash.geom.Point;
public dynamic class dummy extends Array
public function addp(pt:Point):void
this.push(pt.clone());
public static function mixup(dummies:Array):Array
var ret:Array = [];
function local_makeresult():void
{ for(var n:int = 0 ; n < 3 ; n++)
{ var b:dummy = new dummy();
ret.push(b);
local_makeresult();
for(var m:int = 0 ; m < dummies.length ; m++)
{ for(var n:int = 0 ; n < 3 ; n++)
{ var i:int = int(dummies[m].length * Math.random());
var j:int = int(3 * Math.random());
ret[j].push(dummies[m][i]);
return ret;
So the problem class
a) extends array
b) includes a static utility function (converting an array of class objects into another one)
c) that utility function includes nested functions
Tge error message looks like this
TypeError: Error #1007: Instantiation attempted on a non-constructor.
at dummy/mixup/local_makeresult()
at dummy$/mixup()
Does this mean we cannot use nested functions inside static ones?Hi
as I said this is not actual code (several hundred lines) but just a contrived example modelling the application structure. While it is still something different, lets assume that the dummy class represents polygons (so it derives from array and would implement useful methods like finding total length, area, center of gravity).
The static function could be intersection
I am using quite a few nested functions in this project - they have access to local variables of the enclosing function. Without the m I wouldhave to pass in a handful of variables (or an object grouping them together)
I have already noticed that nested functions are a mixed blessing, because there are fewer compile-time checks (such as number and type of arguments). However, they exist, so why shouldn't I use them?
One of the things I stumbled over: when I got the error, I tried one thing ... that did make the code work in the end: I removed the static attribute from the function and changed the main class to call it as a method of the first element of the array (which is certainly making it unreadable) -
Pipelined function ignores DML changes on subqueries
Hello all,
I have a really specific issue when using a pipelined function used in a complex subquery where the function ignores the changes made on the current transaction. The problem is the hidden hint materialize sometimes used by the Oracle optimizer. I say sometimes because it depends mostly on the execution plan and the complexity of the query.
I can repeat the problem with a dummy scenario.
Let's say we have a dummy table with a simple record :
CREATE TABLE DUMMY ("NAME" VARCHAR2(50 BYTE));
INSERT INTO DUMMY VALUES('Original name');
We then create a package which will contain our pipelined function and its record object and collection:
CREATE OR REPLACE PACKAGE PKG_DUMMY AS
TYPE DUMMY_RECORD IS RECORD (NAME VARCHAR2(50 BYTE));
TYPE DUMMY_RECORDS IS TABLE OF DUMMY_RECORD;
FUNCTION FUNC_GET_DUMMY_NAME RETURN DUMMY_RECORDS PIPELINED;
END PKG_DUMMY;
CREATE OR REPLACE
PACKAGE BODY PKG_DUMMY AS
FUNCTION FUNC_GET_DUMMY_NAME RETURN DUMMY_RECORDS PIPELINED AS
BEGIN
FOR CUR IN ( SELECT * FROM DUMMY )
LOOP
PIPE ROW (CUR);
END LOOP;
END FUNC_GET_DUMMY_NAME;
END PKG_DUMMY;
With this SQL query, we can return the value of the table by the pipelined function :
WITH DUMMY_NAME AS
SELECT "NAME"
FROM TABLE(PKG_DUMMY.FUNC_GET_DUMMY_NAME())
SELECT "NAME"
FROM DUMMY_NAME
Result
Original name
If we modify the DUMMY table with a new name without a commit, and re-execute the query, we got the same result :
UPDATE DUMMY SET "NAME" = 'New name';
Result
New name
But if we add the materialize hint in the subquery (without doing a commit or rollback), we have the original value hence my issue :
WITH DUMMY_NAME AS
SELECT /*+ materialize */ "NAME"
FROM TABLE(PKG_DUMMY.FUNC_GET_DUMMY_NAME())
SELECT "NAME"
FROM DUMMY_NAME
Result
Original name
I know I can force my subquery to use an inline hint instead of the "materialize" hint chose by the optimizer but then the query lose a lot of performance. Is there a way to force Oracle to use current DML changes with the materialize hint on a pipelined funtion in a subquery?
This thread is also for this issue : http://stackoverflow.com/questions/1597467/is-using-a-select-inside-a-pipelined-pl-sql-table-function-allowedHi Eliante, Hi Dominic,
Very Interesting. Here what I can reproduce in Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
sql > truncate table dummy;
Table truncated.
sql >INSERT INTO DUMMY VALUES('Original name');
1 row created.Please pay attention that I didn't commit
sql > with dummy_name as
2 (
3 select "NAME"
4 from table(pkg_dummy.func_get_dummy_name())
5 )
6 select "NAME"
7 from dummy_name;
NAME
Original name
sql> start c:\dispcursor
PLAN_TABLE_OUTPUT
SQL_ID 838mtur4m74j2, child number 0
with dummy_name as ( select "NAME" from table(pkg_dummy.func_get_dummy_name()) ) select "NAME"
from dummy_name
Plan hash value: 117055
| Id | Operation | Name | Starts | A-Rows | A-Time | Buffers |
| 1 | COLLECTION ITERATOR PICKLER FETCH| FUNC_GET_DUMMY_NAME | 1 | 1 |00:00:00.01 | 15 |
Note
- rule based optimizer used (consider using cbo)
17 rows selected.
sql > with dummy_name as
2 (
3 select /*+ materialize */ "NAME"
4 from table(pkg_dummy.func_get_dummy_name())
5 )
6 select "NAME"
7 from dummy_name;
no rows selected
sql >start c:\dispcursor
PLAN_TABLE_OUTPUT
SQL_ID 9frx3wjk992rd, child number 0
with dummy_name as ( select /*+ materialize */ "NAME" from table(pkg_dummy.func_get_dummy_name()) ) select "NAME" from dummy_name
Plan hash value: 1359790764
| Id | Operation | Name | Starts | E-Rows | A-Rows | A-Time | Buffers | OMem | 1Mem | Used-Mem |
| 1 | TEMP TABLE TRANSFORMATION | | 1 | | 0 |00:00:00.01 | 20 | | | |
| 2 | LOAD AS SELECT | | 1 | | 0 |00:00:00.01 | 19 | 1024 | 1024 | |
| 3 | COLLECTION ITERATOR PICKLER FETCH| FUNC_GET_DUMMY_NAME | 1 | | 0 |00:00:00.01 | 17 | | | |
| 4 | VIEW | | 1 | 8168 | 0 |00:00:00.01 | 0 | | | |
| 5 | TABLE ACCESS FULL | SYS_TEMP_0FD9D780C_BD7649E3 | 1 | 8168 | 0 |00:00:00.01 | 0 | | | |
16 rows selected.I can point out that the TABLE ACCESS FULL of the global temporary SYS_TEMP_0FD9D780C_BD7649E3 table created by Oracle in response to the -materialize hint is returning *0 rows* in operation 5.
Why?
It seems for me that the reason for that comes from the fact that the creation of this SYS_TEMP_0FD9D780C_BD7649E3 table is done via direct path read/direct path write and as far as
the insert of *'Original name'* has not been pushed yet into the disc then materializing the query will generate an empty temporary table (empty in this case).
This is why if I had committed I will not have seen such a kind of discrepancy between those two queries
What do you think?
Mohamed Houri
www.hourim.wordpress.com -
Hi all,
when I try to Add BizPackage Document to the project and more specifically Server URL: http://localhost:8080/B1iXcellerator/exec/dummy I receive the error mess:
HTTP error: could not PROPFIND file 'http://localhost:8080/B1iXcellerator/exec/dummy' on server localhost (403)
I am using Windows 2003 Server, SAP 8.8 and xmlspy enterprise edition 2011. I have also started WebDAV
However is there another way to locate and modify the xml files?
Best Regards,
VangelisHi Hany,
I already had opened service calls at Altova and SAP regarding this issue. It is related to a small bug in B1i when responding to a PROPFIND request with an url path with trailing slash.
This bug should be fixed in the next B1i Patch.
Meanwhile you can use the following workarounds:
In older versions of XMLSpy you could just enter the path without trailing slash:
http://localhost:8080/B1iXcellerator/exec/dummy
Since the newer Version of XMLSpy automatically adds the trailing slash (which is the proper behaviour of a WebDAV client), you have to eleminate the additional slash in the resulting url path:
http://localhost:8080/B1iXcellerator/exec/dummy//sim.com.sap.b1i.datasync.001/bp.Z.PRIELL/BizPackageMETA.xml
=>
http://localhost:8080/B1iXcellerator/exec/dummy/sim.com.sap.b1i.datasync.001/bp.Z.PRIELL/BizPackageMETA.xml
The other way is to create a project with the external webfolder. Unfortunately XMLSpy adds the trailing slash also here. So you have to edit the created project file (.spp) afterwards to delete the trainling slash. Then it should look like this:
<?xml version="1.0" encoding="UTF-8"?>
<Project>
<ExtMountFolder FolderName="http://localhost:8080/B1iXcellerator/exec/dummy"/>
</Project>
Kind regards,
Marcus -
Duplicate records returned by db adapter
Hi,
We have a DB Adapter design as following.
From a J2EE application, an invoking procedure at the adapter is triggered. This invokes the DB adapter which inturn invokes the implemetned procedure which
returns a VARRAY.
J2EE application is deployed on the AS 10g Protal side.
The implemented procedure further invokes a legacy procedure which returns a Refcursor.Inside this implemetned procedure, the cursor is fetched into a
Recortype and each element of the record type is added to an Object (of type MPLUS_MPLUS_BankGurDet_OAI_V1). Then each of this object is added to a VARRAY and this VARRAY is returned to the invoking procedure.
The problem we face is that, in the returned the varray, there is always a duplicate of the last recored. That is if we have , say 5 records, then when we manipulate the VARRAY, there will 6 recored and the sixth record will be a duplicate of the 5th one.
Why is this happening. I have attached the code I used and log file. This is happening for all cases where VARRAY is returned. I have attached only one set
here.The log file attached clearly show the duplicate records.
-- All these is defined at the Legacy system
-- Following is a object definition used by the implemented procedure to return a collection of objects.
TYPE MPLUS_MPLUS_BankGurDet_OAI_V1 IS OBJECT (
AG_CODE VARCHAR2(1000),
AMT_NO NUMBER,
BANK VARCHAR2(1000),
VAL_FROM DATE,
VAL_TO DATE,
GUAR_NO VARCHAR2(1000)
-- Following is the defintion of Varray returned by the implemented procedure.
TYPE MPLUS_MPLUS_BankGurDet_OAI_Arr IS VARRAY(1000) OF MPLUS_MPLUS_BankGurDet_OAI_V1;
-- This is the implemented procedure called by adapter. This returns a Varray of the above object.(MPLUS_MPLUS_BankGurDet_OAI_V1).
PACKAGE Mplus AS
TYPE MY_TYPE IS REF CURSOR;
PROCEDURE imp_bankGurDet_OAI_V1(
i_CUSTOMER_CODE IN LONG,
i_CURRENT_DATE IN DATE,
o_RESULT OUT MPLUS_MPLUS_BankGurDet_OAI_Arr
END Mplus ;
PACKAGE BODY Mplus AS
PROCEDURE imp_bankGurDet_OAI_V1(
i_CUSTOMER_CODE IN LONG,
i_CURRENT_DATE IN DATE,
o_RESULT OUT MPLUS_MPLUS_BankGurDet_OAI_Arr
AS
Type BANK IS RECORD(agencyname VARCHAR2(1000),Amout NUMBER,BankName VARCHAR2(1000),validfrom date , validto date,guarenteeno varchar2(1000));
RECS MY_TYPE; -- Ref cursor
BANKDETAILS_REC BANK ;
BANKDETAILS_OBJ MPLUS_MPLUS_BANKGURDET_OAI_V1;
i Number;
dummy number;
BEGIN
WF_MP_ADVT.SP_ADV_AGE_BANK_GRTY(i_CUSTOMER_CODE,i_CURRENT_DATE,RECS);
dummy:= 0;
BANKDETAILS_OBJ:=new MPLUS_MPLUS_BankGurDet_OAI_V1('',0,'',sysdate,sysdate,'');
o_RESULT:=MPLUS_MPLUS_BankGurDet_OAI_Arr();
i:=1;
LOOP
fetch RECS INTO BANKDETAILS_REC;
BANKDETAILS_OBJ.AG_CODE:=BANKDETAILS_REC.agencyname;
BANKDETAILS_OBJ.AMT_NO:=BANKDETAILS_REC.Amout;
BANKDETAILS_OBJ.BANK:=BANKDETAILS_REC.BankName;
BANKDETAILS_OBJ.VAL_FROM:=to_date(BANKDETAILS_REC.validfrom,'dd-mon-yyyy');
BANKDETAILS_OBJ.VAL_TO:=to_date(BANKDETAILS_REC.validto,'dd-mon-yyyy');
BANKDETAILS_OBJ.GUAR_NO:=BANKDETAILS_REC.guarenteeno;
o_RESULT.EXTEND;
o_RESULT(i):=BANKDETAILS_OBJ;
i:=i+1;
EXIT WHEN RECS%NOTFOUND;
END LOOP;
END imp_bankGurDet_OAI_V1;
END Mplus ;
-- The following is a legacy procedure which return a refcursor which is iterated by the implemented procedure to create object and then this object is added to VARRAY in the.
PACKAGE WF_MP_ADVT AS
PROCEDURE SP_ADV_AGE_BANK_GRTY(
Customer_Code IN CHAR,
curdate in date,
RESULT OUT Record_Type);
END;
PACKAGE BODY WF_MP_ADVT AS
PROCEDURE SP_ADV_AGE_BANK_GRTY(
Customer_Code IN CHAR,
curdate in date,
RESULT OUT Record_Type) IS
BEGIN
-- OPEN RESULT FOR SELECT AG_CODE,AMT_NO,BANK,to_char(VAL_FROM,'dd-mm-yyyy'),to_char(VAL_TO,'dd-mm-yyyy'),GUAR_NO FROM WF_MP_ADVT_BANKGAR WHERE AG_CODE=CUSTOMER_CODE;
--OPEN RESULT FOR SELECT * FROM WF_MP_ADVT_BANKGAR WHERE AG_CODE=CUSTOMER_CODE;
OPEN RESULT FOR SELECT AG_CODE,AMT_NO,BANK,to_char(VAL_FROM,'dd-mon-yyyy'),to_char(VAL_TO,'dd-mon-yyyy'),GUAR_NO FROM WF_MP_ADVT_BANKGAR WHERE AG_CODE=CUSTOMER_CODE;
-- null;
END SP_ADV_AGE_BANK_GRTY;
END;
The log file is as following
Mplus.bankGurDet:OAI/V1,OAI/V1,false,1
CUSTOMER_CODE: 1
CURRENT_DATE: Fri Oct 29 00:00:00 GMT+05:30 2004
Tue Nov 02 14:55:10 GMT+05:30 2004: InMessageTransformer: got a message for processing.
Mplus.bankGurDet:OAI/V1,OAI/V1,false,1
CUSTOMER_CODE: 1
CURRENT_DATE: Fri Oct 29 00:00:00 GMT+05:30 2004
Tue Nov 02 14:55:11 GMT+05:30 2004: Inbound Transform Engine: beginning to transform message.
Tue Nov 02 14:55:11 GMT+05:30 2004: MessageTransformer: Successfully created destination message object with necessary header information but no attribute objects yet.
Tue Nov 02 14:55:11 GMT+05:30 2004: InMessageTransformer: got a message for processing.
Mplus.bankGurDet:OAI/V1,OAI/V1,false,1
CUSTOMER_CODE: 1
CURRENT_DATE: Fri Oct 29 00:00:00 GMT+05:30 2004
Tue Nov 02 14:56:14 GMT+05:30 2004: db_bridge_writer_1 wrote the message to the database successfully.
Tue Nov 02 14:56:14 GMT+05:30 2004: Agent: sending reply message.
Mplus.bankGurDet:OAI/V1,OAI/V1,true,2
RESULT[0]
AG_CODE: 1
AMT_NO: 200000.0
BANK: STATE BANK OF INDIA
VAL_FROM: 0004-04-01
VAL_TO: 0005-03-31
GUAR_NO: SBI01
RESULT[1]
AG_CODE: 1
AMT_NO: 200000.0
BANK: HDFC BANK
VAL_FROM: 0004-04-01
VAL_TO: 0005-03-31
GUAR_NO: SBI01
RESULT[2]
AG_CODE: 1
AMT_NO: 200000.0
BANK: HDFC BANK
VAL_FROM: 0004-04-01
VAL_TO: 0005-03-31
GUAR_NO: SBI01Vinod,
As far as I can see the problem with duplicating the last record is a result of the EXIT condition in the loop in procedure 'imp_bankGurDet_OAI_V1'. Your loop looks as follows:
LOOP
FETCH recs INTO bankdetails_rec;
bankdetails_obj.ag_code := bankdetails_rec.agencyname;
bankdetails_obj.amt_no := bankdetails_rec.amout;
bankdetails_obj.bank := bankdetails_rec.bankname;
bankdetails_obj.val_from := TO_DATE(bankdetails_rec.validfrom,'DD-MON-YYYY');
bankdetails_obj.val_to := TO_DATE(bankdetails_rec.validto,'DD-MON-YYYY');
bankdetails_obj.guar_no := bankdetails_rec.guarenteeno;
o_result.EXTEND;
o_result(i):= bankdetails_obj;
i:=i+1;
EXIT WHEN recs%NOTFOUND;
END LOOP;
The problem is that checking for recs%NOTFOUND at the end of the loop results in going through the loop one more time even though you can't fetch another row from the recs cursor. The solution is to put the EXIT condition right after the FETCH statement. You now exit the loop if you can't fetch another row without assigning the last fetched record to bankdetails_obj again:
LOOP
FETCH recs INTO bankdetails_rec;
EXIT WHEN recs%NOTFOUND;
bankdetails_obj.ag_code := bankdetails_rec.agencyname;
bankdetails_obj.amt_no := bankdetails_rec.amout;
bankdetails_obj.bank := bankdetails_rec.bankname;
bankdetails_obj.val_from := TO_DATE(bankdetails_rec.validfrom,'DD-MON-YYYY');
bankdetails_obj.val_to := TO_DATE(bankdetails_rec.validto,'DD-MON-YYYY');
bankdetails_obj.guar_no := bankdetails_rec.guarenteeno;
o_result.EXTEND;
o_result(i):= bankdetails_obj;
i:=i+1;
END LOOP;
CLOSE recs;
You also might want to consider to close the ref cursor after exiting the loop... 'too many open cursors' is not a good exception to get. ;-)
Hope this is helpful.
Thanks,
Markus -
Deleting a MS Access database table record using JOptionPane
hi!
just want some help here..
is there a way to delete a MS Access database record through using JOptionPane?? i've gone through some, probably alot of examples on SELECT, INSERT, UPDATE, DELETE statements but none came up to the stuff i need.
so far i've seen the DELETE statement like this and also this is a common DELETE statement..
statement.executeUpdate("DELETE FROM tableName WHERE fieldName01 = 'blablabla' AND fieldName02 = 'etcetcetc'");like INSERT, there's a coding somewhat like this:
String asd = JOptionPane.showInputDialog(null, "Enter blablabla stuff");
statement.executeUpdate("INSERT INTO whatEverTableName (tableFieldName) VALUES('"+asd.getText()+"')");so, is it possible using the same method for DELETE??
help and advices are appreciated in advanced..Here's how I did it. Research does help, but sometimes looking at others code does too... You do have to have a dummy file that you made with access though. You can't just make a file file.mdb (it will be corrupt)
public void createDatabase(String database) throws SQLException{
try{
// This file needs to have been created with MS Access
File dbfile = new File(this.dataBaseDir + "dummy.mdb");
// This is the new database file being made
File newFile = new File(this.dataBaseDir + database + ".mdb");
// Copy all bytes from dummy file to new DB file.
FileInputStream instream = new FileInputStream(dbfile);
FileOutputStream ostream = new FileOutputStream(newFile);
int numBytes = instream.available();
byte inBytes[] = new byte[numBytes];
instream.read(inBytes, 0, numBytes);
ostream.write(inBytes, 0, numBytes);
catch(FileNotFoundException e) { e.printStackTrace();}
catch(IOException e) { e.printStackTrace();}
if(DEBUG) System.out.println("creating the " + database + " database");
} -
Can't put video within template,
Hi,
I am using Dreamweaver CS3. Is there a way to insert a flash
video within a page linked to a template? I always get the error
"making this change would require changing code that is locked by a
template or a translator". I tried unlinking, inserting the video,
then relinking but I get two regions that are not associated with
the template and so ruin the layout once saved. I need all pages to
be linked to the template as the navigational links are constantly
changing/updating - these need to be consistent with every page.
What can I do?!
THanks,
SteveWhen you insert Flash video with Flash detection and
prompting, DW wants to
put this into the body tag -
onLoad="MM_CheckFlashVersion('7,0,0,0','Content on this page
requires a
newer version of Adobe Flash Player. Do you want to download
it now?');"
e.g.,
<body onLoad="MM_CheckFlashVersion('7,0,0,0','Content on
this page requires
a newer version of Adobe Flash Player. Do you want to
download it now?');">
Let's assume that you have a child page with the video
already inserted
WITHOUT Flash detection.
What you would need to do would be to create a DUMMY page,
(FILE | New >
Basic HTML), and insert the video on that page, then copy and
paste from
that page into your template child page.
First, copy and paste the Flash detection script -
change this -
</head>
to this -
<script type="text/javascript">
function MM_CheckFlashVersion(reqVerStr,msg){
with(navigator){
var isIE = (appVersion.indexOf("MSIE") != -1 &&
userAgent.indexOf("Opera") == -1);
var isWin = (appVersion.toLowerCase().indexOf("win") != -1);
if (!isIE || !isWin){
var flashVer = -1;
if (plugins && plugins.length > 0){
var desc = plugins["Shockwave Flash"] ? plugins["Shockwave
Flash"].description : "";
desc = plugins["Shockwave Flash 2.0"] ? plugins["Shockwave
Flash
2.0"].description : desc;
if (desc == "") flashVer = -1;
else{
var descArr = desc.split(" ");
var tempArrMajor = descArr[2].split(".");
var verMajor = tempArrMajor[0];
var tempArrMinor = (descArr[3] != "") ?
descArr[3].split("r") :
descArr[4].split("r");
var verMinor = (tempArrMinor[1] > 0) ? tempArrMinor[1] :
0;
flashVer = parseFloat(verMajor + "." + verMinor);
// WebTV has Flash Player 4 or lower -- too low for video
else if (userAgent.toLowerCase().indexOf("webtv") != -1)
flashVer =
4.0;
var verArr = reqVerStr.split(",");
var reqVer = parseFloat(verArr[0] + "." + verArr[2]);
if (flashVer < reqVer){
if (confirm(msg))
window.location =
http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash";
</script>
</head>
Then, assuming you have no other events in the child page's
body tag, change
this -
</head>
to this -
<script type="text/javascript">
<!--
window.onload(MM_CheckFlashVersion('7,0,0,0','Content on this
page requires
a newer version of Adobe Flash Player. Do you want to
download it now?');
-->
</script>
</head>
and you should be all set.
(by the way, my example is set to check for version 7)
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com
- Template Triage!
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
http://www.macromedia.com/support/search/
- Macromedia (MM) Technotes
==================
"JimboSun" <[email protected]> wrote in
message
news:[email protected]...
> How, how? How do we have the Check for Flash in a
Template Child Page? -
Dlopen within JNI routine?
Hello,
I have a set of JNI-callable C++ routines in lib1.so,
From within one of these I would like to dlopen() a second
C++ library lib2.so.
dlopen() of this' second library always fails, with dlerror() reporting
'ld.so.1: java: fatal: JNI_OnLoad: can't find symbol'
This second library is purely for local use within a single
JNI-callable routine. Example code below.
How can I make this work please?
Thanks
-- Steve
sun01% java -version
java version "1.4.2_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode)
sun01% CC -V
CC: Forte Developer 7 C++ 5.4 2002/03/09
sun01% more Jmaster.java
import java.util.*;
public class Jmaster
static
System.loadLibrary("lib1");
private native void lib1doit();
public static void main(String[] dummy)
Jmaster me = new Jmaster();
me.lib1doit();
sun01% more liblib1.cpp
#include <stdio.h>
#include <stdlib.h>
#include <dlfcn.h>
#include <link.h>
#include <errno.h>
#include "Jmaster.h"
JNIEXPORT void JNICALL Java_Jmaster_lib1doit(JNIEnv* env, jobject obj)
char* dlerr;
fprintf(stderr,"Loaded liblib1.so from Java, about to dlopen liblib2.so\n");
// Open lib2
void* mydll = dlopen("liblib2.so",RTLD_NOW);
if ((dlerr=dlerror()) != NULL)
fprintf(stderr,"ERROR! dlopen of liblib2 failed: %s\n",dlerr);
exit(-1);
// Get call to 'lib2doit()'
void(*doit2)() = (void(*)()) dlsym(mydll,"lib2doit");
if ((dlerr=dlerror()) != NULL)
fprintf(stderr,"ERROR! dlsym of lib2doit failed: %s\n",dlerr);
exit(-1);
// Call 'doit2()'
doit2();
// Close lib2
dlclose(mydll);
if ((dlerr=dlerror()) != NULL)
fprintf(stderr,"ERROR! dlclose of liblib2 failed: %s\n",dlerr);
exit(-1);
sun01% more liblib2.cpp
#include <stdio.h>
extern "C" void lib2doit()
fprintf(stderr,"HELLO from lib2\n");
sun01% javac Jmaster.java
sun01% javah -jni Jmaster
sun01% CC -G liblib1.cpp -o liblib1.so -xildoff -library=Cstd -features=no%strictdestrorder -ldl -I/usr/j2sdk1.4.2/include -I/usr/j2sdk1.4.2/include/solaris
sun01% CC -G liblib2.cpp -o liblib2.so -xildoff -library=Cstd -features=no%strictdestrorder
sun01%
sun01% java Jmaster
Loaded liblib1.so from Java, about to dlopen liblib2.so
ERROR! dlopen of liblib2 failed: ld.so.1: java: fatal: JNI_OnLoad: can't find symbol
sun01%"Johannes Hönig" wrote:
>
Hi
The specification said:
"The enterprise bean must not attempt to load a native library. This funciton is
reserved for the EJB container. Allowing the enterprise bean to load native code
would create a securtiy hole."
Is there a way that the container loads the library. So that I can access it by JNDI
or something simular?
Or do I blind trust the native code that he works fine?The standard approach is to have an RMI server object load the native
library and expose its interface (as a subinterface of Remote,
naturally). Your beans can then call this server via RMI and if they're
in the same container (a given, usually) then you will not incur any RMI
overhead (marshalling, serialization, etc).
Cheers,
Alexander Petrushko
mailto:[email protected]
Consulting Services available
Freemarker vs JSP:
http://javaworld.com/javaworld/jw-01-2001/jw-0119-freemarker.html -
Synchronize problem...please help...
My code:
public synchronized void doIt(String dummy)
Thread thread = new Thread(this);
thread.start();
public void run()
.... code to process
I have a method doIt() in a class (called class A). This method doIt() is called by pressing a button on a webpage. The method doIt() creates a new thread which then does all the processing needed and the method doIt() returns while the thread continues in the background. However, i dont want anyone else to call the method doIt() until the thread has finished running.
I need to have the processing in a separate thread in the doIt() method otherwise the user will have to wait several minutes before the next webpage loads up since it has to then wait for all the processing to finish before the method doIt() returns.
Now class A is application scoped (global scoped in Dynamo) so everyone is sharing this class.
I have put the synchronized keyword next to the method doIt(). This does not make no difference. If i click the webpage button from separate browser windows they both call doIt() and enter the method. I suspect this is happening because once the thread has been started, the method doIt() returns therefore releasing the lock. So how can i say keep the method locked until the thread finishes?
Thanks in advance...OK I must confess that while I think everyone is entitled to my opinion,
no one is correct 100% of the time. However, I am not going to believe something
just because someone says it. So I am going to dig into this further and
explore the "facts."
Why do you say dirty? II think it is a capabilityof the language and only dirty if implemented poorly.
Yep, that's what I mean. It would be a poor
implementation. There are better ways of making a
piece of code single-threaded than synchronizing
Runnable.run(). By better I mean less prone to
misunderstanding by a reasonable person. I dunno... I fail to see where the misunderstanding is to anyone who can read.
As a matter of fact I usually do not use synchronized methods
except when starting and stopping, but that in fact goes back
to the old 1.1.5 JVM under Netscape... Which had its own unique set
of quirks. Lately I have unwound many of those as well.
If the
Runnable also has state such code becomes prone to
misunderstanding even by the person who writes it.Heheh I would never confess in public to not understanding my own code
not that that has never happened OOps I recind that admission :)
For example, the previous example will eventuallydeadlock because of lack of notification.
There is also lack of wait()ing. Therefore
notification is not needed.Consider that if another Thread could get blocked if it tries to
get the Monitor while the other thread in the synchronized method().
Would that Thread automatically be able to get the Monitor without being notified?
I can prove this; with this program.
//// synchronized method test.
public class SynchTest
static int id = 0;
SynchTest()
int z;
long maxIterations = 120;
Caller c1 = new Caller();
Caller c2 = new Caller();
int iteration1 = 0;
int iteration2 = 0;
// wait for threads to start
System.out.println("SynchTest()");
while(!c1.task.isAlive() && !c2.task.isAlive())
synchronized(this)
try{wait(100);}catch(InterruptedException ie){}
System.out.println("SynchTest waiting");
System.out.println("running");
for(z=0;z<maxIterations;z++)
synchronized(this)
try{wait(1000);}catch(InterruptedException ie){}
if(c1.iteration == iteration1 || c2.iteration == iteration2)
System.out.println("It deadlocked ");
System.exit(1);
System.out.println("c1="+c1.iteration+" c2="+c2.iteration);
iteration1 = c1.iteration;
iteration2 = c2.iteration;
public synchronized void synchedMethod()
public static void main(String args[])
new SynchTest();
class Caller implements Runnable
String msg = "";
Thread task = null;
int iteration = 0;
Caller()
start();
public void start()
task = new Thread(this);
task.start();
public void stop()
task = null;
public void run()
Thread controlThread = Thread.currentThread();
System.out.println("Caller running");
task.setName("Caller("+(id++)+")");
while(controlThread == task)
//System.out.println(" caller running "+this.toString());
synchedMethod();
iteration++;
//// end test// Here is the exact Thread dump. It does take a while but it
// always deadlocks eventually.
Full thread dump Java HotSpot(TM) Client VM (1.4.2_04-b05 mixed mode):
"DestroyJavaVM" prio=5 tid=0x00034e90 nid=0x58c waiting on condition [0..7fad8]
"Caller(1)" prio=5 tid=0x00a0c148 nid=0x248 runnable [2cdf000..2cdfd8c]
at SynchTest.synchedMethod(SynchTest.java:46)
- waiting to lock <0x1002c2f0> (a SynchTest)
at SynchTest$Caller.run(SynchTest.java:83)
at java.lang.Thread.run(Unknown Source)
"Caller(0)" prio=5 tid=0x00a0bfe8 nid=0x4e4 waiting for monitor entry [2c9f000..2c9fd8c]
at SynchTest.synchedMethod(SynchTest.java:46)
- waiting to lock <0x1002c2f0> (a SynchTest)
at SynchTest$Caller.run(SynchTest.java:83)
at java.lang.Thread.run(Unknown Source)
"Signal Dispatcher" daemon prio=10 tid=0x009f53d8 nid=0x334 waiting on condition [0..0]
"Finalizer" daemon prio=9 tid=0x009bd2c8 nid=0x784 in Object.wait() [2b5f000..2b5fd8c]
at java.lang.Object.wait(Native Method)
- waiting on <0x10010498> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(Unknown Source)
- locked <0x10010498> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(Unknown Source)
at java.lang.ref.Finalizer$FinalizerThread.run(Unknown Source)
"Reference Handler" daemon prio=10 tid=0x009bbe98 nid=0x398 in Object.wait() [2b1f000..2b1fd8c]
at java.lang.Object.wait(Native Method)
- waiting on <0x10010388> (a java.lang.ref.Reference$Lock)
at java.lang.Object.wait(Unknown Source)
at java.lang.ref.Reference$ReferenceHandler.run(Unknown Source)
- locked <0x10010388> (a java.lang.ref.Reference$Lock)
"VM Thread" prio=5 tid=0x009f36d0 nid=0x53c runnable
"VM Periodic Task Thread" prio=10 tid=0x009f7bf0 nid=0x250 waiting on condition
"Suspend Checker Thread" prio=10 tid=0x009f4940 nid=0x3c0 runnable
You can see that Caller0 and Caller1 are both waiting for the Monitor for(;;)
If you do proper notification however this never occurs.
I have to ask 2 questions.
1- Why would Sun make it a capability of the language if it is bad??
2- Why would Sun use it themselves if it is bad?
ie: from NIO.Channels .. This has very non typical constructor syntax BTW.
public synchronized void write(byte[] bs, int off, int len);
I always try to prove everything and leave nothing to chance.
Conclusion: I am not covinced using synchronized methods are dirty .
I must confess you made me question myself in this regard however :)
(T) -
Xmlspy Error submitting HTTP Request 400
Hi All,
Whe I try to open any XML file with XMLspy, for example BizPackageMETA.xml, I get the an error :
Sorry, but the file "http://localhost:8080/B1iXcellerator/exec/dummy//sim.com.sap.b1i.datasync.001/bp.Z.PRIELL/BizPackageMETA.xml" could not be opend!
Error Submitting HTTP request for "http://localhost:8080/B1iXcellerator/exec/dummy//sim.com.sap.b1i.datasync.001/bp.Z.PRIELL/BizPackageMETA.xml":400
I had enabled WebDav in xcellerator.cfg. Anything else I am missing ?Hi Hany,
I already had opened service calls at Altova and SAP regarding this issue. It is related to a small bug in B1i when responding to a PROPFIND request with an url path with trailing slash.
This bug should be fixed in the next B1i Patch.
Meanwhile you can use the following workarounds:
In older versions of XMLSpy you could just enter the path without trailing slash:
http://localhost:8080/B1iXcellerator/exec/dummy
Since the newer Version of XMLSpy automatically adds the trailing slash (which is the proper behaviour of a WebDAV client), you have to eleminate the additional slash in the resulting url path:
http://localhost:8080/B1iXcellerator/exec/dummy//sim.com.sap.b1i.datasync.001/bp.Z.PRIELL/BizPackageMETA.xml
=>
http://localhost:8080/B1iXcellerator/exec/dummy/sim.com.sap.b1i.datasync.001/bp.Z.PRIELL/BizPackageMETA.xml
The other way is to create a project with the external webfolder. Unfortunately XMLSpy adds the trailing slash also here. So you have to edit the created project file (.spp) afterwards to delete the trainling slash. Then it should look like this:
<?xml version="1.0" encoding="UTF-8"?>
<Project>
<ExtMountFolder FolderName="http://localhost:8080/B1iXcellerator/exec/dummy"/>
</Project>
Kind regards,
Marcus
Maybe you are looking for
-
I have another problem with my 30G ipod video. It skips certain songs, not entirely, but partway through. For instance, there is a song that it will play for 15 sec, and then skip to the next one. It is always the same songs and it skips at the same
-
FOR THE FIFTH TIME - lost audio FF 4.0.1 Windows Ultimate
Where do I find answers? I have reported this problem 4 times before. I have no audio with FF 4.0.1 running on Win 7 Ult. No problem with any other browser nor any other app.
-
What is best reccomended for my upgrade?
Hi all, I have just got my first mac off a friend. It is a Dual 1.8ghz PowerPC G5 System. It currently has 4 sticks of DDR SDRAM and a GeForce FX5200 gfx card. As I am kind of new to upgrading macs, can anyone suggest to me what I should upgrade this
-
How to revert back from external display mode to laptop display mode?
Hi, I'm new to this community. I'm not sure if this is where I should be posting my questions. Anyway, I accidentally pressed fn + f2, which switched my laptop into external display mode (I'm pretty sure), and the screen is now very narrow and small.
-
What is object name in VBA to get query variable values? Is it possible at all?