HBJ5e

Raspian Stretch
~~~~~~~~~~~~~~~

1. Minimal install from

     debian-9.2.1-amd64-netinst.iso

   Install ssh

     apt-get -y install openssh-server --no-install-recommends

Notes. Initially /etc/ssh/sshd_config allows external connections. Please check your network status or virtualbox port forwarding rules (NAT) in case there is no connection.

2. X

  apt-get install xserver-xorg lxde lightdm

3. Arduino & SimulIDE

  sudo apt-get install gpsim libqt5serialport5 arduino

4. Installing Guest Additions on Debian

    apt-get install build-essential module-assistant dkms
    m-a prepare

  Add this to /etc/apt/sources.list:

    deb http://http.us.debian.org/debian sid main non-free contrib

  Update repositories and install package

    uname -a
    Linux RBOX 4.9.0-4-amd64 #1 SMP Debian 4.9.51-1 (2017-09-28) \
               x86_64 GNU/Linux

    sudo apt-get update
    sudo apt-get install virtualbox-guest-x11

    The following NEW packages will be installed:
    libnotify-bin virtualbox-guest-dkms
    virtualbox-guest-utils virtualbox-guest-x11

5. Raspification::Sense_Hat

  Disable this in /etc/apt/sources.list:

    ### deb http://http.us.debian.org/debian sid main non-free contrib

  apt-get update
  apt-get install gir1.2-gtk-3.0 software-properties-common dirmngr

  Add this to /etc/apt/sources.list:

    deb http://archive.raspberrypi.org/debian/ stretch main ui
    # Uncomment line below then
    # 'apt-get update' to enable 'apt-get source'
    # deb-src http://archive.raspberrypi.org/debian/ stretch main ui

  cd /etc/apt/
  wget http://archive.raspberrypi.org/debian/raspberrypi.gpg.key
  apt-key add raspberrypi.gpg.key
  apt-get update
  apt-get install python-sense-emu python3-sense-emu sense-emu-tools

6. Raspification::Cosmetics

    # apt-get install raspberrypi-ui-mods

  Disable both in /etc/apt/sources.list:

    ### deb http://http.us.debian.org/debian sid main non-free contrib
    ### deb http://archive.raspberrypi.org/debian/ stretch main ui

    # apt-get update
    # apt-get clean
    # dd if=/dev/zero of=biig; rm biig

7. Autologin

  $ cat /etc/lightdm/lightdm.conf | grep ^autologin-user
  autologin-user=virtu

  Copy virtualbox debian VHD and 7zip it. Done.

8. Flowgorithm and more (forgotten earlier)

    # mkdir -p /mnt/vbox
    # mount -t vboxsf Desktop /mnt/vbox
    # apt-get install mono-complete alacarte arandr
    $ mkdir ~/Flowgorithm
    $ cd ~/Flowgorithm
    $ cp /mnt/vbox/TMP/Flowgorithm.exe

  Add pictures (icons, wallpapers)

    $ lxappearance # "other" -> [v] "show icons in menus".

9. SimulIDE in "Programming" menu.

  Same as 8. Program is in ~/SimulIDE/bin/SimulIDE_0.1.5

