Monday, September 30, 2013

Cooking Journal #6

Chicken Nugget


Well, if you're like me, you probably like to eat chicken nuggets. Truthfully, I don't cook them all that often. Too much hassle! Still, from time to time, it's okay.


And it's not that big of a deal. I simply slice the chicken into bite-sized pieces and deep fry them. What I like to do is do it on medium heat. This particular batch was actually done on low heat. The chicken brown fine, but they came out dry. Very dry.

The heat convection will need to penetrate the meat, so be careful that you cook it all the way through. Low heat yields nice, well-cooked chicken, but unless you do sous-vide, it's best to use medium heat. That way, the meat outside will be nice and crispy, while the meat inside is still tender and juicy.

Another thing, is that I didn't put anything on the meat. Just the chicken and the cooking oil. You can see that I put enough oil to cover the meat. And I have a special drying rack for the meat to drip free of oil. So, the sensation is pure. I understand that people, in general, would prefer condiment to go along with it. If you go to some fast food restaurant, then you have some idea what kind. I usually go with BBQ sauce, although Sriracha is plenty good also.

Saturday, September 28, 2013

Misc #1

Miscellaneous #1

If you have been following my blog for a while, you see that my posts are rather uneven. This makes it hard for you to follow my posts. The only regular schedule that I have is Cooking. I post them every Sunday. Well, no more! I'm now going to post them every Monday.

The reason is that I do my cooking on my "rest" day, which is Sunday. So, I thought that it would be natural for me to post them on Sunday. Except, it isn't. So, I will be doing special cooking on Sunday, and post them on Monday. That way, if you're like me, and do your special cooking on Sunday, you'll have the whole week to prepare.

Another thing that I want to do is to start making regular schedules on features. This means that specific topics will get specific days. I have the mnemonic done:

Meal Monday: Cooking
Tech Tuesday: Raspberry Pi + other project
Write Wednesday: How tos
Review thuRsday: Review books (movies?)
Fun Friday: Petit Computer Journal and other gaming.
Super Scramble Saturday: News, Nintendo, and other extras

I'm leaving Sunday out, as it is my rest day. My day to do nothing. I'm thinking of making it Sermon Sunday, though. Currently undecided since all my preaching stuff goes to ramstrong blogspot. But that may change in the future.

You haven't yet seen my How-tos. That will change soon.

The only problem I have is time. How am I supposed to keep up with all these postings every week? I may not be able to keep it up every day, but what that means, is if I can't, then that day will be skipped. I will post ETAs in the directories, so you can check the directory pages if some more entries are incoming.



Friday, September 27, 2013

Book Review #3

Algorithms in C++

Robert Sedgewick

This is a very old copy of the book. Robert (Bob) Sedgewick has been writing this book in various languages over the years. Some of them are rather thick! The one copy I have is an old, out-of-print hardcover edition, Algorithms in C++.

How old is the book? The book came out when C++ has just come into being. The majority of computer programmer were still using plain old C. The programs in the book are written in C. Only the data structure is written in C++ format. The year was 1992.

I like to think of it as the layman's guide to Donald Knuth's The Art of Computer Programming books. Every time I read Donald's book, my mind went blank. The farthest I can read was 5 pages. That was on bubble sort algorithm, a subject in which I know intimately. Obviously, the professor has his head in academia world, because the rest of us do not read or write like that! Thankfully, Robert Sedgewick distilled the essence of it, and put forth the content the rest of us can decipher.

I have read a few more algorithm books, but I think this one stands a mention. The rest pales in comparison. If you have this book, and supplement it with special purpose procedure/math formulas book, then you should be prepared for most eventualities.

You do need to know C, but I assume those of you who knows C, Objective C, C++, C#, and other C variants will have no trouble understanding it.

Unlike, say, a special-purpose, non-existent, artificial assembly language. Really. I think it's easier to teach the readers the whole C language, than reading a single program written in assembly language.




Thursday, September 26, 2013

Raspberry Pi Journal #29

BASH Scripting


As you may know, Python is the officially supported programming language of Raspberry Pi. What you may not know is that the Raspbian shell is bash, Born/Bourne Again Shell. Bash is a more sophisticated version of sh. There is also csh, and other flavor, if you're interested.

That's why, you frequently see "#!" shebang format for script language. That has special meaning to run the program specified and feed it the content of the file. That's right. A Python script is just a program that interprets the file's content. Pretty convenient, eh?

So, what does that have to do with bash? If you're used to Windows shell, probably not much. But if you look at the documentation for bash, man bash, you'll see that it is rather involved.

Shell scripting isn't strictly computer programming, although the nuance may be lost to inexperienced coder. If you know Perl, that language was designed to act as a glue language for various programs. So, the relationship would be bash-perl-program.

