• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 17:42
CEST 23:42
KST 06:42
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
[ASL19] Finals Recap: Standing Tall9HomeStory Cup 27 - Info & Preview18Classic wins Code S Season 2 (2025)16Code S RO4 & Finals Preview: herO, Rogue, Classic, GuMiho0TL Team Map Contest #5: Presented by Monster Energy6
Community News
Flash Announces Hiatus From ASL51Weekly Cups (June 23-29): Reynor in world title form?12FEL Cracov 2025 (July 27) - $8000 live event16Esports World Cup 2025 - Final Player Roster16Weekly Cups (June 16-22): Clem strikes back1
StarCraft 2
General
Statistics for vetoed/disliked maps The SCII GOAT: A statistical Evaluation The GOAT ranking of GOAT rankings How does the number of casters affect your enjoyment of esports? Esports World Cup 2025 - Final Player Roster
Tourneys
Korean Starcraft League Week 77 Master Swan Open (Global Bronze-Master 2) RSL: Revival, a new crowdfunded tournament series [GSL 2025] Code S: Season 2 - Semi Finals & Finals $5,100+ SEL Season 2 Championship (SC: Evo)
Strategy
How did i lose this ZvP, whats the proper response Simple Questions Simple Answers
Custom Maps
[UMS] Zillion Zerglings
External Content
Mutation # 480 Moths to the Flame Mutation # 479 Worn Out Welcome Mutation # 478 Instant Karma Mutation # 477 Slow and Steady
Brood War
General
BGH Auto Balance -> http://bghmmr.eu/ Flash Announces Hiatus From ASL Player “Jedi” cheat on CSL Unit and Spell Similarities Help: rep cant save
Tourneys
[Megathread] Daily Proleagues [BSL20] Grand Finals - Sunday 20:00 CET Small VOD Thread 2.0 [BSL20] GosuLeague RO16 - Tue & Wed 20:00+CET
Strategy
Simple Questions, Simple Answers I am doing this better than progamers do.
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread Path of Exile What do you want from future RTS games? Beyond All Reason
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
Things Aren’t Peaceful in Palestine Trading/Investing Thread US Politics Mega-thread Russo-Ukrainian War Thread The Games Industry And ATVI
Fan Clubs
SKT1 Classic Fan Club! Maru Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece [\m/] Heavy Metal Thread
Sports
Formula 1 Discussion 2024 - 2025 Football Thread NBA General Discussion TeamLiquid Health and Fitness Initiative For 2023 NHL Playoffs 2024
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Blogs
Culture Clash in Video Games…
TrAiDoS
from making sc maps to makin…
Husyelt
Blog #2
tankgirl
StarCraft improvement
iopq
Trip to the Zoo
micronesia
Customize Sidebar...

Website Feedback

Closed Threads



Active: 626 users

The Big Programming Thread - Page 114

Forum Index > General Forum
Post a Reply
Prev 1 112 113 114 115 116 1031 Next
Thread Rules
1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution.
2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20)
3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible.
4. Use [code] tags to format code blocks.
Deleted User 61629
Profile Blog Joined March 2010
1664 Posts
Last Edited: 2012-02-06 19:53:22
February 06 2012 19:53 GMT
#2261
--- Nuked ---
esotericc
Profile Joined July 2011
449 Posts
February 06 2012 21:21 GMT
#2262
On February 07 2012 04:53 Inori wrote:
Show nested quote +
On February 07 2012 03:52 esotericc wrote:
Read the first page, just getting confirmation that I understood the advice properly, I start a comp sci degree in a year, I already know web languages fairly well and did a couple years free lance development but stopped because there was no market near me and I couldn't afford to move.

Anyway, I take it I should learn C++ first and then java second and not the other way around? I want to have a decent grasp on languages before I get to school but I am a little cloudy on the most optimal place to start. I feel like this may have been covered in the first post but I am not sure if the advise would be the same for someone going into the course and not someone already in the course.

Thanks guys.

Well if you know your way around in programming (i.e. paradigms, design patterns, etc), then language doesn't really matter. Pick something that suits you. Or something trendy like Scala or node.js.

Since you have a whole year before school, then you could just learn them all (think of a simple project and build it with scala, node.js, ruby, python, java and c++), doing 1 language/1-2 months.


I am fairly rusty as I spent most of my time focusing on HTML and CSS, while I did learn actionscript and PhP during my colledge diploma (different than the degree I am going for) I mostly forgot the ins and outs of each language as I never really used them. Thanks for the advice, I think the one language every few months plan seems like the best course.

