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
Tosin Olayinka
  • 1
  • 1

Have you ever finished eating a meal but still crave for junk like snacks or sweets? You’re not alone. Many people often face food cravings, even on a daily basis.Believe it or not, food manufacturers often create foods for the ...Read more

Have you ever finished eating a meal but still crave for junk like snacks or sweets? You’re not alone. Many people often face food cravings, even on a daily basis.

Believe it or not, food manufacturers often create foods for the purpose of triggering this cycle of addiction in consumers. They aim for the “happy point” in a product. This is the moment when the eater feels the ultimate pleasure, with savory, sweet and fatty flavors neither too much nor too little. These combinations are particularly difficult to resist, and your brain reacts similarly to cocaine and other addictive substances.

Did you know that your weight loss journey was broken because you can’t stop junk food? You’re not alone. One of the biggest traps for a healthy diet and weight loss is continuous consumption of unhealthy foods. Understanding how to stop eating junk food is one of the best ways to do it. Not only does it save you weight loss efforts, it is also recommended for your overall health.

What are junks food?

They are high in calories and low in nutrients. usually high in fat, sugar and salt. Depending on the way other foods are prepared, other foods are considered junk food, but other foods are not junk food. For example, some people think that pizza is junk food because of the high fat and calorie content of pizza. However, others believe that pizza can be a good source of grains, dairy products, vegetables, and meat

How do you stop eating junk foods?

1: Plan meal ahead

There is nothing better than planning meals and snacks in advance. Reduced chances of eating the rest of the pizza, ordering french fries, or eating sweets that others bring to the office.

2: Break the habit

Don’t try to ignore your cravings, be curious and try to recognize how you feel when craving or eating a particular food. Understanding what happens when you eat junk food makes you less interested in the habit. We turn to food in times of stress which causes our brains to produce more of the feel-good neurotransmitter, dopamine.

3: When you have a craving for junk food, chew sugar-free peppermint gum. You can get rid of cravings by chewing peppermint gum.

4: Stop buying junk food. When you are trying to avoid junk food, avoiding being close to it. If you have a lot of junk food on hand, you are more likely to consume it. Stop buying junk food and keep it away from your house, car, and office.

5: Drink a lot of water. Water can help you feel full and help balance your blood sugar. Staying hydrated with water will also make you less likely to buy a can of soda or some other unhealthy sugary drink.

Eating good meal and well balanced diet will not only make you healthy but also make your brain perform better, remember you’re what you want

Read less