And Perl is very convenient to use. I use it a lot in the past. However, sometimes you don't need the full brunt of full-featured scripting language. bash is a viable lightweight alternative.

I'm not that good of a coder with bash. Still, it is something you should learn. There was a job description that says something like:

The applicant must know Unix shell programming, but sufficiently advanced enough to realize that it is not an achievement.

In other words, shell scripting is not a proper computer programming. It is a "convenient" tool.

Let me just point to you a nice resource that I found on the web, and I happily read it. I hope you do too.

http://tille.garrels.be/training/bash/

You need to know Linux already, but for those of you who do, this is a great resource.

Wednesday, September 25, 2013

Raspberry Pi Journal #28

Trademark Rule

If you noticed, the Raspberry Pi directory page now sports the disclaimer that Raspberry Pi trademark is owned by the Foundation. It's actually common sense, but just to clarify, this site is not affiliated with the Foundation in any way, and the posts here are my posts. So, any mistakes I made here is my responsibility. What goes on this are strictly my opinion, etc.

The full trademark rule can be found here:
http://www.raspberrypi.org/trademark-rules

I'm at odds here. It's too inconvenient for me to put the disclaimer on every Raspberry Pi posts, and yet, this blog has more with common, everyday, accessible technology than focusing entirely on Raspberry Pi. How else do you think Cooking is included?

In the end, I decided to just apply it to Raspberry Pi specific page, and that is the directory page. I hope that is enough.

Come to think of it, there is a rule that says:

(ii)         use the Raspberry Pi Word Mark as part of the domain name for your website;

And there are actually several web/blog sites that does feature the word "raspberrypi". The obvious one would be

http://www.theraspberrypiguy.com/

who did several excellent video tutorials regarding the device, but no trademark disclaimer anywhere.

Anyway, I hope I make it clear that I'm not affiliated with the Foundation in any way, except as a happy customer.



Monday, September 23, 2013

Raspberry Pi Journal #27

Cheap Transparent Case

I was browsing the web when I ran into a description on how you get those tupperware as cheap Raspberry Pi container. Well, I think I did well. This is one of those removable sticker case. They come in all sizes, and are usually too small. However, this reload pack is a perfect fit!


Sunday, September 22, 2013

Cooking Journal #5


Chicken and Egg Fried Rice


I'm cooking some chicken and egg combo. If I think about it, I suppose the chicken get it at the short end of the stick. First we take their egg, then we kill and behead the chicken so we can eat them. Doesn't sound fair when you put it that way, eh?

Any way, chicken are cheap, unlike cows. I have nothing against cows. Just substitute the chickens for the cows.



I slice thin 2 thighs. Coat with a tablespoon or two cooking oil, and soy sauce. Unless, that is, you like teriyaki sauce. Cook on Medium. Cover. I always cover for heat retention.



After the bottom side is cooked, flip the meat over. How do you know if the bottom side is cooked? By smell. Or you can just guess. If you guess wrong, just flip it again. No big deal. Repeat until done.



I already pre-cooked the rice. Just dump the chicken onto the rice. Pour out leftover oil. Dump the rice+chicken combo into the wok. Do another teaspoon of oil coating. Add sauce as desired. Mixed thoroughly.

Just keep stirring. The fried rice is done when it's steaming good. As a note, you may want to cook on HIGH if you want crunchy on the outside, and soft on the inside.



Dump the fried rice into serving bowl. Crack eggs into Wok. I like to put in one egg yolk no matter how many eggs I'm using, due to cholesterol concerns. Twirl the yolk to somewhat pleasing shape. Cover. Wait until done. How do you know it's done? By smell. If you don't know how to do it, just experiment. There's really only one big change in smell. Otherwise, just use a timer. I always go by smell, though.

No, I can't tell you how it smells. The egg should be able to slide freely when it's done, even if you have to help loosen it with a spatula.



Even with the cover, the bottom one will be done, when the top is only half done. Flip it! Like you would a pancake. It's helpful to not use too much oil in this phase.

Turn off the stove. The existing heat will cook the other half of the egg without too much trouble. Just wait a minute or so, and then you're done! Dump the egg into the waiting serving dish.

Note:
In the old college days, I'd dump everything into the wok, and eat out of the wok. It helps with cleaning! The sequence would be: Cook meat (no oil). Take meat out, put egg. Cook until done. Put meat back in. Add rice. Fry everything until done. That's something to think about when you're short on time, dish, and oil/sauce money.

Saturday, September 21, 2013

Raspberry Pi Journal #26

Slim Pi Project


Yeah, I've always wondered how it goes. Hey, $25 is cheap enough to experiment. So, I bought a Raspberry Pi model A. Then I proceeded to remove the audio, video, and capacitor from it. The ethernet and USB hub are already gone. So far, it still works!

