• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 09:38
CET 15:38
KST 23:38
  • 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
Rongyi Cup S3 - RO16 Preview3herO wins SC2 All-Star Invitational10SC2 All-Star Invitational: Tournament Preview5RSL Revival - 2025 Season Finals Preview8RSL Season 3 - Playoffs Preview0
Community News
Weekly Cups (Jan 12-18): herO, MaxPax, Solar win0BSL Season 2025 - Full Overview and Conclusion8Weekly Cups (Jan 5-11): Clem wins big offline, Trigger upsets4$21,000 Rongyi Cup Season 3 announced (Jan 22-Feb 7)20Weekly Cups (Dec 29-Jan 4): Protoss rolls, 2v2 returns7
StarCraft 2
General
PhD study /w SC2 - help with a survey! Oliveira Would Have Returned If EWC Continued StarCraft 2 not at the Esports World Cup 2026 [Short Story] The Last GSL Stellar Fest "01" Jersey Charity Auction
Tourneys
$21,000 Rongyi Cup Season 3 announced (Jan 22-Feb 7) OSC Season 13 World Championship $70 Prize Pool Ladder Legends Academy Weekly Open! SC2 All-Star Invitational: Jan 17-18 Sparkling Tuna Cup - Weekly Open Tournament
Strategy
Simple Questions Simple Answers
Custom Maps
[A] Starcraft Sound Mod
External Content
Mutation # 509 Doomsday Report Mutation # 508 Violent Night Mutation # 507 Well Trained Mutation # 506 Warp Zone
Brood War
General
Fantasy's Q&A video [ASL21] Potential Map Candidates BGH Auto Balance -> http://bghmmr.eu/ BW General Discussion Gypsy to Korea
Tourneys
[Megathread] Daily Proleagues Azhi's Colosseum - Season 2 Small VOD Thread 2.0 [BSL21] Non-Korean Championship - Starts Jan 10
Strategy
Current Meta Simple Questions, Simple Answers Soma's 9 hatch build from ASL Game 2 Game Theory for Starcraft
Other Games
General Games
Nintendo Switch Thread Battle Aces/David Kim RTS Megathread Stormgate/Frost Giant Megathread Beyond All Reason Awesome Games Done Quick 2026!
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
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Canadian Politics Mega-thread NASA and the Private Sector Things Aren’t Peaceful in Palestine
Fan Clubs
The herO Fan Club! The IdrA Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece
Sports
2024 - 2026 Football Thread
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
How Esports Advertising Shap…
TrAiDoS
My 2025 Magic: The Gathering…
DARKING
Life Update and thoughts.
FuDDx
How do archons sleep?
8882
James Bond movies ranking - pa…
Topin
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1444 users

The Big Programming Thread - Page 271

Forum Index > General Forum
Post a Reply
Prev 1 269 270 271 272 273 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.
phar
Profile Joined August 2011
United States1080 Posts
March 16 2013 19:36 GMT
#5401
On March 16 2013 12:33 tec27 wrote:if you're actually checking if a variable equals or does not equal a falsy value, you are generally not doing the right thing anyway

Ah, that clears things up quite a bit. js's non-transitive == always made me feel viscerally uncomfortable. Truthy/falsy helps. Is it possible to just use non-type-converting === everywhere instead (jshint could enforce this I imagine)?

Frontend still makes me
Who after all is today speaking about the destruction of the Armenians?
tec27
Profile Blog Joined June 2004
United States3702 Posts
March 16 2013 20:29 GMT
#5402
Yes, you could, but there are a helluva lot of times where you don't really care if something is, for instance, null or empty string, just that it's not an actual string.

I feel that
if(myStr) { ... }

is more readable than
if(myStr !== null && myStr !== '') { ... }


But yes, there are people who advise you to always use ===. Personally I think that's a bit like advising you to not try and understand the language's semantics and just asking for confusion, but to each their own

The JSHint option for enforcing that is 'eqeqeq', so you can enforce it with the modeline:
/*jshint eqeqeq:true */
// code here...
Can you jam with the console cowboys in cyberspace?
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
Last Edited: 2013-03-17 03:19:35
March 17 2013 03:19 GMT
#5403
^ is === equal to what == is for other languages? If yes, then what is == used for in JS, assuming it exists?
Deleted User 101379
Profile Blog Joined August 2010
4849 Posts
March 17 2013 03:36 GMT
#5404
On March 17 2013 12:19 darkness wrote:
^ is === equal to what == is for other languages? If yes, then what is == used for in JS, assuming it exists?


