• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 11:21
CEST 17:21
KST 00:21
  • 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
[ASL21] Ro24 Preview Pt2: News Flash10[ASL21] Ro24 Preview Pt1: New Chaos0Team Liquid Map Contest #22 - Presented by Monster Energy18ByuL: The Forgotten Master of ZvT30Behind the Blue - Team Liquid History Book20
Community News
$5,000 WardiTV TLMC tournament - Presented by Monster Energy2GSL CK: More events planned pending crowdfunding3Weekly Cups (May 30-Apr 5): herO, Clem, SHIN win0[BSL22] RO32 Group Stage4Weekly Cups (March 23-29): herO takes triple6
StarCraft 2
General
Quebec Clan still alive ? BGE Stara Zagora 2026 cancelled Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool Weekly Cups (May 30-Apr 5): herO, Clem, SHIN win Rongyi Cup S3 - Preview & Info
Tourneys
GSL CK: More events planned pending crowdfunding $5,000 WardiTV TLMC tournament - Presented by Monster Energy Sparkling Tuna Cup - Weekly Open Tournament RSL Season 4 announced for March-April Sea Duckling Open (Global, Bronze-Diamond)
Strategy
Custom Maps
[D]RTS in all its shapes and glory <3 [A] Nemrods 1/4 players [M] (2) Frigid Storage
External Content
The PondCast: SC2 News & Results Mutation # 520 Moving Fees Mutation # 519 Inner Power Mutation # 518 Radiation Zone
Brood War
General
ASL21 General Discussion so ive been playing broodwar for a week straight. BW General Discussion Gypsy to Korea Pros React To: JaeDong vs Queen
Tourneys
[Megathread] Daily Proleagues Escore Tournament StarCraft Season 2 [ASL21] Ro24 Group F [BSL22] RO32 Group B - Sunday 21:00 CEST
Strategy
Fighting Spirit mining rates Muta micro map competition What's the deal with APM & what's its true value Simple Questions, Simple Answers
Other Games
General Games
General RTS Discussion Thread Stormgate/Frost Giant Megathread Starcraft Tabletop Miniature Game Nintendo Switch Thread Darkest Dungeon
Dota 2
The Story of Wings Gaming Official 'what is Dota anymore' discussion
League of Legends
G2 just beat GenG in First stand
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 Five o'clock TL Mafia
Community
General
US Politics Mega-thread European Politico-economics QA Mega-thread Russo-Ukrainian War Thread Trading/Investing Thread Things Aren’t Peaceful in Palestine
Fan Clubs
The IdrA Fan Club
Media & Entertainment
[Manga] One Piece [Req][Books] Good Fantasy/SciFi books Movie Discussion!
Sports
2024 - 2026 Football Thread Formula 1 Discussion Cricket [SPORT] Tokyo Olympics 2021 Thread General nutrition recommendations
World Cup 2022
Tech Support
[G] How to Block Livestream Ads
TL Community
The Automated Ban List
Blogs
Loot Boxes—Emotions, And Why…
TrAiDoS
Broowar part 2
qwaykee
Funny Nicknames
LUCKY_NOOB
Iranian anarchists: organize…
XenOsky
FS++
Kraekkling
ASL S21 English Commentary…
namkraft
StarCraft improvement
iopq
Electronics
mantequilla
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1475 users

The Big Programming Thread - Page 335

Forum Index > General Forum
Post a Reply
Prev 1 333 334 335 336 337 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.
teamamerica
Profile Blog Joined July 2010
United States958 Posts
Last Edited: 2013-08-05 10:17:46
August 05 2013 09:09 GMT
#6681
Has been answered by following two posts

Thanks all! Makes a lot of sense. Shoulda read through more of the tutorial - it's mentioned in a later chapter it seems. So effectively it creates a new tuple (b,a) and immediately unpacks it, with the tuple (b,a) being a kind of temporary variable?

