Saturday, November 24, 2012

Black Friday Shopping

I just bought Modernist Cuisine at Home. It was on sale for 50% off, so I paid just $70. Good deal! I also bought Make Magazine 3D Printing special. I sure would like to print some in the future. Will be visiting Hackerspace nearby when I have time. I guess I'm a maker at heart.

Friday, November 23, 2012

Review The 4 Hour CHEF


I've just finished reading Timothy Ferriss' book The 4-Hour CHEF. It's a strange cooking book, to say the least. It's the only book I've read so far that includes not only recipes for various meals, but also catching food in the wild or even pigeons in the park. Also mentioned in there is memorization techniques good for developing vocabulary and random numbers.

I suppose it all dove in with his goal of "Meta Learning." As a jack of all trades myself, I approve. True that the book will not make you a Master Chef, as opposed to Joy of Cooking, but that's what the references are for. There's a lot of links in the book that goes back to his website. I have yet to check them all.

There's a lot of interesting tid bits, including how to win eating contest (he didn't, not exactly) and still be thin (he is). I'm not too happy about the fried rice meal. My favorite is the chicken fried rice, and although he has chicken, and fried rice, the featured fried rice featured mealworms, instead of chicken. Well, I suppose adapting his recipes is a given.

I am also not too happy with his tool selection. Way too many tools for what is supposedly a simple chef. I suppose now I have to get myself a 7 inch chef knife. That and a thermometer. Not to mention Modernist Cuisine book by Nathan Myhrvold. He also didn't mention my favorite cooking implement: Rice cooker. Using rice cooker effectively is what enables me to write 1000 words essay while the food is cooking. To be fair, he did mention 2 hour chicken meal, and I can fit in more than 1000 words with that kind of meal, but I digress.

A section of surviving catastrophe, like San Francisco earthquake is very interesting. Apparently, you need to be able to survive on your own for about 7-10 days without electricity or water. Get out a generator, because that is what you need to power your refrigerator! Very interesting and important knowledge to have. I just didn't expect to find it in a cookbook!

If Timothy Ferriss would come down my way sometimes, I'd like to ask him if he's interested in learning computer languages. After all, I learned my first computer language, the Applesoft Basic, in 3 hours. That's one hour shorter than his 4 hours learning. Admittedly, the subsequent computer language took longer than that, at about 2 days to one week. It's still relatively fast approach, though, compared to the traditional computer programming learning.

Maybe I'm an outlier. My life has never been an easy conformance. I sure want to know whether that 5 minutes per week weight-lifting exercise is any good. I suppose I'll need to add his other book to my library as well. Sigh. I'm supposed to be writing Nanowrimo right now! I wonder if Barry Ross wrote a book? Will have to check that out.

This book review was written while my food is cooking on rice cooker. It just beeped me, so I’m done!

Monday, November 19, 2012

No post this week

I'm way behind 8000 words with Nanowrimo. I guess life does have an interference. But if I make it, I know I can do anything! So, here's to keep trying. Hang in there!

Monday, November 12, 2012

Busy...

No Petit Computer post this week. I'm behind with Nanowrimo. :(

Monday, November 5, 2012

Petit Computer Journal #12


Packing, Saving, and Loading Data

One of the most desirable feature of computer programming is data loading and saving. Nintendo DS is used mainly for gaming, and the ability to save and load large amount of data is mostly an afterthought. However, there is a built-in feature to do so: MEM$. Basically, we simply assign the the string to MEM$, and save that.

We can enter multiple data into MEM$ by using splitting numbers technique: MID$. Let's say that we put the data for score in MEM$ location 10-15. We can extract that by using MID$, like this:

SCORE=MID$(MEM$,10,5)

A similar technique is to pack numbers into one large number. You can split them out like so:

CLS
?"FOR BITS:"
?"DEC:1=10;2=100;3=1000"
?"BIN:1=2;2=4;3=8;4=16"
INPUT "NUMBER,BITS";N,B
@LOOP
?N%B
N=FLOOR(N/B)
IF N!=0 GOTO @LOOP
?"DONE!"

SAMPLE OUTPUT:
123456,100
56
34
12


Let's say that we have data in multiple column format, that we want to save. I'm going to make it easy for testing, and just use 192*16*16. First, we make the data, then we save it two ways: Graphic and MEM$. We also load it 2 ways. Finally, we're going to put some timer on each operation.

'Make up data
DIM D[50000]
FOR X=0 TO 191
FOR Y=0 TO 15
FOR Z=0 TO 15
D[X*256+Y*16+Z]=RND(256)
NEXT:NEXT:NEXT

'SAVE DATA GRAPH
T0=MAINCNTL
FOR X=0 TO 191
FOR Y=0 TO 15
FOR Z=0 TO 15
GPSET (Y*16+Z),X,D[X*256+Y*16+Z]
NEXT:NEXT:NEXT
?"SAVE GRP0:TEST1"
T1=MAINCNTL

'SAVE DATA MEM$
T2=MAINCNTL
FOR X=0 TO 191
MEM$=""
FOR Y=0 TO 15
FOR Z=0 TO 15
MEM$=MEM$+CHR$(D[X*256+Y*16+Z])
NEXT:NEXT
S$="MEM:MEM"+RIGHT$("000"+STR$(X),3):?"SAVE ";S$
NEXT
T3=MAINCNTL

?"GRAPH:",T1-T0
?"MEM$: ",T3-T2

However way I look at it, the MEM$ version is harder, longer, and slower. I purposely skip the actual saving process because it asks whether or not you want to overwrite existing files, which in MEM$ case, rather ponderous. Even so, GRAPH method is faster than MEM$

GRAPH:  300
MEM$:   632

Now let's do LOAD:

'LOAD DATA GRAPH
T0=MAINCNTL
?"LOAD GRP0:TEST1"
FOR X=0 TO 191
FOR Y=0 TO 15
FOR Z=0 TO 15
D[X*256+Y*16+Z]=GSPOIT(Y*16+Z,x)
NEXT:NEXT:NEXT
T1=MAINCNTL

'LOAD DATA MEM$
MEM$="A"*256
T2=MAINCNTL
FOR X=0 TO 191
S$="MEM:MEM"+RIGHT$("000"+STR$(X),3):?"LOAD ";S$
FOR Y=0 TO 15
FOR Z=0 TO 15
D[X*256+Y*16+Z]=VAL(MID$(MEM$,Y*16+Z,1))
NEXT:NEXT:NEXT
T3=MAINCNTL

?"GRAPH:",T1-T0
?"MEM$: ",T3-T2

And the result?

GRAPH:  266
MEM$:   840

In all cases, the Graph version is leaner, cleaner, and faster than the use of multiple MEM$.