• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 06:14
CEST 12:14
KST 19:14
  • 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
Code S Season 1 - RO8 Preview6[ASL21] Ro8 Preview Pt2: Progenitors8Code S Season 1 - RO12 Group A: Rogue, Percival, Solar, Zoun13[ASL21] Ro8 Preview Pt1: Inheritors16[ASL21] Ro16 Preview Pt2: All Star10
Community News
Maestros of The Game 2 announcement and schedule !7Weekly Cups (April 27-May 4): Clem takes triple0RSL Revival: Season 5 - Qualifiers and Main Event12Code S Season 1 (2026) - RO12 Results12026 GSL Season 1 Qualifiers25
StarCraft 2
General
Code S Season 1 - RO8 Preview Behind the Blue - Team Liquid History Book Weekly Cups (April 27-May 4): Clem takes triple Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool Code S Season 1 (2026) - RO12 Results
Tourneys
Sparkling Tuna Cup - Weekly Open Tournament Sea Duckling Open (Global, Bronze-Diamond) Maestros of The Game 2 announcement and schedule ! GSL Code S Season 1 (2026) RSL Revival: Season 5 - Qualifiers and Main Event
Strategy
Custom Maps
[D]RTS in all its shapes and glory <3 [A] Nemrods 1/4 players
External Content
Mutation # 524 Death and Taxes The PondCast: SC2 News & Results Mutation # 523 Firewall Mutation # 522 Flip My Base
Brood War
General
Quality of life changes in BW that you will like ? Why there arent any 256x256 pro maps? BGH Auto Balance -> http://bghmmr.eu/ RepMastered™: replay sharing and analyzer site Tulbo's ASL S21 Ro8 Post-Review
Tourneys
[ASL21] Ro8 Day 4 [ASL21] Ro8 Day 3 Escore Tournament StarCraft Season 2 [Megathread] Daily Proleagues
Strategy
Simple Questions, Simple Answers Fighting Spirit mining rates What's the deal with APM & what's its true value Any training maps people recommend?
Other Games
General Games
Path of Exile Stormgate/Frost Giant Megathread Nintendo Switch Thread Daigo vs Menard Best of 10 OutLive 25 (RTS Game)
Dota 2
The Story of Wings Gaming
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas TL Mafia Community Thread Five o'clock TL Mafia
Community
General
US Politics Mega-thread The Letting Off Steam Thread European Politico-economics QA Mega-thread UK Politics Mega-thread Canadian Politics Mega-thread
Fan Clubs
The IdrA Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece [Req][Books] Good Fantasy/SciFi books
Sports
2024 - 2026 Football Thread McBoner: A hockey love story Formula 1 Discussion
World Cup 2022
Tech Support
streaming software Strange computer issues (software) [G] How to Block Livestream Ads
TL Community
The Automated Ban List
Blogs
How EEG Data Can Predict Gam…
TrAiDoS
ramps on octagon
StaticNine
Funny Nicknames
LUCKY_NOOB
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1417 users

The Big Programming Thread - Page 519

Forum Index > General Forum
Post a Reply
Prev 1 517 518 519 520 521 1032 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.
nunez
Profile Blog Joined February 2011
Norway4003 Posts
September 15 2014 23:30 GMT
#10361
hahaha.
conspired against by a confederacy of dunces.
Ben...
Profile Joined January 2011
Canada3485 Posts
Last Edited: 2014-09-16 00:35:14
September 16 2014 00:33 GMT
#10362
Yesterday I forgot that in some cases you need to put -l flags along with your -L$(DIRECTORY) business before -o flags when using a custom library and linking or gcc will not be able to find the required library.

That hour and a half of frustration before remembering that tidbit was my equivalent of a blood sacrifice to the linker gods (it only broke when using object files and trying to link them).

Luckily, today I solved a different linking issue in that same makefile in about 5 minutes.

