How to install Laravel (5.6) on Uberspace (7)

Published 2018-07-16, 12:57

Laravel is a great PHP framework, and Uberspace is a great and nice PHP host. Why not mix both?

Installing Laravel on shared hosting – which Uberspace still is despite the shell access etc. – can be difficult, especially because of public folder that is used to respond to requests instead of the project root.

Here are the basic instructions for getting a new Laravel project to respond to calls of your <username>.uber.space domain:

  1. Switch folder to /var/www/virtual/<username>.
  2. composer global require "laravel/installer" to install the Laravel Installer.
  3. Create a new Laravel project: laravel new <projectname>.
  4. Delete /var/www/virtual/<username>/html (make sure it is empty, or just rename it maybe) and replace it with a symlink from html to <projectname>/public.
  5. The default Laravel start page should now be available at your <username>.uber.space.

To be able to use the database in the project, you have to make some changes:

  1. Get your generated MySQL password from ~/.my.cnf.
  2. Update the .env file in your Laravel project:
    Username and database should be changed to your username, the password to the one you just retrieved.
  3. Caution: At the time of writing Uberspaces uses MariaDB 10.1.34 (find out by using the command mysql -v). Laravel needs some tiny changes if you work with MariaDB <10.2.2:
    • Edit the app/providers/AppServiceProvider.php file and add the following:
      use Illuminate\Support\Facades\Schema;
      public function boot()
      {
         Schema::defaultStringLength(191);
      }

      (Add both the method call and the import!)

  4. Now you can run php artisan migrate in your Laravel project to create the default tables.

Of course you probably don’t want to host your project at your uber.space domain, not create a new project but check out your already developed project from git, and also not use the default database – but I am sure you can find your way from here.

Laravel Homestead: Run phpunit with another PHP version

Published 2018-06-22, 13:09

Laravel Homestead is a nice development environment/server, that comes with multiple PHP versions installed. You can configure each project you are running through it for its own PHP version, and use e.g. php5.6 on the command line to execute code with a specific PHP version. Unfortunately phpunit always uses the default PHP version. What if the PHPUnit you installed in a project needs a specific PHP version to work and execute your tests (for example because the whole project only works with PHP 5.6)?

You can run phpunit with a specific PHP version by using this command:

php5.6 vendor/phpunit/phpunit/phpunit
Topic(s): Laravel, PHP No comments - :(

How to add spacers to the macOS dock

Published 2018-01-12, 23:18

  1. Open Terminal
  2. defaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type="spacer-tile";}'
  3. killall Dock

Source: https://howchoo.com/g/zdnmodkyngn/add-spacers-to-your-macs-dock

Topic(s): Kram No comments - :(

How to Install Ruby with rbenv on Ubuntu 16.04

Published 2017-12-13, 14:48

Each time I have to install Ruby + rbenv + bundler manually on a Ubuntu machine I somehow mess it up and have to google for a tutorial, then try some until I find a working one.

This one here did work perfectly yesterday, when it was time to do it once again: https://www.digitalocean.com/community/tutorials/how-to-install-ruby-on-rails-with-rbenv-on-ubuntu-16-04

Topic(s): Development, Link No comments - :(

How to create a macOS High Sierra VM with VMware

Published 2017-12-01, 22:07

Topic(s): Link No comments - :(

How to create a macOS High Sierra VM with VirtualBox

Published 2017-11-24, 00:43

Topic(s): Development, Link No comments - :(

Unix command line: How to output to command line and file at the same time

Published 2017-11-22, 12:34

Use:

foo | tee output.file

https://stackoverflow.com/questions/418896/how-to-redirect-output-to-a-file-and-stdout/418899#418899

Topic(s): Development, Kram No comments - :(

Send tabs/URLs between desktop and iOS device

Published 2017-10-18, 15:26

Yay, with Firefox iOS it is finally possible to send tabs and URLs between desktop and iOS devices, in both directions.

iOS to Desktop

From Firefox for iOS to desktop computer, the functionality has its own button in the „tab options menu“ and a great explanation in the knowledge base.

What isn’t mentioned there is that Firefox for iOS also adds a „Send Tab“ share extension to iOS that is accessible from normal Safari. You can use it to send any open tab from Safari to your Firefox Desktop installations. You get a OS notification and the tab is automatically opened in the background when the information is received after a few seconds.

Desktop to iOS

In the other direction, from desktop computer to smartphone, you can use the „Send Tab to device“ extension to add a new Option „Send Page to Device“ to the right click menu of websites and tabs. Using it sends the URL to Firefox for iOS were it also opens a tab.

Only thing missing here is a push notification that also tells you that there is data waiting for you when Firefox iOS is not already open and a simpler way to get the URL from Firefox iOS to Safari – right now one has to manually copy the URL over.

Topic(s): Kram No comments - :(

Disable Windows Defender real time protection with a Desktop Shortcut

Published 2017-10-05, 17:31

I love how Microsoft made third party anti virus protection obsolete with Defender – it just works.

Unfortunately sometimes I need to disable (and later enable again) it’s real time protection feature because it slows down processes I know are secure – for example Gradle builds in Android Studio.

It normally takes 7 clicks to enable or disable Defender real time protection: Systray -> double click on icon -> „Virus & threat protection“ -> „Virus & threat protection settings“ -> Toggle „Real-time protection“ -> User Account Control „Yes“.

Fortunately there is a way to automate this in Powershell:

Set-MpPreference -DisableRealtimeMonitoring $true

Which means we can also create a desktop shortcut (Right click on Desktop -> New -> Shortcut):

%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File "C:/disable.ps1"

(„C:/disable.ps1“ is the file where I put the first code snippet)

In the properties you have to click „Advanced“ to activate „Run as Administrator“ so it can actually be executed.

Then to give it a nice icon, click „Change Icon“ in the shortcut properties and „open“ the icons from „%systemroot%\system32\imageres.dll“. There you’ll find a nice dark red Defender like „badge“ icon with a white x:

The real time protection feature will turn itself back on after some time. Alternatively you could replace „$true“ with „$false“ in a copy of that script to have a shortcut to enable it again. Or spend some time to figure out how to actually „toggle“ in on and off with the same shortcut by somehow doing this in the Powershell script. (Let me know if you do!)

Source: Script via StackOverflow answer by ‚djsmiley2k‘ to my question and icons file for the shortcut

Topic(s): Kram No comments - :(

Website Performance, Code, Images and SEO Testing Tools

Published 2017-09-29, 12:48

There are loads of web site and page analyzer tools out there that look at them under performance, quality, image compression, code or SEO aspects. Many are just (thinly veiled) lead generation tools that don’t really tell the true story, but some are actually useful. As I need them again and again, I collected them here:

More on the marketing-y, rarely even questionable side, but sometimes still interesting to look at:

Topic(s): Kram, Technik No comments - :(

21 queries. 0,243 seconds.