• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 16:17
CET 22:17
KST 06:17
  • 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
RSL Offline FInals Sea Duckling Open (Global, Bronze-Diamond) $5,000+ WardiTV 2025 Championship Constellation Cup - Main Event - Stellar Fest RSL Revival: Season 3
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
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 BW General Discussion
Tourneys
[Megathread] Daily Proleagues [BSL21] RO16 Group B - Sunday 21:00 CET [BSL21] RO16 Group C - Saturday 21:00 CET Small VOD Thread 2.0
Strategy
Game Theory for Starcraft How to stay on top of macro? Current Meta PvZ map balance
Other Games
General Games
Stormgate/Frost Giant Megathread ZeroSpace 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: 1632 users

The Big Programming Thread - Page 462

Forum Index > General Forum
Post a Reply
Prev 1 460 461 462 463 464 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.
MichaelEU
Profile Joined February 2011
Netherlands816 Posts
April 01 2014 10:51 GMT
#9221
On April 01 2014 19:48 Manit0u wrote:
Show nested quote +
On April 01 2014 18:10 MichaelEU wrote:
On April 01 2014 17:41 Manit0u wrote:
On April 01 2014 16:36 icystorage wrote:
im actually pissed reading that lol. im like "WHY WOULD YOU DELETE STUFF IN A CRITICAL MOMENT?!"


I was working crazy hours and my brain didn't process stuff as intended...


What happened to version control?


There wasn't any. Didn't want to bother with doing it for such a small project that I was working alone with. Came back to bite me in the ass in the end.


I guess it made for a valuable lesson.

If I imagine taking more than an hour for anything I git init.
世界を革命する力を!― znf: "Michael-oniichan ( *^▽^*)ノ✩キラ✩"
nunez
Profile Blog Joined February 2011
Norway4003 Posts
Last Edited: 2014-04-01 14:21:46
April 01 2014 14:21 GMT
#9222
put some time aside to get gcc-4.9.0 up and running with -std=c++1y.
return type deduction with decltype(auto) seems very sweet.
conspired against by a confederacy of dunces.
Rollin
Profile Joined March 2011
Australia1552 Posts
April 01 2014 14:33 GMT
#9223
On April 01 2014 23:21 nunez wrote:
put some time aside to get gcc-4.9.0 up and running with -std=c++1y.
return type deduction with decltype(auto) seems very sweet.

I personally didn't understand the appeal with the somewhat strange syntax.
Throw off those chains of reason, and your prison disappears. | Check your posting frequency timeline: http://www.teamliquid.net/mytlnet/post_activity_img.php
Manit0u
Profile Blog Joined August 2004
Poland17495 Posts
April 01 2014 14:45 GMT
#9224
Woohoo! The test was passed. Need to put failsafes back into the app though.

Much weight.
Such lift.
Wow.
Time is precious. Waste it wisely.
nunez
Profile Blog Joined February 2011
Norway4003 Posts
Last Edited: 2014-04-01 14:57:55
April 01 2014 14:47 GMT
#9225
@rollin i think it's born out of necessity. they seem very hesitant to introduce new keywords. but i am not knowledgeable and easily confused, maybe i will get irked at a later point in time (just auto would be sweet). here's the rationale from the proposal:

Difference from decltype

Unfortunately, there is no way to get the effect of decltype with an auto return type; plain auto never deduces to a reference, and auto&& always deduces to a reference. This is a significant problem, as it means that forwarding functions can't use auto. We could consider using decltype semantics instead of the existing auto semantics, but that would mean giving different deduction semantics to auto depending on whether the declaration is of a variable or a function, and making auto functions different from lambdas.

Therefore, I propose to also allow decltype(auto) to get the decltype semantics without having to repeat the expression. For simplicity of specification and orthogonality I propose to allow it everywhere that plain auto is allowed, except for introducing a trailing-return-type. It occurs to me that the difference in meaning of decltype depending on the form of the expression (e.g. parenthesized or not) might be more surprising in this context, but I think it would be even more surprising if this worked differently from C++11 decltype.
src

@manitou $

i wonder if it would be possible to get type deduction for initializing of static variables too...
conspired against by a confederacy of dunces.
Manit0u
Profile Blog Joined August 2004
Poland17495 Posts
April 01 2014 16:09 GMT
#9226
Damn, it's so irksome when you're doing something based on strings (like assigning value of one string to the other) and then you discover that string can return "string", "" or 0, the latter resulting with fatal error because something was expecting a string and it got an int.