The linker gods shine brightly upon me today. I shall mark this day in the history books.
"Cliiiiiiiiiiiiiiiiide" -Tastosis
ZenithM
Profile Joined February 2011
France15952 Posts
September 16 2014 00:50 GMT
#10363
On September 16 2014 08:08 RoyGBiv_13 wrote:
Show nested quote +
On September 15 2014 07:09 nunez wrote:
all my programs are silent prayers to gcc:
take onto you my ungodly syntax, and bring forth the indended semantic.


Compilers are one-file-in-one-file-out programs, how hard could they be? Linkers are the true deity.

+ Show Spoiler +

Our Linker in binary,
+x be thy permissions.
Your ELF, COFF, and PE come,
your allocation be done,
on our binary as it is in yours.
Give us libraries for our executable,
and forgive us our bugs,
as we have forgiven our compiler.
And lead us not into warnings,
but deliver us from errors.
Amen

Take unto Thee, this list of blessed libraries, modules, and symbol tables. Let it be to Your eternal satisfaction that all instances of symbols are singularly defined, and that no COMMONS exist. Amen.

Haha that's good. And so true.
Epishade
Profile Blog Joined November 2011
United States2267 Posts
September 16 2014 06:51 GMT
#10364
I hope my question makes sense - I just started Java and I have almost no idea what I'm doing.

I am creating an instance of a class in my Driver using a while loop that asks the user if they want to continue running the program and entering in different values again. I need to have a running total of some variables (cost subtotals etc) that are calculated when the class is created. Each time I rerun the loop though, the subtotals reset to zero.

Here's my while-loop in my driver right now.
+ Show Spoiler +


while (goAgain == 'Y' || goAgain == 'y')
{
System.out.print ("Enter item price: ");
price = input.nextDouble();
System.out.print ("Enter percent discount: ");
percentDiscount = input.nextDouble();
System.out.print ("Enter tax rate: ");
TAX_RATE = input.nextDouble();

new ItemSale(price, percentDiscount, TAX_RATE);

System.out.print ("Would you like to add more items? Y or N: ");
goAgain = input.next().charAt(0);
}



Does the recreation of ItemSale in each loop reset all of the values back to zero (or whatever I set the values to in the constructor) that were in there from the previous iteration? For example, I used TAX_RATE to find the tax value of an item in a method in ItemSale. I wanted to keep a running total of the tax value of all of the items that the user wants to add, but each repeat, the running total goes back to zero.

If it does, I'm not entirely sure how to proceed from here then. If it doesn't, then I guess I'm stuck somewhere else and can't find where to fix it.
Pinhead Larry in the streets, Dirty Dan in the sheets.
icystorage
Profile Blog Joined November 2008
Jollibee19350 Posts
September 16 2014 07:01 GMT
#10365
maybe because you are instantiating ItemSale over and over again? where do you store the running total? what does ItemSale() look like?
LiquidDota StaffAre you ready for a Miracle-? We are! The International 2017 Champions!
Furikawari
Profile Joined February 2014
France2522 Posts
September 16 2014 07:04 GMT
#10366
This line :

new ItemSale(price, percentDiscount, TAX_RATE);

creates a new object. It creates a new reference to a new object, meaning, it uses free spots in the memory. So yes, basically all members of this object are reinitialized in each iteration.

Here you have to problems: design and how to use objects.
I'm not sure of the way you want to handle your sum of taxes, but the object that will contain this value must be declared prior to the entrance in the while in order to be known in each iteration of the while.
Probably that you want to save your ItemSale. So you should have something like :

ItemSale currentItemSale = new ItemSale(price, percentDiscount, TAX_RATE);
itemSales.add(currenItemSale);

With itemSales being a list declared before you enter the while loop.

Another word: by convention, variables in upper letters are constants. So TAXE_RATE should be taxRate in your case, as it is specified for each item. It's not an error, just a convention used by most java programmers.