http://stackoverflow.com/questions/359494/javascript-vs-does-it-matter-which-equal-operator-i-use

Basically == converts to the same type and then compares, === only results in true if both types and both values are equal.

"4" == 4 is true.
"4" === 4 is false.
tec27
Profile Blog Joined June 2004
United States3702 Posts
Last Edited: 2013-03-17 04:59:01
March 17 2013 04:58 GMT
#5405
Yeah, the technical term is 'type coercion'. == is equality with type coercion, === is without (This operator is generally present in languages that have automatic type coercion, like JS and PHP). You can read more about how types get coerced here:

http://javascriptweblog.wordpress.com/2011/02/07/truth-equality-and-javascript/

(I'd recommend it over the stuff linked in the stackoverflow response above, its much more straightforward than some of the stuff there and Crockford is too dogmatic for anyone's good)
Can you jam with the console cowboys in cyberspace?
GhostLink
Profile Joined January 2011
United States450 Posts
March 17 2013 07:22 GMT
#5406
I have a webpage, and I want the links to be opened in a new tab. I used target="_blank" , but apparently it does not validate as XHTML Strict 1.0. Is there a way to make it so (another tag/method), or is it impossible under this doctype?
Let a man play chess, and tell him that every pawn is his friend. Let him think both bishops holy. Let him remember happy days in the shadows of his castles. Let him love his queen. Watch him lose them all.
tec27
Profile Blog Joined June 2004
United States3702 Posts
Last Edited: 2013-03-17 07:33:52
March 17 2013 07:33 GMT
#5407
Target is not valid under 'strict' doctypes. If you want to use it you'll need to use a transitional (or, ideally, use HTML5). Is there any particular reason you want to use that doctype in the first place? There are a lot of sites that use it completely incorrectly (like, for instance, they send the page with 'Content-type: text/html' which makes all browsers ignore that doctype), and picking a doctype other than <!DOCTYPE html> at this point is probably a bad move.

See: http://www.hixie.ch/advocacy/xhtml
Can you jam with the console cowboys in cyberspace?
GhostLink
Profile Joined January 2011
United States450 Posts
March 17 2013 07:38 GMT
#5408
It's a project for uni. One of the requirements is that we have to use the Strict Doctype. Opening links in a new tab is not a requirement, but just a feature I wanted to add.
Let a man play chess, and tell him that every pawn is his friend. Let him think both bishops holy. Let him remember happy days in the shadows of his castles. Let him love his queen. Watch him lose them all.
Yoshi-
Profile Joined October 2008
Germany10227 Posts
March 17 2013 09:05 GMT
#5409
You can't use this in XHTML.
tofucake
Profile Blog Joined October 2009
Hyrule19189 Posts
Last Edited: 2013-03-17 13:54:05
March 17 2013 13:54 GMT
#5410
On March 17 2013 16:38 GhostLink wrote:
It's a project for uni. One of the requirements is that we have to use the Strict Doctype. Opening links in a new tab is not a requirement, but just a feature I wanted to add.

JavaScript can help you out there.
Liquipediaasante sana squash banana
Yoshi-
Profile Joined October 2008
Germany10227 Posts
March 17 2013 14:05 GMT
#5411
On March 17 2013 22:54 tofucake wrote:
Show nested quote +
On March 17 2013 16:38 GhostLink wrote:
It's a project for uni. One of the requirements is that we have to use the Strict Doctype. Opening links in a new tab is not a requirement, but just a feature I wanted to add.

JavaScript can help you out there.


Just because you avoid that the w3c validator will give you an error, it doesn't mean that the code suddenly gets valid. There is a reason why the target attribute was removed and replacing it with JS certainly doesn't make the code any valid.
supereddie
Profile Joined March 2011
Netherlands151 Posts
March 17 2013 14:43 GMT
#5412
On March 17 2013 16:38 GhostLink wrote:
It's a project for uni. One of the requirements is that we have to use the Strict Doctype. Opening links in a new tab is not a requirement, but just a feature I wanted to add.

