Thursday, January 30, 2014

Book Review #21


Japanese Cooking
Lulu Grimes

First of all, I'm not even sure "Lulu Grimes" is the author of the book. There's no name listed on the cover. The publisher is Parragon Publishing in UK. Printed in China. Produced by the Bridgewater Book Company, Ltd. With Home Economist Kate Moseley. I really don't know what to think of it. The photography, by David Jordan, seems good enough, but there's no blurbs or anything.

The recipe follows a simple procedure.
1. List the ingredients
2. Show one picture of the process
3. Show the text of the preparation process
4. Show a big picture of the finished product

In some cases, this shows the picture of a knife cutting meat, or ingredients being dumped into a pan. So, not much there. Regarding Japanese cooking, they're mostly pure ingredients. In some cases, one short ingredient list. One short preparation steps. Done.

That's my kind of cooking. It annoys me, though, that I can't find the name of the author of this book. Still, if simply prepared Japanese cooking is what you want, then this book is ideal.

By the way, if you haven't done so, try cutting meat in tiny little slices, and use chopstick to drop them into hot oil in a pan. Wait until cooked, and fish it out with the chopstick. Put it in plate. Simple. Quick. Convenient. Done.

Wednesday, January 29, 2014

Musing Journal #4


Plan, Do, Learn

For the longest time, I always work with Learn, Plan, Do. This is because I value my time and by properly learning the materials, I am able to properly plan the activity, so that when it comes to actually doing it, I will have no trouble at all.

This has served me well throughout the years, whether it's engaging in a project, or writing term papers, the proper outline has been essential in getting things done quickly.

Lately, though, I have a second thought about the process. Probably because I'm being overwhelmed right now. There's so much to do that if I have to fully learn everything, then a lot of things won't get done quickly. I suppose there's a good side about "do one thing at a time" philosophy, however, I wonder if that's a good thing when there's so much to do at one time. In essence, I wonder if there's a faster way to do things than one at a time.

So, I have been doing things around. Instead of Learn-Plan-Do cycle, I decided on Plan-Do-Learn cycle. Make plan, Do plan, and Adjust accordingly. So far, it has been working well. Things are getting done, and more importantly, I am able to manage various projects at once. I still limit myself to doing two or three big things per day. And I focus on the most important thing to do in that day. But as weeks go by, I am able to see improvements in all aspects of my life.

If you look at my blog, you see various things going on. That's because I have wide ranging interest, and the fact that had I focus on one thing at a time, there will be some holes on it. So, I have no choice. I have to spread my activities around, regardless how I feel about it.

And that's a good thing. The ability to learn from doing does have value. I keep changing things and well, I see definite improvements in each separate activities. Mind you, I'm still overwhelmed. However, I manage things much better now. I am now able to see progress on my schedule.

So, all I have to do now is keep improving, and I will catch up with the rest of the schedule eventually. It takes longer than expected, but steady progress is better than heroic actions, especially since I have a tendency to burn out after such heroic actions.

Tuesday, January 28, 2014

Raspberry Pi Journal #47


SD card capacity


So I was wondering why my dd command always fail with insufficient disk space message. Turns out that there are different sizes with different SD card brands. Here is my size of PNY 16 gig card:


  1. sudo fdisk -l /dev/sda



  • Disk /dev/sda: 16.0 GB, 16012804096 bytes
  • 255 heads, 63 sectors/track, 1946 cylinders, total 31275008 sectors
  • Units = sectors of 1 * 512 = 512 bytes
  • Sector size (logical/physical): 512 bytes / 512 bytes
  • I/O size (minimum/optimal): 512 bytes / 512 bytes
  • Disk identifier: 0x00000000

  •    Device Boot      Start         End      Blocks   Id  System
  • /dev/sda1            8192    31275007    15633408    c  W95 FAT32 (LBA)



And here is my size of generic store brand 16 Gig card:


  • sudo fdisk -l /dev/sda
  • Warning: ignoring extra data in partition table 5

  • Disk /dev/sda: 16.0 GB, 16009658368 bytes
  • 4 heads, 16 sectors/track, 488576 cylinders, total 31268864 sectors
  • Units = sectors of 1 * 512 = 512 bytes
  • Sector size (logical/physical): 512 bytes / 512 bytes
  • I/O size (minimum/optimal): 512 bytes / 512 bytes
  • Disk identifier: 0x00048a81

  •    Device Boot      Start         End      Blocks   Id  System
  • /dev/sda1            2048     2324218     1161085+   e  W95 FAT16 (LBA)
  • /dev/sda2         2326528    31268863    14471168   85  Linux extended
  • /dev/sda5         2334720     2449407       57344    c  W95 FAT32 (LBA)