There's something interesting, though. When I removed the capacitor (by yanking it out of its socket, of course), the HDMI stopped working. I wonder if the capacitor gives enough current stability to the HDMI? Oh, well. I've always been planning to do it headless, anyway.


Although broken capacitor is technically covered under warranty, I don't think it applies in this case, considering that it is self-inflicted. I suppose I now truly own the device.

I guess this reminds me of frog dissection. Why would you want to open up a frog? Sorry. It's for science.

^_^;

Friday, September 20, 2013

Raspberry Pi Journal #25

Adafruit LCD with Keypad kit


Nothing more to report, but I soldered the kit. At one point, I thought that I installed the 18 pin header wrong, but a quick check with the pdf manual on-screen (with color) instead of printed out shows that it's correct. How come the pins are so tall? The bottom pins are rather short.

I had trouble soldering the pins so close to the display.

I wonder if they make a special case for it?

Too late that I realize if I made a slim Raspberry Pi, I can just solder the GPIO directly, instead of using Header. Of course, that makes it a dedicated unit.

No time to download software. Will have to do the testing some other time.


Thursday, September 19, 2013

Raspberry Pi Journal #24

Learning to Solder


Well, I got myself Adafruit LCD with keypad kit. There's only one problem: It's a kit and I'm a software guy. My last soldering activity was classified as "under cooked". Definitely not a good assessment. I haven't touched a soldering gun since.

But what to do? The LCD only comes in a kit. There's nothing to it, but buckle up and learn how to solder properly this time. I picked up Sparkfun Big Time soldering kit. And well, get to it.

I learned a lot along the way. How to do proper soldering. How to feed the lead to the hole+wire. What part goes where. I don't like it that the manual automatically assume success on the very first soldering hole, but that's exactly what happened. It went rather well.

The lead just went into the hole like water going down the drain. Perfect form! Not every time, but I definitely did it right. The fact that the kit works fine, including surface mounting the battery compartment, is confidence building!

I had some trouble with brown wrapper, but a squeeze with finger nail did help in removing the paper.

Today, Big Time. Tomorrow, LCD with Keypad!

There is one thing I don't understand. Somehow, no matter how I oriented the workspace, the fume kept going to my direction. Supposedly, it's harmless rosin, but I still don't want to inhale anything smoky. And why does it always goes to my direction? Turn it this way and that, nothing helps. Sigh.





Wednesday, September 18, 2013

Petit Computer Journal #18

Letter from Japan



Remember last time I told you about Coral Maze being nominated in the competition? Well, I have a nice surprise in that I got a package from Japan via Air Mail! It's from SmileBoom sending all of us nominee a nice care package for being nominated.

It has some stickers, a CD, a nice letter. The picture above is an illustration on how the selection is done: By RANDOM! (not really).

Apparently, entries that aren't nominated only receive the stickers, and no CD. I saw the award ceremony on YouTube. It's pretty fun, but really, I don't speak Japanese. Still, the fun spirit is there, and I appreciate the letter very, very much!


Tuesday, September 17, 2013

Raspberry Pi Journal #23


Sorting Log  Frequency List


A lot of times, in analyzing log files, you want to see how often something happens. Maybe you want to know how often a particular user logon in a day, or how many times a web page is accessed? If you want to do a daily report, you want to automate the process. Well, there is an easy way to do it using Perl. But since I'm still learning the shell, I want to know if there's a way to do it using shell, not necessarily the most efficient, but as long as it's relatively quick, then it should be alright.

The first thing you want is a way to get only the relevant piece of data. I want to do this in two steps:
1. Identify the wanted line
2. put the identifying unique word in a line in a file.

Let's say I want to parse /var/log/messages.1 for various processes. I would do this:

egrep -o 'raspberrypi [[:alnum:]]+' messages.1 | egrep -o [[:alnum:]]+$ | sort > messlist.txt

replacing "raspberrypi" with your unique SSID_hostname. The "-o" option says that only the matching text, instead of the whole line will be piped out. I do it twice, first with the tell-tale SSID token, then only the process name. I also sort the file and write it out to messlist.txt

We now have the frequency list. How will we get unique names of the list? Simplicity itself. I simply sort it out again, with the "-u" option.

sort -u messlist.txt > messuniq.txt

That's all there is to it!

Now that we have two files, one containing the unique id, and the other contains all the instances of the ids, we can now count them no problem.

for NAM in `cat messuniq.txt`;
do
  echo $NAM `egrep $NAM messlist.txt | wc -l` ;
done

If you are familiar with computer programming at all, you will probably recognize that this algorithm is not at all efficient. What it basically does is for each entry in messuniq.txt, scan all entries in messlist.txt, outputting only those that matches, and count each occurrence. It's pretty easy to do. It's easy-as-a-bubble-sort, and just as inefficient.

But it works, and works well. So, there you go. If you want to do frequency counting, no need to bring out some large, bloated scripting engine. Just do it via shell!

