Onega

a lot of VC++ posts, a few C# posts, and some miscellaneous stuff

Friday, January 01, 2021

SageMath 9.2 error on macOS Catalina 10.15.5 ModuleNotFoundError: No module named '_ssl'

SageMath 9.2 start up error on macOS Catalina 10.15.5:

/Applications/SageMath-9.2.app/Contents/Resources/sage/local/lib/python3.8/site-packages/traitlets/config/loader.py:795: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if len(key) is 1:
/Applications/SageMath-9.2.app/Contents/Resources/sage/local/lib/python3.8/site-packages/traitlets/config/loader.py:804: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if len(key) is 1:
Traceback (most recent call last):
  File "/Applications/SageMath-9.2.app/Contents/Resources/sage/local/lib/python3.8/site-packages/sage/repl/ipython_kernel/install.py", line 307, in have_prerequisites
    from notebook.notebookapp import NotebookApp
  File "/Applications/SageMath-9.2.app/Contents/Resources/sage/local/lib/python3.8/site-packages/notebook/notebookapp.py", line 66, in <module>
    from tornado import httpserver
  File "/Applications/SageMath-9.2.app/Contents/Resources/sage/local/lib/python3.8/site-packages/tornado/httpserver.py", line 29, in <module>
    import ssl
  File "/Applications/SageMath-9.2.app/Contents/Resources/sage/local/lib/python3.8/ssl.py", line 98, in <module>
    import _ssl             # if we can't import it, let the error propagate
ModuleNotFoundError: No module named '_ssl'
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.2, Release Date: 2020-10-24                     │
│ Using Python 3.8.5. Type "help()" for help.                        │
└────────────────────────────────────────────────────────────────────┘
Please wait while the Sage Jupyter Notebook server starts...

The Jupyter notebook requires ssl, even if you do not use
https. Install the openssl development packages in your system and
then rebuild Python (sage -f python3).

Traceback (most recent call last):
  File "/Applications/SageMath-9.2.app/Contents/Resources/sage/local/lib/python3.8/site-packages/sage/repl/ipython_kernel/install.py", line 307, in have_prerequisites
    from notebook.notebookapp import NotebookApp
  File "/Applications/SageMath-9.2.app/Contents/Resources/sage/local/lib/python3.8/site-packages/notebook/notebookapp.py", line 66, in <module>
    from tornado import httpserver
  File "/Applications/SageMath-9.2.app/Contents/Resources/sage/local/lib/python3.8/site-packages/tornado/httpserver.py", line 29, in <module>
    import ssl
  File "/Applications/SageMath-9.2.app/Contents/Resources/sage/local/lib/python3.8/ssl.py", line 98, in <module>
    import _ssl             # if we can't import it, let the error propagate
ModuleNotFoundError: No module named '_ssl'
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.2, Release Date: 2020-10-24                     │
│ Using Python 3.8.5. Type "help()" for help.                        │
└────────────────────────────────────────────────────────────────────┘
Please wait while the Sage Jupyter Notebook server starts...

The Jupyter notebook requires ssl, even if you do not use
https. Install the openssl development packages in your system and
then rebuild Python (sage -f python3).

[I 17:44:32.483 NotebookApp] Using MathJax: nbextensions/mathjax/MathJax.js
[I 17:44:33.670 NotebookApp] The port 8888 is already in use, trying another port.
[I 17:44:33.672 NotebookApp] Serving notebooks from local directory: /Users/onzhang/Documents/jupyter
[I 17:44:33.673 NotebookApp] Jupyter Notebook 6.1.1 is running at:
[I 17:44:33.673 NotebookApp] http://localhost:8889/?token=bfcacfc9fff13ce43129cae1535e1eaf55638cf81e3baa30
[I 17:44:33.673 NotebookApp]  or http://127.0.0.1:8889/?token=bfcacfc9fff13ce43129cae1535e1eaf55638cf81e3baa30
[I 17:44:33.673 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 17:44:33.684 NotebookApp]
    
    To access the notebook, open this file in a browser:
        file:///Users/onzhang/Library/Jupyter/runtime/nbserver-36662-open.html
    Or copy and paste one of these URLs:
        http://localhost:8889/?token=bfcacfc9fff13ce43129cae1535e1eaf55638cf81e3baa30
     or http://127.0.0.1:8889/?token=bfcacfc9fff13ce43129cae1535e1eaf55638cf81e3baa30
[I 17:44:46.884 NotebookApp] Kernel started: 0bdf8030-8556-4d1a-b2e5-0551a02e8938, name: sagemath
[I 17:46:46.881 NotebookApp] Saving file at /sagemath1.ipynb

