• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 16:29
CET 22:29
KST 06:29
  • 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 Revival - 2025 Season Finals Preview8RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12
Community News
[BSL21] Non-Korean Championship - Starts Jan 100SC2 All-Star Invitational: Jan 17-1819Weekly Cups (Dec 22-28): Classic & MaxPax win, Percival surprises3Weekly Cups (Dec 15-21): Classic wins big, MaxPax & Clem take weeklies3ComeBackTV's documentary on Byun's Career !11
StarCraft 2
General
Weekly Cups (Dec 22-28): Classic & MaxPax win, Percival surprises SC2 All-Star Invitational: Jan 17-18 Chinese SC2 server to reopen; live all-star event in Hangzhou Starcraft 2 Zerg Coach ComeBackTV's documentary on Byun's Career !
Tourneys
OSC Season 13 World Championship WardiTV Mondays $5,000+ WardiTV 2025 Championship $100 Prize Pool - Winter Warp Gate Masters Showdow Sparkling Tuna Cup - Weekly Open Tournament
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 506 Warp Zone Mutation # 505 Rise From Ashes Mutation # 504 Retribution Mutation # 503 Fowl Play
Brood War
General
A cwal.gg Extension - Easily keep track of anyone I would like to say something about StarCraft StarCraft & BroodWar Campaign Speedrun Quest BGH Auto Balance -> http://bghmmr.eu/ (UMS) SWITCHEROO *New* /Destination Edit/
Tourneys
SLON Grand Finals – Season 2 [BSL21] Non-Korean Championship - Starts Jan 10 [Megathread] Daily Proleagues [BSL21] Grand Finals - Sunday 21:00 CET
Strategy
Simple Questions, Simple Answers Current Meta [G] How to get started on ladder as a new Z player Fighting Spirit mining rates
Other Games
General Games
Elden Ring Thread General RTS Discussion Thread Nintendo Switch Thread Awesome Games Done Quick 2026! Stormgate/Frost Giant Megathread
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 Survivor II: The Amazon Sengoku Mafia
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Canadian Politics Mega-thread The Games Industry And ATVI 12 Days of Starcraft
Fan Clubs
White-Ra Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece
Sports
2024 - 2026 Football Thread Formula 1 Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List TL+ Announced
Blogs
National Diversity: A Challe…
TrAiDoS
I decided to write a webnov…
DjKniteX
James Bond movies ranking - pa…
Topin
StarCraft improvement
iopq
Customize Sidebar...

Website Feedback

Closed Threads



Active: 924 users

The Big Programming Thread - Page 905

Forum Index > General Forum
Post a Reply
Prev 1 903 904 905 906 907 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.
WolfintheSheep
Profile Joined June 2011
Canada14127 Posts
September 09 2017 08:26 GMT
#18081
Just my opinion, because I am not an iOS or mobile app designer in the slightest, but dynamically populating seems much more flexible and scalable than an "include everything then obscure" approach.

Plus I'm always wary of just visually hiding things people shouldn't have access to. Always feels like there's more margin for mistakes or unintentionally security issues that way, even if it's not.
Average means I'm better than half of you.
sc-darkness
Profile Joined August 2017
856 Posts
Last Edited: 2017-09-09 11:58:42
September 09 2017 11:57 GMT
#18082
I had an eye test. As usual, they recommend 20-minute break from computers after so many hours (I forgot). Does anyone do that? :D I feel like no employer would say yes to that. Aren't modern monitors good enough?
emperorchampion
Profile Blog Joined December 2008
Canada9496 Posts
September 09 2017 12:13 GMT
#18083
On September 09 2017 20:57 sc-darkness wrote:
I had an eye test. As usual, they recommend 20-minute break from computers after so many hours (I forgot). Does anyone do that? :D I feel like no employer would say yes to that. Aren't modern monitors good enough?


Do you have a lunch break lol? Also every 20 min you should focus your eyes on something far away for a minute or so
TRUEESPORTS || your days as a respected member of team liquid are over
Manit0u
Profile Blog Joined August 2004
Poland17557 Posts
September 09 2017 12:21 GMT
#18084
Never paid any attention to that. I'm one of maybe 3 programmers in my company who don't wear glasses and I seriously don't know why it is so (since at home I'm also spending plenty of time at the computer). Must be the beer...
Time is precious. Waste it wisely.
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
September 09 2017 12:51 GMT
#18085
On September 09 2017 20:57 sc-darkness wrote:
I had an eye test. As usual, they recommend 20-minute break from computers after so many hours (I forgot). Does anyone do that? :D I feel like no employer would say yes to that. Aren't modern monitors good enough?


