All u java gurus -please help me with my DAEMONS
I had already posted one query regarding the same but due to some unsatisfactory answers I am forced to ask the same question.
JUST TELL ME HOW TO WRITE DAEMONS IN JAVA- REST I WILL MANAGE
heres my problem:
I have to make a java program to backup and restore encrypted files over a network.
The daemon should :
1 . The daemon has to be able to send messages to all other comps in the network that a user on some machine wants to backup or restore a file.
2. It also needs to be able to find all the files backed up of others as well as my own files on my PC.
3. I will maintain files placed on each PC using hash tables for efficient searching.When this is done the daemon will figure out from a heap of free disk space how many comps are to be involved.I then use a TCPserver or TCPclient class to open connections to them and send or receive encrypted files.
4. Daemon will send messages across the network if any system change(disk space +/-) occurs.Can anyone give me some documentation and links on the same?
Yeah,one more thing how will that daemon calculate free disk space on my computer -any methods would be appeciated -This willl determine what computers to select for back up.
IF all the above doesnt make any sense just tell me how to write a daemon-I need the code for this.
Also how will ensure that my daemon will run at the same time a machine boots up.
help for any part will be appreciated
Check out the apache commons daemon library and associated stub program. http://jakarta.apache.org/commons/daemon/
AFAIK There's no quick way in the Java libraries of measuring free disk space. Best bet is to exec the appropriate command line utility and read the results programatically.
Similar Messages
-
URGENT!!! Java Gurus Please Help with adf issue!
PLEASE SEE MY LATEST POST BELOW TIMO'S RESPONSE. THE REQUIREMENT HAS CHANGED. THAT IS THE ISSUE I AM LOOKING A SOLUTION FOR.
Hello All,
We have a requirement where our adf/jsf app needs to pick an EXCEL file from the server where the application is deployed. The sequence is :
User comes to the page
Clicks on "Open EXCEL" button
EXCEL file located in the c:/ of the server opens up.
How can this be done? I do not see any coding needed because the EXCEL file is being opened as is (and after user views it he closes the file) and the data is not being transferred to the jspx page.
*We are totally flexible in how this is implemented - ie, using button, link , html etc etc. What ever works!!!!*
Thanks,
Edited by: user12054715 on Aug 17, 2010 8:54 PM
Edited by: user12054715 on Aug 18, 2010 4:11 PM
Edited by: user12054715 on Aug 18, 2010 4:13 PMHello Timo,
I am using 10.1.3g so your response is not going to help me.
However, I have another question that I have already posted on the Forum. Please help me...
Requirement:
*1. Java application should be able to write "Hello World" in the excel file, when the user opens it.*
I CAN DO THIS WITH THE FOLLOWING CODE:
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet("newSheet");
HSSFRow row = sheet.createRow(1);
row.createCell(1).setCellValue("HelloWorld!!!!!!!!!");
*2. A "Write To Excel" button on jsf page opens a dialog asking user to Save or Open the excel file. (user can save the file anywhere on his machine)*
I CAN DO THIS WITH THE FOLLOWING CODE:
In jsf:
<af:commandButton text="Download" action="#{myBackingBean.writeToExcel}" useWindow="true"/>
In backing bean:
public static void writeToExcel() throws IOException
String filename = "workbook.xls";
// //Setup the output
String contentType = "application/vnd.ms-excel";
FacesContext fc = FacesContext.getCurrentInstance();
HttpServletResponse response = (HttpServletResponse)fc.getExternalContext().getResponse();
response.setHeader("Content-disposition", "attachment; filename=" + filename);
response.setContentType(contentType);
PrintWriter out = response.getWriter();
BOTTLENECK: When the user opens the excel how do I show "HelloWorld!!!!!!!!!" ? -
i have to buid a screen saver with my companys logo on it which is a flash file any idea how i can do that
Thanks in advanceso you tell me how do i create it !! Iam familiar with java thats why i thought so please tell me how to craete
-
KM images retrieving in Applications ----Java gurus please help -- URGENT
Hi,
I am retrieving images from KM in the webdynpro application and then displaying Adobe Interactive Form with the help of the blog :
/people/bobu.georgeputheeckal/blog/2006/12/22/getting-an-image-from-km-documents-to-be-used-in-web-dynpro
But the images i could retreive are atmost 20kb , if the size of the image is more eg : 70kb , the image is not displaying . In the code of the blog :
//Reading the image file
BufferedInputStream bufIn =
new BufferedInputStream(resourceimg.getContent().getInputStream()); *
byte[] imagebyte = new byte[bufIn.available()];
bufIn.read(imagebyte);
Wile getting BufferedInputStream object from resource object ,,,,,,,if the size is say 70KB ,,,,it is giving problem .But if the size is less say 10KB it is ok .
Pls anyone provide me to overcome this problem and can get byte[] ,,, and can proceed further for larger images .
Thanks and Regards,
Srini
Edited by: srinivasa rao on Feb 20, 2008 6:39 PMSrinivas,
I think that's because the default filesize for BufferedInputStream class is 2048 bytes.
Change your code as follows and check if it resolves your issue:-
BufferedInputStream bufIn =
new BufferedInputStream(resourceimg.getContent().getInputStream(), Integer.MAX_VALUE);
byte[] imagebyte = new byte[bufIn.available()]; -
Please help me with the homework given to me by my teacher
hello,i am new in java programming please help me with the home work given to me by my teacher at school, help me to build an interface that can work with this code.i can build an interface but i dont just understand this code.
//references:
//http://forums.techguy.org/development/570048-need-write-java-program-convert.html
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.FileReader;
public class Translate
public static void main(String [] args) throws IOException
if (args.length != 2)
System.err.println("usage: Translate wordmapfile textfile");
System.exit(1);
try
HashMap words = ReadHashMapFromFile(args[0]);
System.out.println(ProcessFile(words, args[1]));
catch (Exception e)
e.printStackTrace();
// static helper methods
* Reads a file into a HashMap. The file should contain lines of the format
* "key\tvalue\n"
* @returns a hashmap of the given file
@SuppressWarnings("unchecked")
private static HashMap ReadHashMapFromFile(String filename) throws FileNotFoundException, IOException
BufferedReader in = null;
HashMap map = null;
try
in = new BufferedReader(new FileReader(filename));
String line;
map = new HashMap();
while ((line = in.readLine()) != null)
String[] fields = line.split("\\t", 2);
if (fields.length != 2) continue; //just ignore "invalid" lines
map.put(fields[0], fields[1]);
finally
if(in!=null) in.close(); //may throw IOException
return(map); //returning a reference to local variable is safe in java (unlike C/C++)
* Process the given file
* @returns String contains the whole file.
private static String ProcessFile(Map words, String filename) throws FileNotFoundException, IOException {
BufferedReader in = null;
StringBuffer out = null;
try {
in = new BufferedReader(new FileReader(filename));
out = new StringBuffer();
String line = null;
while( (line=in.readLine()) != null ) {
out.append(SearchAndReplaceWordsInText(words, line)+"\n");
} finally {
if(in!=null) in.close(); //may throw IOException
return out.toString();
* Replaces all occurrences in text of each key in words with it's value.
* @returns String
private static String SearchAndReplaceWordsInText(Map words, String text) {
Iterator it = words.keySet().iterator();
while( it.hasNext() ) {
String key = (String)it.next();
text = text.replaceAll("\\b"+key+"\\b", (String)words.get(key));
return text;
* @returns: s with the first letter capitalized
String capitalize(String s)
return s.substring(0,0).toUpperCase() + s.substring(1);
}... here's the head of my pirate_words_map.txt
hello ahoy
hi yo-ho-ho
pardon me avast
excuse me arrr
yes aye
my me
friend me bucko
sir matey
madam proud beauty
miss comely wench
stranger scurvy dog
officer foul blaggart
where whar
is be
are be
am be
the th'
you ye
your yer
tell be tellin'Heres your answer. Run it in on your pc.
public class Annoy
public static void main(String[] args)
System.out.println("I am a triple poster.");
System.out.println("I can not understand why I can not understand the help I have receved to date on the java forums.");
} -
Hi Gurus,
Please help me with the code.
Algorithm: This is for master data extraction. I need to append some records to I_T_DATA before the loop on I_T_DATA begins.
ZTAB is a custom defined table with key KEY. STAB is standard table with key KEY.
1. Create an internal table I_T_STAB similar to STAB.
2. Loop at I_T_DATA
Read record from ZTAB where KEY = I_T_DATA-KEY and { field1 <> I_T_DATA-field1 or field2 <> I_T_DATA-field2 <> field3 <> I_T_DATA-field3}
If success
Delete record from I_T_DATA.
Else
Continue loop.
Copy all records of STAB to I_T_STAB.
3. Delete records in I_T_STAB where I_T_STAB-KEY = ZTAB-KEY.
Now
4. Delete all records in I_T_DATA where I_T_DATA-KEY = I_T_STAB-KEY.
Now,
5. Append all the remaining records from step 3 in I_T_STAB to I_T_DATA.
Please help me with the code upto this part.
Now the actual code in exit starts.
Loop at I_T_DATA
Thanks,
Regards,
aarthi
[email protected]You might get a quick answer if you were to post in the ABAP forum.
Moderator, please move to ABAP forum. Thanks.
Regards,
Rich Heilman -
Please help me with these java puzzle ?
Dear all,
My friend send me typical java puzzle about java.util.ArrayList
which is getting messy. Please help me out. It's not a homework.
Please help me with these java puzzle ?
Dear all,
My friend send me typical java puzzle about java.util.ArrayList
which is getting messy. Please help me out. It's not a homework.
import java.util.*;
public class MyInt ______ ________ {
public static void main(String[] args) {
ArrayList<MyInt> list = new ArrayList<MyInt>();
list.add(new MyInt(2));
list.add(new MyInt(1));
Collections.sort(list);
System.out.println(list);
private int i;
public MyInt(int i) { this.i = i; }
public String toString() { return Integer.toString(i); }
________ int ___________ {
MyInt i2 = (MyInt)o;
return ________;
}Hints , fill the underlines with below :
implements
extends
Sortable
Object
Comparable
protected
public
i = i2.i
i
i2.i=i
compare(MyInt o, MyInt i2)
compare(Object o, Object i2)
sort(Object o) sort(MyInt o)
compareTo(MyInt o)
compareTo(Object o)Dear all,
My friend send me typical java puzzle aboutNotwithstanding your pathetic protestations typicial
of all your posts this is NOT a typical java "puzzle"
but is indeed a typical homework puzzle.
And it's damn easy if you spent 30 minutes with a
tutorial.
DO YOUR OWN HOMEWORK!
Hey i did it.
import java.util.*;
public class MyInt implements Comparable {
public static void main(String[] args) {
ArrayList<MyInt> list = new ArrayList<MyInt>();
list.add(new MyInt(2));
list.add(new MyInt(1));
Collections.sort(list);
System.out.println(list);
private int i;
public MyInt(int i) { this.i = i; }
public String toString() { return Integer.toString(i); }
public int compareTo(Object o){
MyInt i2 = (MyInt)o;
return i;
}E:\>javac MyInt.java
Note: MyInt.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
E:\>java MyInt
[1, 2] -
Since up dating my Firefox I can not play any games on Facebook they all run very slow, can someone please help me with a solution.It mainly seems to be with games.
RE: "P.S. I found it aggravating that I couldn't copy and paste text here, it wanted me to insert as a link or an image, how do you insert plain text?"
I take it you tried using the "right click" menu? That doesn't seem to work, as you noted, but, you should be able to paste text by pressing your CTRL key and while holding it down, press the "V" letter key.
CTRL + C = COPY
CTRL + X = CUT
CTRL + V = PASTE
HTH,
Ortho_Fan -
err = 3150 - this issue has started recently and continues to persist with all of my downloads - please help
Is it error 3150 or -3150 ? If -3150 then have you tried the troubleshooting for that error number on this page : http://support.apple.com/kb/TS3297 ?
"Error -3150"
This alert is often related to a lost connection to the iTunes Store.
If you encounter this alert and you have verified you have a connection to the Internet using Wi-Fi, please review AirPort and Bluetooth: Potential sources of wireless interference.
If the issue persists, and you're using iTunes for Windows, you may need to flush your DNS and remove pop-up or ad-blockers.
Finally, this can occur due to timeouts caused by security software. -
I have a red vertical line on the right side of my screen and it will not go away tried restarting my computer and that didn't help at all, please help me with this problem it is kind of annoying
If it's a thin 1 pixel wide vertical line it's highly likely it could be caused by a defective LCD.
One quick basic way to check is to note the position of the line. Then go to System Preferences, Displays, and lower the resolution. If ther line moves it's on the video and the logic board or video card if fitted is likely to be defective. If the line stays in the same position it's likely to be an LCD fault. Either way to have it repaired you'll need to visit an Apple store or AASP.
The worst offender for this problem is the Late 2006 17" iMac. FOC replacement of the LCD used to be covered by a quality program, but it's now ended.
Steve -
please help me with msi installer file for 11.6.8.* as this is our standard version which we use for all machines in our organization
arai-c wrote:
I have full version of this software but I am not able to install it silently because it always gives Google toolbar pop up which We dont required
arai-c wrote:
the problem is we dont have msi file for 10.6.*.* and hence I am not able to create package for it
I don't understand; two days ago you wrote that you have it, now you don't...?
If you don't have it, then why not deploy the current version 12.1.3.153 - I don't see the point of installing an old, unsecure software version. -
Hi therde I was wondering if you could please help me with my Iphone 4s as it has frozen so i am unable to swipe to either power off or perform any function at all.
RESET DEVICE
Hold down the Sleep/Wake button and the home button together until the apple logo appears (ignore the ON/OFF slider) then let both buttons go and wait for device to restart (no data will be lost). -
Please help me with simple program
Can someone please write a simple program for me that opens up a webpage in the center of the screen , with a set size, and then asks the user where they would like to click on the screen. Then once the person clicks it asks how many times they would like to click there, and then once they enter the # the program opens up the webpage (in the center at the same spot as before, with the same set size) and automatically clicks on the predesignated spot , and then closes all open internet windows, and keeps doing it for however many times the person chose. PLEASE HELP ME WITH THIS!!! If you could, please post the source code here. Thank you so much to whoever helps me!!!!!!!
If it's not to learn, then what is the purpose of
this project?well, if it's not HW and its not for learning java, then why the hell would anyone like to have a program that may open a webpage and then repeatedly click on predefined place...
let me see...
now if he had asked for program that fakes IP as well, then i would suggest that he tryes to generate unique clicks, but now... i'm not sure... maybe just voting in some polls or smthing... though, i would not create a program that clicks on the link or form element, but rather just reload url with given parameters for N times... -
Very Urgent Please Help Me with XML parsing(DOM parser)
Hi
Please help me with the following code.
I have an XML file
<catalog>
<book id="101">
<title>First Ex With ID 101</title>
<ID>500</ID>
<author>RAJU</author>
<price>39.95</price>
</book>
<book id="121">
<ID>501</ID>
<title>First Ex With ID 121</title>
<author>RAJU1</author>
<price>19.95</price>
</book>
</catalog>
By using DOM parser I have to retrive ID values .After getting this ID values i have to pass these values in someother method of someother class.What i suppose to do?Can anyone help me with this regards ,if possible plese write the code..
Regards
Raju GWell first up all create a parser class where u parse the document using DOm and get the id node and assigen it to a String sat str.
Now whatever processiong u want to do , u write in a separate class (say Process.java) in one method say doProcess(String str)
Now from parser class u just call the doProcess() method with passing str as a parameter.
eg.
Process p = new Process();
p.doProcess(str);
Hope this will help u.
....yogesh -
First of all, I live in Ho Chi Minh City, Vietnam. Sometimes, I use a VPN to search on the web here. I purchased Toy Story 3 on my MacBook Pro 2011 OS/X - Lion through iTunes. I initially had trouble downloading it which may be due to being on and off the VPN but after a while it finally downloaded and shows up in my iTunes library on my MacBook.
Under my Apple ID account (which is the only Apple ID account I have), I look under purchase history and it shows that I paid for Toy Story which is where I got my Order # from. But if you go to the iTunes Store then to the Quick Links then click on Purchased, under all my Movies, it does NOT show Toy Story 3 as one of my movies.
Now when I go to my iPad (3rd gen.), Toy Story 3 does not show up under purchased movies (all or not on my iPad). It does not show up on my Apple TV as well. If I want to have Toy Story 3 on my iPad or Apple TV, then it says I have to purchase it again.
I have searched for help via Apple support communities but so far none of their solutions have worked for me. I have tried logging off iTunes & App Store on iPad and also shutting down the iPad. I also made sure that under iTunes Preferences>Store that iTunes in the Clouds purchases is checked. Can someone please help me with this? Your consideration is greatly appreciated. Thanks.Thanks King_Penguin for taking time to read and reply.
I just purchased this movie on Thursday, May 15, so just a few days ago. I have never had any trouble whatsoever since I have been in Vietnam. I have downloaded several movies and even music and they have all synced to my respected Apple products except for this purchase.
Sorry, I don't quite understand what you mean by studios and different versions. Could you please explain?
I checked my purchased list in my purchase history under my account and there are no hidden items.
Maybe you are looking for
-
I'm using LR 3.4.1 and I have NiK plugins. I was opening a file up in Dfine 2.0 and while it was loading I pressed Cancel. Then I attempted to load another file, and received a warning message saying "Lightroom was unable to prepare the selected file
-
Execute webdynpro from abap program and return to the caller program
Guys, I have a question here. I know there is a way to call an abap webdynpro application from normal abap program by either using a class method, or use a function module WDY_EXECUTE_IN_PLACE by providing the webdynpro application or using CALL TRAN
-
No record found in the table while using condition for the new added field
Hi, I have added a new field in Z table. There is lots of record in the table. The field which I added have null records. When I am checking the record using the condition new field equal(EQ) to space or blank. This shows no record in the table, but
-
My Mac tells me my printer is "offline." How can I get it back online?
I have my HP deskjet printer on my home network via Airport Express. My main router is an Airport extreme. I attempted to print from my Macbook but got a message that my printer was "offline." I could print from my iMac. I attempted to fix the proble
-
Import video cropped in imovie
I am importing a video from a Canon Elura 70 camera. When I import into iMovie, the imported video looks like has been zoomed in / or cropped. What do I need to do to keep the same aspect of the video i am importing?