salvin francis

+ Follow
since Jan 12, 2009
salvin likes ...
Google Web Toolkit Eclipse IDE Java
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt Green check

Recent posts by salvin francis

neo zef wrote:... I do not know how to start it because I do not understand the topic about hashmap...

You could start by telling us how you were planning to use the text file, how you were going to handle the exceptions and what exactly is unclear to you about HashMap. In a nutshell, it's just a key value pair data structure.
5 days ago

Dylan Dugan wrote:... but I am a bit confused by some of this as I am knew to Java so my knowledge is slim ...

I strongly suggest against modifying 150+ lines of gui code while learning java. Given that you are unable to fix compilation errors, I believe that this would be a complex task that you are somehow trying to get to work.  
1 week ago
Glad it worked. From what I understand, this code was incorrect: I think this is not the intended use of TextAttribute.SUPERSCRIPT. (I could be wrong)
1 week ago
Try this:

The "subscript" font above is a derivation of normal font with an additional attribute of superscript.
Let me know if it works as intended
1 week ago
Back from the dead,
just to answer this thread
(rhyme intended)

You would also need a simple for loop instead of the for-each if you're interested in the current index. In the OP's example, the loop printed each element of the array, but also printed a new line after every 10 iterations. This would be possible using for-each loop using a variable defined outside the loop, but I don't prefer that since that variable is no longer needed after the loop is done.

2 weeks ago
Fred, just wanted to add, it's been a decade since I have even touched C language.. But the variable scoping issues I saw in your code, would be pretty much the same in C or C++.
5 months ago

Campbell Ritchie wrote:Start from where you left off? Please explain a bit more, Salvin;

Open the text editor. Type in anything (even in multiple tabs). Close the editor. All the ones you mentioned will prompt you to save. See screenshots.
I love the ones that don't prompt and simply close. The next time you open them, they will start where you left off. Even if the machine was shutdown.
Some text editors which support this:
  • Windows: Notepadd++
  • Mac: BBedit
  • Linux: Notepadqq
  • I would love to discover some other ones.

    Campbell Ritchie wrote:it sounds as if I was mistaken not to use your favourite text editor.

    I was just trying to answer your previous question.

    Campbell Ritchie wrote:Does it support syntax highlighting for LaTeX?

    yes, it supports that. See screenshot

    Campbell Ritchie wrote:Would you like to add it somewhere; I think we have a text editors FAQ.

    I'll try and search around.
    5 months ago
    I tried all three of the above, they're good. Lightweight and cool. But.. There's two basic features that I look for in most text editors:
    1. Start from where I left off without saving
    2. Block select mode
    None of the three support 1.
    Block select has limited support in kate. e.g. Tab key does not work as expected.

    I think kate comes the closest, but I will still stick to notepadqq for now.
    5 months ago
    You could try notepadqq for linux
    5 months ago

    Fred Masen wrote:Salvin I use the proper way but Eclipse gave me so many errors while I was typing the code that I had to change it constantly. However you are correct about the bug but if you could demonstrate me how you can get this piece of code working properly without getting into classes and obtaining  the correct average age, I would deeply appreciate. Understand also that after a few hours of frustration I did not know what I was typing at the end

    I used notepad++ for a long while even when eclipse and netbeans were getting popular. Using a simple text editor will help you learn faster. Once you've learned the language well, then switching to an IDE would help you write larger programs.
    5 months ago
    Although you mentioned a couple of times that you wrote the same code as the book, it was not true. Please understand that in the world of programming, a single line change could alter the complete program. It's no longer the book's code, now that it's changed, it's your code !!
    5 months ago
    I just wanted to circle back to your previous code to explain the bug:

    Here are issues:
    1. "total" is set to 0 at the starting of the code and then used in the loop. For every iteration of the loop it remembers it's last value. This is the root cause of the issue you were facing.
    Note that in your original code, you had written this line inside the for loop:
    In the later code, you removed it. This is the bug that was causing a wrong output for scores. I tried to point it out, but we could not reach common ground here
    2. If you're using "total" for scores, why are you using it for calculating age total as well ? The value from scores should be unrelated to age feature. There's also a spelling mistake where you are modifying the value of "average" instead of "averageAge".

    For 2. Campbell suggested to use meaningful variable names. This would have highlighted the wrong code.
    As Piet suggested, you can move to an Object oriented approach as well. But first, I suggest understanding variable scopes and how values are retained or forgotten. You could declare "total" within the for loop as well.
    5 months ago
    I have asked a couple of questions above, I haven't received answers for any of them
    5 months ago

    I wrote:...

    50 is wrong. There's a reason why this is happening.

    Here's the answer to this. The average should have been

    But the behavior of the code is:

    Do you know what this 15 is ? Campbell's post has more clues about it.
    5 months ago