Tuesday, October 8, 2013

Raspberry Pi Journal #31


Package List and Update


So, the Foundation finally updated their package list. Naturally, I'm curious as to what changes are afoot. So, I did what is natural. I simply dump all package names with what I have right now. I call it pack1.txt

apt-cache pkgnames >pack1.txt

Then I do an update and dump all the package names into pack2.txt

apt-get update
apt-cache pkgnames >pack2.txt

Finally, I did a diff between the two.

diff pack1.txt pack2.txt

And all the new package names appear, just like that!

 pypy-upstream-dev
 pypy-upstream-doc
 python-pifacecommon
 python3-pifacedigitalio
 python3-pifacedigital-scratch-handler
 python3-pifacedigital-emulator
 oracle-java7-jdk
 python-pifacedigitalio
 python3-pifacecommon

The update also mention SonicPi, and searching for it yields sonic-pi package name.

apt-cache search sonic
apt-cache show sonic-pi

Monday, October 7, 2013

Cooking Journal #7

Chicken Steak



Remember last week, when I did chicken nuggets, and I said that it's not what I usually do? Well, this is what I usually do: Chicken steak.

The difference is in the cuts. Stir Fry is usually cut into ribbons. It helps in cooking the meat quickly. Chicken nugget makes a nice compromise in cutting time and cooking quickly. Chicken steak like this is cut very broadly, and thickly. This is one of those cook and leave alone for a while.

On medium low, I think this goes about 10 minutes. Again, I go by smell. You can go by bubbles. If the chicken stops bubbling, that means the water is gone, and you can test to see if the chicken is fully cooked by then.

If you look at the chicken, you don't see any brownings at all. There's no caramelization involved. This is because by nature, the chicken breast that I'm using  has water, and it got mixed in the cooking. So, it's partly fried, and partly boiled. The result is well cooked chicken, but somewhat devoid of taste.

If I wanted to, I can dip the chicken into hot oil to induce caramelization process and get the crispy texture outside. This will result in better taste. Alas, I am too lazy for that. Please pass the ketchup. Thank you.

Saturday, October 5, 2013

Nintendo Journal #7



LeapPad circuitry



I've been frequenting Thrift stores lately and picking up old electronic stuff. I was hoping to score one of those servos, or maybe screen display. When I see this Leappad, I picked it up.

Sure enough, there is display in there. Except, there isn't a 2 lines into it. Or maybe four. There's quite a bit in there. I really don't know how many are there. Apparently there is a standard called DSI that is common for LED display. I looked at it, and it's too fine for me to handle.

If you know Raspberry Pi camera ribbon cable. That looks just like that. There's also a touchscreen pasted on top of the screen, but I don't think it works, because the program does not respond to touch at all. It does have standard 4 wires that I can handle if need be.



I do notice something: The audio plug is low profile. So I ended up soldering it to my Raspberry Pi!

noob tools 1

A very rough preview of what is to come: noob version 0.1. I've been working on it a little bit at a time. Backing up SD card using dd remains the longest activity. Make sure the filename is noob01.sh or fix it on the install case. Or else, it won't install.


#!/bin/bash

#echo "$0"

case "$1" in
halt)
echo "Halting"
sync
sleep 3
sudo halt
;;

reboot)
echo "Rebooting"
sync
sleep 3
sudo reboot
;;

wallpaper)
echo "Choosing random jpg as wallpaper"
PIC=$(ls *.jpg | shuf -n1)
pcmanfm -w $PIC
echo $PIC
;;

blank)
echo "Enable Screensaver"
sudo xset s blank      #Enable blanking
sudo xset s on         #Enable screensaver
sudo xset +dpms        #Enable Energy Saving
;;

noblank)
echo "Disable Screensaver"
sudo xset s noblank   #Disable blanking
sudo xset s off       #Disable screensaver
sudo xset -dpms       #Disable Energy Saving
;;

update)
echo "Updating package list"
sudo apt-get update
#sudo apt-get upgrade
##rpi-update   ###DANGEROUS### Do not use!!!
;;

pkglist)
echo "Available packages"
apt-cache pkgnames    #Show all package names
;;

pkgondev)
echo "Installed packages"
#dpkg --get-selections  #Show installed packages
dpkg --get-selections | grep -o -e ^[[:graph:]]*
;;

backup)
echo "Backing up directories to /media/SD/"
echo
echo "Warning: This will copy the files from internal SD card"
echo "to external USB Flashdrive/SD Card. rsync is used to mirror"
echo "the files. Make sure you choose the right directory."
echo
echo "The directories are:"
for i in {0..99}; do sdlist[i]=0; done
j=0

for i in `ls /media`; do
  sdlist[$j]="/media/$i"
  ((++j))
done

for i in {0..99}; do
  if [ -d ${sdlist[$i]} ]; then
    echo $i ${sdlist[$i]}
  fi
done

echo -n "Please choose a directory: "
read sdint

