• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 13:42
CET 19:42
KST 03:42
  • 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
BW General Discussion List of top players active on ShieldBattery Korean players' earnings Hit New All-Time High! SOOP Hosts SC1 & SC2 Event Tournament: Kevin Scrim BGH Auto Balance -> http://bghmmr.eu/
Tourneys
[$1250] International ShieldBattery League [Megathread] Daily Proleagues [BSL23] Ro16 Group A - Saturday 21:00 CET Bisu's Team vs Shuttle's Team 2026-11-14
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 Artificial Intelligence Thread Things Aren’t Peaceful in Palestine 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: 11921 users

The Big Programming Thread - Page 690

Forum Index > General Forum
Post a Reply
Prev 1 688 689 690 691 692 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
December 09 2015 16:33 GMT
#13781
hi guys,
I am going through a pdf of a lecture I missed and it's going on about defining equals methods

in the example it gives, it is showing how to do an equals method, taking a parameter of type "object", to see if that "object" equals the current object, which is of type "student"

here is what they write


public boolean equals(Object obj) {
if (obj == this)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Person other = (Person) obj;

return name.equals(other.name) && idNum.equals(other.idNum);
}



my question is, why do they do this line:

Person other = (Person) obj;



at this point, haven't they confirmed that the object is a person already?
tofucake
Profile Blog Joined October 2009
Hyrule19270 Posts
December 09 2015 16:35 GMT
#13782
Yes, but not that the object to check is the same person as the one being checked against, which is what the return line after is doing.
Liquipediaasante sana squash banana
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
Last Edited: 2015-12-09 16:49:06
December 09 2015 16:47 GMT
#13783
Well, you don't mean literally the same person object, right? because that's what this line does:

if (obj == this)
return true;


so my question is, if the object has aready been determined to be a person, then why do they cast that object to type person to check that it's fields are equal to the current object

couldn't they skip


Person other = (Person) obj;


and just at the end do


return name.equals(obj.name) && idNum.equals(obj.idNum);


or does java not let you do that because it can't recognize an object as being a person?
and if that's the case then can't they do


Person other = obj;


instead of


Person other = (Person) obj;



or is that not allowed
supereddie
Profile Joined March 2011
Netherlands151 Posts
December 09 2015 17:24 GMT
#13784
Stongly typed languages (like Java) cannot implicitly convert an object to a more specific object. In this case, Person is a more specific version of Object. If the object is not of class Person but another class, you probaly get an InvalidCastException (or whatever it is in Java) - that is why the check on Class is there.

It is possible to implicitly convert a Person to an Object however

Object myObject = person;
"Do not try to make difficult things possible, but make simple things simple." - David Platt on Software Design
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
Last Edited: 2015-12-09 19:26:35
December 09 2015 19:20 GMT
#13785
On December 10 2015 01:33 travis wrote:
hi guys,
I am going through a pdf of a lecture I missed and it's going on about defining equals methods

in the example it gives, it is showing how to do an equals method, taking a parameter of type "object", to see if that "object" equals the current object, which is of type "student"

here is what they write

Show nested quote +

public boolean equals(Object obj) {
if (obj == this)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Person other = (Person) obj;

return name.equals(other.name) && idNum.equals(other.idNum);
}



my question is, why do they do this line:

Person other = (Person) obj;



at this point, haven't they confirmed that the object is a person already?

The check if it's exactly the same Person object is this part, you got that right:
if (obj == this)


At the end, we know that obj is a Person, so now we know it's safe to cast it to Person. Which we need for the next line because we can't write this:
return name.equals(obj.name) && idNum.equals(obj.idNum);

While we as humans know that obj is a Person and thus know that it has these fields, the type of the obj reference still is Object. We can't access fields declared in Person on a variable of type Object because Java is a statically typed language. First we tell the compiler to treat the variable as a Person and then we tell it what to do with it.

In dynamically typed languages we can just write
return name.equals(obj.name) && idNum.equals(obj.idNum);

and it will compile just fine, but it will throw an exception during runtime. In statically typed languages we have to make sure that the fields and methods we access match the declared types of the variables at compile time.

