This week's giveaway is in the JDBC forum.
We're giving away four copies of Java Database Connections & Transactions (e-book only) and have Marco Behler on-line!
See this thread for details.
Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!

Anayonkar Shivalkar

Bartender
+ Follow
since Dec 08, 2010
Anayonkar likes ...
Eclipse IDE Java Linux
A Java developer who likes to learn new things.
Cows and Likes
Cows
Total received
5
In last 30 days
0
Total given
0
Likes
Total received
227
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Anayonkar Shivalkar

Yes!

I heard about it a while ago - but never gave serious thought - as those problems are mostly mathematical - and usually do not test cleanliness of code and/or design (since solution is judged based on correctness and efficiency alone - usually 'good' solutions are very tightly coupled to problem statement and with very little scope to modify/extend).

But that apart, from pure mathematical coding point of view, those are very nice puzzle (and let me warn you - very additive! I just wanted to have a look at them a couple of days back - and before I knew I finished around 5 issues within half night ).

By the way, is there any such project/website to check code cleanliness or design principles (e.g. given a problem statement - can coder write a 'clean code', follow SOLID/TDD,  can he/she identify which design pattern(s) would be most suitable for it - so that minimal changes would be needed for further requirements etc.)?

Thanks in advance!
Hi Nikole,

Welcome to CodeRanch!

Nikole Six wrote:So, all flavors will belong to recipes, but not all recipes will have the same number of flavors associated with them


Perfect! You almost figured it out.

When we say flavors belong to recipes, what we say is:
Recipe HAS-A Flavor (of course, it can be 0 or more than 1).

But, if we want to make Flavor as a subclass of Recipe, then it will make sense only when Flavor IS-A Recipe (which is not the case here).

I hope this helps.
3 years ago
Hi Anne,

Welcome to CodeRanch!

As I'm not much aware of NetBeans IDE, I'm not sure about what exactly does 'play' button do (does it run the code?).

Also, when you got NoSuchMethodError - for what method you got it? Was it main method or something else? But then again, not sure how it worked second time (maybe auto-compile was toggled?).

Anyways, regarding the demo - the most sure-shot way to get your demo right is:
1) Get rid of IDE (unless you want to present demo about IDE + code)
2) Create executable jar (we also have options to package all dependent jars/classes in it - to avoid lengthy classpath at runtime). Also make sure you have main class defined in manifest file.
3) Run the code with

I hope this helps.

If you feel the issue is specific to NetBeans and not Java, then we have dedicated forum here(<-click)
3 years ago
Hi Kurumi,

Welcome to CodeRanch!

Kurumi Tokisaki wrote:but doesn't handle leap years very well


What does this mean exactly? Can you please provide and example.

Meanwhile, LocalDate class has isLeapYear method - which you may use to adjust code for leap year.

I hope this helps.

Thanks.
3 years ago
Hi Nicole,

Welcome to CodeRanch!

Everybody has a learning phase and there are hurdles during it. Nothing unusual or wrong with that.

As you have access to your code - did you try to compile it and solve compilation issues?

My advice would be:
Take class which does not use any other class from your code (i.e. Chair class) and compile that only. Unless it compiles successfully, don't go for Demo class(es).

Pay very good attention to variable names, their datatypes, method invocation etc.

You may start with reading about syntax for method declaration/definition and method invocation. Let us know if you face any further doubts.

I hope this helps.

All The Best!
3 years ago
Hi jin,

Not sure if you want to make a chat server or echo server but below are my findings:

In Server code, below part sends message to client:


But, at client side, the code is reading that line, printing it and breaking while(true) loop (first inner loop) only if that message is stop or end. However, that message is 'Whatcha want?'. Thus, loop will not break, and client is waiting for another message from server.
Meanwhile, server is also waiting for another message from client:


I think at client side, if the message (from server) is not end/stop, then you should give client a chance to send a message to server.

I hope this helps.
3 years ago
Hi AhFai,

Regarding Question 1:
I didn't understand what exactly are you trying to do. Especially with line:

Anyways, if you look carefully, what are you doing is - sending a DateFormat object to format method of DateFormat.
Now, DateFormat class doesn't have any such method. So compiler tries to find such method in its parent class - which is Format class.
Format class has a matching method - but not the one accepting DateFormat as argument, but a method accepting Object as argument.
Since DateFormat IS-A Object, compiler is fine with this.

Hence, code compiles.

However, at runtime, the Format class' format method (accepting Object) calls an abstract method - which again goes to DateFormat class and there we see code which checks whether the input argument IS-A Date or IS-A Number.
In your case, it is neither (it is DateFormat) and hence we get IllegalArgumentException: Cannot format given Object as a Date

Regarding Question 2:
As per my knowledge, there is no such facility (at least not in SimpleDateFormat). If your code is expected to parse dates in different formats then I think you should be owner of the code which at least checks:
1) Whether input text is a valid date (e.g. what about 01-01-19blah?)
2) Invoke proper parser (it can be done by ugly way in which you'll create a bunch of parsers and try them all on input)
If you don't provide any format to SimpleDateFormat, it takes format SHORT as default.

I hope this helps.
3 years ago
Yup. Sorry I forgot about those.

Just gave a lecture in my office about modular development so I keep forgetting other new stuff in Java 9 ☺
3 years ago
Yes that is why I couldn't move your post to proper forum

Anyways I just checked API documentation (please note that I have zero knowledge in quartz internals) and found that rescheduleJob(<-click) needs a new trigger with same job name and group name.

I can see that your new trigger does not contain job name. Maybe you can try forJob(<-click).

I hope this helps.
3 years ago
Hi Zohr,

Before burning iso to usb, did you check if hash of your iso matches to that mentioned on website? I guess they've provided md5 and/or SHA hash/checksum.

If it matches, can you try booting some other computer with your usb?

Sorry I'm not kali expert, but I've had same issue with Linux Mint and it turned out that my iso image itself was corrupted.

I hope this helps.

Thanks.
3 years ago
Hi arushi,

Though I'm not much aware of quartz (looks like a job scheduler) - I think this question is more quartz specific than Java specific.

Did you try to get in touch with somebody who knows quartz?
3 years ago

Tom Nielson wrote:

Jeanne Boyarsky wrote:Tom,
I'm not sure of the syntax. Brian Goetz mentioned it in a NY Java SIG presentation last week. OF course it came with the standard Oracle disclaimer that anything can change.



Haha kind of like they did with Currency. I'll check it out and talk to Brian on Twitter if my research comes empty.


Well, Jeanne's update might be latest, but at JavaOne 2015 (around a month back), Brian mentioned that this feature (I think it is value types) will be part of project Valhalla - which is maybe Java 10 (again - same 'safe harbor' slide) - but not in Java 9.

Java 9 is all modules - which was supposed to release by September 2016, but as per latest updates, it might take March 2017 for GA (General Availability).

Thanks.
3 years ago
Great!

Sorry was away from forum since some time

Currently I'm experimenting on Jigsaw early access build and have few questions. Finally I have place to ask them

Thanks!
3 years ago
Hi,

I would recommend 'Database System Concepts' by Henry Korth et.al.

Though it is somewhat big book - it covers plenty of beginner and advanced level concepts.

I hope this helps.
3 years ago
Hi Kyle,

In addition to what Bear and Campbell have said, also check your organization's policies about intellectual ownership of tools you create with organization resources (i.e. hardware, time etc.).

In some cases, any work you do during company time and on company machine automatically becomes company's intellectual property (even if the work is your own and has nothing to do with company's product(s)).

I hope this helps.
3 years ago