Unity Fatal Error: dataOffset !=file.GetPosition()

I was importing a package from Unity store and got this error:

Fatal Error:
dataOffset !=file.GetPosition()

There are probably many reasons why this error can appear but the first thing you should do is check if there is insufficient space on your computer’s hard disk (the one where you keep your projects and also the one where you keep Unity – if they are not on the same disk). I got this error wile importing very large assets package from the Asset Store Window.

So, delete some files (that you do not need anymore) from hard drive and you should be fine.

If you need to to see what makes your disk full, you can use TreeSize Free tool.

 

 

WordPress Custom Fields missing in admin (post or page)

This is a very specific problem so it might only work for some. After I updated WordPress and all plugins on an old site that used WordPress Custom Fields to enter some data, the Custom Fields in admin disappeared. I could add a new post but Custom Fields were nowhere to be sen, not even in the screen options.

Long story short, after doing some searching on the net, I found out it was ACF (Advanced Custom Fields) fault. In new version of the plugin they disable WordPress Custom Fields because they think you are using ACF anyway so no need for both. Not sure I agree but here is 2 ways you can try to solve it:

  1. If you activated ACF but are not using the plugin, just disable it.  WordPress Custom Fields should come back.
  2. If you want to keep both then add this code to your theme’s function.php file (the best is the child theme, if you have one)
    add_filter('acf/settings/remove_wp_meta_box', '__return_false');

WordPress Custom Fields should reappear now.

Using Laragon for Laravel projects

I am in the process of migrating one of my sites from Codeigniter (anyone remember it? It promised so much but then fell behind, especially when Laravel came out years ago) to Laravel. It’s been a while since I used Laravel but I always love developing with it.

I always use XAMPP for local development but luckily I googled for alternatives and found Laragon. What an awesome find. At first I thought it was just for Laravel, due to name Laragon but you can use it for everything.

So here is how easy it was to install latest Laravel and start local development.

  1.  Go to Laragon website and download it, full or lite. Install (also select development folder) and start the services. Now you have a running web server!I changed few preferences (I don’t want it to start with Windows but I want it to start minimized and start ALL services at once) but you can do whatever is best for you.Another great thing: It comes with my favorite Console Emulator CMDER (not my screenshot):
  2. Let’s install Laravel. Right click blue (or green) Laragon tray Icon -> Quick App -> Laravel, name the project (folder)  and Laragon will begin to install Laravel via console. If you get asked for admin permission to open console (for hosts if I remember correctly) say yes.   When it finishes you should be able to open the web at ProjectName.test . I have to say that the first time I installed Laravel the scripts in console did not finish so it didnt work. I deleted the project folder, restarted the step  2. again and then it worked – Laravel was installed!
    laragon install laravel
  3.  I noticed that phpmyadmin was not installed. It is super easy again to install it :  Right click blue (or green) Laragon Icon -> Tools -> Quick Add -> *phpmyadmin . Wait few moment and you can access it at localhost/phpmyadmin/

And that is all. I installed local web server, Laravel and phpmyadmin with few clicks.

Unity 2019 error: Feature `out variable declaration’ cannot be used because it is not part of the C# 4.0 language specification

After upgrading Unity editor from 2017 to 2019 you might get some of these errors when you update your old project and hit play:

…/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMPro_UGUI_Private.cs(1865,73): error CS1644: Feature `out variable declaration’ cannot be used because it is not part of the C# 4.0 language specification