HTH!
Epishade
Profile Blog Joined November 2011
United States2267 Posts
Last Edited: 2014-09-16 07:17:49
September 16 2014 07:15 GMT
#10367
Darn, I was afraid of that, but I kind of had a feeling that that was the problem, as nothing else seemed like it would have been resetting my values. Thanks.

On September 16 2014 16:01 icystorage wrote:
maybe because you are instantiating ItemSale over and over again? where do you store the running total? what does ItemSale() look like?


I was storing running total in the methods inside ItemSale(), which is why I suppose they were getting wiped each time I reran through the loop.
Pinhead Larry in the streets, Dirty Dan in the sheets.
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
Last Edited: 2014-09-16 13:45:37
September 16 2014 13:34 GMT
#10368
ughhh stupid makefiles

had a rule

EXECS : ${EXEC1} ${EXEC2} ${EXEC3} ${EXEC0}

EXEC2 always fails cause there are no files with the name

was wondering for 3 hours why EXEC0 never built.... i felt so dumb when i realized -____-"
There is no one like you in the universe.
Ben...
Profile Joined January 2011
Canada3485 Posts
Last Edited: 2014-09-16 16:44:19
September 16 2014 16:41 GMT
#10369
On September 16 2014 22:34 Blisse wrote:
ughhh stupid makefiles

had a rule

EXECS : ${EXEC1} ${EXEC2} ${EXEC3} ${EXEC0}

EXEC2 always fails cause there are no files with the name

was wondering for 3 hours why EXEC0 never built.... i felt so dumb when i realized -____-"

That's not so bad. I spent multiple hours trying to get a custom library to work in a makefile.

What it ended up being:

LIB=-L/.../doc/...


when it was supposed to be:

LIB=-L/.../docs/...


I didn't notice for a fairly long time. Added the s and everything compiled perfectly. Felt like a complete idiot for the rest of the day.

That led to my other situation in my previous post. The library would be found correctly when making the object file but not when linking. Ended up burning like 3 hours on a tiny thing. Was not impressed with myself.
"Cliiiiiiiiiiiiiiiiide" -Tastosis
RoyGBiv_13
Profile Blog Joined August 2010
United States1275 Posts
Last Edited: 2014-09-16 22:01:37
September 16 2014 22:00 GMT
#10370
Makefiles are the greatest time saver ever until they aren't.

My company has its own custom project file format. It makes entirely too much sense. Especially when compared to make.

Also, you only need to get bitten by -L, -l, and #include <> versus "" once before you know what to look for, which is nice. It's guaranteed you're going to bump into it at least once though.

Linker directive files are for wizards. Each one I look at I find a new piece of syntax I never knew existed. There is no specification for them, and every linker has it's own syntactical sugar.

+ Show Spoiler +
from a piece of documentation I read today: Calling this function on the same Task twice will result in undesirable behavior.

No joke, it crashed the entire system...
Any sufficiently advanced technology is indistinguishable from magic
nunez
Profile Blog Joined February 2011
Norway4003 Posts
September 16 2014 23:06 GMT
#10371
i consequently use #include<>.
oh, how it pleases the eye.

today i got a part time job offer from the company i programmed for this summer.
they had told me they would probably offer one, but it took longer time than i expected.
i made the logical conclusion over a week ago: they took an actual look at the code i wrote and burned every computer that had compiled it.

this confidence boost brings me back into balance. of course it might be a trap, they want me to come in so they can finish the cleansing for good.
conspired against by a confederacy of dunces.
Cyx.
Profile Joined November 2010
Canada806 Posts
September 16 2014 23:42 GMT
#10372
On September 17 2014 08:06 nunez wrote:
i consequently use #include<>.
oh, how it pleases the eye.

today i got a part time job offer from the company i programmed for this summer.
they had told me they would probably offer one, but it took longer time than i expected.
i made the logical conclusion over a week ago: they took an actual look at the code i wrote and burned every computer that had compiled it.

