« first day (2311 days earlier)      last day (2634 days later) » 

12:00 AM
id imagine it'd be heaps faster to query 1 million rows that contain 2 columns, vs 1 that contains all the related data
but im kinda shit with sql tbh
but to back up my idea, that's what modern cms'es like WP and magento do so, obviously its a solid idea
 
@Hybridwebdev Ah so splitting it by columns not by rows? Haha that might make more sense but typically a relations table has 3 columns anyways and I think it would be slower to query through 2 tables with 2 columns instead of 1 table with 3 columns.
 
@Alesana see my above reference to cmses
but again, just run real world tests. Then you'
be 100% sure of the results
play around before you commit to a data structure
 
@Hybridwebdev Are you talking about wp_terms_relationships?
 
@Danack In my opinion the "correct" answer there should be Debian :D
 
@Alesana as an example yes
 
12:03 AM
Actually I'd like to learn more about some very small Linux distros built to be small explicitly for containers.
 
@Hybridwebdev That has 3 columns. I already have a relations table that is for more than just speed though
 
wp uses a lot of relational tables and its super efficient
 
@Hybridwebdev No it doesn't.
 
@Danack ehm....yes...it does lol
 
@LeviMorrison I'm learning about them.......having GLOB_BRACE be an undefined constant is too exciting for me.
 
12:04 AM
@Hybridwebdev It has 1 relations table if I'm correct.
 
@Danack lol, which OS did you hit that in?
 
alpine linux
 
@Alesana there's 1 for metadata, 1 for terms, 1 for users etc
it has a lot
 
@Hybridwebdev It has a total of eleven tables total by default, which is a trivial number of tables.
 
I'm looking right now
 
12:05 AM
If you want to see something that has a 'lot' of tables, look at Drupal.
 
There is none for users
 
@Alesana user_id correlates to a separate table
 
But you're talking crap anyway - splitting up the data into separate tables doesn't affect the total number of rows that need to be hit per query (for general queries) and just makes it far harder for the database to do it's job of running the query.
 
@Danack okay...cuz im sure big companies like youtube just use 1 gigantic table right
 
@LeviMorrison As a "let's learn docker" task, I'm trying to make a container to make it trivial for people to edit the docs.
 
12:07 AM
In user_meta it doesn't relate the user table to another table, it just directly names meta things per user and lists the user ID the meta is for.
 
@Hybridwebdev The first step they use is to have 1 logical table then split it up into sharding......and then the next step is:
10 mins ago, by Danack
@Alesana It really depends on what query you are running, as to whether it will be slow or not. I'd strongly suggest just designing the data storage correctly to begin with, waiting to see if it actually is a problem and then pumping any queries through either elasticSearch, Neo4j or other 'fast' search engines, depending on the exact cause of why it might be slow in SQL.
 
Anyways I will see how it runs with a tst like you say
 
@Alesana Okay, I guess I should have said relational columns. eg the user_id
@Danack you realize "Sharding" is just a fancy way of saying splitting tables right?
 
Yes, but one that's not stupid, like the way you are suggesting is stupid.
 
@Danack uhmmm....but it's the same thing
@dann
 
12:09 AM
@Danack Yes that is what I will do
@RonniSkansing You look oddly similar to Bill Wurtz....
@RonniSkansing Are you Bill Wurtz?
 
13 mins ago, by Hybrid web dev
@Danack yes. But in scenarios where scaling is required. I mean, splitting rows is no biggie, just use a left join
 
What a great question, Am I Bill Wurtz
 
@Danack .......and how do you think sharding works? Geez
 
No it's not. One way means that you can keep the queries simple. The other way means that you have to manually write joins, and then the database has to do a lot of to figure out how to optimise those queries.
 
That's definitely a Bill Wurtz type of response
 
12:11 AM
@Hybridwebdev I have hundreds of million of rows in my tables of work
 
i swear arguing with people in SO chat is like winning a gold medal in the special olympics....
 
and I would never split them into multiple tables
that makes no sense
 
/dat ignore button
 
@RonniSkansing okay, so....then google...yt....fb....all those huge corporations are doing it wrong?
lol
an SO dev that thinks he's smarter than the most talented people in the world employed by billion dollar companies
 
12:13 AM
You haven't provided any valid examples of what you're describing though @Hybridwebdev
 
@Alesana google sharding
 
