oneschemeofhappiness

Related Schemes and Literature

Archive for the category “programming”

Return of the Native (Coder)

After much tramping around, virtually of course, I have come to the conclusion that in order to develop programs for the web, I will have to learn everything. Yes, I mean everything. Should’ve only taken a couple weeks, but here we are and sadly I am no where near to knowing it all. (I will be retaining the title of Know-it-all, in case you were curious).

In the mean time and to help keep me sane, I chose two tracks. The first is php, and the web frameworks that go with it. Drupal and Symfony2 have both caught my eye. My desire would be to continue to track my progress on this blog. I am not holding my breath, so neither should you, but I will try. I have also missed a few daily post challenges that would have been fun to write about. Anyway, if I can find a decent way to keep track of my workflow that I will actually use, this desire might become a reality. Any suggestions are welcome.

The second track, and where a lot of my time has been spent the last two weeks is in setting up another website. Every Thursday, or sooner, there will be a new review of something. That something as of now is most likely going to be books or programming. It is still in the hatching stages. It is also a place for me to test out affiliate marketing, so that I can offer coherent thoughts and opinions of how it works, what works, things to avoid and so on. Again, any thoughts on affiliate marketing, what you like or what could be done better is appreciated. Personally I don’t like the rotating, moving, flash ads with products only tangentially related to the article topic or my interests. We’ll see how it goes.

Later, I would like to follow in the venerable tradition of bloggers, and have some guest reviews and content. If there is anything you think would make a for a good review, or information piece, let me know in the comments here or on my new site. It is still a work in progress while I learn to get everything the way I want it, and not the way WordPress thinks I want it, so you will have to bear with me.

If you do decide at some point that you would like your own hosting plan, hostgator seems to be good. I used them once before, and host my new site with them now. It’s not that difficult to set up, and they are cheap. I will put my affiliate link on this site as well, if you are interested. It doesn’t cost you any more to use my link, and in fact it will cost you less. I added a 25% off coupon code. You have to enter the coupon discount to get it. The savings come out of any commission I might make. (25% was the most I was allowed to make it). After I have hosted with them for a while, I’ll put up a review of their service. I thought I might also do some webcasts on setting things up and using cpanel.

Cheers!

Odds ‘N’ Ends

Short(er) post today. Did not care too much for today’s postaday prompt so, rebel that I am, I am going to write about stuff of interest from today. The presentation will be in the form of a list in honor of much of today being centered around lisp.

(defun describe (item)
 (cond ((eq item "humorous article")
         (web-open-stream this-post-gender-normative-guy-walks-into-a-bar))
        ((eq item "kierkegaard")
         (download-ebook Provocations))
        ((eq item "lisp gui tools")
         (nil))
        ((eq item "norvig")
         (grok peter-norvig-site))
        (t (format t "Whew!~%"))))

(This assumes some non-standard functions have been implemented)
Most of the day, aside from looking for work, was spent trying to find out how to use lisp to program a graphical user interface. At this point I only have a few leads. Many of the ‘projects’ out there haven’t seen the light of day for some years now. I am also not sure why I would want to do this. This morning there was a definite reason, but I’m having trouble recalling exactly what that reason was. It would be nice to know, if only to rationalize the time spent in searching.
On the other hand, I did find some funny articles, another book to put onto my wish list and a new (and poorly formatted) website to explore that has a lot to do with lisp. Also, if you google ‘The Lisp Curse’ you will find a well-written article that attempts to explain the current state of lisp development and the lisp community. Food for thought, certainly. And so I push on.

Up the Mountain

The sounds of raging battle were deafening. Shouts and explosions from all sides erupted into a stream of endless cacophony. I and a few remaining soldiers, scarred and wounded, were all that was left from that once noble band of fighters. We slogged up the mountain that had kept us from being encircled completely, our defense, had now turned into our newest adversary. Five days ago, I had given the order to retreat up the face. Five days ago the worrisome thoughts of snow were now a reality as we set up camp. The first few flakes stung our cheeks and drove our hearts to the brink of despair.

Going back would be certain destruction. But how long could we hold out here in freezing conditions and no supplies to speak of, rations for two more days, three at most and meager shelters meant for warmer climates. I looked up the mountain slope, with more than half still left and wondered why I had agreed to lead this fight. Was it glory or pride? An easy victory and quick–one last war with such riches promised that I, no we all! could live in retired ease.

