• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 01:15
CET 07:15
KST 15:15
  • 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: The Forgotten Master of ZvT28Behind the Blue - Team Liquid History Book19Clem wins HomeStory Cup 289HomeStory Cup 28 - Info & Preview13Rongyi Cup S3 - Preview & Info8
Community News
Weekly Cups (Feb 16-22): MaxPax doubles0Weekly Cups (Feb 9-15): herO doubles up2ACS replaced by "ASL Season Open" - Starts 21/0258LiuLi Cup: 2025 Grand Finals (Feb 10-16)46Weekly Cups (Feb 2-8): Classic, Solar, MaxPax win2
StarCraft 2
General
Terran AddOns placement How do you think the 5.0.15 balance patch (Oct 2025) for StarCraft II has affected the game? Nexon's StarCraft game could be FPS, led by UMS maker ByuL: The Forgotten Master of ZvT Oliveira Would Have Returned If EWC Continued
Tourneys
PIG STY FESTIVAL 7.0! (19 Feb - 1 Mar) SEL Doubles (SC Evo Bimonthly) WardiTV Team League Season 10 RSL Season 4 announced for March-April The Dave Testa Open #11
Strategy
Custom Maps
Publishing has been re-enabled! [Feb 24th 2026] Map Editor closed ?
External Content
Mutation # 514 Ulnar New Year The PondCast: SC2 News & Results Mutation # 513 Attrition Warfare Mutation # 512 Overclocked
Brood War
General
TvZ is the most complete match up BGH Auto Balance -> http://bghmmr.eu/ Soma Explains: JD's Unrelenting Aggro vs FlaSh ACS replaced by "ASL Season Open" - Starts 21/02 BW General Discussion
Tourneys
[Megathread] Daily Proleagues [LIVE] [S:21] ASL Season Open Day 1 ASL Season 21 Qualifiers March 7-8 Small VOD Thread 2.0
Strategy
Soma's 9 hatch build from ASL Game 2 Fighting Spirit mining rates Simple Questions, Simple Answers Zealot bombing is no longer popular?
Other Games
General Games
Nintendo Switch Thread Battle Aces/David Kim RTS Megathread Path of Exile Beyond All Reason New broswer game : STG-World
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
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas TL Mafia Community Thread
Community
General
US Politics Mega-thread Things Aren’t Peaceful in Palestine UK Politics Mega-thread YouTube Thread Mexico's Drug War
Fan Clubs
The IdrA Fan Club The herO Fan Club!
Media & Entertainment
[Manga] One Piece [Req][Books] Good Fantasy/SciFi books Anime Discussion Thread
Sports
2024 - 2026 Football Thread Formula 1 Discussion TL MMA Pick'em Pool 2013
World Cup 2022
Tech Support
Laptop capable of using Photoshop Lightroom?
TL Community
The Automated Ban List
Blogs
YOUTUBE VIDEO
XenOsky
Unintentional protectionism…
Uldridge
ASL S21 English Commentary…
namkraft
Inside the Communication of …
TrAiDoS
Life Update and thoughts.
FuDDx
How do archons sleep?
8882
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2672 users

The Big Programming Thread - Page 701

Forum Index > General Forum
Post a Reply
Prev 1 699 700 701 702 703 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.
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
Last Edited: 2016-01-14 21:43:46
January 14 2016 21:23 GMT
#14001
edit: how do i turn off button hover in bootstrap
Manit0u
Profile Blog Joined August 2004
Poland17677 Posts
January 15 2016 14:43 GMT
#14002
On January 15 2016 06:23 travis wrote:
edit: how do i turn off button hover in bootstrap


What do you mean? Do you want to disable the button?

http://getbootstrap.com/css/#buttons-disabled
Time is precious. Waste it wisely.
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
Last Edited: 2016-01-15 18:21:08
January 15 2016 15:42 GMT
#14003
naw, I want to take the hover effect away from the button. I want to turn hover off but keep the toggle effect, which would go away if I disabled the button.

I guess technically I could do that by just changing the hover color to match the normal color lol
which is what I will do




anyways, so I am designing this website, just seeing what I can make
and as I play around and it slowly starts turning into something I like, I realize that more and more it is slowly just turning into the front page of reddit. I can't seem to help it.
Nesserev
Profile Blog Joined January 2011
Belgium2760 Posts
January 15 2016 19:03 GMT
#14004
--- Nuked ---
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
January 15 2016 19:20 GMT
#14005
On January 16 2016 04:03 Nesserev wrote:
What are some of the recommended books regarding testing and TDD?