SiKStArCuE
Profile Joined April 2011
United States19 Posts
February 07 2012 00:19 GMT
#2263
I'm having trouble figuring this hw problem out and would appreciate it if anyone could guide me on how to solve it.

Problem A. The values of two float variables, x and y, are saved in IEEE single precision floating point format
as below. Calculate the value of z in IEEE single precision floating point format if z = x + y. You should begin
the calculation with the packed 32-bit representations of x and y and end with the 32-bit packed result for z.

x = 0 11100010 00101100000000000000000
y = 1 11100000 11010000000000000000000
tofucake
Profile Blog Joined October 2009
Hyrule19030 Posts
February 07 2012 00:27 GMT
#2264
People won't give you the answer, but they will help. But we want to know what have you done to try to solve it so far? What particular part are you having trouble with?
Liquipediaasante sana squash banana
SiKStArCuE
Profile Joined April 2011
United States19 Posts
Last Edited: 2012-02-07 01:11:09
February 07 2012 01:09 GMT
#2265
I'm having trouble unpacking the numbers. I know that I need to insert a number into the fractional mantissa to get the true mantissa. However, I don't know how to get that number. Also since the exponents are different I need to get them to be the same. In order to do that do I need to subtact the first number by the second number and then shift the mantissa however many times? I didn't mean to come off as asking for the answer I'm just curious about the steps. Thanks Chris,
eFonSG
Profile Joined November 2010
United States255 Posts
February 07 2012 21:18 GMT
#2266
Hey, i need some help with string manipulation in Java.

Essentially im suppose to take a string from the user that is a word
Im writing a class that with a few different methods that are to help split the word up into syllables and help with pronunciation
For one of my methods, Im suppose to change lets say September into sep/tem/ber. Im not really sure how to go about attacking this. We have rules given for when to break syllables up, how to count them, etc.

"How to identify syllables: We’ll confine ourselves to just two situations, commonly known as the ‘vccv’
and ‘vcv’ rules. As you scan a word from left to right, if you encounter a vowel followed by two consonants
(non-vowels) followed by a vowel, divide between the consonants. For example, “hidden” contains this
pattern and is divided into two syllables: ‘hid/den’. If you see the ‘vcv’ pattern, divide before the
consonant. Thus, “consonant”, which exhibits both patterns, would be divided like this: ‘con/so/nant’."

I just need some direction on a project like this, im pretty lost about where to start. The string were manipulating is user input, so i cant find a consistent way to break it up correctly. Sometimes it feels like my brain just cant make the right connections when it comes to programming -.-
mmp
Profile Blog Joined April 2009
United States2130 Posts
Last Edited: 2012-02-07 21:50:42
February 07 2012 21:48 GMT
#2267
On February 07 2012 04:53 Inori wrote:
Show nested quote +
On February 07 2012 03:52 esotericc wrote:
Read the first page, just getting confirmation that I understood the advice properly, I start a comp sci degree in a year, I already know web languages fairly well and did a couple years free lance development but stopped because there was no market near me and I couldn't afford to move.

Anyway, I take it I should learn C++ first and then java second and not the other way around? I want to have a decent grasp on languages before I get to school but I am a little cloudy on the most optimal place to start. I feel like this may have been covered in the first post but I am not sure if the advise would be the same for someone going into the course and not someone already in the course.

Thanks guys.

Well if you know your way around in programming (i.e. paradigms, design patterns, etc), then language doesn't really matter. Pick something that suits you. Or something trendy like Scala or node.js.

Since you have a whole year before school, then you could just learn them all (think of a simple project and build it with scala, node.js, ruby, python, java and c++), doing 1 language/1-2 months.

node.js is not a particularly useful skill toi have. I would ignore this advice.

Scala is very interesting, but learning & refining your understanding of Java must come first. Scala is not for beginners, and you won't appreciate what it's offering until you've struggled through Java's intricacies. And after using Scala, you may just realize that it is not always the best tool for the job (in which case you might use a combination of JVM languages).

If you're going into CS, study Python and C. Python is a decent flexible language to get a lot of general-purpose stuff done, and it's got tons of support & libraries + language bindings where performance is important. Python is your multi-tool utility knife, learn it well and you shall prosper. As a CS, you must understand how C works or you will never understand anything about modern computer architecture. Your degree will probably demand that you become familiar with assembly programming (x86), maybe embedded device programming, and/or fpga programming: knowledge of C (particularly the call stack conventions, segments & object code linking, memory addresses & pointers) should be prerequisite.