@Alesana btw =) no I am not Bill
 
@RonniSkansing Aww but you look so much like him
 
I mean i really feel like SO chat is just full of noobs
 
Good timing @Ocramius github.com/zendframework/zend-stdlib/pull/59/files - why was just setting glob_brace to 0 acceptable?
It's value is 1024 in standard PHP.....setting it to 0 means "don't use glob_brace".
 
12:15 AM
@Alesana heh =) never heard the name before today..
@Hybridwebdev heh nice
 
@Danack can't remember, I'd ask DASPRiD
he wrote that
 
Oh, you have a self-implemented glob brace alternative now.
That effectively reverts the setting glob brace to 0.
 
anyways, rather than waste time arguing with the less gifted, I shall returning to coding godly code
adius noobs
adieu
 
@Hybridwebdev yea sure,, lol.. btw maybe you should check the difference in table splitting, sharding and partitioning
people who have worked at facebook and google are in this room
nvm ignored
 
@RonniSkansing
I mean that looks exactly like you
 
Wes
12:29 AM
ronni = theon greyjoy
 
hmm
except the ass chin
 
I don't see your chin in your photo lol
 
@Wes I heard that one before
heh moment
 
Wes
@RonniSkansing yeah. it was me telling you :P
you used to have a totally theon avatar
 
hah
yea
 
Wes
12:35 AM
theon was nice till he wasn't anymore
 
Wes
so he lost his dick :b
ahaha yeah
 
Yeah that one looks a lot like that guy ^^
 
@DaveRandom JFC these cryptic error messages. 'standard_init_linux.go:178: exec user process caused "no such file or directory"' - Is there seriously no way to get it to tell you what file it was executing?
 
Wes
12:39 AM
danack is robert baratheon. i mean literally, with the beard and everything :B
 
1:04 AM
Anyone here use Deployer to deploy their PHP apps?
I don't know if I'm just stupid or what but the identityFile() method for authentication asks for a public key location and the private key location. The public key is on the server and I have the private key locally. Why is this?
 
@LeviMorrison was it you that made the list of the number of people who had done significant commits to PHP in the recent past? Or can you remember who it was?
 
1:38 AM
@ibanore Would have only thought the private key would be needed, odd.
 
@Sean What I've done is leave the publich key as the default and give the path to my private key (local file) and it works
Very odd
Was confusing me
 
PhpSecLib only uses the private key, but SshExtension uses both the public and private key. Not sure I've seen that extension before.
 
Getting my script to insert 2.5 million rows via a json file passed via Ajax is not so easy to debug because it takes 1 minute just before I get an error back lol
First I had to change the max file upload limit in PHP, then the max post size limit, now the max execution time of a script. Lol
 
Idk. Maybe it doesn't want to generate the public key internally so it makes the user do it so it can be cached? SshExtension boils down to calling ssh2_auth_pubkey_file to authenticate. /cc @ibanore
 
@Danack Nope; define significant though
 
1:51 AM
Maybe someone smarter than me can answer why it needs both the public and private key.
 
@Sean There's smart and there's knowledgeable. I may or may not be smarter than you but I am not more knowledgeable than you in that matter.
 
In anycase, I'd recommend you use phpseclib, where you don't need to specify the public key. I don't actually think the deploy software checks for a correct/valid public key when you use that library.
 
Hi all!! - regarding db tables ...
thought about adding to my application something like "online users" or "online friends" - you can guess - to show who's online from your friends - but also for the app to preview to the general public the number of currently "online users".
Q: what would be best, to create an additional "online" (1/0) column directly to the "users" table - or to create a separate table "users_online" ? humhum? guesses?
- Or it's better to have a simple counter (that updates regularly every N minutes) for the general purpose - and than store the online friends under the "friends" relation table?... Any thoughts?
 
user6061856
2:09 AM
Idk, but as nice as it is to have that. The server load might be a little on the heavy side especially if you've got lot's of traffic.
 
@Terminal-JS I don't think it would be, it would just have to query a value in the users table.
 
hmmm (ya btw nvm about updating the statuses under the users_friends table since that would be duplicating values and just unnecessary garbage...)
 
I would test both and see if having a separate table with just key, user_id, and online_status is significantly faster, and if not just use the regular username table
 
