Python Script to Detect Corrupt Image Files (.jpg)

Over the xmas period i  found out that most of the files in my documents folder were corrupt.  I didnt want to delete them all so i decided to see if Python could help and sure enough it did.

So i wrote a script below to;

  • find all images in a folder and sub-dir’s
  • open then with a python library and see if the file is corrupt
  • move them to a folder and rename them

Massive help from people on stackoverflow.com

Laravel Error – SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes

Im currenlty running my way though Laravel 5 the PHP framework and following some tutorials. If your starting this framework you will most likely run into the error below when you run your migrations;

Illuminate\Database\QueryException  : SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter table users add unique users_email_unique(email))

The fix is simple;

Open the AppServiceProvider file and add the following line to the boot function;

via;

https://laracasts.com/discuss/channels/laravel/laravel-54-failing-on-php-artisan-migrate-after-php-artisan-makeauth?page=1

Angular 4/5 quick tips

 

 

 

 

 

 

how to add bootstrap:

add the scripts and styles to your “.angular-cli.json”

add the following the styles and scripts section;

create new project:

start server:

create new component:

create new service:

Windows 10 wiped all my hard drives without warning

With the recent news that the latest Windows 10 update build (1809) deleted users downloads;

Microsoft:
We have paused the rollout of the Windows 10 October 2018 Update (version 1809) for all users as we investigate isolated reports of users missing some files after updating.
(via engadget.com)

i thought id post this story which ive been too lazy to post about for months.  If anything it shows that Windows 10 is not all its cracked up to be.

Over the years ive installed every Microsoft Windows OS;

  • Win 95
  • Win 98
  • Win Vista
  • Win 7
  • Win 8
  • Win 10

Windows 10 is the only one of those Operation Systems that wiped four hard drives without even a confirmation prompt to say you were “going to wipe out 5 hard drives”.

So what did you do?
It was almost new years eve and well my Windows 10 install was getting more broken after each update and the October 2017 update gave constant blue screens when using bluetooth headphones.  So i thought dam im going to have to reinstall windows 10 and all the dam updates.   At this point i really didnt want to do this with college work and programming source code scattered all over the shop.

F*ck it!
I had made a point of always backing up my PC since a horrable incindet back in 2003 where i lost the source code to two applications i was working on (fucking Maxtor Hard drives).  So yes i had a back up which was on another physical drive other than the SSD drive that Win 10  was installed.

Fed up of blue screens and problems since the October 2017 update i decided i had to reinstall Windows 10.  So i seen in Windows 10 there was a “Reset this PC” feature;

 

 

 

 

 

 

 

I was hoping this was one of “Ronseal” moments where it does “exactly what it says on the tin”,  it didnt.

What could go wrong
I had a back up and was ready to go, so i pressed the “Get Started” button and thought great, it will all be fine.  Now this is the part that is kinda fuzzy ill admit, i cant remember what it said but i was sure that “nothing” would go wrong when i presses the enter button to “reset this PC” that as i pressed it i walked out of the room to get a cuppa Tea.

The horror:
I was away from the PC for a while and thought to myself “sure might as well let it do its thing” and ill watch some TV.

I had expected than when i would return to the PC that Windows 10 would be installed and ready to go.  An hour later i came back to the PC to see that it hadnt booted into any Windows 10/Any kinda interface, nothing.  Black screen and a DOS prompt saying the dreaded message;

“No system drive found”

Windows had mangled or rahter me the menu which Windows used to find the system drive to boot from. After using the BIOS to boot of the correct drive Windows 10 booted.

Not only had the the main Windows drive been wiped but all other internal hard drives were wiped with exception to the External USB 3.0 drive.

External USB Drive to the rescue:
For some reason Windows 10 didnt wipe this drive if it had it would have been an utter fucking nightmare.  I had my programming and college work from over the tears on this drive and somewhere in the “cloud” with Goggle Drive.

Theres hope:
I knew that when you delete a file its not really deleted rather the location where it was is marked as a place for new files to be written.  So i had not make sure that i didnt save or write anything to all the hard drives in question.

Recovery Software:
I had used recovery software before and i knew that

  • it can recovery a lot of files
  • it takes a very long time depeneding on the hard drive in question

So i needed to find the best recovery software available and hope that it would work.

Recommended software:
Figuring out which recovery software was the best was difficult but after a few days of trial and error i found that EaseUS Data Recovery Wizard was the best due to its simeple to use approach via a wizard which walks you through the steps of what drive to recover etc.

It was easy to use and recovery almost everything that was deleted.  Some files cannot be recovered but it managed to recover ALL of my Music collection which was nothing short of a miracle.

 

 

 

 

 

 

 

Notes:

This is not a  Paid advert but just a personal opinion from a Windows 10 nightmare.

Getting started with Python and the Django Framework part 1

So over the christmas holidays ive been keeping myself busy by learning more about the Python language.

Having learnt a few basics i started to try the Django framework which ive seen mentioned quite a lot.  Im reffering to windows mainly in this case see below for more detailed instructions;
https://docs.djangoproject.com/en/2.0/howto/windows/

Step 1:
Install python from the site below and install the necessary version for your Operating system.
https://www.python.org/downloads/release/python-364/

Step 2:
Once you get that installed, verify that python is installed by typing “python” from the windows command prompt;

 

 

 

 

 

 

Step 3:
Install Django framework via command prompt;

pip install django

Step 4:
Create your first project its best to refer to the offical document and tutorials at;
https://docs.djangoproject.com/en/2.0/intro/tutorial01/

From the offical site;

Creating a project

If this is your first time using Django, you’ll have to take care of some initial setup. Namely, you’ll need to auto-generate some code that establishes a Django project – a collection of settings for an instance of Django, including database configuration, Django-specific options and application-specific settings.

From the command line, cd into a directory where you’d like to store your code, then run the following command:

This will create a mysite directory in your current directory. If it didn’t work, see Problems running django-admin.

Retro gaming: Amiga Memories-[draft1]

My first Computer was an Amiga 600 and it was one hell of a machine for its time.  This was around the time of consoles like the SNES and SEGA megadrive which my friends had.

The specs: 7Mhz!
The Amiga 600, also known as the A600, is a home computer that was introduced at the CeBIT show in March 1992. The A600 is Commodore International’s final model based on the Motorola 68000 CPU and the ECS chipset. Wikipedia

Release date: March 1992; 25 years ago
Memory: 1 MB (80 ns access time); (6 MB Maximum, more with unofficial expansions)
Date introduced: March 1992
Manufacturer: Commodore International
Successor: Amiga 1200
CPU: Motorola 68000 @ 7.16 MHz 7.09 MHz (PAL)
Predecessors: Amiga 500, Amiga 500 Plus

 

Emulators:
An emulator is the software you need to run to create a virtual Amiga on your PC/MAC/Linux etc.  You need this software, its free and the most popular two ive found are below;
Games! Shows me the games!
Ive found a few sites where downloading Amiga Games or “Roms” below;

Youtube Movie Channels, you should be watching

I love movies,  so i started to wonder is there anyone on youtube who reviews the good the bad and the ugly movies!

So these are the movie discussion/review channels ive found that are well worth your time.  Got a favorite i didnt mention leave it in the comments!

  1. ralphthemoviemaker
    https://www.youtube.com/channel/UCZ04pLI44c0PWRzubEV6ogA
  2. I hate Everything
    https://www.youtube.com/user/IHEOfficial
  3. Oliver Harper:
    https://www.youtube.com/channel/UC4zKSynEH_sLA1TC8_kU0gQ