• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 04:10
CEST 10:10
KST 17:10
  • 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
Serral wins HomeStory Cup 297Serral wins Maestros of the Game 243ByuL, and the Limitations of Standard Play3Team Liquid Map Contest #22: Results and Winners7Code S Season 2 (2026): RO4 and Finals Preview12
Community News
BSL Season 22 Full Overview & Conclusion7BSL Season 22 Full Overview & Conclusion7Weekly Cups (June 29-July 5): Solar Doubles0MC vs IdrA, Boxer vs Nal_rA to be Legacy Matches @ BlizzCon445.0.16 Hotfix (June 30) - Balance + Bug Fixes40
StarCraft 2
General
Serral wins HomeStory Cup 29 Serral wins Maestros of the Game 2 Reynor: GSL Loss Wasn't About Preparation Format 5.0.16 patch for SC2 goes live (8 worker start) What is your PC setup in 2026 for SCBW/SC2 ?
Tourneys
GSL CK #5 Race War WardiTV Summer Cup 2026 RSL Revival: Season 6 - Qualifiers and Main Event HomeStory Cup 29 Vespene Cup #1 — $300+ USD, July 10
Strategy
[G] Having the right mentality to improve
Custom Maps
New Map Maker - Looking for Advice - Love or Hate Work In Progress Melee Maps [D]RTS in all its shapes and glory <3
External Content
The PondCast: SC2 News & Results Mutation # 534 Burning Evacuation Mutation # 533 Die Together Mutation # 532 Nuclear Family
Brood War
General
ASL 22 Proposed Map Pool ASL22 General Discussion Pros Debate: Zerg Unfairly Nerfed? (ASL S22 map) BSL Season 22 Full Overview & Conclusion BGH Auto Balance -> http://bghmmr.eu/
Tourneys
[ASL22] Wildcard Qualifier IPSL Spring 2026 Top 4! [Megathread] Daily Proleagues CSLAN 4 is Coming!
Strategy
Fighting Spirit mining rates Simple Questions, Simple Answers Creating a full chart of Zerg builds Relatively freeroll strategies
Other Games
General Games
Stormgate/Frost Giant Megathread General RTS Discussion Thread Path of Exile Summer Games Done Quick 2026! Nintendo Switch Thread
Dota 2
Looking for a Dota Mentor 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
TL Mafia
NeO.D_StephenKing vs This Guy From 1 Million Dance TL Mafia Community Thread TL Mafia Power Rank Vanilla Mini Mafia
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread UK Politics Mega-thread YouTube Thread Canadian Politics Mega-thread
Fan Clubs
The IdrA Fan Club The HerO Fan Club!
Media & Entertainment
Movie Discussion! Anime Discussion Thread Series you have seen recently...
Sports
2024 - 2026 Football Thread McBoner: A hockey love story Tennis[sport] Formula 1 Discussion TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
Simple Questions Simple Answers FPS when play League Of Legend on laptop How to clean a TTe Thermaltake keyboard?
TL Community
The Automated Ban List
Blogs
Major Shifts in the Gaming I…
TrAiDoS
An Exploration of th…
waywardstrategy
Gauntlet SC2: A Retrospectiv…
Ctone23
ramps on octagon
StaticNine
Funny Nicknames
LUCKY_NOOB
Evil Gacha Games and the…
ffswowsucks
StarCraft improvement
iopq
Customize Sidebar...

Website Feedback

Closed Threads



Active: 3810 users

The Big Programming Thread - Page 334

Forum Index > General Forum
Post a Reply
Prev 1 332 333 334 335 336 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.
Yoshi-
Profile Joined October 2008
Germany10227 Posts
August 02 2013 18:52 GMT
#6661
There are problems like: http://www.my-debugbar.com/wiki/IETester/HomePage That should allow you to test in IE9
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
Last Edited: 2013-08-02 20:11:03
August 02 2013 19:57 GMT
#6662
I've noticed
std::chrono::steady_clock::now();
from the previous page. Can anyone please explain what each bit is? E.g. what is steady_clock? I guess now() is a method, but what are chrono and steady_clock? Now I know why C++ is complex.