@Alesana yep. nice tip. There's also a thing that actually "online users" might be actually inaccurate - since one can virtually be (session-wise) "online" but that does not means it has been "recently active".... argh...
like "Last seen:" you know...
 
You can make it so every action a user does (every link they load, etc..) updates their last_active column
 
2:16 AM
now that I think about it, probably a "last_seen" column right under the "users" table would be best at this stage (-of my brain cells wakeness)
 
and then instead of having online or offline, just query the last active column. If it less than x minutes then show them as online, if not offline
That would work too :)
 
@Alesana exactly... I think that's the super-best way to do it.
that way I can have a function that regularly loopups fot the timestamp (for the general public) and simultaneously I can fetch that info for "friends statuses" - when necessary
 
if ((current_date_and_time - last_seen) < 5_minutes) {echo "online"} else {echo "Last Online: " . last_seen}
Well that's psuedo-code but yeah
 
@Alesana yes, thanks for the brainstorming!
 
For the general public you could just do SELECT COUNT(user) FROM users WHERE last_seen > (cur_date_and_time - 5_minutes);
Or something like it...
Unless you wanted to show the user names then just take the count away :P
 
2:21 AM
yes. I'll automate this process every N minutes while doing other cleanup processes.
(than I'll also build a JS function that will animate every second the counter to keep that info "interesting" :D :D
 
You can't run the query every time someone wants to see how many/what users are online?
Whoo finally
 
@Alesana hummm..... that would be too expensive... I think? Thought I need to store that info somewhere
 
Showing rows 0 - 24 (2494522 total)
See how long it takes, I assume it wouldn't be so expensive.
Especially if you are only querying the count
 
I'll check. Thanks!!
 
I think it would be less expensive than most queries your app would do regularly (or an app similar to what I think your app would be)
 
2:29 AM
@Alesana I'll cache the result. on a 4h basis. Than comparing to the daily (4h fluctuation) medians I'll animate the "live" ('ahem!) JS counter :) I'd really like to keep this stuff at the minimum possible.... (I might be mistaken but...)
I'll see after testing :)
 
Haha okay. So your JS counter will be an estimate then? Haha
 
@Alesana I'll see... probably if the cost is low I'll go with the initial idea.
 
Well if you are wanting to update it every second I would have to agree that the query would be too expensive, example if you have 100 users it would execute 100 times a second lol
But if you have just a JS counter faking it people might see the code
You could make it really call (via ajax) a PHP page but the PHP page just remembers what the last number it gave was lol
 
@Alesana for the friends list yes...that should update regularily - But for the total online users... probably it's enough to update the counter when a user accesses the login/welcome page (that's where the counter will be placed)
 
Makes sense ^^
 
2:36 AM
cause the login page is shown only for new users and when someone was logged-out which is not that often
 
Well that's a relief. Querying to get 10,000 results from a table of 2.5 million rows only takes 1.5 seconds on localhost.
Well, querying 10,000 ids from a relations table that has 2.5million rows, then querying another table for those 10,000 rows, so even more.
 
@Alesana thanks for the insight
 
No problem
Can I ask what project you're working on? Sounds interesting
 
:( I'm afraid I cannot share that currently with anyone
 
Ah not a problem
I understand :)
 
2:42 AM
@Alesana thanks again :)
 
:D :D
 
Aha
 
user6061856
3:13 AM
XD
 
user6061856
perfect weather system
 
3:27 AM
Everyone going into hiding out here, like the holocaust.
In Cal.
 
That's weird
 
3:43 AM
Morning
 
Morning Linus
 
3:59 AM
Ugh my code is so ugly right now, I am nesting 5 conditionals in each other to verify a string meets 5 standards, but I can't just put them all together because if one of them is not true I want to return a message stating which conditional was not true
Well, I guess I could just have one after another instead of nesting them because it returns anyways. Hmm....
 
SAY WHAT
 
Lol what?
 
Nesting 5 conditionals.
 
Actually just 4
 
Are you building a comment system.
 
4:04 AM
No
This is my conditional lol pastebin.com/QWP3aV03
But I realize since it returns anyway I can just put one after the other, I don't think it's worth it to change it though
 
@SwiftOnSecurity Can't believe PHP is doing this before a large number of other things, but: bravo. Good crypto *should* be everywhere!
evil laughter
 
What are you building?
 
4:23 AM
It's pretty complex aha but right now an admin panel for a project
 