You should let the user decide if he wants to open a link in a new tab or not - do not force a certain behaviour. Any link that stays within the same site should never be opened in a new tab.

Best you can do is have a different style for links that lead to external sites, and let the use decide.
"Do not try to make difficult things possible, but make simple things simple." - David Platt on Software Design
Craton
Profile Blog Joined December 2009
United States17274 Posts
Last Edited: 2013-03-17 19:23:16
March 17 2013 19:22 GMT
#5413
Sites will often use new tab/window for external links and same tab for internal links. I find it a good convention.
twitch.tv/cratonz
MiyaviTeddy
Profile Blog Joined October 2008
Canada697 Posts
March 17 2013 22:54 GMT
#5414
In C++, what is a getter and setter method? I tried googling but I don't think I manage to find anything that help me understand what the hell are those.
Aiyeeeee
Abductedonut
Profile Blog Joined December 2010
United States324 Posts
Last Edited: 2013-03-17 22:59:28
March 17 2013 22:59 GMT
#5415
On March 18 2013 07:54 MiyaviTeddy wrote:
In C++, what is a getter and setter method? I tried googling but I don't think I manage to find anything that help me understand what the hell are those.


Getters and setters are really simple.

Say you have a class:


class Kitten
{
private string furColor;
}


// the getter, which "gets" the fur color of the kitten
string getFurColor()
{
return furColor
}

// the setter, which "sets" the fur color of the kitten
void setFurColor( String furColor)
{
this.furColor = furColor;
}


Basically: Setters and getters are ways to access private variables.
Deleted User 101379
Profile Blog Joined August 2010
4849 Posts
Last Edited: 2013-03-17 23:00:44
March 17 2013 22:59 GMT
#5416
On March 18 2013 07:54 MiyaviTeddy wrote:
In C++, what is a getter and setter method? I tried googling but I don't think I manage to find anything that help me understand what the hell are those.



class Whatever
{
private:
int x;
public:
int getX() { return this->X; } // getter
int setX(int newX) { this->X = newX; } // setter
}


Getters and setters prevent direct access to the private variables of a class and allow adding validation and triggers. Generally it's always a good idea to use getters and setters instead of making a variable public even if you don't require any validation yet because at some point in the future, you most likely want to add some sort of validation and that way you don't have to change your whole code. Also, there are many cases where you want a variable to be e.g. read-only, so having the habit of using getters and setters you can just not write the setter and that way the variable can't be set from the outside.
MiyaviTeddy
Profile Blog Joined October 2008
Canada697 Posts
March 18 2013 00:00 GMT
#5417
Thanks alot Abductedonut & Morfildur

The last few topics I'm still really confused about is:
-Inheritance
-Virtual functions
-Pure virtual
-Abstract classes

any examples or primers would be greatly appreciated! and this is helping me towards finishing my assignment.
Aiyeeeee
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
Last Edited: 2013-03-18 17:20:41
March 18 2013 00:12 GMT
#5418
On March 18 2013 09:00 MiyaviTeddy wrote:
Thanks alot Abductedonut & Morfildur

The last few topics I'm still really confused about is:
-Inheritance
-Virtual functions
-Pure virtual
-Abstract classes

any examples or primers would be greatly appreciated! and this is helping me towards finishing my assignment.


Inheritance - see lecture 26.

[link removed]


Edit: It's Java, so if you're looking for language specific code, then this may not be helpful.
Holy_AT
Profile Joined July 2010
Austria978 Posts
March 18 2013 00:13 GMT
#5419
On March 18 2013 09:00 MiyaviTeddy wrote:
Thanks alot Abductedonut & Morfildur

The last few topics I'm still really confused about is:
-Inheritance
-Virtual functions
-Pure virtual
-Abstract classes

any examples or primers would be greatly appreciated! and this is helping me towards finishing my assignment.


There is ton of stuff about this on the internet, I suggest you first google and read and if you have any specific questions you should ask more specifically.
If you don not know what OO means and what getters and setters are and what inheritance means you should really buy books or google. There are tons of tutorials and explanations for these beginner topics.
CecilSunkure
Profile Blog Joined May 2010
United States2829 Posts
Last Edited: 2013-03-18 00:42:38
March 18 2013 00:17 GMT
#5420
On March 18 2013 09:00 MiyaviTeddy wrote:
Thanks alot Abductedonut & Morfildur