Also, a pop quiz for all of you (regarding my latest headaches):
What do you get when you try to invoke line[0] on an empty line?
Time is precious. Waste it wisely.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
April 01 2014 17:30 GMT
#9227
On April 01 2014 06:18 Cyx. wrote:
Show nested quote +
On April 01 2014 03:52 spinesheath wrote:
As I said, I find the C/C++ version harder to read too, but it provides that little extra safety against typos. In languages like C# where you don't have the stupid implicit pointer to bool cast, you don't need it.

Or you could compile with warnings as errors, then you get the best of both worlds - compiler error when you typo, and you don't have to make your code awkward to read ^^

Warnings as errors is always on, that's not even up for discussion. Max warning level as well. So yeah, it's not really necessary to use the proper C/C++ style. But you can never have enough safety nets in those languages.

And I sure hope that macro stuff is actual C. Makes me shudder.
If you have a good reason to disagree with the above, please tell me. Thank you.
Fawkes
Profile Blog Joined May 2010
Canada1935 Posts
April 02 2014 17:50 GMT
#9228
I'm looking for recommended books and articles on learning C# and .NET from scratch, anybody have anything they would suggest?
Taeyeon ~ Jennie ~ Seulgi ~ Irene @Fawkes711
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
April 02 2014 18:17 GMT
#9229
Other than the MSDN overview?

Use WPF instead of WinForm.
There is no one like you in the universe.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
April 02 2014 18:58 GMT
#9230
I found C# fairly easy to pick up. Basically I just started a project and googled as questions came up. I had a decent amount of C++ experience, but still I don't think it should be too hard just from the internet (Stackoverflow + MSDN). General good OOP practices are what you should be most concerned about, the rest is easy with C#.

WPF has a fairly steep learning curve, but is well worth it.
If you have a good reason to disagree with the above, please tell me. Thank you.
Manit0u
Profile Blog Joined August 2004
Poland17495 Posts
Last Edited: 2014-04-02 19:14:31
April 02 2014 19:11 GMT
#9231
I'm using GTK# since I mostly work under Linux.

And as far as books go this one is fine: http://shop.oreilly.com/product/0636920024064.do

