Author: David

  • You deserve to be there at the top.

    I’m glad to present about “deserving to be there at the top” at the first WordCamp in Africa in 2023. This is a wonderful opportunity to connect and share my experience with the community. #WordCampEbbs happening now at the Uganda Wildlife Education Center. (UWEC) #WordPress

    More updates are coming!

  • When not to use a forEach loop in JavaScript

    A forEach loop is one of the most optimized JavaScript Higher-Order functions that make it one of the preferred functional programming languages.

    What is a Higher-Order function?

    It is a function which takes in another function (also called a callback) as a parameter or returns a function.

    What is a forEach in JavaScript?

    It a function used to iterate or loop over array elements. It accepts a callback back function which it calls for every element in the array in ascending order and an optional value to be used in the place of the this keyword while calling/invoking the callback. The forEach Higher-Order function returns undefined value.

    What is the Syntax?

    arr.forEach(callback(currentValue [, index [, array]])[, thisArg]);
    arr represents the array to be looped. Example of array below.
    let names = ['David','Harriet','Ronald','Laurence']; 

    or – the old way.

    let names = new Array('David','Harriet','Ronald','Laurence'); 

    callback – The function to be called on each element in the array. The callback can be a named function or anonymous function. The callback itself accepts 3 parameters of which 2 are optional. In fact, I personally use them and I think most programmers rarely use them too, speaking from experience of the code, I looked at from other developers.

    The 3 parameters of the callback are the currentValue, Index, and the array being looped.

    Use case 1: Using a named callback

    const CITIES = ['Kampala', 'Lagos', 'Nairobi','Cairo', 'Kigali' ];
    printCities = CITY => { console.log( CITY ); }
    CITIES.forEach( printCities );

    Use case 2: Using anonymous callback

    const COUNTRIES = ['Uganda','Kenya','Tanzania','Nigeria'];
    COUNTRIES.forEach( country => { console.log( country ) } );

    WHEN NOT TO USE THE forEach FUNCTION?

    How did I discover this? I was training a student and we were doing a practical project. We were mimicking a Single Page Application using vanilla JS. We had a JS object with one of the keys being users. The users key was holding an array of objects. Each user object has a name, email, and password for the user. Something like below.

    ...
    users: [
        {name: "David",email:"student1@school.ac",password:"password"},
        {name: "Ronald", email:"student2@school.ac", password:"password"}
    ];

    And we were picking user-provided username and password. Looping over the users’ array and comparing the user-provided details with the ones in the object. If we find the match we produce a notification that the user is found or not found if we don’t find a match.

    What happened is that whenever we found the match the alert notification telling us that we have found a match, appeared and various notifications, did too. The other were notifications were as many as the elements in the array which don’t match our search.

    We rushed in trying to use a break, return and continue statements but not offered the solution.

    This is when we found out that the forEach doesn’t support those statements. You can break out of the forEach loop. At leaste not as simple as using the break and return statements.

    Try to test it using the code below.

    students: [
        {name: "David",email:"student1@school.ac",password:"password"},
        {name: "Ronald", email:"student2@school.ac", password:"password"},
        {name: "Calvin", email:"student3@school.ac", password:"password"},
        {name: "Rachel", email:"student4@school.ac", password:"password"}
    ];
    //Looping the student to find a given match
    users.forEach( student => {
        if( student.name == 'David' && student.password == 'password') {
            alert( 'Student enrolled' );
        } else {
            alert( 'Student not found' );
        }
    });

    The code above and below this sentence will give you similar outputs, that is to say, four alerts, i.e. one, of Student found and three, of Student not found.

    students: [
        {name: "David",email:"student1@school.ac",password:"password"},
        {name: "Ronald", email:"student2@school.ac", password:"password"},
        {name: "Calvin", email:"student3@school.ac", password:"password"},
        {name: "Rachel", email:"student4@school.ac", password:"password"}
    ];
    //Looping the student to find a given match
    users.forEach( student => {
        if( student.name == 'David' && student.password == 'password') {
            alert( 'Student enrolled' );
            break;
            //return false;
        } else {
            alert( 'Student not found' );
        }
    });

    How can you achieve the result we wanted?

    At the moment I thought of two scenarios of which we practically tested one.

    a. Introduce a variable such as found and set it to true or false accordingly.

    Pros

    It solves the problem of producing many alerts at the user interface.

    Cons

    1. But it poses a con. What if the elements were a couple of hundreds or thousands or millions why waste memory looping all of them just to find a single match?
    2. More lines of code. Since you have to introduce a variable, you also have to check it and make a decision.

    Sample code below.

    let isFound = false
    students: [
        {name: "David",email:"student1@school.ac",password:"password"},
        {name: "Ronald", email:"student2@school.ac", password:"password"},
        {name: "Calvin", email:"student3@school.ac", password:"password"},
        {name: "Rachel", email:"student4@school.ac", password:"password"}
    ];
    //Looping the student to find a given match
    users.forEach( student => {
        if( student.name == 'David' && student.password == 'password') {
            isFound = true
        }
    });
    
    if(isFound) {
        console.log( 'Student enrolled' );
    } else {
        console.log( 'Student not found' );
    }

    2. Use the for ( element of elements ) loop.

    This solved our problem for our use case. I don’t see any cons with at the moment.

    students: [
        {name: "David",email:"student1@school.ac",password:"password"},
        {name: "Ronald", email:"student2@school.ac", password:"password"},
        {name: "Calvin", email:"student3@school.ac", password:"password"},
        {name: "Rachel", email:"student4@school.ac", password:"password"}
    ];
    //Looping the student to find a given match
    for( student of students ) {
        if( student.name == 'David' && student.password == 'password') {
            alert( 'Student enrolled' );
        } else {
            alert( 'Student not found' );
        }
    }
  • You are not about to die poor.

    You are not about to die poor.

    In recent years, the biggest number of people I have met are characterized by the following;-

    1. Lazy
    2. Not ready
    3. Entitled
    4. Ignorant
    5. Dishonest
    6. Inconsistent

    It sounds unfortunate, that most probably you will meet people of similar characteristics or more if you’ve not met them yet.

    Disclaimer: What am about to say is not to mean, I’m angel myself or always accurate and successful. Sometimes but not most, I have under-delivered, to the extent of feeling unworthy.

    Anyway, here is the scenario I want to share.

    Him: You see, If you do this for me, I will market you. This is gonna work, it will be good for your portfolio.

    Me: Okay, amazing.

    1. How much budget have you prepared to spend on marketing me?

    2. In numbers, how many people off the head, do you know that are looking for someone like me?

    3. How many people have you done something like this with and succeeded? Can I meet or talk to one of them?

    4. Since you will market me, what do you think my goals and dreams are?
    My dear creative.

  • Thoughts on 13-06-2019

    Thoughts on 13-06-2019

    I promised to share my thoughts in any possible way. In fact, am happy to be honoring you, my readers, that today by sharing something that could be life changing to some. Please, I request you to converse through the open comment box below.

    A NO is a NO in whatever form and at the time it comes. Be inspired to Seek and Ask.


    Sometimes things are not working out because we are not shifting our mind and physical station from our usual environment.


    Recognize, observe and celebrate small achievements, so that your mind can develop the habit of moving to the next step towards the finish line.


    Trying and failing is better than failing to try.


    If you think money gives you drive, find what you like doing when you have the money.


    The larger the population you serve, the higher the chances of finding financial stability.


    We always cheat when promise to do something and we otherwise.

  • A beautiful thought for 29-05-2019

    A beautiful thought for 29-05-2019

    Hey beloved,

    Once in a while, I develop thoughts in my head, and instead of keeping them to myself I’ve decided to share them. Who knows who it will help? By the way, at the bottom of the post, is a comment box where you too can participate/contribute.

    On Financial Empowerment

    If a friend can’t afford to pay double for what you sell. They should bring two of their good friends to not to see, not to talk but to buy and pay instantly.

    On personal positive change

    The only person who doesn’t want change is the poor person. Because they’re weak, self-centered and choice-less. You may apply the filter.

    On a Happy life

    It’s not really about the people who downplay us. It’s not about people who say if you could afford a trip, or a car, or a house, or a pair of shoes or whatever material for them, you would be given a chance.

    It’s about those beautiful/handsome people who would not be afraid to be with us on our way up. If you get somewhere, remember them – please.

    On Trust

    Trust is gained by practicing and exploding Honesty.

    On Respect

    Respect goes to whom explodes and practices and glows self-respect.

    On Choices

    Our words (spoken and written), are perceived as our choices.

    On Faith

    Is letting go of the pleasures of the flesh for the strength of the spirit.

    Do you have some thoughts and not shy about sharing them? I will be happy to read and share them, just send them through the comments below.

  • How to Design your career for ultimate happiness and fulfillment – Part 1.

    How to Design your career for ultimate happiness and fulfillment – Part 1.

    I remember in primary school, I had different interests compared to the ones I have now. During that time, I admired priests because by then I was a staunch Catholic, at the same time playing soccer and following international soccer was my hobby. I also played with toys and watched movies a lot. Watching movies inspired me to respect soldiers and admire becoming one.

    In fact, my answer to one of our teachers, who asked us what we want to become after school was, to be an Engineer or Priest or Soldier.

    Believe you me, I had no idea the interests shift and so will the responsibility. Today I’m a software developer who happily works for my own company. Looking at the journey, I’m persuaded to share about the career topic. Therefore, in this article, expect tips and advise but not drawing conclusions.

    Let’s start with why

    By statistics, 50% of people in America want to quit their jobs, I have used America because it’s a little bit easier to find information about it but the number could be quite high in my own country – Uganda. Of course, not a single individual would want to leave if they were happy.

    The thought of wanting to quit is hugely influenced by how someone feels as opposed to what they are paid. People want to feel respected, loved, cared for and empowered. However, from the very start, people are not trained to embrace and recognize the inner selves. As we grow we learn to live for what others say of us or how they judge us than who we truly are and capable of.

    How do I design my career for happiness and fulfillment?

    1. Discover why

    The most important day in someone’s life is the day they were born, the day discover why and the day they align the why with momentum – Bosco Anthony

    Bosco Anthony’s words were drawing inspiration from the greats i.e. Albert Einstein and Bob Marley. The people who lived a legacy and left a legacy.

    Getting to know your purpose is quite fulfilling and helpful for as long as one will live. It’s the basis of personal integrity and self-positioning. It’s the ground for influential and successful people.

    When Mark Zuckerberg got to define his mission to connect people in the world, he was fuelled and created a process which could easily enable people to connect and share meaningful moments. In fact, Facebook was built around the same purpose.

    You too can become the person you dream, but after knowing who you really are and the reason for your existence.

    Recommendations

    After participating in the Unleash Dreams, a program invented by David Reeve, I have never been energetic and happier. I hugely recommend the program.

    In the USA, Simon Sinek has done a great job, transforming people by helping them to discover their purpose through his Start with Why program and book.

    In Uganda, if you want to learn and discover your life purpose, people like Andrew Bakutana and Lawrence Namale are commendable for their experience and achievements.

    2. Identify the value or principles

    What makes a strong shoe is the kind of material it’s made of. So are humans. Think of it, why is it only 1% of the world’s population is the wealthiest? Aren’t they humans, don’t they share the same 24 hours like you and I? Don’t they have fears, sufferings and struggles like all of us? Of course, they do. But the difference is how they decide to live a life as opposed to the other 99% of the people in the world.

    The Unleash Dreams program emphasizes that every individual should identify about 8 values to be the guiding principle of their lives. However, they shouldn’t be self-centered.

    As humans, we exist to support each other, so at all cost, an individual’s values should be generously empathetic.

    When I identified my purpose and values, it gave me a point of reference and introspection for my daily decisions and actions. The most important part is that it put me at a state where I don’t have expectations and judgement of others. I experience less self-damage than it was because of the self-evaluation discipline that comes with it.

    3. Get the purpose(mission), values and your doing connected

    Do you remember Bosco Anthony’s quote, that I stated earlier in this particular article? It emphasizes one having to balance their purpose with momentum. Momentum is what one does, it is thinking, talking, eating, relationship, etc.

    In other words, our purpose and values must have a point of connection/intersection. So that we can have balance as we live life every single minute.

    4. Aspire for a connected profession

    I put discovering purpose, values and practicing them earlier than this point for a reason. I know 95% of people in the world, live a life of their elders, parents or guardians at least until the age of 16 though, the majority remain victims. But at this point in life, you have no one to blame for your losses and failures. Yes, it’s scary but that’s the way it is.

    As much as people might advise you to choose a certain path because it comes with higher pay and benefits, it’s you to fulfill the responsibility as opposed to them.

    If you choose to be a surgeon, for example, you might spend 90 hours per week in the surgery room. The issue is not about the time you’re spending there but for what purpose are you spending these hours awake and working. What drives your decision should always be natural i.e. the purpose and values, not money or other artificial things.

    5. Knowing your passions is equally important

    When I was a boy, playing soccer was my major activity combined with watching movies. It was easy for someone to say that my passion was around those two activities. But I have to tell you that as humans we always want to be in a comfort zone, we want to be at a position where we are treated as if we mattered even if in actuality we don’t matter. On the other side of the coin, what other choices did I have? Definitely, the only choice for me was to play soccer but at no way, was it a passion.

    After so many years, I realized my passion was to help people find joy, peace, and fulfillment. Realizing this later than sooner, gave me a hard time to add things up. To the extent that those who were in the process of self-discovery, I couldn’t notice. Since my passion required being as close as possible to people especially to those who are vulnerable, it was easy to be taken advantage of.

    To avoid negative self-destructive thoughts, it’s better to take time to discover and isolate your interests from your passion. It’s a great career step.

    6. Relationships matter

    It is scaring the number of teenagers and people of early twenties, I have spoken to, only to confess that they don’t remember the name of their high school teacher, don’t have meaningful conversations with parents, church and community leaders.

    People of such background may find it hard to become outstanding. They missed out on the sense of love, care, and great life lessons and their self-esteem, self-belief, and confidence was killed early enough.

    For most of their lives, they will dwell on the negative actions in their lives because earlier in life they were not taught how to draw and recognize positive energy.

    In fact, statically, convicts of sexual abuse, broken marriages, poor work performance, drug abuse, murder and all sorts of wrongdoing have a history of an earlier lonely life. Contrary to every successful person for whom, had someone or a group of people offering support in any way at different stages in life.

    My suggestion is that if you are a parent, teacher, leader, guardian, relative or adult treat the young and adult people around you with respect and peace.

    If you are a young person, learn to control your anger and feed on the food called forgiving. Because when you become an adult, you realize how much imperfect humans are. Be inquisitive and engage adults with all sorts of questions, that come your way, this is how you build relationships.

    If you are an employer, consider that people have different backgrounds both the hard ones and good ones. Endeavor to find out prior to employing them so that you don’t end up causing damage. Learn to talk to workers even in the most difficult times.

    To conclude

    In this part of how to design your career for ultimate happiness and fulfillment, I have shared some tips and advice about designing your career with the aim of long term/permanent happiness and fulfillment. In part two of this topic, I will talk about how financial discipline, faith, love, work tools, physical and mental health, professional challenges and the resume come into the equation. By the end of the series, I hope the reader will have discovered the secrets of designing an amazing career.

    I’m sure there is so much that I don’t even know about. The good news is, it’s there with you in your thoughts. Why die with it, yet sharing is caring? I invite you the floor, let’s share some love in the comment box below.

  • Trouble comparing dates in PHP

    The scenario.
    I’m building a custom tool which automates the curation of blogs from member bloggers’ feeds. These blogs must be fetched on a weekly basis because the intention is to make sure every member blogger, blogs at least once a week.
    Where to the feed URLs come from?
    Member joins by submitting a blog feed URL, which will save in the system manually at the moment.
    The system(bot) must;

    1. Retrieve the feed URLs from the database.
    2. The system should loop the URLS.
    3. Connect to each URL.
    4. Fetch one feed item(latest).
    5. Get the feed item date and compare it to the date of last Sunday. If the feed date is greater than the date of last Sunday.
    6. Connect to the database again and retrieve a blog item whose item title is similar to the feed item title. If a blog item similar to the feed item is returned, skip that feed item since we already have it and move to the next. Repeating steps 2 to 6.
    7. If the blog item similar to the feed item is not returned, insert it in our blog database to store it permanently.

    Tools used.
    First of all, I chose PHP programming language to accomplish the task. I would have chosen Python, however, my hosting environment doesn’t have python. Yet am also more experienced in PHP than Python.
    I also hard to extend WordPress so that I don’t have to build everything from scratch. Using WordPress will give me the opportunity to automate member sign up, log in and feed submission easier than if I used something different.
    I will eventually build a frontend interface for the system. This interface will enable the public readers to choose and read any blog of their choice as well as enable bloggers to sign up from any part of the world. Building a WordPress theme will be much easier than if I built everything from scratch.
    Alternative tools one could look at Joomla, Drupal and Django and many others.
    What have I built so far?
    So far I have built a WordPress plugin, with the following features.

    1. Automated Feed fetcher
    2. Shortcode which lists active bloggers. This is helpful for displaying member bloggers on the homepage or any page. Hence make it easy for readers to navigate blogs of any member(author)
    3. Shortcode for listing blogs. The intention of the system is to curate blogs from consistent bloggers around the world and make them accessible by consistent readers. This shortcode helps in displaying the blogs on the platform.

    Challenges

    1. Comparing dates.

    PHP has several inbuilt date functions and objects such as DataTime(), CreateDate() etc but they were not helpful. Sometimes they could function but they were never consistent. Luckily enough converting the date strings to time saved me after many trials and struggle.

    Solution

    $TimelastSunday = strtotime(‘last Sunday’);

    $TimeFeedItem = strtotime($feedItem->get_date(‘m-j-Y’));

    if($TimeFeedItem > $TimeLastSunday) {

    // Do the rest

    }

    Whoa! Whoa!
    Can’t wait to enable automated signing up, blog submission and attachment of categories and tags to the fetched/retrieved feeds.
    Thanks for reading until next time.

  • Shared time with a programmer

    One day, one of my friends found himself in a situation where he couldn’t achieve the kind of user interface he wanted. I invited him to our office and within two days, we were able to reach somewhere.
    I realized the cause of his suffering arose from how he was writing code and not knowing the procedure of how something should be approached. For example, he couldn’t really explain to me what he wanted to happen when a certain element is being hovered.
    Basically, it was hard to read and understand his code because of the way he indented his code and named his variables.
    When I helped him, I shared some of the code on github.com which I will share in this post, hopefully, one can pick an idea or two or even contribute towards improving it. This code is written in HTML, JavaScript, and PHP. A snippet which is meant to handle submission of multiple form fields which should pick an array of data. By saying the array of data, I mean picking numerous variants of the same object.
    In his scenario, he wants to pick the available work periods of a contractor and send to a PHP script for processing and storage. During the data entry of a contractor, they have to specify the time duration of a particular day that the contract will be available to offer a service throughout the entire contract period i.e. Monday 08:00 to 17:00, Tuesday 09:00 to 17:00 etc. Therefore it’s necessary for the web application to enable an administrator and registering contract to select a collection of work periods at once without navigating away from the entry form.
    Click here to take a look at the code.
    Besides the code we wrote together, how did I help him improve his coding lifestyle?

    • He got an idea of how to name variables so that even without writing comments the code can be understood by other programmers without any struggle.
    • I admit my code doesn’t come near to the cleanest written code that I hope it will be in a couple months but he was inspired by how I indent and it looks so clean, perhaps he is now practicing the same or even better.
    • I taught him about writing optimized code, especially when using loops.
    • I also introduced him to the idea of a ternary operator as control statement, this was really amazing to him because it would help cut almost a quota of his code.
    • JavaScript is one of his weakest points according to my observation and encouraged him to take a good study of the language including the new concepts of ES6.
    • I encouraged him to watch and follow NetNinjas and Traversy Media channels and others on YouTube to help him develop as fast as possible.

     
     
     

  • How to move WordPress from Cpanel to VestaCP successfully?

    Background
    Cpanel from cpanel.net is the most popular, proven and robust web hosting platform out there. For both not technical and slightly technical, it simplifies the job a lot. It even has a free script installer as well as many paid for auto script installers such as softaculous. Other notable features are email, database and file management on top of robust web statistics aggregation. If you are hosting one or two websites in a shared host environment this is what you need absolutely. Most hosting providers, for example, Godaddy, Bluehost to mention but a few won’t charge you extra for it.
    But if you’re a small and startup hosting provider it might require a huge investment as well as unnecessary expense. Say you host your websites in the cloud, dedicated and normal VPS servers, you have to spend $20 to $40 per month on Cpanel. If you’re smart and a good researcher you may look out for discount coupons and if you’re lucky enough,  you will land on buycpanel.com from which you can get VPS licenses from as low as $13.95. Did I mention setting it up, requires a professional or an experienced person like me for example? Setting up Cpanel requires you to choose the correct operating system usually CentOS and as of writing this article you CentOS7 and above versions are a must, since Cpanel announcement that it will be stopping support for CentOS 6 on all systems by November 30, 2020. If you install FTP, SSH, and exim services you won’t get away with your junior skill. Of course, there’re many individuals and agencies including CPanel support who offer the installation and hardening service at a certain fee.
    If you are in a scenario like mine, you would realize going through all the above jargon is time-consuming and expenditure is overkill.
    My scenario
    I technically manage one of the most read news blog websites in Uganda. These are two websites which run on a single cloud KVM VPS at linode.com. Both websites get around a monthly traffic of 250k. Both websites are four to five years old.
    Technically I’m the single person in a number of publishers. For simplistic, the websites are proudly powered by WordPress which is slightly customized with custom fields, themes, and plugins.
    My primary role is to manage the server and carry out routine security audits, performance, theme optimization, update WordPress and plugins. We also slightly handle emails on the server. But we don’t want to spoil our sender score or reduce the reputation of the IP of our server.
    We’ve had Cpanel on our node for the last two years, despite being in a tight third world economy.
    For some months the license was automatically deactivated due to our failure to submit a payment, throughout that duration we couldn’t access Cpanel support, then it became hard to make any code modifications, manage databases and email accounts.
    During that time the only way of getting in the server was via ssh but we didn’t know every command, for example, to carry out a slight firewall fix.
    Proposal
    For regular management of the server, we had to find a solution. Thus we researched about website/web host control panels. We would filter by fees in relation to Cpanel, features, support, and age of first version and latest version.
    One of the most interesting ones we came across was CentOs CP which looks so much like Cpanel but we settled for another.
    Choosing VestaCP

    • It’s Opensource and free.
    • It supports more than one Linux distributions namely; Centos, Debian, Redhat, and Ubuntu. We actually installed it on CentOS7 but I later found out Ubuntu is recommended.
    • It’s minimum requirements i.e 1GM RAM, 20GB storage are friendly and can translate to slightly better performance than Cpanel.
    • Installation of VestaCP is the easiest yet takes as much as 15 minutes to be ready to set up and manage your websites.
    • To manage backups, databases, and emails is almost as simple as if not easier than Cpanel.
    • It has a growing support community through forums and paid for support.
    • File management. VestaCP doesn’t offer a free file management feature but that wasn’t big of an issue. The developers at VestaCP offer a file management plugin which is at $3 per month or $50 for a lifetime. We can also choose to use services such as codeanywhere.com to connect to the server via FTP hence manage our files without pain. Though codeanywhere.com has both free and paid plans, free code editors such as Notepad++, Atom, and Microsoft VS Code can connect to the server via FTP by the help of secure plugins and allow you to manage files of your websites. For us, this is great. It will help us save more than $179.5 which is a minimum of 661,986/= in Uganda Shillings currency today without including transaction fees.

    Procedure of switch
    Order a second node from linode.com
    One of the sites is about 51GB in files(images contributing the biggest part) and 1GB for MySQL database. As much as I wanted to use a WordPress backup plugin especially duplicator. The PHP execution time and memory limit couldn’t enable the plugin to execute and complete successfully. I also didn’t use the Cpanel backup feature because it was downloading the files locally on my computer which wasn’t what I desired.
    What did I do?
    I accessed both the older and newer nodes via ssh.
    Older node.
    Create a backup archive.

    $zip backup.zip -r /public_html

    The command took some time to finish about 2hours. I would be glad to discover a faster solution because moving systems around is just getting started.
    The next command I used was for backing up the database.

    $mysqldump -u root -p database_name > /home/user/path/database-file.sql

    The dump was blazing fast, motivating me to continue.
    Newer node.

    • Setup the node with CentOS7. Coming from Cpanel, I’m used to CentOS for web hosting.
    • Install VestaCP.
    • Create a site, FTP account, database.
    • Download backup from the older node and restore.

    Download commands
    Navigate to the path where I want to download backup files.

    $cd /home/user/web/domain.tld/public_html
    $wget http://domain-on-older-node.ltd/backup-path/backup.zip
    $wget http://domain-on-older-node.ltd/backup-path/database-file.sql
    1. Restoring files
      While at the path where I downloaded the backup.zip file, issued the command below.
    $unzip backup.zip

    If the files to extract at the root of public_html directory like in my case, I used the move (mv) command to move the files to the right location.

    2. Restoring database

    $mysql -u database-username -p
    $use database-name;
    $source database-file.sql;

    Provide the password as the system will prompt you, the restoration of the database took less than two minutes.

    Troubleshooting tips
    1. I see a blank white screen when I visit the website

    • Check and verify that the .htaccess file was restored. If not copy it from the old node to the new node.
    • Increase the maximum execution time and memory limit. Which VestaCP can help you do without hunting down the PHP.INI file. Increased mine to 300 and 384 respectively. By the way, I made the setting server-wide because am sure, I will be the only person to create websites on this server.

    2. Unable to upload photos through the media library.
    This is caused by a file permission issue. You have to make sure that the website account owns the WordPress installation since by default website installations are owned by root. Use the command below.

    $chown -R username:username /home/username/web/website.com/public_html
    

    Note: replace username with the actual username of the account under which website.com belongs. The website path structure in VestaCP is like /home/username/web/website.com/public_html
    3. The uploaded file could not be moved to /wp-content/uploads/year/month
    This is also a file permission problem on the uploads directory, you should make sure user and group can all write to this directory. Which you have to fix using the command below.

    $chmod -R 777 /home/username/web/website.com/public_html/wp-content/uploads

    Conclusion
    I would have moved the websites in less than 6 hours but because it was my first time doing this, I didn’t have experience of what I experienced during the process. I was playing trial, error and referring to  Google.
    I believe this is going to help you and I get a lot of local businesses online by offering them a cheaper performant alternative.
    Will also get web developers, online without having to cough more than $5USD per month for a robust node.
    Curiosity
    Does VestaCP work with docker? How can it be set up? How is the performance?

  • Hello world!

    Hello world!

    Though I have used the phrase to greet as a welcome to my personal website, I’m absolutely sure you have come across this phrase before, either in the code for programmers or the internet for the none programmers.

    But where does it come from? Today I would like to shade some light about this popular two words sentence, the Hello world!

    The history

    According to Wikipedia, the phrase was first used recently in 1967 in the BCPL programming language as is claimed by Jargon File. Click here to read the Hello world history on Wikipedia. When programmable computers were invented it gave programmers the opportunity to code and print outcomes on the user’s screen. Thus Hello world! got the chance.

    Usage

    Hello world! Is often used by programmers especially in the early stages of learning a programming language and to test the programming language’s ability to handle sentences technically known as strings. See examples below.

    Shell programming.

    #!bin/bash
    echo "Hello world!"

    C programming

    main( ) {
     printf("Hello world!");
    }

    Most programming languages which have the capability of showing characters on the screen, often use the code which introduces printing. So that the programmer can test their ability to use a particular programming language to print a message on the terminal(command line or cmd or console) or other user interfaces.

    However the phrase is not exclusive to programming/coding alone, everyone can use it.

Verified by MonsterInsights