The last few topics I'm still really confused about is:
-Inheritance
-Virtual functions
-Pure virtual
-Abstract classes

any examples or primers would be greatly appreciated! and this is helping me towards finishing my assignment.

These are all related to one another quite heavily.

Inheritance lets you stick one object inside of another completely. Here's a slideshow I made talking about inheritance in C. This is almost exactly like what happens in C++, but it's important to know how to do it (and actually do it yourself) in C first, in my opinion. Read the pdf to understand: what inheritance is, and why it's useful.

The pdf also covers virtual functions and how to implement them.

A pure virtual is a function that must be overridden when a class derives from a type. The compiler will complain if you don't. That's all. This is good for enforcing interfaces.

An abstract class is type that is designed to only be used as a base for derivation. Again, a good example (the only good one I know) is for interfaces.

If you're confused on what an interface is: it is just a set of functions to call. If I employ an interface, then other objects can treat me as if I employ this interface. For example say we make an object to resemble a duck. We have an interface for quacking and swimming. Other code portions can call my quack and swim functions upon me, without knowing about the rest of what I am so long as I employ the duck interface.
Prev 1 269 270 271 272 273 1032 Next
Please log in or register to reply.
Live Events Refresh
OSC
13:00
King of the Hill #235
SteadfastSC123
iHatsuTV 11
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
SteadfastSC 123
Rex 115
Creator 67
MindelVK 6
StarCraft: Brood War
Rain 12087
firebathero 3763
Shuttle 1147
Jaedong 989
Larva 676
Horang2 675
Mini 608
EffOrt 472
Hyuk 370
BeSt 279
[ Show more ]
Zeus 173
Last 143
Soulkey 132
hero 124
Sharp 101
sorry 84
Sea.KH 74
Hyun 71
Hm[arnc] 70
Mind 42
Yoon 37
Backho 34
zelot 28
910 27
ToSsGirL 25
yabsab 23
Noble 17
scan(afreeca) 15
Shinee 14
Shine 14
ZergMaN 13
Bale 11
Terrorterran 8
Icarus 6
eros_byul 1
Stormgate
BeoMulf52
Dota 2
qojqva2392
canceldota79
Counter-Strike
byalli452
edward146
Super Smash Bros
Mew2King43
Heroes of the Storm
Khaldor313
Other Games
B2W.Neo2260
singsing2089
Hui .280
Sick157
crisheroes147
XaKoH 132
KnowMe30
Organizations
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 18 non-featured ]
StarCraft 2
• Adnapsc2 10
• Kozan
• Laughngamez YouTube
• AfreecaTV YouTube
• sooper7s
• Migwel
• intothetv
• IndyKCrew
• LaughNgamezSOOP
StarCraft: Brood War
• blackmanpl 41
• Michael_bg 5
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• C_a_k_e 4455
League of Legends
• Jankos4161
• TFBlade934
• Stunt524
Upcoming Events
BSL 21
23m
QiaoGege vs Sziky
Dewalt vs Bonyth
Mihu vs TBD
Replay Cast
9h 23m
Replay Cast
18h 23m
RongYI Cup
20h 23m
Maru vs Cyan
Solar vs Krystianer
uThermal 2v2 Circuit
21h 23m
BSL 21
1d
Replay Cast
1d 9h
Wardi Open
1d 23h
Monday Night Weeklies
2 days
OSC
2 days
[ Show More ]
WardiTV Invitational
2 days
WardiTV Invitational
3 days
The PondCast
4 days
Korean StarCraft League
6 days
Liquipedia Results

Completed

Escore Tournament S1: W5
OSC Championship Season 13
NA Kuram Kup

Ongoing

C-Race Season 1
BSL 21 Non-Korean Championship
CSL 2025 WINTER (S19)
KCM Race Survival 2026 Season 1
Rongyi Cup S3
Underdog Cup #3
Tektek Cup #1
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
eXTREMESLAND 2025
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025

Upcoming

Acropolis #4 - TS4
Escore Tournament S1: W6
Escore Tournament S1: W7
Acropolis #4
IPSL Spring 2026
uThermal 2v2 2026 Main Event
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
Nations Cup 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League Season 23
ESL Pro League Season 23
PGL Cluj-Napoca 2026
IEM Kraków 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.