Edit: Is this equivalent to superclass.subclass.method()? So basically chrono.steady_clock.now()? But then again it's weird to see a class with _ character, so I guess I'm wrong there.
LukeNukeEm
Profile Joined February 2012
31 Posts
Last Edited: 2013-08-02 20:16:32
August 02 2013 20:15 GMT
#6663
std and chrono are something called namespaces. Basically like a folder structure. std is the c++ standard library, chrono is the time-library. steady_clock is a class representing a clock, now() is a method of that class returning the current time point.
As for the underscore, this is just the naming convention used by the c++ standard library.
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
Last Edited: 2013-08-03 01:35:10
August 02 2013 20:38 GMT
#6664
I see, thanks. I knew std is a namespace, but I didn't know you could use 2nd namespace after std. steady_clock also confused me because I'm used to Java's convention for classes.

On the other hand, I've seen code like stuff.stuff2.method() in Java, but I don't remember/know what the idea is. I don't even know what to type on google to read about it. Could you enlighten me please?
LukeNukeEm
Profile Joined February 2012
31 Posts
August 02 2013 21:25 GMT
#6665
its been a while for me since i've used java, but from what i remember, this could mean 2 things:
- stuff is a class, which has a static member called stuff2, which has a static method called method(),
- stuff is a variable containing an object of a type which has a membervariable called stuff2 of a type which has a method called method()
just look through the java documentation
nunez
Profile Blog Joined February 2011
Norway4003 Posts
Last Edited: 2013-08-03 00:26:14
August 02 2013 22:45 GMT
#6666
On August 03 2013 05:15 LukeNukeEm wrote:
std and chrono are something called namespaces. Basically like a folder structure. std is the c++ standard library, chrono is the time-library. steady_clock is a class representing a clock, now() is a method of that class returning the current time point.
As for the underscore, this is just the naming convention used by the c++ standard library.


also note that the member function now() is static so you don't need an instance of the object when calling it and that :: is the scope resolution operator whereas . is a member access operator.

#include <functional>

namespace m{
//inside scope of namespace m
struct tea{
//inside scope of class tea
static void liq(){}
void uid(){}
};
}

...{
m::tea::liq(); //ok, method is static (residing under namespace m and under the scope of class tea)
m::tea::uid(); //woops compile error, needs instance of object
m::tea t;
std::bind(&m::tea::uid, &t)(); //ok, reference to the object t bound to function and called
t.liq(); //also ok
t.uid(); //ok
}


for future reference check f.ex cppreference for quick std related stuff:
steady_clock::now()
conspired against by a confederacy of dunces.
sqrt
Profile Blog Joined August 2010
1210 Posts
August 04 2013 01:16 GMT
#6667
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.
@
Zocat
Profile Joined April 2010
Germany2229 Posts
August 04 2013 01:35 GMT
#6668
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.


http://www.arcsynthesis.org/gltut/index.html
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
Last Edited: 2013-08-04 03:50:35
August 04 2013 02:38 GMT
#6669
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.


Unless you're trying to learn OpenGL, I would recommend using some library.

http://gamedev.stackexchange.com/questions/23652/what-alternatives-to-glut-exist
There is no one like you in the universe.
ObliviousNA
Profile Joined March 2011
United States535 Posts
August 04 2013 03:48 GMT
#6670
On August 04 2013 10:35 Zocat wrote:
Show nested quote +
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.


http://www.arcsynthesis.org/gltut/index.html


I've been using his site for the past few weeks, I just want to reiterate for anyone looking to learn openGL (or generic graphics programming principles taught with openGL) - it's awesome.
Theory is when you know everything but nothing works. Practice is when everything works but no one knows why. In our lab, theory and practice are combined: nothing works and no one knows why.
sqrt
Profile Blog Joined August 2010
1210 Posts
August 04 2013 05:19 GMT
#6671
On August 04 2013 12:48 ObliviousNA wrote:
Show nested quote +
On August 04 2013 10:35 Zocat wrote:
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.


http://www.arcsynthesis.org/gltut/index.html


I've been using his site for the past few weeks, I just want to reiterate for anyone looking to learn openGL (or generic graphics programming principles taught with openGL) - it's awesome.


On August 04 2013 10:35 Zocat wrote:
Show nested quote +
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.


http://www.arcsynthesis.org/gltut/index.html


Thank you.

On August 04 2013 11:38 Blisse wrote:
Show nested quote +
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.


Unless you're trying to learn OpenGL, I would recommend using some library.