10. Code::Blocks + wxWidgets

      # apt-get update
      # apt-get install codeblocks codeblocks-contrib subversion
      # apt-get install libwxgtk3.0-dev wx3.0-doc wx3.0-examples

      $ mkdir ~/CB; cd ~/CB
      $ svn checkout svn://svn.code.sf.net/p/codeblocks/code/trunk

    settings -> compiler -> search directories

      /usr/include/wx-3.0/
      /usr/lib/x86_64-linux-gnu/wx/include/base-unicode-3.0/

    New Project hiLED

      wxWidgets Project
      wxWidgets 3.0.x
      Project Title/Folder
      Author: -
      Preferred GUI Builder: wxSmith
      Application Type: Dialog Based
      GNU GCC Compiler [v] Debug [v] Release
      [v] Use default wxWidgets configuration

      Select wxPanel alread placed on wxWidgets app (Form) -> Cut
      wxWidgets app properties: Default Size [ ]
                                Height: 150
                                Width: 400
      Led1 properties:          Enabled: [v]
      In press Button1 Event:   Led1->Switch();

       +-------------------------+
       |     wxWidgets app       |
       |  wxPanel    wxButton    |
       |  +-----+   +---------+  |
       |  |[LED]|   | SWITCH  |  |
       |  +-----+   +---------+  |
       |      wxLCDDisplay       |
       |  +-------------------+  |
       |  |     HEllorlD      |  |
       |  +-------------------+  |
       |      +---------+        |
       |      | Push Me |        |
       |      +---------+        |
       +-------------------------+

    led.h lcdwindow.h led.cpp lcdwindow.cpp

  cp ~/CB/trunk/src/plugins/contrib/wxContribItems/wxled/led/include/wx/led.h \
     /usr/include/wx-3.0/wx/

  cp ./CB/trunk/src/plugins/contrib/wxContribItems/wxled/led/src/led.cpp \
     ~/Hello/

  cp ~/CB/trunk/src/plugins/contrib/wxContribItems/wxled/lcdWindow/include/wx/lcdwindow.h \
     /usr/include/wx-3.0/wx/

  cp ~/CB/trunk/src/plugins/contrib/wxContribItems/wxled/lcdWindow/src/lcdwindow.cpp \
  ~/Hello
     /usr/include/wx-3.0/wx/

      add led.cpp lcdwindow.cpp to project files:

        Project -> Add files

  void HelloDialog::OnButton1Click(wxCommandEvent& event)
  {
    Led1->Switch();
  }

  void HelloDialog::OnButton2Click(wxCommandEvent& event)
  {
    LcdWindow1->SetValue("0123456789CEo");
  }

11. Code::Blocks + AVR

12. Logisim

  java -jar /home/virtu/logisim-generic-2.7.1.jar

13. Wine, UnoArduSim, CircuitMaker

  Download and 'make install' rar (rarlab.com)

  # apt-get install wine
  # dpkg --add-architecture i386
  # apt-get update
  # apt-get install wine32

  Download and extract UnoArduSim. Run wine UnoArduSim.exe
  Download and extract Cirmaker 6. Run wine CIRMAKER.EXE

  Create menu items. Link icons:

    wine /home/virtu/UnoArduSimV1.7.2/UnoArduSim.exe
    wine /home/virtu/CM60S/CIRMAKER.EXE

14. Siemens Logo Comfort 7.0 + russian.luf

Miscellaneous

  alacarte in "Preferences" menu.
  Multilayout EN EE RU (to right corner, add and configure panel 'Keyboard layout switcher').

HBQCe

Installation was successful, you can start Thonny from start menu under Education or Programming, or by calling /home/virtu/apps/thonny/bin/thonny
For uninstalling Thonny call /home/virtu/apps/thonny/bin/uninstall

HBDDD

  #include <stdio.h>
  #include <stdlib.h>
  #include <string.h>

  int main() {
    char* sfrom = "HELLO WORLD\0";
    char* sto = (char*)malloc(strlen(sfrom)*sizeof(char));
    int i;

    strcpy(sto, sfrom);
    for(i=0; i<strlen(sto); i=i+1)
      printf("%c\n", sto[i]);
    free(sto);
    return 0;
  }

m

  #!/bin/bash
  mkdir -p /mnt/desktop
  mount -t vboxsf Desktop /mnt/desktop/
  chmod 777 /mnt/desktop/

  chmod +x /usr/local/bin/m

u

  #!/bin/bash
  umount /mnt/desktop/

  chmod +x /usr/local/bin/u

c

  #!/bin/bash
  dd if=/dev/zero of=biig
  rm -f biig

HBo58

wxString to char*
.................

void wxTDialog::OnButton1Click(wxCommandEvent& event)
{
  wxString mystring(wxT("HelloWorld"));
  char s[80];
  min( 80, mystring.Length());
  // strncpy(s, (const char*)mystring.mb_str(wxConvUTF8), 79);
  sprintf(s, "%d %s", mystring.Length(), mystring.mb_str().data());
  StaticText1->SetLabel( s);
}

  https://wiki.wxwidgets.org/Converting_everything_to_and_from_wxString