By the way, I was confused by the instruction in using "for" loops. I keep using the square brackets, and keep getting invalid token error. It was only after I step back, and consider all possibilities that I guessed that the square brackets are there only to indicate optional entries. As such, I eliminate all the square brackets, and it works!

Here is the script in its entirety:

#!/bin/bash

egrep -o 'raspberrypi [[:alnum:]]+' messages.1 | egrep -o [[:alnum:]]+$ | sort > messlist.txt
sort -u messlist.txt > messuniq.txt

for NAM in `cat messuniq.txt`;
do
  echo $NAM `egrep $NAM messlist.txt | wc -l` ;
done



And here is the output:

kernel 6379
motion 1545
mtp 34
rsyslogd 19
shutdown 14
wpa 366

Monday, September 16, 2013

Raspberry Pi Journal #22


Constructing ToDo Files  


I'm rather busy. In fact, I'm so busy that I'm constructing a master ToDo list, and it's rather long. So, I cast about ways to automate the process. Well, Linux to the rescue. It has sophisticated shell commands that allows me to sort the different stages on my list. This is an example of my master todo list, called "MasterTask.txt"

TASK: Petit Computer
Petit Computer Picross Dec 2012 hold
Petit Computer Journal #N WITCH start
Petit Computer Journal #N Virtual Keyboard todo
Petit Computer Journal #N Turtle Graphic

TASK: Raspi Journal
Raspi Journal: ebook - calibre - done
Raspi Journal: Log Frequency List
Raspi Journal: ToDo List
Raspi Journal: webcam, motion: Deer camera on the cheap todo
Raspi Journal: SD Back Up #3 Success with TAR
Raspi Journal: SD Back Up #4 A little thing called rsync
Raspi Journal: Can a Raspberry Pi be used to create a backup of itself?
Raspi Journal: SD wear leveling

TASK: Book Reading
Raspberry Pi for Beginner done
Programming Linux Games
Algorithm in C++
Modernist Cuisine at Home

So, as you can see, the format is simple. There is "TASK:" in the beginning of a line, representing a header. A single line per task, and a status word at the end of the line. They are:

start - the project has been started
todo - the project has been scheduled
hold - the project has been put on hold
wait - the project is waiting for a missing part
done - the project has been completed
skip - the project has been cancelled

What's the difference between started and scheduled? Sometimes, the project needs some materials to be purchased. While I'm gathering materials for the project, it will not be scheduled. Only once all the materials has been gathered will the project status be changed to "todo"

So, what I want to do is to create several files:
TaskToday.txt - contains all the "start" and "todo" projects
TaskHold.txt - contains all the "wait" and "hold" projects
TaskDone.txt - contains all the "done" and "skip" projects
TaskLog.txt - a running log of all projects done.
TaskNext.txt - The updated MasterTask.txt minus all the finished projects

Looks to be comprehensive, right? Usually, in C programming, I would need quite a lot of lines of code in order to achieve those tasks. I need a less lines if I'm using one of those "convenient" scripting language, such as Perl. I'm wondering just how difficult it is to do the whole thing using bash shell. In fact, here is the script that I'm using.

#!/bin/bash

cat MasterTask.txt | grep -e ^TASK -e 'todo *' -e 'start *' > TaskToday.txt
cat MasterTask.txt | grep -e ^TASK -e 'hold *' -e 'wait *' > TaskHold.txt
cat MasterTask.txt | grep -e ^TASK -e 'done *' -e 'skip *' > TaskDone.txt
cat MasterTask.txt | grep -v -e 'done *' -e 'skip *' > TaskNext.txt

#CycleLog
date >> TaskLog.txt
cat TaskDone.txt >> TaskLog.txt
#cp TaskNext.txt MasterTask.txt

And that's it! Pretty much all one-liner. Let's explain this a little bit. I'm using the commands "cat", "grep", "date", and "cp". That's it. You can figure out what the options are from the "man" command. "man cat", "man grep", "man date", "man cp".

So, the first line, basically says: Type out the contents of MasterTask.txt and pipe it to "grep" which will take all the lines that is
1. Starts with "TASK" or
2. Ends with "todo" or
3. Ends with "start".
Then pipe those lines into a file called TaskToday.txt. Same thing with the next two lines with "hold/wait" and "done/skip"

The fourth line says to pipe the all the lines, *except* the ones that ends with "done/skip"

The "-e" option simulates egrep, except as I understand it, egrep is deprecated.

The Cycle Log part is simply appending the current date to TaskLog.txt, then piping out the content of "TaskDone.txt", appending it to TaskLog.txt. That's about it.

The last line is commented out, since I like to do it manually while testing the script. It simply replaced MasterTask.txt with TaskNext.txt. In other words, take out all the "done/skip" tasks from MasterTask.txt. It's that simple!

Sunday, September 15, 2013

