How to fix PHP Warning:Declaration of ... should be compatible with .... in WordPress plugins/themes

Posted by on Nov 3, 2017 in Articles | 0 comments

Problem: PHP Warning:  Declaration of ... should be compatible with .... You will see this error when you (or your hosting company) upgrades to the latest php 7 which is great. This is wp-cli output before the warnings were suppresses. This is wp-cli output after the warnings were suppressed   The other problem is that based on the error reporting settings php will could show those warning messages to your users and/or in your log files. It would be stupid to run out of space because of those warnings. Suppressing all of the warnings is not a good idea as it will make the troubleshooting harder when it's needed. There are multiple ways to fix this. Solution #1 One of the ways to remove this php warning is that you will have to go and inspect the code where the warnings are coming from. This could be plugins/themes which contain php classes. It seems something has changed and php 7 doesn’t like it. This is because some method's parameters don’t method(s) those in their the parent class’ or vice versa.  Then fix the parameters so they match. This solution is long term, however, if you have full control over the code. Solution #2 Ignore the warning and suppress it. In the context of WordPress plugins/themes it’s a tedious work to go through and fix each plugin or theme’s files. This is also pointless because a new update would override your changes anyways. This is the approach I’d recommend for the time being while the developers fix their code in the upcoming months. You can use this code in a file that's get included first. This is usually a config file. In WordPress case you can add it to wp-config.php (right after the opening php tag: <?php or to your functions.php file. If you'd rather install a WordPress plugin please check Orbisius Warning Suppressor plugin.     Were you also have been searching for: How to Suppress PHP Warning: Declaration of ... should be compatible with .... How to Remove PHP Warning: Declaration of ... should be compatible with .... How to Get rid of PHP Warning: Declaration of ... should be compatible with ....   Do you use test/staging sites? Visit qSandbox for more...

Read More

How to Create a CSV File with PHP using thephpleague

Posted by on Oct 17, 2017 in Programming | 0 comments

the latest version requires php 7+ but the old 8.x branch can work with a lower version of php so you can download it from: <?php // include_once 'shared/csv-8.2.2/autoload.php'; use League\Csv\Writer; // //$writer->setOutputBOM(Writer::BOM_UTF8); //adding the BOM sequence on output $header = ["position" , "team", "played", "goals difference", "points"]; $records = [ [1, "Chelsea", 26, 27, 57], [2, "Arsenal", 26, 22, 56], [3, "Manchester City", 25, 41, 54,], [4, "Liverpool", 26, 34, 53], [5, "Tottenham", 26, 4, 50], [6, "Everton", 25, 11, 45], [7, "Manchester United", 26, 10, 42], ]; $writer = Writer::createFromPath('./file.csv', 'w'); $writer->insertOne($header);...

Read More

Qualities of the Successful Freelancer

Posted by on Oct 7, 2017 in Business | 0 comments

Being a freelancer/subcontractor is becoming the norm nowadays. With that many freelancers it's very convenient for the business to hire people per project and if the project needs more resources to hire even more people. The things i is just like cloud services. This is good for the business because of the unpredictability and the teams can shrink or expand as needed. If you are serious about your freelancing career here are the qualities I believe will help you get and retain your clients. Finding clients The client's won't find themselves you need to dedicate time and effort every single day to look for clients [twitter, job boards etc] that can benefit from your services. Also if they are good fit for you. Even though you can probably service lots of clients you have to be picky about that. a bad client can drain your energy and vice versa. You want clients that respect your processes, pay on time and are understanding when you need to unplug. Not all clients will reply when your contact them and that's OK. You need to keep going without loosing motivation. I have noticed that 1-3 out of 20-30 people will get back to you and out of that 1 may hire you. It is also important how you approach each project. Lots of people including myself I would copy & paste the same content. I wanted to be efficient. It's important to take a minute or two to get an idea what the project is about and ask meaningful questions. If you can even provide some steps that you'd take to complete the project you would be seen as someone who can really do it. What I have done is to check that potential client's website and come up with some suggestions. The idea is to provide value as soon as possible. For some clients I've created a short video recording (up to 1-3 minutes) explaining how I would approach the project. Sometimes I  also turn on my webcam which shows my face in the bottom right corner of the video. The audio + video recording helps the client to determine my level of English (for non-native speakers). Having a picture communicates what person you are. Work ethic Have a great work ethic. If you promise that something will be ready by a given date do everything possible to make that deadline. If you see issues or probables that may cause the deadline to be pushed forward tell the client immediately as soon as you find that out. Waiting for the last possible moment is a really bad idea. You have to be realistic when things are not going well. In such cases...

