Windows – Extremely Slow to Create a New Folder Fix

Came across this problem on a computer, and a few places suggested the following method, and it worked for me:

1. Open Windows Explorer/File Explorer, i.e. go into a normal folder.

2. At the top of the window, click on the ‘view’ tab at the top of folder. under the title.

3. You should now see a button that says ‘Options’ in the updated ribbon content. Click on it.

4. A dialog box will appear. On the ‘General’ Tab (which appears by default), un-tick the two privacy options “Show recently used files in Quick access” and “Show frequently used folders in Quick access”.

5. Apply/OK to exit.

6. Try making a new folder and seeing if it works as it should now.

Good luck!

Peter

Error: ValueError: Path cannot be empty in file

Are you receiving this error in a Laravel application? And is Google suggesting something to do with file uploads (as it does indeed sound like?), but you’re not uploading any files, and just using the normal ORM methods?

The problem might be with your object’s save method, or rather, the source of the problem is that it can’t store a new object.

Check that your table has auto-incrementing enabled for the appropriate field.

Peter

Laravel Migrations: Cannot declare class XYZ, because the name is already in use

The error for this is a little misleading.

If you’re sure you’re really not redeclaring, what you need to do is make sure that the migration name and the snakeCaseClassName actually match.

So for example, the migration add_bank_account_to_payments_table.php combined with the code

class AddBankAccountIdToPaymentsTable extends Migration { …

would spring this error, because of ‘Id’ sneaking into the class name while not being present in the migration filename.

Hope this helps!

Peter

Tailwind and npm run dev — fixing the assets not loading (‘remotely’)

If you’re working with Tailwind and in any situation where your browser isn’t able to load the URLs that ‘npm run dev’ automatically compiles for its assets (it will usually use localhost in my experience), then you will come across a situation where your browser fails to load the compiled CSS and JS, leaving an ugly unstyled page. How to fix?

Basically, Vite runs its own little server process that you need to be able to access from your browser, and which compiles your assets (in dev situations) for live-updating. By default, the basic ‘npm run dev’ assumes localhost. You can’t use ‘localhost’ probably (since you’re having an issue), so you need to be able to find what IP you need to access the Vite server.

Find out the IP of the (virtual?) machine hosting your website and Vite server. There are many ways to do this. If you have edited your hosts file to access the site using a domain like http://acme.testing, then it’s the IP you used for that in your etc/hosts configuration. If you’re accessing your website via IP (ew), then likely that. Either way, you just need the correct IP. To test you’ve got it, check out http://%5BRemote_IP%5D:5173/ to check you can see the Vite landing page. If you can, then this is definitely the IP address you need. If you can’t, but you’re sure it’s the correct IP, you may have other issues, such as a firewall.

Once this is confirmed, here is the command you need to run:

npm run dev -- --host [IP HERE]

The formatting is pretty unusual to my eyes because of the naked ‘–‘ in the middle, but it is correct. Here is an example:

npm run dev -- --host 192.168.1.123

That’s basically all you should need! Hopefully this helps!

Peter

Importing Photos stuck at “Preparing to Import From Iphone”

Had this problem? I have!

Turns out this bug is somewhat related to a setting related to Personal Hotspots and the “Allowing others to join” feature.

So you can (most likely) fix this but turning that setting off.

But more directly, just turn on airplane mode while you want to import, and it will work. That’s what I did. It took about 30 seconds after airplane mode was switched on for it to start to import as normal.

It would be nice if this was just fixed rather than having to do this workaround, but alas!

Hope this helps!

Peter

Appling CSS Classes / Centering Text Responsively in MJML

I had a strange problem trying to simply centre text on mobile views in MJML (which is definitely a smart way to avoid the crazy headaches Outlook introduces into creating responsive e-mails!).

I won’t enter into whether this is a good idea – media queries aren’t covered by every client even still.

Anyway, the solution is simple.

<mjml>
  <mj-head>
    <mj-attributes>
      <mj-section background-color="#fff" />
    </mj-attributes>
        <mj-style>

