What's your question?

Question Bump Latest Questions

Bellarmine901
  • 1
  • 1

Someone brought up a suggestion today. He said that swapping phones in Nigeria was a possibility and that it cost just very little. I doubted him but felt asking that question on this platform may be worth it.

Someone brought up a suggestion today. He said that swapping phones in Nigeria was a possibility and that it cost just very little.

I doubted him but felt asking that question on this platform may be worth it.

Read less
Adv
Jhero23
  • 1
  • 1

I recently wanted to execute a cron job to run an sql file in a shared hosting website. In my case, I wanted to reset by database every hour and everyday for a demo website. There are two methods to ...Read more

I recently wanted to execute a cron job to run an sql file in a shared hosting website. In my case, I wanted to reset by database every hour and everyday for a demo website. There are two methods to achieving this;

  • Using the cron job from the cpanel
  • Using an external service to run the cron job for you

METHOD 1

I learnt from this task that running the sql file directly from the cron job is not so efficient. In fact, in my own project, it didn’t work. Therefore, I changed my method. I wrote the script in a php file calling the sql file, while the cron job calls the php file, because it is more convenient that way. Though, if you just want to run a php script, it can be passed to the cron job in the cpanel and hopefully, it works for you.

In the cron job on the cpanel, there is a guide in order to use it properly. For example

/usr/local/bin/php -f /home/(username)/public_html/nameofthefile.php

<?php

$con = mysqli_connect('localhost', 'username', 'password');
if (!$con) {
    die('Could not connect: ' . mysqli_connect_error());
}

$sql = 'DROP DATABASE db_name';
if (mysqli_query($con, $sql)) {
    //echo "Database db_name was successfully dropped\n";
} else {
    echo 'Error dropping database: ' . mysqli_connect_error() . "\n";
}
$createsql = 'CREATE DATABASE db_name';
if (mysqli_query($con, $createsql)) {
    //echo "Database db_name created successfully\n";
} else {
    echo 'Error creating database: ' . mysqli_connect_error() . "\n";
}

$mysql_host = "localhost";
$mysql_database = "db_name";
$mysql_user = "username";
$mysql_password = "password";
# MySQL with PDO_MYSQL
$db = new PDO("mysql:host=$mysql_host;dbname=$mysql_database", $mysql_user, $mysql_password);

$query = file_get_contents("file.sql"); // calls the sql file here

$stmt = $db->prepare($query);

if ($stmt->execute()) {
    echo "Success";
} else {
    echo "Fail\n";
}

then you select the timing you need for this job to run for.

METHOD 2

In my case, this file above didn’t work on the server, but worked on the localhost which was really surprising. The PDO part of the code, didn’t work to be precise, so initially I thought my shared hosting service didn’t enable PDO for my php version which was 7.3 at that time, after confirmation that it was enabled, I then knew I had to find an alternative to the cron job issue. After much researching, I found google cloud platform (serverless computing — not free) so I couldn’t use it, I then found another online service- webcron that could do this. I registered and configured for what I needed. The only major thing you need to supply is the url.

Therefore, i just supplied https://domain-name.com/nameoffile.php. and BOOM, it worked as I expected.

Read less
Bellarmine901
  • 1
  • 1

Companies are doing virtual assignments now and human direct interface is limited, are people going to lose their jobs to robots because of COVID-19?

Companies are doing virtual assignments now and human direct interface is limited, are people going to lose their jobs to robots because of COVID-19?

Read less
Kenny
  • 1
  • 1

Understanding how you imagine your life in the future can help employers understand whether the trajectory of the role and company fits in with your personal development goals. To answer, provide general ideas about the skills you want to develop, ...Read more

Understanding how you imagine your life in the future can help employers understand whether the trajectory of the role and company fits in with your personal development goals. To answer, provide general ideas about the skills you want to develop, the types of roles you would like to be in and things you would like to have accomplished.

 

Read less
Adv
Tosin Olayinka
  • 1
  • 1

Relationships generally requires a lot of work, dedication. If you’re in a long distance relationship Congrats! You’ve got a free ticket to an emotional roller-coaster ride!Some days will be fine but there will be difficult days too. ...Read more

Relationships generally requires a lot of work, dedication. If you’re in a long distance relationship Congrats! You’ve got a free ticket to an emotional roller-coaster ride!

Some days will be fine but there will be difficult days too. Don’t panic as long as you both love each other you’ll scale through. Long distance relationship can be sustained if both parties are willing to put in the work.


There are few things that needs to be put into consideration if you’re willing to make it work;

1: Make trust the foundation of your relationship.

2: communication is key.

3: Make sure your goals align.

4: Avoid excess communication.

5: Stay honest with each other.

6: Be there” even when you can’t actually be there.

7: Focus on the positive aspects of long distance.

8: Feed your emotional intimacy by asking deeper questions.

9: Talk about your future together. 

10: Find ways to be a happy person even if you are not together. 

Relationships don’t make people happy. People make themselves happy. Happier people are more fun to be around. Find ways to make yourself happy and enjoy your life so that you have positive energy to contribute when you connect or are together.

Before accepting to be in a relationship with that person far away, put these things into consideration and be sure you’re ready to make efforts

A very funny recent video I saw stated: To love is to suffer, to avoid suffering, one must not love, but then one suffers from not loving. Therefore, to love is to suffer, not to love is to suffer. To suffer is to suffer. To be happy is to love, to be happy then is to suffer, but suffering makes one unhappy, to be unhappy one must love or love to suffer, or suffer from too much happiness

Read less