• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 21:23
CEST 03:23
KST 10:23
  • 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
[ASL19] Finals Recap: Standing Tall9HomeStory Cup 27 - Info & Preview18Classic wins Code S Season 2 (2025)16Code S RO4 & Finals Preview: herO, Rogue, Classic, GuMiho0TL Team Map Contest #5: Presented by Monster Energy6
Community News
Flash Announces Hiatus From ASL54Weekly Cups (June 23-29): Reynor in world title form?12FEL Cracov 2025 (July 27) - $8000 live event16Esports World Cup 2025 - Final Player Roster16Weekly Cups (June 16-22): Clem strikes back1
StarCraft 2
General
The SCII GOAT: A statistical Evaluation The GOAT ranking of GOAT rankings Statistics for vetoed/disliked maps How does the number of casters affect your enjoyment of esports? Esports World Cup 2025 - Final Player Roster
Tourneys
Korean Starcraft League Week 77 Master Swan Open (Global Bronze-Master 2) RSL: Revival, a new crowdfunded tournament series [GSL 2025] Code S: Season 2 - Semi Finals & Finals $5,100+ SEL Season 2 Championship (SC: Evo)
Strategy
How did i lose this ZvP, whats the proper response Simple Questions Simple Answers
Custom Maps
[UMS] Zillion Zerglings
External Content
Mutation # 480 Moths to the Flame Mutation # 479 Worn Out Welcome Mutation # 478 Instant Karma Mutation # 477 Slow and Steady
Brood War
General
Flash Announces Hiatus From ASL BGH Auto Balance -> http://bghmmr.eu/ Player “Jedi” cheat on CSL Unit and Spell Similarities Help: rep cant save
Tourneys
[Megathread] Daily Proleagues [BSL20] Grand Finals - Sunday 20:00 CET Small VOD Thread 2.0 [BSL20] GosuLeague RO16 - Tue & Wed 20:00+CET
Strategy
Simple Questions, Simple Answers I am doing this better than progamers do.
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread Path of Exile What do you want from future RTS games? Beyond All Reason
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
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
Things Aren’t Peaceful in Palestine US Politics Mega-thread Trading/Investing Thread Russo-Ukrainian War Thread The Games Industry And ATVI
Fan Clubs
SKT1 Classic Fan Club! Maru Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece [\m/] Heavy Metal Thread
Sports
Formula 1 Discussion 2024 - 2025 Football Thread NBA General Discussion TeamLiquid Health and Fitness Initiative For 2023 NHL Playoffs 2024
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Blogs
Culture Clash in Video Games…
TrAiDoS
from making sc maps to makin…
Husyelt
Blog #2
tankgirl
StarCraft improvement
iopq
Trip to the Zoo
micronesia
Customize Sidebar...

Website Feedback

Closed Threads



Active: 617 users

The Big Programming Thread - Page 905

Forum Index > General Forum
Post a Reply
Prev 1 903 904 905 906 907 1031 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
Poland17243 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
Poland17243 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
Poland17243 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
Poland17243 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 1031 Next
Please log in or register to reply.
Live Events Refresh
Next event in 1h 37m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Nina 266
RuFF_SC2 137
Livibee 87
StarCraft: Brood War
Sea 1098
NaDa 40
Icarus 2
Dota 2
420jenkins668
capcasts134
NeuroSwarm92
febbydoto10
LuMiX1
League of Legends
JimRising 686
Counter-Strike
Stewie2K751
taco 608
Other Games
summit1g10365
tarik_tv4837
ViBE191
Organizations
Other Games
BasetradeTV70
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 16 non-featured ]
StarCraft 2
• Berry_CruncH244
• Hupsaiya 108
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• Azhi_Dahaki16
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Doublelift4827
• Jankos1588
• masondota2974
Upcoming Events
Korean StarCraft League
1h 37m
CranKy Ducklings
8h 37m
RSL Revival
8h 37m
ByuN vs Cham
herO vs Reynor
FEL
14h 37m
RSL Revival
1d 8h
Clem vs Classic
SHIN vs Cure
FEL
1d 10h
BSL: ProLeague
1d 16h
Dewalt vs Bonyth
Replay Cast
2 days
Sparkling Tuna Cup
3 days
The PondCast
4 days
[ Show More ]
Replay Cast
4 days
RSL Revival
5 days
Replay Cast
5 days
RSL Revival
6 days
Liquipedia Results

Completed

BSL 2v2 Season 3
HSC XXVII
Heroes 10 EU

Ongoing

JPL Season 2
BSL Season 20
Acropolis #3
KCM Race Survival 2025 Season 2
CSL 17: 2025 SUMMER
Copa Latinoamericana 4
Championship of Russia 2025
RSL Revival: Season 1
Murky Cup #2
BLAST.tv Austin Major 2025
ESL Impact League Season 7
IEM Dallas 2025
PGL Astana 2025
Asian Champions League '25
BLAST Rivals Spring 2025
MESA Nomadic Masters
CCT Season 2 Global Finals
IEM Melbourne 2025

Upcoming

2025 ACS Season 2: Qualifier
CSLPRO Last Chance 2025
2025 ACS Season 2
CSLPRO Chat StarLAN 3
K-Championship
uThermal 2v2 Main Event
SEL Season 2 Championship
FEL Cracov 2025
Esports World Cup 2025
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1
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.