• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 15:50
CET 21:50
KST 05:50
  • 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
[ASL22] Finals Preview: Sweet Victory!12[ASL22] Ro4 Preview: Mirror Mirror6[ASL22] Ro8 Preview: Within Reach5[ASL22] Ro8 Preview: In A Tizzy11[ASL22] Ro16 Preview: Holy Diver5
Community News
Dark completes military service, returns to SC211[BSL23] RO16 Group Stage19Weekly Cups (Nov 2-8): herO back on top?2Weekly Cups (Oct 26 - Nov 1): MaxPax, herO, Solar win0Weekly Cups (October 19-25): Clem triples first in 5.0.175
StarCraft 2
General
Dark completes military service, returns to SC2 Greetings.. No more SC2 streamers on team liquid? Serral's getting trashed by New Catsle's Mind Weekly Cups (Nov 2-8): herO back on top?
Tourneys
Sparkling Tuna Cup - Weekly Open Tournament Sea Duckling Open (Global, Bronze-Diamond) Dark returns! GSL CK #7 4v4 Team Battle (Nov 19) soO & FanTaSy return! SC2 Kevin Scrim 4v4 (Nov 16) RSL goes to London! 2026 Offline Finals Nov 21-22
Strategy
[H] ZvP Mid-Late Game: Stalkers Collossi HT
Custom Maps
[G] How to playtest arcade maps Starcraft 2 Advance [D] the control group Simple Questions/Answers
External Content
Mutation # 552 Secret Storm The PondCast: SC2 News & Results Mutation # 551 Robotic Revival Mutation # 550 Graveyard Shift
Brood War
General
Korean players' earnings Hit New All-Time High! BW General Discussion List of top players active on ShieldBattery SOOP Hosts SC1 & SC2 Event Tournament: Kevin Scrim BGH Auto Balance -> http://bghmmr.eu/
Tourneys
[BSL23] Ro16 Group C - Sunday 21:00 CET [$1250] International ShieldBattery League [Megathread] Daily Proleagues [BSL23] Ro16 Group A - Saturday 21:00 CET
Strategy
Pluto's TvP 5Marine 2Medic Push Simple Questions, Simple Answers Infested Terran strategies in 2026 Nuke strategy worked in K-League 2026-11-09
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread Free Space RTS Game, optimised f. Phone/Tablet etc List of Game Threads The PlayStation 5
Dota 2
League of Legends
[TL LoL EUW IHs] Teemo shall perish
Heroes of the Storm
Heroes of the Storm 2.0
Hearthstone
Deck construction bug
TL Mafia
TL Mafia Community Thread
Community
General
US Politics Mega-thread Things Aren’t Peaceful in Palestine Artificial Intelligence Thread Trading/Investing Thread European Politico-economics QA Mega-thread
Fan Clubs
Fan Club Resource Thread Reynor Fan Club The Flash Fan Club
Media & Entertainment
Movie Discussion! Anime Discussion Thread [Manga] One Piece
Sports
Football (Soccer) Thread TeamLiquid Health and Fitness Initiative For 2023 MLB/Baseball 2023
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List Recent Gifted Posts
Blogs
The time I organised my…
AssyrianKing
Why I built Repalyzer (1.1.…
BlueStar
Innovate or Game Over?
TrAiDoS
ShieldBattery on Mac
Kraekkling
Can Bots Beat Pros?? Starcr…
namkraft
Customize Sidebar...

Website Feedback

Closed Threads



Active: 11556 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
Poland17875 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
Poland17875 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
Poland17875 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
Hyrule19270 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
Poland17875 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
BSL
05:00
S23 - Ro16 Group C
Artosis vs Dewalt
Ret vs Tech
ZZZero.O463
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
SpeCial 114
EmSc Tv 22
StarCraft: Brood War
Rain 1352
ZZZero.O 463
firebathero 93
Dota 2
Gorgc5195
Counter-Strike
pashabiceps2320
zeus703
allub560
gobbtv213
Super Smash Bros
Mew2King38
Heroes of the Storm
Khaldor363
Other Games
Grubby3182
Liquid`RaSZi2150
tarik_tv708
syndereN205
UpATreeSC33
Railgan18
Organizations
Other Games
gamesdonequick2604
StarCraft 2
EmSc Tv 22
EmSc2Tv 22
[ Show 12 non-featured ]
StarCraft 2
• Hinosc 22
• Reevou 15
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• Migwel
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Other Games
• imaqtpie1462
• Shiphtur487
Upcoming Events
SOOP
13h 10m
soO vs FanTaSy
WardiTV Weekly
15h 10m
Replay Cast
1d 2h
Monday Night Weeklies
1d 20h
PiGosaur Cup
2 days
The PondCast
2 days
GSL
3 days
Replay Cast
4 days
KCM Race Survival
4 days
RSL Revival
5 days
[ Show More ]
BSL
5 days
eOnzErG vs StRyKeR
Cross vs JDConan
RSL Revival
6 days
BSL
6 days
Bonyth vs Doodle
Kyrie vs Jimin
Liquipedia Results

Completed

Proleague 2026-11-14
Blizzard Classic Cup 2026
HCC Season 3

Ongoing

Acropolis #5
KCM Race Survival 2026 Season 4
International ShieldBattery League
BSL Season 23
IPSL Winter 2026-27
Calamity Cup Div. A Season 8
Underdog Cup 2026 Div 2-3
BLAST Rivals Fall 2026
IEM Beijing 2026
PGL Masters Bucharest 2026
Stake Ranked Episode 5
1win Private Club #2
Thunderpick World Champ. '26
ESL Pro League Season 24
Stake Ranked Episode 4
1win Private Club #1
Logitech G Play Connect 2026
SL StarSeries Fall 2026
FISSURE Playground #3
BLAST Open Fall 2026

Upcoming

YSL S4
Sector 591
SC4ALL II: Brood War
BSL 23: Non-Korean Championship
HSC XXX
Stellar Fest 2: Lunar Cup
StarCraft2 Weekly Open Tournament 2026 Grand Finals
SC4ALL II: StarCraft II
Kung Fu Cup 2026 Grand Finals
RSL Offline Finals
IEM Kraków 2027
PGL Bucharest 2027
BLAST Bounty Winter 2027
PGL Major Singapore 2026
Stake Ranked Episode 6
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.