http://gamedev.stackexchange.com/questions/23652/what-alternatives-to-glut-exist


I am, I'd still file this for later after I have a better grasp at OpenGL.
@
Encdalf
Profile Joined February 2012
Germany66 Posts
August 04 2013 07:46 GMT
#6672
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.
one-one-one
Profile Joined November 2011
Sweden551 Posts
August 04 2013 12:34 GMT
#6673
On August 01 2013 10:18 darklordjac wrote:
Cool taking in everyone's input and asking some of my friends that are into coding (they all said C was a good idea except for one who said C++ but all my programmer friends make fun of him for being a C++ fanboy lol) I've decided to go ahead and start with C.

Now onto the next question, where do you guys suggest to start? I'm guessing a book or something since I don't wanna go for classes or anything of the sort (takes too much time + money) so can any of you recommend a book? Also if I have any questions would it be okay to ask here?


You are lucky. There is a very very good book for you: http://en.wikipedia.org/wiki/The_C_Programming_Language

It is widely considered as one of the best programming books out there. I have one copy at work and one at home.

Learning C is a very good idea. Don't let people scare you. There are no shortcuts in the programming world.
By getting a solid foundation in C you will also get a good understanding of how computers work from a really low level.
If you are a student I would recommend that you take courses in machine level programming and operating systems.
These will have very good synergies with your C studies.

This should be a motivator for you - look at the language trends:
http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
http://www.youtube.com/watch?feature=player_embedded&v=1BFY4R7IIP4#t=1710s
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
Last Edited: 2013-08-05 01:39:29
August 05 2013 01:30 GMT
#6674
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.

So to give you an idea of what I already know in programming so you can give me better advice, here is a simple list.

Java:
I. Threads, ExecutorService way of threads, 'synchronized' methods. A bit of semaphore knowledge, but never quite developed this and relied on synchronized instead.
II. Simple I/O network knowledge which I developed when I had to do a simple chat server at university.
III. Inheritance, arrays, an idea of what a linked list and how it works but I should implement it some day to see things for myself, HashTable
IV. An idea of generics but I haven't had practice which is something to do
V. Just bare touch on TLS and keystore to add SSL support to a small java http server as an assignment for university
VI. Limited experience with Java RMI
VII. Really, really basic GUI (awt/swing)

C:
I. Really basic stuff like using some of the common libraries like stdlib (dynamic memory, exit), stdio (printf, scanf, sscanf, fgets)... also strlen, sizeof but I think they come from stdlib. I haven't touched C recently.
II. Struct (data structure), array obviously, typedef

I also studied basic Objective-C, but I'd rather focus on other languages for now. I'm not into Apple.

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?
heroyi
Profile Blog Joined March 2009
United States1064 Posts
August 05 2013 02:04 GMT
#6675
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.
wat wat in my pants
teamamerica
Profile Blog Joined July 2010
United States958 Posts
Last Edited: 2013-08-05 08:06:27
August 05 2013 07:49 GMT
#6676
+ Show Spoiler [Old question] +

Hey guys I was looking at the python intro (http://docs.python.org/3/tutorial/introduction.html#strings) and saw an example of multiple assignments in a way I'm not used to (coming from Java/PHP).
Basically the code in question was

a,b = b, a + b

Wherein a takes the value b had (before the assignment) and b takes the value of b + a (before the assignment). So somewhere the interpreter has to store a temp variable for the value of "a" or "b", or does some trick about switching two variables without using a temp like the following from Java, right?

The only equivalent way I can think of doing it in Java is:

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


Is there some way simpler to what Python does?


Simplified my question down to:
I was reading python intro @ the python site and realized in python you can switch two variables a,b using the line
a,b = b, a


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


So I have a few questions:
1) In Java, is there a simple way to switch two objects without creating a temp object?
2) How does that line of python code get interpreted? Does it go something like

tempA = b
tempB = a
a = tempA
b = tempB


Or does it do some optimization I don't know about? I put both a tempA and tempB because it seems arbitrary of there was a tempA and not tempB created by the intrepreter....
RIP GOMTV. RIP PROLEAGUE.
CecilSunkure
Profile Blog Joined May 2010
United States2829 Posts
Last Edited: 2013-08-05 08:31:30
August 05 2013 08:31 GMT
#6677
The standard way to swap stuff is to:

