• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 07:02
CEST 13:02
KST 20:02
  • 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
ByuL, and the Limitations of Standard Play1Team Liquid Map Contest #22: Results and Winners7Code S Season 2 (2026): RO4 and Finals Preview12TL.net Map Contest #22 - Voting & Ladder Map Selection7Code S Season 2 (2026) - RO8 Preview8
Community News
[TLMC] Summer 2026 Ladder Map Rotation05.0.16 patch for SC2 goes live (8 worker start)78ZeroSpace at Steam NextFest - Last free demo36Weekly Cups (June 8-14): Clem and Solar double, PTR tested0RSL: S6 Finals played at BlizzCon 202611
StarCraft 2
General
The future of the SC game model 5.0.16 patch for SC2 goes live (8 worker start) Is the larve respawn broken? Daily SC2 Player Grid - feedback wanted The Death of Cheese: From a Professional Cheeser
Tourneys
Maestros of The Game 2 announcement and schedule ! Douyu Cup 2026: $20,000 Legends Event (June 26-28) RSL Revival: Season 6 - Qualifiers and Main Event INu's Battles#17 <BO.9> Sparkling Tuna Cup - Weekly Open Tournament
Strategy
[G] Having the right mentality to improve
Custom Maps
New Map Maker - Looking for Advice - Love or Hate Work In Progress Melee Maps [D]RTS in all its shapes and glory <3
External Content
The PondCast: SC2 News & Results Mutation # 531 Experimental Artillery Mutation # 530 One For All Mutation # 529 Opportunities Unleashed
Brood War
General
BW General Discussion ASL 22 Proposed Map Pool Best thing happen to StarCraft since Remastered? Fact based Zerg Upgrade Tier List BGH Auto Balance -> http://bghmmr.eu/
Tourneys
[Megathread] Daily Proleagues [ASL21] Grand Finals The Casual Games of the Week Thread [BSL22] GosuLeague Casts - Tue & Thu 22:00 CEST
Strategy
Simple Questions, Simple Answers Creating a full chart of Zerg builds Relatively freeroll strategies Why doesn't anyone use restoration?
Other Games
General Games
ZeroSpace at Steam NextFest - Last free demo Nintendo Switch Thread Path of Exile Stormgate/Frost Giant Megathread Beyond All Reason
Dota 2
Looking for a Dota Mentor 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
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
US Politics Mega-thread The Games Industry And ATVI Canadian Politics Mega-thread Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread
Fan Clubs
The HerO Fan Club! The herO Fan Club!
Media & Entertainment
Movie Discussion! Series you have seen recently... [Req][Books] Good Fantasy/SciFi books [TV/BOOK] *SPOILERS* Game of Thrones Discussion
Sports
McBoner: A hockey love story 2024 - 2026 Football Thread Formula 1 Discussion TeamLiquid Health and Fitness Initiative For 2023 Cricket [SPORT]
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
Listen To The Coaches!
TrAiDoS
An Exploration of th…
waywardstrategy
I'm an arrogant trash talke…
FlaShFTW
Gauntlet SC2: A Retrospectiv…
Ctone23
ramps on octagon
StaticNine
StarCraft improvement
iopq
Customize Sidebar...

Website Feedback

Closed Threads



Active: 10248 users

The Big Programming Thread - Page 967

Forum Index > General Forum
Post a Reply
Prev 1 965 966 967 968 969 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.
Excludos
Profile Blog Joined April 2010
Norway8264 Posts
Last Edited: 2018-06-16 10:30:46
June 16 2018 10:30 GMT
#19321
On June 16 2018 19:01 Acrofales wrote:
I assume that's c++. In which case, what's the problem? You promise to return a char array and you do.


I think what he's asking is why you can return a pointer to something who's scope should only be within the function itself. iaretehnoob answered why this specific case works.
sc-darkness
Profile Joined August 2017
856 Posts
Last Edited: 2018-06-16 11:23:37
June 16 2018 10:54 GMT
#19322
On June 16 2018 19:30 Excludos wrote:
Show nested quote +
On June 16 2018 19:01 Acrofales wrote:
I assume that's c++. In which case, what's the problem? You promise to return a char array and you do.


I think what he's asking is why you can return a pointer to something who's scope should only be within the function itself. iaretehnoob answered why this specific case works.


Yes. Also, pointer isn't the same thing as an array. Arrays could decay and become pointers, but the opposite isn't true. You could treat a pointer as if it points to a sequence of elements but I think arrays and pointers are different.

