dantinkakkar 19 Junior Poster

You have not set the Java environment properly... Set the path variable!

dantinkakkar 19 Junior Poster

http://www.w3.org/MarkUp/html-spec/html-spec_13.html

If your symbols are not here, then what I recommend to you is that you change the encoding to UNICODE. That'll give you a fair bit of Turkish characters to use! :)

dantinkakkar 19 Junior Poster

You're looking for file input and output. The Java Tutorials would help you here.

This link is one of the best available, I guess:

http://docs.oracle.com/javase/tutorial/essential/io/

dantinkakkar 19 Junior Poster
background:url(../images/bodybg.jpg) repeat-x 0 0;
	background-color:#1a3c4b;
	/*height:3000px;*/

The background-color might be interfering with the image. Try removing it, and then view it on IE8. Just a suggestion because IE8 does god-knows-what to perfectly valid CSS...

dantinkakkar 19 Junior Poster

It is coming up on my IE9 and Firefox and even Chrome! Give me a little more time, and I'll add something to this reply.

dantinkakkar 19 Junior Poster

So basically you want to store the number in a separate PDF file after extracting it or what?

dantinkakkar 19 Junior Poster

Please edit your posts: wrap your code around the [code] tags for a little more clarity, then we'll see what we can do for you. :)

dantinkakkar 19 Junior Poster

What do you mean by linking an object to another? Like making one object a function of the other?

dantinkakkar 19 Junior Poster

Buggy? Versions of Internet Explorer any lesser than 9 are all the anti-CSS types. And no, z-index does not work on IE8.

dantinkakkar 19 Junior Poster
public static int compChoice ()
{
Random rand = new Random();
int i = 0;
i = rand.nextInt(2) + 1;
//I've changed the statement below. Change it in your original code
return i;
}

Look at the last line. The return statement had not been properly written. You must return a value.

You had forgotten to return a value here, too! (Below)

public static String choiceTree (int player, int comp)
       {
           String answer = " ";
           if (player == 1)
           {
               if (comp == 2)
               {
                   answer = "You lose.";
               }
               if (comp == 3)
               {
                   answer = "You win!";
               }
           }
           if (player == 2)
           {
               if (comp == 1)
               {
                   answer = "You win!";
               }
               if (comp == 3)
               {
                   answer = "You lose.";
               }
           }
           if (player == 3)
           {
               if (comp == 1)
               {
                   answer = "You lose.";
               }
               if (comp == 2)
               {
                   answer = "You win.";
               }
           }
           else
           {
               
           }
           //look at the line below... Add this to your original code
           return answer;
       }

P.S. I've corrected your code at both of the places! :)

dantinkakkar 19 Junior Poster

Yes, please do that. You may be going wrong during the printing part. If AccountRecord.ser is to be created while writing, as it seems from your code, you will have to define the file first, and then use the <newly_created_file's_object>.createFile() method and only then write to it. Hope this helps! :)

dantinkakkar 19 Junior Poster

Lol, to the asker: I agree completely with stultuske. You're better off coding sans an IDE, that will definitely help you learn the language better. But what you asked for - a .NET-based IDE WAS available, it's not available now, called Visual J++ (By Microsoft). It was their implementation of Java, but has been discontinued now. Just for a little history-related knowledge, see http://en.wikipedia.org/wiki/Visual_J%2B%2B

It's not available now, and as for the IDE-war peter, NETBEANS #1

DavidKroukamp commented: netbeans all the way!! +9
dantinkakkar 19 Junior Poster

See what James has posted, check the java tutorials.

dantinkakkar 19 Junior Poster

@James, I think he means "words" by saying tokens, because, as he said, he wants "this" from "i want this". So I guess he wants to extract the third word.

[EDIT: Almost forgot this; dude gedas use a loop and a variable, name it as, say word_count and initialize it to 0. Loop through your string and increase word_count by 1 for every space you encounter. After the second space, you'll be on the third word. Loop through and record the String till the next space, and print to the screen.]

Philippe.Lahaie commented: James way is more efficient, thats what split() does. -1
dantinkakkar 19 Junior Poster

Well, I'm sorry for that, but you sounded like a little rude to me. So I hit back at you. Apologies for any mistake made by me.

~s.o.s~ commented: No worries +17
dantinkakkar 19 Junior Poster

He wanted to find out the value of something raised to the power of something, and those something's were well within long range. And by the way, please be a little more polite. I am not challenging your post.

dantinkakkar 19 Junior Poster

thanks dear it worked, but isn't there any direct way for such a conversion??

It worked. -.-

dantinkakkar 19 Junior Poster

Window = size of browser window.

Use CSS to change the size of the page; you cannot change th size of the browser window, and why would you want to do that, by the way?

dantinkakkar 19 Junior Poster

Convert it to long first using Long.parseLong() and then convert the long to BigInteger using BigInteger.valueOf(long val) .

Cheers! :)

