auto-cpufreq

I’m a new convert to using Ubuntu as my full-time development environment. Each change in platform requires some adjustment of development tools and such. Being a user of vagrant means there wasn’t much to change in development setup. PHPStorm is multi-platform, as are the MySQL Workbench tools. Hiri is getting me connect to our exchange email/calendar system and gitKracken has replaced sourcetree. (Come on guys. I really miss sourcetree. ) There’s even a linux version of zoom, though not as feature complete as the windows or mac client.

One possible deal breaker I’ve been fighting with is battery life on this linux laptop. I could get around 6 hours from the 3 year old windows laptop. My new linux laptop gets 2 or 3 tops. Thankfully, Mr. Hodzic has solved that problem for me with his wonderful tool “auto-cpufreq“. It installs as a “snap”. (a sandbox for apps). There is a very useful screen cast right there on the snap home page which explains the what, why and how for this tool. It’s un-complicated, accessible and automatic.
I’m now getting closer to 5 or 6 hours between charges.

Install

sudo snap install auto-cpufreq
sudo auto-cpufreq --install

and your done.
You really should watch the screencast. It’s worth the minutes.
and if you can, please toss Adnan some coin.

Updating search indexes (attempt: 1) – Error (time: 0.027s): fopen(assets/uploads/something.pdf): failed to open stream: No such file or directory

I’ve spent a whole day trying to debug a queue error with craft cms 3. I’m using the “document-search” plug-in to make assets searchable and while testing it discovered some errors in my queue.

Manually running these jobs one by one would complete successfully but any time the queue tried to run them; they would fail.

Finally after digging through the assets api I discovered this was a configuration error.

Notice the “File System Path”. That use of a relative path turned out to be the issue. When the queue running starts a job, it doesn’t start in the webroot (Usually the “craft/web” folder). That’s why it works just fine from the web ui and fails for the queue runner.

So what should this value have been?

“@webroot/assets/uploads/docs” instead of “./assets/uploads/docs” did the trick. This alias works for both the web ui and queue. The only silver lining for me was a reason to dive into the minutia of crafts assets.

Doing an “Annual contract, paid monthly” with Adobe Creative Suite? Read the fine print.

I needed photoshop for a short period of time and saw the option of month to month and thought this was great. Access to photoshop when I need it for $10 a month. That’s reasonable.

Should have read the fine print.

Cancellation Terms

You can cancel your subscription anytime via your Adobe Account page or by contacting Customer Support*. If you cancel within 14 days of your initial order, you’ll be fully refunded. Should you cancel after 14 days, you’ll be charged a lump sum amount of 50% of your remaining contract obligation and your service will continue until the end of that month’s billing period.

It wasn’t obvious anywhere in the check out process that this was an annual contract with a cancellation penalty. Only when I finally got around to canceling did I notice which was too late.

“error”:”unlink(/vagrant/craft/storage/runtime/mutex/*.lock): Text file busy”

Problem: You’re getting a dev environment setup for craft on your system and every update or plug-in install fails with an error message:

Status: Internal Server Error
Response: {"error":"unlink(/vagrant/craft/storage/runtime/mutex/xxxx.lock): Text file busy"}

Solution: You’re on windows. Yii has a different mutex mechanism on windows and by virtue of sharing a folder from a windows host; you’ve inherited some of the idiosyncrasies of the windows file system.

CraftCMS creator discusses this issue in a github issue: https://github.com/craftcms/cms/issues/4355

You’ll need to add this to your craft/config/app.php file.

return [
    'components' => [
        'mutex' => function() {
            $config = craft\helpers\App::mutexConfig();
            $config['isWindows'] = true;
            return Craft::createObject($config);
        },
    ],
];

This was actually an issue in Yii which Craft reported to the Yii framework.

syntax error: unexpected end of file

Problem: You’re trying to run a bash script embedded in a git repository to provision a vagrant machine and are getting an error that no one else is.

Solution: You’re using a windows host. The default on windows is for git to checkout files using Windows friendly line endings and then save them to the repository using unix line endings. Bash on linux is expecting unix line endings and errors if that expectation is not met.

You’ll need to set your settings for this project and re-checkout the files.
Open a command / “git bash” prompt in your project directory and run:

git config core.autocrlf

This should show you your current settings for this feature of git.

The options are true,input or false.

  • true: checkout as windows; check in as unix.
  • input: checkout as whatever is in git and check-in as unix.
  • false: checkout as whatever and check-in as same.

for this repository I changed my settings to

git config core.autocrlf true

then

git reset --hard

This is does fix the problem but it’s not the best solution for your project.
You should probably have a “.gitattributes” file in your root directory to set this settings explicitly instead of depending on your team to set these up on checkout every time.

*               text=auto
*.sh            text eol=lf
*.conf          text eol=lf
*.bat           text eol=crlf

This will inform git to have different defaults for these specific types in this project. Git is good at detecting binary vs text so you don’t have to go crazy listing every type in your project.

See more about .gitattributes in the book of git.