• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 01:42
CET 07:42
KST 15:42
  • 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
TL.net Map Contest #21: Winners9Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10[ASL20] Finals Preview: Arrival13TL.net Map Contest #21: Voting12[ASL20] Ro4 Preview: Descent11
Community News
StarCraft, SC2, HotS, WC3, Returning to Blizzcon!33$5,000+ WardiTV 2025 Championship6[BSL21] RO32 Group Stage4Weekly Cups (Oct 26-Nov 2): Liquid, Clem, Solar win; LAN in Philly2Weekly Cups (Oct 20-26): MaxPax, Clem, Creator win10
StarCraft 2
General
Weekly Cups (Oct 20-26): MaxPax, Clem, Creator win TL.net Map Contest #21: Winners RotterdaM "Serral is the GOAT, and it's not close" 5.0.15 Patch Balance Hotfix (2025-10-8) StarCraft, SC2, HotS, WC3, Returning to Blizzcon!
Tourneys
Constellation Cup - Main Event - Stellar Fest $5,000+ WardiTV 2025 Championship Sparkling Tuna Cup - Weekly Open Tournament Merivale 8 Open - LAN - Stellar Fest Sea Duckling Open (Global, Bronze-Diamond)
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 498 Wheel of Misfortune|Cradle of Death Mutation # 497 Battle Haredened Mutation # 496 Endless Infection Mutation # 495 Rest In Peace
Brood War
General
[ASL20] Ask the mapmakers — Drop your questions BW General Discussion [BSL21] RO32 Group Stage BGH Auto Balance -> http://bghmmr.eu/ SnOw's ASL S20 Finals Review
Tourneys
[Megathread] Daily Proleagues [ASL20] Grand Finals [BSL21] RO32 Group B - Sunday 21:00 CET [BSL21] RO32 Group A - Saturday 21:00 CET
Strategy
Current Meta PvZ map balance How to stay on top of macro? Soma's 9 hatch build from ASL Game 2
Other Games
General Games
Nintendo Switch Thread Path of Exile Stormgate/Frost Giant Megathread Should offensive tower rushing be viable in RTS games? Dawn of War IV
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
TL Mafia Community Thread SPIRED by.ASL Mafia {211640}
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine YouTube Thread Dating: How's your luck?
Fan Clubs
White-Ra Fan Club The herO Fan Club!
Media & Entertainment
[Manga] One Piece Anime Discussion Thread Movie Discussion! Korean Music Discussion Series you have seen recently...
Sports
2024 - 2026 Football Thread NBA General Discussion MLB/Baseball 2023 TeamLiquid Health and Fitness Initiative For 2023 Formula 1 Discussion
World Cup 2022
Tech Support
SC2 Client Relocalization [Change SC2 Language] Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List Recent Gifted Posts
Blogs
Coffee x Performance in Espo…
TrAiDoS
Saturation point
Uldridge
DnB/metal remix FFO Mick Go…
ImbaTosS
Why we need SC3
Hildegard
Reality "theory" prov…
perfectspheres
Our Last Hope in th…
KrillinFromwales
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1504 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
Poland17421 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
Poland17421 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
Poland17421 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
Poland17421 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
Korean StarCraft League
03:00
Week 82
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Nina 206
ProTech122
StarCraft: Brood War
Sea 928
Zeus 585
Noble 21
Hm[arnc] 21
Bale 13
Dota 2
NeuroSwarm94
LuMiX1
League of Legends
JimRising 634
Reynor17
Counter-Strike
fl0m560
Other Games
summit1g16780
tarik_tv13013
WinterStarcraft376
C9.Mang0373
FrodaN184
Organizations
Other Games
gamesdonequick750
Counter-Strike
PGL151
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 13 non-featured ]
StarCraft 2
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• Azhi_Dahaki14
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Stunt709
Other Games
• Shiphtur173
Upcoming Events
CranKy Ducklings
3h 18m
IPSL
11h 18m
dxtr13 vs OldBoy
Napoleon vs Doodle
LAN Event
11h 18m
Lambo vs Clem
Scarlett vs TriGGeR
ByuN vs TBD
Zoun vs TBD
BSL 21
13h 18m
Gosudark vs Kyrie
Gypsy vs OyAji
UltrA vs Radley
Dandy vs Ptak
Replay Cast
16h 18m
Sparkling Tuna Cup
1d 3h
WardiTV Korean Royale
1d 5h
IPSL
1d 11h
JDConan vs WIZARD
WolFix vs Cross
LAN Event
1d 11h
BSL 21
1d 13h
spx vs rasowy
HBO vs KameZerg
Cross vs Razz
dxtr13 vs ZZZero
[ Show More ]
Replay Cast
2 days
Wardi Open
2 days
WardiTV Korean Royale
3 days
Replay Cast
4 days
Kung Fu Cup
4 days
Classic vs Solar
herO vs Cure
Reynor vs GuMiho
ByuN vs ShoWTimE
Tenacious Turtle Tussle
4 days
The PondCast
5 days
RSL Revival
5 days
Solar vs Zoun
MaxPax vs Bunny
Kung Fu Cup
5 days
WardiTV Korean Royale
5 days
RSL Revival
6 days
Classic vs Creator
Cure vs TriGGeR
Kung Fu Cup
6 days
Liquipedia Results

Completed

BSL 21 Points
SC4ALL: StarCraft II
Eternal Conflict S1

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
SOOP Univ League 2025
YSL S2
BSL Season 21
Stellar Fest: Constellation Cup
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual

Upcoming

SLON Tour Season 2
BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
HSC XXVIII
RSL Offline Finals
WardiTV 2025
RSL Revival: Season 3
META Madness #9
BLAST Bounty Winter 2026: Closed Qualifier
eXTREMESLAND 2025
ESL Impact League Season 8
SL Budapest Major 2025
BLAST Rivals Fall 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.