edit: nm about previous talk of creating new tuple - on seeing the python opcode - thanks for going over that! reading the documentation I'm a little unsure but STORE_NAME pops the stack as well?

also - I'll stop being a smartass about swapping variables and use a temp. I had never head of a 'pipeline stall' before but on reading about it, it makes sense.

Secondly, kind of related to something I asked earlier - I was running different ways to calculate fibonacci - realized it's a lot cheaper to calculate it without recursion, and I have some runtime differences I can't understand.

I have a dumb recursive way, a simple way that memorizes the results, a way that stores the results in an array (ed: nope - kind of what Java would do in the dynamic case of Java allowed tall call optimization?), and a way that only remembers the two most recent fibonacci numbers. These methods are dumbFib, dynamicFib, arrayFib, and smartFib recursively.

Because I got tired of writing lines 87-124 I wanted to write a method that could run my methods for comparison purposes. I added an interface called DecoratorInterface (side note: I should call it something else, this has no relation to Decorator pattern on 2nd thought).

When I ran it this 2nd time around - with addition of lines 77-83, the runtime for the 2nd array fib seems to have dropped and I don't know why.

+ Show Spoiler [output with lines 77-83 commented] +

Array fib 14
Smart fib 5
Dumb fib 186
Dynamic fib 21


+ Show Spoiler [output with 77-83 uncommented] +

Array fib1 16
Array fib 4
Smart fib 5
Dumb fib 211
Dynamic fib 25


http://pastebin.com/KUFZjYga

I'm of course trying to work it out myself too - just figured I'd ask while it seems a lot of people are around to answer.

ed:
My first thought was that maybe I didn't understand how static functions worked in Java and that the variable was only created once (like having a static variable in a function in PHP). That's why I had that printMe check - I just called arrayFib at the end to check the size of the array. But a new array is created on every function call, so I don't know why creating the array once would help me the 2nd time the array was called. I also thought maybe there is some compiler magic, so I moved my 2nd arrayFib check to the end of main - so it did the 3 other tests before calling arrayFib again. Given that I was checking for 'magic', I'm not sure what I was expecting, but it didn't make a difference. So that's where I'm looking at now.

Btw really all - thanks a lot for putting up with these dumb questions
RIP GOMTV. RIP PROLEAGUE.
tec27
Profile Blog Joined June 2004
United States3702 Posts
Last Edited: 2013-08-05 09:52:50
August 05 2013 09:47 GMT
#6682
Its a difference of 10ms, its not really significant. In any case, calling the method 20k times could easily trigger the JIT to try and optimize harder, and those optimizations would benefit your second round of calls. I wouldn't really worry about it or care in the slightest.

Commenting on the rest of your code: Most of your tests aren't really valid; you're not resetting their stored state between test iterations, so they're the slowest they'll ever be for the first iteration and then blazing fast after that. That's not at all a fair comparison to the dumbFib method. Furthermore, if your timings are returning 4-5ms for all your iterations to run, you should probably be running them more to get anywhere near an idea of how fast they are. After all, you saw yourself that simply adding a method call could add 12ms to the total run, which is 3x what your Array test was giving as a result. Way too much error involved there.
Can you jam with the console cowboys in cyberspace?
gedatsu
Profile Joined December 2011
1286 Posts
August 05 2013 09:57 GMT
#6683
If you want to test the speed of your fibonacci implementations, I would suggest calling fib(1000) or some such. Running fib(20) a thousand times is rather pointless.
teamamerica
Profile Blog Joined July 2010
United States958 Posts
Last Edited: 2013-08-05 10:22:36
August 05 2013 10:16 GMT
#6684
Ok guys, thanks for that. Regarding:

"Most of your tests aren't really valid; you're not resetting their stored state between test iterations, so they're the slowest they'll ever be for the first iteration and then blazing fast after that. "

This applies only to dynamicFib, which uses a static variable right? arrayFib array is a local variable so every iteration creates a new array?