dantinkakkar 19 Junior Poster

You are welcome! :)

Since you're problem is solved, please mark the thread as solved so that it can be used to help others.

dantinkakkar 19 Junior Poster

You're going wrong there. Suppose your index.html file is located at the root /index.html and your about folder is located in the same folder /about , you will access it using /about/whatever.html .

I hope your problem is solved now.

dantinkakkar 19 Junior Poster

Be clear. Do you mean that you want the WINDOW size or the size of your webpage?

dantinkakkar 19 Junior Poster

Thank stul. :D

dantinkakkar 19 Junior Poster

@riahc, do the following:

switch e.getLocalizedMessage() with e.printStackTrace()
for a more complete error message, and convey the exact error message! :)

dantinkakkar 19 Junior Poster

Since it is working in a separate program, the only and obvious reason due to which the file is not getting erased is since the OutputStream is not closing properly. What I suggest is that you write a separate module for deleting the code and make it executable. Then, access the application with your code so that it deletes all of that in a separate process and the file is not in use any longer. Otherwise, put in a bit of work and find out what is not closing. I suspect that the problem lies where you're using pre-built libraries. Something is not closing the output stream.

dantinkakkar 19 Junior Poster

:\ lemme think

dantinkakkar 19 Junior Poster

There're two things that I'd like to ask, now that you've cleared that up:

1. Did you try deleting with a separate piece of code in a separate file, that is, instead of doing it in the same program?

2. The method zipFolder(), does it close up everything?

dantinkakkar 19 Junior Poster

Hey, chill riahc, don't turn it into a battlezone. Just post your code, and I'll help you out with it! :)

dantinkakkar 19 Junior Poster

*nowords*

Let's just try to solve his problem, and ignore the blabbity blap. That's what I tried to explain to him, that he might've left an output stream open; but he does need to provide the image-writing code for us to understand whatever his problem is: my point is, @riahc3 is not explaining his problem correctly.

dantinkakkar 19 Junior Poster

Can you tell me what Operating System are you using? Like, I'm asking because you're saving and deleting from the "root", if I'm interpreting what you said correctly. If it's Linux, we do have a problem on our hands here and I can understand the usage of forceDelete . I dunno why you would do that on win32 if you're saving to the root: taking the root as Local Disk C:

dantinkakkar 19 Junior Poster

The code to delete the files in a separate program?

dantinkakkar 19 Junior Poster

No, you don't close that. It's different. A little more code, please?

And before that, just try deleting the file with a separate piece of code after writing to it once. Like, try deleting it programmatically in a different program. If that doesn't work, give a little more code - the writing part.

dantinkakkar 19 Junior Poster

After generating the BMP file, did you close your Output Stream?

Not closing may be the cause.

dantinkakkar 19 Junior Poster

Have you tried placing another BMP file and then trying to delete it? There may be a problem with the specific BMP file. Just give it a try, and if it still doesn't get erased, re-post; and I'll see what I can do.

dantinkakkar 19 Junior Poster

You're welcome!
And do run the examples once; the code is not complicated at all, and best of luck with whatever you're making/trying to do! :)

dantinkakkar 19 Junior Poster

Well, I guess he's asking for your opinion rather than choices. It depends upon several factors; for instance if you're developing software that does not interact much with the hardware and stays at the software level [if you understand me]; you might find Java easy-to-learn and powerful too. If you're gonna go around interacting with the hardware, then I would recommend C. It is the lingua franca of programming.

dantinkakkar 19 Junior Poster

The correct answer is, as you say, 88. The problem - I have recognized it. It's not that we're doing anything wrong with the code. 895430243255237372246531, which is the value of 11^23, is too large a number even for long. :)

It is not computed properly by the compiler. The number is just too big.

dantinkakkar 19 Junior Poster

@weekendrockstar is right. You can use CSS to do that... It'll make it damn easier... If you don't want anything to move around then I suggest to you to use absolute positioning. Since your content is already inside a <div>, it ain't gonna get affected! :)

dantinkakkar 19 Junior Poster