On December 10 2015 02:24 supereddie wrote:
Stongly typed languages (like Java) cannot implicitly convert an object to a more specific object. In this case, Person is a more specific version of Object. If the object is not of class Person but another class, you probaly get an InvalidCastException (or whatever it is in Java) - that is why the check on Class is there.

It is possible to implicitly convert a Person to an Object however

Object myObject = person;

Implicit conversion is not relevant here because at no point in the last line we tell the compiler or runtime what type we want to convert it into. There could be a Person type and an Apple type both with the name and idNum fields and both would fit the needs of the last line. We can't convert to anything if it's not clear what we should convert to. We can access fields that are only known to be there at runtime, but that doesn't require conversion.
If you have a good reason to disagree with the above, please tell me. Thank you.
Manit0u
Profile Blog Joined August 2004
Poland17875 Posts
December 09 2015 20:09 GMT
#13786
On December 10 2015 01:01 BByte wrote:
You can also sometimes trick Excel by changing the file extension to txt -- assuming it's currently csv. Alternatively "Paste Special" or similar functionality may work. Excel should also handle large integers correctly.

What are you using to read the file in PHP? Both fgetcsv and str_getcsv should return an array of strings whether you have quotes around numbers or not.


I'm using fgetcsv. And I'm totally dumb (guess it happens after 7.5hrs of coding session). The problem was not with PHP or Notepad++ but with Excel/OpenOffice which was rounding the values. I thought it was the other way around but I've discovered it not to be so by sheer happenstance - I dumped one of the arrays which should be ['arr' [ 'arr2' [ 'val1', 'val2']]] according to the Excel data but turned out to be [ 'arr' [ 'arr2' ['val1'], 'arr3' ['val2']]]. This got me thinking and I've noticed that 2 numbers ending in 41 and 42 respectively were displayed in Excel as 40.

Seriously, fuck that bullshit
Time is precious. Waste it wisely.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
December 09 2015 22:25 GMT
#13787
On December 10 2015 05:09 Manit0u wrote:
Show nested quote +
On December 10 2015 01:01 BByte wrote:
You can also sometimes trick Excel by changing the file extension to txt -- assuming it's currently csv. Alternatively "Paste Special" or similar functionality may work. Excel should also handle large integers correctly.

What are you using to read the file in PHP? Both fgetcsv and str_getcsv should return an array of strings whether you have quotes around numbers or not.


I'm using fgetcsv. And I'm totally dumb (guess it happens after 7.5hrs of coding session). The problem was not with PHP or Notepad++ but with Excel/OpenOffice which was rounding the values. I thought it was the other way around but I've discovered it not to be so by sheer happenstance - I dumped one of the arrays which should be ['arr' [ 'arr2' [ 'val1', 'val2']]] according to the Excel data but turned out to be [ 'arr' [ 'arr2' ['val1'], 'arr3' ['val2']]]. This got me thinking and I've noticed that 2 numbers ending in 41 and 42 respectively were displayed in Excel as 40.

Seriously, fuck that bullshit

Excel is a pain in the ass. We end up using a lot of excel at work for various reasons and it's always annoying. I especially hate it when it changes things numbers with a decimal place or two into dates. And forgets what the original value was, so no amount of reformatting your cells will bring it back.

Always blame excel first. The odds are with you.
If you have a good reason to disagree with the above, please tell me. Thank you.
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
Last Edited: 2015-12-10 04:58:30
December 10 2015 04:55 GMT
#13788
Had a pair programming interview with Square (squareup.com)

Did it in C++. Bad idea.

+ Show Spoiler +