Anyway, I was also conflating some other things because my question was mainly pertaining to the differences in the 2 arrayFibs times, so I should have commented out the other tests.

When I changed it to something different (compute fib(1000) 2 million times, not computing fib[1...20] 1000 times), there was no real difference in the arrayFib runtime with lines commented or not, and as expected the testMe method took a bit longer on every run because of the overhead of the extra method call. Idk what stock I was reading into a 4ms difference...I had just gotten impatient testing because dumbFib with even fib(40) took so long that I went with these tiny numbers.

Updated code is: http://pastebin.com/P9VszeWE

In case anyone was curious:
Runtime for arrayFib ranged from 7900-8100 ms when I ran it alone.
When I ran them together, runtime for arrayFib1 ranged from 7900 to 8400 ms and arrayFib was 7600 to 7800 ms
RIP GOMTV. RIP PROLEAGUE.
ptrpb
Profile Joined March 2011
Canada753 Posts
August 05 2013 14:43 GMT
#6685
does anyone have any good resources for learning and practicing SQL Triggers? MySQL preferred but at this point i'll take what i can get. i have a decent theoretical understanding on how to use them, i'm really just looking more for syntax things and good ways to practice implementing them.
thanks in advance.
MBAACC | SG | shit at fighting games
Nakamp
Profile Joined March 2012
Czech Republic27 Posts
Last Edited: 2013-08-05 15:24:22
August 05 2013 15:22 GMT
#6686
On August 04 2013 10:16 sqrt wrote:
I looked at the tutorials for OpenGL in the OP, but they seem to be quite dated, can anyone recommend me a more modern tutorial? Or should I just work with older versions?

P.S. I'm using Windows.


I can highly recommend http://www.opengl-tutorial.org/ helped me a ton at school this year, you can check the full code at https://code.google.com/p/opengl-tutorial-org/source/browse/ took me some time before I found that :D I wouldn't recommend learning old OpenGL (older than 3.1) if you wanna develop for desktop (OpenGL ES uses some of the old stuff I think).
HardlyNever
Profile Blog Joined July 2011
United States1258 Posts
August 05 2013 15:58 GMT
#6687
On August 03 2013 03:52 Yoshi- wrote:
There are problems like: http://www.my-debugbar.com/wiki/IETester/HomePage That should allow you to test in IE9


Thanks for this, it sort of works.


On August 04 2013 16:46 Encdalf wrote:
Show nested quote +
On August 03 2013 03:47 HardlyNever wrote:
[...]
Does anyhow know how to get this piece of crap to load at an earlier version correctly, so I don't have to physically go check it on an old machine?


The developer tools in the IE are good for a quick peek, but well that's about it. It won't simulate an earlier version 100%, instead you get an earlier version with enhancements, i.e. IE9 debug tools would make you think media queries work in IE8. As for the mentioned IE Tester, I havn't used that for a while since it constantly crashed on my system and printing didn't work.

In my current setup I use virtual machines with remote desktop connections for compatibility checks in older IE versions since that way I also have the operating system as a test platform, which at least for me is a requirement in some cases. There are also services like https://saucelabs.com/ or http://www.browserstack.com/ which will provide you with other version/os combinations but these cost money.


I think just the IE9 version isn't working right on the tester linked above. Any page I try to load in an IE9 tab just crashes. The IE8 tab seems to be working, though.

Out there, the Kid learned to fend for himself. Learned to build. Learned to break.
HardlyNever
Profile Blog Joined July 2011
United States1258 Posts
Last Edited: 2013-08-05 16:23:53
August 05 2013 16:21 GMT
#6688
Nvm got it.
Out there, the Kid learned to fend for himself. Learned to build. Learned to break.
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
August 05 2013 18:22 GMT
#6689
On August 05 2013 11:04 heroyi wrote:
Show nested quote +
On August 05 2013 10:30 darkness wrote:
I'm looking to sharpen my programming skills as I feel I'm not doing anything useful these days to become better. Once I'm done with studies, I'd like to work as a software engineer, but I'd rather use the time while I'm studying at university. I'm on my 3rd and last year of BSc in Software Development programme. I plan to follow it up with MSc in the same field if possible.

