dimgray

Lose your life.

Before, I went to look for Life.
In gods, in fables, in dreams.
Money, pleasures, vanities.
Then I said, “It’s all a mirage.”.
Later, I found JESUS CHRIST.
The Way, The Truth, The Life.
Wholesome, goodness, eternal.
Then HE said, “Lose your life for ME.”.

Shibanoshinyacho, Nara

A picturesque walk down Shibanoshinyacho, Nara.

Bare Reality

A hole in the soul,
only a GOD can fill.
A heart found wanting,
only a GOD can feel.
A mind that grows dull,
only a GOD can thrill.
A body old and cold,
only a GOD can heal.

This life a transit.

In between here and there a 5-inch screen of pixels kept company. Surround sound courtesy of Indian tunes and children’s squeals. Footsteps headed to their buses then to their destinations. Age halfway caught up on me, trained me to sit still, to stare blankly into space. Within this conditioned cold air, my brain pulled a fuzzy yellowed scene of childhood before i came to a pair of orange-laced sneakers on cream dust-speckled glossy marble while thinking about what to eat and how to kill time with longer eating. Must allow ample time too for offloading what i ate earlier in the day or yesterday? Everything must be timed so i not miss the bus going to where i must be. Behind, two men conversed in a familiar language i cannot decipher. Are we there yet? No we barely moved. It’s still hours more. Speakers announced names of latecomers who may be stuck somewhere or simply have given up. I do not know. I type this to fill up time. People with luggages and vacant expressions. Where is the whom I’m waiting for? Hope all is well, hope is all we’ve got before we arrive at the place we’re destined.

Efficient SQLite Pagination

LIMIT and OFFSET come first to mind when doing pagination, but these will incur performance regression. This is how I paginate efficiently in PHP:

<?php
# Since the number of posts per page is fixed, we define a constant.
define('POSTS_PER_PAGE', 10);

# Instantiate a database connection. Here I'm using SQLite.
$db = new SQLite3('/PATH/TO/my_database.sqlite');

# We usually GET page number via the query string.
# https://example.com/?page_number=123
$page_number = filter_input(INPUT_GET, 'page_number', FILTER_VALIDATE_INT) ;

# Blogs are usually sorted with the newest post coming first.
# So we grab the row id of latest post.
# In my blog, I have no wasted row, so I simply sort by row id. 😁
# *If you have complicated filtering, use ROW_NUMBER() to re-order your row ids.
$last_row_id_sql = 'SELECT id FROM my_posts_table ORDER BY id DESC LIMIT 1';
$last_row_id = $db->querySingle($last_row_id_sql);

# Advancing to next pages would alter the row id of last-est post of the page.
$last_row_id = $last_row_id - (POSTS_PER_PAGE * ($page_number - 1));

# Finally, we can fetch the 10 posts per paginated page.
$posts_sql = 'SELECT * FROM my_posts_table WHERE id <= :id ORDER BY id DESC LIMIT ' . POSTS_PER_PAGE;        
$statement = $db->prepare($posts_sql);
$statement->bindValue(':id', $last_row_id, SQLITE3_INTEGER);
$posts = $statement->execute();

# Use the result in your output template, like so. ?>
<?php while ($post = $posts->fetchArray(SQLITE3_ASSOC)) : ?>
    <article><?= $post['content']; ?></article>
<?php endwhile; ?>
<?php
# BONUS: This will check if the current page has no post.
if (false != $posts->fetchArray()) {
    $posts->reset();
    // This page has post(s). Do something ...
} else {
    // This page has NO post. Do something else ...
}

# Close the database connection.
$db->close();

This has been a simplified tutorial. I hope you benefited from it. Mucho gracias!


*SQLite Window Function: ROW_NUMBER()

On Sexuality

Are you having dirty thoughts? Yes, I see your hand, and yours, and you you you. So most likely you’ve been exposed to some pornographic materials and are most likely addicted to it. Now don’t look at me, I’m none of these things 🤐. Here’s a deal breaker. Jesus once said, “You have heard that it was said, ‘Do not commit adultery.’ But I tell you that anyone who looks at a woman to lust after her has already committed adultery with her in his heart.” So today, in this room, we have 5 adulterers! Those of you who are still a virgin, it will feel like an epic injustice.

Above a door to a house along Rowell Road,a pink neon sign proclaims "THERE IS A WOMAN IN HERE BUT SHE IS NOT FOR $EX"

Jesus has thrust upon you a standard against which you can never measure up. The kind of standard that’s akin to telling an alcoholic he must not drink another can of beer. This same moral standard extends to all types of sexuality including homosexuality, bestiality, incest and rape1, which of course are all2 fully banned from the Kingdom of God. Here’s the thing, natural tendecies are no justification for behaviors. You can’t just feel sexual one day and start molesting children and raping women, even though it may absolutely feel au naturel to you. GOD dispenses laws by which we are judged.

To this end, we arrived at the very crux of Christianity, also known as the only way to be a follower of Jesus Christ: to deny oneself, to take up one’s cross and to follow Him. Jesus did not hang on the cross so we can indulge in sexual sins. Jesus died so we can be granted the Holy Spirit of God to enable us to live the life that GOD wants us to live. Every moment of our life, we will either fight against GOD or yield to HIM, our flesh warring against God-ly intent.

May the grace of our LORD JESUS CHRIST be with us all, for truly there is no other way.

  1. Deuteronomy 22:25-29; Exodus 22:16-17 ↩︎

  2. Leviticus 20:10-21 ↩︎