Stuff I'm Up To

Technical Ramblings

bootstrap-tagsinput — February 12, 2018

bootstrap-tagsinput

I’ve got a work project that fills in a database field with multiple comma separated values and thought using the bootstrap-tagsinput script would fit very well. Only I managed to misinterpret the instructions and made a bit of a hole to dig myself out of.

The big mistake I made was to add a data-role="tagsinput" attribute to my HTML. This was a bad mistake because I then tried to configure it using JavaScript – setting the tagClass and typeahead options. It worked, but nothing like I was expecting. I couldn’t reference it by it’s id selector using $('#selector') in the script and ended up using $('.boostrap-tagsinput > input') Which can’t be right.

Continue reading

Advertisements
Bootstrap Tags Input and Typeahead — February 8, 2018

Bootstrap Tags Input and Typeahead

Both of these add-ons I forget what they are called. So when I go looking for something that does a multiple select type option in a HTML form I struggle to know what to look for. Hopefully now they are here I’ll find them more easily.

https://bootstrap-tagsinput.github.io/bootstrap-tagsinput/examples/

https://twitter.github.io/typeahead.js/

PHP7.2 and MSSQL Drivers — February 5, 2018

PHP7.2 and MSSQL Drivers

I upgraded to PHP v7.2 on my Debian Buster/Sid today. Not a problem until I realised I’d broken my Microsoft SQL Drivers.

The real reason for my update from v7.0 to v7.2 was down to a problem I suffered with some Laravel console commands I was working on. When I ran a CLI based command php artisan group:command, which is a command I’m writing that uses a model from an MSSQL server. It would come up with an error message:

In Connection.php line 664:
                                                                               
  could not find driver (SQL: select top 1 * from [vwContract] order by [Ref]  
   asc)                                                                        
                                                                               
In Connector.php line 67:
                         
  could not find driver  

Continue reading

Vue.js, Vuetify and Laravel — December 24, 2017

Vue.js, Vuetify and Laravel

I’m really new to playing with Vue.js but thought I’d use it with Laravel and Vuetify rather than bootstrap. I couldn’t even get it off the ground due to this error:

app.js:442 [Vue warn]: Unknown custom element:  - did you register the component correctly? For recursive components, make sure to provide the "name" option.

(found in )

I’d tried to webpack the JS and this seems to be where the trouble lies. Something not loading quite right separating Vuetify out into the “vendor” script. Put simply the not being registered is because the vuetify.js script hasn’t loaded.

So going from this in my webpack.mix.js:

mix.js('resources/assets/js/app.js', 'public/js')
    .extract(['vue','vuetify'])
    .sass('resources/assets/sass/app.scss', 'public/css');

To this:

mix.js('resources/assets/js/app.js', 'public/js')
    .extract(['vue'])
    .sass('resources/assets/sass/app.scss', 'public/css');

resolved the problem for me.

Laravel & PHP Minimum Requirements — December 11, 2017

Laravel & PHP Minimum Requirements

Make sure you’ve installed php and the necessary modules before trying to create a new Laravel project.

$ sudo apt-get install php-fpm php php-mbstring php-zip

The order of php-fpm and php is important as putting them the other way around you’ll find you get apache2 installed when you probably don’t want that.

Then you should be able to create your empty project using composer without any complaints.

$ cd /var/www
$ composer create-project --prefer-dist laravel/laravel [project]

 

DMARC, SPF and DKIM — November 11, 2016

DMARC, SPF and DKIM

For several ears now we’ve run a fairly tight ship on our email server. It consumes an awful lot of resources mainly because of how many businesses out there fail to properly configure their email server correctly. By far the biggest failing is not using the proper HELO/EHLO name and not having a reverse DNS (RNDS/PTR) record that matches.

So please, if you’re an email admin, get it sorted. This is an internet standard from way back in the 1980’s and beyond!

Adding to our anti-spam systems using DKIM and SPF we’ve brought in DMARC to enforce compliance with these standards. So in future we’ll be telling recipients to reject mail claiming to be from our domain that fails to meet the SPF and DKIM checks.

Continue reading

Invalid View Path, Token Mismatch — November 7, 2016

Invalid View Path, Token Mismatch

Somehow I managed to bork my Laravel development app. I’m not entirely sure what I did as I only changed one of my config files, but I was getting a blank page when visiting the site. Checking the Laravel log showed nothing. Checking the Nginx logs suggested a permission problem. So I cleared the storage folder and things didn’t get any better!

So I Tried:

$ php artisan cache:clear
$ php artisan config:clear
$ php artisan view:clear

Which resulted in:

[RuntimeException]
View path not found.

Continue reading

NGINX and Laravel — September 20, 2016

NGINX and Laravel

NGINX needs a little special setup to handle Laravel as Laravel only really serves one page. All others are served through index.php as a route.

index index.php;

location / {
    # First attempt to serve request as file, then
    # as directory, then fall back to displaying index.php.
    try_files $uri $uri/ /index.php$query_string;
}

They key parts here are serve index.php as the index page and then using try files when it can’t find $uri serve up index.php and pass the $query_string as the parameters.

Continue reading

spatie\laravel-permission — September 16, 2016
Adldap2\Adldap2-Laravel — September 14, 2016
Laravel Redirect to Intended — September 13, 2016
It’s getting late — September 11, 2016