And if you really need to copy it in to char* (but why would you? ;) :

  wxString mystring(wxT("HelloWorld"));
  char cstring[1024];
  strncpy(cstring, (const char*)mystring.mb_str(wxConvUTF8), 1023);

You can also use ToUTF8(). Variadic functions (like printf) won't work with mb_str(), but this will work:

  wxString mystring(wxT("HelloWorld"));
  printf("%s",mystring.mb_str().data());

Alternatively, use the method recommended in Potential Unicode Pitfalls:

  printf("%s", (const char*)mystring.mb_str())

HBPCR

How to adjust the double click's speed in PCManFM?
Post by Frank » Sun Jun 21, 2009 6:33 pm

  https://forum.lxde.org/viewtopic.php?f=8&t=501

  $ echo gtk-double-click-time=1000 >> ~/.gtkrc-2.0.mine

Links
-----

  1. Minimal Stretch

       https://www.howtoforge.com/tutorial/debian-minimal-server/2/

  2. how to install PIXEL desktop over Raspbian Jessie LITE

       https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=166806

  3. Binary packages are in sid repository

       https://virtualboxes.org/doc/installing-guest-additions-on-debian/

  4. How to add key with apt-key

      https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=18176

  5. Can't execute VBoxLinuxAdditions. Permission denied.

      http://blog.ackx.net/virtualbox-guest-additions-common-errors.html

  6. lightdm autologin

       https://askubuntu.com/questions/848110/auto-login-lxde

  7. Icons in Menu

       https://bbs.archlinux.org/viewtopic.php?id=174631

  8. https://www.howtoinstall.co/en/debian/stretch/codeblocks