temp = A;
A = B;
B = temp;


And that's that! There's not really a "faster" way unless you start getting into assembly stuff afaik.
Nesserev
Profile Blog Joined January 2011
Belgium2760 Posts
Last Edited: 2013-08-05 09:42:20
August 05 2013 08:43 GMT
#6678
--- Nuked ---
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
Last Edited: 2013-08-05 09:06:56
August 05 2013 08:44 GMT
#6679
@team

Here's what it does if you disassemble the code.

Code:

a, b = b, a

Backend:

1 0 LOAD_NAME 0 (b)
3 LOAD_NAME 1 (a)
6 ROT_TWO
7 STORE_NAME 1 (a)
10 STORE_NAME 0 (b)
13 LOAD_CONST 0 (None)
16 RETURN_VALUE


Python optimizes it by recognizing the swap assignment. It loads, the two values into the stack, calls ROT_TWO (ref) which swaps the stack, and then stores them back into their variables. No tuples here!

Code:

a, b = 1, 2

Backend:

1 0 LOAD_CONST 3 ((1, 2))
3 UNPACK_SEQUENCE 2
6 STORE_NAME 0 (a)
9 STORE_NAME 1 (b)
12 LOAD_CONST 2 (None)
15 RETURN_VALUE


With a constant RHS* it creates the tuple, and then we have the sequence unpacking into the variables.

http://stackoverflow.com/questions/4554130/fastest-way-to-swap-elements-in-python-list

Python is awesome.



And any swap mechanism other than swapping with the temp. variable is really discouraged unless you have a space requirement.
There is no one like you in the universe.
gedatsu
Profile Joined December 2011
1286 Posts
August 05 2013 09:03 GMT
#6680
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.

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.
Prev 1 332 333 334 335 336 1032 Next
Please log in or register to reply.
Live Events Refresh
Next event in 2h 50m
[ Submit Event ]
Live Streams
Refresh
StarCraft: Brood War
Tasteless 435
Free 156
Larva 129
firebathero 108
Bale 60
PianO 46
ToSsGirL 41
NaDa 31
ZergMaN 24
Noble 16
[ Show more ]
Nal_rA 12
IntoTheRainbow 9
ggaemo 1
League of Legends
JimRising 660
Counter-Strike
summit1g7205
Other Games
ceh9497
Happy257
Organizations
Other Games
gamesdonequick2429
BasetradeTV221
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 14 non-featured ]
StarCraft 2
• Berry_CruncH296
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• lizZardDota253
League of Legends
• Rush1434
• Stunt544
Upcoming Events
WardiTV Weekly
2h 50m
The PondCast
1d 1h
Replay Cast
2 days
CrankTV Team League
2 days
Replay Cast
3 days
CrankTV Team League
3 days
Replay Cast
3 days
RSL Revival
4 days
Clem vs Lambo
Scarlett vs Cure
CranKy Ducklings
4 days
IPSL
4 days
Dragon vs Hawk
[ Show More ]
RSL Revival
5 days
Classic vs Trap
herO vs SHIN
Sparkling Tuna Cup
5 days
IPSL
5 days
Bonyth vs Ret
WardiTV Weekly
6 days
Monday Night Weeklies
6 days
Liquipedia Results

Completed

YSL S3
HSC XXIX
Eternal Conflict S2 E2

Ongoing

IPSL Spring 2026
Acropolis #4
CSL 2026 Summer (S21)
RSL Revival: Season 6
CranK Gathers Season 4: BW vs SC2 Team League
SCTL 2026 Spring
XSE Pro League 2026
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

Upcoming

Escore Tournament S3: W3
ASL S22 SEASON OPEN Day 1
Escore Tournament S3: W4
ASL S22 SEASON OPEN Day 2
Escore Tournament S3: W5
CSLAN 4
Blizzard Classic Cup 2026
HSC XXX
SC4ALL II: StarCraft II
Kung Fu Cup 2026 Grand Finals
Light Tournament 2026
Eternal Conflict S2 Finale
Eternal Conflict S2 E3
Logitech G Connect 2026
StarSeries Fall 2026
FISSURE Playground #5
BLAST Open Fall 2026
Esports World Cup 2026
BLAST Bounty Summer 2026
BLAST Bounty Summer Qual
Stake Ranked Episode 3
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.