I ran my eyes over the battle-weary warriors. Was this their only reward, to starve or freeze, to which I led them? I walked quietly away, with orders to my second to take command while I scouted a better position. There was a chance, there were tales I remembered from long ago, legends used to scare the younger ones round the summer campfires of my youth and kept us in our tents till daybreak and the odors of breakfast drove our stomachs to rebel, and take with them our selves from out that cloister of the night. But sometimes legends are rooted in fact, however strange or bleak the chance might be.

The darkness deepened, the snow fell harder. I cast around for a place to shelter for the night when a glint of light caught my eye. I scrambled to the place I thought I’d seen the light, and soon was greeted with a cheery glow spilling forth from a cave just high enough for me to fit without bending over.

Not far in, just around a gentle bend in the path, I saw the source of the fire and what had to be its two progenitors. One was large, fat, adorned with gold and silken fabric. The lobes of his ears struck me as being quite longer than the normal sort; his half-smile was one of seeming content, and in his eyes a depth of peace and understanding beyond my ability to measure.

The other was his opposite, emaciated and gaunt with a thin, tattered, patched cloth his only garment. He sat upon the ground, his eyes were closed and about him hung a cold and darkened space despite the fire. He spoke first. His voice as strong as judgement day sent chills along my spine.

“We have been waiting for you to arrive. Your test has been prepared. Are you ready?”

The old man, who hadn’t opened his eyes as he spoke, opened them now. My knees grew weak. His gaze pierced through my soul. The legendary fate of those who dared the test was grim indeed, and in that gaze I felt my certain failure.

“I am,” I said. The whole cave spun around me, and something cold and hard like stone hit my head with the force of a giants punch, then all went dark.

Heavy Casualties

I stood at the treeline near the foot of the mountain surveying the fray. It didn’t look good. One of lieutenants approached, uniform torn, muddy. A trickle of blood flowed from his right temple. “Supply lines have been cut off, Sir! Sustained heavy casualties on all sides. Intelligence says that both enemy forces have signed a temporary truce in order that they might band together to destroy us first, before destroying each other.”

“Must have just finished reading King John. No matter!” I replied. “What are our options?”

“Intelligence has been able to decipher only some of messages we have intercepted. LoL forces are spreading out along the northern front. PCL forces have laid a heavy mine field to the West while entrenching themselves along our southern line.”

“East it is then, over the mountain.”

“But, Sir, winter is hard by and the clouds are frowning darkly above the peak. I fear our forces will be caught in the coming storm and freeze ere we reach the other side.”

“If we stay here or brave either side we’ll be overrun and lost. We will have a better chance if we maintain the higher ground. Give the order!”

As the lieutenant ran off carrying the instructions to the troops, I thought to myself, ‘and perhaps those legends about the mountain have some kernel of truth.’

Defmacro in the house, yo!

O the joys of lisping around. Having made it (almost) through chapter 8 in PCL, I am jumping back to LoL. Perhaps I am too picky or my mind-set is just being obstinate, but I have to say that I am struggling with all these lisp tutorials. They start out easily enough and then all in one chapter, the kitchen sink comes flying out of nowhere. Two chapters about macros, well before much to do with lists. Macros are extremely important, but I think that there are other items that ought to come first in a budding lisper’s career.

Another thing that does get on my nerves, and this seems to be endemic to certain veins of books that Explain Hard Things, is the Look How Clever I Am moments, or when in a more jovially tolerant mood, the “Cutsy Effect.” As an example, and not to pick on PCL–it just happens to be handy and relevant: Why, O Why! would the first serious macro example be one wherein there is no body to the macro?

This is part of a larger pattern fueled in part, no doubt, by the need to impress, and includes other such terrors as: All the examples (and I have several elementary student math texts in mind here) show only one way to solve the problem, use the pattern or rule, &c., and then the very first and most of the rest of the exercises can’t be done the same way and/or need information that comes several lessons later!

Perhaps much of this is subconsciously done. This leads to self-reflection. Where is it that I *gasp* maybe, might, do (but oh no! never ever!) the same thing? When explaining, writing, speaking, showing, demonstrating “stuff” I know like the back of my hand? Especially the “stuff” it took me a long time to learn? Sigh.  Well, just wait till I write my book. . .

