‘cp932’ codec can’t encode character ‘\xa1’ in position 62: illegal multibyte sequence

When using print in python with some multibyte character or when decoding from another encoding you might encounter this fatal error:

Traceback (most recent call last): File "skynet.py", line 28, in print(skyname_wakeup_word) UnicodeEncodeError: 'cp932' codec can't encode character '\xa1' in position 62: illegal multibyte sequence

To sort of fix it, you can use

skyname_wakeup_word.encode('cp932',"ignore")

This occurs because python can’t convert that character to the traditional windows ansi used in windows terminal (cmd). cp932 is code page 932 the Japanese version of shift-JIS.
Other encodings: cp874, cp936, cp949, cp950, cp1251, cp1252, cp1253, cp1254, cp1255, cp1256, cp1257, cp1258. Source

How to test nginx configuration without breaking down the server

You simply use t and c flags followed by config file

sudo nginx -tc /etc/nginx/nginx.conf

This can give you output like this when ok:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

t flag according to man nginx means : Do not run, just test the configuration file. nginx checks the configuration file syntax and then tries to open files referenced in the configuration file.

c flag means: Use an alternative configuration file. the config file path should come after the c flag.

Why you should use this instead of restart? or reload? because when you do sudo service nginx restart and your config file is broken you’ll affect the whole server and if you have multiple websites that means all sites go down possibly because of some little curly boi ; . reload might not do anything when there is error. to be safe always test config before reloading or restarting. even if you do simple changes to main nginx config or sites configs.

IE 11 not opening, crashing on Windows 10 after upgrade from windows 7, How to solve

After upgrading from windows 7 to 10,  IE 11 doesn’t open.  I have searched a lot but didn’t find a solution.  One solution suggested it was due to logitech camera’s process monitor. but removing that didn’t solve the problem.   The error log in event viewer was this:

Faulting application name: iexplore.exe, version: 11.0.10240.16412, time stamp: 0x55b99d3f
Faulting module name: ntdll.dll, version: 10.0.10240.16430, time stamp: 0x55c59f92
Exception code: 0xc0000409

After some digging, it turned out it was due to EMET 5.2 Microsoft mitigation service.  seems Microsoft security service breaks its own program.   I uninstalled it, IE 11 worked. I reinstalled it after downloading it again from Microsoft site.  IE 11 stopped working.  I opened EMET notification and went into apps and tested the different checkboxes for IE.  unchecked EAF and leaving other checks worked.

TL;DR;  If you have EMET 5.2 installed, opening EMET, going to APPS -> unchecking EAF in front of Internet Explorer and then OK should make IE work again.  what security implication that means not sure. but Microsoft should fix this soon.

 

Fail while upgrading to windows 10 from 7, Error 0xC1900101 – 0x40017: Potential fix

I have tried to upgrade windows 10 from 7 for 5 times but failed. It reverts back to windows 7 then displays a window with error in second_boot with number 0xC1900101 – 0x40017 but on my 6th attempt I was successful.
IMG_7619 - Copy

 

Logs are stored in c:\windows  beside windows bt and ws.   I assume the ones where I could find the reason for failure get deleted once windows recover to previous version.  so if you face a problem tries to copy those logs when it restarts using a linux installation or Live CD.  then search for *.log  in c:\windows   setuperr.log and setupacc.log should have useful information.

Before the last successful attempt. I did the following:

1. sfc /scannow this by the way always discovered errors for me not sure why.

2. updated everything from windows update. except security essentials.

3. From previous failed attempt I already uninstalled Avast. I turned off firewall in my second failed attempt but turned it back on.

4. Unplugged all USBs except keyboard and mouse.

5. Removed some hidden and left over drivers, please see this: https://support.microsoft.com/en-us/kb/315539

6. Uninstalled some potential troublemaking software particularly media center extenders, Media center is gone from Windows 10. so they can be trouble.
Here are some drivers I removed.
– Old Nvidia display driver. because I switched to AMD.

– HP printer. My HP printer already broken. and I found out so many HP printer driver leftovers something like 10 . I removed their software(s) a lot of them and each one trying to restart the computer anyway. ugh HP

– PC USB driver for OneSeg TV. probably you don’t have this.

– PCI driver for Satellite TV tuner card. this works with Media center so it is useless.

– Removed all usb drivers that are not active. they include several flash drives. also drivers for hard disks I no longer have.
I think what likely fixed the issue is 5 & 6 particularly media center extenders and old drivers for Nvidia. when I installed AMD I didn’t uninstall Nvidia first. but there is good chance that HP with their horrendous software and/or other usb drivers caused the issue. I suggest you try the same but be careful you don’t remove something essential. Make sure to restart after you do all.

Also I tried the install from ISO. but I don’t think related, but my previous 5th attempt was from ISO too.

Finally, there is a slim chance that weird funny thing happened when I logged in to Linux when it restarted after 70% that magically fixed the issue.

Construct 2: Convert array or key/values to a c2_dictionary json object

Here is a converter I made to convert a one dimensional php array or simple key/values to a c2_dictionary json object to load json data from string into a dictionary object for construct 2 game maker

OR:

“key”=>”value”,

Add reversed key value to allow for easy lookup by key/value (e.g. beside key:value, value:key)