Fix Android can’t write to SD card error with Windows 10 / 11 without formatting it

Android users using an SD card in their phone might be presented with an error message stating that their SD card is read only and that to protect the card it’s not possible to write to the card. Annoying because the SD card is pretty useless if you can’t write to it.

The error comes from System UI and states:

Can’t write to SD card. Your SD card isn’t working correctly and has been set to read-only to prevent data loss. Backing up the data on your SD card is recommend.

Many solutions on the internet are either outdated or require a format, which means you will lose all your data.

A more simple solution is possible if you have an external microSD card reader/writer. These can be obtained for a couple of dollars/euros pretty much everywhere.

Step 1
Open your phone and remove the microSD from your Android phone and insert it in your card reader/writer.

When the card is inserted, Windows 10 or Windows 11 probably won’t read it and mention that the storage device needs to be formatted.

But don’t format it!

Step 2
Open Windows File Explorer to see which drive is attached to the card reader with your microSD card. This could be e.g. D: or E: or any other letter of the alphabet.

Step 3
Then find cmd.exe and start as an administrator (how to). From there type:

chkdsk /f drive:

In my case, the card reader was the h: drive, so I typed:

chkdsk /f h:

After you press enter, you will probably see a lot of text appearing on your screen, just wait till it’s finished.

Step 4

After it’s finished, make sure you properly remove the microSD card. Use the eject hardware option available in the system tray, at the right bottom of your screen, next to the time and date. Still don’t know how to do that? Read more here on how to properly eject your microSD card. Don’t forget this step, or your card might be corrupt again!

Put the microSD card back in your phone
After that, try the card again in your phone, and it should work!

If your microSD still isn’t fixed, then it might be even more corrupt.

Still not fixed? Try this more powerful, but also more time-consuming trick!
Repeat the former steps, but instead of chkdsk /f drive:, use:

chkdsk /r drive:

So in my case:

chkdsk /r h:

This will do a much more thorough scan, pretty much on hardware level. The disadvantage is that it takes a lot of time, hence you better first try the /f option. Be warned, this might take hours!!

Hope this helps!

Posted in Uncategorized | Leave a comment

Installing NVMe M.2 PCIe SSD on Windows 10 and make it boot

I got a Corsair Force MP510, a blazing fast NMVe M.2 SSD and I couldn’t get Windows 10 to boot from it. It succesfully installed all the time, but never decided to boot Windows 10 for me.

What a dissapointment, since the drive is so fast, I didn’t want to restort to an older SSD and didn’t give up. There is so much crappy advice on the web, including many times the advice to RMA the device. But that might be way too drastic I decided.

Finally, after lots of trying with Windows tools like bootrec and diskman, I decided it had to be some BIOS setting and I was right.

To install a NVMe M.2 PCIe drive, follow these steps:

  1. Make sure the M.2. is the only drive that can be found (disconnect all other drives or disable them in the BIOS)
  2. Boot into your BIOS (usually means pressing F1 or ESC during boot)
  3. Disable, or make sure it is disabled, CSM ( Compatibility Support Module) UEFI, you should find it in the Startup/Boot section of the BIOS
  4. Make sure Secure Boot is enabled
  5. Format your drive. This is e.g. possible by choosing repair this computer during Windows 10 Setup and then getting into the command line.
  6. Restart your computer
  7. Go into the BIOS again
  8. Enable CSM/UEFI
  9. Disable Secureboot
  10. Go into the installer and follow the steps
  11. Then go back into the BIOS and confirm that the Windows Boot Manager is listed with your new NVMe drive
  12. Enable Secureboot again and install the default (factory) keys
  13. Save and exit
  14. You should be good to go!
  15. Let us know if that helped you….
Posted in Uncategorized | Leave a comment

Install Netbeans 11 and skip Java Development Kit (JDK) not found error

Since Netbeans is my IDE of choice, it was one of the first things I installed on my new PC. running Windows 10. I went straight away with the latest Netbeans version, which was version 11 at that time. Unfortunately installing Netbeans 11 was a pain, I got stuck with the installer stating Java SE Development Kit (JDK) not found on this computer.

The installer hints that using –javahome you can point the installer to the folder where the JDK is installed. However that never worked for me as well. If you have the same issue with installing Netbeans 11, you might want to know there is a fix.

Step 1

Make sure you have Java SE installed. E.g download the latest version from this page.

Step 2

Download the installer for Netbeans (on Windows) and then nagivate to the file. Run the Windows command line (cmd.exe) as Administrator and then run this command:

{filename.exe} --extract.

You will notice that the installer will start to extract files without doing any additional checks (such as for the JRE/JDK/Java whatever requirements).