I was thinking of getting my hands on one of Kent Beck's books, but was told that Kent Beck's style is a little bit too Billy Mays, and that I should stay away from any book that even reeks of the word Agile, cause it'll be just another sales pitch.

I quite liked TDD by example, not sure what's to hate about Kent Beck's style.
If you have a good reason to disagree with the above, please tell me. Thank you.
Manit0u
Profile Blog Joined August 2004
Poland17677 Posts
January 15 2016 20:33 GMT
#14006
On January 16 2016 04:03 Nesserev wrote:
What are some of the recommended books regarding testing and TDD?

I was thinking of getting my hands on one of Kent Beck's books, but was told that Kent Beck's style is a little bit too Billy Mays, and that I should stay away from any book that even reeks of the word Agile, cause it'll be just another sales pitch.


Just a few pages back:
http://chimera.labs.oreilly.com/books/1234000000754/index.html
Time is precious. Waste it wisely.
aksfjh
Profile Joined November 2010
United States4853 Posts
January 15 2016 21:24 GMT
#14007
On January 13 2016 01:19 berated- wrote:
Show nested quote +
On January 12 2016 19:38 Morfildur wrote:
On January 12 2016 10:59 tofucake wrote:
So last week we got the green light to start fresh with the new version of our website, and today we had a database design meeting. I'm excited that we are moving from a heavily modded and unupgradable CakePHP 1.something, weird ajax, some sort of Symfony, bootstrap AND random SASS, jQuery, and PHP 5.3 all run on composer and compass to Symfony 3, PHP7, AdminLTE/Bootstrap, bower/gulp, and maybe nginx.

The admin section of prod alone is a nightmare to debug, as the way it's setup is such that all debugging is a pain (tail -F /var/log/httpd/error_log) and called pages cannot execute JS, which means all the control JS needs to be in the calling document, not the return result. It's so dumb how it's currently done.

Add to that the fact that we outsourced the development of the mobile site to another company and they royally fucked it up, and what we get is a very happy team of developers. Going through the DB today and saying "yes we can axe this 13gb table" was awesome.


Been there, done that. End product was worse than the previous product.

In my previous company we wanted to move away from the old frontend, which was essentially entirely custom made. The new project was supposed to be all OOP, SOA, TDD and stuff. I was only involved in the latter parts of the rework, but essentially the new website was slow as hell, the structure was even more confusing since everything was configurable and the UI that was supposed to be identical to the old ended up much less userfriendly. The rework too 6 developers about a full year, if not a bit more, and for me the final product was unacceptable with page loading speeds in the range of one second for the simpler pages - after the extended 10 person team, the part where I got involved, spent two weeks optimizing everything, apart from the underlying Kohana framework which we weren't allowed to fix as to maintain compatibility to future updates.

I switched to my current company, for which I worked a few years back, on the promise of scrapping the old websites and creating something new. The old pages were basically procedural with all the functions in a file literally called functions.php. I came in when the one developer plus two student assistants already laid most of the foundation and I mostly had to add some of the more complex stuff like payment connectors and such. The new product is using zend framework 2 running on the azure cloud with lots of factories and stuff - and it's ugly, slow (page loading speed of 2s and more) and big parts of the code are huge messes. Launch is on the first of February and I wouldn't use the product in it's current state even if the stuff we're selling was free.

I think scrapping old stuff and creating it anew is overrated.
It's fun though, I do it with my private projects all the time, which is one reason why 99% of them never see the light of day.


+1 - rewrites are definitely.. interesting.

The problem I have with them most of the time is the fallacy that it will be easier to understand, combined with the failure to understand the current product. If you can't dive in and figure out the current one, I've never been quite certain how one thinks they will rewrite it and get it correct.

I would say the biggest problems with rewrites is the attempt to do too much under the guise of "rewrite." In his specific example,
The new project was supposed to be all OOP, SOA, TDD and stuff
that is way too much work to put under the umbrella of a single project/rewrite. Doing each individual thing listed (OOP, SOA, TDD) is an undertaking and full team effort all on its own. You should take each one as a step to improve the current product, and if you can't do that, then you have no place doing a rewrite using those techniques/paradigms.

The only time I can see doing a complete rewrite like that is if you literally have a team of developers/programmers practically sitting around doing nothing or otherwise need a large project to undertake while your normal team is also underwhelmed with maintenance. Something that, if you threw a bunch of resources into and it failed, it would suck but it wouldn't ruin your product/brand.
Animzor
Profile Joined March 2011
Sweden2154 Posts
January 16 2016 05:51 GMT
#14008
Should get functions in c++ always return const? like:

+ Show Spoiler +
SDL_Rect Sprite::getRect() const
{
return rect;
}


I assume set functions are used to change the object, so it seems reasonable to always use const in get functions.
Nesserev
Profile Blog Joined January 2011
Belgium2760 Posts
Last Edited: 2016-01-16 07:09:01
January 16 2016 06:39 GMT
#14009
--- Nuked ---
bangsholt
Profile Joined June 2011
Denmark138 Posts
January 16 2016 19:21 GMT
#14010
There's also this one about TDD:

https://pragprog.com/book/lotdd/modern-c-programming-with-test-driven-development

Read it and I like it, because it takes small steps and doesn't assume you know things, so it's all explained thoroughly.
solidbebe
Profile Blog Joined November 2010
Netherlands4921 Posts
January 16 2016 21:02 GMT
#14011
On January 16 2016 04:03 Nesserev wrote:
What are some of the recommended books regarding testing and TDD?

I was thinking of getting my hands on one of Kent Beck's books, but was told that Kent Beck's style is a little bit too Billy Mays, and that I should stay away from any book that even reeks of the word Agile, cause it'll be just another sales pitch.

If you are interested in some articles/blogs by Bertrand Meyer and my software quality and testing professor:
+ Show Spoiler +

Bertrand Meyer. "Applying Design by Contract". IEEE Computer, 1992. http://se.ethz.ch/~meyer/publications/computer/contract.pdf
Bertrand Meyer. "Seven Principles of Software Testing". IEEE Software, 2009. http://se.inf.ethz.ch/~meyer/publications/testing/principles.pdf
"Line Coverage: Lessons from JUnit".
http://avandeursen.com/2012/12/21/line-coverage-lessons-from-junit/
"Test Coverage: Not for Managers?"
http://avandeursen.com/2013/11/19/test-coverage-not-for-managers/
"Learning from Apple's #gotofail Security Bug."
http://avandeursen.com/2014/02/22/gotofail-security/
"Beyond Page Objects: Testing Web Applications with State Objects."
http://queue.acm.org/detail.cfm?id=2793039
That's the 2nd time in a week I've seen someone sig a quote from this GD and I have never witnessed a sig quote happen in my TL history ever before. -Najda
Cynry
Profile Blog Joined August 2010
810 Posts
Last Edited: 2016-01-17 23:35:25
January 17 2016 23:34 GMT
#14012
Any web hacking knowledge around here ?
I'm looking to secure all the client input when he calls server sided logic, for inserting document into a db for exemple.
I've type checked everything and made sure only the fields I required were present, but the possible issue comes from how I've done it.

Basically I receive the following args : the name of the function to execute, related data, optional target for the function.
For most functions it's a one step process, check first, then execute, no problem. But in some cases, like inserting a document, the related data contains a whole object representing the document to create, and the process happens in 2 phases. First, I make sure there is a document of type Object in the data, but I don't check what's inside. Then inside the create function, I check each of the document's objet's fields before copying them to the db.
I'm worried because *some* stuff happens inbetween. Nothing interacts with the document object's fields before they are checked, but I still wonder if there's some security hole possible in this scenario..
Manit0u
Profile Blog Joined August 2004
Poland17677 Posts
January 17 2016 23:57 GMT
#14013
On January 18 2016 08:34 Cynry wrote:
Any web hacking knowledge around here ?
I'm looking to secure all the client input when he calls server sided logic, for inserting document into a db for exemple.
I've type checked everything and made sure only the fields I required were present, but the possible issue comes from how I've done it.

Basically I receive the following args : the name of the function to execute, related data, optional target for the function.
For most functions it's a one step process, check first, then execute, no problem. But in some cases, like inserting a document, the related data contains a whole object representing the document to create, and the process happens in 2 phases. First, I make sure there is a document of type Object in the data, but I don't check what's inside. Then inside the create function, I check each of the document's objet's fields before copying them to the db.
I'm worried because *some* stuff happens inbetween. Nothing interacts with the document object's fields before they are checked, but I still wonder if there's some security hole possible in this scenario..


Could you be a bit more specific? What do you mean by 'user calls server-side logic' and what is the document? Is it just some text? Fields from some form? Uploaded file that you save as binary data?

If you're worried about stuff like SQL injection or XSS I can give you some hints. It really boils down to what programming language/framework you're using for the most part. Most modern frameworks already come with enough built-in security but if you've written your web application in pure PHP from scratch you can be in a world of hurt if you don't know what you're doing. You'd be surprised how many people still use deprecated database connection methods...

Some general hints for your regular form -> object -> db path:

1. HTML validation - html5 provides you with pretty nice validation for some form fields out of the box. This prevents the browser to even submit the form with invalid data (email, password, numbers come to mind - some fields can also have regexp validation).
2. Form validation - this is done server-side, after the form is submitted but before the object is created.
3. Object validation - your getters and setters can also include a layer of validation.
4. Proper SQL - this is the last part. You should design your database properly with correct field types, default values etc. Then you should also make sure that your queries are constructed properly (using literals for text, query parametrization etc.).
Time is precious. Waste it wisely.
bangsholt
Profile Joined June 2011
Denmark138 Posts
January 18 2016 00:06 GMT
#14014
Do prepared statements for all your SQL and escaping user input covers you for the vast majority of the cases.

Also make sure you do a proper check of return values and catch exceptions if applicable, so that you don't leak information about your systems.
tofucake
Profile Blog Joined October 2009
Hyrule19193 Posts
January 18 2016 00:54 GMT
#14015
You're better off using an ORM that's tried and tested (Doctrine, Eloquent, etc) to handle your db interactions
Liquipediaasante sana squash banana
Cynry
Profile Blog Joined August 2010
810 Posts
January 18 2016 02:48 GMT
#14016
Oh yeah we're working with meteor, so all javascript and mongodb. Of all the terms I didn't understand (literals, query parametrization, prepared statements) I'm not sure which ones are SQL related...


Could you be a bit more specific? What do you mean by 'user calls server-side logic' and what is the document? Is it just some text? Fields from some form? Uploaded file that you save as binary data?

There are methods in meteor, which are the functions the client side of the app calls to do any modification to the database. From the client app the server receives data as JSON objects, coming from forms. But the same methods can also be called from console with who knows what as arguments, and there lies a key point of securiy in meteor, making sure you're receiving proper data in methods.

We're using some kind of ORM, so all fields are enforced, default values set etc. I'm in fact fairly confident that it's now quite secure, and I was just wondering about the particular case I mentionned. I'll add some code tomorrow to explain further.
aksfjh
Profile Joined November 2010
United States4853 Posts
January 18 2016 05:52 GMT
#14017
I suggest going through your list of tools/packages and doing Google searches on known vulnerabilities and attack vectors. You might find some things to look out for that are "by design" and others that the vendor hasn't/won't fix. Might want to get some sort of web-scan on it once it's in place as both a stress test and security check.

You should also investigate all known vulnerabilities of your parsers. Some JSON and XML parsers have been known to be vulnerable to kinds of injections and behave strangely to malformed or unusual formatting.

Your project is probably fine from a design perspective if you have enough sense to actively think and ask about security.
Manit0u
Profile Blog Joined August 2004
Poland17677 Posts
January 18 2016 12:46 GMT
#14018
On January 18 2016 11:48 Cynry wrote:
Of all the terms I didn't understand (literals, query parametrization, prepared statements) I'm not sure which ones are SQL related...


All of them

Literals, query parametrization, prepared statements - that's what most ORMs can handle for you as they do it automatically most of the time (if you're using DBMS like H2 you can even disable literals and force people to use parametrized queries and prepared statements, ORM or not). You can even do it without ORM but it requires more work.

https://en.wikipedia.org/wiki/Prepared_statement
http://blog.codinghorror.com/give-me-parameterized-sql-or-give-me-death/
Time is precious. Waste it wisely.
Deleted User 101379
Profile Blog Joined August 2010
4849 Posts
January 18 2016 14:57 GMT
#14019
On January 18 2016 11:48 Cynry wrote:
Oh yeah we're working with meteor, so all javascript and mongodb. Of all the terms I didn't understand (literals, query parametrization, prepared statements) I'm not sure which ones are SQL related...

Show nested quote +

Could you be a bit more specific? What do you mean by 'user calls server-side logic' and what is the document? Is it just some text? Fields from some form? Uploaded file that you save as binary data?

There are methods in meteor, which are the functions the client side of the app calls to do any modification to the database. From the client app the server receives data as JSON objects, coming from forms. But the same methods can also be called from console with who knows what as arguments, and there lies a key point of securiy in meteor, making sure you're receiving proper data in methods.

We're using some kind of ORM, so all fields are enforced, default values set etc. I'm in fact fairly confident that it's now quite secure, and I was just wondering about the particular case I mentionned. I'll add some code tomorrow to explain further.


If you are working with MongoDB you don't have to worry about the SQL stuff. MongoDB works with a completely different API and structure, so almost none of the SQL things with prepared statements and such applies.

However, what you need to keep in mind:

1. If you get documents from outside that you want to write to the database, verify that it is valid. If the document comes straight from the frontend, people can write whatever they want into your database, including new keys and such. Make sure that every document only contains the data you allow and that that data is valid. Don't rely on any frontend verification. I explicitly copy the values over to a new object instead of using the object I get from the outside to make sure it's clean, though that adds overhead and another place to maintain the data structure.
2. Validate queries. If you just do
$query = ["username" => $username, "password" => $password];

you run the risk that users manipulate the frontend to have $password be something like ['$exists' => true], and suddenly they can log in as any username. This is the closest to SQL injection and easy to overlook.
3. For all deletions, verify that the filter is correct so you don't accidentally delete your whole collection. Depending on the API there are separate methods for deleting just one and deleting any amount of documents.
4. Verify that you are accessing the correct collection. Don't accept any collection selection that comes from the frontend, always take it from a configuration or some constant.
5. Make sure authentication is enabled. The default MongoDB installations don't have authentication enabled and it's easy to forget to enable it when you are just working on the programming side. Make sure user accounts only have the access they need and not a tiny bit more, which means separate users for administration, backups and the actual server<->DB communication.
Cynry
Profile Blog Joined August 2010
810 Posts
January 18 2016 22:15 GMT
#14020
On January 18 2016 23:57 Morfildur wrote:

1. If you get documents from outside that you want to write to the database, verify that it is valid. If the document comes straight from the frontend, people can write whatever they want into your database, including new keys and such. Make sure that every document only contains the data you allow and that that data is valid. Don't rely on any frontend verification. I explicitly copy the values over to a new object instead of using the object I get from the outside to make sure it's clean, though that adds overhead and another place to maintain the data structure.


We don't copy the values to a new object, but we type check every fields before actually using them using some kind of ORM, and make sure they are the only one received. Would that be enough ? Copying whole object would require some implementation of a deep extend function, I'd rather avoid that..

Everything else is duly noted, didn't even knew there was an auth to enable in mongo... Thanks a lot !
Prev 1 699 700 701 702 703 1032 Next
Please log in or register to reply.
Live Events Refresh
Replay Cast
00:00
LiuLi Cup Grand Finals Group B
LiquipediaDiscussion
AI Arena Tournament
20:00
RO8
DaveTesta Events
18:15
The Dave Testa Open #11
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
WinterStarcraft466
Ketroc 63
SortOf 10
StarCraft: Brood War
GuemChi 3930
ggaemo 311
ToSsGirL 28
NaDa 11
Dota 2
NeuroSwarm158
League of Legends
Reynor82
Counter-Strike
Stewie2K898
Super Smash Bros
Mew2King154
Other Games
summit1g8874
JimRising 637
Livibee43
Organizations
Other Games
gamesdonequick677
Counter-Strike
PGL272
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 16 non-featured ]
StarCraft 2
• practicex 44
• StrangeGG 26
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• HerbMon 29
• Diggity6
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Lourlo1457
• Rush1329
Upcoming Events
PiG Sty Festival
2h 45m
Clem vs Serral
Maru vs ShoWTimE
Sparkling Tuna Cup
3h 45m
uThermal 2v2 Circuit
8h 45m
Replay Cast
1d 2h
Wardi Open
1d 5h
Monday Night Weeklies
1d 10h
Replay Cast
1d 17h
Replay Cast
3 days
Replay Cast
3 days
The PondCast
4 days
[ Show More ]
KCM Race Survival
4 days
Replay Cast
4 days
Replay Cast
5 days
CranKy Ducklings
6 days
Replay Cast
6 days
Liquipedia Results

Completed

[S:21] ASL SEASON OPEN 2nd Round
LiuLi Cup: 2025 Grand Finals
Underdog Cup #3

Ongoing

KCM Race Survival 2026 Season 1
Acropolis #4 - TS5
Jeongseon Sooper Cup
Spring Cup 2026
WardiTV Winter 2026
PiG Sty Festival 7.0
Nations Cup 2026
ESL Pro League S23 Stage 1&2
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
eXTREMESLAND 2025

Upcoming

ASL Season 21: Qualifier #1
ASL Season 21: Qualifier #2
ASL Season 21
Acropolis #4 - TS6
Acropolis #4
IPSL Spring 2026
CSLAN 4
HSC XXIX
uThermal 2v2 2026 Main Event
Bellum Gens Elite Stara Zagora 2026
RSL Revival: Season 4
NationLESS Cup
IEM Atlanta 2026
Asian Champions League 2026
PGL Astana 2026
BLAST Rivals Spring 2026
CCT Season 3 Global Finals
FISSURE Playground #3
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League S23 Finals
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.