Archive
Fix: javascript location.hash throttling issue with IFrame
I had implemented a simple (and most importantly working in older browsers too) way of communication between an IFrame and its parent page via location.replace(“#” + hash), which doesn’t add entries to history like location.hash=… does, and the onhashchange event, when I noticed Edge-Chromium was throwing a “Throttling navigation to prevent the browser from hanging.” error and the lon/lat fields I had on my test page wheren’t updating anymore when I was dragging quickly for a while my location picker marker on an OpenLayers map. If I released the marker and tried after a sec it was starting working again.
since the URL shown in the error message redirects to some page that has permission denied, I looked up a discussion that explained the “–disable-ipc-flooding-protection” Chromium switch to turn off that protection, however I was not having any loop in my code that was mentioned in that discussion as probable cause.
https://stackoverflow.com/questions/55925936/angular-7-throttling-navigation-to-prevent-the-browser-from-hanging
On Firefox there was a similar error but with other message:
Searching about it I read about the “debouncing” concept (to avoid flooding some API with consequtive requests too fast/often) at
and
https://stackoverflow.com/questions/35991867/angular-2-using-observable-debounce-with-http-get
And ended up finding a simple implementation of it at
https://medium.com/@griffinmichl/implementing-debounce-in-javascript-eab51a12311e
that I adapted to run in older browsers (like IE11) too:
function debounce(func, wait) {
var timeout;
return function() {
var context = this;
var args = arguments;
clearTimeout(timeout); //clear previous scheduled execution if still pending
timeout = setTimeout(function() { func.apply(context, args); }, wait);
}
}function setLocationHash(hash) {
window.location.replace("#" + hash); //don’t set window.location.hash directly, adds entries to browser history
}setLocationHashDebounced = debounce(setLocationHash, 20);
//this will make sure any setLocationHash calls that occur within 20msec replace any pending ones (all are timed to execute in steps of 20msec)//…
function markersUpdated(otherLocations) { //callback
theOtherLocations = otherLocations;
if (theOtherLocations.length > 0) {
var hash = theOtherLocations[0].toString();
setLocationHashDebounced(hash);
}
}function hashChanged() {
var hash = window.location.hash.substring(1);
if (hash.length > 0) {
var hashParts = hash.split(‘,’);
if (hashParts.length >= 2){
var location = [hashParts[0], hashParts[1]]; //[lon, lat]
map_addOtherMarker(location); //Note: this will just move selected marker if existing and otherLocations.length = _maxOtherLocations > 0
if (hashParts.length >= 3 && hashParts[2] == "zoom")
zoomToLocation(location);
}
}
}
HowTo: make raw_input & input work the same in both Python 2 and 3
Was just trying to make a Python 2 script work in Python 3 and at first it seemed I just needed a small change to add missing parentheses to the argument of a couple of print statements.
But then another issue came up, it wasn’t understanding the command raw_input(somePrompt) that was occuring at various places in that file to input text from the console.
Various solutions were proposed at
https://stackoverflow.com/questions/954834/how-do-i-use-raw-input-in-python-3/62825723
but I think I came up with a cleaner looking solution that works in both Python2 and Python3, that should allow one to use either raw_input or input in both Python2 and Python3 with the semantics of Python2’s raw_input (aka the semantics of Python3’s input).
# raw_input isn't defined in Python3.x, whereas input wasn't behaving
# like raw_input in Python 2.x. This should make both input and raw_input
# work in Python 2.x/3.x like the raw_input from Python 2.x
try: input = raw_input
except NameError: raw_input = input
In practice this came up from ideas at other answers on that SO thread. It tries to define input as raw_input which should fail in Python3.x since raw_input is undefined. In that case it will catch a NameError exception and do the reverse, aka define raw_input as input. However in Python2 the first command should execute fine, overriding the insecure input of Python2.x to work the same as raw_input (not trying to interpret input strings that is). Actually that is what Python 3.x input does.
Wonder why they didn’t declare it like that in the first place though, breaking compilation of Python2 programs. After all semantically only Python2 programs that were using the old insecure input would have an issue, not those that were using raw_input which is the semantics Python3 promotes with its newer input.
HowTo: Use DISM and SFC tools to check+fix your Windows installation
If you’re having issues with your Windows 7 or newer, you should consider whether its installation has become corrupted (due to malicious software or hard drive errors).
After doing a disk check (say by right clicking the appropriate drive under my computer and selecting Properties, then Tools tab and Error checking) and a complete virus scan (on Win10 you can click the shield icon of Windows defender in the taskbar tray and at scanning options choose to do a full scan – or if you have installed some third-party antivirus double-click its icon in the taskbar tray and when its GUI opens up opt to do a full scan), then try the following steps to repair your Windows installation:
1. Press WIN+R to open Run dialog
2. Type in:
CMD
Hold down CTRL+SHIFT keys and click OK to open the command line window in Administrator mode (do press Yes at the User Account Control prompt)
A (usually) black text-based console window will open up and you’ll be greated with something like:
Microsoft Windows [Version 10.0.18363.720]
(c) 2019 Microsoft Corporation. All rights reserved.
and then a prompt like:
C:\Windows\system32>
3. Type in the following and press the ENTER key:
DISM.exe /Online /Cleanup-image /Scanhealth
and press ENTER to execute the DISM tool with the option to check the windows image health and wait patiently for it to complete
Deployment Image Servicing and Management tool
Version: 10.0.18362.1Image Version: 10.0.18363.720
[==========================100.0%==========================] The component store is repairable.
The operation completed successfully.
4. In case you see a message that the component store is repairable, then when greeted with the C:\Windows\system32> prompt again, type in the following and press ENTER:
DISM.exe /Online /Cleanup-image /RestoreHealth
to repair the Windows image:
Deployment Image Servicing and Management tool
Version: 10.0.18362.1Image Version: 10.0.18363.720
[==========================100.0%==========================] The restore operation completed successfully.
The operation completed successfully.
If RestoreHealth fails and you’re on Windows 10, then you should checkout this article:
https://www.tenforums.com/tutorials/16397-repair-install-windows-10-place-upgrade.html
on how to do an in place upgrade of Windows 10, opting to keep your settings and apps
5. If all goes well you’ll see that the restore operation completed successfully and you’ll be taken again to the command-line prompt C:\Windows\system32>
Now that the windows image is checked and fine, you should check your Windows installation against that image, giving the following command and pressing ENTER:
sfc /scannow
Beginning system scan. This process will take some time.
Beginning verification phase of system scan.
Verification 100% complete.Windows Resource Protection found corrupt files and successfully repaired them.
For online repairs, details are included in the CBS log file located at
windir\Logs\CBS\CBS.log. For example C:\Windows\Logs\CBS\CBS.log. For offline
repairs, details are included in the log file provided by the /OFFLOGFILE flag.
After any automatic repairs you should see the prompt C:\Windows\system32> again. Now repeat the same step till you see no more errors found and repaired.
sfc /scannow
Beginning system scan. This process will take some time.
Beginning verification phase of system scan.
Verification 100% complete.Windows Resource Protection did not find any integrity violations.
When back at the C:\Windows\system32> prompt with no errors found and repaired, just close the console window or type in the following and press ENTER:
exit
Fix: Microworlds Pro installer showing gibberish instead of Greek
A friend sent me the other day a screenshot from the installer of Microwords Pro Greek version on Windows 10 that was showing gibberish instead of Greek. At their school on Windows 10 it was showing up fine, so they wondered what the issue was.
They mentioned that on Windows 10 english it was showing fine. So we did try changing the preferred language order of Windows (at Laguage preferences in settings), to put English first (clicking on a language there shows arrows to reorder them, but has no drag action allowed btw), then Greek and try installing again, but the issue was still the same.
Note that at first I had wondered if it was a similar issue with the OwnCloud client installation that was showing an unexpected language instead of English, but since the screenshot was showing gibberish chars I guessed it was indeed showing Greek, but at some unexpected encoding for the system’s codepage. Note that codepages are a thing of the past and not needed for Unicode programs, but they’re still needed for older programs that just used a single byte (that couldn’t fit all posisble characters in the world) to encode a character.
I noticed it was showing a WinRar icon at that installer, so wondered if they had WinRar installed, but since installers are usually self-contained, I guessed the installer had been built with some older non-unicode WinRar engine version or something.
So I suggested going to Control Panel > Change Display Language > Administrative > Change System Locale for non Unicode programs and choose Greek there instead of English and indeed it worked.
Note that to find Control Panel on recent versions of Windows 10, the easiest way is to press the Search icon on the taskbar and then type “Control Panel” (or “Πίνακας Ελέγχου” if you’re on a Greek system). On the first Windows 10 editions you could just right click the Windows 10 Start/flag button on the taskbar and select Control Panel from the popup menu shown, but it seems they’ve removed that with recent updates.
This is useful to know since it usually affects most older non-Unicode programs that expect the system to work with a specific codepage. Microsoft used to have a utility that allowed one to switch the system codepage separately for various programs instead of doing a system-wide change, but it was hard to find even back then (plus didn’t allow redistribution) and most probably doesn’t work on newer systems.
Fix: Cisco Webex Meetings install fail (AddDllDirectory @ KERNEL32.dll)
Looking into the following error message occuring with Cisco WebEx Meetings installer on Windows 7, found this useful discussion:
where the following are suggested:
– install Update for Windows 7 (KB2533623) from Microsoft:
https://www.microsoft.com/en-us/download/details.aspx?id=26767
– video tutorial:
https://www.youtube.com/watch?v=TpRRiMGJ_xA
And an extra tip, in case you after the installation, when you try to connect via a meeting URL, you see this dialog:
then try enabling TLS 1.1 & 1.2 at your browser (e.g. was told Chrome on Win7 had then both off). See how to do this for various browsers at: https://knowledge.digicert.com/generalinformation/INFO3299.html
Regarding TLS 1.1 though, mind you that it is considered insecure – so you might decide to skip enabling it (and try just enabling TLS 1.2) unless you can’t find some other solution. Quoting recent article on TLS 1.0 and 1.1 protocols:
Microsoft announced today that it will delay disabling support for the insecure Transport Layer Security (TLS) 1.0 and 1.1 protocols from Microsoft web browsers because of the current global situation until the second half of 2020, with an estimated time of roll out during July. “For the new Microsoft Edge (based on Chromium), TLS 1.0 and 1.1 are currently planned to be disabled by default no sooner than Microsoft Edge version 84 (currently planned for July 2020),” Kyle Pflug, Microsoft Edge Developer Experience Principal PM Lead, said. “For all supported versions of Internet Explorer 11 and Microsoft Edge Legacy (EdgeHTML-based), TLS 1.0 and TLS 1.1 will be disabled by default as of September 8, 2020.” https://www.bleepingcomputer.com/news/security/microsoft-delays-disabling-insecure-tls-in-browsers-until-july/
Fix: make ownCloud installer display in English language
OwnCloud is an interesting solution for setting up a file sharing cloud for a group of people.
However,one issue I’ve found with its Windows desktop client’s current version (which looks clean of any viruses since I always check first) is that if your Windows 10 is configured with a preferred language that the desktop client’s installer doesn’t have localization support for, then it doesn’t show up in English as you’d expect, but in Czech or someother language that most of us don’t know how to read.
So I tried running it’s MSI installer (ownCloud-2.6.1.13407.13049.msi) with –? parameter from the command-line and the /g languageCode parameter mentioned there looked promising, but trying /g en for English didn’t work. I guessed it needed some specific language code number (and not double-letter language code like en for English), since the help text was mentioning to see Windows Installer SDK for more help.
After a quick search I found an article that suggested passing the parameter Productlanguage=1033 to an msi installer on the command-line for it to ALWAYS show in English. And indeed it worked.
To open a command window one can click the Search icon on the windows taskbar and type CMD then press ENTER.
Then they can drag-drop the .MSI file of ownCloud installer onto the black command-line window that opens up and type an extra space char and then Productlanguage=1033 before pressing ENTER to launch the ownCloud installer in English. After that they can close the command-line window at anytime.
Since many users may be uncomfortable with such instructions, one could provide an msiEnglish.bat file that just contains
%1 Productlanguage=1033
User could drag-drop the .msi they want onto that msiEnglish.bat file and it would run the msi installer being displayed in English language, irrespective of any preferred language settings at the Windows operating system.
Of course the best thing would be if ownCloud fixed their desktop client installer to fallback to the Engish language (set it as default) if it can’t find localization strings for the currently prefered language of the user. Have filed an issue at https://github.com/owncloud/client/issues/7825
Fix: Buildbox activation issues on load
Buildbox is a wonderful game authoring tool (that spans the whole nocode-code continuum, including the low-code aspect). It now has a free version too with nice templates and tutorials included.
I had an issue with the Windows version (it also has an indentical MacOS-X version since it’s a Qt-based app) where it was complaining about activation issue at startup and couldn’t proceed.
To solve that you can remove activation info (which won’t be removed if you just do uinstall and reinstall) by deleteing the com.eightcell.buildbox subfolder at:
C:\Users\YOUR_PROFILE_NAME_HERE\AppData\Local\eightcell\Buildbox\
Next time you run Buildbox.exe it will show activation dialog and you can enter your registration key (even the free version has one that you can download from your free account at http://buildbox.com)
With the latest Buildbox 3 there seems to exist an extra com.eightcell.buildbox3 subfolder that you could delete or just rename the main.iblicense files in there to main._iblicense. The launch Buidlbox again to see the activation dialog.
There probably exists some bug in Buildbox that causes one to repeat this action often.
So you could add a RESET_BUILDBOX_LICENSE.BAT file to your desktop with the following commands to delete the license file:
del "%AppData%\..\Local\eightcell\Buildbox\com.eightcell.buildbox3\main.iblicense"
@pause
Fix: Acer Aspire One (AS1) ZG5 blank screen at startup
Seems Acer Aspire One (AS1) ZG5 can have a recurring problem, esp. if its battery is near its end of life. If it shuts down abruptly its BIOS settings seem to get corrupted and its BIOS instead of discarding them seems to freeze.
Luckily they have a way to update the BIOS via USB key at machine power up. Flashing the BIOS (even to the same version) will fix the issue. Probably resetting the BIOS NVRAM data would do the same, but since you can’t boot this is the way to do it (without fiddling with the hardware directly that is).
The process suggested by ACER in case you come across this issue is the following:
Create a recovery USB drive to update the Bios on the unit.
The specific steps to perform this recovery with the USB drive are:
1. Download & Extract BIOS_Acer_3310_A_AOA110 & AOA150 (found in https://www.acer.com/ac/en/US/content/support-product/60?b=1)
2. Rename the Bios name from 3310.fd to zg5ia32.fd
3. Copy zg5ia32.fd and Flashit.exe to USB flash drive.
4. Start the restoration process:
- Plug the AC Adapter into the unit.
- Insert the USB flash drive into a USB port.
- Press and Hold down the Fn and the Esc keys together.
- Keep these keys held down and press power.
- When the unit’s power light comes on release the Fn and Esc keys.
- After the keys have been released the power light will start to blink.
- Let the unit run and after approximately 1 to 7 minutes, the unit should reboot.
- Video should now be restored.
Can also see the process in this video:
https://www.youtube.com/watch?v=iHkGkw9EE8c&feature=emb_logo
See my comment there with the newer links I have above, have fixed the links they had (since they had old broken ACER links they eventually provided the file themselves) so that you download the BIOS from ACER directly, to be safer and to be sure you always get the latest BIOS (aka 3310 at the time of writing).
Fix: “A numeric comparison was attempted” at VS build (Costura.Fody)
After upgrading from Visual Studio 2017 to Visual Studio 2019 I was able to update NuGet packages Fody and Costura.Fody of a solution that needed them (to package assembly DLLs inside console EXEcutables) and the solution was rebuilding fine.
However after I synced the solution via a Git repository on another machine and installed the newer Visual Studio there too, I rebuilt the solution in order to fetch/rebuild NuGet packages too and although everything seemed to rebuild fine, when I was using a plain build instead of a rebuild all I was getting at Errors dialog for each project that was using Costura.Fody:
Error
A numeric comparison was attempted on "$(MsBuildMajorVersion)" that evaluates to "" instead of a number, in condition "($(MsBuildMajorVersion) < 16)".
To fix this I had to uninstall and reinstall Costura.Fody NuGet package (it wasn’t needed to uninstall/reinstall the Fody NuGet package itself) on the solution’s projects that were using it and then all was rebuilding/building fine again on that other machine.