Solution:

https://ask.sagemath.org/question/51130/ssl-error-using-sage-pip-install-to-download-a-package/

/Applications/SageMath-9.2.app/sage -python -m fix_mac_sage9_2.fix

Labels:

Sunday, May 19, 2019

Android Studio

FileNotFoundException: instantRunSplitApkResourcesDebug 

Run App in emulator, Android Studio reports build error: FileNotFoundException: instantRunSplitApkResourcesDebug/out/slice_1/resources_ap
Solution: disable Instant Run plugin in Android Studio > Preferences

Wednesday, April 03, 2019

brew on MacOs

On some system brew install cmake (or other program) reports the following errors:
Error: The following directories are not writable by your user:
/usr/local/bin
/usr/local/etc
/usr/local/sbin
/usr/local/share
/usr/local/share/doc

You should change the ownership of these directories to your user.
  sudo chown -R $(whoami) /usr/local/bin /usr/local/etc /usr/local/sbin /usr/local/share /usr/local/share/doc

And make sure that your user has write permission.
  chmod u+w /usr/local/bin /usr/local/etc /usr/local/sbin /usr/local/share /usr/local/share/doc

On my system sudo chown -R $(whoami) ... does not work. Dropping "-R" works.
sudo chown $(whoami) /usr/local/bin /usr/local/etc /usr/local/sbin /usr/local/share /usr/local/share/doc

Labels:

Saturday, January 05, 2019

JarFinder.jar

Here are results of different tools in this SO post.

JarClassFinder

java -jar ~/Downloads/JarClassFinder1.3.jar
Error: Unable to initialize main class cn.jun.ui.Launcher
Caused by: java.lang.NoClassDefFoundError: com/sun/java/swing/plaf/windows/WindowsLookAndFeel

