25 Apr 2007
English!
I got 90% on my English final!
You are currently browsing the Jay’s Realm weblog archives for April, 2007.
22 Apr 2007
So I decided to stop reading tutorials and actually try to apply some of what I’ve been learning and write my own program. I’ve been musing about doing a massively multiplayer online space strategy game so I decided to start defining simple base for that and build from there.
Functional programming is… well it’s neat. And different. I fought for a long time with almost every data definition and function I wrote, but as the hours wore on it started to feel more and more natural and I went back and re-factored a bunch of my code. In no time flat I had everything up and working great. One little problem. Something felt wrong. I wrote a function to recursively blast alterations into my list and when I checked it out it looked like it wasn’t freeing memory and keeping a copy of each list ever touched. Bummer.
I dropped into #haskell and asked for advice. Man. I got so many things I didn’t understand thrown at me, also a few compliments. Apparently for a first solo Haskell project, my code was far more Haskell like than expected. Anyways, I had a bunch of things pointed out to me to fix or improve and was introduced to the concept of thunks. Haskell has lazy computation which means it only evaluates things when it needs to. Thunks as I understand are partially evaluated computations which sit around taking up ram waiting to be useful again.
Pretty sure I have to go back to trying to learn monads better to fix it though.
19 Apr 2007
I just finished off the Haskell tutorial I was running through and I feel slightly enlightened and also disappointed. My expectations were fairly simple. By the end of a 150 page introduction to a language I should feel like I can do something interesting with it. Interesting being defined by me in any way I like. I didn’t get that feeling with Two Dozen Short Lessons.
The entire body was overly technical and I spent more time beating my head against understanding the content of the examples than I did trying to grok the actual Haskell lessons. I found it very neat to be walked through building a DES cryptography system, but I don’t feel it made me understand Haskell better.
On the upside, I can now look at Haskell code and generally work out what’s going on. The syntax mostly makes sense to me, though the typing of functions still messes with my head from time to time. Some of the random code flying past on #haskell is becoming less alien. I’ve written a few small proof of concept tools and am gaining more confidence and comfort with the language.
However I don’t feel ready to set out on my own and write something real world that solves a problem yet. I don’t think I have enough of a grounding in Haskell and its workings. So I’m off to find another online tutorial to work through!
17 Apr 2007
I found my old website that I did back in my first year of University. Man I was horrible. This wasn’t even my first website. It was my third attempt at a website and ugly as sin.
My previous attempts were worse. At least I had stopped using frames by then. And no animated GIF’s or marquee or blink tags.
15 Apr 2007
I was out shopping with Erik and Kate and got it into my head I would try cooking *something* with coconut milk. At seventy cents and over two hundred percent my daily recommended intake of saturated fats per can, I couldn’t go wrong. So I bought two. Then today Erik mentioned he was going to throw out some strawberries. Can’t have waste so my mind started spinning and came up with a plan to make something of these two things.
Ingredients:
Coconut Milk – Half can (200 ml)
Strawberries – Four good sized ones
Mozzarella Cheese – Chunk
Nutmeg – Pinch
Salt – Pinch
Sauce:

1) Pour milk into pan and bring to boil
2) Dice cheese and toss in pan
3) Slice strawberries and toss in pan
4) Pinch nutmeg and salt into pan
5) Cook on medium heat until thick
I added the cheese mostly to make the sauce not so liquid and thicken it up a bit. I’m not sure what else I could have used as a thickening agent with coconut milk. I’ll have to look into it.
I put this on fettucini noodles and it looked… well… limp. Smelled very interesting, strawberries yet somehow more subtle and masked. The actual flavor was deeply progressive. By that I mean the flavor progressed through stages.
First bite was a very mellow strawberry flavor with very soft undertones. It stayed like that for a while until I noticed a gradient. The softness was actually a fatty taste not unlike licking a block of margarine. As time progressed the strawberry flavor seemed to fade away and the fat became stronger and stronger. I couldn’t finish it the sensation was so strong.
It was an experience and I feel more enlightened because of it. I’m not going to try it again.
15 Apr 2007
We had a ghostbusters themed party at our place yesterday which went off fairly well. Lots was drunk and much green food coloring was used. We watched both ghostbusters movies, saw Ron Jeremy , and ate too much sugar. Annnyways, I made a cake!
15 Apr 2007
While working through the haskell tutorial I came to a point where they’re teaching about modules. Basically how to load up and import libraries. Fairly standard stuff. The haskell way to do this makes sense and I have no issues with… but the chapter teaches it by getting me to build DES encryption.
Seriously. My brain hurts from the concepts and math of the encryption, not from the programming logic. Also of annoyance is the so called helpful library they have in the appendix which you can download from their website. For non standard definitions of can that is. I could be retarded, it has happened to me before. However, I could not find it, nor could Google .
I’ve gone and formatted it all pretty like and put it on the web:
SequenceUtilities.lhs
12 Apr 2007
When I was six I wanted a remote controlled truck. It was bright blue and in the Sears catalog. I wanted it real bad but my parents told me they wouldn’t buy it for me. I had to buy it myself. It was a hundred dollars. That much money to me seemed insane.
My parents both made crafts and went to craft shows to sell their wares. I asked if I could sell stuff too and they were overjoyed. I made little fluffy things out of Fun Fur: little snake with googly eyes that rose up when you petted it and tufts glued to the end of pencils to look like those little troll dolls. Each one was priced at a dollar and my mom subsidized my venture by buying all the materials. I had to sell a hundred of them to buy my truck. I was an ADD kid so I couldn’t even count that high without getting distracted.
Time rolled on and slowly over the course of a dozen or so craft sales my pile of cash grew and grew until I had enough. Just for me my parents made the three hour long (round trip)journey into the city. I was so excited. I had worked so hard and now I was getting what I wanted.
Life rarely works out as planned unfortunately. The truck also required one of those fancy batteries that wasn’t included. The kind that cost another $40. My parents didn’t come to my rescue. They just told me I’d have to work harder to afford the new cost. On the way back I was in tears, my heart broken. My mother then told me that I shouldn’t be sad, and to remember the smiles of the people I sold my stuff to. Money was just a way to say thank you, but the real reward was in making other people happy.
10 Apr 2007
I decided I should expand my computeristic knowledge and pick up a new language. Up for consideration were: lisp, haskell, and flash (action script). Lisp I have a strong interest in, but not strong enough to overcome my aversion to something that you pay for. Action script would probably be the most useful, in a directly relevant to my life way, to learn. In the end I settled for haskell. It is supposed to blow my mind and be a zen like experience that will take me to the next level of programming gurudom.
I googled for ‘learning haskell’ and ended up at the official haskell learning page. After browsing the options I decided to go for the tutorial called, ‘Two dozen short lessons‘, and download hugs as my haskell environment. So far so good.
I’ve never done any functional programming of any kind, so I had no idea what to expect. Erik has tried to show me a few things, but I’m the type of person who learns to do by doing. Most of the things he showed me I thought were neat conceptual tricks with no real reason for existing. I’m a good little sheep, so when the tutorial told me to forget everything I know about functional and object oriented programming I did so. With great ease and joy for the object stuff as well.
I’m on page 70 of the tutorial and so far I have found one main thing that annoys me. The way haskell is set up means that I can’t just write definitions (raw code) into the interpreter like I would Python. I have to do that in a text file and then load it. From there I can run commands on the code. So I can use the functions I define, but I can’t define them in the interpreter for a quick putter. Annoying, but not nearly as annoying as the fact that I can’t declare variables in the interpreter as well. I’m learning the way and the why of haskell so it makes sense to do it this way, but I’m lazy and it’d just be easier to write it right in.
I’m understanding how things work, and I’ve taken their examples and mashed them up to do my own thing differently, but I’m not sure I grok it yet. Most other coding tutorials I’ve done have started out with a hello world program. Haskell has dived right into sets, list comprehension, reductions and infinite iterations while briefly stopping to talk about the nature of numbers. It’s not making my head hurt as much as I thought it might, but there is still some pain.
So far I’m not seeing any real advantage to haskell as a language, but I’ve only started scratching the surface and the syntax. I’m seeing it more as a tool for doing computations like statistics than as a general language useful for everything. I’m going to keep at it and see if I can’t think up a project to do in haskell that solves a real problem.
09 Apr 2007
Ok, so it’s not exotic. This is more a post so my mom doesn’t worry that I’m eating like a bachelor. Ramen noodles, greasy pizza, twinkies and ice cream.
Ingredients:
Hunk of meat – one
Weatherford Spice – several dashes (basically seasoning salt + garlic)
Mushrooms – two handfuls
Carrots – two
Onion – half a handful
Garlic – two cloves
Butter – sliver
Salt – dash
Meat:

1) Cook on BBQ until cooked.
2) Spice with spice.
Healthy Junk:

1) Wash all veggies to remove most dirt
2) Dice carrots and onion
3) Dice and smoosh garlic
4) Toss mushrooms, carrots, onion, garlic, butter, and salt into a small pan over medium heat
5) Stir to prevent burning and cook until onions turn clear
I should’ve started the veggies before the meat. I used a fairly thin steak so it cooked faster that the veggies. I started off just wanting mushrooms sauteed in garlic butter to go with my steak but decided a wider range of non meat like substances would probably be better for me.
Steak is hard to screw up, and it came out decent. I take great pride in finding the best, cheapest, steaks I can when I go shopping. Sadly this package of steaks was not so strong on the best side. It was too thin and didn’t have enough marbling for my taste. I like my fat. It tastes good.
The veggie bit came out better than I expected. The carrots were perfectly cooked so they were soft without falling apart. There was a nice soft underflavor from the butter, but not enough to make it greasy and gross. All the flavors melded together nicely and nothing was too sharp. The color was a little bland and could have been brought out more with something vibrant like podded peas or red pepper.