…/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMPro_Private.cs(1916,130): error CS1644: Feature `out variable declaration’ cannot be used because it is not part of the C# 4.0 language specification

there are other scripts that might give error: TMPro_UGUI_Private.cs, TMPro_Private.cs, TMP_Text.cs, TMP_MaterialManager.cs,… lots of them.

The solution is simple:

Go to : Edit -> Project Settings -> Player -> Other Settings -> Configuration

and change Scripting Runtime Version to .NET 4.x Equivalent, click RESTART and all those errors should disappear.

Scripting Runtime Version

Curl Error : SSL certificate problem: unable to get local issuer certificate Laravel Wamp

Got this error when trying to use a Laravel API package that used Curl:

Curl Error : SSL certificate problem: unable to get local issuer certificate

I am using WAMP (local development) so the solution that worked was this (Let’s assume your PHP version is 7.1.9):

1. Download/save this file: http://curl.haxx.se/ca/cacert.pem into (your wamp path might differ) the C:\wamp64\bin\php\php7.1.9 folder.

2. Now you have to edit php.ini file but in my case it was not the one that is in the above folder (I tried that one first but still got the same error) but it was the one in this (your wamp and apache folder might differ) folder:  C:\wamp64\bin\apache\apache2.4.27\bin . The easiest way to open this file is to click on the green W (Wamp) icon in the tray, then PHP and then php.ini and Windows should open this file for you.

3. Find this line
;curl.cainfo
and change it to :
curl.cainfo = "C:\wamp614\bin\php\php7.1.9\cacert.pem"
Dont forget to remove the ; at the start of the line and of course use your wamp path.

4. Restart (or exit and start) the WAMP server and the error should be gone!

 

Laravel Composer using the wrong PHP version

I installed WAMP for offline development, then Composer and then Laravel. Everything was OK until I used Composer to download some Laravel package and I got this kind of error:

This package requires php >=7.0.0 but your PHP version (5.6.25) does not satisfy that requirement

Number don’t matter but I needed newer PHP. OK, I changed PHP version on WAMP, restarted it..and Laravel composer gave me the same error!

Long story short, after an hour of googling and trying all the suggested solutions like editing composer.json and this and that, nothing worked!

The solution is simple: reinstall Composer! D’oh!

When you run setup you can select the PHP version you want Composer to use (of course you have to have this PHP version installed on your PC or server) and the Composer will use it from then on:

 

laravel composer php version

After doing this this I was able to install the package. To be honest, I was quite upset that so many people offered some complicated solutions (that didn’t even work for me) on various forums and wasted my time when the solution was so simple.

 

 

 

Cmder displays {lamb} and {git} instead of λ and current dir

I recently installed cmder for Windows and when I ran it it was displaying {lamb} and {git} instead of λ and current dir.

Cmder displays {lamb} and {git} instead of λ and current dir

It came with the 0.4.2 version of Clink , which apparently is incompatible or doesnt work best with Windows 10.

Solution is very simple:

1. Go to https://mridgers.github.io/clink/ and download ZIP version of  Clink (.exe is probably OK too but I downloaded ZIP). The new version I downloaded was 0.4.9.

2.  Go to the cmder_mini/vendor folder (where you installed cmder) and rename clink folder to something like clink_original (or you can delete it if you like but I prefer to backup first if something goes wrong) and recreate a folder named clink  and simply extract all files from the downloaded ZIP to this folder.

3. Close (if you had it open) and restart cmder and this is what you should see:

cmder clink

Prevent Windows from updating/reinstalling a driver

This is for Windows 10 but will probably work on other Windows versions too.

Windows 10 is still relatively new so some vendors (looking at you Lenovo) haven’t updated the drivers. For example in my case I had problems with Conexant driver for Windows 10 – microphone didn’t work in some programs. To make the long story short, I tried everything and the solution was to uninstall the driver and use older version. The problem was, Windows 10 kept reinstalling the latest driver!

The solution was this: Install Microsoft tool that “hides” specific driver form Windows so Windows doesn’t “see” it and doesn’t update/reinstall it.

So:

  1. Uninstall or rollback the problematic driver until you have the one that works.
  2. Download this tool:
    Note: I am linking to Microsoft site and not directly to file download so you can be sure that there isn’t some virus or some malware file on the link.
  3. Click Hide Updates, like on photo below.hide updates windows
  4. You will see a list of drivers. Select the driver you want to hide from Windows update and Windows will not update this driver anymore. Click next, wait and that’s it.

If you want Windows to update the driver again, the run this tool again and select “Show hidden updates” and then remove the hidden driver.

Global variable set in the template’s header.php is empty in footer.php

If you set up a global variable in the header you would expect that it would be available everywhere, right? That is the definition of the word ‘global;, right? Well, it doesn’t work like this and the reason is because in WordPress header and footer are called via functions so the variable is only accessible in scope of each function.

One of the solutions is simple – use global variable before the declaration AND before echoing.

For example, add this to header.php:

<?php global $var; $var= "something"; ?>

and then in the footer.php you do this :

<?php global $var; echo $var; ?>

and it will echo the content of your $var variable.

Be advised though that some people say using global variables is not the best practice.