After you understand C, you can debate the merits of C++/C#/Java(/Go/D/...). Most likely your degree will require you to use one of these three languages in a software engineering course.

You will also want to check out lisp, haskell, smalltalk, ocaml, clojure, etc. to get a feel for the alternative school of design that has survived in the shadow of Worse is Better. I think Scala is probably in this category of the Right Thing; it is superengineered to be super awesome, but it ends up becoming terribly difficult to master, adopt in a workplace, and tune for performance.
I (λ (foo) (and (<3 foo) ( T_T foo) (RAGE foo) )) Starcraft
mmp
Profile Blog Joined April 2009
United States2130 Posts
Last Edited: 2012-02-07 22:22:46
February 07 2012 22:15 GMT
#2268
On February 08 2012 06:18 eFonSG wrote:
Hey, i need some help with string manipulation in Java.

Essentially im suppose to take a string from the user that is a word
Im writing a class that with a few different methods that are to help split the word up into syllables and help with pronunciation
For one of my methods, Im suppose to change lets say September into sep/tem/ber. Im not really sure how to go about attacking this. We have rules given for when to break syllables up, how to count them, etc.

"How to identify syllables: We’ll confine ourselves to just two situations, commonly known as the ‘vccv’
and ‘vcv’ rules. As you scan a word from left to right, if you encounter a vowel followed by two consonants
(non-vowels) followed by a vowel, divide between the consonants. For example, “hidden” contains this
pattern and is divided into two syllables: ‘hid/den’. If you see the ‘vcv’ pattern, divide before the
consonant. Thus, “consonant”, which exhibits both patterns, would be divided like this: ‘con/so/nant’."

I just need some direction on a project like this, im pretty lost about where to start. The string were manipulating is user input, so i cant find a consistent way to break it up correctly. Sometimes it feels like my brain just cant make the right connections when it comes to programming -.-

This sounds like homework...

First thing you want to do is think about the problem, think about how you would do it by hand if you were given this task to do instead of the computer. Use pencil & paper to sketch out your strategy.

Once you think you've got a basic strategy laid out, look for exceptional cases, anything you think might break your basic strategy.

Once you have a sound strategy, write it down as a series of logical steps, pseudocode preferably. Abstract over any details, like converting uppercase to lowercase, or how you will break the word into syllables. Just write what is intuitive.

