FileSystemWatcher similar code in Java
Hi All,
I am trying to write a code which aims to move a file from a specific folder to an another folder. This program starts everyday at 7:30 am and ends at 16:30 . Rather than implementing an hourly check, I wanted to control the folder and whenever a file is copied into that folder it should be moved immediately to the other folder. .Net is supporitng this with FileSystemWatcher (I guess). Is there any possibility to implement a method such like this?
Thanks for your answers.
Regards
Message was edited by:
legolas066
http://www2.hawaii.edu/~qzhang/FileSystemWatcher.html
Similar Messages
-
How can i get the source code from java concurrent program in R12
Hi 2 all,
How can i get the source code from java concurrent program in R12? like , "AP Turnover Report" is java concurrent program, i need to get its source code to know its logic. how can i get its source code not the XML template?
Regards,
Zulqarnainuser570667 wrote:
Hi 2 all,
How can i get the source code from java concurrent program in R12? like , "AP Turnover Report" is java concurrent program, i need to get its source code to know its logic. how can i get its source code not the XML template?
Regards,
ZulqarnainDid you see old threads for similar topic/discussion? -- https://forums.oracle.com/forums/search.jspa?threadID=&q=Java+AND+Concurrent+AND+Source+AND+Code&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
Thanks,
Hussein -
How do I rewrite current code for java 1.3
I'm using the code below that is written for java 1.4. I have been told that the company can not push JRE 1.4 to the company, and that I need to write my code for java 1.3. I'm using org.w3c.dom for my create xml, etc.
Is there a java 1.3 option to the 1.4? Any help would be very appreciated.
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.util.List;
import java.io.*;
import java.util.*;
import javax.xml.parsers.*;
import javax.xml.transform.*;
import javax.xml.transform.dom.*;
import javax.xml.transform.stream.*;
import org.w3c.dom.*;
public class Sametime extends JFrame implements ActionListener {
private int indentation = -1;
JPanel panel = new JPanel();
JTextArea jta = new JTextArea(
//Instructions for user
"For a successful buddy list migration do the following:\n"
+ "1. Save your current Sametime Buddy List to your PC.\n "
+ "The default location should be: C:/Program Files/Lotus/Sametime Client.\n"
+ " A. Open the Sametime Client.\n"
+ " B. Click on People\n"
+ " C. Click on Save List.\n"
+ " D. Save as your first.last.dat\n"
+ " Ex. john.doe.dat\n"
+ "NOTE: If you have AOL contacts in your Sametime buddy list they will not be migrated.\n");
JButton browse = new JButton("Continue");
JButton exit = new JButton("Exit");
public Sametime() {
super("Sametime Buddy List Migration");
setSize(610, 245);
Container c = this.getContentPane();
c.add(panel);
browse.addActionListener(this);
exit.addActionListener(this);
panel.add(jta);
panel.add(browse);
panel.add(exit);
jta.setEditable(false);
setLookAndFeel();
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
} //end Sametime
public class DATFilter extends javax.swing.filechooser.FileFilter {
public boolean accept(File f) {
//if it is a directory -- we want to show it so return true.
if (f.isDirectory())
return true;
String extension = getExtension(f);//get the extension of the file
//check to see if the extension is equal to "dat"
if ((extension.equals("dat")))
return true;
//default -- fall through. False is return on all
//occasions except:
//a) the file is a directory
//b) the file's extension is what we are looking for.
return false;
}//end accept
public String getDescription() {
return "dat files";
}//end getDescription
* Method to get the extension of the file, in lowercase
private String getExtension(File f) {
String s = f.getName();
int i = s.lastIndexOf('.');
if (i > 0 && i < s.length() - 1)
return s.substring(i+1).toLowerCase();
return "";
}//end getExtension
}//end class DATFilter
public void actionPerformed(ActionEvent e) {
//Default Location for JFileChooser search
String error = "The file selected is not a .dat file!\n"
+ "Please select your recently saved .dat file and try again.";
JFileChooser fc = new JFileChooser("/Program Files/Lotus/Sametime Client");
fc.setFileFilter(new DATFilter());
fc.setFileSelectionMode( JFileChooser.FILES_ONLY);
String user = System.getProperty("user.name");// finds who the current user is
if (e.getSource() == browse) {
int returnVal = fc.showSaveDialog(Sametime.this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
//if (fc.getSelectedFile().getName().equals(".dat")){
if (fc.getSelectedFile().getName().endsWith(".dat")){ // checks to see if selected file is .dat
}else{
JOptionPane.showMessageDialog(null, error, "Wrong File", JOptionPane.ERROR_MESSAGE);
return;
}//end else
try {
String[] contactArray = parseDatFile(fc.getSelectedFile());
Document document = createXMLDocument(contactArray);
saveToXMLFile(
document,
new File(
"C:/Documents and Settings/" + user +"/My Documents/OLCS/",// looks for directory for list
"contacts-list_migration.ctt"));
} catch (Exception exc) {
File f = new File("C:/Documents and Settings/" + user +"/My Documents/OLCS/");// setting directory for list if not there
boolean yes = true;
yes = f.mkdir();// creating directory
try {
String[] contactArray = parseDatFile(fc.getSelectedFile());
Document document = createXMLDocument(contactArray);
saveToXMLFile(
document,
new File(
"C:/Documents and Settings/" + user +"/My Documents/OLCS/",// used only if the directory didn't exist
"contacts-list_migration.ctt"));
//exc.printStackTrace();// not sure if this is needed?
} catch (Exception exc1) {
exc1.printStackTrace();
}//end inner catch
}// end catch
}// end if
if(returnVal==JFileChooser.CANCEL_OPTION){
String Warning = "You did not migrate your Sametime buddy list at this time.";
JOptionPane.showMessageDialog(null, Warning, "Migration Canceled", JOptionPane.WARNING_MESSAGE);
return;
}else{
String thankyou = "Thank You for Migrating your Sametime buddy list to OLCS"
+ "\nYour new OLCS buddy list has been saved to:"
+ "\nC:/Documents and Settings/" + user +"/My Documents/OLCS"
+ "\n as: Contact-List_migration.ctt"
+ "\n\n To be able to use Contact-List_migration.ctt for Windows Messenger:"
+ "\n1. Log into Windows Messenger."
+ "\n2. Click on File"
+ "\n3. Click on 'Import Contacts from a Saved File...'"
+ "\n4. Open OLCS in My Documents"
+ "\n5. Click on 'Contact-list_migration.ctt'"
+ "\n6. Click Open to import the list."
+ "\n A window will pop up confirming that you want to add all of the contacts"
+ "\n Click 'yes'"
+ "\n Your buddy list is ready to be used.";
JOptionPane.showMessageDialog(null, thankyou, "Migration Completed", JOptionPane.INFORMATION_MESSAGE);//Change this when defualt directory is known.
}//end if else statement
} //end if
System.exit( 0 );
if (e.getSource() == exit) {
System.exit( 0 );
} //end if
} //end actionPerformed
String[] parseDatFile(File datFile)
throws Exception {
List list = new ArrayList();
BufferedReader br = new BufferedReader(new FileReader(datFile));
String line;
while ((line = br.readLine()) != null) {
line = line.trim();
if (line.indexOf("U") != 0)
continue;
int p = line.indexOf("::");
if (p == -1)
continue;
line = line.substring(p + 2).trim();
if (line.indexOf("AOL") == 0)
continue;
p = line.indexOf(",");
if (p != -1)
line = line.substring(0, p);
line = line.trim() + "@mci.com";
if (list.indexOf(line) == -1)
list.add(line);
}//end while
br.close();
String[] contactArray = new String[list.size()];
list.toArray(contactArray);
return contactArray;
}// end String
// setting up the XML file
Document createXMLDocument(String[] contactArray) throws Exception {
DocumentBuilderFactory dBF = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = dBF.newDocumentBuilder();
DOMImplementation domImpl = builder.getDOMImplementation();
Document document = domImpl.createDocument(null, "messenger", null);
Element root = document.getDocumentElement();
Element svcElm = document.createElement("service");
Element clElm = document.createElement("contactlist");
svcElm.setAttribute("name", "Microsoft RTC Instant Messaging");
svcElm.appendChild(clElm);
root.appendChild(svcElm);
for (int i = 0; i < contactArray.length; i++) {
Element conElm = document.createElement("contact");
Text conTxt = document.createTextNode(contactArray);
conElm.appendChild(conTxt);
clElm.appendChild(conElm);
}//end for
return document;
}// end Document
void saveToXMLFile(Document document, File xmlFile) throws Exception {
OutputStream os =
new BufferedOutputStream(new FileOutputStream(xmlFile));
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");//puts information on seperate lines
transformer.setOutputProperty(OutputKeys.METHOD, "xml");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");//gives the XML file indentation
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
DOMSource source = new DOMSource(document);
StreamResult result = new StreamResult(os);
transformer.transform(source, result);
os.close();
}//end saveToXMLFile
public static void main(String[] args) {
Sametime st = new Sametime();
ImageIcon picIcon = new ImageIcon(st.getClass().getResource("/images/mci.gif"));//Change when default is known!
st.setIconImage(picIcon.getImage());
} //end main
private void setLookAndFeel() {
try {
UIManager.setLookAndFeel(
UIManager.getSystemLookAndFeelClassName());
SwingUtilities.updateComponentTreeUI(this);
} catch (Exception e) {
System.err.println("Could not use Look and Feel: " + e);
} //end catch
} //end void setLookAndFeel
} //end public class SametimeAre there features of Java 1.4 that you specifically took advantage and are there any particular lines you are having problems with or did you just freak and post it here?
Basically compile it under Java 1.3 and see what complains. I've done several projects that compile under 1.2, 1.3, and 1.4. -
How to get the source code of Java Concurrent Program?
Hi,
How to get the source code of Java Concurrent Program?
Example
Programe Name:Format Payment Instructions
Executable:Format Payment Instructions
Execution File Name:FDExtractAndFormatting
Execution File Path:oracle.apps.iby.scheduler
Thanks in advance,
SenthilGo on Unix box at $JAVA_TOP/oracle/apps/iby/scheduler
You will get class file FDExtractAndFormatting.
Decompile it to get source code.
Thanks, Avaneesh -
Please help me transform this C++ code to java code....
guys...please help me transform this C++ code to java code....please try to explain the code..thanks
[program]
#include <stdio.h>
#define ALIVE 1
#define DEAD 0
#define SZ 33
int stschk (int ,int );
main()
int s[SZ][SZ], i, j;
for (i=0; i<sz; i++ ) s[0] = DEAD;
for (j=0; j<sz; j++ ) s[0][j] = DEAD;
s[0][1] = ALIVE;
for (i=0; i<sz-1; i++) {
for ( j=1;j<sz;j++ ) {
s[i][j] = stschk(s[i][j-1],s[i+1][j];
if(s[i][j-1]==ALIVE) printf("*");
else printf(" ");
printf("\n");
int stschk(int s1,int s2)
if(((s1==DEAD)&&(s2==ALIVE))||
((s1==ALIVE)&&(s2==DEAD))) return ALIVE;
else return DEAD;Being picky, that's not C++, that's C. Standard headers in C++ dont' have .h after them, loop variables are scoped with the for, you use constants rather than #defines, etc..
C and C++ both don't initialise arrays by default; you'd have to write an initialiser to get it to zero out the array:
int s[sz][sz] = {};gcc will insert a call to memset to zero the array.
If the author was assuming that the array was zeroed out, there would be no point zeroing the first row and column.
The code reads values which haven't been initialised. If you mark such values explicitly undefined, and change the program to report an error when undefined, then you get several cases where the program makes such report.
So either it' s a primitive random number generator (some random number generators use uninitialised memory as a source of randomness), or it's buggy, or it's processing undefined data and throwing away the result. Either way, it cannot be directly be ported to Java if the undefined values (which are limited to a small area of the ouput) are significant. -
Tips on how to write efficient java code for java mapping
hi
I do not have much knowledge in Java
Can anybody tell me some tips on how to write efficient and optimised java code to be used in java mapping
Thanks,
Loveenahi D'za,
JAVA in xi
A very important place where you will use JAVA in XI is while doing your Mapping. There will be cases when JAVA MAPPING is the best solution to go for. There are 2 types of Parsers available for JAVA Mapping. DOM Parser and SAX parser. Just got through the following links to understand more on Java Mapping and the APIs available.http://java.sun.com/j2se/1.4.2/docs/api/javax/xml/parsers/package-summary.html http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/Document.html http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/package-frame.html /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i
/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-ii /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-iii
JAVA mapping -
/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-ii /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-iii /people/ravikumar.allampallam/blog/2005/06/24/convert-any-flat-file-to-any-idoc-java-mapping /people/amol.joshi2/blog/2006/03/10/think-objects-when-creating-java-mappings /people/sameer.shadab/blog/2005/09/29/testing-abap-mapping
sample code for java mapping
Re: Example code DOM PARSER API -
http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/package-frame.html DOM --- /people/thorsten.nordholmsbirk/blog/2006/08/10/using-jaxp-to-both-parse-and-emit-xml-in-xi-java-mapping-programs tutorial sax and dom
For a tutorial on the methods of SAX and DOM http://java.sun.com/webservices/docs/1.1/tutorial/doc/
SAX AND dom PARSER ( BY thorsten) -
example /people/thorsten.nordholmsbirk/blog/2006/08/10/using-jaxp-to-both-parse-and-emit-xml-in-xi-java-mapping-programs java mapping example ( testing and debugging) /people/stefan.grube/blog/2006/10/23/testing-and-debugging-java-mapping-in-developer-studio
regards
biplab
Use a Good Subject Line, One Question Per Posting - Award Points -
Hi i am getting Innternal Error in jdeveloper IDE in side preferences- code editer- java
hi i am getting Innternal Error in jdeveloper IDE in side preferences->code editer->java
if u know something about this error psease share here
java.lang.NullPointerException
at oracle.jdevimpl.java.editing.JavaOptionsPanel.loadSettingsFrom(JavaOptionsPanel.java:186)
at oracle.jdevimpl.java.editing.JavaOptionsPanel.onEntry(JavaOptionsPanel.java:67)
at oracle.ide.panels.MDDPanel.enterTraversableImpl(MDDPanel.java:1220)
at oracle.ide.panels.MDDPanel.enterTraversable(MDDPanel.java:1201)
at oracle.ide.panels.MDDPanel.access$1200(MDDPanel.java:128)
at oracle.ide.panels.MDDPanel$Tsl.updateSelectedNavigable(MDDPanel.java:1657)
at oracle.ide.panels.MDDPanel$Tsl.updateSelection(MDDPanel.java:1525)
at oracle.ide.panels.MDDPanel$Tsl.actionPerformed(MDDPanel.java:1519)
at javax.swing.Timer.fireActionPerformed(Timer.java:291)
at javax.swing.Timer$DoPostEvent.run(Timer.java:221)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:642)
at java.awt.EventQueue.access$000(EventQueue.java:85)
at java.awt.EventQueue$1.run(EventQueue.java:603)
at java.awt.EventQueue$1.run(EventQueue.java:601)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:612)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:178)
at java.awt.Dialog$1.run(Dialog.java:1046)
at java.awt.Dialog$3.run(Dialog.java:1098)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Dialog.show(Dialog.java:1096)
at java.awt.Component.show(Component.java:1585)
at java.awt.Component.setVisible(Component.java:1537)
at java.awt.Window.setVisible(Window.java:842)
at java.awt.Dialog.setVisible(Dialog.java:986)
at oracle.bali.ewt.dialog.JEWTDialog.runDialog(JEWTDialog.java:395)
at oracle.bali.ewt.dialog.JEWTDialog.runDialog(JEWTDialog.java:356)
at oracle.ide.dialogs.WizardLauncher.runDialog(WizardLauncher.java:55)
at oracle.ide.panels.TDialogLauncher.showDialog(TDialogLauncher.java:225)
at oracle.ide.config.IdeSettings.showDialog(IdeSettings.java:808)
at oracle.ide.config.IdeSettings.showDialog(IdeSettings.java:601)
at oracle.ide.ceditor.CodeEditorController.handleEvent(CodeEditorController.java:956)
at oracle.ide.controller.IdeAction.performAction(IdeAction.java:529)
at oracle.ide.controller.IdeAction.actionPerformedImpl(IdeAction.java:897)
at oracle.ide.controller.IdeAction.actionPerformed(IdeAction.java:501)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:809)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:850)
at java.awt.Component.processMouseEvent(Component.java:6289)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6054)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4652)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4482)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4482)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:644)
at java.awt.EventQueue.access$000(EventQueue.java:85)
at java.awt.EventQueue$1.run(EventQueue.java:603)
at java.awt.EventQueue$1.run(EventQueue.java:601)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
at java.awt.EventQueue$2.run(EventQueue.java:617)
at java.awt.EventQueue$2.run(EventQueue.java:615)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:614)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)Hi,
make sure the IDE is installed with the proper JDK version
Frank -
Hi All,
The Actual query to perform is below.
SELECT name,number from emp WHERE CASE WHEN :1='T' AND term_date IS Not NULL THEN 1 WHEN :1='A' AND term_date IS NULL THEN 1 WHEN :1='ALL' THEN 1 ELSE 1 END = 1;
I have tried in DB adapter like below as a parameter for :1 as #vInputParam
SELECT name,number from emp WHERE CASE WHEN #vInputParam='T' AND term_date IS Not NULL THEN 1 WHEN #vInputParam='A' AND term_date IS NULL THEN 1 WHEN #vInputParam='ALL' THEN 1 ELSE 1 END = 1;
Getting Error code :17003 .java.sql.SQLException: Invalid column index error.
Please suggest me on using ':' bind character in DB adapter Select Query SOA11g.
Can someone help me on this please?
Thanks,
HariHi,
Could you please make sure your binding style(Oracle Positional,Oracle named..etc) of the Seeded VO and Custom Vo are same.
This is the option you will get when you are extending your vo. So make sure that both are same.
You can refer the below link too
VO extension leads to "Invalid column index" exception
Thanks
Bharat -
Can u tell some source codes of java application
can u tell some source codes of java application?
i want to get some source codes .such as a proxy source code .
any help will be appreciated.hi
check www.rgagnon.com for more source code in java.
regards
Pradheep -
How to call C/C++ - Code from Java?
I would like to know if it is possible to call C or C++ - Code from Java and how to do.
In short, yes you can do this.
Have a look at http://java.sun.com/docs/books/tutorial/native1.1/concepts/index.html
to see how...
Good luck! -
How to transform this pascal code into java code!
I want to transform this pascal code into java code . Please tel me how to do it because I really don't know how to do it!
Thanks!
{CALCULATE HOHN-LONDON FACTORS}
var kk:tab4;
PROCEDURE INTENS(var kk:tab4);
begin
for n:=0 to nr+2 do
begin
kk^[1,n]:=sqrt(lup*lup*yg*(yg-4)+4*sqr(n+1)) +lup*(yg-2);
kk^[2,n]:= sqrt(lup*lup*yg*(yg-4)+4*sqr(n+1))-lup*(yg-2);
kk^[3,n]:=0.5*(kk^[1,n]*kk^[1,n]+4*(sqr(n+1)-lup*lup));
kk^[4,n]:= 0.5*(kk^[2,n]*kk^[2,n]+4*(sqr(n+1)-lup*lup));
kk^[5,n]:= sqrt(ldown*ldown*yd*(yd-4)+4*sqr(n+1)) +ldown*(yd-2);
end;
end;
BEGIN
new (kk);
intens(kk);
writeln(f2,' ','N ','V','branch ','H-L');
for n:=1 to np do
begin
fp1[n,v]:=(n-ldown)*(n+ldown+1)*sqr(kk^[2,n-1]*kk^[6,n]+4*(n+ldown)*(n-ldown+1));
fp1[n,v]:=fp1[n,v]/(4*(n+0.5)*kk^[4,n-1]*kk^[8,n]) ;
writeln(f2,' ',n,' ',v,' fp1 ',fp1[n,v]:10:2);
end;
for n:=1 to nq do
begin
fq1[n,v]:=sqr(kk^[2,n]*kk^[6,n]*(ldown+0.5)+4*(n-ldown+1)*(n+ldown+1)*(ldown-0.5)) ;
fq1[n,v]:=fq1[n,v]/(2*(n+0.5)*kk^[4,n]*kk^[8,n]*(n+1.5));
fq1[n,v]:=fq1[n,v]*(n+1);
writeln(f2,' ',n,' ',v,' fq1 ',fq1[n,v]:10:2);
end;
for n:=1 to nr do
begin
fr1[n,v]:=sqr(kk^[2,n+1]*kk^[6,n]+4*(n-ldown+2)*(n+ldown+1));
fr1[n,v]:=fr1[n,v]/(4*kk^[4,n+1]*kk^[8,n]*(n+1.5));
fr1[n,v]:=fr1[n,v]*(n-ldown+1)*(n+ldown+2) ;
writeln(f2,' ',n,' ',v,' fr1 ',fr1[n,v]:10:2);
end;Basically it looks like this:
public class KK{
private your_type[][] kk = new your_type[length][length];
private void intens(your_type[] kk){
for(int n= 0; n<nr+2; n++){
kk[1][n] = Math.sqrt(lup*lup*yg*(yg-4)+4*Math.pow((n+1), 2)) +lup*(yg-2);
kk[2][n] = Math.sqrt(lup*lup*yg*(yg-4)+4*Math.pow((n+1), 2))-lup*(yg-2);
kk[3][n] = 0.5*(kk[1][n]*kk[1][n]+4*(Math.pow((n+1), 2)-lup*lup));
kk[4][n] = 0.5*(kk[2][n]*kk[2][n]+4*(Math.pow((n+1), 2)-lup*lup));
kk[5][n] = Math.sqrt(ldown*ldown*yd*(yd-4)+4*Math.pow((n+1), 2)) +ldown*(yd-2);
public static void main(String args[]){
KK k = new KK();
k.intens(kk);
System.out.println(f2 + ' ' + 'N ' + 'V' + 'branch ' + 'H-L');
for(int n=1; n < np; n++){
fp1[n][v] = (n-ldown)*(n+ldown+1)*Math.pow((kk[2][n-1]*kk[6][n]+4*(n+ldown)*(n-ldown+1)), 2);
fp1[n][v] = fp1[n][v]/(4*(n+0.5)*kk[4][n-1]*kk[8][n]) ;
System.out.println(f2 + ' ' + n + ' ' + v + ' fp1 ' + fp1[n][v]:10:2);
for(int n=1; n< nq;n++){
fq1[n][v] = Math.pow((kk[2][n]*kk[6][n]*(ldown+0.5)+4*(n-ldown+1)*(n+ldown+1)*(ldown-0.5)), 2);
fq1[n][v] = fq1[n][v]/(2*(n+0.5)*kk[4][n]*kk[8][n]*(n+1.5));
fq1[n][v] = fq1[n][v]*(n+1);
System.out.println(f2 + ' ' + n + ' ' + v + ' fq1 ' + fq1[n][v]:10:2);
for(int n=1; n < nr; n++){
fr1[n][v] = Math.pow((kk[2][n+1]*kk[6][n]+4*(n-ldown+2)*(n+ldown+1)), 2);
fr1[n][v] = fr1[n][v]/(4*kk[4][n+1]*kk[8][n]*(n+1.5));
fr1[n][v] = fr1[n][v]*(n-ldown+1)*(n+ldown+2) ;
System.out.println(f2 + ' ' + n + ' ' + v + ' fr1 ' + fr1[n][v]:10:2); //fr1[n][v]:10:2 --> Here you must use the BigDecimal class
}I'm not very sure because my pascal knowledge is extremely "dated".
What about the converter I told you about? -
How to convert Vb code into java?
Hi,
I want to know how to make conversion a visual basic source code into java. The conversion could be (1:1) scale.
Is there any compilers making the live easier (solving this problem) ?
Thank you all.
Abu_ramlaUse the JNI. VB doesent actually do anything on its own. Its just a series of calls on COM objects to performs all its work. You can call these same COM objects using the Java Native Interface or JNI. You wont have access to things designed in VB though like forms, you will have to redesign those.
This will take extensive knowledge of COM, VB, Java, and JNI. It will take you about 1 year to get up to speed. I would say to not do this. -
Hello all,
I'm new to this forum, so first I'll say Hello.
I'm a CS student taking my first Java class, and I'm trying to figure out how to view code for certain Java classes and methods; in particular, I want to view the actual code for the g.drawString, g.drawRect, g.setColor, ect... methods. Where do we go to view the actual code for these methods. I find it very frustratingto learn how to use these methods, and yet not to be able to see the actual code that executes them.Hello all,
I'm new to this forum, so first I'll say Hello.
I'm a CS student taking my first Java class, and I'm
trying to figure out how to view code for certain
Java classes and methods; in particular, I want to
view the actual code for the g.drawString,
g.drawRect, g.setColor, ect... methods. Where do we
go to view the actual code for these methods. I find
it very frustratingto learn how to use these methods,
and yet not to be able to see the actual code that
executes them.First thing you should know is that not all code is open-source. You are rarely going to get the source code with libraries and other such items.
Second, you can always read the JavaDocs provided on this site.
http://java.sun.com/reference/api/
API documentation is much more informative (often times) than reading the source code itself.
Third, the JDK ships with the source code. You can also get copies of the source code from java.net by enrolling in one of the programs and agreeing to the terms and conditions provided therein. -
How to incorporate the C/C++ code in Java?
Guys,
Does any one here knows about in incorporating the C/C++ code in java?
Or know about to call the C/C++ code in java?
Guys, please impart your knowledge to me...
Thanks,
MercyJNI is built right into the JVM - in fact some of the most fundamental of the library classes use it to get access to the operating system.
You package your C and C++ into a DLL (windows) or shared library (unix) to which you connect with a System.loadLibrary() call.
To create the hooks, you declare special methods native. Then you run the classes with native methods through the javah comand to generated C headers declaring the methods to which the java connecfs. -
How can I execute MSIL code using java?
Thanks for your reply. I did it in google and didn't find any useful think.
I just want to know is there any technique in java or already written product that can do that.
Any advice will be helpful. Thanks
Maybe you are looking for
-
EHP1 Upgarde Monitor screen resolution problem in a support message
Hi Experts, We have recently upgraded our Solution manager to EHP1, iam facing a screen resolution problem with 15 inch monitors. Our key users have 15 inch monitors to their system and when they try to reply a support message under transaction data-
-
How to reduce the width of Shuttle pane
Hi I have create da shuttle pane but it takes too much space on a page I want to reduce its width I have all ready reduced its hieght so , how can I redue its width from any way like either from personalization or from CO?
-
Hi Experts I am investigating a probelm related to some TX's e.g MB1B, MIGO. How do I know that what SAP notes have been applied to a SAP tranasction. Pls advise. e.g. I may have to apply a SAP note to a TX but before that I want to make sure that w
-
First time for me so here goes. I have a PC. I downloaded a [Genius] system to improve the drivers (messing about with something I did not understand ... blame my age, 61). Silence from then onwards. I removed the system and hoped the sound would ret
-
Partially corrupt iPhoto Library
I am using iPhoto 6.0.6 Recently, some of my older Rolls have had their photos seemingly disappear. They are actually moved under a folder ~iPhoto Library/Originals/2009/SomeNewRoll. This folder has 2400 photos in it, but the corresponding roll, Some