Read More

How to Completely Uninstall/Remove WooCommerce and Data

Posted by on Aug 10, 2017 in WooCommerce | 0 comments

The complete removal of WooCommerce and its data is not (or should not be) a common thing but it might be useful if you need to go back to previous version of WooCommerce or if just want to start from scratch or if you need to delete some test orders. Here's a video how to do it. If you deactivate WooCommerce and uninstall like you do with any other WordPress plugin this won’t delete the orders and customer data which makes sense otherwise lots of people would freak out. The only extra step that needs to be done first before you attempt to uninstall WooCommerce is to edit your wp-config.php file and append one line. You need to add this line right after the starting <?php tag. define( 'WC_REMOVE_ALL_DATA', true); To edit that file you will need to use an ftp client (e.g. FileZilla). Do make sure that the quotes are correctly pasted (e.g. single quotes look like single quotes) because if they aren’t this can/will crash your site. If you get an error you can manually delete the quotes around WC_REMOVE_ALL_DATA and type them again and upload the file. Some may wonder why there isn’t a button that can be checked to confirm data deletion. The problem is people don’t read and especially if they are tired or if they don’t know what they are doing they can click on the wrong checkbox and the order data would be lost. Sometimes the user needs to be protected from themselves.   To recap the complete WooCommerce uninstallation steps Add the line in the wp-config.php to confirm that you really want the data removed Deactivate the WooCommerce plugin Uninstall the WooCommerce plugin Maybe reinstall WooCommerce plugin Remove the line from the wp-config.php in case you uninstall the plugin later.   Related   Test WordPress site deployed in seconds? Yes, it's possible. Visit qSandbox for more...

Read More

Decisiveness: Quality 1 of N of Successful Entrepreneurs

Posted by on Aug 9, 2017 in Business, Entrepreneurship | 0 comments

Being decisive is a cool and very important quality. It requires energy and you to face fears of being wrong or even to look stupid. It takes guts to be decisive but there’s no success without decisiveness. It is an important quality not only in business but also in personal life because decisions unstuck you. You decide which road to take and that makes some of the problems irrelevant and other ones more relevant and that is a good thing. It’s better to solve issues that are right in front of your eyes rather than spend time and energy fixing things that might or might not happen in 1 year. In programming terms this is called premature optimization. It’s good to look ahead but not too far ahead and only when it really makes sense. Many books state that we have a limited pool of energy that we can use for decision per day. Every decision takes some of its contents. With the new day that pool gets replenished. Even micro decisions take mental energy e.g. what clothes/socks to wear, what to eat for breakfast, do you want to drink tea or coffee. To simplify this you can have rules to improve the decision making process. For example: you can prepare your clothes for the next day. You can cereal during the week days and on pancakes on the weekend. Deciding between: coffee or tea. Anytime between 5am & 4pm drink coffee otherwise tea. There will be days when you’ve had to exercise your decision power and lot and at the end of the day you feel drained and deciding what to order for dinner can take minutes to make. That’s normal and is ok. What if I make the wrong decision? I was raised that making mistakes is a wrong thing. Thankfully I was able to change my perception by reading lots of startup/business books. Those books repeatedly mentioned that mistakes are just learning lessons. In the context of startups many decisions/experiments have to be made in order to find a working business model i.e. create something that people want and are willing to pay money for it & are actively looking for a solution. Most of the time it’s better to make a decision early on because you’ll be able to course correct if things don’t work out as expected or you get new information that makes you change course. In one of the business books I remember reading that a CEO mentioned that he/she has changed their mind rather than saying he/she was wrong J.   There are small other cases/exceptions that makes sense to delay making a decision they are called creative procrastination. I like...

Read More