Pointer points to something that is already in memory. I guess string literals are somehow in memory for pointers to work. Otherwise, how do you point to something which you've not allocated memory for?

On June 16 2018 19:19 iaretehnoob wrote:
Show nested quote +
On June 16 2018 18:00 sc-darkness wrote:
Does anyone know why this works at all? It feels unsafe yet it works.


const char* SomeMethod()
{
return "Hello!";
}


Pointer points to something that must exist. Does compiler do some magic?


string literals are special and exist for the entire duration of the program.


That probably makes sense now. They're like static objects then.
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
June 18 2018 03:44 GMT
#19323
This is somewhat programming related, but does anyone know of good replacements for f.lux? It's gotten too heavy for what should be a very simple application.
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
TheEmulator
Profile Blog Joined July 2010
28100 Posts
June 18 2018 03:55 GMT
#19324
On June 18 2018 12:44 WarSame wrote:
This is somewhat programming related, but does anyone know of good replacements for f.lux? It's gotten too heavy for what should be a very simple application.

I use redshift on linux. It's incredibly minimalist.

If you're on windows 10 the native blue light app is actually alright. I heard Iris is good but idk how heavy the app is.
Administrator
ShoCkeyy
Profile Blog Joined July 2008
7815 Posts
June 18 2018 12:44 GMT
#19325
If anybody is interested, I recently came across an open source machine learning tool.

https://ml5js.org/

Friendly Machine Learning for the Web.
ml5.js aims to make machine learning approachable for a broad audience of artists, creative coders, and students. The library provides access to machine learning algorithms and models in the browser, building on top of TensorFlow.js with no other external dependencies.

The library is supported by code examples, tutorials, and sample datasets with an emphasis on ethical computing. Bias in data, stereotypical harms, and responsible crowdsourcing are part of the documentation around data collection and usage.


I haven't touched it much, but I assume I will in the future.
Life?
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
June 18 2018 22:07 GMT
#19326
On June 18 2018 12:55 TheEmulator wrote:
Show nested quote +
On June 18 2018 12:44 WarSame wrote:
This is somewhat programming related, but does anyone know of good replacements for f.lux? It's gotten too heavy for what should be a very simple application.

I use redshift on linux. It's incredibly minimalist.

If you're on windows 10 the native blue light app is actually alright. I heard Iris is good but idk how heavy the app is.

Thanks! For some reason I don't feel the need as bad on Linux, but I'll check out Redshift too.
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
June 19 2018 00:18 GMT
#19327
I need some advice on DB design/interfacing.

I am using Flask with flask_sqlalchemy as an ORM and postgresql as a DB.

My flask_sqlalchemy Model defines the columns and tables. Should it also include the logic to CRUD objects? If not, where is the ideal place for that to go? In a db.py file?
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
Manit0u
Profile Blog Joined August 2004
Poland17774 Posts
June 20 2018 07:30 GMT
#19328
On June 19 2018 09:18 WarSame wrote:
I need some advice on DB design/interfacing.

I am using Flask with flask_sqlalchemy as an ORM and postgresql as a DB.

My flask_sqlalchemy Model defines the columns and tables. Should it also include the logic to CRUD objects? If not, where is the ideal place for that to go? In a db.py file?


Will need to check alchemy further but the general rule of thumb is that internal model logic should be inside the model. Any extra queries you want to perform on it should go into the repository class.
Time is precious. Waste it wisely.
Acrofales
Profile Joined August 2010
Spain18332 Posts
June 20 2018 08:16 GMT
#19329
On June 20 2018 16:30 Manit0u wrote:
Show nested quote +
On June 19 2018 09:18 WarSame wrote:
I need some advice on DB design/interfacing.

I am using Flask with flask_sqlalchemy as an ORM and postgresql as a DB.

My flask_sqlalchemy Model defines the columns and tables. Should it also include the logic to CRUD objects? If not, where is the ideal place for that to go? In a db.py file?


Will need to check alchemy further but the general rule of thumb is that internal model logic should be inside the model. Any extra queries you want to perform on it should go into the repository class.

Agree. CRUD goes in the model.

When I teach MVC to students I have some basic rules:

If it's SQL it's in the model. I don't want to see SQL in the controller, and most certainly never ever in the view. My general rule of thumb is that I should be able to switch database engines and only touch the model.

If it's HTML/CSS/JS it's in the view. I don't want to see html tags or javascript in the controller. JS you could make a case that some of it is controller, but then I'd make a case that you have a clientside view and controller, which in the grand scheme of your application is all view for the server side.