Annex A. Hello
..............

  void HelloDialog::OnButton1Click(wxCommandEvent& event)
  {
      mfOK = 0;

      if (Led5->IsEnabled()) {
          Led6->Enable();
          if (Led5->IsOn()) Led6->SwitchOn(); else Led6->SwitchOff();
      }
      if (Led4->IsEnabled()) {
          Led5->Enable();
          if (Led4->IsOn()) Led5->SwitchOn(); else Led5->SwitchOff();
      }
      if (Led3->IsEnabled()) {
          Led4->Enable();
          if (Led3->IsOn()) Led4->SwitchOn(); else Led4->SwitchOff();
      }
      if (Led2->IsEnabled()) {
          Led3->Enable();
          if (Led2->IsOn()) Led3->SwitchOn(); else Led3->SwitchOff();
      }
      if (Led1->IsEnabled()) {
          Led2->Enable();
          if (Led1->IsOn()) Led2->SwitchOn(); else Led2->SwitchOff();
      }
      Led1->Enable();
      Led1->SwitchOn();
  }

  void HelloDialog::OnButton2Click(wxCommandEvent& event)
  {
      mfOK = 0;

      if (Led5->IsEnabled()) {
          Led6->Enable();
          if (Led5->IsOn()) Led6->SwitchOn(); else Led6->SwitchOff();
      }
      if (Led4->IsEnabled()) {
          Led5->Enable();
          if (Led4->IsOn()) Led5->SwitchOn(); else Led5->SwitchOff();
      }
      if (Led3->IsEnabled()) {
          Led4->Enable();
          if (Led3->IsOn()) Led4->SwitchOn(); else Led4->SwitchOff();
      }
      if (Led2->IsEnabled()) {
          Led3->Enable();
          if (Led2->IsOn()) Led3->SwitchOn(); else Led3->SwitchOff();
      }
      if (Led1->IsEnabled()) {
          Led2->Enable();
          if (Led1->IsOn()) Led2->SwitchOn(); else Led2->SwitchOff();
      }
      Led1->Enable();
      Led1->SwitchOff();
  }

  void HelloDialog::OnButton3Click(wxCommandEvent& event)
  {
      unsigned char vX = 0;

      if (Led6->IsOn()) vX += 32;
      if (Led5->IsOn()) vX += 16;
      if (Led4->IsOn()) vX += 8;
      if (Led3->IsOn()) vX += 4;
      if (Led2->IsOn()) vX += 2;
      if (Led1->IsOn()) vX += 1;

      if ( 0 <= vX && vX <=  9) vX += '0';
      else if (10 <= vX && vX <= 35) vX += 'A'-10;
      else if (vX == 36) vX = '_';
      else if (vX == 37) vX = '-';
      else if (vX == 38) vX = '=';
      else if (vX == 39) vX = ' ';

      mfOK += 1;

      switch(mfOK) {
          case 2:
              if (mfOK) vX = ' ';
          case 1:
              mS += vX;
              LcdWindow1->SetValue(mS);

              Led6->SwitchOff(); Led5->SwitchOff(); Led4->SwitchOff();
              Led3->SwitchOff(); Led2->SwitchOff(); Led1->SwitchOff();

              Led6->Disable(); Led5->Disable(); Led4->Disable();
              Led3->Disable(); Led2->Disable(); Led1->Disable();
              break;
          case 3:
              LcdWindow1->SetValue("=TU-DUU="); break;
              /*
                0 +  AD   add, summa
                1 -  SU   substrct
                2 *  MU   multiply
                3 /  DI   integer divide (3/2=1)
                4 %  RE   reminder (8%3=2)
                5 && AN   logical AND, false (0) true not 0.
                6 || OR   logical OR
                7 ^^ XO   logical OR
                8 !  NO   logical NOT (1=!0, 0=!25)
                9 &  BA   bitwise AND (6&3=2)
                A |  BO   bitwise OR (6|3=7)
                B ^  BX   bitwise XOR (6^3=5)
                C ~  BN   bitwise NOT (~7=f8)
                D << SL   logical shift left (5<<2=14)
                E >> SR   logical shift left (28>>3=14)
                F == EQ   is equal (67==90=0)
                G != NE   not equal (67!=90=1)
                H <= LE   less or equal
                I >= GE   greater or equal
                J <  LT   less than
                K >  GT   greater than
                L ?: IF   4 5 6 IF is (6?5:4=5)
              */
          case 4:
              LcdWindow1->SetValue("01234567"); break;
          case 5:
              LcdWindow1->SetValue("89ABCDEF"); break;
          case 6:
              LcdWindow1->SetValue("GHIJKLMN"); break;
          case 7:
              LcdWindow1->SetValue("OPQRSTUV"); break;
          case 8:
              LcdWindow1->SetValue("WXYZ_-= "); break;
      }
  }

  unsigned char wxLCDWindow::Decode( char c )
  {
    unsigned char ret = 0;

    struct DecodedDisplay
    {
      char ch;
      unsigned char value;
    };

    DecodedDisplay dec[] =
    {
      { '0', 0x3F },     //      0000
      { '1', 0x14 },     //     1    2
      { '2', 0x6D },     //     1    2
      { '3', 0x75 },     //      6666
      { '4', 0x56 },     //     3    4
      { '5', 0x73 },     //     3    4
      { '6', 0x7B },     //      5555
      { '7', 0x15 },

      { '8', 0x7F },
      { '9', 0x77 },
      { 'A', 0x5F },
      { 'B', 0x7A },
      { 'C', 0x2B },
      { 'D', 0x7C },
      { 'E', 0x6B },
      { 'F', 0x4B },

      { 'G', 0x3B },
      { 'H', 0x5A },
      { 'I', 0x29 },
      { 'J', 0x31 },
      { 'K', 0x5E },
      { 'L', 0x2A },
      { 'M', 0x1E },
      { 'N', 0x58 },

      { 'O', 0x78 },
      { 'P', 0x4F },
      { 'Q', 0x57 },
      { 'R', 0x48 },
      { 'S', 0x72 },
      { 'T', 0x6A },
      { 'U', 0x3E },
      { 'V', 0x38 },

      { 'W', 0x7E },
      { 'X', 0x18 },
      { 'Y', 0x76 },
      { 'Z', 0x61 },
      { '-', 0x40 },
      { '_', 0x20 },
      { '=', 0x60 },
      { ' ', 0x00 },

      { 0, 0 }
    };

    for( int d = 0; dec[d].ch != 0; d++ )
    {
      if( dec[d].ch == c )
      {
        ret = dec[d].value;
        break;
      }
    }

    return ret;
  }