...

Edit: When people say "study algorithms and data structures", do you mean to memorise algorithms or just to have an idea about an algorithm and to know how to google it?

Essentially the latter. A lot of languages come with their own little algorithms built in (i.e java for sort etc...). Essentially know the practicality and downfall of each and know when to implement which (red black tree vs sorts etc...). It seems a lot of programming is just knowing the abstract level which makes sense considering if you can't design a blueprint of what you want the program to do then it doesn't matter how well you know about a language.


Any algorithms & data structures book you'd recommend or is google enough to learn this?
KainiT
Profile Joined July 2011
Austria392 Posts
August 05 2013 19:25 GMT
#6690
On August 06 2013 03:22 darkness wrote:
Show nested quote +
On August 05 2013 11:04 heroyi wrote:
On August 05 2013 10:30 darkness wrote:
I'm looking to sharpen my programming skills as I feel I'm not doing anything useful these days to become better. Once I'm done with studies, I'd like to work as a software engineer, but I'd rather use the time while I'm studying at university. I'm on my 3rd and last year of BSc in Software Development programme. I plan to follow it up with MSc in the same field if possible.

...

Edit: When people say "study algorithms and data structures", do you mean to memorise algorithms or just to have an idea about an algorithm and to know how to google it?

Essentially the latter. A lot of languages come with their own little algorithms built in (i.e java for sort etc...). Essentially know the practicality and downfall of each and know when to implement which (red black tree vs sorts etc...). It seems a lot of programming is just knowing the abstract level which makes sense considering if you can't design a blueprint of what you want the program to do then it doesn't matter how well you know about a language.


Any algorithms & data structures book you'd recommend or is google enough to learn this?


I think that depends on your preferences. By now you can learn pretty much everything with Internet ressources, but I would recommend buying the classic http://upload.wikimedia.org/wikipedia/en/thumb/4/41/Clrs3.jpeg/220px-Clrs3.jpeg . This way you don't risk getting too much false/problematic information.
With great power comes great responsibility.
phar
Profile Joined August 2011
United States1080 Posts
Last Edited: 2013-08-06 01:34:12
August 06 2013 01:33 GMT
#6691
On August 06 2013 03:22 darkness wrote:
Show nested quote +
On August 05 2013 11:04 heroyi wrote:
On August 05 2013 10:30 darkness wrote:
I'm looking to sharpen my programming skills as I feel I'm not doing anything useful these days to become better. Once I'm done with studies, I'd like to work as a software engineer, but I'd rather use the time while I'm studying at university. I'm on my 3rd and last year of BSc in Software Development programme. I plan to follow it up with MSc in the same field if possible.

...

Edit: When people say "study algorithms and data structures", do you mean to memorise algorithms or just to have an idea about an algorithm and to know how to google it?

Essentially the latter. A lot of languages come with their own little algorithms built in (i.e java for sort etc...). Essentially know the practicality and downfall of each and know when to implement which (red black tree vs sorts etc...). It seems a lot of programming is just knowing the abstract level which makes sense considering if you can't design a blueprint of what you want the program to do then it doesn't matter how well you know about a language.


Any algorithms & data structures book you'd recommend or is google enough to learn this?

If you have a very strong math background, Knuth is good. If not, the above suggestion is really good.
Who after all is today speaking about the destruction of the Armenians?
tec27
Profile Blog Joined June 2004
United States3702 Posts
August 06 2013 04:33 GMT
#6692
On August 05 2013 19:16 teamamerica wrote:
Ok guys, thanks for that. Regarding:

"Most of your tests aren't really valid; you're not resetting their stored state between test iterations, so they're the slowest they'll ever be for the first iteration and then blazing fast after that. "

This applies only to dynamicFib, which uses a static variable right? arrayFib array is a local variable so every iteration creates a new array?

Anyway, I was also conflating some other things because my question was mainly pertaining to the differences in the 2 arrayFibs times, so I should have commented out the other tests.

When I changed it to something different (compute fib(1000) 2 million times, not computing fib[1...20] 1000 times), there was no real difference in the arrayFib runtime with lines commented or not, and as expected the testMe method took a bit longer on every run because of the overhead of the extra method call. Idk what stock I was reading into a 4ms difference...I had just gotten impatient testing because dumbFib with even fib(40) took so long that I went with these tiny numbers.

Updated code is: http://pastebin.com/P9VszeWE

In case anyone was curious:
Runtime for arrayFib ranged from 7900-8100 ms when I ran it alone.
When I ran them together, runtime for arrayFib1 ranged from 7900 to 8400 ms and arrayFib was 7600 to 7800 ms

Yeah, my comment would only apply to dynamicFib. The rest are stateless between method calls, so they don't have that issue.

Anyway, I do have some suggestions for your code if you'd like them:

First, I think wrapping the methods like you are is a bit weird. The thought that spurred it is good (reducing repeated code), but passing methods around in Java always ends up being painful and hard to read due to its lack of first-class functions. I'd recommend instead creating an interface for a FibonacciSolver or something along those lines, e.g.:
public interface FibonacciSolver {
long find(int n);
}

Then you can create implementations for each of your strategies, and reduce your main method to something like:
public static void main(String args[]) {
FibonacciSolver solvers[] = { new ArrayFibonacciSolver(),
new DynamicFibonacciSolver(),
new DumbFibonacciSolver() };

for(FibonacciSolver solver : solvers) {
long startTime = System.currentTimeMillis();
for (int i = 0; i < NUM_ITERATIONS; i++) {
solver.find(MAX_FIB);
}
long endTime = System.currentTimeMillis();
System.out.println(solver.class.getSimpleName() + ": " + (endTime - startTime) + "ms");
}
}


I think ideally you would also provide a standard setup/teardown for each method, and do so before each test iteration, but this would probably be hard to separate from your timing unless you started using a higher resolution timer.

Also, if you really want any idea of where the advantages lie in any of these methods, you really need to take a different approach than sequentially picking n's or just choosing 1 large n. Doing either of those gives advantages to some methods while giving extreme disadvantages to others. I doubt you care too much how accurate your comparisons are, but its something to think about.
Can you jam with the console cowboys in cyberspace?
RoyGBiv_13
Profile Blog Joined August 2010
United States1275 Posts
Last Edited: 2013-08-06 18:19:52
August 06 2013 05:01 GMT
#6693
On August 05 2013 18:03 gedatsu wrote:
Show nested quote +
On August 05 2013 16:49 teamamerica wrote:
But in Java the simplest way I can think of (and this only works for switching two integers) is

b = a + b
a = b - a
b = b - a

You can avoid overflow by using xor:

b = a^b;
a = a^b;
b = a^b;

I think this (and your method) can create a pipeline stall however, so it's not necessarily faster than swapping with the normal method of using an extra variable.

Show nested quote +
So I have a few questions:
1) In Java, is there a simple way to switch two objects without creating a temp object?

You only create objects by using the 'new' command. Since you can have two names referencing the same object, that is the best way to swap them and no extra object is created.


Compilers can figure out the fastest way to swap based on your architecture and language. They recognize this sort of pattern pretty well.