As you can see, the PNY SD card has holds 16012804096 bytes, compared to 16009658368. So that's the difference of 3145728 bytes. No wonder the dd command always fails. Well, there are two ways about it:


  1. Buy identical PNY SD cards
  2. Migrate the whole thing to a smaller, generic SD card.


Option one is easy, but depends on availability of such card. Option two is, frankly, a pain at this point. I have too many stuff in there already.

Option 3, which is to built another card, and copy the files between them somehow does not work because the keyboard stopped working. No, I don't know why, but that is why it's off the table.

Monday, January 27, 2014

Cooking Journal #23

Frozen Pizza

So, I bought a few pizza from the local supermarket. Buying in batch of 5, they cost $2 each. Quite a good deal, if I may say so myself. $2 meal is nice, but the large pizza means that I eat only half. The other half goes to refrigerator for another meal time. So, the cost per meal is only $1.

I find it hard to believe that people will order a pizza delivery. I can understand if you're travelling and have no means to cook good food. I can also understand if you're having a party or maybe you want to have more than one pizza. If all you want is a pizza, frozen pizza is cooked in about 20 minutes at 400 degrees, or about the same as delivery.

Pizza quality, of course, is less than gourmet pizza. Pizza Hut is great. So is Papa John. However, the quality of frozen pizza is not bad. There's nothing wrong with stocking your freezer with them.

Take a simple Pepperoni pizza. Maybe you think it's rather bland. So? Just add more toppings as you like it. There's nothing wrong with customizing the toppings. You may need to experiment a little bit with the proper cooking time as to accomodate the opening of the oven, but I don't think that's too difficult to do.


Thursday, January 23, 2014

Book Review #20


Chinese Cooking
Rose Cheng and Michelle Morris

I like this book because the book opens up with a short cultural lesson of Chinese cooking that is frequently missing in other cookbooks, and yet short enough as to concentrate on cooking, without being wordy or irrelevant. A philosophical overview maybe irrelevant to some, but I find that as I experiment with the recipe, these provide the guidance I need.

The tool section is short and to the point. Normally, a cook book would specify so many pots and pans, and so many utensil. This one specifies a few multi-purpose tools. I really appreciate that.

The problem comes when it comes to ingredients. Chinese ingredients are unique to chinese culture, and that's kind of hard to get in rural America. There's a big picture that helpfully shows the different kind of ingredients desired, but unless there's a good Asian store in your neighborhood, there's no getting them. I'd appreciate if the writer would write equivalent substitute to the ingredients. Alas, that information will not be found here.

The dishes are varied and good. My complain about them is the same complain about other recipes: They are all hard to make, requiring many different ingredients and spices, and frankly, a bother to do. I have no doubt that they are great tasting food. I find that I'm skimping all the different exotic ingredient, and substitute what is available locally. There's nothing to it. I appreciate the pictures of the food, and although mine is nowhere close to looking the same, it's good enough for me.

If you want a good survey of chinese food, and don't mind either going to Asian store and do a lot of work, or maybe converting it to using readily available local ingredient, then this is a good cook book to have.

Wednesday, January 22, 2014

Musing Journal #3

3 Priorities

I think that's me. For some reason, I always fixated to number 3. Or maybe number 4. In this case, I'm thinking about what I'm doing with my time, and there are 3 answers:

1. PTC: There will be GameJam this weekend, and I really, really want to go there. Basically, I'll spent the weekend doing one whole game using PTC. It should be fun. There is a lot of projects that has been held up due to my setbacks. I need to step up my productivity.

2. My home. It's kind of a mess right now. I just discovered that the previous owner cleaned the oven by using the "self-cleaning oven" setting. Which is to say, burn all grease to a crisp. Unfortunately, that's all he did. So, I'll be scraping all the fat that is currently sticking to it. Sigh. Where's Mr. Clean? I also need to work on my paperworks, speaking of which...

3. My books. I have 4 books nearly done. 2 needs editing, 2 needs a little more materials before editing. I also have some more materials for more books. So, I need to step up to that also.

It's kind of bad when bad health is causing havoc with the schedule. Then I have the tendency to make up for time lost, then I get sick due to overwork, and repeat. I'll have to figure something out to break the cycle.

So, I should ride my bicycle more often. That gets my heart rate up, and hopefully raised my stamina so I can get more work done.

Tuesday, January 21, 2014

Raspberry Pi Journal #46


Disable Screensaver

The last couple posts deals with pesky screensaver kept interfering with our display. We certainly want to have an easy way to disable the screen saver, and for that, we need to go to the source: X window session itself.

Most of the instructions I see on the internet specifies .xinitrc file modification. Although it should work, that makes the change permanent. If I can do it via user shell, I'd rather do it that way.