Finally, everything goes throug a controller. You call new pages by their controller, which gets the appropriate data from the model, repackages it and passes it to a view. You never call a view directly from a model, or a model directly from a view. And if you are writing any kind of logic other than how to display something (and what should happen when it is clicked on) in the view, then you are doing it wrong.
Excludos
Profile Blog Joined April 2010
Norway8264 Posts
June 20 2018 10:50 GMT
#19330
On June 20 2018 17:16 Acrofales wrote:
Show nested quote +
On June 20 2018 16:30 Manit0u wrote:
On June 19 2018 09:18 WarSame wrote:
I need some advice on DB design/interfacing.

I am using Flask with flask_sqlalchemy as an ORM and postgresql as a DB.

My flask_sqlalchemy Model defines the columns and tables. Should it also include the logic to CRUD objects? If not, where is the ideal place for that to go? In a db.py file?


Will need to check alchemy further but the general rule of thumb is that internal model logic should be inside the model. Any extra queries you want to perform on it should go into the repository class.

Agree. CRUD goes in the model.

When I teach MVC to students I have some basic rules:

If it's SQL it's in the model. I don't want to see SQL in the controller, and most certainly never ever in the view. My general rule of thumb is that I should be able to switch database engines and only touch the model.

If it's HTML/CSS/JS it's in the view. I don't want to see html tags or javascript in the controller. JS you could make a case that some of it is controller, but then I'd make a case that you have a clientside view and controller, which in the grand scheme of your application is all view for the server side.

Finally, everything goes throug a controller. You call new pages by their controller, which gets the appropriate data from the model, repackages it and passes it to a view. You never call a view directly from a model, or a model directly from a view. And if you are writing any kind of logic other than how to display something (and what should happen when it is clicked on) in the view, then you are doing it wrong.


Good explanation! What about mvvm? It's something I've never had time to learn about in any reasonable depth.
ShoCkeyy
Profile Blog Joined July 2008
7815 Posts
June 20 2018 14:25 GMT
#19331
Magento does a great deal of MVC, and if you're interested in mvvm, vue.js is built around that pattern. However, I don't think the mvvm pattern is built for large enterprise scaling. So that's a downside.
Life?
sc-darkness
Profile Joined August 2017
856 Posts
June 22 2018 18:53 GMT
#19332
Has anyone dealt with OAuth 2, any thoughts? I may have to support it soon.
Manit0u
Profile Blog Joined August 2004
Poland17774 Posts
June 23 2018 11:34 GMT
#19333
On June 23 2018 03:53 sc-darkness wrote:
Has anyone dealt with OAuth 2, any thoughts? I may have to support it soon.


Check previous page of this thread

Bonus:

[image loading]
Time is precious. Waste it wisely.
sc-darkness
Profile Joined August 2017
856 Posts
Last Edited: 2018-06-23 16:35:07
June 23 2018 16:34 GMT
#19334
Thanks, I'll read it. In terms of funny photos:

+ Show Spoiler +

[image loading]

WarSame
Profile Blog Joined February 2010
Canada1950 Posts
Last Edited: 2018-06-24 16:58:22
June 24 2018 03:28 GMT
#19335
I tried to add google oauth to my flask project and ran into issues. When I try to import google.auth.transport.requests.Request I get a module not found error. However, I can look with bash and see that the module is definitely in my venv libs.

My import looks like
from google.auth.transport.requests import Request
though I have tried other import styles, including some from their official guides. What can I be missing?

EDIT: I found out what the error was. The module requires that you have installed "requests" as a library. I thought it was referring to itself as an import or something.
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
June 24 2018 21:51 GMT
#19336
I've been trying to setup testing for my Flask app which uses Docker and I've found it difficult.

I need some strategy advice: when/how do you run your tests? Previously I was trying to run my tests using a command in my web image, but then it would exit and cause my web image to exit. Right now I'm using a test image in my compose that uses the same Dockerfile as my web image. It is fine to exit because web will keep on running. However, this seems stupid and wasteful. What is a better approach?
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
Excludos
Profile Blog Joined April 2010
Norway8264 Posts
July 03 2018 17:33 GMT
#19337
Hmm, I've been thinking about this for a while: What's the best way to store someone's credit card information on your servers? Obviously it would need to be encrypted, but it can't just be hashed as you'll need to somehow decrypt it when it's time to automatically renew the subscription or let the user pay more easily on his next online shopping transaction. So you'll need a good encryption and a key to decrypt it, but then you're left with the problem of how and where to store the key instead...