Don't you have any sort of work you can do that doesn't take looking at the monitor?

Also it's probably a good idea anyways. Get up, walk around, stretch, etc.
Isualin
Profile Joined March 2011
Germany1903 Posts
Last Edited: 2017-09-09 13:15:28
September 09 2017 13:14 GMT
#18086
On September 09 2017 20:57 sc-darkness wrote:
I had an eye test. As usual, they recommend 20-minute break from computers after so many hours (I forgot). Does anyone do that? :D I feel like no employer would say yes to that. Aren't modern monitors good enough?

There is a time management technique called Pomodoro which is basically working 25 minutes and a 5 minutes break after that. It has a lot of implementations as apps or websites. As travis said, it is a good idea to take a walk, drink water, talk with a colleague etc
| INnoVation | The literal god TY | ByuNjwa | LRSL when? |
sc-darkness
Profile Joined August 2017
856 Posts
September 10 2017 21:29 GMT
#18087
Yeah, I take a break from time to time to drink something. I just don't think 20-minute break apart from lunch is possible at workplace.

Either way, any successful H1B visa holders here? No one said yes last time.
sabas123
Profile Blog Joined December 2010
Netherlands3122 Posts
September 11 2017 06:23 GMT
#18088
Even if you don't take to take a break, you can just look away from the monitor for a bit.
The harder it becomes, the more you should focus on the basics.
Manit0u
Profile Blog Joined August 2004
Poland17557 Posts
September 11 2017 21:11 GMT
#18089
Just for fun I'll bitch about rails "has_secure_password" setting for the user model. Sure, it does encrypt it (even with Argon2, I did that), but there's so much bullshit about it...

For instance, when you create user model you must pass "password" and "password_confirmation" fields, and they must match. When you update it you also need to pass "current_pussword" (none of them being "encrypted_password" which is actually digested and saved to the db).

When you pass "password_confirmation" as "nil/null" or you don't pass it at all, it turns off all passwrord/confirmation matching validations. WTF?!

This is one of the most ridiculous things I've ever seen. Especially that it's at the very core of the framework and there's plenty of authn/authr libraries that make use of this feature.

I've seen a lot of bullshit in my life, but right now this takes the cake.
Time is precious. Waste it wisely.
PM_ME_NICE_PUPPERS
Profile Joined September 2017
Pakistan51 Posts
September 12 2017 07:06 GMT
#18090
On September 09 2017 20:57 sc-darkness wrote:
I had an eye test. As usual, they recommend 20-minute break from computers after so many hours (I forgot). Does anyone do that? :D I feel like no employer would say yes to that. Aren't modern monitors good enough?


At SAP, we were allowed to take a morning walk and an afternoon walk around the local park. Staring at screens, sitting down, isn't great for your health, doing so without regular breaks is devastating.
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
September 13 2017 02:10 GMT
#18091
The Ethereum blockchain is currently at around 30GB. If you wanted to have it on a phone it would take up most of the storage. What are possible ways to get that size down?

I've been wondering if a "rolling" blockchain is possible, where some computers store only the last X blocks, and the rest store the whole blockchain, but that seems like it might be vulnerable. Is it? Are there better ways?
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
Hanh
Profile Joined June 2016
146 Posts
September 14 2017 07:50 GMT
#18092
You can instruct your client software to prune the data which roughly does what you want.
enigmaticcam
Profile Blog Joined October 2010
United States280 Posts
Last Edited: 2017-09-14 18:10:14
September 14 2017 17:56 GMT
#18093
Question on OOP and optimization:

The general guidelines with OOP and classes are to keep logic well organized and simple. Objects should generally do no more than one thing. But what if you're building something where optimization is paramount?

For example, suppose you're building a chess engine. Perhaps you might have some logic that calculates all the possible moves for a given piece. If that piece is a rook, the calculation would be a bit different than say a knight. Proper OOP would require something like an abstracted piece class that defines a single interface for calling that logic, and then you would have different instantiated objects that inherit from that piece class that each perform their specific logic based on that piece type.

But rather than having to instantiate new classes just to perform this logic for every new position when you're having to analyzing literally millions of positions as fast as possible, maybe it's better to just use the trusty old case/switch statement and route that logic to a function in a class that's already loaded? Obviously I can do what I want, but just curious what your opinions are. Thanks!
netherh
Profile Blog Joined November 2011
United Kingdom333 Posts
Last Edited: 2017-09-14 19:23:59
September 14 2017 19:22 GMT
#18094
On September 15 2017 02:56 enigmaticcam wrote:
Question on OOP and optimization:

