You might have a better idea if you look at the Java Primitive Data Types and what data they are able to hold.
https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html
You might have a better idea if you look at the Java Primitive Data Types and what data they are able to hold.
https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html
Ok. You need to think about this logically.
You must first read the users input.
Then split the string of numbers into individul digits - which are then stored in some sort of collection.
You then need to iterate through the collection and print out each element.
We don't get the grades for writing the code for you! But use those instructions as a guide for your research and learning.
I know this is going to sound basic, but add some breakpoints into areas where the operations are being performed. Then debug the code and add watches to the data variables.
By watching each variable, you will be able to narrow down where the problem is, and then post a more concise and directed query.
At the moment, you have posted too much code for people to engage.
The editor was just an example. For instance I may have written a program that I want to call without using the entire pathname and insteaad just want to call it 'move' or 'john'. What I am asking is how do I get linux to understand that 'John' means execute a program at location x.
Thank you
Hey,
Basically I want to be able to type something like 'editor &' and have an editor of my choice open. Similar to if you type 'emacs &' emacs opens. I was wondering where this information is kept and how to edit it for the desired results.
Thank you
The blueprints aren't instantiated because a blueprint is a design for a building not the building itself.
Just in case this analogy has gone too far;
Java attempts to mimic the real world using objects e.g. Cars
A class is a description of a car. Is defines everything about it.
When you 'instantiate' (create) this Car object, you use the class to determine what the car looks like, how it behaves etc.
Inheritance is used when you have a group of things that share some common attributes e.g. wheels, doors, engine etc.
Quick note, these values do not have to be the same for every car, they simply have to be present. SO a car can have 4 wheels or 6 wheels, as long as it has wheels
The key to inheritance is there are lots of cars, but there are also different TYPES of car e.g. sports car, 4x4, pickup. Each of these cars has certain attributes that other cars don't have e.g. a 4x4 may have heavy duty tyres.
Inheritance allows us to treat every Car as a Car whilst still maintaining the different types of Car.
Simplest way to explain is: A Parent class has a series of common attributes and methods found in every Child class. Each Child class has access to these attributes and methods, but also has some custom methods of its own that no-one else knows about.
Hope this helps
Just to add to the discussion, I believe it is possible to speed up your pc using a USB and ReadyBoost. I have very little knowledge about this however so it may not be possible. Have a go though, right click on your USB in 'My Computer' and select Properties. Go to the ReadyBoost tab and follow the instructions and see if this helps at all.
If not then you will need to try something else I'm afraid.
I agree with JamesCherrill, the best way to further your knowledge is to think of a project. Then, go and create it. First try will be shit (pardon my french), but as you continue to develop applications, you pick up the different techniques required.
One thing I would say is try not to get bogged down in various technologies such as XML, it's a very basic technology. In terms of complexity, Java is far more complex than XML and things like C++ are more complex than Java.
If you do want to know about XML, use w3Schools, it's a great free resource. Also for learning how to incorporate it to Java, have a look at the Java Documentation.
Also on a side note, don't listen to stultuske, his attitude is unproductive. People lime JamesCherrill are far better as their goal is to guide you through to process of learning, rather than making themselves feel big.
Hope this advice helps, if you need anything don't hesitate to contact me.
I am currently creating a MySQL back-end database system and have come across a problem. Whilst building my ERD, I have noticed that one table requires 3 Foreign Keys. Is this acceptable database design?
Thanks for all your help
Read this an figured I should add something. DO NOT FOLLOW DEEPMODI's advice!!! Microsoft never take kindly to people downloading their software from anyone except themselves. People have tried and failed repeatedly. So as a reminder, Microsoft Website Only!
The last thing you want is to be in a legal battle with Microsoft, they have immense power and they often win.
Hope you take this advice.
I think I know what you mean. I believe you are asking about the different elements that form an expression. I think for this I shall just list them for you.
It is probably going to be beneficial to have a read online about each of these to fully understand them. This is key to programming so make sure you understand it!
Hope this helps
Another useful resource is the Kolling and Barnes book which is used in many Java courses. It uses it's own development environment which is designed for teaching java to beginners and the book will take you to an average level of Java programming. If you are interested, the book is linked here. It may seem expensive but it's a worthwhile investment.
Hope this helps
I believe that you are in my CS class at Hertfordshire judging by this post. Your answer is clearly laid out in the practical 9 pdf on the hompages site. Look under heading "UselessHTTPServer05".
You said your new to Java. If thats the case then I would definately recommend not starting out with such an ambitious project.
Just to kind of echo what JamesCherrill has said, it is impossible to access a machine without an IP address. The entire point of an IP is address is to provide a reference to a machine across a network. It is literally impossible to find a machine without it's ip.
Have a read around how networks work before attempting this if I were you
It would be interesting to see more of a following for the Hardware/Software area of the forum. Obviously it would increase the knowledge base that would become available to the users of Daniweb.
I think the reason there has been a demise, is the movement in education away from Hardware especially. Whilst most people have access to a computer of some kind, very few understand how it works and even less care.
There are however, changes occuring that may change this. For instance, here in England, the government is starting to introduce Computer Science topics into Secondary Education (ages 11-18). This is a great improvement, as it enables so many more people to engage with computer science, a subject which has been restricted to University level courses.
What you've done is great, you have literally missed one tiny detail.
The replace method in String returns a new String object. Currently you are calling the method but not putting the result anywhere. So when you return the variable 'string', you return what you gave it.
Try using string = string.replace(ch,'1');
instead. This means you are then assigning the result of replacing the capital letters to your string variable.
Good Work. Well done
In future, if you get stuck, have a look at the java Documentation online. Google something like 'Java String doc' and it will come up. It's really useful
Google displays results based on two main qualities.
First is, it looks at what pages link to your page, it examines the importance of all these sites. It then looks at all the sites that link to those sites and examines the importance of those sites. Bigger, more influencial sites have a higher importance which instantly raises the importance of your site.
Another thing it looks at is the occurance of keywords and their proximity within your page. So if the query is "Hello World" and your site contains "Hello" and position 1 and "World at position 387, you will have a low rank for the query. However, if you have "Hello" and position 1 and "World" at position 2, then you have a high rank as the words fit the query very well.
There are also other things to consider such as when the document was last modified as new content is better for users than a page that has been left dormant for the last 8 years.
On the whole I'd say that you need to think about when you want your page to turn up by listing the queries that you want to return your page, then make sure that the content on your page includes the keywords.
Posting on many sites will not get your rank up, especially if they are things like blogs and forums as this isn't reliable influencial sources. You need relevant, big sites to find your site and provide links to it …
That is truely amazing. Not that he can write code, because realistically, anyone can do that given the time and resources...but that someone was willing to give him a chance, that's inspirational.
Thank you for sharing this
I think the biggest barrier to overcome here is that you are not fully understanding the role of an Object in programming. I wrote a small article on my new blog a few days ago about this. It's shameless I know, but have a little look, it may help.
If that doesn't help then go and buy the Objects First with BlueJ book. It's written by the professors who created BlueJ. It's a really good guide from basics all the way up to moderately complex code. Worth the money!!
Hope this advice helps
AhmadHasanSahi, This information is widely available on the internet as these are very common sort operations. I suggest you take a litle bit of time to research rather than asking for others to write your code for you.
This is a free help forum, not a development centre. There are many people on the internet who would happily write your code for a fee, but this is not one of those places.
Please take this into consideration in future.
I love James Cherrill's idea of using a html file to output. Then the file could be opened ina browser to display the formatting. Never even thought of that. Thank you!!
ok so your going to need a loop surrounding your statements so that 3 items can be selected
private String[] mainArray = new String[10];
private String[] threeStrings = new String[3];
public void getThreeRandomStrings()
{
Random rand = new Random();
for(int i = 0; i < 3; i++)
{
threeStrings[i] = mainArray[rand.nextInt(10)];
}
}
This example does not take into consideration the fact that the Random object may produce the same integer twice which would lead to a String in mainArray being selected twice in a single allocation. This wouldn't cause an error, however it may mess with any further operations you wish to execute.
Hope this was helpful
If not you can DM me for further assistance or reply to this thread.
Good Luck
Ok, Imagine an actual physical book.
This is what you are trying to describe in your class. Whenever we program in Object Oriented Programming 'OOP', we try to Describe and Model real world Objects.
So let's start,
All books have an Author, a Title, Pages, Reference Numbers and Identity Numbers.
These are the properties of a Book, we put these in the fields of the class. The Fields are the variables placed at the top of the class e.g private int pages
Next we have Methods. These are ways of manipulating the Book object.
There are two types of Methods, Accessors and Mutators. Accessors GET information and therefire have a Return statement. Mutators change/mutate the data.
The idea behind OOP is to be able to write the description of something once and implement it many times. So we have written a Book class, and now we can use it to make 1000 books or more if we please.
Hopefully this has clued you up more on the aim of a Class.
There are things here that you cannot do, e.g. add a Book to a Book, you need to have another class that maintains a Collection of Books (e.g a Library)
I think this is all the information I can give due to the nature of the forum where I cannot help you first hand. If you still have problems with coding, I'd recommend getting the 'Objects First with Java' book written by Kolling and Barnes. These are the people …
Ms.toumi, thsi forum is not designed for people to do your work for you. If you need help, then show us something you have already done, little bits of code that you have started to develop towards your solution.
Do not just ask for help and give a description of your problem. You cannot learn without trying and failing to do things.
There are so many people who are willing to help, but you need to make some effort yourself.
Show us what you have and we will help.
Ok so I'm writing a program that outputs text to a file.
Currently, I am writing it to a .TXT file for ease and convenience. Ideally, I would like to output some of the information so that it is formatted with Italics. I'm thinking that using a RTF file would be simplest but i'm not entirely sure as I have never bothered with this problem.
Any help of guidance would be appriciated. Also if suggesting a file type, do you know of any useful Websites that have tutorials or guides to outputting formatted text using java.
Thank you in advance
There is no need for the If statement to be there.
When you iterator through your Collection, you either find the desired item, or you don't. These are your only 2 outcomes.
Item Found - Return the Item object, method stop executing when a value is returned
Item not Found - While loop finishes, Code after is Executed. Regardless of the if statement, the return value is always null. So if the method does not find the desired item, it always returns null.
Because of this, there is no need to check if the item is null as the outcome will always be the same.
Hope this helps
ghosh22, What vjproduction is saying, is that the problem that you have posted is long and complex, and you haven't actually made a start yourself. This forum is designed for smaller, more specific problems. You have posted a specification for a project and are expecting experienced web designers to do the heavy lifting.
VJ's post gives you good areas to look at so that you are able to make a start. Then once you reach a sticking point with a piece of code, use this forum to get advice..
Hope this was helpful
Cheaper than books, try this website. It's free and has a lot of good starting points.
If your looking for inspiration and to see some cool design ideas/code, visit css-tricks. It's run by a guy called Chris Coyier and he usually posts some pretty interesting guides about web programming.
If your looking for a book specifically however, John Duckett's HTML & CSS book is a good starting point
Hope this helps
I don't think there is a built in function of Eclipse that offers this, however they may be a plugin floating around out there. I'd have a look for that
JamesCherrill you're correct however this seems like a moot point to focus on. Either way, the default value is 0. Whether you can remove items or not is not actually relevant as my response didn't focus on that point.
Don't, really understand the point of your reply...
I'd recommend getting used to programming command line programs in Java before hopping into GUI's. I recommend this because a lot of the underlying functionality is key to writing a good program. If you start at GUI's, you tend to focus more on interface design and less on the program functionality.
If you choose to take this advice, have a look at the following:
Object Oriented Design
Java Types
Java Collections (ArrayList, HashMap, HashSet, Array)
Error Handling
These will give you a good foundation to writing Java programs.
Hope this was helpful
I'm assuming that because you are using BlueJ, you are in your first semester of a Computer Science Course or related course. On this assumption I am going to recommend you talk to a tutor or to some class mates as the question seems to be related to a specific piece of code provided by your tutor.
Well computer DateTime is actually stored at a 64bit number.
This number started on Jan 1, 1970.
so for you ID you can use this 64bit number as it can uniquely identify a record. It can also be used (with some additional processing) to give you a DateTime. 2 Birds with one stone
If your a beginner I'd recommend buying a book on Java. Something like Sam's 24 Hour Java as it will give you the basic starting blocks for the language. Going straight into a project such as a POS system is a bad idea as it requires a higher level of understanding, not just of programming, but also of Analysis etc.
By default, when you declare and create a new array, each element is set to 0.
So, using this logic we can conclude that if you remove a 0 from the array, Java replaces it with the default value, 0.
There are two simple options.
1. Bite the bullet use another array
2. If you are returning the values or printing them to the screen, use some sort of check to ensure that only values that are greater than 0 are output.
Those are the only things I can think of. If neither of these suit your specification, then I think you may be at a dead end.
Another idea may be to use the dreaded ArrayList object. Just a thought
good luck
It depends on the nature of the website. However you can work out most of the requirements within 5 minutes.
How much space does your page take up on your computer?
::Thats the start of your storage requirements
How many people will be visiting the page?
::Increased traffic means faster connection/server. general rule: more people = higher spec
Is there a database? (e.g. signup/login, blog, dynamic Content)
::If there is a database which is having regular updates, the website will need more storage(eventually).
So there you have it, 3 steps to working out the server you need.
I'd recommend using ww.1and1.co.uk. This is where I host my website www.ob-sys.co.uk
I have found the interface very useful and simple to use. The hosting is also very cheap which is a bonus.
Good Luck with your site.
Thats a lot of data to analyse, but after a quick look, I see you haven't closed the socket. You have closed the BufferedWriter that writes along the socket but not the socket itself. I don't know if i'm 100% correct here but it's all I could think of.
Good Luck
Thankyou for the responses.
I know the requirement was strange. It's what made the problem so difficult. I have now relented and returned an Array.
Once again thank you for the responses. They were very helpful.
If you really wish to find out then declare a float and a double. Then print them to the screen.
e.g.
public class Test{
private float myFloat;
private double myDouble;
public static void main(String[] args)
{
System.out.println("Float: " + myFloat);
System.out.println("Double: " + myDouble);
}
}
Is there any way to do this just with HTML/CSS?
If not is there a way to do it with PHP as thats the language I will be using for dynamic content.
Thankyou
Basically I am creating a web page that is going to eventually load content dynamically using PHP.
Right now I am constructing the HTML/CSS for the page so that the design is complete.
My problem is that when I add x amount of content to my page, the content simply overflows out of the element, across the top of my footer and down the page.
What I want is for the content area to resize automatically keeping my footer at the bottom so that all the content is displayed correctly.
Below is a copy of my current web page.
thankyou
HTML
<!DOCTYPE html>
<html>
<head>
<link rel='stylesheet' type='text/css' href='layout.css'/>
<link href='http://fonts.googleapis.com/css?family=Orienta|Orbitron:700' rel='stylesheet' type='text/css'>
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js'></script>
</head>
<body>
<header>
<nav>
<span id="logo"><a href="index.html">LOGO</a></span>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Projects</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
</header>
<div id="wrapper">
<div class="content">
<div class="leftSide">
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
</div>
<div class="rightSide">
<p>Right</p>
</div>
</div>
<footer>
<div class="footer">
<div class="footerInfo">
<h3>My Places</h3>
<ul>
<li><a href="#">Twitter</a></li>
<li><a href="#">Google+</a></li>
<li><a href="#">Youtube</a></li>
<li><a href="#">Daniweb</a></li>
</ul>
</div>
<div class="footerInfo">
<h3>Site Info</h3>
<ul>
<li><a href="#">About Me</a></li>
<li><a href="#">Sitemap</a></li>
</ul>
</div>
</div>
</footer>
</div>
</body>
</html>
CSS
/*
* Green: #32CF0A
*/
*{
margin: 0;
padding: 0;
}
html, body{ …
I don't think these will work as the method stops running once the return statement is executed. Or at least thats my belief. I'd rather not return any sort of array or collection aswell as I want all processing of Card data to be done in the specified class.
Therefore I require a way of taking every object in the hashmap and returning them to the client method.
Trying to return Multiple Card objects from a hashmap
Currently using the following code
private HashMAp<Integer,Card> allCards = new HashMap<Integer,Card>();
public Card getAllCards()
{
Collection col = allCards.values();
for(Card c: col)
{
return c;
}
}
This works but only returns 1 Card object from many.
How can I change it to return every object stored in the HashMap??
Thankyou
I agree with JamesCherrill. You can't measure the performance of an algorithm without first understanding the algorithm.
It's like asking someone 'How long is a piece of string?'
Without the string, we cannot tell.
Basically I have the Game Logic in one class so that it is separate from the IO/GUI.
The accessor is located in the Game Logic Class. It's function is to locate the value of a 'Box'. e.g. box 1 has a value of £250,000 and Box 20 has a value of £0.01.
So when I use the accessor, it returns the box Value which is in the Box class.
What I really need help with is sorting the JButtons so that I can easily create them and store them in an array for easy manipulation. I'm very inexperienced with GUIs in Java at the moment though so Clear simple advice would be great.
O' Captain my Captain - Walt Whitman
I don't get it....you've out foxed this fox....which makes you extremely bloody foxy!
Hey guys
I recent wrote the deal or no deal game in Java for fun. It currently operates using a Command driven interface where users input numbers based on textual feedback.
My aim is to develop this into a full GUI interface, however, I have not met GUI's yet in my computer science course. Whilst I have some basic knowledge of how they work and the Syntax they use, I still need help.
What I want to do is create 21 buttons and assign each a value which is determined by a accessor. These numbers will range from 1 to 22.
I then also want for the button text to change once it has been clicked (through an event listener or similar). This will then start a new turn.
This is the basic functionality I require. I have looked on various different websites but it doesn't seem to help.
Figured I'd ask here.
Please don't ask for the GUI code I've already written as it's incomprehensive and not very good. Also assume the accessor produces an integer value between 1 and 22 as this is not important to the task in hand.
Thank you in advance
Thing that springs to mind is that you've got other applications running that maybe you didn't realise are running. Some programs start at System boot without you even realising. They then take up processing power and you experience a lag in your games. This would also explain the large amount of RAM being used.
Check task manager to see if anything out of the ordinary is running in processes. Then in the Start Bar Search field type msconfig. Once it loads use the startup tab to see what programs your pc loads at runtime and disable those that you don't need.
Hope this helps