• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 06:47
CEST 12:47
KST 19:47
  • 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
Code S Season 1 - RO8 Preview3[ASL21] Ro8 Preview Pt2: Progenitors8Code S Season 1 - RO12 Group A: Rogue, Percival, Solar, Zoun13[ASL21] Ro8 Preview Pt1: Inheritors16[ASL21] Ro16 Preview Pt2: All Star10
Community News
Maestros of The Game 2 announcement and schedule !7Weekly Cups (April 27-May 4): Clem takes triple0RSL Revival: Season 5 - Qualifiers and Main Event12Code S Season 1 (2026) - RO12 Results12026 GSL Season 1 Qualifiers25
StarCraft 2
General
Code S Season 1 - RO8 Preview Behind the Blue - Team Liquid History Book Weekly Cups (April 27-May 4): Clem takes triple Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool Code S Season 1 (2026) - RO12 Results
Tourneys
Maestros of The Game 2 announcement and schedule ! GSL Code S Season 1 (2026) Sea Duckling Open (Global, Bronze-Diamond) RSL Revival: Season 5 - Qualifiers and Main Event Sparkling Tuna Cup - Weekly Open Tournament
Strategy
Custom Maps
[D]RTS in all its shapes and glory <3 [A] Nemrods 1/4 players
External Content
Mutation # 524 Death and Taxes The PondCast: SC2 News & Results Mutation # 523 Firewall Mutation # 522 Flip My Base
Brood War
General
Do we have a pimpest plays list? BGH Auto Balance -> http://bghmmr.eu/ (Spoiler) Asl ro8 D winner interview BW General Discussion AI Question
Tourneys
[ASL21] Ro8 Day 4 Escore Tournament StarCraft Season 2 Small VOD Thread 2.0 [BSL22] RO16 Group Stage - 02 - 10 May
Strategy
Simple Questions, Simple Answers Fighting Spirit mining rates What's the deal with APM & what's its true value Any training maps people recommend?
Other Games
General Games
Stormgate/Frost Giant Megathread Path of Exile Nintendo Switch Thread OutLive 25 (RTS Game) Dawn of War IV
Dota 2
The Story of Wings Gaming
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
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas TL Mafia Community Thread Five o'clock TL Mafia
Community
General
Canadian Politics Mega-thread European Politico-economics QA Mega-thread US Politics Mega-thread The Letting Off Steam Thread Russo-Ukrainian War Thread
Fan Clubs
The IdrA Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece [Req][Books] Good Fantasy/SciFi books
Sports
2024 - 2026 Football Thread McBoner: A hockey love story Formula 1 Discussion
World Cup 2022
Tech Support
streaming software Strange computer issues (software) [G] How to Block Livestream Ads
TL Community
The Automated Ban List
Blogs
How EEG Data Can Predict Gam…
TrAiDoS
ramps on octagon
StaticNine
Funny Nicknames
LUCKY_NOOB
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1776 users

The Big Programming Thread - Page 487

Forum Index > General Forum
Post a Reply
Prev 1 485 486 487 488 489 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.
netherh
Profile Blog Joined November 2011
United Kingdom333 Posts
June 01 2014 14:55 GMT
#9721
Haha nice. Damn Protoss is so OP.

Instead of making infestor_t a friend of fungaled_t, I think you can just make fungaled_t private. (Not that it makes much difference though).

