• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 03:03
CET 09:03
KST 17:03
  • 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
RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10
Community News
Weekly Cups (Nov 24-30): MaxPax, Clem, herO win2BGE Stara Zagora 2026 announced15[BSL21] Ro.16 Group Stage (C->B->A->D)4Weekly Cups (Nov 17-23): Solar, MaxPax, Clem win3RSL Season 3: RO16 results & RO8 bracket13
StarCraft 2
General
Chinese SC2 server to reopen; live all-star event in Hangzhou Maestros of the Game: Live Finals Preview (RO4) BGE Stara Zagora 2026 announced Weekly Cups (Nov 24-30): MaxPax, Clem, herO win SC2 Proleague Discontinued; SKT, KT, SGK, CJ disband
Tourneys
StarCraft Evolution League (SC Evo Biweekly) RSL Offline Finals Info - Dec 13 and 14! RSL Offline FInals Sea Duckling Open (Global, Bronze-Diamond) $5,000+ WardiTV 2025 Championship
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 502 Negative Reinforcement Mutation # 501 Price of Progress Mutation # 500 Fright night Mutation # 499 Chilling Adaptation
Brood War
General
BW General Discussion Which season is the best in ASL? Data analysis on 70 million replays BGH Auto Balance -> http://bghmmr.eu/ [ASL20] Ask the mapmakers — Drop your questions
Tourneys
[BSL21] RO16 Group D - Sunday 21:00 CET [BSL21] RO16 Group A - Saturday 21:00 CET [Megathread] Daily Proleagues [BSL21] RO16 Group B - Sunday 21:00 CET
Strategy
Current Meta Game Theory for Starcraft How to stay on top of macro? PvZ map balance
Other Games
General Games
ZeroSpace Megathread Nintendo Switch Thread Stormgate/Frost Giant Megathread The Perfect Game Path of Exile
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
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Mafia Game Mode Feedback/Ideas TL Mafia Community Thread
Community
General
Russo-Ukrainian War Thread US Politics Mega-thread Things Aren’t Peaceful in Palestine The Big Programming Thread Artificial Intelligence Thread
Fan Clubs
White-Ra Fan Club
Media & Entertainment
[Manga] One Piece Movie Discussion! Anime Discussion Thread
Sports
2024 - 2026 Football Thread Formula 1 Discussion NBA General Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Where to ask questions and add stream? The Automated Ban List
Blogs
Physical Exertion During Gam…
TrAiDoS
James Bond movies ranking - pa…
Topin
Thanks for the RSL
Hildegard
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1462 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
Replay Cast
00:00
WardiTV Mondays #62
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
SortOf 127
-ZergGirl 65
StarCraft: Brood War
Tasteless 254
Sacsri 85
Shine 76
Pusan 72
Dewaltoss 49
Sharp 34
Bale 31
ZergMaN 30
Hm[arnc] 2
Dota 2
febbydoto209
NeuroSwarm129
canceldota30
League of Legends
JimRising 626
Reynor51
Super Smash Bros
Westballz19
Other Games
summit1g10930
WinterStarcraft556
crisheroes301
C9.Mang0234
Mew2King41
Organizations
Other Games
gamesdonequick637
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 13 non-featured ]
StarCraft 2
• Berry_CruncH198
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• LUISG 0
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Lourlo1270
Upcoming Events
The PondCast
1h 57m
OSC
7h 57m
Demi vs Mixu
Nicoract vs TBD
Babymarine vs MindelVK
ForJumy vs TBD
Shameless vs Percival
Replay Cast
15h 57m
Korean StarCraft League
1d 18h
CranKy Ducklings
2 days
WardiTV 2025
2 days
SC Evo League
2 days
BSL 21
2 days
Sziky vs OyAji
Gypsy vs eOnzErG
OSC
2 days
Solar vs Creator
ByuN vs Gerald
Percival vs Babymarine
Moja vs Krystianer
EnDerr vs ForJumy
sebesdes vs Nicoract
Sparkling Tuna Cup
3 days
[ Show More ]
WardiTV 2025
3 days
OSC
3 days
BSL 21
3 days
Bonyth vs StRyKeR
Tarson vs Dandy
Replay Cast
4 days
Wardi Open
4 days
StarCraft2.fi
4 days
Monday Night Weeklies
4 days
Replay Cast
4 days
WardiTV 2025
5 days
StarCraft2.fi
5 days
PiGosaur Monday
5 days
StarCraft2.fi
6 days
Tenacious Turtle Tussle
6 days
Liquipedia Results

Completed

Proleague 2025-11-30
RSL Revival: Season 3
Light HT

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
YSL S2
BSL Season 21
CSCL: Masked Kings S3
Slon Tour Season 2
Acropolis #4 - TS3
META Madness #9
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2

Upcoming

BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
RSL Offline Finals
WardiTV 2025
Kuram Kup
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
eXTREMESLAND 2025
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.