      @media all and (max-width:600px) {
        .mobile-center div {
          text-align: center !important;
        }

      }
    </mj-style>
  </mj-head>
......
....
....
 <mj-section>
      <mj-column width="26%" padding-right="0px">
        <mj-text font-size="13px" align="left" css-class="mobile-center">HELLO THERE</mj-text>

      </mj-column>
</mj-section>

This works… but only because of the “div” after .mobile-center in the media query declaration. It’s vitally important. Don’t miss it out! This caused me a bit of a headache, but fine once you know. It was weirdly difficult to find anyone else mentioning this. Only through trial and error did I realise why my text wasn’t centering – because referring to the class alone isn’t enough. When it converts to HTML, divs appear, which must also be referenced

Peter

Replacing Image Source / src with JQuery (Without it being, slow, laggy, or not working after a few times)

Hello!

Recently I had an annoying occurrence where the ‘standard’ Stack Overflow response wasn’t very performant, and would stop working after a few times.

For clarity, I was making an image change based on what was being hovered over.

This is the code you’ll find circulating, where menu_item is the ID or class, and image is the new image URL:


 function change_image(image_element, image){

      $(image_element).fadeTo(250,0.0, function() {
        $(image_element).attr("src", image);
        $(image_element).on('load', function(){
          $(image_element).fadeTo(250,1);
        });
       });
    }

This appears to work at first. The first one worked perfectly. But then the second one was slow. The third, slower, and so on, until it was no longer working.

The images were tiny, and cached, so it wasn’t an issue like that.

If you look at the console log or network log, you can see it firing multiple times, growing exponentially. What you want is to change

“on(‘load’…..”

to

“one(‘load’….”,

The idea is to make sure this is only fired once per item per event.

The working code:


 function change_image(image_element, image){

      $(image_element).fadeTo(150,0.0, function() {
        $(image_element).attr("src", image);
        $(image_element).one('load', function(){
        $(image_element).fadeTo(500,1);
        });
       });
    }

 

Also be aware of the initial animation: This can stack over time too.

Hope this helps!

 

Peter

Laravel Error: “The only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths.”

You might find that on deploying a project to a new server, you receive the error message:
“The only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths.”

Usually there’s no issue with the sever or incorrect cyphers, but you still receive it, and even after using what looks to be the correct cache related command.
For me, doing these three commands in order seems to resolve this issue:


peter@ABC:/var/www/exampleproject$ php artisan key:generate
Application key set successfully.
peter@ABC:/var/www/exampleproject$ php artisan config:clear
Configuration cache cleared!
peter@ABC:/var/www/exampleproject$ php artisan config:cache
Configuration cache cleared!
Configuration cached successfully!

Why do I need to run “php artisan config:clear” when it appears “php artisan config:cache” does that anyway? No idea! But it seems to help in my anecdotal experience.

Hope this helps someone else out heer, and me, in the future, when I come across this again.

Peter

How to Find Out Which Windows 10 Channel or Type of Licence You Are Using

You may well be interested in finding out if you’re running a Retail Key or an OEM Key, and so on. This is an easy way to do it that, for me, has worked since Windows 7:

  1. Press the start button in the bottom left
  2. Type “CMD”, and click on command prompt. (You may want to right click and choose “Run as Administrator” but I’ve found this is not necessary)
  3. Type “slmgr.vbs /dlv” into the command prompt (or simply paste) and press enter. A script will show up and tell you the information you need to know.

Hope this helps!
Peter

Turning Green in Zoom

I had some people inform me I was turning green. Not in a hulk way, but my whole video feed. I’ve been using Zoom for years as well, so this was strange, but nonetheless, that’s what was happening.

I’m not sure why, potentially drivers, but here’s how to fix:

Go to Settings > Video > Advanced: In the “Use hardware acceleration for” section, uncheck “Sending Video”.

This worked for me! Hope it helps someone else.

Peter