I'm not looking for a tool or library, but more an idea on how you'd go about solving this if you had to do it all from scratch, on a surface level.
WolfintheSheep
Profile Joined June 2011
Canada14127 Posts
Last Edited: 2018-07-03 18:39:01
July 03 2018 18:35 GMT
#19338
On July 04 2018 02:33 Excludos wrote:
Hmm, I've been thinking about this for a while: What's the best way to store someone's credit card information on your servers? Obviously it would need to be encrypted, but it can't just be hashed as you'll need to somehow decrypt it when it's time to automatically renew the subscription or let the user pay more easily on his next online shopping transaction. So you'll need a good encryption and a key to decrypt it, but then you're left with the problem of how and where to store the key instead...

I'm not looking for a tool or library, but more an idea on how you'd go about solving this if you had to do it all from scratch, on a surface level.

Look up industry standards is the best advice I can give you. Financial payment information is one of those things you don't want to be approaching from scratch, because it could potentially get you in a lot of trouble. Here in North America we have the PCI DSS, which is the payment card compliance standard. I don't know what the equivalent would be in Norway.

Most secure solutions I've seen involve not hosting the credit card data at all. It generally involves a 3rd party host (provided by your payment processor) who would take the initial credit card info and give you back a unique identifier that's specific to your business. Within your business, you can keep using that ID as a credit card for processing and future payments, but if anyone hacks in to your system and gets the data it's useless to them.


Edit: Apparently PCI standards are fairly global and also apply to Norway. So there you are.
Average means I'm better than half of you.
Excludos
Profile Blog Joined April 2010
Norway8264 Posts
Last Edited: 2018-07-03 19:21:39
July 03 2018 19:19 GMT
#19339
On July 04 2018 03:35 WolfintheSheep wrote:
Show nested quote +
On July 04 2018 02:33 Excludos wrote:
Hmm, I've been thinking about this for a while: What's the best way to store someone's credit card information on your servers? Obviously it would need to be encrypted, but it can't just be hashed as you'll need to somehow decrypt it when it's time to automatically renew the subscription or let the user pay more easily on his next online shopping transaction. So you'll need a good encryption and a key to decrypt it, but then you're left with the problem of how and where to store the key instead...

I'm not looking for a tool or library, but more an idea on how you'd go about solving this if you had to do it all from scratch, on a surface level.

Look up industry standards is the best advice I can give you. Financial payment information is one of those things you don't want to be approaching from scratch, because it could potentially get you in a lot of trouble. Here in North America we have the PCI DSS, which is the payment card compliance standard. I don't know what the equivalent would be in Norway.

Most secure solutions I've seen involve not hosting the credit card data at all. It generally involves a 3rd party host (provided by your payment processor) who would take the initial credit card info and give you back a unique identifier that's specific to your business. Within your business, you can keep using that ID as a credit card for processing and future payments, but if anyone hacks in to your system and gets the data it's useless to them.


Edit: Apparently PCI standards are fairly global and also apply to Norway. So there you are.


Again I should stress I'm not looking to implement this myself, only a surface level of understanding about how you'd do it (or rather, how others have done it). I'm not crazy enough to put myself in a situation where I could get sued for millions because I lost a bunch of credit cards.

It seems to me like it's a catch 22. No matter what you do, you have to store something which lets you unencrypt the credit cards, which in turn can get stolen and used by hackers to do the exact same thing.
WolfintheSheep
Profile Joined June 2011
Canada14127 Posts
July 03 2018 19:34 GMT
#19340
On July 04 2018 04:19 Excludos wrote:
Show nested quote +
On July 04 2018 03:35 WolfintheSheep wrote:
On July 04 2018 02:33 Excludos wrote:
Hmm, I've been thinking about this for a while: What's the best way to store someone's credit card information on your servers? Obviously it would need to be encrypted, but it can't just be hashed as you'll need to somehow decrypt it when it's time to automatically renew the subscription or let the user pay more easily on his next online shopping transaction. So you'll need a good encryption and a key to decrypt it, but then you're left with the problem of how and where to store the key instead...

I'm not looking for a tool or library, but more an idea on how you'd go about solving this if you had to do it all from scratch, on a surface level.

Look up industry standards is the best advice I can give you. Financial payment information is one of those things you don't want to be approaching from scratch, because it could potentially get you in a lot of trouble. Here in North America we have the PCI DSS, which is the payment card compliance standard. I don't know what the equivalent would be in Norway.