EDIT: confirmed: xor swaps, arithemetic swaps, an temporary variable swaps are all treated by the compiler to generate identical assembly. There is one case where this is not true, when a temporary variable is used for several uses, it is assumed the user did want to use a temporary holding state, usually a register.
Any sufficiently advanced technology is indistinguishable from magic
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
August 06 2013 07:51 GMT
#6694
On August 05 2013 17:43 Nesserev wrote:
Show nested quote +
On August 05 2013 17:44 Blisse wrote:
Python is awesome.

I beg to differ... but Python's okay.
After doing a lot of coding in C and C++, going back to Python was a real headache.


Yeah I'm having the same issue right now and alleviated it by working with C# ^^

C/C++ syntax is so much more well structured than Python since Python's mainly for scripting and being clean and verbose, so swapping between them feels so odd. But I love how quickly I can write up a simple script to say, just look at the assembly of Python code, and then CTRL+B to run.

But mainly, writing classes in Python hurts so much coming from C/C++. TT
There is no one like you in the universe.
WindWolf
Profile Blog Joined July 2012
Sweden11767 Posts
Last Edited: 2013-08-06 12:36:59
August 06 2013 12:34 GMT
#6695
Visual C++ 2012 question, where should I put my .ini-files so that files in the project can read it? I tried different things, and it doesn't seem to work in the same way as it did in VS2010
EZ4ENCE
icystorage
Profile Blog Joined November 2008
Jollibee19350 Posts
Last Edited: 2013-08-06 14:18:36
August 06 2013 14:09 GMT
#6696
I made a program (homework) that solves the satisfiabilty of CNF clauses using Hill Climbing (as stated on the instructions). Now my problem is that I seem to get stuck at the local maxima. I want to escape it (using walksat) but I dont seem to understand how to implement the algorithm. Anybody care to help?

here's my code btw

+ Show Spoiler +


import java.util.Arrays;


public class HillClimbing {

public static int[] literals = new int[8];
public static void main(String[] args) {
// TODO Auto-generated method stub
// randomize(literals); // Randomize initial state.

boolean[] startingState = new boolean[8];
boolean[] leftNeighbor;
boolean[] rightNeighbor;
int Number = 0;
int numOfSatClause = 0;
Number = generateRandomStart(startingState);
while(numOfSatClause < 10){

leftNeighbor = generateNeighbor(Number-1);
rightNeighbor = generateNeighbor(Number+1);
if (checkSat(startingState) < checkSat(leftNeighbor)){
numOfSatClause = checkSat(leftNeighbor);
startingState = leftNeighbor;
Number--;
System.out.println("Changing starting state");
}
else {
numOfSatClause = checkSat(rightNeighbor);
startingState = rightNeighbor;
System.out.println("Changing starting state");
Number++;
}
}
System.out.println("Number of true clauses: " + numOfSatClause);
System.out.println(Number + " = " + Arrays.toString(startingState));


}

private static int checkSat(boolean[] state) {
int ctr = 0;
if(!state[7] || !state[5] || !state[4] || state[3]) // ~A V ~C V ~D V E
ctr++;
if(!state[7] || !state[6] || !state[4] || !state[0]) // ~A V ~B V ~D V ~H
ctr++;
if(state[6] || state[4] || !state[2] || !state[0]) // B V D V ~F V ~H
ctr++;
if(state[6] || !state[5] || state[1] || !state[0]) // B V ~C V G V ~H
ctr++;
if(!state[6] || state[5] || !state[2] || !state[1]) // ~B V C V ~F V ~G
ctr++;
if(state[5] || !state[4] || state[3] || !state[0]) // C V ~D V E V ~H
ctr++;
if(!state[5] || state[4] || !state[3] || !state[2]) // ~C V D V ~E V ~F
ctr++;
if(state[6] || !state[4] || !state[2] || state[0]) // B V ~D V ~F V H
ctr++;
if(!state[7] || !state[5] || !state[4] || state[3]) // ~A V ~C V ~D V E
ctr++;
if(state[6] || state[5] || !state[4] || !state[2]) // B V C V ~D V ~F
ctr++;
return ctr;
}

private static boolean[] generateNeighbor(int randomNumber) {
boolean[] neighbor = new boolean[8];

for (int i = 7; i >= 0; i--) {
neighbor[i] = (randomNumber & (1 << i)) != 0;
}

System.out.println(randomNumber + " = " + Arrays.toString(neighbor));
return neighbor;
}

private static int generateRandomStart(boolean[] startingState) {
int input = (int) (Math.random()*(128));

for (int i = 6; i >= 0; i--) {
startingState[i] = (input & (1 << i)) != 0;
}

System.out.println(input + " = " + Arrays.toString(startingState));
return input;
}
}
LiquidDota StaffAre you ready for a Miracle-? We are! The International 2017 Champions!
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
August 06 2013 14:38 GMT
#6697
On August 06 2013 21:34 WindWolf wrote:
Visual C++ 2012 question, where should I put my .ini-files so that files in the project can read it? I tried different things, and it doesn't seem to work in the same way as it did in VS2010