Maybe it is sketched out something like this (don't actually use this, it is non-normative):

variable lower <-- lower_case <-- word
variable vc_form <-- convert_vowels_to_v <-- convert_consonants_to_c <-- lower
for symbol in vc_form:
... details ...


Ok, then in Java, you go and code up the lower_case method, the convert_foo_to_bar methods, etc. Once all of the pieces are put together, you test it. If it fails, then you either (a) didn't assemble one of the pieces correctly, or (b) your strategy failed.

If you think your strategy is getting too large and complicated for this task, then you need to go back to that pseudocode and find a more concise way of expressing your abstractions (how would you instruct a human to do this task?). Very likely, if you are concise enough in your abstraction, there is probably a library or algorithm already in existence to solve a similar problem.

Hint:
+ Show Spoiler +

You shouldn't need to reinvent the wheel.
http://en.wikipedia.org/wiki/Regular_expressions
http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/String.html
I (λ (foo) (and (<3 foo) ( T_T foo) (RAGE foo) )) Starcraft
mmp
Profile Blog Joined April 2009
United States2130 Posts
Last Edited: 2012-02-07 22:49:58
February 07 2012 22:49 GMT
#2269
On February 07 2012 06:21 esotericc wrote:
Thanks for the advice, I think the one language every few months plan seems like the best course.

I think this is a poor course. Going into a degree program, you will be better served by depth of knowledge in a useful language, not shallow familiarity in irrelevant languages (you can adopt them later once you appreciate how irrelevant they are).

Python and C are both practical and relevant, more than any other languages I could recommend. Practical knowledge of Python will let you code up homework, class projects, and personal experiments quickly and with little headache. It's a decent scripting language to know, and is popular in software industry. Deep knowledge in C/C++ will make learning other languages a walk in the park, and is core to your education in computers. You'll do a lot better in compilers, computer languages, operating systems, distributed systems, parallel programming, and other classes that focus on low-level details if you start with an understanding of C.
I (λ (foo) (and (<3 foo) ( T_T foo) (RAGE foo) )) Starcraft
eFonSG
Profile Joined November 2010
United States255 Posts
Last Edited: 2012-02-08 01:45:04
February 07 2012 23:02 GMT
#2270
On February 08 2012 07:15 mmp wrote:
Show nested quote +
On February 08 2012 06:18 eFonSG wrote:
Hey, i need some help with string manipulation in Java.

Essentially im suppose to take a string from the user that is a word
Im writing a class that with a few different methods that are to help split the word up into syllables and help with pronunciation
For one of my methods, Im suppose to change lets say September into sep/tem/ber. Im not really sure how to go about attacking this. We have rules given for when to break syllables up, how to count them, etc.

"How to identify syllables: We’ll confine ourselves to just two situations, commonly known as the ‘vccv’
and ‘vcv’ rules. As you scan a word from left to right, if you encounter a vowel followed by two consonants
(non-vowels) followed by a vowel, divide between the consonants. For example, “hidden” contains this
pattern and is divided into two syllables: ‘hid/den’. If you see the ‘vcv’ pattern, divide before the
consonant. Thus, “consonant”, which exhibits both patterns, would be divided like this: ‘con/so/nant’."

I just need some direction on a project like this, im pretty lost about where to start. The string were manipulating is user input, so i cant find a consistent way to break it up correctly. Sometimes it feels like my brain just cant make the right connections when it comes to programming -.-

This sounds like homework...

First thing you want to do is think about the problem, think about how you would do it by hand if you were given this task to do instead of the computer. Use pencil & paper to sketch out your strategy.

Once you think you've got a basic strategy laid out, look for exceptional cases, anything you think might break your basic strategy.

Once you have a sound strategy, write it down as a series of logical steps, pseudocode preferably. Abstract over any details, like converting uppercase to lowercase, or how you will break the word into syllables. Just write what is intuitive.

Maybe it is sketched out something like this (don't actually use this, it is non-normative):

variable lower <-- lower_case <-- word
variable vc_form <-- convert_vowels_to_v <-- convert_consonants_to_c <-- lower
for symbol in vc_form:
... details ...


Ok, then in Java, you go and code up the lower_case method, the convert_foo_to_bar methods, etc. Once all of the pieces are put together, you test it. If it fails, then you either (a) didn't assemble one of the pieces correctly, or (b) your strategy failed.

If you think your strategy is getting too large and complicated for this task, then you need to go back to that pseudocode and find a more concise way of expressing your abstractions (how would you instruct a human to do this task?). Very likely, if you are concise enough in your abstraction, there is probably a library or algorithm already in existence to solve a similar problem.

Hint:
+ Show Spoiler +

You shouldn't need to reinvent the wheel.
http://en.wikipedia.org/wiki/Regular_expressions
http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/String.html



Hey thanks for the reply, and it is homework; but its self mandated homework. Im doing this out of a book i bought. But thats why i tried not to ask for direct help instead i just wanted some direction. I Want to be able to do this, so just getting the answer doesnt help all that much. One of my problems though, is that this is straight up not that intuitive to me and im very unfamiliar with writing any code by hand. Still, I appreciate the help, and i like the approach you laid out, ill do my best on this see if i can piece it together. Thanks again

Edit: a few hours later and 0 progress, i cant wrap my head around any of this. And ive been doing this for months, i must just be fucking stupid, it will not click in my head.
Kasha_Not_Kesha
Profile Blog Joined October 2011
United States71 Posts
February 07 2012 23:44 GMT
#2271
I had a couple of responses to Crazyeyes, the guy who's post is quoted in the first post, so I figured I'd throw them out there and see what you all think =P

So anyways. As I've mentioned, I'm third year. All of my knowledge in computer programming comes from my classes. I'll admit I'm not the best student, but I do pay attention when I can and I'm not exactly failing my way through this. I don't ever program on my free time or read programming-related things that aren't school related.

This is a huge issue right here. It honestly doesn't even matter that you aren't the best student; the issue is you aren't driven to learn. You need to pursue this stuff in your spare time, and you need to do so because you love it. Math teachers always say "you can't learn math unless you practice it a lot"; the same is true of Computer Science. You can't learn to program unless you do it a lot, and you probably won't do it a lot unless you really truly love it.

Any computer-related(or even technology-related) job you ever get will only be familiar, related to your college education, and simple for a short period of time. In case you weren't aware, computers are leaps and bounds ahead of where they were a mere 10 years ago. Look back 20 years, and it's almost like we're dealing with alien technology. Computer related fields are constantly changing, and if you don't love learning/lack the drive to continually teach yourself new things and keep up to date on the major developments that are going on in your field, you aren't going to be very successful (Unless your job involves computer proficiency, rather than computer science).

Taking a passive approach to learning programming is a pitfall because it sets you up for failure in a big way, and it doesn't prepare you for a future where everything you learned in college is antiquated and discussed in history books. You have to get yourself interested and knowledgeable about this stuff, because eventually the demands placed on you won't come from a professor that also gives you everything you need to know to meet those demands.

The thing is, I feel like I don't know anything. I feel like pepole who have way less education than me are more capable than I am.

They probably are. You don't need (nor, in my opinion, should you really have) someone to teach you how to program; there are guides and tutorials galore available for free online, and knowing how to find them is just another skill every programmer should develop as soon as possible. I'm a sophomore in college at the moment, and I have a friend who is two years younger than me that recently graduated High school and isn't going to college. He's never taken a single programming course in his entire life; I've taken somewhere around 8. Despite all of this, he's a hundred times more knowledgeable about computers in general, and a million times better at programming than I am, because he's so damn interested in it, and he has the drive to teach himself and learn, something I only recently developed in myself.

What I hope is going on is that I'm being given the basic (and hopefully more advanced, too) programming skills and knowledge that can be applied to all computer science, and then the more specific things I'll be able to pick up without too much effort.

If I can give you any advice it's that you not rely on college to teach you ANYTHING. College is more or less a place you go to in order to secure a paper that tells possible employers that you probably aren't too stupid. You won't get anything of value out of college unless you pursue it yourself. Your professors *should* know a hell of a lot, and they are resources you literally can't utilize enough, ever. Ask them questions, ask them for challenges, ask them for interesting topics to look into and read about. Just going to lectures and pulling off B's in all of your classes isn't going to make you a good, or even mediocre programmer. You *have* to work at it yourself and go beyond what is required of you, and the best time to do it is now, while you still have physical access to people that (ideally) know how to answer any questions you could have.
Human beings are literally made up of potential more than anything else.
thedz
Profile Blog Joined March 2011
United States217 Posts
February 07 2012 23:52 GMT
#2272
Any computer-related(or even technology-related) job you ever get will only be familiar, related to your college education, and simple for a short period of time. In case you weren't aware, computers are leaps and bounds ahead of where they were a mere 10 years ago. Look back 20 years, and it's almost like we're dealing with alien technology.


This.

When I'm hiring, candidates that have an existing GitHub or similar account with code that I can look at and appreciate almost always have the leg up, even if someone else has a more impressive educational background. That said, this is in the SF Bay Area, where practical experience trumps nearly everything.
shannn
Profile Blog Joined May 2010
Netherlands2891 Posts
February 08 2012 00:05 GMT
#2273
On February 08 2012 08:44 Kasha_Not_Kesha wrote:
I had a couple of responses to Crazyeyes, the guy who's post is quoted in the first post, so I figured I'd throw them out there and see what you all think =P

Show nested quote +
So anyways. As I've mentioned, I'm third year. All of my knowledge in computer programming comes from my classes. I'll admit I'm not the best student, but I do pay attention when I can and I'm not exactly failing my way through this. I don't ever program on my free time or read programming-related things that aren't school related.

This is a huge issue right here. It honestly doesn't even matter that you aren't the best student; the issue is you aren't driven to learn. You need to pursue this stuff in your spare time, and you need to do so because you love it. Math teachers always say "you can't learn math unless you practice it a lot"; the same is true of Computer Science. You can't learn to program unless you do it a lot, and you probably won't do it a lot unless you really truly love it.

Any computer-related(or even technology-related) job you ever get will only be familiar, related to your college education, and simple for a short period of time. In case you weren't aware, computers are leaps and bounds ahead of where they were a mere 10 years ago. Look back 20 years, and it's almost like we're dealing with alien technology. Computer related fields are constantly changing, and if you don't love learning/lack the drive to continually teach yourself new things and keep up to date on the major developments that are going on in your field, you aren't going to be very successful (Unless your job involves computer proficiency, rather than computer science).

Taking a passive approach to learning programming is a pitfall because it sets you up for failure in a big way, and it doesn't prepare you for a future where everything you learned in college is antiquated and discussed in history books. You have to get yourself interested and knowledgeable about this stuff, because eventually the demands placed on you won't come from a professor that also gives you everything you need to know to meet those demands.

Show nested quote +
The thing is, I feel like I don't know anything. I feel like pepole who have way less education than me are more capable than I am.

They probably are. You don't need (nor, in my opinion, should you really have) someone to teach you how to program; there are guides and tutorials galore available for free online, and knowing how to find them is just another skill every programmer should develop as soon as possible. I'm a sophomore in college at the moment, and I have a friend who is two years younger than me that recently graduated High school and isn't going to college. He's never taken a single programming course in his entire life; I've taken somewhere around 8. Despite all of this, he's a hundred times more knowledgeable about computers in general, and a million times better at programming than I am, because he's so damn interested in it, and he has the drive to teach himself and learn, something I only recently developed in myself.

Show nested quote +
What I hope is going on is that I'm being given the basic (and hopefully more advanced, too) programming skills and knowledge that can be applied to all computer science, and then the more specific things I'll be able to pick up without too much effort.

If I can give you any advice it's that you not rely on college to teach you ANYTHING. College is more or less a place you go to in order to secure a paper that tells possible employers that you probably aren't too stupid. You won't get anything of value out of college unless you pursue it yourself. [Your professors *should* know a hell of a lot, and they are resources you literally can't utilize enough, ever. Ask them questions, ask them for challenges, ask them for interesting topics to look into and read about. Just going to lectures and pulling off B's in all of your classes isn't going to make you a good, or even mediocre programmer. You *have* to work at it yourself and go beyond what is required of you, and the best time to do it is now, while you still have physical access to people that (ideally) know how to answer any questions you could have.

This man speaks the truth

Out of 40 or so CS students in my senior year probably less than 8 people know how to program, know the concepts and have the basics under control.
The degree really really says nothing when it comes to CS at my college tbh.

My study in the past 3.5 years so far consisted 75% of how to work with tools like PowerDesigner, PowerBuilder, ISAH etc and learning ITIL v2. I can't see myself working with any of these tools.
I was lucky enough that I was programming on the side for my part-time job and for fun.

If I knew anyone RL who is planning to study CS then I'd just quote the above poster and tell him exactly that especially the first bolded part.
http://www.teamliquid.net/forum/viewpost.php?post_id=6321864 Epic post.
mmp
Profile Blog Joined April 2009
United States2130 Posts
Last Edited: 2012-02-08 02:18:02
February 08 2012 02:08 GMT
#2274
On February 08 2012 08:02 eFonSG wrote:
Show nested quote +
On February 08 2012 07:15 mmp wrote:
On February 08 2012 06:18 eFonSG wrote:
Hey, i need some help with string manipulation in Java.

Essentially im suppose to take a string from the user that is a word
Im writing a class that with a few different methods that are to help split the word up into syllables and help with pronunciation
For one of my methods, Im suppose to change lets say September into sep/tem/ber. Im not really sure how to go about attacking this. We have rules given for when to break syllables up, how to count them, etc.

"How to identify syllables: We’ll confine ourselves to just two situations, commonly known as the ‘vccv’
and ‘vcv’ rules. As you scan a word from left to right, if you encounter a vowel followed by two consonants
(non-vowels) followed by a vowel, divide between the consonants. For example, “hidden” contains this
pattern and is divided into two syllables: ‘hid/den’. If you see the ‘vcv’ pattern, divide before the
consonant. Thus, “consonant”, which exhibits both patterns, would be divided like this: ‘con/so/nant’."

I just need some direction on a project like this, im pretty lost about where to start. The string were manipulating is user input, so i cant find a consistent way to break it up correctly. Sometimes it feels like my brain just cant make the right connections when it comes to programming -.-

This sounds like homework...

First thing you want to do is think about the problem, think about how you would do it by hand if you were given this task to do instead of the computer. Use pencil & paper to sketch out your strategy.

Once you think you've got a basic strategy laid out, look for exceptional cases, anything you think might break your basic strategy.

Once you have a sound strategy, write it down as a series of logical steps, pseudocode preferably. Abstract over any details, like converting uppercase to lowercase, or how you will break the word into syllables. Just write what is intuitive.

Maybe it is sketched out something like this (don't actually use this, it is non-normative):

variable lower <-- lower_case <-- word
variable vc_form <-- convert_vowels_to_v <-- convert_consonants_to_c <-- lower
for symbol in vc_form:
... details ...


Ok, then in Java, you go and code up the lower_case method, the convert_foo_to_bar methods, etc. Once all of the pieces are put together, you test it. If it fails, then you either (a) didn't assemble one of the pieces correctly, or (b) your strategy failed.

If you think your strategy is getting too large and complicated for this task, then you need to go back to that pseudocode and find a more concise way of expressing your abstractions (how would you instruct a human to do this task?). Very likely, if you are concise enough in your abstraction, there is probably a library or algorithm already in existence to solve a similar problem.

Hint:
+ Show Spoiler +

You shouldn't need to reinvent the wheel.
http://en.wikipedia.org/wiki/Regular_expressions
http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/String.html



Hey thanks for the reply, and it is homework; but its self mandated homework. Im doing this out of a book i bought. But thats why i tried not to ask for direct help instead i just wanted some direction. I Want to be able to do this, so just getting the answer doesnt help all that much. One of my problems though, is that this is straight up not that intuitive to me and im very unfamiliar with writing any code by hand. Still, I appreciate the help, and i like the approach you laid out, ill do my best on this see if i can piece it together. Thanks again

How would you tell a human (me, for example) to do this task in English instructions? Your book told you to "divide between the consonants" in a word. That's a very high-level instruction, so break it down into terms that make a little more sense for a machine.


(1) You are given a word (String) as input.
(2) The word is a sequence of characters, either classified as "consonants"|"c" or "vowels"|"v".
(3) Output a new String that is the word with a "/" character inserted everywhere "vc" is followed by "cv" and everywhere "v" is followed by "cv".


This appears to be the same problem, just stated at a lower level. Which parts appear easy to translate into Java, which parts do not? (1) just fetches the argument from the user. (2) is some discrimination of vowel & consonant characters in the word. (3) does some kind of scanning to figure out everywhere the "vccv" & "vcv" patterns occur, and it magically comes up with a new word that has all of the "/"s inserted.

Your task is to figure out what that magic component is and dissect it into terms as simple as (1) or (2). This is a top-down problem-solving approach, breaking something abstract down into smaller concrete pieces until the entire task is understood. But when you're trying to solve a tough problem, you have to break it down into the parts that you do understand and the parts that you do not; if you understand everything about a problem except one thing, then you can ignore everything else and try to answer that one smaller problem.

So the big problem here is breaking down the magic:
(a) How do we scan for "vccv" & "vcv"?
(b) Once we've found an instance of either, where do we put the "/"? That is, we need to remember or store in some way the occurrence of a new syllable.
(c) However we've scanned the word and analyzed it, we need to form a new word now that has "/"s.
I (λ (foo) (and (<3 foo) ( T_T foo) (RAGE foo) )) Starcraft
mmp
Profile Blog Joined April 2009
United States2130 Posts
February 08 2012 02:16 GMT
#2275
A really cool high-level talk on persistent hash maps in clojure:
http://blip.tv/clojure/clojure-concurrency-819147
I (λ (foo) (and (<3 foo) ( T_T foo) (RAGE foo) )) Starcraft
Kasha_Not_Kesha
Profile Blog Joined October 2011
United States71 Posts
Last Edited: 2012-02-08 15:02:39
February 08 2012 04:55 GMT
#2276
On February 08 2012 08:02 eFonSG wrote:
Edit: a few hours later and 0 progress, i cant wrap my head around any of this. And ive been doing this for months, i must just be fucking stupid, it will not click in my head.

I'm being as serious as I can when I say this; welcome to programming. Programming is all about that state of "huhwah" following your introduction to a problem. First off, you have to understand the concepts intrinsic to the problem itself, i.e. if you weren't a programmer, but in expert in the field most closely related to the problem, how would you solve the problem? That alone is a pretty considerable burden for you. Then you have to break it down into a set of sub-problems you can solve, and get to work solving them. Sometimes you run into something that doesn't seem simple or easy to solve; i.e. it's a pretty major problem that you can't break apart, but which seems pretty hefty. At that point, you should assume there's an easier way, and start trying to find that easier way.

Trust me when I say that it has nothing to do with your intelligence or problem solving ability; you're just fundamentally approaching the problem the wrong way, which is not necessarily a negative thing because there are a ton of ways to approach the problem, and only a few are helpful. You don't have the experience needed to immediately know the proper approach to the problem, which is fine, because once you solve this one, you'll be able to apply variations of this solution to tons of problems you might run into down the line. You've been programming for months; I've been programming for years and this problem was still a bit difficult for me to solve.

And let me tell you; the problem you're working on is a fun/frustrating one. Hopefully you have a decent grasp of the Object Oriented paradigm, because if you're doing all of this functionally it's going to be hell to try and organize the code you write.

I literally just finished something similar to what you have to do here, and if you would like I can tell you two Java classes that will make the solution a lot easier to find. Let me know; I don't want to spoil the research side of it if you want to try to find them on your own, I just know that I wouldn't have found them without my infinitely more knowledgeable friends' help.
Human beings are literally made up of potential more than anything else.
Deleted User 61629
Profile Blog Joined March 2010
1664 Posts
February 08 2012 15:15 GMT
#2277
--- Nuked ---
silentsaint
Profile Joined September 2010
Germany540 Posts
February 09 2012 21:31 GMT
#2278
Does anyone know a good book about c#?
It really tied the room together.
Kasha_Not_Kesha
Profile Blog Joined October 2011
United States71 Posts
February 09 2012 21:47 GMT
#2279
Programming books are very rarely worth the money. If you're trying to teach yourself how to program in a specific language, it's usually easier and cheaper (and more beneficial in the long run) to look up tutorials online. That's my opinion anyway =P
Human beings are literally made up of potential more than anything else.
Frigo
Profile Joined August 2009
Hungary1023 Posts
February 09 2012 22:26 GMT
#2280
On February 10 2012 06:47 Kasha_Not_Kesha wrote:
Programming books are very rarely worth the money. If you're trying to teach yourself how to program in a specific language, it's usually easier and cheaper (and more beneficial in the long run) to look up tutorials online. That's my opinion anyway =P

Read Clean Code: A Handbook of Agile Software Craftsmanship, I doubt you will find that in tutorials.
http://www.fimfiction.net/user/Treasure_Chest
Prev 1 112 113 114 115 116 1031 Next
Please log in or register to reply.
Live Events Refresh
Next event in 5h 18m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Nina 200
JuggernautJason126
ProTech83
StarCraft: Brood War
Calm 2558
Dewaltoss 124
ZZZero.O 96
NaDa 20
Shine 15
MaD[AoV]4
Dota 2
capcasts128
NeuroSwarm29
League of Legends
JimRising 621
Counter-Strike
flusha732
Foxcn270
taco 173
Heroes of the Storm
Liquid`Hasu538
Other Games
summit1g6638
Grubby4157
tarik_tv3010
FrodaN1662
fl0m853
ZombieGrub223
Pyrionflax164
ViBE122
Sick66
PPMD27
Organizations
Other Games
BasetradeTV43
StarCraft 2
angryscii 24
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 19 non-featured ]
StarCraft 2
• RyuSc2 67
• davetesta45
• LUISG 16
• IndyKCrew
• sooper7s
• Migwel
• AfreecaTV YouTube
• intothetv
• LaughNgamezSOOP
• Kozan
StarCraft: Brood War
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• masondota21343
League of Legends
• Doublelift5156
• Jankos3028
Other Games
• Scarra1333
• imaqtpie798
• Shiphtur295
Upcoming Events
Korean StarCraft League
5h 18m
CranKy Ducklings
12h 18m
RSL Revival
12h 18m
ByuN vs Cham
herO vs Reynor
FEL
18h 18m
RSL Revival
1d 12h
Clem vs Classic
SHIN vs Cure
FEL
1d 14h
BSL: ProLeague
1d 20h
Dewalt vs Bonyth
Replay Cast
3 days
Sparkling Tuna Cup
3 days
The PondCast
4 days
[ Show More ]
Replay Cast
5 days
RSL Revival
5 days
Replay Cast
6 days
RSL Revival
6 days
Liquipedia Results

Completed

Proleague 2025-06-28
HSC XXVII
Heroes 10 EU

Ongoing

JPL Season 2
BSL 2v2 Season 3
BSL Season 20
Acropolis #3
KCM Race Survival 2025 Season 2
CSL 17: 2025 SUMMER
Copa Latinoamericana 4
Championship of Russia 2025
RSL Revival: Season 1
Murky Cup #2
BLAST.tv Austin Major 2025
ESL Impact League Season 7
IEM Dallas 2025
PGL Astana 2025
Asian Champions League '25
BLAST Rivals Spring 2025
MESA Nomadic Masters
CCT Season 2 Global Finals
IEM Melbourne 2025

Upcoming

2025 ACS Season 2: Qualifier
CSLPRO Last Chance 2025
2025 ACS Season 2
CSLPRO Chat StarLAN 3
K-Championship
uThermal 2v2 Main Event
SEL Season 2 Championship
FEL Cracov 2025
Esports World Cup 2025
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.