sleep 1
echo "Warning: You are about to overwrite the content of "
echo ${sdlist[$sdint]}
echo "Continue (y/n)? "
read prompt

case $prompt in
y | Y)
echo "rsync --delete -axv /boot ${sdlist[$sdint]}/boot"
sleep 5
sudo rsync --delete -axv /boot ${sdlist[$sdint]}/boot
sleep 5
echo "rsync --delete -axv / ${sdlist[$sdint]}"
sleep 5
sudo rsync --delete -axv / ${sdlist[$sdint]}
sleep 5
sync
sync
echo "Done!"
sleep 2
;;
*)
echo "Terminating operation..."
sleep 2
;;
esac
;;

restore)
echo "Restoring up directories from /media/SD/"
echo
echo "Warning: This will copy the files from external USB "
echo "Flashdrive/SD Card to internal SD card. rsync is used to"
echo "mirror the files. Make sure you choose the right directory."
echo
echo "The directories are:"
for i in {0..99}; do sdlist[i]=0; done
j=0

for i in `ls /media`; do
  sdlist[$j]="/media/$i"
  ((++j))
done

for i in {0..99}; do
  if [ -d ${sdlist[$i]} ]; then
    echo $i ${sdlist[$i]}
  fi
done

echo -n "Please choose a directory: "
read sdint

sleep 1
echo "Warning: You are about to copy the content of "
echo ${sdlist[$sdint]}
echo "Continue (y/n)? "
read prompt

case $prompt in
y | Y)
echo "rsync --delete -axv ${sdlist[$sdint]}/boot /boot"
sleep 5
sudo rsync --delete -axv ${sdlist[$sdint]}/boot /boot
sleep 5
echo "rsync --delete -axv ${sdlist[$sdint]} /"
sleep 5
sudo rsync --delete -axv ${sdlist[$sdint]} /
sleep 5
sync
sync
echo "Done!"
sleep 2
;;
*)
echo "Terminating operation..."
sleep 2
;;
esac

;;


help | -h | --help)
echo "Help File"
echo
echo "Noob Tools is a collection of bash shell scripts, wrapped in simple command line for ease of use. The user is encouraged to examine the corresponding man pages for further info."
echo
echo "To install this as a command use:"
echo "  sudo ln -s /home/pi/noob.sh /usr/bin/noob"
echo "where /home/pi/noob.sh is the name of the script."
echo
echo "This script is work in progress. Currently pre-pre-alpha."
;;

install)
echo "Installing noob on /usr/local/bin/noob"
sudo ln -s /home/pi/noob01.sh /usr/local/bin/noob
;;

uninstall)
echo "Removing noob from /usr/local/bin/noob"
sudo rm /usr/local/bin/noob
;;

where)
echo "The location of noob is"
which noob
;;

print)
#For printing A4 paper size in US letter size
lp -o scaling=96 $2
;;

clone)
echo "Disk Dumping to SD Card"
echo
if [[ $2 == '' ]]; then
  path="/dev/sda"
else
  path=$2
fi
echo "This will erase existing data on $path"
read -p "OK to delete SD card on $path? [y/n] " REPLY
  if [[ $REPLY == 'y' || $REPLY == 'Y' ]]; then
     echo "Copying /dev/mmcblk0 to $path"
     sleep 10
     sudo dd if=/dev/mmcblk0 of=$path & pid=$!
     sleep 10

     while [ `ls /proc | grep $pid` ]; do
       sudo kill -USR1 $pid
       sleep 15
     done
     
     sync
     sync
     echo "Finished!"
  else
     echo "Terminating process"
  fi
;;

faq)
echo "Raspberry Pi Mini FAQ"
echo
echo "dd clone operation may fail due to cards of differing size. If the "
echo "target card is smaller than the original, the operation will fail with"
echo "insufficient size error message."
echo
echo "You may circumvent the problem by creating a second Raspbian system"
echo "and backup your current system onto that."
echo
echo "To terminate Xserver. Logout, and do Ctrl-Alt-F1"
echo
echo "Wallpaper seems to be changeable from home root directory"
;;

source)
cat `which noob`
;;

credit | credits)
echo "Noob Tools ver. 0.1"
echo "Oct 4, 2013"
echo "by Harry M. Hardjono"
echo
echo "Specifically written for use on Raspberry Pi"
echo
;;

*)
echo "noob tools: a collection of easy to use commands suitable for beginners."
echo "Written by Harry M. Hardjono"
echo "Sep 30, 2013"
echo
echo "Usage:"
echo "noob help             :Show help screen"
echo "noob faq              :Mini FAQ"
echo "noob install          :Install noob on system"
echo "noob uninstall        :Uninstall noob on system"
echo "noob where            :Shows installed path if any"
echo "noob update           :Update system (packagelist (network required))"
echo "noob halt             :Safely shutdown device"
echo "noob reboot           :Safely reboot device"
echo "noob wallpaper        :Random jpg as wallpaper"
echo "noob blank            :Enable screen blanking"
echo "noob noblank          :Disable screen blanking"
echo "noob pkglist          :List all available packages"
echo "noob pkgondev         :List all installed packages"
echo
echo "noob print (filename) :Print slighly smaller print"
echo "noob clone (/dev/sd?) :Duplicate main SD to external SD"
echo "noob backup           :Mirror files from internal SD to /media"
echo "noob restore          :Mirror files from /media to internal SD"
echo
echo "noob source           :Source code for noob"
echo "noob credit           :Credits for noob"
;;
esac