The Battle of the Books Rages on:

LoL:5 (preparing to outflank) PCL:8

The First Snag at Chapter 2

Plunging through PCL Chapter 2. It’s an exposition chapter to kind of show off what lisp can do by making a simple database for a music collection using property lists. Pretty cool, right?

And halfway through I hit a snag. Yesterday everything worked fine. Today I added some of load and save features, started up the REPL again and BOOM! the function to add records no longer worked. Not the new functions, mind you, but the one that already worked. Frustration and Head Scratching abounded.

I realized what the difference was. When I restarted the REPL, obviously the previous definitions were cleared. This should not have been a problem, because I reloaded the file with all my work. But here is the catch. The book builds up the program piece by piece, so that by the time you have all the major functions built, the global *db* is already defined. But that value gets wiped if you restart. So when the code tried to push the list onto *db* it landed me in the debugger. Apparently one cannot instantiate variables that way, at least in lisp.

Added (defvar *db*) to the file and it works fine now, even after restarting the REPL.

This leaves me with two (for now) questions:

  1. Would setf have been a better choice?
  2. More generally, I dislike the idea of defining globals, so what might be a better way to achieve the same goals?

Cheers!

The Journey Continues

Off to a limping start. One last attempt at getting a usable, compiling Common Lisp environment set up. I have settled on Embedded Common Lisp. The process has been a little over 30 min. so far. As I write this, it just finished. The compile process was an interesting mix of output from make and lisp code. If my current box wasn’t from the Dark Ages, I don’t think it would have taken as long.

This time, though, has given a pause for me to step back and meditate upon the deeper things, like how have I come to this point, and why on earth did I try to compile it through xterm with the X server still running.

The second question is one of those unanswerables. The first has a slightly more cogent path.

It all started when I applied to be a web programmer and asked what I needed to do to advance to those lofty heights. The answer was immediate and direct. Master JavaScript, PHP, MySQL, HTML and CSS. These are the Five Elements I must seek out. To that end, and to put me in the proper mood, I popped in some Jackie Chan and other Kung Fu flicks. Properly motivated, I decided to set out after the least known Element: JavaScript.

So, you might well ask, why does this seeker of web wisdom slave away at the command line in order that he might forge the perfect Lisp environment? Well, it’s like this. JavaScript is a functional language deep down, but the ancient tomes of functional wisdom are written with a decided lisp in a scheme unknown. So learn this scheme first. After pushing through 14 chapters of the excellent Simply Scheme, I had a grasp of recursion and higher-order functions. But I needed more practical examples. Enter Practical Common Lisp–the book.

My plan now is to work through that book as quickly as possible, and I wanted more than just one version. I had hoped to get one with a better IDE, but they all failed horribly and fatally–for example, the editor won’t attach to the running instance, and it was packaged with that version of lisp for just that reason. Oh, yes, and ease of installation and use. And so my journey continues.

Another Day Another Scheme

So here I am, contemplating what to blog, and no napkins. Believing that these computer things might just catch on, perhaps not now, but someday! I have decided to plunge on in so as to get in on the ground floor. What better way than to become a web programmer! And I can make tons of money–there are plenty of sites that say so. All I need to do to find out the secret to making money on the web that NO ONE ELSE HAS is to order a vastly-just-for-me-discounted /pdf|license|video|whatever/ within the next few hours–no minutes! Blurry eyed and feverish I mouse my way to the golden-brick-link, hovering I hesitate, finger poised to click the click that will change my life forever, something nagging at the back of my mind. What was it? Oh, yeah, I’m broke.

So back to web programming. Actually I think it would be fun. Woefully behind on social networking, having abstained from JavaScript (this turns out to have been a mistake), I am plunging ahead in all things web.

I have learned a lot from blogs. I have started exploring the Scheme and Lisp programming languages to get a better handle on JavaScript’s core. It turns out all those parentheses are like little machetes hacking away the overgrowth obscuring that core.

Rather than just agonize my way through the mountains of information alone, I wanted to share. Share my thoughts and progress and occasional insights on my journey. The resources, books, the whatever that comes along that I integrate into my scheme of the day.

I like to read, write, explore. I like to learn and share in odd and creative ways. So here I am.

Post Navigation