Back to the topic you get 65 if you write the exponent code yourself, instead of using Math.pow(int,int). @adil_bashir, are you sure it's 11^23 and not 23^11? o.O

dantinkakkar 19 Junior Poster

(Am not editing since this is an explanation and you may miss out on it if I edit.)

The query

SELECT LAST(Emp_id) FROM empDetail

Will return the last value of Emp_id, or the last employees' number, say 100.
Now, I've taken it in a string as follows:

String res = rs.getString(1)

No loops 'coz the output will bein the form of a lone String only. Now, parse the integer out of it.

int hh = Integer.parseInt(res);
hh+=1;

Added it by one and now append it to the TBox.

txtEmpNo.setText(hh.toString());
dantinkakkar 19 Junior Poster

Wait. You got something wrong with your code there.

clearFields();
String sql = "SELECT LAST(Emp_ID) FROM empDetail";
openDatabase();
try{
ResultSet rs = stmt.executeQuery(sql);
String res = rs.getString(1);
int hh = Integer.parseInt(res);
hh+=1;
}
catch(SQLException e){}

I've modified line 2. Look at that first. Now, look at the rest. hh is your final result which you need.

dantinkakkar 19 Junior Poster

It's nothing. Just do me a favour, and mark this thread as solved! :)

dantinkakkar 19 Junior Poster

You'll have to play around with the SQL Query. This is the query you might need:

SELECT LAST(column_name) FROM table_name

Execute this, and the employee number of the last record will be returned as the output.

You are familiar with executing SQL queries, I hope? If you're not, the here's how you can go about:

QueryString = "SELECT * from user_master1";
  rs = statement.executeQuery(QueryString);
  while (rs.next()) {
  System.out.println(rs.getInt(1) + " " + rs.getString(2) + "  
                  " + rs.getString(3) + "  "+rs.getString(4)+"\n");

[EDIT: In your case, only one value will be returned, so I don't think you'll need the loop. :) ]

dantinkakkar 19 Junior Poster

No, that isn't a viable solution. @ForceStr you may want to consider using the SwingWorker thread, it's for this use!

http://java.sun.com/products/jfc/tsc/articles/threads/threads2.html

They've even added a Progress Bar example! :)

dantinkakkar 19 Junior Poster

When "New" is clicked, the question wants you to create a new employee entry. The employee number will be one higher than the existing number of employees present obviously. So what I suggest is that you get from the DB [unless you've already stored it somewhere] the employee no. of the last employee, add it by one, and set the value for the employee number textbox field. Just reply if you have a problem with writing the code and I'll help you out there, too! :)

dantinkakkar 19 Junior Poster

CSS is better anyday, since it is more flexible than tables. CSS has been designed to replace tables as a layout system and you can adjust your data more precisely and with lesser difficulty than you can do with tables. Imagine creating table cells of varying heights and widths all over a page in contrast to simply specifying it's location in terms of a few attributes. Hope you get my point! :)

dantinkakkar 19 Junior Poster

Yeah, he's right. Another version of my code got 65 as output. I guess that's what's dwindling your answer... :\

If you try writing a piece of code to find out the exponent of a number, and you try solving 11^23, you get 6839173302027254275.Then, if you try finding out it's remainder with 187, you get 65, which is wrong, I guess, as per you.

dantinkakkar 19 Junior Poster

Funnily...

public class test {
    public static void main(String[] args)
    {
        long hyz = (long) Math.pow(11.0, 23.0);
        hyz = hyz%187;
        System.out.println(hyz);
    }
}

Output = 161?

Also, I edited your code a bit and checked...

int c = 11;
    int d = 23;
    int n = 187;
    long dt;
    dt = (long)((Math.pow(c,d)));
    long rc = dt%n;
    System.out.println(rc);

I put the modulus n part in another line... and whoa! 161

So, you want this, right? (11^23)%187?

dantinkakkar 19 Junior Poster

also: depending on your IDE to 'auto-complete' your code is a crappy way of writing applications. better taking a few seconds longer, but knowing and understanding what you wrote when compared to knowing 'NetBeans(/Eclipse/...)' 'll solve the problem for me.

I only said that because I didn't remember the function name exactly :\

dantinkakkar 19 Junior Poster

Hey

I want to get the date and time with miliseconds in a format such as:

2012-02-09 12:41:52.982

or

2012-02-09 16:41:52.129

How can I do this in Java?

(If I can get a localized version of "Tuesday" as "Tues" as well even better but if not, I dont mind. Something stupid and unrequired.)

This?