Dolphin, the GameCube and Wii emulator - Forums
Programming Discussion Thread - Printable Version

+- Dolphin, the GameCube and Wii emulator - Forums (https://forums.dolphin-emu.org)
+-- Forum: Offtopic (https://forums.dolphin-emu.org/Forum-offtopic)
+--- Forum: Delfino Plaza (https://forums.dolphin-emu.org/Forum-delfino-plaza)
+--- Thread: Programming Discussion Thread (/Thread-programming-discussion-thread)



RE: Programming Discussion Thread - Zee530 - 11-10-2012

Overpopulation is the main cause, if the class is crowded there's no way of waiting for everyone to get it.


RE: Programming Discussion Thread - AnyOldName3 - 11-11-2012

Now, back vaguely towards actual programming:

Can someone who knows some java help me with something. For a program I'm working on I need a method which puts the frequency of each character in the alphabet as a separate entry into an array (or as parts of the internet have suggested when I googled it, a hashmap, which I don't have a clue how to use). The program overall will put this data into a .csv file with a user specified name (which I've already got working). Basically, I have no idea what functions will help me, so can't even write a psuedocode version. When I looked it up, I found some examples, but don't like using other people's code unless I know what each line does and why, which is why I'm asking for help: I'd like to be told generally what I'll need to do, and which functions I'll need, and why, then try and make it myself from that information.


RE: Programming Discussion Thread - AnyOldName3 - 11-12-2012

Seeing as LordVador is making so may new threads, it looks like I'll have to...

*Bump*


RE: Programming Discussion Thread - NaturalViolence - 11-12-2012

Why don't you just make the method yourself?


RE: Programming Discussion Thread - AnyOldName3 - 11-12-2012

I see you skim read what I wrote. The reason I don't write the code is that I have no idea what I'm doing. If I did, I could.


RE: Programming Discussion Thread - NaturalViolence - 11-12-2012

I keep thinking that there must be something that I'm missing because that seems pretty easy.

Quote:I need a method which puts the frequency of each character in the alphabet as a separate entry into an array

So you want an array with 52 elements for each alphabetical character (upper and lower) with each element holding the number of times that character appears in the file correct?

Just make a for loop that runs 52 times and increments to the next letter each time. Then within that for loop have another for loop that goes through every character, checks to see if it matches the currently set character using an if statement, and if it does += 1 to the counter, then when it's done write the counter to the current array element. The outer loop should then pop to the next letter and the next array element.


RE: Programming Discussion Thread - shuffle2 - 11-12-2012

(11-09-2012, 04:10 PM)NaturalViolence Wrote:
Quote:Ye, reason why you shouldn't rely on classes and start teaching stuff yourself lol...
Quote:Most of my programming knowledge came from the internet when I studied stuff myself.

Well obviously. But to do anything with that knowledge career wise you need a degree. And to get that degree you're going to need to take these classes. And if you take these classes you're going to have to put up with the idiots in those classes. Therefore it's a common issue regardless of how much or little you learn about programming outside of class.
This is not true. If you are good, many places do not care if you got a degree in something unrelated or never even attended university.


RE: Programming Discussion Thread - shuffle2 - 11-12-2012

(11-11-2012, 06:25 AM)AnyOldName3 Wrote: Now, back vaguely towards actual programming:

Can someone who knows some java help me with something. For a program I'm working on I need a method which puts the frequency of each character in the alphabet as a separate entry into an array (or as parts of the internet have suggested when I googled it, a hashmap, which I don't have a clue how to use). The program overall will put this data into a .csv file with a user specified name (which I've already got working). Basically, I have no idea what functions will help me, so can't even write a psuedocode version. When I looked it up, I found some examples, but don't like using other people's code unless I know what each line does and why, which is why I'm asking for help: I'd like to be told generally what I'll need to do, and which functions I'll need, and why, then try and make it myself from that information.
in high level languages, hashmaps typically work such that you have pairs of values, called a "key", and a "value". The key is used as if it is an index into the hashmap.

Consider a normal array where you might do something like this:
Code:
alphabet[0] == "a"
hashmaps make it easy to use whatever datatype you want as the index, so instead of using integers you can use strings, for example:
Code:
alphabet_indices["a"] == 0

you can use this to easily do something like:
Code:
for character in input_string:
    hitcounts[character] = hitcounts[character] + 1
...and that's about it.

note i'm not using java, but you should get the idea.


RE: Programming Discussion Thread - AnyOldName3 - 11-12-2012

Actually I only need to search for uppercase characters, so would only need 26 elements.

The problems are as follows:

a) The internet has told me to use a hashmap instead of an array. I have no clue what the difference is, and no clue how to implement one.

b) I don't know exactly how to do the comparing a specific location in a string to another string. I only learned this afternoon how to compare the whole of a string to another string @(as stringName != "y" apparently always evaluates to true, even when the string is "y").

c) The example code I can find doesn't do this exactly how you say. There's a faster way to do it (there may be a library function that gives the total count of a character in a string, but the code I've seen was poorly formatted, so I struggled reading it).


RE: Programming Discussion Thread - NaturalViolence - 11-12-2012

Quote:This is not true. If you are good, many places do not care if you got a degree in something unrelated or never even attended university.

Well it certainly increases your chances, a lot.

Quote:Actually I only need to search for uppercase characters, so would only need 26 elements.

The problems are as follows:

a) The internet has told me to use a hashmap instead of an array. I have no clue what the difference is, and no clue how to implement one.

b) I don't know exactly how to do the comparing a specific location in a string to another string. I only learned this afternoon how to compare the whole of a string to another string @(as stringName != "y" apparently always evaluates to true, even when the string is "y").

c) The example code I can find doesn't do this exactly how you say. There's a faster way to do it (there may be a library function that gives the total count of a character in a string, but the code I've seen was poorly formatted, so I struggled reading it).

I'm guessing you got ninja'd by shuffle.