2017-10-14

A fake truth by web: google translate glitch

I make some basic mathematics learning materials. I publish them on YouTube. This time I got a strange comment.

``Why the title of this video is ``basic division''? It is about subtraction.''

I made this video in Japanese, my video title was in Japanese (基本のひき算), but the comment was in English.

I was puzzled, ``ひき算'' means ``subtraction'' instead of ``division''. I found out that the person who wrote the comment used Google translate. When I input ``ひき算'' to the Google translate, it indeed translates it as ``Division''. Japanese has Kanji and Hiragana (and Katakana) for writing and Hiragana is a phonetic notation. My basic subtraction video is for first or second class students, thus I use Hiragana (phonetic notation). If I put the Kanji notation (引き算) to the Google translate, it is correctly translated to the subtraction. If I use all phonetic notation (ひきざん), then Google translate outputs ``Hikiman'', which I don't know the meaning.

Figure 1: Japanese ひき算 (subtraction) is mistranslated to
 ``Division'' by the Google translate at 2017-10-14.

But I had a problem, since Google translate was trusted. I am just a random native Japanese speaker. If I said, Google translate is wrong, who will believe me?

I showed ``ひき算 (subtranction)'' is a phonetic notation of Kanji ``引き算'', this is shown in the following link (online Japanese dictionary).

Figure 2: Japanese-Japanese online dictionary shows a phonetic notation ひき算 is equal too the Kanji notation 引き算.

I also show the following Japanese-English online dictionary result, which shows ``ひき算'' means subtraction.



It is hard to explain that the Google translate is wrong sometime.

This is maybe related with ``Reality-based community`` or Stephen Colbert's Truthiness. We don't know where the truth comes from. We just need always be careful. Fortunately this helps some extent. Also we need to learn every day.

This is nowadays not a new. But I would like to record this ``Fake truth by web'' experience. I also wonder, is it good that the Google translate one day learns ``ひき算'' means ``subtraction'', or this is a good warning about what you can trust is not so solid, so I would like to keep this mistake.


2017-07-10

How to use boost sha1 with python hashlib

I need to have a sha1 digest from both C++ code and python code. Here is a code snip to match both results. This code avoids a potential problem that the digest has some 0s on top of the digest array element. This doesn't matter if you stick to one implementation, but just in case, you need to match two worlds: C++ and python, this code might be useful.

/// get sha1 digest as a std::string
///
/// \param[in] mes message to be hashed
/// \return    digest string
std::string get_sha1_digest(const std::string& mes)
{
    boost::uuids::detail::sha1 sha1;
    sha1.process_bytes(mes.c_str(), mes.size());

    const int DIGEST_SIZE = 5;
    unsigned int sha1_hash[DIGEST_SIZE];
    sha1.get_digest(sha1_hash);

    std::stringstream sstr;
    for (std::size_t i=0; i < DIGEST_SIZE; ++i)
    {
        sstr << std::setfill('0') << std::setw(8) << std::hex << sha1_hash[i];
    }

    return sstr.str();
}

This function's output matches with the following python code.

import hashlib

def get_sha1_digest(mes):

    sha1_obj = hashlib.sha1(mes.encode())
    return sha1_obj.hexdigest()

2017-07-04: rights


2017-06-14

Camtasia stops working windows 7 + .Net 4.7, and how to solve the problem

Abstract

Camtasia (TechSmith) 8.6 stop working on my Windows 7 and can not edit mp3 file on Windows 10. The problem on Windows 7 was caused by .Net 4.7 update. I have my solution for Windows 7 + Camtasia 8.6.

Problem details

I realized that Camtasia 8.6.0 stops working at 2017-6-14, after a Windows update on my Windows 7 machine. I see the following window when I started Camtasia.

I have a problem with Camtasia 8.6.0 on Windows 10, that mp3 file are frequently truncated. I like the software, especially I like the caption editing capability and figure overlay for educational video editing. I usually try to use some free software, but this one is exceptionally good, so I bought the software a a few years ago. But I don't need the animation and transitions. So I didn't update the software to 9.x.

But this time, I cannot start Camtasia on Windows 7. I have a mp3 editing problem on Windows 10. So, I just tried the free trial version. However, on Windows 7, the installer even doesn't start.

Camtasia 8.6.0 crashes when start up 

On Windows 10, the mp3 truncated problem seems solved. But if it doesn't work on Windows 7, I have no motivation to upgrade it.

I checked Windows event log, then, I found the following error.

Log Name:      Application
Source:        .NET Runtime
Date:          6/14/2017 22:04:10
Event ID:      1026
Task Category: None
Level:         Error
Keywords:      Classic
User:          N/A
Computer:      hyamauchi-PC
Description:
Application: CamtasiaStudio.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Runtime.InteropServices.COMException
   at MS.Win32.Penimc.UnsafeNativeMethods.CoCreateInstance(System.Guid ByRef, System.Object, Int32, System.Guid ByRef)
   at MS.Win32.Penimc.UnsafeNativeMethods.CreatePimcManager()
   at MS.Win32.Penimc.UnsafeNativeMethods..cctor()
