• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 02:57
CEST 08:57
KST 15:57
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
[ASL19] Finals Recap: Standing Tall9HomeStory Cup 27 - Info & Preview18Classic wins Code S Season 2 (2025)16Code S RO4 & Finals Preview: herO, Rogue, Classic, GuMiho0TL Team Map Contest #5: Presented by Monster Energy6
Community News
Flash Announces Hiatus From ASL61Weekly Cups (June 23-29): Reynor in world title form?13FEL Cracov 2025 (July 27) - $8000 live event19Esports World Cup 2025 - Final Player Roster16Weekly Cups (June 16-22): Clem strikes back1
StarCraft 2
General
Statistics for vetoed/disliked maps Program: SC2 / XSplit / OBS Scene Switcher The SCII GOAT: A statistical Evaluation Weekly Cups (June 23-29): Reynor in world title form? PiG Sty Festival #5: Playoffs Preview + Groups Recap
Tourneys
FEL Cracov 2025 (July 27) - $8000 live event RSL: Revival, a new crowdfunded tournament series Korean Starcraft League Week 77 Master Swan Open (Global Bronze-Master 2) [GSL 2025] Code S: Season 2 - Semi Finals & Finals
Strategy
How did i lose this ZvP, whats the proper response Simple Questions Simple Answers
Custom Maps
[UMS] Zillion Zerglings
External Content
Mutation # 480 Moths to the Flame Mutation # 479 Worn Out Welcome Mutation # 478 Instant Karma Mutation # 477 Slow and Steady
Brood War
General
Flash Announces Hiatus From ASL Player “Jedi” cheat on CSL ASL20 Preliminary Maps SC uni coach streams logging into betting site BGH Mineral Boosts Tutorial Video
Tourneys
[BSL20] Grand Finals - Sunday 20:00 CET [Megathread] Daily Proleagues Small VOD Thread 2.0 [BSL20] GosuLeague RO16 - Tue & Wed 20:00+CET
Strategy
Simple Questions, Simple Answers I am doing this better than progamers do.
Other Games
General Games
Path of Exile Stormgate/Frost Giant Megathread Nintendo Switch Thread 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 Russo-Ukrainian War Thread Trading/Investing Thread Things Aren’t Peaceful in Palestine The Games Industry And ATVI
Fan Clubs
SKT1 Classic Fan Club! Maru Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece [\m/] Heavy Metal Thread
Sports
2024 - 2025 Football Thread Formula 1 Discussion NBA General Discussion TeamLiquid Health and Fitness Initiative For 2023 NHL Playoffs 2024
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Blogs
Culture Clash in Video Games…
TrAiDoS
from making sc maps to makin…
Husyelt
Blog #2
tankgirl
StarCraft improvement
iopq
Trip to the Zoo
micronesia
Customize Sidebar...

Website Feedback

Closed Threads



Active: 538 users

The Big Programming Thread - Page 701

Forum Index > General Forum
Post a Reply
Prev 1 699 700 701 702 703 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.
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
Poland17243 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
Poland17243 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
Poland17243 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
Hyrule19030 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
Poland17243 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 1031 Next
Please log in or register to reply.
Live Events Refresh
Next event in 3h 3m
[ Submit Event ]
Live Streams
Refresh
StarCraft: Brood War
Leta 594
Larva 324
Barracks 53
Dota 2
XaKoH 608
League of Legends
JimRising 745
Counter-Strike
Stewie2K1027
Heroes of the Storm
Khaldor237
Other Games
WinterStarcraft650
SortOf103
kaitlyn77
ProTech53
Organizations
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 17 non-featured ]
StarCraft 2
• Berry_CruncH367
• Hupsaiya 91
• Sammyuel 42
• Kozan
• LaughNgamezSOOP
• sooper7s
• AfreecaTV YouTube
• intothetv
• Migwel
• IndyKCrew
StarCraft: Brood War
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• lizZardDota2175
League of Legends
• Lourlo1363
• masondota2816
• Stunt507
Upcoming Events
RSL Revival
3h 3m
Clem vs Classic
SHIN vs Cure
FEL
5h 3m
WardiTV European League
5h 3m
BSL: ProLeague
11h 3m
Dewalt vs Bonyth
Replay Cast
1d 17h
Sparkling Tuna Cup
2 days
WardiTV European League
2 days
The PondCast
3 days
Replay Cast
3 days
RSL Revival
4 days
[ Show More ]
Replay Cast
4 days
RSL Revival
5 days
FEL
5 days
RSL Revival
6 days
FEL
6 days
FEL
6 days
Liquipedia Results

Completed

BSL 2v2 Season 3
HSC XXVII
Heroes 10 EU

Ongoing

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

Upcoming

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

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.