Notings of Attention™
Acmlmboard 2 Released
Github/GIT | @acmlmboard
Chatting Places
Discord

Affiliates
Super Mario Bros. X | Kuribo64
Views: 8,987,822
Main | FAQ | IRC chat | Memberlist | Active users | Latest posts | Stats | Ranks | Online users | Search
04-20-24 02:06 PM
Guest: Register | Login

Main - Posts by Arisotura

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94

Arisotura
Posted on 03-05-15 12:05 AM, in profile.php user age calculation Link | ID: 82740
Developer
pancakes
Level: 83


Posts: 702/1868
EXP: 5409229
Next: 22992

Since: 01-05-12
From: France

Last post: 677 days
Last view: 216 days
Turns out that the method used by AB2.5 yields wrong results (one year off) if the user is old enough.

'Old enough' is typically 100 years or more so it doesn't really matter, though.


I came up with a different method for calculating the member's age. It works fine for all ages, and as a bonus, it doesn't have the requirement of the code that is implemented currently.

if($user['birth'])
{
$months = array(1 => 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');

$bd = explode('-',$user['birth']);
$birthday = $months[(int)$bd[0]].' '.(int)$bd[1];

$unit = ($bd[1]>=10 && $bd[1]<=13) ? 4 : $bd[1]%10;
switch ($unit)
{
case 1: $birthday .= 'st'; break;
case 2: $birthday .= 'nd'; break;
case 3: $birthday .= 'rd'; break;
default: $birthday .= 'th'; break;
}

if ($bd[2])
{
$birthday .= ', '.$bd[2];

$datenow = explode('-',date("m-d-Y"));
$daynow = $datenow[0]*31 + $datenow[1];

$daybd = (int)$bd[0]*31 + (int)$bd[1];

$age = $datenow[2] - (int)$bd[2];
if ($daybd > $daynow) $age--;

if ($age < 0)
$age = '(born in '.(-$age).' year'.($age==-1?'':'s').')';
else
$age = '('.$age.' year'.($age==1?'':'s').' old)';
}
else
$age = '';
}
else
{
$birthday='&nbsp;';
$age='';
}


This assumes that the user birthday is stored as 'MM-DD-YYYY' or 'MM-DD' when the year is omitted.

____________________
Kuribo64 - melonDS

want some revolution in your coffee?

Arisotura
Posted on 03-05-15 12:23 AM, in profile.php user age calculation Link | ID: 82742
Developer
pancakes
Level: 83


Posts: 703/1868
EXP: 5409229
Next: 22992

Since: 01-05-12
From: France

Last post: 677 days
Last view: 216 days
In my Acmlmboard branch, 'no birthday entered' is represented by an empty string, rather than 0 or -1.

____________________
Kuribo64 - melonDS

want some revolution in your coffee?

Arisotura
Posted on 03-07-15 09:59 PM, in I decided I will commit suicide Link | ID: 82829
Developer
pancakes
Level: 83


Posts: 706/1868
EXP: 5409229
Next: 22992

Since: 01-05-12
From: France

Last post: 677 days
Last view: 216 days
sigh



oh, it says I have permission to close this. Should I? At this point it's kinda like talking to a brick.

____________________
Kuribo64 - melonDS

want some revolution in your coffee?

Arisotura
Posted on 03-07-15 10:01 PM, in My Niece is MTF Transsexual Link | ID: 82830
Developer
pancakes
Level: 83


Posts: 707/1868
EXP: 5409229
Next: 22992

Since: 01-05-12
From: France

Last post: 677 days
Last view: 216 days
I would say that quitting your job when you have debts isn't the wisest idea, personally. I hope she finds a better job before falling into a debt spiral.

____________________
Kuribo64 - melonDS

want some revolution in your coffee?

Arisotura
Posted on 03-08-15 01:34 AM, in I decided I will commit suicide Link | ID: 82837
Developer
pancakes
Level: 83


Posts: 708/1868
EXP: 5409229
Next: 22992

Since: 01-05-12
From: France

Last post: 677 days
Last view: 216 days
Actually, her parents are biphobic, or so she said.

____________________
Kuribo64 - melonDS

want some revolution in your coffee?

Arisotura
Posted on 03-08-15 01:08 PM, in Answers... Link | ID: 82842
Developer
pancakes
Level: 83


Posts: 709/1868
EXP: 5409229
Next: 22992

Since: 01-05-12
From: France

Last post: 677 days
Last view: 216 days
If you need to know, PM a staff member.

____________________
Kuribo64 - melonDS

want some revolution in your coffee?

Arisotura
Posted on 03-12-15 10:54 PM, in Pagination optimizations Link | ID: 82914
Developer
pancakes
Level: 83


Posts: 713/1868
EXP: 5409229
Next: 22992

Since: 01-05-12
From: France

Last post: 677 days
Last view: 216 days
Pagination in Acmlmboard is done with the typical 'LIMIT X,Y' statement. There's an issue with that and long threads, though.

Let's say the user requests page 200 of a thread. His posts per page setting is 20. Your query will look like this:

SELECT (tons of shit) FROM posts p LEFT JOIN (several other tables) WHERE t.id=1337 LIMIT 4000,20

Which basically means that MySQL will fetch 4020 rows and discard most of them.


I coded a simple solution to reduce that overhead.
function postids($table, $where)
{
global $sql, $loguser, $page;

$ids = $sql->query("SELECT id FROM $table WHERE $where LIMIT ".(($page-1)*$loguser['ppp']).",".$loguser['ppp']);
$ret = '';
while ($id = $sql->fetch($ids))
$ret .= ($ret?',':'').$id['id'];

return $ret ?: 'NULL';
}


This retrieves the IDs of the posts that are going to be visible. It still has the aforementioned problem, but MySQL will read from the posts table's primary index (as opposed to reading from multiple tables), so it's much less severe.

Once you got the result of that, you feed it to the query that fetches all the remaining data.

SELECT (tons of shit) FROM posts p LEFT JOIN (several other tables) WHERE p.id IN ($result)



Another solution would consist into giving posts per-thread incrementing numbers, and base pagination on that. But this has its number of problems, especially if you find yourself wanting to merge/split threads or delete a spammer's posts. And it only works for displaying a regular thread.

____________________
Kuribo64 - melonDS

want some revolution in your coffee?

Arisotura
Posted on 03-13-15 09:29 AM, in your dreams Link | ID: 82925
Developer
pancakes
Level: 83


Posts: 714/1868
EXP: 5409229
Next: 22992

Since: 01-05-12
From: France

Last post: 677 days
Last view: 216 days
:3



Had that dream a while ago about me going in vacation somewhere with my parents for Summer. There was a conflict because my sister wasn't there, and we thought she wasn't coming with us (that's what actually happened last Summer). But at the time of leaving home, she came back home and she was willing to come with us.

Then there was that pier platform thing I was on, that was covered in sand, like some weird artificial beach. There was a radio station talking about how hot climate was and supposedly it was caused by global warming, but actually it was cold. So much even that it snowed a little. Didn't seem that off to me despite happening in July. Wee dream logic.

Then we were in our backyard, and for some reason it was flooded. We were bathing as if it was the sea.

____________________
Kuribo64 - melonDS

want some revolution in your coffee?

Arisotura
Posted on 03-13-15 09:32 AM, in Sprites and logout Link | ID: 82926
Developer
pancakes
Level: 83


Posts: 715/1868
EXP: 5409229
Next: 22992

Since: 01-05-12
From: France

Last post: 677 days
Last view: 216 days
I logged out, and I got a sprite on the redirect page following it. Trying to capture it yielded a 'Not logged in.' message.

____________________
Kuribo64 - melonDS

want some revolution in your coffee?

Arisotura
Posted on 03-13-15 11:09 PM, in Sprites and logout (rev. 2 of 03-13-15 11:33 PM by Arisotura) Link | ID: 82929
Developer
pancakes
Level: 83


Posts: 716/1868
EXP: 5409229
Next: 22992

Since: 01-05-12
From: France

Last post: 677 days
Last view: 216 days
Instant redirects wouldn't have this issue at all ;)


Other than that, I suspect that sprites are added to the page somewhere in pageheader(), before the current page has the time to signal that it's a redirect page.

You'd need to add a flag to pageheader() or somewhere else before that.

____________________
Kuribo64 - melonDS

want some revolution in your coffee?

Arisotura
Posted on 03-15-15 11:24 PM, in Enhancing all the form code (and instant redirects) Link | ID: 82976
Developer
pancakes
Level: 83


Posts: 719/1868
EXP: 5409229
Next: 22992

Since: 01-05-12
From: France

Last post: 677 days
Last view: 216 days
If those places use instant redirects no matter what, you might as well scrap the option entirely, for the sake of consistency.

____________________
Kuribo64 - melonDS

want some revolution in your coffee?
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94


Main - Posts by Arisotura


Acmlmboard v2.5.5 (10/04/2020)
© 2005-2024 Acmlm, Emuz, et al.

Page rendered in 0.086 seconds. (873KB of memory used)
MySQL - queries: 129, rows: 482/514, time: 0.067 seconds.