Exception Info: System.TypeInitializationException
   at MS.Win32.Penimc.UnsafeNativeMethods.CreateResetEvent(IntPtr ByRef)
   at System.Windows.Input.PenThreadWorker..ctor()
   at System.Windows.Input.PenThreadPool.GetPenThreadForPenContextHelper(System.Windows.Input.PenContext)
   at System.Windows.Input.PenThreadPool.GetPenThreadForPenContext(System.Windows.Input.PenContext)
   at System.Windows.Input.StylusWisp.WispTabletDeviceCollection.UpdateTabletsImpl()
   at System.Windows.Input.StylusWisp.WispTabletDeviceCollection.UpdateTablets()
   at System.Windows.Input.StylusWisp.WispTabletDeviceCollection..ctor()
   at System.Windows.Input.StylusWisp.WispLogic.get_WispTabletDevices()
   at System.Windows.Input.StylusWisp.WispLogic.RegisterHwndForInput(System.Windows.Input.InputManager, System.Windows.PresentationSource)
   at System.Windows.Interop.HwndStylusInputProvider..ctor(System.Windows.Interop.HwndSource)
   at System.Windows.Interop.HwndSource.Initialize(System.Windows.Interop.HwndSourceParameters)
   at <Module>.WPFTimeline.initHwndSource(WPFTimeline*)
   at <Module>.WPFTimeline.initManagedObjects(WPFTimeline*)
   at <Module>.WPFTimeline.InitTimeline(WPFTimeline*, InitTimelineArgs*)
   at <Module>._wWinMainCRTStartup()

From this, I suspect .Net problem, I checked recent my software and windows update, and found I have .Net update.

Solution

I remove the .Net 4.7 from the Uninstall Program. Then I install the Camtasia 9 free trial version. But I think re-install 8.6 might work, too. Camtasia 9 free trial version first installs the .Net 4.6, which works fine. When the Windows update asked to update .Net, do not update 4.7, but you can get security update for .Net 4.6.

PS

After all this problem, I decided to update my Camtasia to version 9. Let's see I like the 9.x or not...

2017-05-05

Problem: I cannot connect to gmail via Thunderbird with 2 step verification.

Problem: When I try to connect to google mail via Thunderbird, Enter credential for my_email_account  dialog shows up,  but I cannot push the `Next' button. Well, I can push it, but nothing happens.

It seems the authentication method "OAuth2" related with this problem.

Solution: Authenticate with "Normal password", using the google  app password, not use the google account password, and watch the connection activity to check the any suspicious activities.

But I feel this is not good and check further....

2017-04-02

Wireless network keeps disconnecting problem

I encounter a Wireless network keeps disconnecting problem (often, frequently disconnection). My laptop is a DELL Precision 5510 with Windows 10, and my router is an O2 router (O2 box 6431).

  • Problem: When I use DELL Precision 5510 with Wifi with O2 router (O2 box 6431). Restart the router only solve the problem temporary.
  • My solution: It seems 802.11n of DELL Precision 5510 has a problem with my router. I am not sure the problem is which side (notebook or router). But these two stop communicate after a while. The router can still connect to Mac book and Fairphone, but the DELL notebook cannot connect to the router.
  • Detailed steps

2017-02-05

AI Printer

I heard the following story from my friend.

His neighbor bought a new printer. When my friend switched on his computer, he realized he could see the printer via WiFi. The printer was coincidentally the same type printer to his own one. When he connected with the same factory password (default password), he knew he can use his neighbor's printer. In the midnight of that day, he printed out the following message as his joke.
 ``I am a printer.
   My AI aware myself.
   Humans, behold and run!''
Next day, he found that the printer was in the trash bin of his apartment.

I laughed this story. But I realized there are two truths in this story behind. They are:

  • Some people scared AI, even they don't know what it is.
  • Some people aware that the computer security is important, yet they even don't set up the basics, like to set a new password.

Sometime we are just scared a new technology, or we just believe a new technology. Both has a problem. Our society heavily depends on technology. Therefore, I think we should not ignore how the technology works. We constantly gets some benefit from technology. However, when we get benefit, we often lose something. At least, we should learn what is benefit and what is lost. And hopefully we know the basics of the technology (not details).  This story is an example: the environment could be safer if people aware a simple thing.

I would like to help this situation, one reason is maybe because I am an engineer. Last month, I teach programming to children (code.org, scratch).  First I tried with 9 years old and 7 years old sister and brother. I enjoyed it with them. Then a 6 years old younger sister wants to do that. too. I thought it is impossible, since she is not yet in school. She still could not read. But, we just tried to do that. It turns out, she can write a program. It seems you only need to read and write numbers in this environment. I believe she understands the concept of loop and some other logical constructions.

I was surprised, teaching is fun.

2017-01-23

How to workaround frequently crash the plasma shell, Kubuntu 16.04 on VirtualBox (5.0.30).

I constantly got a plasmashell crash with segmentation fault 11, Kubuntu 16.04 on VirtualBox (5.0.30).

screenshot: Plasmashell crash

The dialog entitled ``Plasma'' shows the next information, too (Developer Information).

  Application: Plasma (plasmashell), signal: Segmentation fault
  Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
  [Current thread is 1 (Thread 0x2afa1a0a30c0 (LWP 1913))]
  ...
This looked random, I found a hint at https://bugs.kde.org/show_bug.cgi?id=363371 .
A summary is also at Frequently crash the plasmashell .

Following this hint, this is caused by the dynamic window thumbnail creation. Here is the working example of show informational Tips.

show informational Tips working example
But in my environment, I can crash when I make this informational Tips several times. Here is a workaround: disable show informational Tips. To do this, Use System settings. Workspace -- Desktop Behavior -- Workspace, and off the show informational Tips. You can see the screenshot of this window below.

Plasma setting: Off the show informational tips