exit 0
                 
#Todo
#noob faq             frequently asked question
#adduser user group   auto create group
#userusbon user       mount user directory to USB
#userusboff user      mount user directory to SD
#userusbusb user      copy user directory from USB to SD
#userusbsd user       copy user directory from SD to USB
#tarback drive USB    dated tarball backup
#tarrestore drive USB dated tarball restore
#format USB size      format USB for ext4 (use dd tar xz of various size 4MB 8MB 16MB 32MB)


Friday, October 4, 2013

Petit Computer Journal #19


 Randomous Klondike Solitaire

Although normally I'd showcase my own games, this time I want to make an exception. There is a computer game that is extremely well done: Klondike Solitaire by Randomous.

Here's the link in Petit Computer Wikia:

http://petitcomputer.wikia.com/wiki/Klondike_(Solitaire)

I would like to mention the fact that this game is special in that it comes with special package where all the components are downloadable separately. That means you can play around with the program and even come up with your own special program. Look for "Klondike Depackaged"

I like the fact that I can change the playing card to my liking. You can use CHRED to do it. Even though you have to be careful since the card shape is hard-coded and you don't want to introduce any holes to the card, it still represents the power of open software.

For that reason, I'm showcasing the program here. I think this extremely simple, yet well-done program is worthy for your consideration.

It also represents an example on how to do SPRITE on the touch screen.

Thursday, October 3, 2013

Book Review #4


Raspberry Pi for Beginner bookazine

This magazine-as-a-book is part of LinuxUser&Developer bookazine series. Just like a magazine, it is filled with large glossy color, and features easy to read passages. The problem with the format is that there are lots of different articles exploring different ideas, but limited in length. So, it's much of an exploration of ideas, as opposed to books that dwell in implementation details. The closest thing I can think of is O'Reilly Getting Started series, except it's light on resources, and plenty of photos. With that in mind, I still enjoyed the bookazine tremendously.

It starts with the basics, what is Pi, what do you do with it, and so one. It seems like every book about Pi deals with it. Considering the volume, though, it's clear that this bookazine is intended for extreme novice. For that, I think this is a good first Raspberry Pi book. My interest lies in the middle section: Projects. It's here that I find articles about remote control car, solar powered pi, webcam server, and so on. Unfortunately, these are light on details. Which means two things:

  1. The issues explored are necessarily brief, focusing only on core features and functions.
  2. The problem solving, in case something goes wrong, is non-existent.


To be fair, point#2 is also light in other works, including technical books. But with longer text, I can usually research such troubles on the Internet. I'm having trouble picking up keywords to research the problem further. In the end, if the project is successfully modified, it is because I spent hours, if not days, researching the subject matter. I don't think that's a good book implementation. But it's certainly acceptable for magazine implementation.

In other words, is this bookazine format successful? If you think of it as fountain of knowledge, then no. If you look at it as fountain of ideas, then it succeeds admirably. So, if you're a new Raspberry Pi user or someone who's interested in knowing what Raspberry Pi is all about, then this bookazine is a good first Raspberry Pi book to start.

Tuesday, October 1, 2013

Raspberry Pi Journal #30

NOOBS 1.3


Rob Bishop of Raspberry Pi foundation just announced recently asking for Beta Testers for the newly crafted NOOBS 1.3

I can see that a lot of work has been done to make it extremely user-friendly and accessible. A very interesting take about it, is the fact that you can easily have multiple OS flavor in one SD card. Therefore, you can have one all-encompassing SD card that is suitable for general, scratch, headless, servers, and so on. This is very big news! An educator can now use just one SD card for teaching different discipline. Very convenient, and thank you for providing this functionality.

I'm ambivalent about it, though. I guess I'm more of the old school tar-ball method. My idea of doing minimal headless server method would be to just install a standard distro, then ruthlessly purge the unnecessary packages. Of course, it'll be done automatically with a script.

Speaking of which, there is still no switch to use external USB hard drive. Considering that SD card do have the very real issue of wear, I think attaching a USB hard drive would be recommended so as to prolong the life of the system. I will see if I can do something about it.

Maybe some script that says: reboot with USB harddrive, and reboot with internal SD card. One button backup/restore would be handy, too. I probably will use rsync on that one.

I currently have a script that I run at the end of the day. I call it "EndOfDay.sh" that back ups my SD card to USB flashdrive, and updates my ToDo List. It's all very messy, so I will have to clean it up further.