Fortunately, there is a set of xwindow utilities. The one we're interested in is called xset. Disabling DPMS (Energy Star) feature is as simple as

xset -dpms

Enabling it would be

xset +dpms

So, to disable screen blanking, we'd do this:


  1. xset s noblank   #Disable blanking
  2. xset s off       #Disable screensaver
  3. xset -dpms       #Disable Energy Saving


And to enable them, we can do this:


  1. xset s blank      #Enable blanking
  2. xset s on         #Enable screensaver
  3. xset +dpms        #Enable Energy Saving


So I created two scripts: unblank.sh and blank.sh respectively. Oh, I also put sudo command in front of them, just to make sure it takes.

Now, all I have to do in order to disable the screen saver is type

unblank.sh

on the command prompt. And to enable it, just type

blank.sh

And there you go. Note that xset does more than just dealing with screen savers. Check out its man page for details.

Monday, January 20, 2014

Cooking Journal #22


Cooking #22 Dehydrator






Yep, got myself a dehydrator. It works fine. What you see there is a bunch of kale leaves being dried. Kale chips are rather popular, don't you know? So, I dried them. It works well enough, I suppose, but what happens is that I have to rotate the tray every so often. The end result is great, though. So, this technique is certainly doable.

I'm unsure about contamination. My thinking is that the warmth will cause bacteria to multiply rapidly. So, I don't know. Perhaps if you maintain a septic kitchen it's alright. For me, though, this dehydrator is going back out.

Got to admit, though, those dried kale chips were terrific!


Thursday, January 16, 2014

Book Review #19


Debt Free Living
How to Get Out of Debt (and Stay Out)
Larry Burkett

I am rather ambivalent about this book. There is no doubt that the author is skilled, experience, and knows what he's talking about. However, I see a distinct lack of specific step-by-step in the book. It's closer to something that a wise grandparent would tell the young ones the pitfalls of money management. The book opens up with sample cases, three of them, and walked through their bad experiences. I think it's good that there are these cases, but I think they can be shorter. This long-drawn story-telling is closer to counseling, instead of lecturing. This is neither good or bad, but if you're deeply in debt and want to quickly get to the core solution, then this book will seem to be pandering.

50 pages later, on part two, we begin to see the basic principles of debt, as laid upon by the bible. We see time and again, the bible is brought forward as guidance regarding debt and borrowing. This may seem to be preaching to some people, but I don't see it as Christian-centric. The principles given forth are basic universal principles that everyone should adhere to. And it's only 10 pages. See how the core ideas of debt and borrowing are very simple and direct? Tales of woe has more pages than basic principles!

There are some forms to fill, but unfortunately, they are scattered throughout the book. There is no simple, "Here are the steps". So the reader will be forced to take their own paper and write their own form. This, itself, isn't bad, but despite long winded sample cases, there is no direct one-on-one relation for different cases. This is fine, if you're in counseling. The counselor can help you with your budget. But as a stand alone book, I'm afraid it's lacking.

Minimal debt treatment. Lots of stories. This is something that is closer to counseling than a genuine get out of debt book. If you really need to get out of debt, I suggest you keep looking. If you are already in the process of getting out of debt, and being discouraged because there's no progress, then give this book a try. You may just change your mind.

Tuesday, January 14, 2014

Raspberry Pi Journal #45


SlideShow Update

Given such trouble in working with refreshing the screen saver, there is an easy way to do slide show:

gpicview

This lightweight program does automatic slide show for all images in a directory. It is configurable. It can show picture on the whole screen, so it doesn't show title bar or icons.

You know. I just spend some money to buy a dedicated digital picture frame, and all it does is show Animal Crossing pictures from my Nintendo 3DS. Well, that and a few other things that's from the device. But with this program, I can show just about anything and on big screen TV, too.

Will it survive screensaver shutdown? Nope. You still need the screen refresher from last time.

Monday, January 13, 2014

Cooking Journal #21


KFC



Yes, that's KFC, or Kentucky Fried Chicken. I cook my own rice, and I cook my own egg. This dish is brown rice, egg, and fried chicken. It's very quick to prepare since I'm using Success Rice. I fried the egg, while the rice is cooking. The chicken is courtesy of KFC. You're probably wondering why I bothered to cook rice and egg if I'm eating KFC chicken? The answer is that I don't eat chicken as a meal. I eat rice as the main meal, and chicken is just something extra.

In any case, it's too salty. KFC maybe famous for their secret spice, but the current KFC is mostly salt and pepper. Make that various salt and pepper. For some reason, I keep thinking Monosodium glutamate (MSG) every time I eat KFC. But what can I say? It tastes delicious! So, I do take KFC original style chicken from time to time.

