Win a copy of React Cookbook: Recipes for Mastering the React Framework this week in the HTML Pages with CSS and JavaScript forum!

twity Panu

Greenhorn
+ Follow
since Jan 31, 2007
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by twity Panu

I have called this method for printing a .txt file.
I am creating a .txt file and then giving it to print.
By defaut the page orientation is portrait,but i want it in landscape.
so i had set the orientation.
but still i am getting it in portrait.what should i do?
need suggestion as early as possible...
below is mine part of code..

public void print(ArrayList arr) throws OMSApplicationException{
CustomerVO customerVO = null;
InputStream is = null;
try{
for(int i=0 ; i<arr.size();i++)
{
customerVO = (CustomerVO) arr.get(i);
File file = new File("D:\\PinGeneration.txt");
boolean success = file.createNewFile();
if (success) {
System.out.println("new file");
createFile1(customerVO);// if file is not there
} else// if file already there
{
boolean success1 = new File("D:\\PinGeneration.txt").delete();
if (!success1) {
System.out.println("file deletion problem!!!");
} else {
System.out.println("file alredy exit!!!");
createFile1(customerVO);// again create the file
}
}
is = new BufferedInputStream(new FileInputStream("D:\\PinGeneration.txt"));
System.out.println("Value of textStream : " + is);
DocFlavor myFormat = DocFlavor.INPUT_STREAM.AUTOSENSE; // Create a Doc
Doc myDoc = new SimpleDoc(is, myFormat, null));
PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
aset.add(OrientationRequested.LANDSCAPE);
aset.add(new Copies(1));
aset.add(Sides.ONE_SIDED);
System.out.println("Value of textStream : ");
AttributeSet aset1 = new HashAttributeSet();
aset1.add(new PrinterName("Kyocera Mita FS-9500DN KX", null));
aset1.add(SUPPORTED);
PrintService[] services = PrintServiceLookup.lookupPrintServices(null, aset1);
if (services.length > 0) {
DocPrintJob job = services[0].createPrintJob();
try {
System.out.println(services[0]);
job.print(myDoc, aset);
} catch (PrintException pe) {
pe.printStackTrace();
}
}
}}catch(Exception e){}}


Thanks
14 years ago
I want to delete data of the file and rewrite it.
is it possible in java.
14 years ago
String[] cmd = new String[4];
cmd[0]= "cmd.exe";
cmd[1] = "/C";
cmd[2] = "D:";
cmd[3] = "dir";
Process process = Runtime.getRuntime().exec(cmd);
BufferedReader stdInput = new BufferedReader(new InputStreamReader(process.getInputStream()));
String s = "";
while (( s = stdInput.readLine()) != null) {
System.out.println(s);
}

Actully my default when i type cmd in command center it id pointing to c:\\DocumentsAndSetting\\paul
but i want change it to d:\\
in command prompt if i type d:
it changes,
but not able to do it using getRuntime().exec()

pls provide some help
14 years ago
Can i get some suggestion of how to upload a file in server using ftp.......
in java.....
pls reply
14 years ago
URL url = new URL("ftp://admin:administrator@10.20.30.9");
URLConnection urlc = url.openConnection();
InputStreamReader isr = new InputStreamReader(urlc.getInputStream());
Process process = Runtime.getRuntime().exec(urlc + "cd SABB_APP dir");
BufferedReader input = new BufferedReader(isr);
String s;
while ((s = input.readLine()) != null)
{
System.out.println(s);
}input.close();
I have done this thing for connection,but i want to execute mput and mget commands from java..I thought to use Runtime.getRuntime.exec()
but was not able to do.....
plaese help me out.....
i have an urgency......
14 years ago
please help,i want some perfect solution..................
I mainly want to upload a file from my local machine to server..
using ftp mput.
14 years ago
URL url = new URL("ftp://admin:administrator@10.20.30.9");
URLConnection urlc = url.openConnection();
InputStreamReader isr = new InputStreamReader(urlc.getInputStream());
Process process = Runtime.getRuntime().exec(urlc + "cd SABB_APP dir");
BufferedReader input = new BufferedReader(isr);
String s;
while ((s = input.readLine()) != null)
{
System.out.println(s);
}input.close();
I have done this thing for connection,but i want to execute mput and mget commands from java..I thought to use Runtime.getRuntime.exec()
but was not able to do.....
plaese help me out.....
i have an urgency......
14 years ago