|
1. Did you install SQL server on your machine if not Simple Guide[^] get the 120 day Enterprise from Microsoft.
2. If yes then check this Troubleshoot[^]
Good luck
|
|
|
|
|
If you are using SQL Server Express you should be aware that it is installed as a named instance and does not use TCP/IP by default. In other words, it does not listen on port 1433 unless you tell it to. You can use the SQL Express Configuration Manager to enable TCP/IP and tell it which port to listen on. The .NET SQL Client does not connection via TCP/IP which is why you can open this in Visual Studio.
|
|
|
|
|
Hi Member !
I think you have sometime played this game http://brianx.com/downloads/fdd.exe[^]
This game help us to draw many things to the desktop.
I've got some question:
1.We always use JFrame,JWindow,JPanel,... to load image, draw graphics object(circle,bar,line,...) and our application always accompanied the Parent Component(JFrame,JWindow,JPanel,...).
So if we want to draw graphic objects(cicle,bar,line,...) on the desktop without JFrame,JWindow,JPanel,...using Java.
Can we do it and how to do.
If can, please give me some example java code.
Thanks and regards
sharkbc
|
|
|
|
|
|
Hi !
I can do alot of thing with java2d but my problem that how can i draw these graphic objects to the desktop.
You show me 2 step:
1.get the desktop screenshot-->How to do it--> with link you provide?
2.use java2d for the animation. Yes, i can do alot of thing with java2d.
The example i need that draw circle or rect,... to the desktop not to any JComponent or draw these graphics objects to the JComponent but when the program running i need see only the graphics objects(as the same the game i gave you the link before).
If you understand me, please help?
Sorry because my(not very good) English.
Thanks and regards !
|
|
|
|
|
Hi all!
I can do the same action with the game i gave you before.
with 2step that Member gave us:
1.capture the desktop the screen shot.
2.put this picture to the background of the container.
3.Draw animation.
But when the game running, we can't impact to any thing on the desktop.
I need another solution that we can impact to icon on the desktop.
Can anybody help me.?
Regards !
|
|
|
|
|
I dont think that it is possible, because even the game does what I told you about but the trick here is to use the toolkit method in java and set the size of the frame to the size of the screen.
|
|
|
|
|
I think we can.
Because the fullscreen may be created by alot of subscreen.
With the way we told, ofcourse it is not posible.
But we can do this by another way.
We do not set fullscreen for my game, So the game may be created by alot of screen(use one screen for an animation)
The transparency solution help us to do this(JKD 6.U10)
Regards !
modified on Friday, September 25, 2009 10:13 PM
|
|
|
|
|
I just installed netbeans etc and have been playing with all the mobile components and testing it on my phone etc.
Im coming from a c# background so my website runs off .net asmx webservices.
Firstly, can J2ME apps natively connect to these?
Secondly, if they cant and I need some extra API or something, what phones will it run on?
And lastly, either way, could you guys give me some links on where to start
Shot!
Strive to be humble enough to take advice, and confident enough to do something about it.
|
|
|
|
|
|
Exercise 1
Write a program Backwards.java that reads a line of text from the keyboard and then prints it in reverse order on the screen. An execution might look like this:
Type a line of text: Hello! My name is Jonas Lundberg.
Backwards: .grebdnuL sanoJ si eman yM !olleH
Exercise 2
Write a program LargestK.java that for an arbitrary positive integer N (read from the keyboard) computes the largest K such that 0+2+4+6+8+...+K < N.
Exercise 3
Write a program CountDigits.java that for an arbitrary positive integer N (read from the keyboard) prints the number of zeros, odd digits, and even digits. An execution might look like this:
Provide a positive integer: 6789500
Zeros: 2
Odd: 3
Even: 2
Notice, we treat zero as neither odd nor even.
Exercise 4
Write a program HighLow.java that implements the simple guessing game High and Low. The program selects a random number between 1 and 100. The player than tries to guess its value. After each, the program gives a hint, "higher" or "lower". An execution might look like this:
Guess 1: 67
Hint: higher
Guess 2: 82
Hint: lower
Guess 3: 77
Correct after only 3 guesses - Brilliant!
The program is terminated after 10 guesses with a suitable comment.
Exercise 5
Write a program Diamond.java that for an arbitrary positive and odd integer (read from the keyboard) prints is "diamond". An execution might look like this:
Provide an odd integer: 7
*
***
*****
*******
*****
***
*
Notice, the integer N determines the thickness of the "diamond" over its waist. The program should terminate with an appropriate error message if the provided integer isn't odd.
Exercise 6
Write a program CountChars.java that counts different types of characters in a text that is read from a file. The program should count how many characters found in the following categories:
Upper case letters
Lower case letters
"Whitespace" (i.e., space, tab, and return)
Other characters.
The search path to the text file you are reading can be coded directly into the program. (We will test your program using our own text file.) Here is an example of a text file. It is an american article about the spanish golfer Sergio Garcia taken from the golf magazine Golf Digest. However, we recommend that you start with something smaller.
After lecture Java 2
Exercise 7
Write a class Arrays.java with the following static methods.
Method int sum(int[] arr) that adds all elements in the array arr and returns the sum.
Method String toString(int[] arr) that returns a string which, if printed, provides a nice looking print out of the array content. Used as:
int n = {3,4,5,6,7};
String str = Arrays.toString(n);
System.out.println("n = " + str);
Method int[] addN(int[] arr, int n) that creates, and returns, a new array where we have added the number n to alla elements in the array arr. The array arr should be left unchanged.
Method int[] reverse(int[] arr) that creates, and returns, a new array with all the elements in array arr but in reverse order. The array arr should be left unchanged.
Method boolean hasN(int[] arr, int n) that returns true if the array arr contains the element n, otherwise false.
Method void replaceAll(int[] arr, int old, int nw) that replaces all occurences of the elemnt old with nw in arr.
Method int[] sort(int[] arr) that returns a new sorted array (least element first) with the same set of elements as in arr. The array arr should be left unchanged.
Method boolean hasSubsequence(int[] arr, int[] sub) that returns true if the subsequence sub is a part of the array arr, otherwise false. For example, in the case hasSubsequence({1,2,3,4,5}, {3,4,5}) the result is true since {3,4,5} is the final part of {1,2,3,4,5}.
Write also a program ArraysMain.java that demonstrates how all these methods work.
Exercise 8
Create a program Histogram.java that reads any number of integers from a file and then prints a simple histogram bar-chart for all integers between 1 and 100. Note: not all integers in the file need to be in the interval [1-100]. An example of an execution:
Reading integers from the file: C:\Temp\integers.dat
Number of integers in the interval [1,100]: 46
Others: 16
Histogram
1 - 10 | ******
11 - 20 | ****
21 - 30 | **
31 - 40 | ***
41 - 50 | *******
51 - 60 | ****
61 - 70 | ***
71 - 80 | *********
81 - 90 | *****
91 - 100 | ***
All exceptions that might be raised during an execution should be handled within the program.
Exercise 9
Write a program (CountJava.java) that prints a numbered list of all Java files (.java) in a given directory (and all its sub-directories). The program should also print the number of lines in each Java file. A program run may look like
Root director: C:\teaching\da1021\
1 Hello.java lines = 14
2 InOut.java lines = 19
3 Formatting.java lines = 22
4 .....
All exceptions that might be raised during an execution should be handled within the program.
Exercise 10
Create a class Pnr.java, representing a Swedish personal identity number on the form YYMMDD-NNNN. Information about the structure of Swedish personal identity numbers can be found at Wikipedia (Personal identity number (Sweden)). The class should contain the following members:
A constructor, creating and initializing an identity number.
Methods getFirstPart and getSecondPart, returning the first part (YYMMDD) and second part (NNNN) of the identity number, respectively.
isCorrect returning true if the number is a correct Swedish personal identity number.
isFemaleNumber, isMaleNumber returning true if the identity number corresponds to a male or female, respectively.
isEqualTo comparing two Pnr instances, checking if they correspond to the same identity number.
toString returning a string representation of the identity number.
Feel free to add more methods, if you think anything is missing. Suitable types for arguments and return values are up to you to decide.
Exercise 11
Write a class Deck that represents an ordinary deck of cards with 52 different cards. Each card has a color (4 possible) and a value (13 possible). The Deck class should have methods for shuffeling the deck, hand out a single card, and count number of remaining cards. Notice, it should only be possible to shuffle the deck when it has 52 cards.
Writa also a test program DeckMain that creates a Deck, hands out a few cards, and displays what cards that was handed out, and the number of cards remaining in the deck.
Exercise 12
News papers are exchanging news using news agencies (e.g., Reuter). A news paper register themself at a news agency and sends their news to that agency. The news agency receives news and sends them to all registred news papers.
Create classes that simulates this scenario.
|
|
|
|
|
If you are expecting someone to do this work for you, you are likely to have a very long wait!
|
|
|
|
|
1. get the string from the input using scanner then use a for loop with the starting index being the string length and the end being zero then print out using the string.charat(index)
2. get input make sure positive (>=0) with if statement, declare an int called sum = 0, use a for loop from zero to N, in the for loop you have an if statement that says if((i*2)+sum)> N print out sum else sum = sum +(i*2)
3. get input make sure positive (>=0) with if statement. You need 3 counters and 2 if statements, first if, if int is zero zero count++, second if, if (input%2==0) evencount++ else oddcount++
4. generate random number from Math.random() method, a for loop from 0 to < 10 and 3 if statements for lower and higher now for the correct answer the output will include the i from the for loop kinda like "you guesed it in" + i + "times" if he guessed right then break; and a last if statement if i == 10; you could also use switch case as you like.
5. get input from user, then an if statement to determine odd by %2 != 0 , then use a for loop from 1 to >= 7 then use input%2 != 0 println("*") then use a reverse for loop from input-1 to <= 1 same input%2 != 0 println("*")
6. scanner for the file, and 4 counters, while (scanner.hasNext()) if (scanner.next(). "here do what they are asking") counter++ then print out the counters
7. This question answers its self its basic class and method concepts just follow what the description says
8. scanner for the file, two counters, two if statements, the first if is to determine number is greater or smaller than 100 if so do the appropriate++ to the counters, now for the first if it is less than 100 do the respective if statements and for each if you do here do a counter++ for the appropriate category ex if a number is between 1 and 10 counter++ for the category 1 and 100 then after all that is done do a simple method that takes int n which is the number of stars as parameter and returns a string of stars of that number then for every respective category do a println ex System.out.println("1 - 10 "+ getStars(onetotencounter));
9. you here need a file that points to your directory then use the file.getdirectories method to get the items listed store them in a string array, declare a counter = 0, then use a for loop from 0 to array.length then use a scanner and a while(scanner.hasnext()) scanner.nextline() counter++ then once all that is done print the result and set counter back to zero
10. First get the format of string then create the class and methods mentioned then use basic boolean,get and set methods, and string concat,substring,charat manipulations as needed
11. final count = 52 this is a constraint on the shuffle method the rest you can use a list (contain two parameters) and a random generator to get the solution do not forget to have a counter which shows the number of cards remaining and another list to show the cards given out
12. classical OO example just look for the verbs and create the classes and methods
|
|
|
|
|
can anyone show me how to do a system which input the participants registration, lucky draw generator and their report?
1. PARTICIPATION REGISTRATION
(ID, Full name, telephone number, email address, lucky draw number)
2.display the winning number and winning name.
3.display the overall list of winners, their details and their lucky numbers
please help me.. im new to java programming
|
|
|
|
|
syarizan wrote: please help me.. im new to java programming
Buy a book, study, learn, work hard.
|
|
|
|
|
You need two things:
1. JSP/Servlet knowledge.
2. SQL Programming basics
1. Create your PR jsp page which contain a form with method post and action to a servlet that will handle the insertion of the data to a database table i would add winners table containing ID, Frkey, thenumber
2. A servlet that will generate the number and cross check with those who guessed right and update the winners table with that data.
3. A servlet that will do an inner join with the pr and winners tables to display the results.
Good luck
|
|
|
|
|
I'm having problems implementing all of my functions in the LinearFunction.java to my Main.java program file. I was able to implement getValue but not any of the rest of my function. What am I doing wrong?
<code>package Function;
public interface Function {
public static double EPSILON = 0.000000001;
public double getValue( double inValue );
}
package Function;<br />
<br />
<br />
public interface Function {<br />
<br />
public static double EPSILON = 0.000000001;
<br />
public double getValue( double inValue );<br />
<br />
}
<code>
package Function;
public class Main {
public Main() {
}
public static void main(String[] args) {
Function f = new LinearFunction();
Function g = new LinearFunction(2);
Function h = new LinearFunction(3, 6);
f.getYIntercept(1.0);
System.out.println("Y intercept="+f.getSlope());
System.out.println("Slope="+f.setSlope());
f.setSlope(2.0);
for (int i = 0 ; i<10; i++ ){
System.out.print("f(" +i+ ")="+f.getValue(i)+ " ");
System.out.print("g(" +i+ ")="+g.getValue(i)+ " ");
System.out.println("h(" +i+ ")="+h.getValue(i)+ " ");
}
System.out.println();
}
}
|
|
|
|
|
I have no idea what you are talking about. The code you have posted does not really shed much light on your question. A bit more information would help us to answer you.
What problems are you having? When you say that you are "not able" to implement a function what does that mean? Do you mean that you do not know how to code this, or that it does not compile, or that it does not work when you try to run it? When you use the word "function" do you mean method, or are you referring to the interface which you have named Function?
|
|
|
|
|
wkid87 wrote: Function f = new LinearFunction();
I don't see a definition for LinearFunction() anywhere.
|
|
|
|
|
Sorry, I'm double post the Function.java code Below is my Linear Function.java.
<br />
<br />
<br />
package Function;<br />
<br />
<br />
public class LinearFunction implements Function{<br />
private double slope = 1.0;<br />
private double yIntercept = 0.0;<br />
<br />
public double getSlope(){<br />
return slope;<br />
}<br />
<br />
public void setSlope(double s){<br />
slope = s;<br />
}<br />
<br />
public double getYIntercept(){<br />
return yIntercept;<br />
}<br />
<br />
public void setYIntercept(double y){<br />
yIntercept = y;<br />
}<br />
public double getValue(double inValue){<br />
return slope+inValue+yIntercept;<br />
}<br />
<br />
}<br />
<br />
I will like for all the methods that are in the LinearFunction.java to load in Main.java. The only methods that is loading up correctly is get.Value. There is an error in my Main.java file using setSlop and getSlope. I'm new to Java and I hope this information help.
|
|
|
|
|
wkid87 wrote: There is an error in my Main.java file using setSlop and getSlope
Well, you need to tell us what the error is; we cannot guess!
|
|
|
|
|
In your Main class you have declared f, g and h as being of type Function. So, although the actual type that you create at runtime is LinearFunction, you can only access the method which is defined on the Function interface (getValue) because that is all the compiler knows about for f, g and h.
If you want to access the methods on LinearFunction which are not on the Function interface, you will need to either declare the variables as being of type LinearFunction, or cast them to LinearFunction so that the compiler knows what it is dealing with at this point:
((LinearFunction) f).getSlope()
You probably want to read up a bit about interfaces in Java and how they work and how to use them. Or, if this is a homework question, ask your tutor to explain it.
|
|
|
|
|
This is the error I'm getting:
C:\Users\John\Documents\NetBeansProjects\Lab 2\src\Function\Main.java:36: cannot find symbol
symbol : method getYIntercept(double)
location: interface Function.Function
f.getYIntercept(1.0);
1 error
But I was able to find getValue without any problems.
modified on Wednesday, September 23, 2009 11:54 PM
|
|
|
|
|
As I said, you have declared f as being of type Function. There is no getYIntercept method on the Function interface, so the compile fails. There is a getValue method on the interface, so that is OK.
You need to read up about interfaces.
There are some other problems with your code, as noted by the other poster.
|
|
|
|
|
1. f,g, and h define them as LinearFunction (as mentioned by David) this will solve the problem of accessing the methods from LinearFuction.
2. In Linear Function you need to create constructors 3 to be specific (one empty,one with one double variable, and one with two double variables). Do note that constructors have same name as class.
3. In f.getYIntercept() you cant set a value in a get method unless you specify it in the class plus thats wrong only set methods should have parameters.
4. In f.setSlope() you cant use it because it does not have a return value to be printed. In addition you are not giving the slope any value to be set. This is in the System.out.println();
Good Luck
|
|
|
|
|