Also, possibly you want std::move instead of std::forward in the fungaled_t(unit_t&&) constructor. (Because the constructor isn't actually a templated function). Again I'm not sure that makes any difference. /o\


explicit fungaled_t(unit_t&& unit):damage_t<std::decay_t<unit_t>>(std::move(unit)){}
nunez
Profile Blog Joined February 2011
Norway4003 Posts
Last Edited: 2014-06-01 15:52:56
June 01 2014 15:01 GMT
#9722
if you make it private but the constructor public you can move it from the callsite, which defeats the purpose. (or maybe i'm missing something?). the framework is only supposed to facilitate the fancy call syntax, not be a value type or whatevs. i think this is a 'good' use of the friend class. that fungaled_t is only alive as a glue (pun intended) in the twilight between the input type through [] and the type the call produces, and the callsite.

however you're correct on the second account, i didn't catch that, nicely done. but it doesn't matter if constructor is templated function, what is key is that unit_t has to be a deduced type (wrt to std::forward i mean, like you say it's basically just std::move there as it is).

unit_t being a deduced type implies constructor is templated but not other way around.

template<class T0> struct F{
template<class T> F(T0&& v) <- std::forward = std::move, ctor is templated, T0 not a deduced type
template<class T1> F(T1&& v) <- std::forward = conditional move, T1 is deduced type implying ctor is templated

f.ex introduce intermediate type or just pass by const& is maybe better? i dunno honestly i'll have meet some issues first before i find a solution to the eventual problems... i don't really wanna know anything about the actual type though, it'll be up to damage_t to deal with that bidness. if i can just move it through that would be nice.
template<class unit_t_>
explicit fungaled_t(unit_t_&& unit):damage_t<std::decay_t<unit_t_>>(std::forward<unit_t_>(unit)){}
conspired against by a confederacy of dunces.
3FFA
Profile Blog Joined February 2010
United States3931 Posts
June 01 2014 19:32 GMT
#9723
On June 01 2014 15:30 spinesheath wrote:
Show nested quote +
On June 01 2014 05:35 3FFA wrote:
On May 31 2014 17:16 spinesheath wrote:
On May 31 2014 09:23 FFGenerations wrote:
its fucking BRILLIANT tutorial

Make sure you don't read this one tutorial and then think you know everything. Learn from multiple sources and critically question each one. Internet tutorials are not something you should blindly depend upon. Neither is any other single source.

What about college/university?

Judging from my own experience with those, only good for getting a piece of paper that says you were there. You might have better luck with it. Certainly not trustworthy as a single source.

Well what else do you guys recommend to do along with University? So far in HS I've been following along tutorials for how to do things.
"As long as it comes from a pure place and from a honest place, you know, you can write whatever you want."
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
Last Edited: 2014-06-01 19:49:18
June 01 2014 19:48 GMT
#9724
Solve a problem that you have. Find problems you encounter in your day. Solve them.

The great part about being a software developer is that you can probably code the solution to a lot of your day to day problems. Or automate a lot of boring stuff you do.
There is no one like you in the universe.
Cyx.
Profile Joined November 2010
Canada806 Posts
Last Edited: 2014-06-01 21:45:31
June 01 2014 21:45 GMT
#9725
On June 02 2014 00:01 nunez wrote:
if you make it private but the constructor public you can move it from the callsite, which defeats the purpose. (or maybe i'm missing something?). the framework is only supposed to facilitate the fancy call syntax, not be a value type or whatevs. i think this is a 'good' use of the friend class. that fungaled_t is only alive as a glue (pun intended) in the twilight between the input type through [] and the type the call produces, and the callsite.

however you're correct on the second account, i didn't catch that, nicely done. but it doesn't matter if constructor is templated function, what is key is that unit_t has to be a deduced type (wrt to std::forward i mean, like you say it's basically just std::move there as it is).

unit_t being a deduced type implies constructor is templated but not other way around.

template<class T0> struct F{
template<class T> F(T0&& v) <- std::forward = std::move, ctor is templated, T0 not a deduced type
template<class T1> F(T1&& v) <- std::forward = conditional move, T1 is deduced type implying ctor is templated

f.ex introduce intermediate type or just pass by const& is maybe better? i dunno honestly i'll have meet some issues first before i find a solution to the eventual problems... i don't really wanna know anything about the actual type though, it'll be up to damage_t to deal with that bidness. if i can just move it through that would be nice.
template<class unit_t_>
explicit fungaled_t(unit_t_&& unit):damage_t<std::decay_t<unit_t_>>(std::forward<unit_t_>(unit)){}

lol nunez I love reading your code

spacebars are for shitheads imo =D vowels too
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
June 01 2014 22:51 GMT
#9726
that last line of code is ridiculous. cool, but ridiculous XD

has anyone built a windows desktop application that has an icon your toolbar?
There is no one like you in the universe.
3FFA
Profile Blog Joined February 2010
United States3931 Posts
June 01 2014 22:55 GMT
#9727
On June 02 2014 04:48 Blisse wrote:
Solve a problem that you have. Find problems you encounter in your day. Solve them.

The great part about being a software developer is that you can probably code the solution to a lot of your day to day problems. Or automate a lot of boring stuff you do.

Any ideas for automating English Essays?
"As long as it comes from a pure place and from a honest place, you know, you can write whatever you want."
tofucake
Profile Blog Joined October 2009
Hyrule19210 Posts
June 02 2014 00:27 GMT
#9728
On June 02 2014 07:51 Blisse wrote:
that last line of code is ridiculous. cool, but ridiculous XD

has anyone built a windows desktop application that has an icon your toolbar?

Yes
Liquipediaasante sana squash banana
nunez
Profile Blog Joined February 2011
Norway4003 Posts
June 02 2014 02:28 GMT
#9729
thx cyx. :>
conspired against by a confederacy of dunces.
Azerbaijan
Profile Blog Joined January 2010
United States660 Posts
Last Edited: 2014-06-02 03:50:28
June 02 2014 03:48 GMT
#9730
I'm working on a basic Mp3 player for a Java gui lab and I am having a weird issue where my jpanel that holds the buttons keeps getting painted with other parts of my UI. I have an add file button that creates a file chooser for selecting mp3 files but if I cancel the file selection the chooser gets stuck on the Jpanel behind the buttons. If I dont cancel and actually select an Mp3 the Jpanel begins mirroring the Jlist that the Mp3 was just added to; again its on the Jpanel but behind the buttons. Anyone know what might cause this?

edit: once stuck on the panel, the Jlist/fileChooser can't be manipulated. They are just painted on it for some reason.
Manit0u
Profile Blog Joined August 2004
Poland17743 Posts
June 02 2014 06:34 GMT
#9731
On June 02 2014 12:48 Azerbaijan wrote:
I'm working on a basic Mp3 player for a Java gui lab and I am having a weird issue where my jpanel that holds the buttons keeps getting painted with other parts of my UI. I have an add file button that creates a file chooser for selecting mp3 files but if I cancel the file selection the chooser gets stuck on the Jpanel behind the buttons. If I dont cancel and actually select an Mp3 the Jpanel begins mirroring the Jlist that the Mp3 was just added to; again its on the Jpanel but behind the buttons. Anyone know what might cause this?

edit: once stuck on the panel, the Jlist/fileChooser can't be manipulated. They are just painted on it for some reason.


Do you really need to add the fileChooser window? I faced similar problem with C# and I simply removed filechooser from the UI designer, manually created the function to choose files and it worked flawlessly.
Time is precious. Waste it wisely.
CecilSunkure
Profile Blog Joined May 2010
United States2829 Posts
June 02 2014 07:50 GMT
#9732
My god you guys write some ugly C++ code lol
nunez
Profile Blog Joined February 2011
Norway4003 Posts
Last Edited: 2014-06-02 15:19:15
June 02 2014 12:14 GMT
#9733
const Member *mem = RetrieveMemberTypeFromFile( &(meta->members), startLevel ); 
GetNumberOfConsoleInputEvents(rHnd, &numEvents);

WellCommaWhatCanISayEllipsisSpaceToEachHisOwnPeriod

~finished the chaining one (array subscript operator) two punch (function call operator) framework for the sockets, calling it a directive for now (full disclosure: i inflated all the names just for you guys, it says dir_t,vrb_t,cnstr_t etc... in the source files).

chaining implemented by holding a const ref to the directive and doing function calls through constrained_t, this way it's not intrusive on the supplied type. calls the function call operator on a supplied verb_t constructed with whater enters through it's array subscript operator, also allows for specifying additional template params for verb_t to be instantiated with. usage just like posted earlier:

directive      [ subject ] ( objects... )
                  [ subject ] ( objects... )
                  ...
;

the requirements on the supplied verb_t type is that it takes the bare type of the subject as a template parameter, and provides the appropriate constructor for the decorations the subject_t is being forwarded with, as well as providing a const function call operator for whatever objects it's being used with.

+ Show Spoiler [code] +
template<template<class,class...> class verb_tt,class... adverbs>
struct directive_t{
directive_t(){}
directive_t(directive_t const&) =delete;
directive_t(directive_t&&) =delete;
directive_t& operator=(directive_t const&) =delete;
directive_t& operator=(directive_t&&) =delete;

template<class decorated_subject_t> using verb_t=verb_tt<std::decay_t<decorated_subject_t>,adverbs...>;

template<class subject_t0>
struct constrained_t:verb_t<subject_t0>{
constrained_t(constrained_t const&) =delete;
constrained_t& operator=(constrained_t const&) =delete;
constrained_t& operator=(constrained_t&&) =delete;

template<class... object_ts>
directive_t const&
operator()(
object_ts&&... os
)const{
static_cast<verb_t<subject_t0> const&>(*this)(std::forward<object_ts>(os)...);
return dir;
}

private:
friend class directive_t;
directive_t const& dir;

template<class subject_t1>
explicit constrained_t(
directive_t const& dir_,subject_t1&& sub
):directive(dir_),verb_t<subject_t1>(std::forward<subject_t1>(sub)){}

constrained_t(
constrained_t&& cns
):directive(cns.dir),verb_t<subject_t0>(std::move(cns)){}

};

template<class subject_t>
decltype(auto)
operator[](
subject_t&& sub
)const{ return constrained_t<subject_t>(*this,std::forward<subject_t>(sub)); }

};


turned out sweet, i might even keep it and was a fun detour.
thx for help netherh.
conspired against by a confederacy of dunces.
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
Last Edited: 2014-06-02 17:12:54
June 02 2014 17:05 GMT
#9734
Can anyone explain the 'L' in SOLID? I really cannot find sense in being able to replace a subclass with its base class. If it's the opposite way, then it would make more sense I think.

Edit: So it's actually replacing the base class with its subclass?
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
June 02 2014 17:19 GMT
#9735
On June 03 2014 02:05 darkness wrote:
Can anyone explain the 'L' in SOLID? I really cannot find sense in being able to replace a subclass with its base class. If it's the opposite way, then it would make more sense I think.

http://en.wikipedia.org/wiki/Liskov_substitution_principle
Let q(x) be a property provable about objects x of type T. Then q(y) should be provable for objects y of type S where S is a subtype of T.


So you should be able to freely plug in any of the base class and its subclasses into your program without breaking any important behavior. Of course you'll observe different behavior if for example you plug in different gui implementations, but you should not rely on having a certain subclass.

In other words: don't cast base types to subtypes, don't switch on their types. If you need a specific subtype, don't accept a base type.
If you have a good reason to disagree with the above, please tell me. Thank you.
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
June 02 2014 18:02 GMT
#9736
Thanks! Is it still ok if a subclass adds new features which aren't needed when a base class is substituted for its subclass?

Additional question, is there a noticeable difference between software developers that have different background (e.g. math, physics and computer science)? Is the computer science background preferred over others? I'm applying for jobs, and I'm wondering if maths and physics students have any edge other than being better at mathematics.
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
Last Edited: 2014-06-02 18:46:16
June 02 2014 18:43 GMT
#9737
Not really sure what you're asking there, the point of the subclass is to extend the functionality of the base class. LSP just says that invariants (pre and post conditions) that hold up for the base class shouldn't fail if you use the subclass instead of the base class. rectangle.setHeight shouldn't modify width, but if square extends rectangle, square.setHeight must modify width, so that hierarchy is a violation of LSP. You can extend functionality so long as the base class's invariants aren't affected. If they are, that's a sign there's probably another way of doing what you're doing.

Computer science is obviously preferred because you actually learn some software development principles and write non-trivial code. No employer really cares though once you have job experience. If you don't have job experience you can just have project experience and that substitutes in well until you have job experience.
There is no one like you in the universe.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
June 02 2014 18:48 GMT
#9738
If I were to take employees, I'd take people who studied math over people who studied comp sci any day. In math you actually learn stuff. That is again based on my personal experiences at university though.
If you have a good reason to disagree with the above, please tell me. Thank you.
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
Last Edited: 2014-06-02 20:13:59
June 02 2014 20:09 GMT
#9739
Comp sci at my school isn't really interesting until year 3.5 where you have the options to take the big kids courses (distributed, networking, real time, concurrency, computer structures, compilers, graphics and more for us). you don't really get the option to take them until like the last year of school because of pre-requisites and a lot of people i know don't really want to take half of them.

Math seems a lot more hardcore (fourier series t-t) but if the math guy doesn't have the comp sci experience i don't see how you could justify hiring him for a dev position.
There is no one like you in the universe.
Blitzkrieg0
Profile Blog Joined August 2010
United States13132 Posts
Last Edited: 2014-06-02 21:10:29
June 02 2014 21:06 GMT
#9740
On June 03 2014 05:09 Blisse wrote:
Math seems a lot more hardcore (fourier series t-t) but if the math guy doesn't have the comp sci experience i don't see how you could justify hiring him for a dev position.


Teaching the physicist how to python is a lot easier than teaching a python guy advanced physics. Now granted the smart thing to do is to hire someone that knows both already, but if that isn't an option.
I'll always be your shadow and veil your eyes from states of ain soph aur.
Prev 1 485 486 487 488 489 1032 Next
Please log in or register to reply.
Live Events Refresh
The PondCast
10:00
Episode 92
CranKy Ducklings47
LiquipediaDiscussion
Escore
10:00
Week 6
escodisco1378
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
ProTech129
Rex 9
StarCraft: Brood War
Calm 4140
Sea 2830
Horang2 562
Hyuk 471
BeSt 240
Mini 213
Light 189
EffOrt 184
actioN 182
Stork 181
[ Show more ]
Zeus 138
Soma 124
Soulkey 119
ggaemo 111
Killer 108
Dewaltoss 95
ZerO 91
Pusan 80
ToSsGirL 76
Hyun 60
hero 58
Mong 51
Sharp 50
Rush 42
Hm[arnc] 41
Backho 41
Liquid`Ret 40
910 34
Free 31
sorry 29
Shinee 28
Shine 25
Barracks 19
Bale 18
Sacsri 17
yabsab 15
soO 14
scan(afreeca) 14
[sc1f]eonzerg 12
GoRush 11
ajuk12(nOOB) 9
Terrorterran 3
Dota 2
monkeys_forever172
League of Legends
Reynor17
Counter-Strike
zeus727
allub219
edward94
Other Games
gofns16632
singsing1526
B2W.Neo510
DeMusliM332
Lowko193
KnowMe152
Mew2King72
NeuroSwarm48
ZerO(Twitch)6
Organizations
Other Games
gamesdonequick1265
StarCraft: Brood War
lovetv 7
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 19 non-featured ]
StarCraft 2
• CranKy Ducklings SOOP67
• LUISG 45
• StrangeGG 35
• Adnapsc2 2
• Kozan
• sooper7s
• Migwel
• LaughNgamezSOOP
• IndyKCrew
• intothetv
• AfreecaTV YouTube
StarCraft: Brood War
• iopq 2
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• TFBlade940
• Nemesis714
• Stunt514
Other Games
• WagamamaTV292
Upcoming Events
WardiTV Invitational
14m
Zoun vs Ryung
Lambo vs ShoWTimE
Rex9
WardiTV6
Big Brain Bouts
5h 14m
Fjant vs Bly
Serral vs Shameless
OSC
11h 14m
The PiG Daily
12h 14m
Maru vs Rogue
TBD vs Classic
herO vs Solar
ByuN vs Solar
Replay Cast
13h 14m
CranKy Ducklings
23h 14m
RSL Revival
23h 14m
SHIN vs Bunny
ByuN vs Shameless
WardiTV Invitational
1d
Krystianer vs TriGGeR
Cure vs Rogue
SC Evo League
1d 2h
uThermal 2v2 Circuit
1d 4h
[ Show More ]
BSL
1d 8h
Artosis vs TerrOr
spx vs StRyKeR
Replay Cast
1d 13h
Sparkling Tuna Cup
1d 23h
RSL Revival
1d 23h
Cure vs Zoun
Clem vs Lambo
WardiTV Invitational
2 days
BSL
2 days
Dewalt vs DragOn
Aether vs Jimin
GSL
2 days
Afreeca Starleague
2 days
Soma vs Leta
Wardi Open
3 days
Monday Night Weeklies
3 days
OSC
3 days
CranKy Ducklings
3 days
Afreeca Starleague
3 days
Light vs Flash
Replay Cast
4 days
Replay Cast
5 days
The PondCast
5 days
Replay Cast
6 days
RSL Revival
6 days
Liquipedia Results

Completed

Proleague 2026-05-05
WardiTV TLMC #16
Nations Cup 2026

Ongoing

BSL Season 22
ASL Season 21
CSL 2026 SPRING (S20)
IPSL Spring 2026
KCM Race Survival 2026 Season 2
Acropolis #4
Escore Tournament S2: W6
SCTL 2026 Spring
RSL Revival: Season 5
2026 GSL S1
BLAST Rivals Spring 2026
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2

Upcoming

KK 2v2 League Season 1
BSL 22 Non-Korean Championship
YSL S3
Escore Tournament S2: W7
Escore Tournament S2: W8
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
Maestros of the Game 2
2026 GSL S2
BLAST Bounty Summer 2026: Closed Qualifier
Stake Ranked Episode 3
XSE Pro League 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
IEM Atlanta 2026
Asian Champions League 2026
PGL Astana 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.