All posts by andreasheindl

Run MIT App Inventor offline on a Windows 10 machine

Want to teach children how to develop Android apps using MIT App Inventor? Have problems with an unstable or missing Internet connection? Use a local installation of MIT App Inventor on your Windows PC. Here's how:

VirtualBox

Download VirtualBox from https://www.virtualbox.org/wiki/Downloads

Install.

Download App Inventor Appliance

Go to

https://frc-events.firstinspires.org/FTCImages/2016

. They host a preconfigure virtual machine that runs an offline MIT App Inventor server. It contains some additional FTC stuff, but you can ignore that if you want. Download the Local App Inventor applicance file for Windows.

Setup Appliance

Start VirtualBox. In the menu, go to File / Import Appliance... .  Select 2016-08-20 11_17_52-LocalAppInventor - Settingsthe appliance file you downloaded from FTC. After it is imported, select the new virtual machine 'LocalAppInventor', go to settings and select Network.  Make sure Adapter 1 is enabled and set to 'Attached to: NAT'. Go to Advanced' / Port Forwarding and set up a new rule with Protocol: TCP, Host Port: 8888, Guest Port: 8888.2016-08-20 11_18_25-Port Forwarding Rules

Launch Virtual Machine

In Virtual Box click on Start. After a few minutes everything should be running. Check that the screen shows a running App Inventor after some time.

Share your WiFi connection

Enable a WiFi hotspot on your Laptop to allow the children to connect their laptops to yours. You can follow the instructions from windowscentral.com.

 

Transition from Windows 10 to Fedora 23