VS12 should put your executable into /bin/Debug/, and if you put your files in there you can access them easily using a relative path. If you put the file into your project folders and set "copy to output directory" in the file properties to "copy always" or "copy if newer", then the file should be copied into your /bin/Debug/ on build, using the relative path from the project root.
If you have a good reason to disagree with the above, please tell me. Thank you.
WindWolf
Profile Blog Joined July 2012
Sweden11767 Posts
August 06 2013 15:11 GMT
#6698
On August 06 2013 23:38 spinesheath wrote:
Show nested quote +
On August 06 2013 21:34 WindWolf wrote:
Visual C++ 2012 question, where should I put my .ini-files so that files in the project can read it? I tried different things, and it doesn't seem to work in the same way as it did in VS2010

VS12 should put your executable into /bin/Debug/, and if you put your files in there you can access them easily using a relative path. If you put the file into your project folders and set "copy to output directory" in the file properties to "copy always" or "copy if newer", then the file should be copied into your /bin/Debug/ on build, using the relative path from the project root.

I can't find the "copy to output directory" settings anywhere in VS2012. Where is it locaed, I've searched both my project settings, solution settings and file settings for my ini-file
EZ4ENCE
stormchaser
Profile Joined January 2011
Canada1009 Posts
August 06 2013 15:27 GMT
#6699
On August 07 2013 00:11 WindWolf wrote:
Show nested quote +
On August 06 2013 23:38 spinesheath wrote:
On August 06 2013 21:34 WindWolf wrote:
Visual C++ 2012 question, where should I put my .ini-files so that files in the project can read it? I tried different things, and it doesn't seem to work in the same way as it did in VS2010

VS12 should put your executable into /bin/Debug/, and if you put your files in there you can access them easily using a relative path. If you put the file into your project folders and set "copy to output directory" in the file properties to "copy always" or "copy if newer", then the file should be copied into your /bin/Debug/ on build, using the relative path from the project root.

I can't find the "copy to output directory" settings anywhere in VS2012. Where is it locaed, I've searched both my project settings, solution settings and file settings for my ini-file

Select all of the project files in the solution explorer and in the properties panel click Copy to Output.
WindWolf
Profile Blog Joined July 2012
Sweden11767 Posts
August 06 2013 18:03 GMT
#6700
On August 07 2013 00:27 stormchaser wrote:
Show nested quote +
On August 07 2013 00:11 WindWolf wrote:
On August 06 2013 23:38 spinesheath wrote:
On August 06 2013 21:34 WindWolf wrote:
Visual C++ 2012 question, where should I put my .ini-files so that files in the project can read it? I tried different things, and it doesn't seem to work in the same way as it did in VS2010

VS12 should put your executable into /bin/Debug/, and if you put your files in there you can access them easily using a relative path. If you put the file into your project folders and set "copy to output directory" in the file properties to "copy always" or "copy if newer", then the file should be copied into your /bin/Debug/ on build, using the relative path from the project root.