/cygdrive/c/Users/Victor/Documents/GitHub/Interviews/problems/questions/src/states.cpp: In function ‘bool isValidScrambledTransition(std::string, std::set<std::basic_string<char> >, std::vector<std::vector<std::basic_string<char> > >, std::vector<std::basic_string<char> >)’:
/cygdrive/c/Users/Victor/Documents/GitHub/Interviews/problems/questions/src/states.cpp:66:107: error: no matching function for call to ‘find(std::vector<std::basic_string<char> >::iterator, std::vector<std::basic_string<char> >::iterator, std::string&)’
vector<string>::const_iterator current_state_iter = find(scrambled.begin(), scrambled.end(), start_state);
^
/cygdrive/c/Users/Victor/Documents/GitHub/Interviews/problems/questions/src/states.cpp:66:107: note: candidate is:
In file included from /usr/lib/gcc/i686-pc-cygwin/4.9.2/include/c++/bits/locale_facets.h:48:0,
from /usr/lib/gcc/i686-pc-cygwin/4.9.2/include/c++/bits/basic_ios.h:37,
from /usr/lib/gcc/i686-pc-cygwin/4.9.2/include/c++/ios:44,
from /usr/lib/gcc/i686-pc-cygwin/4.9.2/include/c++/ostream:38,
from /usr/lib/gcc/i686-pc-cygwin/4.9.2/include/c++/iostream:39,
from /cygdrive/c/Users/Victor/Documents/GitHub/Interviews/problems/questions/src/states.cpp:1:
/usr/lib/gcc/i686-pc-cygwin/4.9.2/include/c++/bits/streambuf_iterator.h:369:5: note: template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(std::istreambuf_iterator<_CharT>, std::istreambuf_iterator<_CharT>, const _CharT2&)
find(istreambuf_iterator<_CharT> __first,
^
/usr/lib/gcc/i686-pc-cygwin/4.9.2/include/c++/bits/streambuf_iterator.h:369:5: note: template argument deduction/substitution failed:
/cygdrive/c/Users/Victor/Documents/GitHub/Interviews/problems/questions/src/states.cpp:66:107: note: ‘__gnu_cxx::__normal_iterator<std::basic_string<char>*, std::vector<std::basic_string<char> > >’ is not derived from ‘std::istreambuf_iterator<_CharT>’
vector<string>::const_iterator current_state_iter = find(scrambled.begin(), scrambled.end(), start_state);
^
/cygdrive/c/Users/Victor/Documents/GitHub/Interviews/problems/questions/src/states.cpp:83:79: error: no matching function for call to ‘find(std::vector<std::basic_string<char> >::iterator, std::vector<std::basic_string<char> >::iterator, std::string&)’
if (find(potential_next_states.begin(), potential_next_states.end(), state) != potential_next_states.end()) {
^
/cygdrive/c/Users/Victor/Documents/GitHub/Interviews/problems/questions/src/states.cpp:83:79: note: candidate is:
In file included from /usr/lib/gcc/i686-pc-cygwin/4.9.2/include/c++/bits/locale_facets.h:48:0,
from /usr/lib/gcc/i686-pc-cygwin/4.9.2/include/c++/bits/basic_ios.h:37,
from /usr/lib/gcc/i686-pc-cygwin/4.9.2/include/c++/ios:44,
from /usr/lib/gcc/i686-pc-cygwin/4.9.2/include/c++/ostream:38,
from /usr/lib/gcc/i686-pc-cygwin/4.9.2/include/c++/iostream:39,
from /cygdrive/c/Users/Victor/Documents/GitHub/Interviews/problems/questions/src/states.cpp:1:
/usr/lib/gcc/i686-pc-cygwin/4.9.2/include/c++/bits/streambuf_iterator.h:369:5: note: template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(std::istreambuf_iterator<_CharT>, std::istreambuf_iterator<_CharT>, const _CharT2&)
find(istreambuf_iterator<_CharT> __first,
^
/usr/lib/gcc/i686-pc-cygwin/4.9.2/include/c++/bits/streambuf_iterator.h:369:5: note: template argument deduction/substitution failed:
/cygdrive/c/Users/Victor/Documents/GitHub/Interviews/problems/questions/src/states.cpp:83:79: note: ‘__gnu_cxx::__normal_iterator<std::basic_string<char>*, std::vector<std::basic_string<char> > >’ is not derived from ‘std::istreambuf_iterator<_CharT>’
if (find(potential_next_states.begin(), potential_next_states.end(), state) != potential_next_states.end()) {
^
CMakeFiles/states.dir/build.make:54: recipe for target 'CMakeFiles/states.dir/src/states.cpp.o' failed
make[2]: *** [CMakeFiles/states.dir/src/states.cpp.o] Error 1
CMakeFiles/Makefile2:165: recipe for target 'CMakeFiles/states.dir/all' failed
make[1]: *** [CMakeFiles/states.dir/all] Error 2
Makefile:86: recipe for target 'all' failed
make: *** [all] Error 2


couldn't compile code. that was the output. ran out of time.

the fix?

+ Show Spoiler +

#include <algorithm>


FUCK THAT

+ Show Spoiler +

I made it to the next round though.
There is no one like you in the universe.
Khalum
Profile Joined September 2010
Austria831 Posts
Last Edited: 2015-12-10 10:07:24
December 10 2015 08:42 GMT
#13789
Hm but the std::find you're using is defined in algorithm after all - why FUCK THAT?
Or are you complaining about #include in general?
Manit0u
Profile Blog Joined August 2004
Poland17875 Posts
December 10 2015 08:51 GMT
#13790
Can anyone reference some good resources for basic webapp pentesting?
Time is precious. Waste it wisely.
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
December 10 2015 15:54 GMT
#13791
Random curiosity question - if you have two Java Linked Lists is there a more efficient way to append them together, abusing the fact that they are both Linked Lists? For example, pointing the last element in the 0th list to the 0th element in the 1st list? Note: This is not what .addAll() does.
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
RoomOfMush
Profile Joined March 2015
1296 Posts
December 10 2015 16:10 GMT
#13792
On December 11 2015 00:54 WarSame wrote:
Random curiosity question - if you have two Java Linked Lists is there a more efficient way to append them together, abusing the fact that they are both Linked Lists? For example, pointing the last element in the 0th list to the 0th element in the 1st list? Note: This is not what .addAll() does.

There is not. But you shouldnt be using LinkedLists anyways. There is very little reason to use them over ArrayLists or ArrayDeques. And even if there is, you wouldnt be needing micro optimizations like this.
Cyx.
Profile Joined November 2010
Canada806 Posts
December 10 2015 16:12 GMT
#13793
On December 10 2015 17:42 Khalum wrote:
Hm but the std::find you're using is defined in algorithm after all - why FUCK THAT?
Or are you complaining about #include in general?

I was thinking he forgot to #include <algorithm> for a significant portion of the interview
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
Last Edited: 2015-12-10 20:11:52
December 10 2015 18:10 GMT
#13794
edit: got the help i needed!
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
December 10 2015 20:32 GMT
#13795
On December 11 2015 01:10 RoomOfMush wrote:
Show nested quote +
On December 11 2015 00:54 WarSame wrote:
Random curiosity question - if you have two Java Linked Lists is there a more efficient way to append them together, abusing the fact that they are both Linked Lists? For example, pointing the last element in the 0th list to the 0th element in the 1st list? Note: This is not what .addAll() does.

There is not. But you shouldnt be using LinkedLists anyways. There is very little reason to use them over ArrayLists or ArrayDeques. And even if there is, you wouldnt be needing micro optimizations like this.

You're right, I was just curious about it. Why is an ArrayList superior to a LinkedList, though?

Also, I'd like a bit of help optimizing some code. I'm trying to find the number of unique ways to make change for an int(i.e. 5 nickels and a penny is the same as a penny and 5 nickels, and only count for one way). My method of doing this is a recursive search. I want to use a HashSet for a memo table, but I'm making 4 new CoinCollection(has a number of pennies, nickels, dimes and quarters) each time, with the first taking the input CoinCollection and adding 1 penny, the second adding a nickel, the third a dime, the fourth a quarter. 4 new objects is a lot for a recursive function. However, I don't see how I can check if my current solution is in the HashSet without making these objects. It would save a lot of computation and stack space if I could avoid making them. Does anyone know how to get around making them? Is there something besides a HashSet I can use?

The source code is here. coinCollections is a global variable to avoid having to put it on the stack every call, but if you have a better way of dealing with that please let me know.

Can it be I stayed away too long? Did you miss these rhymes while I was gone?
tofucake
Profile Blog Joined October 2009
Hyrule19270 Posts
December 10 2015 22:14 GMT
#13796
I would suggest breaking it into smaller parts. Set an order for coins such that everything is set in stone: ie always QDNP or PNDQ or it doesn't even matter. With a set order you automatically see that 5 nickels and 1 penny is the same as 1 penny and 5 nickels and you can discard one result.
Liquipediaasante sana squash banana
Mindcrime
Profile Joined July 2004
United States6899 Posts
December 10 2015 23:31 GMT
#13797
Anyone know anything about .NET's SqlCommand.CommandTimeout property? According to the documentation, it is the amount of time that the program will wait before terminating an attempt to execute a command and then generate an error. However, it would seem that it sometimes stops a query but then doesn't generate any error at all.

There's an automated report that I'm responsible for that queries our database and then uses the results to build the contents of an email to send to a small group of people who need that data. The report runs at 7:30 in the morning and usually completes within about 1 minute. It's a pretty important report though, so it got the standard CommandTimeout = 10000 that our other important batches get. And today it didn't complete in 1 minute; instead, it finally sent out the email at 10:17 (read: 10000 seconds later), without ever throwing an exception, and the email's contents indicated that the query returned no results and that is not good because it definitely returned something when I ran it in SSMS. So what am I missing here?
That wasn't any act of God. That was an act of pure human fuckery.
hooktits
Profile Blog Joined February 2008
United States972 Posts
December 11 2015 01:42 GMT
#13798
ok guys i'm back with a question i hope this is not too vague, but long story short as possible ^_^
Ok so i'm making a site and it will require some admin type stuff but i don't wanna spend time programming a giagantic advanced admin system, its not needed. Althought i have never built an admin system i know how to if need be However again i am gunna be the only admin for a small site but must be its important to be a very secure site. So that being said i'm trying to avoid the whole separate admin login section and tons of admin pages (maybe a few)because i just don't need it too much. Alot of the stuff i could just go in to phpmyadmin but some i wanna have a basic way to define a special user being me and have my log in more secure.


So my thought process is use the regular login system but have some kind of conditional statement that determines that when i log on it will know its me and i want to encrypt my password stronger so i'm so lets say for the regular users there passwords are made using blowfish $2y$modifier of what ever something not to high so it doesn't take for ever to log in for them) then use a salt to create a password hash for them but when i log in it will recognize my user name and and then probably run same blowfish stuff but high modifier. there is a column to differentiate from regular user and admin and me being only admin.

So then using that plan to login in a slight more secure way (ill make a nice large password with lots of knicknacks and a higher modifer). So that would be how i login and then most of the stuff echoed out on the pages if it needed a some extra admin stuff i could have a condition that specifies that if this is the admin logged in etc then echo whatever on the page the normal stuff for users but with extra features" So does this plan sound bad or should i have separate pages for all my admin stuff?


So i'm sorry that was so vauge i didn't wanna make it too long with tons of unneeded code,i know how to code and i know you guys replying know how to way better then me but my question being would this be a secure way of making a login to admin system, Now keep in mind people would be able to enter my user name (they would know it) and potentials try to gain admin access but my pass will wayyy stronger and they won't know the information described in here?

and i guess other then that i feel pretty confident in my ability to protect against sql injection but again it would be quite important that no one gains access to this and i guess that would depend on how i code it and if i cleanse all data being placed into a data base as well as make sure there is coding that prevents a regular user from being on a page he shouldn't be, so if i did have 1 or 2 admin pages have conditions that check to see who the the user is and if they are not me then they get ushered away from the page the shouldn't be on.
I do that on all pages if a user has no need to be there the set conditions that user them away...


I feel get i'm gunna get shit for this post but i'm sorry i have taken the time to learn html css php javascript mysql etc but i'm a newb and i have started projects and never finished them but this one i HAVE to finish and i wanna get it right so if you see any red flags about what i stated above then let me know this sounds like a bad idea and why.. thanks again i love this thread and TL thank you seeya
Hooktits of Tits gaming @hooktits twit
Manit0u
Profile Blog Joined August 2004
Poland17875 Posts
Last Edited: 2015-12-11 02:29:07
December 11 2015 02:24 GMT
#13799
@hooktits:

First of all, making your admin password more encrypted than regular users won't help that much. Just using password_hash($password, PASSWORD_BCRYPT) should be sufficient in most cases (you can expand it to password_hash($password, PASSWORD_BCRYPT, [ 'cost' => 10 ]) if you think it'll help you much). You generally want all users using the same thing since admin will be saved along them. Where they differ is their permissions.

Website security isn't all about how secure your admin account is. It doesn't mean crap if you have the most secure hashing algorithm and some crazy 128-character length password if someone can go around it by tampering with other parts of your application (giving regular users admin access, breaking into your server and seeing the code etc.). There are pretty crazy things you can do with even pretty basic XSS attacks.

Second of all, unless you absolutely have to write this thing from scratch I'd suggest you don't reinvent the wheel and go with some reliable framework instead. This will give you access to more tools right off the bat and save you a lot of time. Frameworks such as Symfony or Laravel make developing PHP apps pretty enjoyable and you get all the basic security you want with them right off the bat (SQLI, CSRF, admin/user/anonymous user authentication etc. all built-in). On top of that they're built with modern approaches and best practices in mind.

The worst thing you could possibly do here is trying to do it yourself without much experience. You'll end up with a page that's in the 90's or early 2000's security-wise (SQL statements in the views and other bullshit like that). Also, don't ever use WordPress...

Also, try to tackle one thing at a time. Right now it seems like you have a very vague idea on how your project is going to work/look like. One day spent planning can save you a week of work. Focus on that first.
Time is precious. Waste it wisely.
Ropid
Profile Joined March 2009
Germany3557 Posts
Last Edited: 2015-12-11 02:55:42
December 11 2015 02:55 GMT
#13800
On December 11 2015 05:32 WarSame wrote:
You're right, I was just curious about it. Why is an ArrayList superior to a LinkedList, though? [...]


This feels like some dirty secret that's not mentioned when learning about data structures.

Here's a video of a presentation about linked lists vs. arrays from the guy that created C++:

+ Show Spoiler +
"My goal is to replace my soul with coffee and become immortal."
Prev 1 688 689 690 691 692 1032 Next
Please log in or register to reply.
Live Events Refresh
IPSL
02:00
Ro24 Group F
Art_Of_Turtle vs KameZerg
Radley vs George
Airneanach106
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
ProTech123
BRAT_OK 60
MindelVK 25
StarCraft: Brood War
Calm 3261
Rain 1251
Shuttle 423
Soulkey 108
firebathero 83
Zeus 67
Killer 31
Hm[arnc] 27
Barracks 25
soO 12
[ Show more ]
910 11
sorry 10
Dota 2
Gorgc5448
qojqva2673
Counter-Strike
pashabiceps2130
allub1364
byalli418
gobbtv112
Super Smash Bros
Mew2King46
Heroes of the Storm
Khaldor498
Other Games
FrodaN2749
Grubby2208
Liquid`RaSZi1943
Beastyqt719
syndereN222
zeus93
Railgan13
Organizations
Other Games
gamesdonequick6442
EGCTV952
[ Show 14 non-featured ]
StarCraft 2
• StrangeGG 24
• Reevou 16
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• Migwel
StarCraft: Brood War
• HerbMon 42
• Michael_bg 9
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Other Games
• imaqtpie744
• Shiphtur441
Upcoming Events
BSL
1h 18m
Artosis vs Dewalt
Ret vs Tech
SOOP
15h 18m
soO vs FanTaSy
WardiTV Weekly
17h 18m
Replay Cast
1d 4h
Monday Night Weeklies
1d 22h
PiGosaur Cup
2 days
The PondCast
2 days
GSL
3 days
Replay Cast
4 days
KCM Race Survival
4 days
[ Show More ]
RSL Revival
5 days
BSL
6 days
eOnzErG vs StRyKeR
Cross vs JDConan
RSL Revival
6 days
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.