Catch the exception and provide a default. What should the method return if the parse fails?
its parsing a calendar, so... empty string probably.
hmmm i feel like i tried catching before, but eclipse wasn't havin' it. so fickle. will try again.
Catch the exception and provide a default. What should the method return if the parse fails?
Java has checked exceptions, which means that when you're writing a method, any other method you call can throw an exception. You must either catch that exception in your method, or declare that your method can throw that exception. It sounded like you're saying you can't add the exception declaration, so your only other option is to catch it.its parsing a calendar, so... empty string probably.
hmmm i feel like i tried catching before, but eclipse wasn't havin' it. so fickle. will try again.
Java has checked exceptions, which means that when you're writing a method, any other method you call can throw an exception. You must either catch that exception in your method, or declare that your method can throw that exception. It sounded like you're saying you can't add the exception declaration, so your only other option is to catch it.
I graduated almost 3 years ago now. Even though I already knew the basics about programming before I started college, I feel like I learned a ton in school. I was one of the top people who graduated my year, having won a regional programming competition and some other awards.yeah should be that.
shit my job is stressing me out. Graduated college with a computational media which is pretty much cs with a more design/media track... but my job is embedded java stuff and i need to learn about optimization and memory management and all that jazz lol.
The humans I can just assume that they aren't idiots
if you're creating a list of already filled spots for the AI to use, you may as well just apply it to the player as well.Hey guys, so I'm in an intro to CS class (learning Java) and I was wondering if anyone could help me with a basic idea of how to set this up. I'm supposed to make a TicTacToe game with either a human and a computer player or two human players. The humans I can just assume that they aren't idiots and won't try to choose the same spot but I'm not sure how to get the computer to recognize an open spot. Spots are chosen using coordinates (ABC for the X-axis and 123 for the Y-axis).
I'm guessing I just need a recursive method that checks for spots the player has filled and then fills out different ones? Any ideas how to do that? The basic assignment just requires me to make a computer that fills spots at random, I can get extra credit if I create an "AI" that is unbeatable, but I think I'll just settle for the basic one for now.
Sorry this is so ridiculously basic. I'm just starting out![]()
Java has checked exceptions, which means that when you're writing a method, any other method you call can throw an exception. You must either catch that exception in your method, or declare that your method can throw that exception. It sounded like you're saying you can't add the exception declaration, so your only other option is to catch it.
Hey guys, thought this might be the best place for me to ask for some advice.
I got my B.S. in Computer Science in January and have been looking for a job ever since with not much luck. Meanwhile, I have a part time job where I do some light I.T. stuff, but really no programming involved. I'm looking for advice as to where to put my efforts in. My classes mainly taught Java, and I've done some work in C, Assembly, and some Android Development. I'm currently trying to stay active by learning JavaScript and web development in general, as well as working on a simple android app. Is there anything in particular I should be focusing on or ways to stay in practice so I don't forget everything? There's an almost limitless list of things to do/learn, but I want to be on the right path if there's any such thing as a wrong path.
Where are you looking?
Either way keep working on side projects so you can point to those things in an interview if you need/want to. Do the kind of things that would interest you.
I suspect your potential employers will mainly be concerned with one thing: do you only have theoretical knowledge, or do you get things done?Hey guys, thought this might be the best place for me to ask for some advice.
I got my B.S. in Computer Science in January and have been looking for a job ever since with not much luck. Meanwhile, I have a part time job where I do some light I.T. stuff, but really no programming involved. I'm looking for advice as to where to put my efforts in. My classes mainly taught Java, and I've done some work in C, Assembly, and some Android Development. I'm currently trying to stay active by learning JavaScript and web development in general, as well as working on a simple android app. Is there anything in particular I should be focusing on or ways to stay in practice so I don't forget everything? There's an almost limitless list of things to do/learn, but I want to be on the right path if there's any such thing as a wrong path.
I'd be glad to hear about good C# books too. I've tried and failed to find any. I'm interested both in books aimed at total beginners, written from the introductory programming perspective, and well-written, tight "insight" books analogous to what Meyers, Sutter, Alexandrescu and others have written on C++.Sigh... I.m struggling to keep up in my programming class. I really want to understand this stuff =(
My instructor introduced:
Methods with the out Keyword
Named Optional Parameters
Using Combo Box Control
Enumerations
Using Windows Timer
The List Box Control
Can anyone recommend a good C# book to help supplement my learning?
I haven't gotten the chance to try it for myself yet so I can't vouch for it's usefulness, but I found http://www.programmr.com/ which is supposedly akin to code academy. And it actually has c#
My knowledge is really limited, but it seems that JavaFX will be the focus in the future in Java. I also wrote a couple small stuff in both and JavaFX was a lot faster/easier to write and the code was a lot cleaner, using the GUI editor. Lists and spreadsheets are still a bit rough last time I checked, but they're improving it.Opinions on Swing vs JavaFX?
So today I registered for classes at my new university. I'll be transferring next month to start the summer semester.
My new university uses C++ instead of Java, so will you guys recommend a book I can read to get up to speed on C++ before I start my programming classes here. (Programming class will start in July)
I already have the object oriented experience from Java, so ideally it wouldn't be an absolute beginners book
Thanks!
What do you plan to do?Opinions on Swing vs JavaFX?
You can use objects, to better organize your types. Though you may want to keep using numeric keys, I used text (apple, orange, etc).So I'm known to over complicate things, but does anyone know of a simpler way to set this up?
http://jsfiddle.net/cx4mZ/
var food = {
apple: {
1: 'fuji',
2: 'gala',
3: 'red delicious'
},
orange: {
6: 'navel',
7: 'valencia',
8: 'blood'
}
};
var selectedFruits = $('#fruit :selected'); // code to get selected items
selectedFruits.each(function (index, optionEl) {
var name = $(optionEl).text().trim().toLowerCase();
if (name === 'All Fruit') {
// code to attach all fruit
$.each(food, function (fruit, list) {
$.each(list, function (key, value) {
$('<option>').val(key).text(value).appendTo('#types');
});
});
} else {
// this would now be something like food['apple']
// so the list inside apple
$.each(food[name], function (key, value) {
$('<option>').val(key).text(value).appendTo('#types');
});
}
});
struct Node
{
Node(const Factory& h);
Factory data;
Node * nextNode
};
Factory::Factory(const char * const name, const int size)
{
//code for copying arguments into Factory's data members
}
LinkedList::Node::Node(const Factory& h) : nextNode(NULL)
{
// ???
}
Not really a programming question, but I have to choose a new laptop for software development. So I thought this might be a good place to get some opinions.
It's supposed to be a pretty high-end device with 16GB of RAM (so most of the Ultrabook-type notebooks are out). Currently I'm considering the Dell Precision M3800 and the Thinkpad T440p, but I'm open to other suggestions.
With the Dell I'm not so sure about the glossy high-dpi display. Working on a glossy display isn't ideal. And I'm not sure how problematic the high-dpi display is. What if I want to install Linux next to Windows? Can IDEs like Eclipse deal with the resolution?
On the Thinkpad I don't like how the 9 cell battery protrudes from the case and with 4-4.5h the 6 cell battery seems a bit small. And the device seems a bit bulkier overall.
I probably won't have the chance to compare the keyboards and trackpads, since I'll have to order soon and I don't think there's a store nearby that has both on display.
Leaning towards the Thinkpad, but a 3800x1880 touch display is quite tempting...
Hi guys, novice question about NoSQL databases like MongoDB. Specifically I would like to understand they claim that they scale horizontally much better than traditional databases. Increasing capacity by adding more servers implies that the data isn't replicated across all servers, otherwise why would adding more servers increase capacity right? So my question is if all servers in the db don't contain the same data, how do you ensure that you'l get consistent results when querying the db? If 1 out of 5 servers goes down are we just missing 1/5 of our result set when we run a query?
Is this a philosophical difference between relational and non-relational databases? I.E. when querying a non-relational database are we content with saying "get me whatever data is available at the moment?"
What kind of development do you do exactly?Not really a programming question, but I have to choose a new laptop for software development. So I thought this might be a good place to get some opinions.
It's supposed to be a pretty high-end device with 16GB of RAM (so most of the Ultrabook-type notebooks are out). Currently I'm considering the Dell Precision M3800 and the Thinkpad T440p, but I'm open to other suggestions.
bool android = true;
#if UNITY_ANDROID
if (android){
Google Play Games Stuff
} else {
Kindle GameCircle Stuff
}
#endif
I'm taking a Python course on Coursera. Well, it uses Python to introduce programming. Anyway, I built my first Celsius to Fahrenheit converter. I can't believe something so simple was so satisfying to figure out. Really enjoyable. Maybe because it's a nice change of pace from my normal work. I know you guys are pros but this noob is having a good time.
Stroustrup's "A Tour of C++". Short, yet covers a ton of stuff, very high quality. PDF version is free, get it fromMy new university uses C++ instead of Java, so will you guys recommend a book I can read to get up to speed on C++ before I start my programming classes here.
This might be a dumb Java question, but is there any benefit to using && or || over & or | in boolean statements? If my understanding is right, && and || evaluate both sides of the operator whereas & and | just evaluate the first side first, and then the second only if necessary. If that's the case, why not just use the single operators all the time instead of the double operators?
You have that reversed. && and || will only test the second part if they do not evaluate to false and true respectively. & and | test both sides of the operation as they are binary arithmetic operators.
I think you got it backwards. The doubled symbols mean logical AND/OR, while the single symbols mean binary AND/OR.This might be a dumb Java question, but is there any benefit to using && or || over & or | in boolean statements? If my understanding is right, && and || evaluate both sides of the operator whereas & and | just evaluate the first side first, and then the second only if necessary. If that's the case, why not just use the single operators all the time instead of the double operators?
When doing a binary operation, the result is not True or False, but a value. 0x66 OR 0xF2 is 0xF6. Because 0x00 is False and any non-zero value is True, the logical result of the binary OR matches that of the logical OR, but the binary value of the result could not have been known without evaluating it to the end.
That makes a lot of sense. I guess for the purposes of simple if or while statements, it's best to stick with the double operators then. Not sure I completely understood the last sentence of your post lol but I get the difference between binary and logical operations now
Making a linked list and ran into an issue. I'll provide a very simplied version of what I'm doing that I *think* will still have enough info to solve my basic issue.
In each node of the LL, there is an object:
Code:struct Node { Node(const Factory& h); Factory data; Node * nextNode };
the constructor for Factory objects looks like this (and it's the only constructor I'm able to use, I cannot create another constructor):
Code:Factory::Factory(const char * const name, const int size) { //code for copying arguments into Factory's data members }
Here's the constructor for Node:
Code:LinkedList::Node::Node(const Factory& h) : nextNode(NULL) { // ??? }
I want to initialize data by copying the data member values from h, but I'm not sure how to do this. In that first bit of code data does not have an argument list that corresponds with the constructor.
Basically, if line 4 in the top snippet was in the format "Factory data( argument1, argument2)" I'd know what to do. But with no argument list it seems like it needs to call the default constructor, where no default constructor exists. Hope that makes sense
I bought a Thinkpad T440s for this purpose, however it maxes out at 12GB of RAM, so if 16GB is a hard requirement for you, I guess it's not an option. For me, the additional portability was more important.
What kind of development do you do exactly?
Did you make the Factory constructor yourself or is that what you were given?
No idea; haven't started the job yet. I suppose it'll be mostly standard Java stuff. At this point I really don't know what I could possibly need 16GB of RAM for.
Then again, having a quad-core CPU rather than one of the ULV ones surely can't hurt.
At this point I'm really over Macs, even though I know they have pretty great hardware. I want a repairable machine where I can e.g. easily change the battery should the need arise. And I want a Windows machine (maybe install Linux on the side).
I downloaded Visual Studio 2013 a week ago and I'm having one problem, I can't type ending bracket "}". I don't remember having that problem in VS2010. What's the deal here, is it a feature?
Maybe I should bite the bullet, get a good Windows laptop, and figure out how to run Linux in a virtual machine to have adequate terminal tools.
How do you feel about Windows/Linux dual booting vs Windows + Linux VM?
So far I've never really had to use Linux much. Mostly used Windows and OS X. But from what I've heard most people at the company I'll join shortly use Linux, so I might try to expand my horizons some more. My current machines weren't really powerful enough to run VMs well.