Step 3

After that, run the command:

java -jar bundle.jar

Now setup should start and guide you through all next steps

Posted in Uncategorized | Leave a comment

Terrible experience with BDO Groningen

For my company I hired an accountant in Groningen, The Netherlands. In my case BDO Groningen. They also advice on taxes but unfortunately don’t understand that their clients benefit from paying less taxes.

An advice I received was described too near in the invoice which resulted in not being able to deduct it from taxes as a cost.

After mailing a couple of times, the company never wanted to change the description in such a way that I could deduct it from taxes. While my company always plays by the rules, there were some good arguments why it could be changed, at least for part of the process.

The end result,  a whopping 1400 EURO extra in tax obligations. Thank you BDO Groningen…

Posted in Uncategorized | Leave a comment

WordPress 3.5 – Image / Gallery Media uploader to custom plugin / meta box (easy)

With this simple and relative short code you can add the WordPress 3.5 Media Uploader to your own plugins. It will return single or multiple images and returns them in a comma seperated list.

If you want to return other attributes then  monitor the attributes using the console.


jQuery(document).ready(function(jQuery){

jQuery('#image_button').click(function(e) {
 e.preventDefault();
 frame = wp.media({
 title : 'Add your title here',
 frame: 'post',
 multiple : true, // set to false if you want only one image
 library : { type : 'image'},
 button : { text : 'Add Image' },
 });
 frame.on('close',function(data) {
 var imageArray = [];
 images = frame.state().get('selection');
 images.each(function(image) {
imageArray.push(image.attributes.url); // want other attributes? Check the available ones with console.log(image.attributes);
 });

 jQuery("#imageurls").val(imageArray.join(",")); // Adds all image URL's comma seperated to a text input
});
 frame.open()
});
});

 


<input type="text" name="imageurls" id="imageurls" />
 <input type= "button" class="button" name="image_button" id="image_button" value="Add Image(s)" />
2 Comments

Fixing WordPress error: An error occurred in the upload. Please try again later

I’ve been spending a considerable amount of time in fixing the WordPress error: An error occurred in the upload. Please try again later. I received this error when trying to add image upload functionality to my own custom plugin.

I had a hard time debugging and first focussed on the Javascript. Unfortunately I couldn’t find the cause of the error and nearly gave up.

Then I remembered the obvious. The media upload element uses Ajax for uploading and return information about the uploaded image.

I assume you have WP_DEBUG = true in your config file, if not, make sure to add it to wp-config.php.

After that, use FireFox or Chrome developer tools and monitor the Ajax requests. You’ll notice requests to admin-ajax.php and async-upload.php. By looking at the responses the error was obvious, there was a conflict with (in my case, the custom permalink plugin) which gave me notices in the Ajax response. When I changed some code, it was solved and uploading media worked great!

So if you want to debug the mentioned issue, then make sure to monitor the Ajax requests, you might find the cause. Good luck and feel free to ask in case you need help!

2 Comments

Google now also reports about old versions of software

When I logged in to Google Webmastertools today I was presented with a message that I’m using an old version of Vbulletin on one of my websites. Vbulletin is currently in the 4.x.x. version but in the 3.x.x versions there is still a maintained one, which we’re using. But it’s probably good that Google monitors for it as many outdated versions come with security vulnerabilities. I hope to update to the 4.x.x. branch soon but as our forum is rather large this is more than simply running the update script.

Leave a comment

WordPress wp_list_comments callback explanation

When working with comments you might want to drastically change the appearance of the comments. You can use a new comment template with

comments_template( '/my-comments.php', true )

which you call from the template where you want to list the comments. But if you want each single comment to be different, you can use the callback function of wp_list_comments.

You use wp_list_comments in your comments template. Default is comments.php in your theme function, but if you used the comments_template function from above, you have to look for that file (of course). You should see wp_list_comments like the The Loop on it’s own. It goes through all of the comments and lists them. With the callback you can modify The Comment Loop and totally make it to your own likings.


<?php 
global $my_object;
wp_list_comments(array('type' => 'all', 'callback', array($my_object, 'my_custom_comments'));
?>

I’m using classes in my plugins, hence the inclusion of the global, you can also put the function in your functions.php and simply remove the references to the object. Then you can create a function in your class or functions.php and start the fun:


function my_custom_comments($comment, $args, $depth){
        
        $GLOBALS['comment'] = $comment;
    
        comment_text();
        
    }

In it, you can use the Comments Tags which are listed here. Questions? I’m happy to help you a little further, so don’t hesitate to post!

Posted in Uncategorized | Leave a comment