Here are the steps I that I found useful for my transition from using Windows 10 to using Fedora 23 (x64 / workstation):

  • Download Fedora 23 Workstation from getfedora.org.
  • First I tried (without success!) to copy the ISO file Fedora-Live-Workstation-x86_64-23-10.iso to my USB stick via UNetBootin. Reboot Windows, but press SHIFT when clicking on Reboot to get the different restart options (like boot from USB). That seemed to work at first, but then the Live Fedora did not boot through to the desktop but hung somewhere in the middle. Copying the ISO file with dd if=the_iso_file.iso of=/dev/sdb bs=1M did the trick. Be very sure about what /dev/sdb is before writing to it!
  • sudo dnf -y update
  • Mount Windows drive to /win:
    • sudo mkdir /win
    • [missing]
  • Install Google Chrome
    • sudo rpm --import https://dl-ssl.google.com/linux/linux_signing_key.pub
    • sudo sh -c 'echo "[google-chrome]
      name=Google Chrome 64-bit
      baseurl=http://dl.google.com/linux/chrome/rpm/stable/x86_64" >> /etc/yum.repos.d/google-chrome.repo'
    • Alternative for line above for x86 (32 bit) only: sudo sh -c 'echo "[google-chrome]
      name=Google Chrome 32-bit
      baseurl=http://dl.google.com/linux/chrome/rpm/stable/i386" >> /etc/yum.repos.d/google-chrome.repo'
    • sudo dnf install google-chrome-stable
  • Install Visual Studio Code
    • sudo mkdir /opt/vscode
    • [download]
    • sudo unzip VSCode-linux64.zip
    • rm VSCode-linux64.zip
    • sudo ln -s /opt/vscode/VSCode-linux-x64/Code /usr/local/bin/code
  • Install Qt
    • sudo dnf install mesa-libGL-devel
    • sudo dnf groupinstall "C Development Tools and Libraries"
    • sudo dnf install qt5-qtbase qt5-qtbase-devel
  • hostnamectl set-hostname --static "ultra"
  • Install Thunderbird
    • Copy profile from Windows to Linux:
      • cp /win/Users/xxx/AppData/Roaming/Thunderbird/Profiles/krb2tad7.default/prefs.js /home/xxx/.thunderbird/vvspfz6z.default
  •  Virtualbox
    • [missing]
    • sudo usermod -a -G vboxusers USER
  • Enable  SSH server
    • sudo chkconfig sshd on
    • sudo service sshd start
  • Play MP3s
    • sudo dnf install gstreamer-plugins-base.i686
    • sudo dnf install gstreamer-plugins-base
    • sudo dnf install gstreamer1-libav gstreamer1-plugins-good gstreamer1-plugins-ugly gstreamer1-plugins-bad-free gstreamer-ffmpeg gstreamer-plugins-good gstreamer-plugins-ugly gstreamer-plugins-bad gstreamer-plugins-bad-free gstreamer-plugins-bad-nonfree
  • Truecrypt 7.1
  • Run script on startup:
    • create $HOME/.config/autostart /startup.desktop
      • [Desktop Entry]
        Type=Application
        Version=1.0
        Name=startup.sh
        Comment=execute script startup.sh
        Exec=/home/USER/bin/startup.sh
        Terminal=true
    • Verify/add with gnome-tweak-tool / Startup Applications
  • Change waterdrop sound in Terminal to bell sound
    • sudo wget http://cgit.freedesktop.org/sound-theme-freedesktop/plain/stereo/bell.oga?id=38bc773912317a2163083b6f483fbc8e6fb61123 -O /usr/share/sounds/freedesktop/stereo/bell.oga
  • Custom keyboard layout:
    • I prefer the layout ¨English (US, international with dead keys)¨ but without the dead keys:
      • In Gnome Activity Launcher, type: region
      • Add keyboard layout ´English (US, international with dead keys)´
      • Edit file /usr/share/X11/xkb/symbols/us
        • Find entry English (US, international with dead keys
        • The next few lines, change all words like dead_grave -> grave, dead_tilde -> tilde, ...
        • For key <AC11> change [ acute, diaeresis, apostrophe,        quotedbl] to [ apostrophe, quotedbl ]
  • Show icons on desktop
    • gnome-tweak-tool must be installed
      • sudo dnf install gnome-tweak-tool
      • Launch gnome-tweak-tool
      • In Desktop / Icons on Desktop: ON
      • To get custom desktop shortcuts on the GNOME desktop, put .desktop file into ~/Desktop, make sure they are executable (chmod u+x ~/Desktop/*.desktop)
        • example file /home/USER/Desktop/keepass.desktop:
        • [Desktop Entry]
          Type=Application
          Version=1.0
          Name=keepass.sh
          Comment=execute script keepass.sh
          Exec=/home/USER/bin/keepass.sh
          Terminal=true
  • Other packages needed
    • sudo dnf install vim vim-enhanced octave keepass
    • sudo dnf groupinstall "Development Tools"
    • Some 3rd party packages (like the MIT App Inventor aiStarter) need these 32 bit libs:
      • sudo dnf install zlib.i686 libstdc++.i686

 

Some useful keyboard shortcuts:

  • In Nautilus: Press / or CTRL+L to enter an arbitrary path
  • WIN+LEFT and WIN+RIGHT moves windows within one display. WIN+SHIFT+LEFT and WIN+SHIFT+RIGHT moves windows to another display
  • ALT+F2: Run commands

Capture Screen with ffmpeg / screencast

On Windows you can record your screen to an .mp4 file using ffmpeg:

  • Download ffmpeg for Windows from http://ffmpeg.zeranoe.com/builds/
  • Run e.g. with following command: ffmpeg -f gdigrab -framerate 30 -show_region 1 -i desktop out.mp4

(the capture devices

video="UScreenCapture"

and

video="screen-capture-recorder"

did not work for me on my Windows 10 machine, they were not even listed in the available video devices.)

For details see ffmpeg's https://trac.ffmpeg.org/wiki/Capture/Desktop

On Windows 10, you can also try to use Windows' Screen Recording to record a window. Just press Win+G and check Yes, this is a game. Afterwards you get a Record button. Your recordings will be saved to %HOMEPATH%\Videos\Captures

Start an application with the debugger attached

You can automatically attach the Visual Studio Just-In-Time debugger when a process is started on Windows. The steps are simple:

  • Open the Registry Editor
  • navigate to HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options
  • Select the application you want to debug:
    • Either it already exists as subkey, then use that one
    • Or, you have to create a new key in Image File Execution Options with the name of the application (e.g. chrome.exe)
  • Create a new string value with name debugger and name vsjitdebugger.exe

regedit_debugger

Enable VT-x for VirtualBox

My Virtual Machine was running very slow in VirtualBox 4.3.28. Unbearable slow. I though I remembered running it faster, but I wasn't sure.

Indicators for the problem I'll describe next are:

  • In CPU-Z the VT-x feature is missing in the Instructions list of the CPU.
  • In VirtualBox's Create New dialog box only 32-bit OS are shown.
  • In VirtualBox's settings of an existing VM, the Acceleration tab in the System settings is disabled/grayed out.

After some googling around at the wrong corners of the Internet I found this post by vonnie mentioning that maybe on my Windows 8.1 host the feature Hyper-V was enabled. I think this steals the VT-x functionality somehow for usage by itself. Disabling this feature boosted the performance of my VMs dramatically!

To disable Hyper-V in Windows 8.1 go to Turn Windows features on or off via Windows' search functionality (hotkey: Win+Q). You'll have to reboot.

These screenshots have been taken after fixing the problem:vt-x-1 vt-x-2

vt-x-cpuz

Serial connection from your PC to Raspberry Pi

I needed an example device for tests of an implementation of a serial connection terminal. A Raspberry Pi is especially suited: It dumps a lot of kernel data upon boot and it listens for input as soon as the login prompt appears (after about one minute).

Required:

  • FTDI serial cable to USB converter TTL-232R-3V3 from http://www.ftdichip.com/
  • Raspberry Pi
  • Jump wires male - female

Wiring is simple: Just connect the FTDI cable as shown in the sketch below:

raspberry_pi_ttl232_serial_connection_ftdi_bb

 

  1. FTDI GND -> RaspPi GND
  2. FTDI TXD -> RaspPi RXD
  3. FTDI RXD -> RaspPi TXD
  • Fire up PuTTY and setup as in the following screenshot (speed/baud rate = 115200)

putty_serial

  • Press "Open" and you should receive the kernel boot messages followed by a login prompt.

 

 

Use VIM as git editor on Windows

The following configures git to use VIM as the default editor (e.g. for commit messages) on Windows:
git config --system core.editor 'C:\\PROGRA~2\\Vim\\vim73\\gvim.exe' --wait

Explanation

  • Uses short directory names. You can find these using e.g.:

    dir /X "C:\Program Files (x86)*"

    Notice the star at the end of the command line. This will reveal the short name PROGRA~2
  • Use double backslashes
  • Use single quotes
  • Use the --wait option after closing the single quotes for the path to the VIM editor

Configure https for JIRA

2015-07-14 10_45_10-System Dashboard - Machine JIRA

I installed JIRA on my Ubuntu 14.04 machine according to
http://engineerbabu.com/2014/10/14/install-jira-ubuntu-14-04-lts/

What was missing was the https support, i.e. the support for secure data transfers.
Here, I followed
https://confluence.atlassian.com/display/JIRA/Running+JIRA+over+SSL+or+HTTPS
and
http://tomcat.apache.org/tomcat-6.0-doc/ssl-howto.html

Install https support as follows on the command line:

JAVA_HOME=/opt/atlassian/jira/jre
JIRA_HOME=/opt/atlassian/jira/atlassian-jira
sudo $JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA -keystore $JIRA_HOME/jira.jks
Enter keystore password: *****
What is your first and last name? : machine return a few times ... yes ... return
$JAVA_HOME/bin/keytool -certreq -keyalg RSA -alias tomcat -keystore $JIRA_HOME/jira.jks -file $HOME/jira.csr
$JAVA_HOME/bin/keytool -list -alias tomcat -keystore $JIRA_HOME/jira.jks
sudo cp /opt/atlassian/jira/conf/server.xml /opt/atlassian/jira/conf/server.xml.bak
sudo vi /opt/atlassian/jira/conf/server.xml

Contrary to Atlassian's documentation, you have to specify attributes keystoreFile and keystorePass in the Connector element in the server.xml file, e.g.:

<Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol" maxHttpHeaderSize="8192" SSLEnabled="true" maxThreads="150" minSpareThreads="25" enableLookups="false" disableUploadTimeout="true" acceptCount="100" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" useBodyEncodingForURI="true" keystoreFile="/opt/atlassian/jira/jira.jks" keystorePass="******"/>

Then stop'n'start JIRA:

sudo service jira stop
sudo service jira start

Now try to open following URL in your browser (replace 'machine' by your host name):
https://machine:8443/