• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 04:55
CEST 10:55
KST 17:55
  • 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
[ASL22] Ro16 Preview: Rough Waters10[ASL22] Ro24 Preview: Siren's Call8[ASL22] Ro24 Preview: Summer's End9Serral wins HomeStory Cup 2915Serral wins Maestros of the Game 244
Community News
StarCraft open world shooter announced at BlizzCon57Weekly Cups (Aug 30-Sep 7): herO thrives amid growing schism10Official StarCraft website teases new content ahead of BlizzCon?168Stellar Fest TWO the Moon (Dec 16-20)9Weekly Cups (August 24-30): Patches' balance mod takes over3
StarCraft 2
General
StarCraft open world shooter announced at BlizzCon How do you feel about the StarCraft shooter announcement at BlizzCon 2026? Balance hotfix patch 5.0.16b (July 16) Team Liquid Map Contest #22: Results and Winners Weekly Cups (Aug 30-Sep 7): herO thrives amid growing schism
Tourneys
RSL goes to London! 2026 Offline Finals Nov 21-22 KSL Week #92 IntoTheTV X SOOP SC2 League : Weekly & Monthly 2026 GSTL Announcement Sparkling Tuna Cup - Weekly Open Tournament
Strategy
[G] Having the right mentality to improve
Custom Maps
Nexus Wars 2021 GUIDE [M] (2) Industrial Park
External Content
Mutation # 542 The Ascended Mutation # 541 Binary Choice The PondCast: SC2 News & Results Mutation # 540 Dodge This
Brood War
General
Official StarCraft website teases new content ahead of BlizzCon? BGH Auto Balance -> http://bghmmr.eu/ Broodwar Prediction Market Practice Partners (Official) [D] Brainstorming a balance patch for Brood war
Tourneys
[ASL22] Ro16 Group B [ASL22] Ro16 Group A Escore Tournament - Season 3 Small VOD Thread 2.0
Strategy
Replay Review Process - What do you do? Simple Questions, Simple Answers Odyssey Mineral Stack Saturation Game Theory for Starcraft
Other Games
General Games
Diablo IV EVE Corporation Nintendo Switch Thread [Maplestory Hardcore] Let's Play~!! General RTS Discussion Thread
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
[TL LoL EUW IHs] Teemo shall perish TSM pausing esports and CLG Dead
Heroes of the Storm
Heroes of the Storm 2.0
Hearthstone
Deck construction bug
TL Mafia
TL Mafia Community Thread
Community
General
US Politics Mega-thread Trading/Investing Thread UK Politics Mega-thread Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread
Fan Clubs
MarineLorD Fan Club The Creator Fan Club The ShoWTimE Fan Club
Media & Entertainment
Diablo Animated Series on Netflix Movie Discussion!
Sports
Football (Soccer) Thread TeamLiquid Health and Fitness Initiative For 2023 MLB/Baseball 2023
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List Northern Ireland Global Starcraft
Blogs
Virtual Romance, Real-Life C…
TrAiDoS
Regacy Esports:Our Goa…
regacyesports
Dreaming of BW patches (mod…
c3rberUs
LOCKPICKING NOOB
LUCKY_NOOB
Customize Sidebar...

Website Feedback

Closed Threads



Active: 5021 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
Next event in 1h 5m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Trap 41
StarCraft: Brood War
Shuttle 7076
firebathero 329
actioN 308
Larva 141
910 98
Aegong 77
Dewaltoss 76
Shinee 61
Sharp 34
yabsab 15
[ Show more ]
ajuk12(nOOB) 8
Dota 2
ODPixel445
XcaliburYe369
Fuzer 105
Counter-Strike
byalli779
Other Games
summit1g15437
mouzStarbuck549
KnowMe189
Organizations
Other Games
BasetradeTV234
StarCraft: Brood War
UltimateBattle 18
[ Show 12 non-featured ]
StarCraft 2
• StrangeGG 65
• LUISG 14
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• Migwel
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• lizZardDota2212
League of Legends
• Jankos2030
Upcoming Events
Sparkling Tuna Cup
1h 5m
WardiTV Invitational
2h 5m
ByuN vs Percival
Cure vs Classic
Shopify Rebellion Sundays
6h 5m
Spirit vs Mixu
Clem vs TBD
RSL Revival
7h 5m
Serral vs Rogue
BlizzCon
9h 35m
IdrA vs MC
Replay Cast
15h 5m
Afreeca Starleague
1d 1h
Light vs JyJ
Soulkey vs hero
WardiTV Weekly
1d 2h
Monday Night Weeklies
1d 7h
Afreeca Starleague
2 days
Snow vs Shinee
Shine vs EffOrt
[ Show More ]
GSL
2 days
PiGosaur Cup
2 days
The PondCast
3 days
Kung Fu Cup
3 days
Replay Cast
3 days
KCM Race Survival
4 days
IntoTheTV X SOOP
4 days
Replay Cast
4 days
IntoTheTV X SOOP
5 days
Replay Cast
5 days
GSL
6 days
Replay Cast
6 days
Liquipedia Results

Completed

Acropolis #5 - TRS
PiG Sty Festival 8.0
Big Dog Cup 2026 Div 1

Ongoing

KCM Race Survival 2026 Season 3
K-JUNGMAN
ASL Season 22
Super Anchor Qualifying S3
CSL 2026 AUTUMN (S22)
Acropolis #5
Blizzard Classic Cup 2026
Blizzard Classic Cup 2026
RSL Revival: Season 6
Calamity Invitational
FISSURE Playground #3
BLAST Open Fall 2026
Esports World Cup 2026
BLAST Bounty Summer 2026
BLAST Bounty Summer Qual
Stake Ranked Episode 3
XSE Pro League 2026

Upcoming

Acropolis #5 - GSA
Acropolis #5 - GSB
Acropolis #5 - GSC
SC4ALL II: Brood War
HSC XXX
Stellar Fest 2: Lunar Cup
SC4ALL II: StarCraft II
Kung Fu Cup 2026 Grand Finals
RSL Offline Finals
PGL Major Singapore 2026
Stake Ranked Episode 6
BLAST Rivals Fall 2026
IEM Beijing 2026
Stake Ranked Episode 5
PGL Masters Bucharest 2026
1win Private Club #2
Thunderpick World Champ. '26
ESL Pro League Season 24
Stake Ranked Episode 4
1win Private Club #1
Logitech G Play Connect 2026
SL StarSeries Fall 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.