Most secure solutions I've seen involve not hosting the credit card data at all. It generally involves a 3rd party host (provided by your payment processor) who would take the initial credit card info and give you back a unique identifier that's specific to your business. Within your business, you can keep using that ID as a credit card for processing and future payments, but if anyone hacks in to your system and gets the data it's useless to them.


Edit: Apparently PCI standards are fairly global and also apply to Norway. So there you are.


Again I should stress I'm not looking to implement this myself, only a surface level of understanding about how you'd do it (or rather, how others have done it). I'm not crazy enough to put myself in a situation where I could get sued for millions because I lost a bunch of credit cards.

It seems to me like it's a catch 22. No matter what you do, you have to store something which lets you unencrypt the credit cards, which in turn can get stolen and used by hackers to do the exact same thing.

I'd still recommend PCI standards for theoretical information. Encryption key storage is included in the requirements, but yes, ultimately no system is every going to be completely secure. Security is always risk minimization, not risk prevention.

That's why a 3rd party credit card vault (which I think is the industry term) is a lot more secure than storing the data yourself.
Average means I'm better than half of you.
Prev 1 965 966 967 968 969 1032 Next
Please log in or register to reply.
Live Events Refresh
Douyu Cup 2020
06:00
2026 - Day 4
Scarlett vs OliveiraLIVE!
WardiTV1881
Ryung 952
IndyStarCraft 276
CranKy Ducklings184
CranKy Ducklings SOOP19
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Ryung 952
IndyStarCraft 276
ProTech128
trigger 50
StarCraft: Brood War
Calm 11568
Jaedong 515
firebathero 506
JYJ 432
Mini 422
Larva 376
Soma 248
EffOrt 200
Light 172
Mong 170
[ Show more ]
Zeus 123
BeSt 115
Last 114
Rush 98
Pusan 84
sorry 35
ggaemo 24
Hm[arnc] 24
Sacsri 14
ajuk12(nOOB) 8
Noble 7
Britney 1
Dota 2
Gorgc452
XaKoH 423
XcaliburYe417
Counter-Strike
pashabiceps685
kRYSTAL_123
Super Smash Bros
Mew2King89
Heroes of the Storm
Khaldor121
Other Games
JimRising 547
crisheroes249
Hui .181
Dewaltoss80
NotJumperer6
Organizations
Dota 2
PGL Dota 2 - Main Stream1188
Other Games
BasetradeTV240
StarCraft: Brood War
lovetv 8
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 12 non-featured ]
StarCraft 2
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• Michael_bg 7
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Lourlo650
Upcoming Events
BSL22 NKC (BSL vs China)
2h 59m
Mihu vs TBD
Online Event
3h 59m
RSL Revival
14h 59m
WardiTV Weekly
23h 59m
RSL Revival
1d 22h
RSL Revival
2 days
Bombastic Starleague
2 days
Kung Fu Cup
2 days
OSC
3 days
CrankTV Team League
3 days
[ Show More ]
Bombastic Starleague
4 days
Replay Cast
4 days
The PondCast
4 days
HomeStory Cup
4 days
Replay Cast
5 days
HomeStory Cup
5 days
Replay Cast
6 days
HomeStory Cup
6 days
Liquipedia Results

Completed

CSL Season 21: Qualifier 1
Maestros of the Game 2
Heroes Pulsing #2

Ongoing

IPSL Spring 2026
Acropolis #4
CSCL: Masked Kings S4
YSL S3
BSL 22 Non-Korean Championship
CSL Season 21: Qualifier 2
SCTL 2026 Spring
Douyu Cup 2026
Murky Cup 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
Asian Champions League 2026
IEM Atlanta 2026
PGL Astana 2026
BLAST Rivals Spring 2026
IEM Rio 2026

Upcoming

CSL 2026 Summer (S21)
ASL Season 22:Wild Card Qualifier
CSLAN 4
Blizzard Classic Cup 2026
Kung Fu Cup 2026 Grand Finals
RSL Revival: Season 6
CranK Gathers Season 4: BW vs SC2 Team League
HSC XXIX
BCC 2026
Light Tournament 2026
Eternal Conflict S2 Finale
Eternal Conflict S2 E1
Heroes Pulsing #3
FISSURE Playground #5
BLAST Open Fall 2026
Esports World Cup 2026
BLAST Bounty Summer 2026
BLAST Bounty Summer Qual
Stake Ranked Episode 3
XSE Pro League 2026
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.