• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 00:12
CEST 06:12
KST 13:12
  • 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 Tall10HomeStory 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
Weekly Cups (June 30 - July 6): Classic Doubles2[BSL20] Non-Korean Championship 4x BSL + 4x China9Flash Announces Hiatus From ASL66Weekly Cups (June 23-29): Reynor in world title form?14FEL Cracov 2025 (July 27) - $8000 live event22
StarCraft 2
General
The GOAT ranking of GOAT rankings The SCII GOAT: A statistical Evaluation Weekly Cups (June 23-29): Reynor in world title form? Weekly Cups (June 30 - July 6): Classic Doubles Program: SC2 / XSplit / OBS Scene Switcher
Tourneys
RSL: Revival, a new crowdfunded tournament series FEL Cracov 2025 (July 27) - $8000 live event Sparkling Tuna Cup - Weekly Open Tournament WardiTV Mondays Korean Starcraft League Week 77
Strategy
How did i lose this ZvP, whats the proper response Simple Questions Simple Answers
Custom Maps
[UMS] Zillion Zerglings
External Content
Mutation # 481 Fear and Lava Mutation # 480 Moths to the Flame Mutation # 479 Worn Out Welcome Mutation # 478 Instant Karma
Brood War
General
BGH Auto Balance -> http://bghmmr.eu/ ASL20 Preliminary Maps [ASL19] Finals Recap: Standing Tall SC uni coach streams logging into betting site Flash Announces Hiatus From ASL
Tourneys
[BSL20] Non-Korean Championship 4x BSL + 4x China [BSL20] Grand Finals - Sunday 20:00 CET CSL Xiamen International Invitational The Casual Games of the Week Thread
Strategy
Simple Questions, Simple Answers I am doing this better than progamers do.
Other Games
General Games
Nintendo Switch Thread Stormgate/Frost Giant Megathread 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
US Politics Mega-thread Summer Games Done Quick 2025! Russo-Ukrainian War Thread Stop Killing Games - European Citizens Initiative Summer Games Done Quick 2024!
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
The Automated Ban List
Blogs
momentary artworks from des…
tankgirl
Culture Clash in Video Games…
TrAiDoS
from making sc maps to makin…
Husyelt
StarCraft improvement
iopq
Customize Sidebar...

Website Feedback

Closed Threads



Active: 645 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
Poland17244 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
Poland17244 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
Poland17244 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
Poland17244 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 5h 48m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
RuFF_SC2 182
ProTech59
StarCraft: Brood War
GuemChi 1080
Leta 419
MaD[AoV]41
PianO 38
Bale 15
Icarus 9
Dota 2
monkeys_forever810
League of Legends
JimRising 789
Counter-Strike
Stewie2K246
Super Smash Bros
Mew2King216
Other Games
summit1g10181
WinterStarcraft345
Maynarde153
SortOf102
NeuroSwarm59
Organizations
Other Games
gamesdonequick43598
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 15 non-featured ]
StarCraft 2
• Berry_CruncH324
• practicex 28
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Lourlo679
Other Games
• Scarra2306
• Shiphtur270
Upcoming Events
Sparkling Tuna Cup
5h 48m
WardiTV European League
11h 48m
MaNa vs sebesdes
Mixu vs Fjant
ByuN vs HeRoMaRinE
ShoWTimE vs goblin
Gerald vs Babymarine
Krystianer vs YoungYakov
PiGosaur Monday
19h 48m
The PondCast
1d 5h
WardiTV European League
1d 7h
Jumy vs NightPhoenix
Percival vs Nicoract
ArT vs HiGhDrA
MaxPax vs Harstem
Scarlett vs Shameless
SKillous vs uThermal
uThermal 2v2 Circuit
1d 11h
Replay Cast
1d 19h
RSL Revival
2 days
ByuN vs SHIN
Clem vs Reynor
Replay Cast
2 days
RSL Revival
3 days
Classic vs Cure
[ Show More ]
FEL
3 days
RSL Revival
4 days
FEL
4 days
FEL
4 days
CSO Cup
4 days
BSL20 Non-Korean Champi…
4 days
Bonyth vs QiaoGege
Dewalt vs Fengzi
Hawk vs Zhanhun
Sziky vs Mihu
Mihu vs QiaoGege
Zhanhun vs Sziky
Fengzi vs Hawk
Sparkling Tuna Cup
5 days
RSL Revival
5 days
FEL
5 days
BSL20 Non-Korean Champi…
5 days
Bonyth vs Dewalt
QiaoGege vs Dewalt
Hawk vs Bonyth
Sziky vs Fengzi
Mihu vs Zhanhun
QiaoGege vs Zhanhun
Fengzi vs Mihu
Liquipedia Results

Completed

BSL Season 20
HSC XXVII
Heroes 10 EU

Ongoing

JPL Season 2
BSL 2v2 Season 3
Acropolis #3
KCM Race Survival 2025 Season 2
CSL 17: 2025 SUMMER
Copa Latinoamericana 4
Jiahua Invitational
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
CSL Xiamen Invitational
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.