I limit myself to just legs and thighs. Dark meat. 10 piece bucket. $14.03. That's enough for five meals. About $3 meal. I think that's a good deal, considering the great taste of KFC. I do know how to cook tender, juicy Leg+Thigh chicken. But the process takes 45 minutes each. For quick meals when I'm tired, KFC makes a good substitute!

There's a caution here, though. Usually KFC features big sized chicken. However, lately, their size is on the smallish side. Considering that, I think $10 is about right. When I found out that they charge $14 for the small chicken size, well, I stopped coming. There's that.


Saturday, January 11, 2014

Nintendo Journal #21


Nintendo #21 Mini umbrella




A really compact umbrella. Look how small it is, compared to a quarter! And yet it opens up wide enough to handle rain. Small, lightweight, portable umbrella that you can take "just in case" around town. Good for summer showers. For winter, I have REI Element jacket and doubles as raingear.

Friday, January 10, 2014

Petit Computer Journal #33


Quick Programs

There are many programs that can be done quickly. Suppose that you only have 15 minutes to write a computer program. What do you think you would write? Let's start a quick one. The quickest program that you can write would be a simple game. Coin flips. Heads or Tail. Or in this case, A/B buttons. The program simply checks whether or not you pushed the right buttons. It's a simple one-liner.


  1. ?"A/B?":WAIT 180:IF BUTTON(0)==16*RND(2) THEN "YOU WIN!" ELSE "YOU LOSE!"


Yes, it's that simple! There's nothing to it, is there? Let's take it a little more and do a simple Rock-Paper-Scissor game. Let's take a look at this table(A-B) (RPS=012):

B\A R P S
R 0 1 2
P -1 0 1
S -2 -1 0

Now, consider this: Looking at the diagonals, we see that the values are the same. zero means draw. one means win. two means lose. -1, -2 means lose, win. So, how about if we shift it up and set the range to modulus 3?


  1. O=(2+A-B)%3:'O=OUTCOME


The range then becomes 0-2, 0=Win,1=Lose,2=Draw, and everything is peachy! The program then clearly writes itself:


  1. CLS:CLEAR
  2. DIM T$(3)
  3. T$(0)="ROCK"
  4. T$(1)="PAPER"
  5. T$(2)="SCISSORS"
  6. ?"A=ROCK,B=PAPER,X=SCISSORS"
  7. WAIT 180
  8. B=BUTTON(0)
  9. A=0
  10. IF B AND 32 THEN A=1
  11. IF B AND 64 THEN A=2
  12. ?"YOU CHOSE ";T$(A)
  13. B=RND(3)
  14. ?"I CHOOSE ";T$(B)
  15. O=(2+A-B)%3
  16. IF O==0 THEN ?"YOU WIN" ELSE IF O==1 THEN ?"YOU LOSE" ELSE ?"DRAW"


That's all there is to it. Pretty quick to do and implement.

Let's keep moving on. How about random outcome? That's important in a game. However, there's something that you can do for a purely random device, such as dice. Here's a quick implementation of the Magic 8 Ball, although I don't bother putting in too many responses.


  1. CLS:CLEAR
  2. DIM T$(6)
  3. T$(0)="ABSOLUTELY YES"
  4. T$(1)="YES"
  5. T$(2)="MAYBE"
  6. T$(3)="NO"
  7. T$(4)="ABSOLUTELY NOT"
  8. T$(5)="NO WAY JOSE!"
  9. ?T$(RND(6))


If the example looks lean, that's because it is. The Magic 8 Ball is quite famous. Another example, using the same structure, would be Yoda's Wisdom. Quotes of Yoda from Star Wars, presented with pictures of him is a rather entertaining program. Another one would be Bingo, or lottery, or anything random. One of my stand by program is a dice roller for playing board games.

Some games requires you to roll so many dice, and they're not all six dice, either. Let's say that you want to roll 1-4 dice, ranging from D6,D10,D20. It's a simple process using the touch screen and do it. I'm doing it quick, so there's no text. You certainly want to dress it up for practical use.


  1. CLS:CLEAR
  2. DIM D(3)
  3. D[0]=6
  4. D[1]=10
  5. D[2]=20

  6. @MAIN
  7. VSYNC 1:TX=TCHX:TY=TCHY
  8. R=0
  9. FOR I=0 TO FLOOR(TX/64)
  10. R=R+RND(D[FLOOR(TY/64)])
  11. NEXT I
  12. IF TCHST THEN LOCATE 0,0:?"YOU ROLL ";R;"    "
  13. GOTO @MAIN