Cooking Journal #4

Safron Rice with Oyster

There are all kinds of rice. Sometimes, I go with fried rice. Or maybe brown rice. Or the easy kind, because the package is sold in supermarkets, Saffron rice. It used to be saffron is sold is small spice package. The one I use is already mixed, so it's extremely easy to use.


  1. Add yellow rice package into the pan (1 cup)
  2. Add Oyster package into the pan
  3. Add 1.3 cup of water into the pan
  4. Hit "White Rice" to start



Rice to pan

Oyster to pan

Water to pan

Hit Start

Saturday, September 14, 2013

Raspberry Pi Journal #21

Cost of Ownership: Raspberry Pi

Raspberry Pi has been billed as the low-cost computer. When model A is priced at $25, and Model B is priced at $35, who can blame them? I bought mine at $40, due to mark up, but that's okay.

What I didn't count on, is that I will be getting multiple units. I have in my possesion 3 Model Bs, and 1 Model A. So, I was shopping peripherals last time. I looked at the total: $150. Ouch.

That does not compare with today, though. I actually bought a soldering kit + voltmeter unit because that Adafruit LCD w/ keypad unit comes in a kit!

I'm a dedicated software guy, and I'm buying a soldering kit! Talk about new experiences. So far, I have done back ups, bash scripting, and webcam. I'll be blogging those in the future. But hardware projects? Unthinkable!

Of course, I also purchased Lego Mindstorm EV3 robotic system. That's another $350 down the hatch.

So total purchase? $150+$350+$200, and total is $700! For Raspberry Pi projects. Sigh.

Well, at least that's it. No more hardware that I can think of.

Wait a minute. I have some idea about wiring up some large capacity capacitors so I can have a delayed power off for proper shutdown. Hmmm. I wonder how much those cost? ^_^;



Friday, September 13, 2013

Petit Computer Journal #17

WITCH

I wrote WITCH to showcase the SPRITE capabilities of Petit Computer. There are lots of people who doesn't know how to use sprites. In fact, Petit Computer sprites are so powerful, you can easily replicate old games.

So here is the WITCH program that is purposely SPRITE heavy. There are certain techniques where I could have done it traditionally, but chose to implement it using a sprite instead. Notably, there is a TIMER sprite, where the sole purpose is to spread the bullets so that they don't trip over one another.

I chose the firing of the fireball using stylus because somebody was asking the way to do it. He was wondering about how to fire the bullet in the direction of the stylus, without stopping at the point of the stylus. In my solution, I also took care of the speed of the bullets. Done carelessly, the bullets may have different speed.

'THE WITCH AND THE UNDEAD
'A SPRITE EXERCISE

'1. WITCH
'2. FIREBALL
'3. UNDEAD FALLING
'4. UNDEAD WALKING
'5. UNDEAD HIT
'6. WITCH HIT
'7. EXTRAS

@INIT
H=100:'HEALTH
NUMZ=1:'CURRENT NUM OF ENEMY
MAXZ=20:'MAXNUM OF ENEMY
SCORE=0

ACLS
PNLTYPE "OFF"
SPSET 1,108,1,0,0,0:'WITCH
SPCOL 1,0,0,16,16,FALSE
SPOFS 1,120,170

'BULLET
FOR I=2 TO 9
SPSET I,142,0,0,0,0
SPANIM I,2,10,0
SPOFS I,30,180,I*90
SPCOL I,0,0,16,16,FALSE,2
NEXT

'CURSOR
SPSET 10,253,1,0,0,0
SPCOL 10,0,0,16,16,FALSE,0

'TIMER
SPSET 11,3,1,0,0,0
SPCOL 11,0,0,16,16,FALSE,0
SPOFS 11,200,200

'UNDEAD
FOR I=20 TO 20+MAXZ
SPSET I,130,RND(16),0,0,0
SPANIM I,2,20,0
SPOFS I,200,-300
SPCOL I,0,0,16,16,FALSE,1+2
NEXT



@MAINLOOP
VSYNC 1:X=TCHX:Y=TCHY:S=TCHST:B=BUTTON(0)
LOCATE 0,0:?"HEALTH=";H;"   ":?"SCORE=";SCORE
SPOFS 10,X,Y
GOSUB @FIREBALL
GOSUB @ENEMY

IF SPHIT(1) THEN H=H-1:BEEP 37
IF B AND 4 THEN DX=-8: GOSUB @MOVE
IF B AND 8 THEN DX=8:GOSUB @MOVE
'IF B AND 16 GOTO @END
IF H<=0 GOTO @END
GOTO @MAINLOOP

@MOVE
SPREAD(1),SX,SY
IF SX+DX>0 AND SX+DX<240 THEN SPOFS 1,SX+DX,SY,8
RETURN

