Call   0208 3131682   Mon-Fri 9am-6pm

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

Hide Buddypress members pages from guests ( also hide BBpress forum posts)

By | PHP, Website Development, Wordpress | No Comments

The code below is to hide sections of a WordPress website from guests (hide certain pages or groups of pages on a WordPress , so they are only available for logged in users).

In this case we’re hiding all the Buddypress members pages from guests ( so hiding all pages that start with /members such as member profiles and so on). We’re also  hiding BBpress forum topics ( but they can still view the forums and forum post / topic names ).

If a guest is trying to view a page (that we’re not allowing them to, they are sent to the homepage).

 

 

AI Care for the Elderly

By | Artificial Intelligence | No Comments

With all the advancements in technology and in the field of medicine, it is no wonder that people have longer lifespans now more than ever.  More elderly people are able to live on their own, albeit self-care and mobility challenges, and medical issues because of their advanced age.

In recent years, artificial intelligence has also gained a lot of ground in various fields. Aside from advancements in business and other areas, it has been utilised to focus on elderly care and in improving quality of life for those in their later years. From providing better and more streamlined services, all the way to the monitoring of elderly health and wellbeing, the use of artificial intelligence is proving to be a step in the right direction.

Let’s delve into some of the advancements of artificial intelligence for elderly care.

Health monitoring

One of the bigger hurdles of caring for the elderly is monitoring their health and their safety without intruding into their lives. Artificial intelligence and smart home monitors can help do that by unobtrusively checking vital signs and changes in behaviour and movements, as well as monitoring for accidents and falls that would need immediate medical attention.

Having a robot or a smart home set up for elderly living is great since sensors and technologies can be put into place to prevent and deal with any accidents, falls or mishaps. Not only is this good in terms of emergency response, but the elderly also get a sense of security that should anything happen to them within the home that would require emergency or medical intervention, help will be on their way.

Virtual Assistance

Being able to make sure that the elderly are following through on their take-home instructions and medications is important, but remembering to do them daily at home can be difficult because of cognitive decline and their failing memories. Smart robots are now being utilised to help the elderly be reminded of the health schedules they should keep on a daily basis. Cues are given to help them remember to take their medication on time, eat and do self-care tasks needed for better quality of life. Smart robots can also help in making sure that the elderly keep to their medical appointments and health check-ups to maintain better health.

Robots can now also help make sure that the elderly follow a healthy routine throughout the day. Reminders about staying on track regarding getting physical activity and sharing useful and practical health and self-help information are other ways artificial intelligence is helping the elderly at home.

Other applications to elderly smart homes may entail artificial intelligence and robots to do small tasks around the home such as doing light cleaning or in meal preparation.

Keeping connected

Artificial intelligence can be utilised to help keep the elderly feel connected and less isolated from the outside world and the lives of friends and family members they hold dear. Smart robots have the capability to allow easier interaction and communication with family and friends regardless of distance, so family members can keep in touch and spend time with their elderly loved ones with ease. Video calls and photo-sharing capabilities also help the elderly feel more connected and may experience less feelings of loneliness and isolation.

Smart robots are also able to connect to medical professionals and doctors quickly and efficiently, should there be any emergency where quick medical attention is needed. This is very important to making sure that the elderly are given the best care.

Socialisation for physical, mental and emotional wellbeing

Artificial intelligence and smart robots can actually become daily companions for the elderly. Because they are designed to engage and be available to converse with, they can become vital companions that help the elderly become more social and maintain a healthy mental and emotional wellbeing. Smart robots actually become carers of sorts to the elderly where relationships and positive emotional bonds are created. It gives the elderly a sense of security that they are being cared for and attended to, but on their terms.

Artificial intelligence has advanced by leaps and bounds in the past years, and we see more and more applications for good for the elderly, people with disabilities and for those outliers of society that may need help and attention more than anything. Many are already benefitting from the new technologies coming out to make life easier and better for everyone–the elderly in particular. At present, there are already such great utilisations of this technology and it seems as though it will only improve and get even better in the future.

 

 

-This article was written by Abby Villarica from Green Box

Charities and Utilising the Potential of Artificial Intelligence

By | Charities, Digital | No Comments

Artificial Intelligence is here and now. We may not realize it, but we interact with some form of AI most, if not, each time we go online–from voice assistants like Alexa to as simple as being given suggested movies, products or options every time we use programs and applications. AI makes things easier for us by learning about our preferences and patterns and it then makes suggestions or actions according to these.

For the sake of having a working definition of what artificial intelligence is, according to The Street, “AI is the use of computer science programming to imitate human thought and action by analysing data and surroundings, solving or anticipating problems and learning or self-teaching to adapt to a variety of tasks.”  From what we have been seeing and experiencing at present, AI can be used in numerous applications for everyday life that will help to make tasks, or life in general, simpler.

Since AI is already a part of our everyday lives, it would also be great, too, if Artificial Intelligence could be harnessed more by charities to help further their advocacies.  After all this is one technology that can and should definitely be used for good.

Some of the things we are using in our everyday lives such as voice assistants like Alexa and Siri are already being used by some charities to help with their programs. Charities use this technology not only to help people get better informed about health conditions such as breast cancer, but also to help fundraise and spread awareness. For something that is widely available, it would be a great advantage for charities to make use of this technology. Hopefully in the future, more and more charities will follow suit and utilise this tool.

AI Chatbots are also a great tool to harness for charities, as we are seeing in some already these days. These can help in not only giving information but also answering questions about the charity’s goals and programs. Utilising chatbots lessens the need for human resources to handle information dissemination and answering some queries, while also helping lessen the use of resources and costs of the charities as well.  Chatbots are already being tested by a few charities now, and hopefully, more and more charities will see the benefit of using such technology in raising awareness and educating, as well.

Other areas that charities can harness artificial intelligence is for their fundraising efforts. With AI, charities can spread word easily that they are raising funds for a certain program or cause.  It is also making it simpler for people to give and donate. Instead of the tedious process of old, people can easily give and share through channels as readily accessible as Facebook and the like.  This is great for charities since the simple process will potentially encourage more people to give. To date, more and more channels are opening up to help making donating simpler and easier because of artificial intelligence.

Another one of the more important benefits of artificial intelligence that charities should really make use of is the capability of AI to gather and analyze data.  This is especially helpful since knowing and understanding their target audience will help a lot in deciding the best steps to take in terms of programs or marketing.  The vast amounts of data that AI can harness and process for a charity to gain more insight into how they are making an impact is invaluable. This definitely is one of the most important advantages for charities to use AI.

Artificial intelligence is here, and it is here to stay.  With all the possibilities and potentials AI has to offer, it would be great if charities utilised them more to help them help more people. Hopefully, more and more tap into this tech for good because it can really help further their charity’s goals and advocacies.

 

-This article was written by Abby Villarica from Green Box