I'm constantly using docs found on MSDN, dotnetperls.com etc. but I've found a long time ago that nothing really beats a good book on the subject. Especially that books are easier to learn from and remember what you learn (the way our brain works with roadmaps and all, e-books and Internet articles simply don't give you that).
Time is precious. Waste it wisely.
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
April 03 2014 16:47 GMT
#9232
My main problem with books is that you can't CTRL+F through them, and I don't really have the time nor need to go step-by-step through any textbook. Maybe if you have a lot more time on your hands then they would be useful, but online references have usually been good. A pdf version of the book would be better too, but I don't absolutely buy the idea that books are easier to learn from unless you're actually going through the book page by page.
There is no one like you in the universe.
Fawkes
Profile Blog Joined May 2010
Canada1935 Posts
Last Edited: 2014-04-03 21:53:39
April 03 2014 21:44 GMT
#9233
Guess I'll slowly work through MSDN and stuff.

Need help with a SQL query, trying to update 2 columns on rows in a table that match a certain criteria. Assuming I have a userid column that starts with '13%', and I want to change every userid that starts like that to '14%'...so something like

13Fawkes would be turned into 14Fawkes, is this possible?


mySQL

update 'tablename'
set 'user_id' = CONCAT('14', SUBSTRING('user_id', 3)), 'user_id_clone' = CONCAT('14', SUBSTRING('user_id', 3))
where 'user_id' LIKE '13%'


Would this work?
Taeyeon ~ Jennie ~ Seulgi ~ Irene @Fawkes711
LaNague
Profile Blog Joined April 2010
Germany9118 Posts
Last Edited: 2014-04-03 22:56:49
April 03 2014 22:54 GMT
#9234
Murach C# is a good introduction and has exercises, but not very hard ones.
There is also Essential C#, Manning C# in Depth and others for more indepth features.

I like C# a lot and often the problem is simply that you didnt know about a technique or a .net class that solves all issues you had




Also, what do you guys think is the most elegant way to pop a messagebox/new form, pause execution of the main program and meanwhile send and read data from a USB port, while in the mainform if possible a "cancel" button should still be active.
Once something specific is read on USB, messagebox goes away and the program continues.


Im not good with all this multithreading. TT
Manit0u
Profile Blog Joined August 2004
Poland17495 Posts
Last Edited: 2014-04-04 00:25:19
April 04 2014 00:22 GMT
#9235
On April 04 2014 01:47 Blisse wrote:
My main problem with books is that you can't CTRL+F through them, and I don't really have the time nor need to go step-by-step through any textbook. Maybe if you have a lot more time on your hands then they would be useful, but online references have usually been good. A pdf version of the book would be better too, but I don't absolutely buy the idea that books are easier to learn from unless you're actually going through the book page by page.


That's why you have numerous indexes in the book, you can search through them too, you just have to know how

Also, it's easier to learn from a book because it's a physical object that gives you more references to the information you seek. Stuff you don't normally notice, like how far it is from the beginning/end of the book judging by how much paper you feel under your fingers, where is it located on the page etc. That's how our brain memorizes stuff.

As an example: It is easier to learn about numerous characters in the book, their names, appearance, history etc. than it is to memorize a 30 digit number even though the amount of data is vastly greater in the first case. It's all because of this roadmaps with waypoints that your brain creates when reading an actual book. That's also why in the memory-enhancing classes they teach you to make stories when you have to memorize something so that instead of having to commit a long number to the memory you remember stuff like 5 elephants bought 3 apples but monkeys stole 2 of them and sold them for 4 pennies. Even though at first it seems that memorizing a story is harder since it's more data it's actually easier for your brain to process because that's how it's built.

You don't necessarily have to read through the entire textbook too. Just pick it up if you need something, go through the index and try to find it. If you ever need that info again you'll be surprised how fast you can find it again (usually even faster than searching on the net). The added benefit is that after you read it in the book there's a greater chance that it'll stay with you and you won't have to look for it again.
Time is precious. Waste it wisely.
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
Last Edited: 2014-04-04 00:56:48
April 04 2014 00:53 GMT
#9236
I've been reading a bit of that "Clean Code" book. One of the suggestions is not to return null but to throw an exception or return a special case object. Is that how you guys do it as well? I've recently got annoyed at some bits of my code that are if (object == null).

But then, do you have to catch those exceptions? Can't they go silently like "return" in a void method? What about int/boolean methods though? "return" is insufficient there, but if you write "return -1", then whether you check for (object == null) or (object != -1) kind of has the same purpose.
CatNzHat
Profile Blog Joined February 2011
United States1599 Posts
April 04 2014 04:17 GMT
#9237
On April 04 2014 09:53 darkness wrote:
I've been reading a bit of that "Clean Code" book. One of the suggestions is not to return null but to throw an exception or return a special case object. Is that how you guys do it as well? I've recently got annoyed at some bits of my code that are if (object == null).

But then, do you have to catch those exceptions? Can't they go silently like "return" in a void method? What about int/boolean methods though? "return" is insufficient there, but if you write "return -1", then whether you check for (object == null) or (object != -1) kind of has the same purpose.


Returning null can be appropriate in some cases, raising an exception in others, it depends on context. If you're code is going to break if the return value is null then it should throw an exception plain and simple. Things get a bit more complicated with accessor methods in some situations, recent example I ran into was an accessor method for a signed cookie. If it successfully unsigns the cookie then it will return the value, otherwise it will return nil (which could be caused by bad cookie value or no cookie at all). This creates a clean encapsulation for accessing the signed cookie values that is easy to test. An example of a situation where returning nil could be a problem: you have a object being assigned through a function, and then a method being invoked on that object. If the object returns nil the method call will cause an exception. Better to have it blow up at the source rather than somewhere down the chain.
CatNzHat
Profile Blog Joined February 2011
United States1599 Posts
April 04 2014 04:26 GMT
#9238
On April 04 2014 06:44 Fawkes wrote:
Guess I'll slowly work through MSDN and stuff.

Need help with a SQL query, trying to update 2 columns on rows in a table that match a certain criteria. Assuming I have a userid column that starts with '13%', and I want to change every userid that starts like that to '14%'...so something like

13Fawkes would be turned into 14Fawkes, is this possible?


mySQL

update 'tablename'
set 'user_id' = CONCAT('14', SUBSTRING('user_id', 3)), 'user_id_clone' = CONCAT('14', SUBSTRING('user_id', 3))
where 'user_id' LIKE '13%'


Would this work?

Why do you have a user_id_clone column? Is it always a clone? (if it's not then your where clause will muck things up)
If you want to do regex replaces: https://github.com/mysqludf/lib_mysqludf_preg#readme

I don't have mysql installed on this box but it does look like that would work.

I am concerned as to why you would ever want to do this ever like seriously what is going on here.
CatNzHat
Profile Blog Joined February 2011
United States1599 Posts
April 04 2014 04:32 GMT
#9239
On April 04 2014 09:22 Manit0u wrote:
Show nested quote +
On April 04 2014 01:47 Blisse wrote:
My main problem with books is that you can't CTRL+F through them, and I don't really have the time nor need to go step-by-step through any textbook. Maybe if you have a lot more time on your hands then they would be useful, but online references have usually been good. A pdf version of the book would be better too, but I don't absolutely buy the idea that books are easier to learn from unless you're actually going through the book page by page.


That's why you have numerous indexes in the book, you can search through them too, you just have to know how

Also, it's easier to learn from a book because it's a physical object that gives you more references to the information you seek. Stuff you don't normally notice, like how far it is from the beginning/end of the book judging by how much paper you feel under your fingers, where is it located on the page etc. That's how our brain memorizes stuff.

As an example: It is easier to learn about numerous characters in the book, their names, appearance, history etc. than it is to memorize a 30 digit number even though the amount of data is vastly greater in the first case. It's all because of this roadmaps with waypoints that your brain creates when reading an actual book. That's also why in the memory-enhancing classes they teach you to make stories when you have to memorize something so that instead of having to commit a long number to the memory you remember stuff like 5 elephants bought 3 apples but monkeys stole 2 of them and sold them for 4 pennies. Even though at first it seems that memorizing a story is harder since it's more data it's actually easier for your brain to process because that's how it's built.

You don't necessarily have to read through the entire textbook too. Just pick it up if you need something, go through the index and try to find it. If you ever need that info again you'll be surprised how fast you can find it again (usually even faster than searching on the net). The added benefit is that after you read it in the book there's a greater chance that it'll stay with you and you won't have to look for it again.


You can find memory hookes when reading on a computer just as well as with a physical book. Groupings of paragraphs on the page, line numbers, etc... All that being said memorization isn't very valuable when it comes to programming. You shouldn't have to rely on memorization techniques for your understanding of data structures and algorithms, and the things that are handy to have memorized can be looked up in a few seconds on a computer and eventually will be memorized if you use them enough. (And if you don't, then they weren't worth the effort to memorize.)
phar
Profile Joined August 2011
United States1080 Posts
April 04 2014 05:26 GMT
#9240
On April 04 2014 13:17 CatNzHat wrote:
Show nested quote +
On April 04 2014 09:53 darkness wrote:
I've been reading a bit of that "Clean Code" book. One of the suggestions is not to return null but to throw an exception or return a special case object. Is that how you guys do it as well? I've recently got annoyed at some bits of my code that are if (object == null).

But then, do you have to catch those exceptions? Can't they go silently like "return" in a void method? What about int/boolean methods though? "return" is insufficient there, but if you write "return -1", then whether you check for (object == null) or (object != -1) kind of has the same purpose.

recent example I ran into was an accessor method for a signed cookie. If it successfully unsigns the cookie then it will return the value, otherwise it will return nil (which could be caused by bad cookie value or no cookie at all). This creates a clean encapsulation for accessing the signed cookie values that is easy to test.


In cases like these you can consider using Optional<T> instead of @Nullable T.
Who after all is today speaking about the destruction of the Armenians?
Prev 1 460 461 462 463 464 1032 Next
Please log in or register to reply.
Live Events Refresh
Next event in 2h 44m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
IndyStarCraft 199
StarCraft: Brood War
Calm 2467
Larva 347
Shuttle 334
Dewaltoss 136
ggaemo 101
Dota 2
syndereN822
canceldota147
Counter-Strike
pashabiceps1904
Foxcn235
Heroes of the Storm
Liquid`Hasu514
Other Games
Grubby7065
FrodaN987
KnowMe251
Sick196
C9.Mang0144
RotterdaM114
Livibee77
Trikslyr61
ArmadaUGS51
ZombieGrub46
Chillindude26
Organizations
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 19 non-featured ]
StarCraft 2
• HeavenSC 57
• sooper7s
• Migwel
• LaughNgamezSOOP
• AfreecaTV YouTube
• IndyKCrew
• intothetv
• Kozan
StarCraft: Brood War
• FirePhoenix10
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• Ler97
League of Legends
• Nemesis2860
• TFBlade1038
Other Games
• imaqtpie1247
• Scarra583
• WagamamaTV365
• Shiphtur152
Upcoming Events
Replay Cast
2h 44m
The PondCast
12h 44m
OSC
18h 44m
Demi vs Mixu
Nicoract vs TBD
Babymarine vs MindelVK
ForJumy vs TBD
Shameless vs Percival
Replay Cast
1d 2h
Korean StarCraft League
2 days
CranKy Ducklings
2 days
WardiTV 2025
2 days
SC Evo League
2 days
BSL 21
2 days
Sziky vs OyAji
Gypsy vs eOnzErG
OSC
3 days
Solar vs Creator
ByuN vs Gerald
Percival vs Babymarine
Moja vs Krystianer
EnDerr vs ForJumy
sebesdes vs Nicoract
[ Show More ]
Sparkling Tuna Cup
3 days
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
5 days
WardiTV 2025
5 days
StarCraft2.fi
5 days
PiGosaur Monday
6 days
StarCraft2.fi
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.