Download its source code
unzip jarclassfinder-svn-r6-JarClassFinder.zip
cd jarclassfinder-svn-r6-JarClassFinder/src
Comment out usage of WindowsLookAndFeel in Launcher.java and LicenseDialog.java
javac cn/jun/ui/*java cn/jun/util/*java
jar -cvfe ../test.jar cn.jun.ui.Launcher .
java -jar ../test.jar
Please input the search target: org*RollingFileAppender
Choose PACKAGE_CLASS_TYPE
Enable FUZZY_SEARCH
Please select the search location: ~/.gradle/wrapper/dists
Click Search

jarbrowser 

java -jar ~/Downloads/jarbrowser.jar
Cannot find image: /conexus/images/Jar24.gif
Exception in thread "main" java.lang.NullPointerException
        at conexus.util.JarInventory.(Unknown Source)
        at conexus.util.JarInventory.main(Unknown Source)

Download its source code jarbrowser1.0.zip
mkdir mod-jarbrowser
cd mod-jarbrowser
unzip  jarbrowser1.0.zip
Modify conexus/util/JarInventory.java
public static ImageIcon getImage(String path) {
    ...
    // java.net.URL imgURL = path.getClass().getResource(path);
    java.net.URL imgURL = JarInventory.class.getResource(path);
    ...
}
javac -cp lib/syntax.jar conexus/util/*java
jar -cfe mod-jarbrowser.jar conexus.util.JarInventory conexus -C resource conexus -C lib/syntax com -C lib/syntax gnu
java -jar mod-jarbrowser.jar
Root directory: .gradle/wrapper/dists
Click Scan button
Search: RollingFileAppender.class

JarFinder

Extract JarFinder.jar from JarFinder-PlatformIndependent.zip
java -jar ~/Downloads/JarFinder.jar

Labels:

Android Log Viewer

Apache License Android Log Viewer

Labels: ,

Fix Eclipse log4j WARN

Eclipse complains log4j settings

log4j:WARN No appenders could be found for logger (com.spotify.docker.client.DockerConfigReader).
log4j:WARN Please initialize the log4j system properly.

Solution

create a file log4j.properties according to this post

# Root logger option
log4j.rootLogger=INFO, file, stdout

# Direct log messages to a log file
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=/Users/ozhang/oss/log4j/eclipse/eclipse.log
log4j.appender.file.MaxFileSize=10MB
log4j.appender.file.MaxBackupIndex=10
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
 
# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n

Add a line to /Applications/Eclipse.app/Contents/Eclipse/eclipse.ini

-Dlog4j.configuration=file:///Users/ozhang/oss/log4j/log4j.properties

Result: 

Eclipse does not complain log4j any more.


Eclipse and OS versions

Eclipse IDE for C/C++ Developers

Version: 2018-12 (4.10.0)
Build id: 20181214-0600

sw_vers
ProductName: Mac OS X
ProductVersion: 10.13.6
BuildVersion: 17G2112

Labels: ,

Build wxMac

CMake build wxWidgets library

ld: library not found for -lstdc++

cmake ../wxWidgets-3.1.2
-- The C compiler identification is AppleClang 10.0.0.10001145
-- The CXX compiler identification is AppleClang 10.0.0.10001145
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- broken
CMake Error at /Applications/CMake.app/Contents/share/cmake-3.13/Modules/CMakeTestCXXCompiler.cmake:45 (message):
  The C++ compiler

    "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: ~/oss/bld/CMakeFiles/CMakeTmp
    
    Run Build Command:"/usr/bin/make" "cmTC_6d774/fast"
    /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_6d774.dir/build.make CMakeFiles/cmTC_6d774.dir/build
    Building CXX object CMakeFiles/cmTC_6d774.dir/testCXXCompiler.cxx.o
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++    -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.7   -o CMakeFiles/cmTC_6d774.dir/testCXXCompiler.cxx.o -c ~/oss/bld/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
    warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
    1 warning generated.
    Linking CXX executable cmTC_6d774
    /Applications/CMake.app/Contents/bin/cmake -E cmake_link_script CMakeFiles/cmTC_6d774.dir/link.txt --verbose=1
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++    -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.7 -Wl,-search_paths_first -Wl,-headerpad_max_install_names   CMakeFiles/cmTC_6d774.dir/testCXXCompiler.cxx.o  -o cmTC_6d774 
    clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
    ld: library not found for -lstdc++
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make[1]: *** [cmTC_6d774] Error 1
    make: *** [cmTC_6d774/fast] Error 2
    
  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:26 (project)

Solution:

LDFLAGS="-stdlib=libc++" cmake ../wxWidgets-3.1.2

CMake build wxWidgets application

cmake -DwxWidgets_CONFIG_EXECUTABLE=~/Downloads/wxWidgets-3.1.2/bld/wx-config ..

macOS version

sw_vers
ProductName: Mac OS X
ProductVersion: 10.13.6
BuildVersion: 17G2112

Labels: , , ,

Monday, October 29, 2018

Import certificate for JVM

portecle is a GUI tool to import certificate for JVM.
Works great when combined with https://github.com/escline/InstallCert
On Mac I have to import certificate to /Applications/ccollab_client/.install4j/jre.bundle/Contents/Home/jre/lib/security/cacerts for ccollab

Useful python open source libraries

htmllisting-parser: use it to download files from html listing

Wednesday, July 02, 2014

linux device driver notes

writing a linux device driver module for kernels 3.0 or 2.6 with udev
Reading Files From The Linux Kernel Space (Module/Driver) (Fedora 14)
Driving Me Nuts - Things You Never Should Do in the Kernel
sysfs interface is preferred over ioctls and using /proc.
Device Drivers, Part 10: Kernel-Space Debuggers in Linux
10.2. Linux Kernel Debugging
Kernel Thread Creation : 1

Sunday, April 27, 2014

Comparison of the Grid/Cloud Computing Frameworks

Krystian Lider: Comparison of the Grid/Cloud Computing Frameworks (Hadoop, GridGain, Hazelcast, DAC) - Part I
Comparison of the Grid/Cloud Computing Frameworks (Hadoop, GridGain, Hazelcast, DAC) - Part II

THE HADOOP DISTRIBUTED FILE SYSTEM
Konstantin Shvachko, Hairong Kuang,
Sanjay Radia, Robert Chansler
Presented by Alexander Pokluda
October 7, 2013

CBliag uDdatiaa Processing, 2013/14
Lecture 5: GFS & HDFS - distributed file systems!
Claudia Hauff (Web Information Systems)

PostgreSQL

Microsoft SQL Server vs. PostgreSQL
Oracle vs PostgreSQL Oracle vs. PostgreSQL

Cluster Computing and MapReduce bookmarks

Cluster Computing and MapReduce Lecture 1
    parallel vs distributed
Cluster Computing and MapReduce Lecture 2 
Mapper, Combiner, Reducer
Cluster Computing and MapReduce Lecture 3
NFS vs GFS
Cluster Computing and MapReduce Lecture 4
Clustering
Cluster Computing and MapReduce Lecture 5
Graph algorithm

More videos from Google developers.

Big Data Processing Lectures

StanfordUniversity
Introducing Apache Hadoop: The Modern Data Operating System

HADOOP
Introduction to HBase
Low latency, column based database.