Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.

salvin francis

Bartender
+ Follow
since Jan 12, 2009
salvin likes ...
Eclipse IDE Google Web Toolkit Java
Forum Moderator
salvin francis currently moderates these forums:
Mumbai
Cows and Likes
Cows
Total received
46
In last 30 days
0
Total given
79
Likes
Total received
176
Received in last 30 days
3
Total given
66
Given in last 30 days
6
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by salvin francis

Also adding to what Campbell asked,
"package" should be the first line of your source code. Also, the directory where you create your java source code matters. You cannot define two packages in the same java source.
1 day ago
I feel that its better to early exit a method if the parameters are not valid. Validation should be the first part of your method code. Personally, I avoid too much indentations and not having an else statement where the if condition does a return is one of my norms.
4 days ago
My opinion about this is slightly different...
First of all, if the if condition returns, then why do you need to write an else condition ?

eg...One advantage of this is that your code skips an unwanted indentation. Here's an example from Hashmap.Node class:
4 days ago
I agree, they are not always good, hence I mentioned that :

salvin francis wrote:... But to a different person, they may not mean the same.


and

salvin francis wrote:This made me this re-think that my acronyms too might not make sense to someone from a different language background



5 days ago
@Campbell, How about using characters instead of Strings ? That would probably boost the program even more. I see that just 3 characters: ' ','#', and '\n' are needed.
@OP, the only import you need is I am not sure why you are using scanner.skip, maybe you can elaborate more on that ?
5 days ago
I think that Naming code entities is actually a matter of taste.

We are humans after all, each person has a different perspective of looking at the world. Some of us are expressive in typing variables/class/methods/documentation. Some of us type the shortest word possible.
Many times, I resort to using acronyms such as : no, num, id, empId, etc... Typically, these are local variables and I have no issues reading them as number, employee id, etc.. But to a different person, they may not mean the same. I remember that I had to once modify a code that was written in German. All variables/methods/comments were completely foreign to me. This made me this re-think that my acronyms too might not make sense to someone from a different language background.  While we strive for a good naming convention, expecting everyone to follow the same format is simply not practical.

With regards to long naming conventions, here's an interesting quote from coding horror: (https://blog.codinghorror.com/new-programming-jargon/)

codinghorror wrote:Smurf Naming Convention
When almost every class has the same prefix. IE, when a user clicks on the button, a SmurfAccountView passes a SmurfAccountDTO to the SmurfAccountController. The SmurfID is used to fetch a SmurfOrderHistory which is passed to the SmurfHistoryMatch before forwarding to either SmurfHistoryReviewView or SmurfHistoryReportingView. If a SmurfErrorEvent occurs it is logged by SmurfErrorLogger to ${app}/smurf/log/smurf/smurflog.log


5 days ago

Tim Cooke wrote:Dreams are such mysterious things.


Dreams are such mysterious, there is a cool concept of "lucid dreaming". It means that the dreamer is aware that he/she is dreaming.
Lucid_dream

wikipedia wrote:During lucid dreaming, the dreamer may be able to have some control over the dream characters, narrative, and environment.


I haven't experienced one, but I would love to.
2 weeks ago
I don't know much about the subject at hand. But, I would have to comment that reservations of any kind is a bad idea. It raises questions over equality.
In my country, there are reservations over a lot of places including government jobs, government schemes and education (yes, that's right, education). They have "quota" for woman, "quota" for people belonging to some caste, etc...

2 weeks ago
Is there something specific about lambda expressions that you are looking for ?
Have you read the tutorials : https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html ?

I suggest that you also have a look at coderanch guidelines:
ShowSomeEffort <-- it’s a link
UseAMeaningfulSubjectLine <-- it’s a link
3 weeks ago
This is how the comparison should work:

A more better way would be:
3 weeks ago
Thanks for the likes guys.

Aside from my regex, I agree with Stephan. If this is truly an XML data, Regex is not the right way to go. Java comes with it's own xml parsers and it's just a couple of lines of code to simply parse this data.
3 weeks ago
If you want to name the group as "prof" then this should also work:
3 weeks ago
I think it should be :

3 weeks ago