I actually implemented Snake and Ladder game in less than 10 minutes. One thing that is interesting about it, is that the program really doesn't require any user input other than rolling the dice. In that sense, all the activities that you do can be boiled down into rolling the dice. We can improve this further simply by letting the computer run it straight.


  1. CLS:CLEAR
  2. A=0:B=0
  3. @MAIN
  4. ?A,B
  5. A=A+RND(2):B=B+RND(2)
  6. IF A>100 OR B>100 THEN GOTO @END
  7. GOTO @MAIN

  8. @END
  9. IF A>100 THEN ?"A WINS!"
  10. IF B>100 THEN ?"B WINS!"
  11. IF A==B THEN ?"IT'S A DRAW!"


The program will resolve the race immediately. You may find it interesting to input some kind of delay in the output, so as to make it more readable as it goes.

All of these programs can be done really quick. In fact, I do these while waiting for something. Or maybe when I was in bed, trying to sleep. Most people would take a book to read in bed. I would take a Nintendo 3DS and write programs, instead.

One more quick example of the program, and this time it's useful when you're trying to do something regarding sleep: An alarm clock.


  1. CLS
  2. AH=6:'ALARM HOUR
  3. AM=0:'ALARM MINUTE
  4. LOCATE 0,2:?AH;":";AM
  5. @MAIN
  6. WAIT 60
  7. LOCATE 0,0:?TIME$
  8. CH=VAL(LEFT$(TIME$,2))
  9. CM=VAL(MID$(TIME$,3,2))
  10. IF AH==CH AND AM==CM THEN BEEP
  11. GOTO @MAIN



Oh, one more bonus program since not one hour has passed, yet. You know how timers have lap times? Usually, there's only one room for lap times. With this, you can have as many as you want. I'm going to limit it to just 20 for simplicity. You may modify to suit.


  1. CLS
  2. I=0:T=0
  3. @MAIN
  4. VSYNC 1:T=T+1
  5. IF BTRIG() THEN I=I+1
  6. J$=RIGHT$("00"+STR$(T%60),2)
  7. S$=RIGHT$("00"+STR$(FLOOR((T/60))%60),2)
  8. M$=RIGHT$("00"+STR$(FLOOR((T/3600))%60),2)
  9. LOCATE 0,I:?I,M$;":";S$;":";J$
  10. IF I>=20 THEN END
  11. GOTO @MAIN


These programs are rough, and really, for distribution, you may want to dress them up a little. However, for something that you can doodle in 10 minutes, while waiting for something, these are perfectly suited as a pleasant time waster. Did I just do 7 programs in one hour? I guess so.

Thursday, January 9, 2014

Book Review #18


RuleBook for argument
Anthony Weston

By chance, I picked this book up at a college bookstore. I was just shopping for the regular textbook, and I saw this little book. I was intrigued, and picked it up. In truth, I have learned all the rules described in the book, except I didn't have names to them. This book not only outlines the logic behind the rules, but also the fallacies that people use to fool you.

Nowadays, everytime somebody used any of the fallacies, instead of commenting and explaining their errors, which can take a while and may involve heated words, I simply say, for example, "ad populus" or "ad hominem" or "circular reasoning." And unless the other person corrects the error, I always leave the conversation. It has save me a lot of time in avoiding wasteful conversations with idiots.

The book was out of print for a while. I'm glad that the book has gone at least four printings, with the latest including a small treatment for the internet generation. I have since found that the wikipedia has a much more comprehensive set of logical rules and fallacies, but this book remains the gold standard not only in what it includes, but also what it excludes. It has that magic balance of not too much, not too little. Highly recommended.

Wednesday, January 8, 2014

Musing Journal #2


Schedule

It is amazing how a little planning can go a long way. I have been doing it ad-hoc, doing improvisation along the way. It works, but I noticed a lot of repetitions going on. So, the question is, if I can schedule my activities, will that help speed things up?

The answer is yes. What surprised me the most is the amount of time saved in doing so. My productivity quadruples! That's amazing. Therefore, for this year, I resolve to plan  and follow through all my activities for the year.

So far, the result has been uneven. Some activities are easily done. Others, not so quick. The most important thing, however, is that the activities are done one after the other. There is no longer periods of indecision. That helps a lot.

I'm redoing all the directory pages and they will be in this format:

#N Title
Description
URL
Date

Sometimes, description is unnecessary. In those cases, I will omit the description. Also, there will be no more "ETA" notifications. I find that putting the date directly is sufficient. Obviously, if the date lies in the future, that means ETA.

I'm reserving News Directory for completed projects. It makes a handy reference if you just want to get to completed projects, instead of having to wade through my various journals.

Tuesday, January 7, 2014

Raspberry Pi Journal #44


Raspi #44
Prevent screen from blanking

If you want to show picture slide shows for hours on end, you probably run into a "feature" that is quite annoying: screensavers. The gist is that the program will interrupt your display to save your screen. It is a prudent action in order to stop your monitor from burning static images. The issue isn't as common as before, but even with the latest LCD display, it is still present. Therefore, having an automatic screen saver feature is desirable.