@ENEMY
SPREAD(1),SX,SY
FOR I=20 TO 20+NUMZ
SPREAD(I),ZX,ZY
IF (1 AND SPCHK(i)) GOTO @ENEMY2
IF ZY>SY THEN SPOFS I,SX,SY,SPEED:GOTO @ENEMY2
SPEED=(50000-SCORE)/100:IF SPEED<60 THEN SPEED=60
SPOFS I,RND(255),0
SPOFS I,RND(255),SY+1,SPEED
@ENEMY2
NEXT
RETURN

@FIREBALL
FOR I=2 TO 9
IF SPHIT(I) THEN GOSUB @HITZ
IF !(1 AND SPCHK(I)) THEN SPOFS I,I*18,300
IF S==1 AND !(1 AND SPCHK(11) THEN @SHOOT
NEXT
RETURN

@HITZ
BEEP 14
SPOFS I,80,0
SPOFS SPHITNO,30,-150
SCORE=SCORE+FLOOR(SQR((SPHITX-SX)*(SPHITX-SX)+(SPHITY-SY)*(SPHITY-SY))/3)
NUMZ=FLOOR(SCORE/1000)+1
IF NUMZ>MAXZ THEN NUMZ=MAXZ
RETURN

@SHOOT
CB=((CB+1)%8:CBS=CB+2
IF (1 AND SPCHK(CBS)) GOTO @SHOOT2
BEEP 10:SCORE=SCORE-1:IF SCORE<0 THEN SCORE=0
SPREAD(1),SX,SY
A=ATAN((X-SX),(Y-SY))
SPOFS CBS,SX,SY
SPOFS CBS,SX+300*SIN(A),SY+300*COS(A),150
SPOFS 11,250,250,20
@SHOOT2
RETURN

@END
CLS:?"GAMEOVER"
BGMPLAY 6
WAIT 60
END

Thursday, September 12, 2013

Petit Computer Journal #16

Petit Computer Coral Maze


SmileBoom entry for Coral Maze

I wrote the Amazing Maze a while back, and bluerobin2 decided to make a game out of it. One thing led to another and before we know it, we have a full-fledge game on our hand.

SmileBoom was having a competition, and I entered this one. I was going to enter another game, but polishing this game, as simple as it is, took a long time, and I didn't finish my other game.

Still, I thought the fact that it was a spontaneous teamwork who never met in person would be interesting. It's a great feeling to be nominated! Kindly, SmileBoom has this to say about it:

"I've seen you everyone working together and making enjoying. It is one of the ideal way of PetitCom."

An obvious machine translation, but kind words, nevertheless.

There will be an entry in petit computer wiki, and I'll update the link when it happens.

http://petitcomputer.wikia.com/wiki/Maze_Generator

Wednesday, September 11, 2013

Nintendo Journal #5

American Mensa Academy


It took me 3 tries to get this score. That's not a bad score. American Mensa Academy for Nintendo 3DS e-shop.

Tuesday, September 10, 2013

Nintendo Journal #4


Nintendo Journal #4

A simple object, taken with my Nintendo 3DS camera. I think  it's telling that I'm using my N3DS for replacement of digital camera.



Monday, September 9, 2013

Raspberry Pi Journal #20


Installing Web Camera

Or How to Get a High End Deer Camera Really Cheap

I was shopping around at MicroCenter when I saw this cheap HP webcam HD 2200 for sale. I couldn't resist and bought one. So, the first thing to see if the camera would work right out of the box. And what do you know? It works fine.

There's a program called lucview that you can use to see if the webcam works, but I simply use the mplayer program that I already downloaded.

mplayer tv://

That will work just fine. Apparently, though, the cheap webcam has bad adjustment. It's fine under sun light, but when the room is dark, the blacks become blue and green. So freaky!

Next, it's video capture time. I'm using a program called motion. The program uses configuration file. It took me a while to notice that there is no command line parameters. In the end, I simply create a file called motion.conf and put it in my directory. Also notice, that if you have more than one, you also need to create motion1.conf, motion2.conf, and so on. Not that I will have more than one. Even using one, my Raspberry Pi goes to max CPU so easily.


pi@rustypi ~ $ cat motion.conf
#motion -c /home/pi/motion.conf
auto_brightness off
brightness 200
contrast 200

control_port 9001
control_localhost on
webcam_port 9090
webcam_localhost off
framerate 2
noise_level 255
noise_tune on
threshold 16400
threshold_tune off
max_mpeg_time 540

ffmpeg_cap_motion off
ffmpeg_cap_new on
ffmpeg_timelapse 2
on_motion_detected echo "motion is detected"
on_movie_start echo "Movie  %f is starting"
on_movie_end echo "End of Movie %f"

jpeg_filename cap%M%S
#jpeg_filename preview%T
movie_filename Movie%v
snapshot_filename shot%M%S
timelapse_filename tlapse
target_dir /home/pi/webcam_images

height 640
width 480
output_all off
output_motion off

Quite a long list of options, right? It uses 2 ports. One is for control, or the user interface for the program. Another is for webcam, or the viewfinder of the program. The viewfinder uses MJPEG stream, something Midori cannot handle. I eventually relented and use my Kindle Fire for it.




You can see the big monitor that is running Raspberry Pi, and I'm holding the webcam next to my Kindle Fire that is acting as my viewfinder. Talk about technological overkill! It works well enough, but that's quite a bit of technologies involved here. Oh, the blue box? That's my Nintendo 3DS XL. I'm using it to take the picture.

Hmmm. It looks like I'm using a bunch of cheap technologies, doesn't it? Does that means I'm a cheapskate?





Here is the view of the directory. I created a special "webcam" directory to hold the images. I'm thinking of moving it to external SD card, because of SD write wear problem.

The name of the files are different according to what you want to use. In this case, I'm using capHHMM format. There are lots of different format, depending whether or not you're capturing time-lapse and whatnot. The only thing I can tell you is for you to experiment.





I thought I was being clever and decided to capture screenshot via webcam. It turns out the lighting was atrocious and all I got was a bunch of colored dot. Not at all what I was looking for. I set the brightness manually, and brought it extremely bright lights. It works, in that the screen looks normal. It doesn't work in that the lighting was uneven. Either way, the result is unusable.

You know, I was thinking how this Raspberry Pi is really compact and that motion program is really powerful. Then it occured to me that I can duplicate the project as Deer Cameras.

I was looking through the Cabela's catalog, and it features lots of deer cameras, starting from $80 and up. So, I'm thinking, Raspberry Pi, battery, webcam, Wifi dongle. Those probably costs about $60. Tupperware for rain-proof enclosure, and you have the redneck equivalent of Raspberry Pi powered Deer Camera!

You'll run it headless, for sure. You can set it up anyway you want. In short really nice functionality of a high end deer camera for the price of the cheapest kind.

Well, there's one thing missing. It can't take picture in the dark. I suppose, you'll need infrared spotlight. Or heck, since we're talking about redneck version, just hook up multiple Million Candlelight Spotlight, set to trigger when the deer is in range. Just freeze those deer in multitude spotlights, good for taking pictures with webcam in the middle of the night!




Sunday, September 8, 2013

Cooking Journal #3

Minestrone Ramen with Tea


Sometimes, I'm just so busy and don't have time for proper cooking. Such times means that I will simply throw something out and be done with it. Minestrone Ramen is my Go-To meal when I want something quick, complete, and better than simple sandwich.


  1. Put water in electric kettle with auto-shutoff
  2. Crunch ramen into bowl. Skip the salt packet
  3. Dump Minestrone from can to bowl
  4. Put tea in a pitcher
  5. When water is boiled, pour into bowl. Cover
  6. Pour rest of water into pitcher, stir
  7. Add water to top off pitcher. 


Ready to eat in 10 minutes, including boiling water!


Boil water

Ramen into bowl

Minestrone into bowl

Tea into pitcher

Hot water into bowl

Hot water into pitcher

Top off pitcher

Saturday, September 7, 2013

Nintendo Journal #3

3 guesses of what this is! It's not a rock. It's a raisin! It's incredible how Nintendo camera can shoot close range objects very well!


Friday, September 6, 2013

Nintendo Journal #2

The New Nintendo 2DS

I love my Nintendo DS. I have been a loyal purchaser ever since Nintendo DSi. I think the dual screen and clamshell form factor is excellent.

Looking at this thing, though, it gave me some confusion. I wonder why the project got off the ground at all. I don't even know that there is a market for this thing. Unexpected is what I can tell you.

The whole thing is flat. So, my first thought would be, "Won't the screen get scratched?" Apparently there is a bag you can carry this thing in. No more inside the pocket.

So, the next thought would be, "Will the shoulder button lasts?" Of course, the malfunctioning shoulder button is infamous in DS lines. My very own DSi fell victim to that.

And finally, "Why would people choose this over the real 3DS?" The answer to that is that this is cheaper. As we all know, Nintendo 3DS has been selling quite a lot. Estimate is that it will sell 18 million unit by the end of this year. I can see that if people are given choice, this will help make it sell.

The ads seems to emphasize that this is N3DS mini. As in, for children. Looking it that way, it makes sense. No more worrying about ruining eyes via 3D screen. The bag makes it pretty much fall proof. The price means that you don't have to worry about losing too much money had it been lost.

Once again, I salute Nintendo for having far-reaching vision for family entertainment. I doubt there is much money in this venture, but as far as goodwill is concerned, I think this is a tremendous gesture from Nintendo.

Thursday, September 5, 2013

Nintendo Journal #1

Petit Computer Keyboard Close Up



I was just playing around with my Nintendo 3DS, and well, you know that device have some cameras attached, right? Have you ever wondered how close of an image it can take? Very close indeed. Here is a picture of Petit Computer keyboard screen.


Wednesday, September 4, 2013

Raspberry Pi Journal #19


E-Book with Calibre

Printing and making book is fun. But what is really interesting, is to have an e-book you can take with you wherever you go. With e-book, that means Kindle, Nook, or other dedicated e-book reader. Sure, you can bring along your laptop to view your PDF or PowerPoint files, but that's not fun. For true fun, we want dedicated e-book reader. That means EPUB file format for most. Kindle has its own format. MOBI for old Kindle, and EZ3W for the new Kindle Fire.

So, how can we convert our books into those format? Amazon has a converter service that converts Microsoft Word Document into its format. I will probably investigate that later. In the meantime, I'm using a program called Calibre.

This program is designed to function as all-in-one e-book solution. It shows. The download is quite sizable, and the program runs like a hog through mud. Just struggling to move. CPU at 100% at all times.

The important thing is that it works!

The first thing you want is a proper format for the book. This means that you should put proper formatting in place. Let's use Abiword for example. The formatting is usually set on "Normal". For different parts, we need to specifically specify each type. It's not enough that it looks right. It has to be the right type.


For Chapter Heading, use the Chapter Heading format. Bullet list? Use Bullet List format, and so on. This is very important. The reason for this is so that the automatic Table of Content generator can pick this up. It just makes things more convenient if you do.



Here is my novel. Well, short story. I did this during Nanowrimo event last year. Notice that everything is formatted properly. Abiword can save epub file format, and that's what I'm using.



Open the Calibre program. Add book into it. If you're using Raspberry Pi, you'll probably notice the extremely long load times. Most of the functions is provided by Python, I believe. So, not only it is running its own program, but also Python interpreter. And well, heavy slog.



Edit your Metadata here. That means Title, Author, and Cover. There are other info as well, such as Publisher. If you're feeling lazy, there's a button called "Generate Cover" that will automatically generate the book cover for you.



It's time to convert the book! In this case, I'm converting it to MOBI format for Kindle reader.



I'm leaving everything as default. I do make sure that the program automatically generate the Table of Contents. Notice that even though the size of the document is small, it takes a long time to format the piece. About 2 minutes to format 20 kb file? That's unbelieably long time!



If all goes well, you'll have an e-book! Normally, you can upload the document directly via USB connection. For some reason, I keep getting "Low Voltage" error, and the book refused to upload. How can I transfer the book to Kindle? There's always the PC method, but I'm going to see if I can skip PC altogether.

Sure enough, there is! Calibre comes with its own Content Server. What that means is, you start some kind of document provider over the net. Since I'm doing local, it's just a local connection.

I set the Server Port to 8088. Then it's time to fire up my Kindle! What I need to do is to connect to server on my Raspberry Pi at port 8080. Like this:

http://myhostname:8080




On my Kindle Keyboard, it falls under Experimental feature. Launch the internal web browser, and type in the URL into the address bar. Just remember to use your Raspberry Pi Hostname.



There it is! Both epub and mobi format are downloadable. We want the mobi format. All you have to do is click on it. If you have specified the cover in the metadata, then it will show up here. Otherwise, the default cover is the first picture on the book.

Oh, look! My very own e-book! Isn't that nice!

Well, enough time for gawking. Now, let's see. Next on my To-Do list is to write The Great American Novel. Yup. That's the ticket. See you later.




Oh, one more thing. You can have images in your e-book. But remember, e-book format does not have pages, so there's no point of you aligning the pictures so it looks nice on your word processor. It all depends on the set up on your e-book reader.

Have fun making your own e-book format!


Tuesday, September 3, 2013

Raspberry Pi Journal #18

Installing MTPAINT

After my disastrous experience with GIMP, I tried a different tack. I downloaded mtpaint.

sudo apt-get install mtpaint

And it installed no problem. I see mtPaint under Graphics menu. So I set out to use it. It's pretty simple to use.


Oh, look! Colors! I can do coloring with this program! Okay, so maybe that's not a big deal, but I was having trouble with GIMP, remember?



And adding text is not a problem either. Looks like I mastered this program already, and it's not even 15 minutes. That's my kind of program!



Now that I've done experimenting, let's see if we can do something nice. Let's put a picture on an AbiWord document. Create new picture.



Do a quick classical masterpiece. Add some text. Put colors in. All in all, a great and wonderful new art work. Done in less than 5 minutes! What a deal!



There it is in AbiWord. Looks like adding a picture is not a problem at all. There's only one thing to do now, and that is print it out.



Ta-da! That's how I want it done. Too bad my laser printer isn't color, but I don't expect miracles. There's always crayon if I want color, right?

Adding picture to word processor: Done!