Sunday, September 6, 2015

9-06-2015 Get Kivy to make an android app on my phone using Dalvik (status: done)

Unfortunately my phone won't upgrade to 5.0 so I can use ART. I think once I fix my phone i will switch to ART. The reason is that I am probably a year away from really using it in prod, and a year from now most everything will have ART. I don't care about apple products for cost reasons and target audience.

The nice thing is I might be able to write a program that runs on a phone, tablet, Linux, Windoze, and iOS. It is not going to be an intensive program.


sudo add-apt-repository ppa:kivy-team/kivy
  # I want python2, I hate python3
sudo apt-get install python-kivy

sudo apt-get install kivy-examples # didn't work

  #Had to remove ffmpeg. On Linut Mint, hope it doesn't make a difference compared to ubuntu. 
sudo apt-get install -y     python-pip     build-essential     mercurial     git     python     python-dev          libsdl2-dev     libsdl2-gfx-dev     libsdl2-image-dev     libsdl2-mixer-dev     libsdl2-net-dev     libsdl2-ttf-dev     libportmidi-dev     libswscale-dev     libavformat-dev     libavcodec-dev     zlib1g-dev

sudo pip install --upgrade pip virtualenv setuptools


virtualenv --no-site-packages kivyinstall

  ## I guess this puts us in the virtual environment. 
. kivyinstall/bin/activate

pip install Cython==0.21.2
pip install kivy


pip install git+https://github.com/kivy/buildozer.git@master
pip install git+https://github.com/kivy/plyer.git@master
pip install -U pygments docutils


  # We need to know where the examples are. 
python -c "import pkg_resources; print(pkg_resources.resource_filename('kivy', '../share/kivy-examples'))"

# Even though the output was: /root/kivyinstall/local/lib/python2.7/site-packages/kivy/../share/kivy-examples
# my path was : /root/kivyinstall/share/kivy-examples/
ln -s /root/kivyinstall/share/kivy-examples kivy-examples
cd kivy-examples
cd demo/touchtracer
python main.py

cd ../pictures
python main.py

   # Dumb I am root, but this is a test box. 
   # This makes it so the beginning of the scripts can be #!/usr/bin/kivy
ln -s /root/kivyinstall/bin/python /usr/bin/kivy



Packaging for android
git clone https://github.com/kivy/buildozer.git
cd buildozer
sudo python2.7 setup.py install


buildozer init
buildozer android debug deploy run

git clone git://github.com/kivy/python-for-android
./distribute.sh -m "pil openssl kivy"



Had to do some work on apache and git on my local box when pushing to production.
Locally:

  • cd /var/www/html/
  • rm index.html
  • mkdir DIR
  • chown work DIR
  • In the apache config: /etc/apache2/sites-enabled/000-default.conf
    • <Directory "/var/www/html/hhcf/">
      AddHandler cgi-script .cgi .py
      AllowOverride All
      Options +Indexes +FollowSymLinks +ExecCGI
      Order allow,deny
      Allow from all
      </Directory>
  • a2enmod cgi a2enmod status a2enmod info
  • Restart apache
For git I created a bash script to save stuff quickly. I don't care about comments because its all me. I just called it "G" with chmod 755 /usr/local/bin/G.


#!/bin/sh

echo $1
git add $1 
git commit -m "auto"
git push origin master





Wednesday, September 2, 2015

9-02-2015 VoltDB community install on laptops (status : stuck)

I am going to install the community version of VoltDB. This means you have to compile it.Hope this changes. I will try to get the enterprise edition somehow.




sudo apt-get -y install ant build-essential ant-optional default-jdk python \
    valgrind ntp ccache git-arch git-completion git-core git-svn git-doc \
    git-email python-httplib2 python-setuptools python-dev apt-show-versions


git clone https://github.com/VoltDB/voltdb.git

cd voltdb
ant

  # following instructions on 2.2.3 ad then 2.2 to install. 
ant dist

tar -zxvf  ./obj/release/voltdb-5.6.tar.gz -C /opt
ln -s /opt/voltdb-5.6 /opt/voltdb

  # Puts the binaries in the path of all accounts. 
  # I don't like having to modify each path in each account. 
  # You could modify an etc file for the path I guess. 
cd /opt/voltdb/bin
for i in `ls`; do echo $i; rm -f /usr/local/bin/$i; ln -s /opt/voltdb/bin/$i /usr/local/bin/$i; done

  # This turns off something in memory. 
echo never >/sys/kernel/mm/transparent_hugepage/enabled

  # Turn off swapiness.

echo "" >>  /etc/sysctl.conf
echo "vm.swappiness=10" >> /etc/sysctl.conf
echo "" >>  /etc/sysctl.conf


  # Add the following to /etc/rc.local
#!/bin/bash
for f in /sys/kernel/mm/*transparent_hugepage/enabled; do
    if test -f $f; then echo never > $f; fi
done
for f in /sys/kernel/mm/*transparent_hugepage/defrag; do
    if test -f $f; then echo never > $f; fi
done 

  ### then reboot


sudo apt-get install screen  # Add this to my server setup. 
sudo apt-get install tmux


reboot


On server mark4:

  • voltdb create # as the user mark 
    • I don't know if its because its a community edition or what, but it spit out some messages.
      Build: 5.6 voltdb-5.5-158-gdb3a5fd Community Edition
      Connecting to VoltDB cluster as the leader...
      Host id of this node is: 0
      Initializing the database. This may take a moment...
      WARN: Strict java memory checking is enabled, don't do release builds or performance runs with this enabled. Invoke "ant clean" and "ant -Djmemcheck=NO_MEMCHECK" to disable.
      WARN: This is not a highly available cluster. K-Safety is set to 0.
      WARN: Durability is turned off. Command logging is off.
      Server completed initialization.
      
  • Now I need some sort of license, so I am stuck because I want to setup a cluster. Do I need a community license?