SOLID PRINCIPLES
separate business logic
Uncle bob clean code.
 
4:38 AM
What principle of SOLID does that not meet?
 
Use of conditionals.
Or to many.
Watch his clean code videos.
 
would someone be able to help me, i have a while loop to echo every row in my sql with a button, but dont know how to kind of assign that row to the button that was clicked
    while($row = $result->fetch_assoc())
	{ ?>
		<div class="post">
			<div class="post-header">
			<h3><?php echo $row["username"]; ?></h3>
			</div>
			<a href="profile.php"><img src="graphics/buttons/profile.png" class="post-image"></a>
			<textarea class="post-message" readonly="readonly"><?php echo $row["post"] . "&#13;" . $row["date"]; ?></textarea>

			<?php if ($moderator == 1){ ?>
			<a href="muteUser.php"><img src="graphics/buttons/mute.png" class="post-buttons"></a>
			<a href="deletePost.php"><img src="graphics/buttons/delete.png" class="post-buttons"></a>
 
@rachel what do you want that button to do?
 
theres 4 but to start, the delete button should delete that row from the sql table
 
i see it
 
4:41 AM
so how would i assign that button the value of say "post_id" so i know which post to delete
if u get what i mean
 
SOLID has 5 principles. I have to study them more but I didn't think clean code was one of them
What do you mean @RachelDockter?
You will do it via GET or POST?
 
wait a second
why didnt i think of that
 
<a href="deletePost.php?id=<?php echo $row['id']; "><img src="graphics/buttons/delete.png" class="post-buttons"></a>
 
I would do <a href="#" onclick="deletePost("<?php echo $rowid; ?>")>
 
its almost 5am forgive me
 
4:45 AM
Or Sal's version if ou are okay with doing it as a GET value
 
no wait i could make each post a form, with each button being a submit input
 
On any delete you would have to confirm first.
 
That works too @RachelDockter
 
yes that's perfectly fine.
 
sometimes its the simplist thing u overlook
or its probably just me
 
4:46 AM
Sometimes it happens to me too :P
 
or you can do it with ajax
 
I would do it via JS though that way you can, like Sal said, confirm it. But, if it's not necessary for your project that's fine.
 
i think that would confuse me more
 
I have 100% of my admin panel in Ajax, I made the navigation work by loading the inner DIV with Ajax
 
You use jquery or plain JavaScript
@RachelDockter, on delete.php you have to validate the id that you are passing along.
 
4:49 AM
What do you mean @SalOrozco?
 
You can't assume that the id exist.
 
it does exist
 
You know that and I know that.
something like this hang on.
 
Ah @SalOrozco has a point though, it could have been deleted by another page before that page was reloaded
Or something else could happen along the way
 
like 2 moderators could delete it at the exame same time
 
4:50 AM
Right
It wouldn't break your code if not but it just wouldn't delete anything.
 
well thats a 1 in a million lol
but ok ill check it anyway
 
Lol you never know
I just check the affected rows after the query to make sure it is > 0, if not say "Could not find ID"
Did you switch over to PDO yet?
 
no im doing it all through mysqli
but its safe from injections at least
 
if (isset($_GET['id']) && filter_var($_GET['id'], FILTER_VALIDATE_INT, array('min_range' => 1)))
 
Why is that necessary @SalOrozco?
 
4:53 AM
anyone can pass anything right
a string
 
@RachelDockter. If you start a new project you should start it with PDO
 
true or false
what that check is that
 
Yeah but if it's not an int than nothing bad will happen
 
$_GET['id] has to be set
and it checks if it's a integer and hs to be greater than 1
If get is not an interger
you send the user to a 404 page
 
Hmm, I also have my code just try to directly delete something by $_POST['id'] without checking but I can't see any harm in it because I bind it
 
4:55 AM
Even with post you still have to validate.
Then you first would check if that id exist in the database.
 
Right but I don't understand what the harm is in not validating
 
then if any rows returned you delete.
If no id in the database send the user to a 404 page.
 
I just have...
well note I use Ajax but it's the same concept
 
With ajax you have to validate too.
 
Oops hold on
 
4:59 AM
You check post request like this. //if the form was submitted
if($_SERVER['REQUEST_METHOD'] === 'POST')
 

« first day (2311 days earlier)      last day (2634 days later) »