• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 23:09
CET 05:09
KST 13:09
  • 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 Stormgate/Frost Giant Megathread Nintendo Switch Thread 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
Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread US Politics Mega-thread 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
James Bond movies ranking - pa…
Topin
Esports Earnings: Bigger Pri…
TrAiDoS
Thanks for the RSL
Hildegard
Saturation point
Uldridge
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1558 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
Replay Cast
00:00
WardiTV Mondays #62
CranKy Ducklings130
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
RuFF_SC2 185
Nathanias 154
trigger 9
StarCraft: Brood War
Tasteless 103
Shine 86
Bale 57
NaDa 27
Icarus 7
Dota 2
monkeys_forever842
NeuroSwarm141
League of Legends
JimRising 651
Counter-Strike
Coldzera 1376
Fnx 297
Other Games
summit1g13284
tarik_tv4906
shahzam600
C9.Mang0303
WinterStarcraft211
ViBE177
Mew2King97
Organizations
Other Games
gamesdonequick979
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 14 non-featured ]
StarCraft 2
• Hupsaiya 116
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• RayReign 20
• Azhi_Dahaki3
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Doublelift3930
Upcoming Events
The PondCast
5h 51m
OSC
11h 51m
Demi vs Mixu
Nicoract vs TBD
Babymarine vs MindelVK
ForJumy vs TBD
Shameless vs Percival
Replay Cast
19h 51m
Korean StarCraft League
1d 22h
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.