• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 11:22
CEST 17:22
KST 00:22
  • 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: 1472 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 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.