Call   0208 3131682   Mon-Fri 9am-6pm

In WordPress Recent Posts Widget , only show posts tagged with the current page url

By | Uncategorized | No Comments
 

Setting up a Laravel app on Docker

By | Apache, Docker, Laravel, linux | No Comments

Rough notes, will pull this togther in a blog post at later date.

issue:

The requested URL /login/ was not found on this server.

resolution:

add to manually enable mod rewrite on command line in the container:

# launch a terminal in the container

docker exec -it e39431779799 bash

# enable modrewrite

a2enmod rewrite

/etc/init.d/apache2 reload

 

issue:

could not find driver (SQL:

resolution:

Add this to Dockerfile:

RUN docker-php-ext-install mysqli pdo pdo_mysql
run

docker-compose build

then bring it up:

docker-compose up -d

Use anonymous functions sparingly

By | Javascript, Programming Tips and Best Practices | No Comments

This is the first of a bunch of posts I’m going to write on programming tips and best practices.

This one is about Anonymous functions ( a sometimes useful technique if your going to use in one place and throw away ). 

And thats all well and good, however these make code more difficult to understand ( especially large code bases you need to maintain ).

For example imagine some code you need to maintain, lets say it starts off with a long file you need to read through and get a high level understanding of. If its littered with anonymous functions it’s makes it hard to understand (quickly, quickly being the operative word, we’re busy people after all with lots of a new features the boss wants to add).

Is this easier to understand (approach 1)

 

Than this

 

It’s quicker and easier to read and understand the 2nd code ( we don’t even need to read the function ‘toggleDisplayOfControls’ because from its name it’s obvious what it does).

To take this one step further we can nicely comment the function (toggleDisplayOfControls) at the top ( as is standard ) if needed (in my experience anonymous functions are rarely commented).

 

Adding javascript functions to Laravel Mix ( and why you get error Uncaught ReferenceError: function is not defined )

By | Javascript, Laravel, Programming | No Comments

This one had me pulling my hair out the other day. I was using Laravel,  adding a javascript function to the app.js file ( also tried using require in app.js and pulling in my function ). Laravel uses Laravel Mix which is a wrapper for webpack.

Yet with either approach I was getting the javascript error:

Uncaught ReferenceError: testing_helloworld is not defined

It seemed to be working ( had npm run watch , compiling it and doing a view source I could see the function in my javascript app.js file ).

My function source code looked like this:

It seems webpack wraps this in IIFE (see details on mozilla site )

This has the effect of wrapping it in its own scope ( and not in the global scope ).

So to put it in the global scope, so you can call it anywhere, you need to pop the function onto a global such as Window as below:

thanks stack overflow ! 

I’d have read through my app.js file , but it was massive and would have taken me awhile to find this I think ! Hope this helps someone else with Laravel Mix, Webpack and adding your own javascript functions.

 

 

Exporting Forum data from BBPress

By | BBPress, Migration, SQL | No Comments

This is how to export data from BBPress, which would be useful if you wanted to migrate from BBPress to another forum platform.

Its straight SQL export direct from the mysql database, with things like forum posts (topics ) and forum replies, as well as some other data including users ( and their user ids etc ).

I’ve exported the forum data into a table, then escaped the quote marks and finally output into a csv (comma separated list ) file that can be used to suck into the relevant system , where you’re moving the BBPress forum to.

 

 

The Covid-19 Pandemic is Changing Company Mindsets about Remote Working

By | Remote Work | No Comments

This Covid-19 Pandemic has disrupted life as we know it. Businesses and companies are struggling to adjust to utilising and implementing different work options because of the lockdowns and quarantines in place. The positive trend that is happening though is more and more companies are adopting remote working set-ups to keep their businesses running amidst this pandemic.

Going from a traditional set-up to a remote one has become a feat and a challenge for many companies, especially those caught unaware and left to make transitions quickly. This pandemic brought about a need for a big change in mindset and companies have had to make a shift in how they run their businesses.  Company owners and managers now see the need to adjust work processes that have long been in place to accommodate a new remote working set-up which is the most viable solution for these tough times.

The need for remote work set-ups not only made changes in the infrastructure and work systems companies use. Managers and company owners also had to learn a new way of managing their people, with the focus on putting more trust in their employees that work will get accomplished well even if they are not in the office.

It has been observed through that companies are seeing that the remote working set-up may not be so bad for business after all.

Companies are realising that with the technologies available now, there are many options to better support this type of work set-up. So many applications and products can cater to and support remote working for collaboration, communication and encouraging productivity.

So, apart from the challenge of transitioning processes to a remote set-up, companies are realising that there are a lot of benefits to this shift.

Less overhead costs on infrastructure

A remote working set-up allows companies to save on overhead and infrastructure costs. If a physical office and core team is needed, a smaller and less costly space will suffice. Companies can then choose to invest in tools that will better support their employees, instead of having to deal with the burden of high overhead costs.

A decrease in stress brought about by the daily commute

The daily commute can take its toll on employees. The hurried rush to get out the door to get to their place of work is stressful and time-consuming, to say the least. Remote work removes this and allows employees to create a work environment conducive to productivity right in their own homes or wherever they choose. This change alone translates to increased productivity and an observed reduction in days off.

Higher performance and productivity

Employees that have remote working arrangements can enjoy greater flexibility in managing their time between work and family. They perform better at their tasks and there is an increase in their productivity too because they are satisfied with the work-life balance that remote working provides.

An increase in employee retention

The work flexibility and remote set-up increases employee retention because it encourages a good work-life balance. Companies with remote workers are aware that the work culture they foster is important, and they put a lot of focus on that. Employees are also given the trust and autonomy to get their work done well while supporting and encouraging carving out quality time for themselves and their families.

Better options for recruitment with a bigger candidate pool

Since physical location is less of an issue for companies that offer remote work options, the pool for better and more qualified recruitment candidates broadens. Companies can find employees that will fit their needs and the work culture while thinking less about geographical limitations. More professionals are also becoming aware of the benefits and flexibility that remote working has to offer so they look for companies that can give them that. All in all, it is a win-win.

In the last couple of years, there has been a slow but steady mindset shift for companies to be more open and supportive of remote working situations. This Covid-19 Pandemic, though, has highlighted and increased the need for faster transitions to this type of work set-up more than ever. With the many benefits that remote working has to offer; it may well be the trend for businesses and companies at present and in the future.

The Covid-19 Pandemic may have given companies and businesses a big nudge to make changes; and given the benefits of remote working, it may have been a nudge in the right direction.

 

-This article was written by Abby Villarica from Green Box