this confidence boost brings me back into balance. of course it might be a trap, they want me to come in so they can finish the cleansing for good.

Haha this is exactly how I felt last week when my summer company did the same... now I'm fixing a bunch of bugs in all the stuff I wrote this summer rofl
nunez
Profile Blog Joined February 2011
Norway4003 Posts
September 17 2014 00:37 GMT
#10373
that does not bode well!
conspired against by a confederacy of dunces.
Cyx.
Profile Joined November 2010
Canada806 Posts
September 17 2014 01:49 GMT
#10374
On September 17 2014 09:37 nunez wrote:
that does not bode well!

awh it's okay, that's just for the first week or so =P but prepare to get a few bug reports if you wrote anything big near the end of the summer rofl
Millitron
Profile Blog Joined August 2010
United States2611 Posts
Last Edited: 2014-09-17 02:02:37
September 17 2014 02:01 GMT
#10375
On September 17 2014 01:41 Ben... wrote:
Show nested quote +
On September 16 2014 22:34 Blisse wrote:
ughhh stupid makefiles

had a rule

EXECS : ${EXEC1} ${EXEC2} ${EXEC3} ${EXEC0}

EXEC2 always fails cause there are no files with the name

was wondering for 3 hours why EXEC0 never built.... i felt so dumb when i realized -____-"

That's not so bad. I spent multiple hours trying to get a custom library to work in a makefile.

What it ended up being:

LIB=-L/.../doc/...


when it was supposed to be:

LIB=-L/.../docs/...


I didn't notice for a fairly long time. Added the s and everything compiled perfectly. Felt like a complete idiot for the rest of the day.

That led to my other situation in my previous post. The library would be found correctly when making the object file but not when linking. Ended up burning like 3 hours on a tiny thing. Was not impressed with myself.

If we're talking about annoying problems, I got a dilly.

I had to make a sudoku game for a User Interfaces course. It was a semester-long project in which each chapter would end with us implementing the chapter topic in the game. For instance, an early one was to split the game up into an MVC-style program. Anyways, it is the night before the assignment is due, and I am putting what I think is the finishing touches on. 11PM rolls around, and suddenly this program which was nearly complete and running great starts crashing constantly. 7 hours later, and it's 6AM and I find the problem. Somewhere along the way, I had lost a close-parenthesis, and eclipse neglected to tell me. But now I find a few more minor problems and end up working on it until 30 minutes before I present.

tl;dr:
One missed parenthesis almost cost me a semester long project.
Who called in the fleet?
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
Last Edited: 2014-09-17 02:35:49
September 17 2014 02:20 GMT
#10376
haha, maybe not on one parenthesis level, but this was a makefile error. worked on my machine, did not compile on submission servers. deadline was 11:59 :p can you feel the pain hahaha

+ Show Spoiler +
[image loading]
There is no one like you in the universe.
Millitron
Profile Blog Joined August 2010
United States2611 Posts
September 17 2014 03:35 GMT
#10377
That's the stuff nightmares are made of.
Who called in the fleet?
icystorage
Profile Blog Joined November 2008
Jollibee19350 Posts
September 17 2014 03:47 GMT
#10378
rofl. felt it.
LiquidDota StaffAre you ready for a Miracle-? We are! The International 2017 Champions!
amazingxkcd
Profile Blog Joined September 2010
GRAND OLD AMERICA16375 Posts
September 17 2014 17:02 GMT
#10379
Anyone ever used angularJS or meteorJS to create a front end for exposing an API (documentation)? I'm rebuilding the API docs in house at my work and i want it to look sleek and smooth. back end would run off node