The general guidelines with OOP and classes are to keep logic well organized and simple. Objects should generally do no more than one thing. But what if you're building something where optimization is paramount?

For example, suppose you're building a chess engine. Perhaps you might have some logic that calculates all the possible moves for a given piece. If that piece is a rook, the calculation would be a bit different than say a knight. Proper OOP would require something like an abstracted piece class that defines a single interface for calling that logic, and then you would have different instantiated objects that inherit from that piece class that each perform their specific logic based on that piece type.

But rather than having to instantiate new classes just to perform this logic for every new position when you're having to analyzing literally millions of positions as fast as possible, maybe it's better to just use the trusty old case/switch statement and route that logic to a function in a class that's already loaded? Obviously I can do what I want, but just curious what your opinions are. Thanks!


[Not too much knowledge about chess engines here, so this is quite speculative...]

But... assuming you need a function for a piece that takes a position and returns the set of possible outcome positions after moving that piece. You could use a "Ruleset" class overloaded for each type of piece, or a set of free functions and a switch statement, whichever is faster (they'd be effectively doing the exact same thing). By "new" and "already loaded" are you referring to dynamic allocation? I don't think you'd need to dynamically allocate inherited classes, as you'd only need one Ruleset instance for each type of piece, not for every piece instance.

You probably don't need an inheritance hierarchy for the Piece class itself. You might not even want an instance of such a class. Just an enum, and some conversion functions (for names, notation, etc.) might do.

In general, I suggest thinking about the specific data you need (coordinates / type of pieces), and what the algorithms do with it. Then think about container types and how to group the data efficiently. At that point you have your objects.

i.e. Don't think: "Well a chess board has pieces on it of different types, so I need a Piece class and an inheritance chain with Pawn, Knight, etc.". Think something like: "my algorithm needs a set of coordinates (int, int), and piece types (enum), that I process in [...] way, and they need to be stored in a [map / vector / list]".
enigmaticcam
Profile Blog Joined October 2010
United States280 Posts
September 14 2017 20:19 GMT
#18095
On September 15 2017 04:22 netherh wrote:i.e. Don't think: "Well a chess board has pieces on it of different types, so I need a Piece class and an inheritance chain with Pawn, Knight, etc.". Think something like: "my algorithm needs a set of coordinates (int, int), and piece types (enum), that I process in [...] way, and they need to be stored in a [map / vector / list]".
Ah yes, that's a better way to organize it. Sometimes I get those logical blinders on and it takes a fresh pair of eyes to help me see it from a different perspective. Thank you!
CecilSunkure
Profile Blog Joined May 2010
United States2829 Posts
September 14 2017 20:28 GMT
#18096
On September 15 2017 02:56 enigmaticcam wrote:
Question on OOP and optimization:

The general guidelines with OOP and classes are to keep logic well organized and simple. Objects should generally do no more than one thing. But what if you're building something where optimization is paramount?

For example, suppose you're building a chess engine. Perhaps you might have some logic that calculates all the possible moves for a given piece. If that piece is a rook, the calculation would be a bit different than say a knight. Proper OOP would require something like an abstracted piece class that defines a single interface for calling that logic, and then you would have different instantiated objects that inherit from that piece class that each perform their specific logic based on that piece type.

But rather than having to instantiate new classes just to perform this logic for every new position when you're having to analyzing literally millions of positions as fast as possible, maybe it's better to just use the trusty old case/switch statement and route that logic to a function in a class that's already loaded? Obviously I can do what I want, but just curious what your opinions are. Thanks!


You're over thinking it. Typically people that use OOP apply it everywhere whether or not it helps. If we're solving some kind of chess optimization problem, OOP probably won't help.
Manit0u
Profile Blog Joined August 2004
Poland17557 Posts
Last Edited: 2017-09-14 20:31:32
September 14 2017 20:29 GMT
#18097
You will get the most performance in OOP by adopting the DCI (Data Context Interaction) architecture. I'm not sure if you can do that in Java. C#, Scala, Python and Ruby support this in various ways, most commonly traits that you inject into objects during or after instantiation (run time, not compile time) - only when they need them.

Some reading:
https://www.saturnflyer.com/blog/oop-dci-and-ruby-what-your-system-is-vs-what-your-system-does
http://www.artima.com/articles/dci_vision.html
https://stackoverflow.com/questions/378629/dci-data-context-and-interaction-successor-to-mvc
Time is precious. Waste it wisely.
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
September 15 2017 05:08 GMT
#18098
On September 14 2017 16:50 Hanh wrote:
You can instruct your client software to prune the data which roughly does what you want.

Thank you, that led me in the right direction. It's encouraging to know that a technical problem didn't just ruin what I wanted to do
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
September 15 2017 09:11 GMT
#18099
On September 15 2017 05:29 Manit0u wrote:
You will get the most performance in OOP by adopting the DCI (Data Context Interaction) architecture. I'm not sure if you can do that in Java. C#, Scala, Python and Ruby support this in various ways, most commonly traits that you inject into objects during or after instantiation (run time, not compile time) - only when they need them.

Some reading:
https://www.saturnflyer.com/blog/oop-dci-and-ruby-what-your-system-is-vs-what-your-system-does
http://www.artima.com/articles/dci_vision.html
https://stackoverflow.com/questions/378629/dci-data-context-and-interaction-successor-to-mvc

Interesting. I've been thinking about concepts like this to fix some really annoying architectural problems at work but I haven't stumbled across DCI yet. Good to know that it's an established pattern. Probably won't be able to apply it large-scale anytime soon, obviously...
If you have a good reason to disagree with the above, please tell me. Thank you.
Manit0u
Profile Blog Joined August 2004
Poland17557 Posts
September 15 2017 09:52 GMT
#18100
I could use a bit of help with regex...

Validating paths is a bitch:


/\A(?:(?!\s)[^\/:*?"<>|\r\n\t\f\v]*(?<![.\s])\/?)+\Z/i


The regex works fine, if not for one tiny little quirk. Matching longer strings results in catastrophic backtracking. Like this one:


my super/Duper/ultra/path/that is not valid.


I know it's caused by the negative look behind, but I don't know how to rectify this
Time is precious. Waste it wisely.
Prev 1 903 904 905 906 907 1032 Next
Please log in or register to reply.
Live Events Refresh
The PiG Daily
21:00
Best Games of SC
Reynor vs Clem
MaxPax vs TBD
SHIN vs TBD
Rogue vs TBD
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
mouzHeroMarine 655
PiGStarcraft234
ProTech106
UpATreeSC 83
SC2Nice 33
RushiSC 33
Railgan 30
StarCraft: Brood War
Mini 149
Shuttle 86
firebathero 76
Killer 31
Sexy 22
JYJ 18
yabsab 11
Dota 2
febbydoto18
League of Legends
C9.Mang0231
Counter-Strike
pashabiceps2762
Heroes of the Storm
Liquid`Hasu574
Other Games
Grubby5583
tarik_tv3411
FrodaN2395
Beastyqt1062
B2W.Neo359
fl0m345
mouzStarbuck324
ArmadaUGS145
Livibee108
KnowMe98
IndyStarCraft 85
QueenE66
PPMD32
ZombieGrub30
Organizations
StarCraft 2
angryscii 18
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 17 non-featured ]
StarCraft 2
• kabyraGe 233
• davetesta6
• Kozan
• LaughNgamezSOOP
• AfreecaTV YouTube
• sooper7s
• intothetv
• Migwel
• IndyKCrew
StarCraft: Brood War
• Azhi_Dahaki8
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• WagamamaTV660
Other Games
• imaqtpie3281
• Shiphtur347
• tFFMrPink 22
Upcoming Events
Korean StarCraft League
5h 31m
OSC
14h 31m
IPSL
19h 31m
Dewalt vs Bonyth
OSC
20h 31m
OSC
1d 14h
uThermal 2v2 Circuit
1d 16h
Replay Cast
2 days
RotterdaM Event
2 days
Patches Events
2 days
OSC
3 days
[ Show More ]
OSC
4 days
OSC
5 days
Liquipedia Results

Completed

C-Race Season 1
WardiTV 2025
META Madness #9

Ongoing

IPSL Winter 2025-26
BSL Season 21
Slon Tour Season 2
CSL Season 19: Qualifier 2
Escore Tournament S1: W2
eXTREMESLAND 2025
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025

Upcoming

CSL 2025 WINTER (S19)
Escore Tournament S1: W3
BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
Thunderfire SC2 All-star 2025
Big Gabe Cup #3
OSC Championship Season 13
Nations Cup 2026
Underdog Cup #3
NA Kuram Kup
ESL Pro League Season 23
ESL Pro League Season 23
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
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.