I can't find the "copy to output directory" settings anywhere in VS2012. Where is it locaed, I've searched both my project settings, solution settings and file settings for my ini-file

Select all of the project files in the solution explorer and in the properties panel click Copy to Output.

http://i.imgur.com/YjuZzPx.png

This is everything I see in the properties panel (The full path is whited out by me)
EZ4ENCE
Prev 1 333 334 335 336 337 1032 Next
Please log in or register to reply.
Live Events Refresh
Next event in 18h 39m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
trigger 281
LamboSC2 18
StarCraft: Brood War
Britney 44963
Mini 1279
Soma 739
EffOrt 679
Stork 520
Zeus 198
Shuttle 185
ggaemo 185
Soulkey 152
Snow 147
[ Show more ]
PianO 145
Hyuk 141
Rush 135
hero 134
Sharp 129
Shinee 92
sorry 89
Barracks 57
Hyun 52
Movie 46
Nal_rA 40
Free 30
Hm[arnc] 27
scan(afreeca) 23
HiyA 19
Terrorterran 17
yabsab 17
Sacsri 17
soO 13
GoRush 12
Sexy 12
ajuk12(nOOB) 11
Dota 2
Gorgc4663
qojqva1230
420jenkins277
Fuzer 160
Counter-Strike
fl0m3525
edward128
Other Games
singsing1976
B2W.Neo1040
hiko734
Mlord397
crisheroes356
RotterdaM205
FrodaN198
ArmadaUGS137
XaKoH 93
QueenE86
Trikslyr34
Mew2King31
Organizations
Counter-Strike
PGL36524
Other Games
BasetradeTV717
StarCraft: Brood War
UltimateBattle 706
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 16 non-featured ]
StarCraft 2
• poizon28 26
• intothetv
• AfreecaTV YouTube
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• HerbMon 28
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• lizZardDota259
League of Legends
• Nemesis3293
• Jankos2326
• TFBlade1351
Upcoming Events
CranKy Ducklings
18h 39m
WardiTV Team League
19h 39m
uThermal 2v2 Circuit
23h 39m
IPSL
1d
Hawk vs TBD
StRyKeR vs TBD
BSL
1d 3h
n0maD vs perroflaco
TerrOr vs ZZZero
MadiNho vs WolFix
DragOn vs LancerX
Sparkling Tuna Cup
1d 18h
WardiTV Team League
1d 19h
OSC
1d 21h
BSL
2 days
Sterling vs Azhi_Dahaki
Napoleon vs Mazur
Jimin vs Nesh
spx vs Strudel
IPSL
2 days
Artosis vs TBD
Napoleon vs TBD
[ Show More ]
Replay Cast
2 days
Replay Cast
2 days
Wardi Open
2 days
Afreeca Starleague
2 days
Soma vs YSC
Sharp vs sSak
Afreeca Starleague
3 days
Snow vs PianO
hero vs Rain
GSL
3 days
Replay Cast
4 days
Kung Fu Cup
4 days
Replay Cast
5 days
The PondCast
5 days
Replay Cast
6 days
Escore
6 days
Liquipedia Results

Completed

Proleague 2026-04-09
RSL Revival: Season 4
NationLESS Cup

Ongoing

BSL Season 22
ASL Season 21
CSL 2026 SPRING (S20)
StarCraft2 Community Team League 2026 Spring
Nations Cup 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2
PGL Cluj-Napoca 2026
IEM Kraków 2026

Upcoming

IPSL Spring 2026
Escore Tournament S2: W3
Acropolis #4
BSL 22 Non-Korean Championship
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
RSL Revival: Season 5
WardiTV TLMC #16
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
Asian Champions League 2026
IEM Atlanta 2026
PGL Astana 2026
BLAST Rivals Spring 2026
CCT Season 3 Global Finals
IEM Rio 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.