If i could get some tips or tricks for designing this stuff would be appreciated since I never done any web dev before (I'm a soft dev, test guy)
The world is burning and you rather be on this terrible website discussing video games and your shallow feelings
ZenithM
Profile Joined February 2011
France15952 Posts
September 17 2014 18:54 GMT
#10380
On September 17 2014 11:20 Blisse wrote:
haha, maybe not on one parenthesis level, but this was a makefile error. worked on my machine, did not compile on submission servers. deadline was 11:59 :p can you feel the pain hahaha

+ Show Spoiler +
[image loading]

Been there, done that haha. Good (and terrifying) stuff.
Prev 1 517 518 519 520 521 1032 Next
Please log in or register to reply.
Live Events Refresh
RSL Revival
10:00
Season 5: Group D
Cure vs Zoun
Clem vs Lambo
Tasteless627
IntoTheiNu 386
Ryung 222
Rex35
IndyStarCraft 14
LiquipediaDiscussion
Sparkling Tuna Cup
10:00
Weekly #131 (TLMC 22 Edition)
MiniZergUA vs ExostrikerLIVE!
Classic vs TBD
CranKy Ducklings25
CranKy Ducklings SOOP7
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Tasteless 627
Ryung 222
Rex 35
IndyStarCraft 14
StarCraft: Brood War
BeSt 457
Hyuk 293
ZerO 249
sorry 81
Shine 80
Mind 77
Pusan 63
Movie 62
JulyZerg 58
Nal_rA 51
[ Show more ]
Backho 40
Last 33
zelot 32
910 31
Shinee 22
yabsab 20
Noble 7
Liquid`Ret 2
Dota 2
Gorgc3607
monkeys_forever167
XcaliburYe95
Other Games
gofns14276
singsing1465
B2W.Neo391
KnowMe117
DeMusliM20
ZerO(Twitch)18
MindelVK10
Organizations
Counter-Strike
PGL31871
Other Games
gamesdonequick2451
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 17 non-featured ]
StarCraft 2
• Berry_CruncH278
• LUISG 29
• Adnapsc2 15
• IndyKCrew
• sooper7s
• Migwel
• LaughNgamezSOOP
• Kozan
• intothetv
• AfreecaTV YouTube
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Nemesis3476
• Jankos1262
• TFBlade1175
Other Games
• WagamamaTV180
Upcoming Events
WardiTV Invitational
1h 46m
ByuN vs Rogue
Solar vs Ryung
Zoun vs Percival
Cure vs SHIN
BSL
8h 46m
Dewalt vs DragOn
Aether vs Jimin
GSL
21h 46m
Afreeca Starleague
23h 46m
Soma vs Leta
Wardi Open
1d 1h
Monday Night Weeklies
1d 5h
OSC
1d 13h
CranKy Ducklings
1d 23h
Afreeca Starleague
1d 23h
Light vs Flash
Replay Cast
2 days
[ Show More ]
Replay Cast
3 days
The PondCast
3 days
Replay Cast
4 days
RSL Revival
4 days
Korean StarCraft League
5 days
RSL Revival
5 days
BSL
6 days
GSL
6 days
Cure vs TBD
TBD vs Maru
Liquipedia Results

Completed

Escore Tournament S2: W6
WardiTV TLMC #16
Nations Cup 2026

Ongoing

BSL Season 22
ASL Season 21
CSL 2026 SPRING (S20)
IPSL Spring 2026
KCM Race Survival 2026 Season 2
Acropolis #4
KK 2v2 League Season 1
BSL 22 Non-Korean Championship
SCTL 2026 Spring
RSL Revival: Season 5
2026 GSL S1
PGL Astana 2026
BLAST Rivals Spring 2026
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2

Upcoming

YSL S3
Escore Tournament S2: W7
Escore Tournament S2: W8
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
Maestros of the Game 2
2026 GSL S2
BLAST Bounty Summer 2026: Closed Qualifier
Stake Ranked Episode 3
XSE Pro League 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
Asian Champions League 2026
IEM Atlanta 2026
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 © 2026 TLnet. All Rights Reserved.