• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 23:21
CEST 05:21
KST 12: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
[ASL22] Ro24 Preview: Siren's Call8[ASL22] Ro24 Preview: Summer's End9Serral wins HomeStory Cup 2915Serral wins Maestros of the Game 244ByuL, and the Limitations of Standard Play3
Community News
Stellar Fest TWO the Moon (Dec 16-20)8Weekly Cups (August 24-30): Patches' balance mod takes over2New 3v3 BGH Ladder (and more) on ShieldBattery!40Weekly Cups (August 17-23): Zerg dominate the week6Weekly Cups (August 10-16): SHIN doubles4
StarCraft 2
General
Weekly Cups (August 10-16): SHIN doubles Nexon wins bid to develop StarCraft IP content, distribute Overwatch mobile game SC4ALL II: SC2 Player Announcement 6/8 - Maru Weekly Cups (August 24-30): Patches' balance mod takes over How would you feel about frequent/monthly balance patches for SC2?
Tourneys
2026 GSTL Announcement Stellar Fest TWO the Moon (Dec 16-20) PIG STY FESTIVAL 8.0! (13 - 23 August) Sparkling Tuna Cup - Weekly Open Tournament IntoTheTV X SOOP SC2 League : Weekly & Monthly
Strategy
[G] Having the right mentality to improve
Custom Maps
Nexus Wars 2021 GUIDE [M] (2) Industrial Park
External Content
Mutation # 541 Binary Choice The PondCast: SC2 News & Results Mutation # 540 Dodge This Mutation # 539 Thunder Dome
Brood War
General
ASL22 General Discussion BGH Auto Balance -> http://bghmmr.eu/ BW General Discussion [Personal Project Share] Terran Defense v0.60 XUN appreciation thread
Tourneys
[Megathread] Daily Proleagues BSL LAN Party - Kraków 29-30 August - OPEN SIGNUPS [ASL22] Ro24 Group F Small VOD Thread 2.0
Strategy
Replay Review Process - What do you do? Game Theory for Starcraft Odyssey Mineral Stack Saturation Fighting Spirit mining rates
Other Games
General Games
[Maplestory Hardcore] Let's Play~!! General RTS Discussion Thread Stratus: Battle for the sky now on steam Early acc Nintendo Switch Thread Stormgate/Frost Giant Megathread
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
[TL LoL EUW IHs] Teemo shall perish TSM pausing esports and CLG Dead
Heroes of the Storm
Heroes of the Storm 2.0
Hearthstone
Deck construction bug
TL Mafia
TL Mafia Power Rank TL Mafia Community Thread NeO.D_StephenKing vs This Guy From 1 Million Dance
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine Canadian Politics Mega-thread European Politico-economics QA Mega-thread
Fan Clubs
MarineLorD Fan Club The Creator Fan Club The ShoWTimE Fan Club
Media & Entertainment
Movie Discussion! Anime Discussion Thread
Sports
Football (Soccer) Thread TeamLiquid Health and Fitness Initiative For 2023 MLB/Baseball 2023 NBA General Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List Northern Ireland Global Starcraft
Blogs
Regacy Esports: The Bh…
regacyesports
Violent Games and Crime Rate…
TrAiDoS
LOCKPICKING NOOB
LUCKY_NOOB
Cathedral Of CS And NY pizza a…
FuDDx
Please support my new stand…
Peanutsc
Customize Sidebar...

Website Feedback

Closed Threads



Active: 5531 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
2026 GSTL: Main Stage Day 4
CranKy Ducklings139
Discussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
WinterStarcraft541
RuFF_SC2 194
ProTech127
ViBE123
StarCraft: Brood War
Rain 2325
GuemChi 1911
sSak 62
Noble 5
Dota 2
NeuroSwarm188
LuMiX0
League of Legends
JimRising 695
Counter-Strike
summit1g6284
Coldzera 771
minikerr37
Super Smash Bros
Mew2King89
Other Games
XaKoH 360
PiGStarcraft228
C9.Mang0199
Sick152
Livibee123
Maynarde117
[ Show 12 non-featured ]
StarCraft 2
• davetesta36
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• Migwel
StarCraft: Brood War
• RayReign 22
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Lourlo936
Other Games
• Scarra924
Upcoming Events
The PondCast
6h 39m
OSC
19h 9m
IntoTheTV X SOOP
1d 7h
CranKy Ducklings
2 days
Sparkling Tuna Cup
3 days
OSC
3 days
Shopify Rebellion Sundays
3 days
Mixu vs TBD
Spirit vs TBD
Clem vs TBD
Afreeca Starleague
4 days
Soma vs Shuttle
BeSt vs Rush
WardiTV Weekly
4 days
Afreeca Starleague
5 days
Leta vs ggaemo
Jaedong vs Queen
[ Show More ]
GSL
5 days
PiGosaur Cup
5 days
Kung Fu Cup
6 days
Replay Cast
6 days
Liquipedia Results

Completed

Proleague 2026-09-02
PiG Sty Festival 8.0
Light Tournament 2026

Ongoing

KCM Race Survival 2026 Season 3
K-JUNGMAN
ASL Season 22
Super Anchor Qualifying S3
CSL 2026 AUTUMN (S22)
RSL Revival: Season 6
Calamity Invitational
Big Dog Cup 2026 Div 1
BLAST Open Fall 2026
Esports World Cup 2026
Esports World Cup 2026: LCQ
BLAST Bounty Summer 2026
BLAST Bounty Summer Qual
Stake Ranked Episode 3
XSE Pro League 2026
IEM Cologne Major 2026

Upcoming

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