The problem is when we want the screen to burn all the time, such as displaying photo slide show. How do we disable the screen saver? I'm sorry to say that the system is very complex and that there is no single way to disable the screen saver.

I suppose you can kill the process, but that's not a desirable solution in the long run.

The trick here, is to let the computer know that you want the screen is up all the time. So, press a key in the keyboard or jiggle that mouse. A robot that shakes the mouse all the time seems ideal. Alternatively, put the mouse in a shake box.

However, we can do better than that. Even if the solution is hackish, we should do it all in software. There is such a thing, and it is:

pygame.event.get()

That's a python script. So far, that pygame is for Python 2.7. So we'll use that. Write a python program that will poll the keyboard/mouse event. Let's call it: unblank.py


  1. import pygame
  2. pygame.init()
  3. pygame.event.get()


And when you run this program:

python unblank.py

The screen saver process should terminate and the timer will restart. All you have to do is call it periodically and problem solved!

I'll just stick that line in my wallpaper rotation script


  1. #!/bin/bash

  2. for ((walltick=100;$walltick;walltick=$walltick-1))
  3. do 
  4.   PIC=$(ls wallpaper/*.jpg | shuf -n1)
  5.   pcmanfm -w $PIC
  6.   *python unblank.py*
  7.   sleep 100 
  8. done
  9. pcmanfm -w saber.png
  10. sleep 5
  11. exit 0


The whole process takes a couple second because python is not an insignificant process. So this answer is hackish and not very good.

And what do you know? It doesn't work! I would think that pygame.event.get() will reset the input, but apparently not. So, back to square one. The problem is, there are so many things that can be wrong, and you never know which one. That's very frustrating.

So, let's open up a window and see if that works. Here's the modified python script


  1. import pygame
  2. from time import sleep

  3. pygame.init()
  4. window=pygame.display.set_mode((32,24))

  5. while True:
  6.     pygame.event.get()
  7.     window.fill(pygame.Color(255,255,255))
  8.     pygame.display.update()
  9.     sleep(100.0)


Notice that this is an infinite loop, which is something I try to avoid. The problem is that it opens up a window, so I can do something to it, and that's not good. So, now, I'm running the script in the background, minimizing the window.

Minimizing the window needs to be done manually, which is a terrible solution. Worse, when I kill the process, the window still stays up! There's no way to terminate the window that I can see. Therefore, this command is useless:


  1. python unblank.py & pid=$!
  2. kill $pid


Because python script is killed yet the window is still up, there's no longer any way to close the window. It's definitely broken. So, now, I pull another shell just to run the program, keeping it in the background. That's another window open.

Of course, the right solution is to provide a refresh command, that we can use to reset the screensaver timer. How is it that we do not have such command?

Monday, January 6, 2014

Cooking Journal #20


Potato Chips



I know I did potato chips cooking last time. However, For this one, I use a special slicer board. Grab yourself a bag of Russel potatoes from your local supermarket and do it.

I fry them using medium heat, as usual. The whole process took 45 minutes. The way I do it is to just hold the slicer on top of the pan and just slice the potato right into the pan. I can usually fit 20 slices at a time. Then wait until they're done.

I like it when they're stops being yellow and starts to become golden, but not so much. I experimented with the thinnest slice and the second thinnest (1/32) and prefer the second thinnest. You may have a different preference.

The subsequent slices would cook faster due to the oil warms up as it goes. And that's the trouble. Whenever I do this, it's upwards one hour for the whole thing to finish. I usually just eat the first batch while the second batch is cooking, and so on.

I have to say that the end result is terrific! I thought that I'd need to use salt or something to make it taste good. I had Sriracha sauce prepared, but it turns out, I don't need it. That's right. I just eat it without salt or anything. They're that good!

So, if you're wondering whether or not you should invest in potato chip microwave thing, I'd say, no. This is good enough. I will admit that doing this takes a very long time, as it is not a hands-off operation. I need to watch the whole cooking process from start to finish.

Saturday, January 4, 2014

Nintendo Journal #20


Nintendo #20 Water Filter



Water filter. I bought this one with the idea of having one to take around the town. I don't really like it. It seems to work as advertised, but the bite piece is too solid for me. Hard to use, hard to clean. The cartridge filter is easy enough to replace, but properly cleaning the whole thing is a hassle. It basically just sits in the cupboard doing nothing.

Friday, January 3, 2014

Petit Computer Journal #32


Lottery Number Generator

A while ago, I wrote a simple Lottery Number Generator. It may interests you that it has these words in it: "...THEN A MIRACLE OCCURS" Of course, that was done as a joke, but in reality, choosing a bunch of random number isn't rocket science. Especially so, if the programming language provides a built-in random number generator, such as Petit Computer.

All of these talk about the biggest million jackpot ever got me fired up again, and well, I think it's time to update that program. This time, though, I want it to be an actual program that I can use. Speaking of which, there is more than one lottery, so I decided to write a customizable lottery number generator.


  1. CLS:CLEAR
  2. PNLTYPE "OFF"
  3. DIM MN[10]
  4. DIM MB[10]

  5. @INIT
  6. NT=15:'NUMBER OF TICKETS
  7. NS=2:'NUMBER OF SLOTS
  8. CS=0:'CURRENT SLOT
  9. MN[0]=75:'MAXNUM 1-75
  10. MB[0]=5:'NUMBER OF BALLS
  11. MN[1]=15
  12. MB[1]=1
  13. SE=0:'SELECTOR
  14. SSL=0:'SAVE SLOT
  15. DIR=0:'GOSUB @MSL


It's clear that I'm planning to have more than one slot. The old version only has one slot, and this one have more than one. I put in initial value for the most common configuration. Also notice that you can have more than one slot for saving. I do it via MEM$ for saving/loading.


  1. @LOOP
  2. VSYNC 1:B=BUTTON(1):TS=TCHST:TT=TCHTIME
  3. IF TS THEN GOTO @ROLL
  4. IF B AND 1 THEN SE=SE-1
  5. IF B AND 2 THEN SE=SE+1
  6. IF B AND 4 THEN DIR=-1:ON SE GOSUB @MNT,@MNS,@MCS,@MMN,@MMB,@MSL
  7. IF B AND 8 THEN DIR=1:ON SE GOSUB @MNT,@MNS,@MCS,@MMN,@MMB,@MSL

  8. IF B AND 64 THEN GOSUB @SAVER
  9. IF B AND 128 THEN GOSUB @LOADER


That's all for the user interface. There are 6 different actions you can take, and U/D refers to the different action. L/R refers to the value being changed. In truth, there's a simpler 2 dimensional way that you can do this, but I decided to stick with this generic form for now.


  1. COLOR 15
  2. PNLSTR 0,0,"LOTTERY GENERATOR"
  3. PNLSTR 0,1,"(C) 2013 HARRY M. HARDJONO"
  4. PNLSTR 0,3,"  NUMBER OF TICKETS: "+STR$(NT)+"   "
  5. PNLSTR 0,4,"  NUMBER OF SLOTS: "+STR$(NS)+"   "
  6. PNLSTR 0,5,"  CURRENT SLOT: "+STR$(CS)+"   "
  7. PNLSTR 0,6,"  MAXNUM  1-"+STR$(MN[CS])+"   "
  8. PNLSTR 0,7,"  MAXBALL 1-"+STR$(MB[CS])+"   "
  9. PNLSTR 0,8,"  SAVE NAME:"+MM$+"            "
  10. PNLSTR 0,20,"  TOUCH SCREEN TO ROLL"
  11. PNLSTR 0,21,"(X) TO SAVE   (Y) TO LOAD"
  12. PNLSTR 0,23,MID$(MEM$,0,32)

  13. SE=(SE+6)%6
  14. PNLSTR 0,SE+3,">"
  15. GOTO @LOOP


And that's about it for the User Interface. There's really nothing new here. It's just displaying some variables, and that's about it.


  1. @MNT
  2. NT=(NT+DIR+21)%21
  3. RETURN
  4. @MNS
  5. NS=(NS+DIR+10)%10
  6. RETURN
  7. @MCS
  8. CS=(CS+DIR+NS)%NS
  9. RETURN
  10. @MMN
  11. MN[CS]=(MN[CS]+DIR+100)%100
  12. RETURN
  13. @MMB
  14. MB[CS]=(MB[CS]+DIR+10)%10
  15. RETURN
  16. @MSL
  17. SSL=(SSL+DIR+10)%10
  18. MM$="L"+STR$(SSL)+"TTOCFG"
  19. RETURN


As you can see, the structure is all the same. Therefore, I can very well use a 2 dimensional array to do the whole thing. Doing it this way is actually more complicated, although it does have the benefit of mindless coding. Ha! Mindless coding. Isn't that an oxymoron? Haha, joking aside, it's true that simply adhering to plan is on the low end of the difficulty scale.


  1. @ROLL
  2. CLS
  3. FOR I=0 TO NT-1
  4. COLOR 15
  5. ?RIGHT$("  "+STR$(I),2);
  6. FOR J=0 TO NS-1
  7. CNL$=""
  8. IF MB[J]<1 THEN MB[J]=1
  9. FOR K=0 TO MB[J]-1
  10. IF MN[J]<1 THEN MN[J]=1
  11. @THROW
  12. NUM$=" "+RIGHT$("00"+STR$(RND(MN[J])+1),2)
  13. IF INSTR(CNL$,NUM$)>=0 THEN GOTO @THROW
  14. CNL$=CNL$+NUM$
  15. NEXT K
  16. COLOR 12+FLOOR((I%10)/5)
  17. COLOR 4+FLOOR((I%10)/5)
  18. ? CNL$+" -";
  19. NEXT J
  20. ?" "
  21. NEXT I
  22. GOTO @LOOP


Then a miracle occurs...

In fact, it's just a simple string search. Everytime I roll a number, the number is checked via INSTR whether or not the it exists in the string. If so, roll another number, else add the number to the string. Pretty simple, yet devious at the same time. Normally, you use an array, associative array, or hash, depending on the language you're using.


  1. @SAVER
  2. MEM$=RIGHT$("00"+STR$(NT),2
  3. MEM$=MRM$+RIGHT$(STR$(NS),1)
  4. FOR J=0 TO 8:'MAX NS
  5. MEM$=MEM$+RIGHT$("00"+STR$(MN[J]),2)
  6. MEM$=MRM$+RIGHT$(STR$(MB[J]),1)
  7. NEXT J
  8. SAVE "MEM:"+MM$
  9. RETURN
  10.  
  11. @LOADER
  12. LOAD "MEM:"+MM$
  13. NT=VAL(MID$(MEM$,0,2))
  14. NS=VAL(MID$(MEM$,2,1))
  15. FOR J=0 TO 8:'MAX NS
  16. MN[J]=VAL(MID$(MEM$,J*3+3,2))
  17. MB[J]=VAL(MID$(MEM$,J*3+3+2,1))
  18. NEXT J
  19. RETURN


Saving and loading are really just building the string and decoding it. You can see the string on the last line. I made several mistakes here, mainly because I didn't write anything down, and just winging it. I build a long string array because I'm multiplying it by the number of tickets, which is silly because one ticket is the same as the other. Another one is that I multiplied J by 8. Oops. How did that happen?

I was on my bed trying to sleep, so I guess that kind of mistakes can't be helped. Now that I think of it, such mistakes are laughable silly. I guess I shouldn't be programming when I'm trying to sleep. Nah. Who cares? Some people read books on their bed. I'm doing computer programming. That's that.

Thursday, January 2, 2014

Book Review #17


Book #17 Nasty People
Jay Carter

To call this little booklet a "seminal work in literature" maybe overselling it, but not by much.

I wonder what possesed me to pick up this little hardcover book dealing with one, just one, personality. And yet, as I read this book, I felt compelled to take it home with me, and I did. The fact that I can pick up this old book for $2.99 must have figured in the process. I read it, I took it home, and promptly forgot about it.

That is, until a few days later, when somebody who actually fit the description perfectly started berating me for parking at the same parking spot I've been parking for years. It's amazing as how perfect the description is. I use the techniques outlined in the book, and defused the person. The next day, I called the owner of the parking lot, explained the situation, and showed him the book. After the owner talked to the person, I showed him the pages where the characteristic matches. He was impressed. "You mean you pick this book just a few days ago?" Yup. Talk about lucky break!

So, I managed to solve the situation very well. I have since run across another person like that. In life, there are many such persons. Some are merely temporary. Others are more permanent. This book will not help such nasty person, called "invalidator", to lead a better life. But it will save you from grief whenever you meet with them. Highly recommended.

Wednesday, January 1, 2014

Musing Journal #1

Happy New Year 2014

Today is the first day of the rest of my life. Sometimes, life needs a reset button. There's quite a lot of happening in 2013, and unfortunately, it's more bad than good. Well, the thing is, bad things will happen in life. The real question is, what are you going to do about it?

The first order of the day is to organize everything. I have been learning time management, project organization, and house organization. I now realize that the system I had for 2013 was woefully inadequate. Little wonder when I was so busy last year!

Fortunately, I have had sometime to reflect. November Nanowrimo showed me how totally unprepared I really was. So, for my resolution, I vow to organize my life so that everything I do will be like clock work and effortless.

Hopefully, in time, it will be better.

I also resolve to start my Personal Productivity Hour (PPH). This is basically a way to keep moving forward, one step at a time. The idea is to write down in a journal, one new thing to do, every day, in one hour. This is separate from work. This is for personal development.

You can have just about any project you want in there. The only requirement is that you need to have a different item in it every day. If you need more than one hour to complete the project, you can do "part 1", "part 2", "part 3" etc, outlining what you did different for each project.

You can also have "Learning" as a way to develop yourself further. And that's about it. Learning and Applying what you learned, is what PPH is all about.