• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 22:03
CET 04:03
KST 12:03
  • 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
BGE Stara Zagora 2026 announced Weekly Cups (Nov 24-30): MaxPax, Clem, herO win SC2 Proleague Discontinued; SKT, KT, SGK, CJ disband Information Request Regarding Chinese Ladder SC: Evo Complete - Ranked Ladder OPEN ALPHA
Tourneys
$5,000+ WardiTV 2025 Championship Constellation Cup - Main Event - Stellar Fest RSL Revival: Season 3 Tenacious Turtle Tussle [Alpha Pro Series] Nice vs Cure
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? [ASL20] Ask the mapmakers — Drop your questions BW General Discussion FlaSh's Valkyrie Copium BGH Auto Balance -> http://bghmmr.eu/
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 The Perfect Game Path of Exile Nintendo Switch Thread Should offensive tower rushing be viable in RTS games?
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: 1383 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
Poland17490 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
Poland17490 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
Poland17490 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
Poland17490 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
PiGosaur Monday
01:00
#60
PiGStarcraft593
SteadfastSC159
CranKy Ducklings113
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
PiGStarcraft593
SteadfastSC 159
Nathanias 75
StarCraft: Brood War
Artosis 743
Noble 20
Dota 2
monkeys_forever219
League of Legends
C9.Mang0361
Other Games
summit1g14343
JimRising 620
ViBE150
WinterStarcraft147
Mew2King29
CosmosSc2 20
Organizations
Other Games
gamesdonequick1155
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 14 non-featured ]
StarCraft 2
• Hupsaiya 77
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• Azhi_Dahaki6
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Stunt228
Other Games
• Scarra1321
Upcoming Events
Wardi Open
8h 57m
StarCraft2.fi
13h 57m
Replay Cast
20h 57m
The PondCast
1d 6h
OSC
1d 12h
Demi vs Mixu
Nicoract vs TBD
Babymarine vs MindelVK
ForJumy vs TBD
Shameless vs Percival
Replay Cast
1d 20h
Korean StarCraft League
2 days
CranKy Ducklings
3 days
SC Evo League
3 days
BSL 21
3 days
Sziky vs OyAji
Gypsy vs eOnzErG
[ Show More ]
OSC
3 days
Solar vs Creator
ByuN vs Gerald
Percival vs Babymarine
Moja vs Krystianer
EnDerr vs ForJumy
sebesdes vs Nicoract
Sparkling Tuna Cup
4 days
OSC
4 days
BSL 21
4 days
Bonyth vs StRyKeR
Tarson vs Dandy
Replay Cast
5 days
Wardi Open
5 days
StarCraft2.fi
5 days
Replay Cast
5 days
StarCraft2.fi
6 days
PiGosaur Monday
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.