better living through python

An adventure in programming and recovery.

Code for my blog's tagging system

April 02, 2012

I created a tagging system for my blog, so that I or others could easily peruse the entries I’ve written. I figured if I ever end up writing a book about learning to program, then it would be great to have my resource already cataloged.

In order to create my tagging system, I had to sort through all the tons of documentation on how others out there did it. This is probably the most difficult part of programming; understanding what others have out there and how to use it. In the end I set mine up simply, thankfully. If not, I might not have been able to rexplain it to you here.

Using the blog setup jekyll, I inserted the following code in the right side bar under blog content. The code inserted is shown below in liquid/html:

{% for tag in site.tags  %}
<p>
	<a href="/tags.html#{{tag[0]}}>{{tag[0]}}</a>
</p>
{% endfor %}

As seen on my right under blog content, this code provides a large list of all tags included in my blog posts. If you click on the title blog content, it will take you to the tags.html page of my website.

To create the tags page, I created a new html file. The top section of this file is separated by the three dashes, and indicates the layout file name and the title of the page. This section is in yaml. The bottom section is in html/liquid.

---
layout: main
title: betterlivingthroughpython
---
{% for tag in site.tags %}
<h2><a name="{{tag[0] }}">{{tag[0]}}</a></h2>
<ul>
	{% for post in tag[1] %}
		<li><a href="{{ post.url }}">{{post.title}} -- {{ post.date | date: \}}</a></li>
	{% endfor  %}
</ul>
{% endfor  %}

I use the main layout, so that my tags page will have the same layout imagery as the rest of the site. The liquid section indicates that for each tag in the site’s collection of tags, there should be a list of the entries with that tag(along with their titles and date posted) shown below the tag header. Due to this structure, the same post may show up multiple times on my tags page, under multiple headers. For each tag a post has, the post will show up in the list for those subsequent tags.

Considering the amount of documentation out there on how to organize, collect, and group your tags I’m glad I stuck with this more simplistic approach. It may not be as dynamic, but for a beginning programmer I understand how it works and I can more easily find blog entries.

Google Code Jam 2012 and new Icon

March 30, 2012

I received an email earlier this week about signing up for the Google Code Jam. I signed up last year, but didn’t understand enough about programming to actually take part. I feel confident I can at least attempt the first problem this year, so I’ve signed up to challenge myself. I think some celebration will be in order if I can complete the first problem, no matter what my score.

New Science Fiction Tower Power IconI was also working on creating a new icon for my game Science Fiction Tower Power. Here is today’s creation. I’m rather proud of it. Creation was done using Inkscape.

I’ve made another change to my work schedule in order to provide more separated time to work on the business. My previous schedule was a six hour block on Wednesday through Friday. Now I’ve adjusted it to two eight hour blocks on Wednesday and Thursday, and one two to four hour block on Friday.

Hopefully this new schedule will allow for more creation and creativity…and hey! I got up before 10am today. Progress is made.

I couldn't find sleep

March 29, 2012

It evaded me, for as I was starting to drift my mind became awash with memories of my time at my previous employer. I kept thinking about all the different things that happened to me. About what I could have done to change things, what I could have done to make things better. Were things my fault?

I think about the anger that still fills me up. When I think about how everyone supported her, and accepted her treatment of me. Then I think of how incredibly alone I felt. Anytime I see anything supportive of her, I am reminded of the lies.

Last night as I tried to sleep I was reminded of the pain I experienced at her hands. I am told that I had nightmares all night, ones where I whimpered in my sleep. I didn’t feel poorly rested this morning, and I don’t remember a bad night’s rest. However my anger lingers…

Creating a tagging system

March 28, 2012

Figuring out how to create a tagging system for my blog was not very clear at first. It took a fair amount of searching the documentation to find a clear way of setting it up. Much of it took testing until we were able to see information start to show up in the correct fields.

The first problem was in realizing that I had set up the tags in my individual entries incorrectly. So I had to go back through all the entries and change them from a simply comma separated format, to what is show at http://www.yaml.org/. Once the tags were set up correctly, the rest of the code was rather simple.

Simple, but still something that Robey had to help me with largely. I understand it now, however it was in a language I was not familiar with. The tagging system was in liquid, another language that is related to Ruby. Ruby is the language that Jekyll was written in, and Jekyll is the software that sets up my blogging system (created by mojombo).

Despite it being in several different languages, I’ve gotten the hang of ‘programming languages’ enough that I can start to grasp the basic syntax differences more easily than before. The language or symbol shock isn’t nearly as bad either. The code was written rather simply in two parts. The organization is presented on the main blog page, under the blog content section on the right side. The second is a separate page created for viewing the organized blog content, the page where you can peruse all the tags.

Slow Recovery

March 27, 2012

I did awaken early this morning, as I hoped yesterday, however this morning I had a reason and not simple initiative as I had hoped. I had a dentist appointment. Things went well enough as I now have whiter teeth and no horrifying life imprints were left on the people who cleaned them.

After my drive yesterday I’m doing better today, but I’m still feeling the edge of an attack if I don’t be careful. The hope is to finish up the tagging system today, so that my blog will be finished and off my docket. Well, for now at least.

I found a useful post that includes code to create a next and previous button on your individual blog pages. It is discussed here. I’ve added it to my website. However, I’m still on the search for a tag org creation system. Hopefully someone has already done all the work for me. : )

Missing in action

March 26, 2012

It seems I am still fighting panic attacks and depression. This morning I awoke at 9am ready to start the day, but decided to hit the snooze button for 30 minutes. I later woke up at noon. At that point I proceeded to hang out in bed for a while, dreading the day, and finally got out to eat and watch some TV. After a couple of episodes of DS9 I decided to take a bath. That’s when my panic attack started to set it. The heat overwhelmed me for a bit, so I only stayed in the bath for about 10 minutes. Then I got out, put on some clothes and decided to go do some errands.

After dropping off some paper work downtown and turning some recycling in at the local Co-op I grabbed a cup of coffee and started driving. I didn’t care where I went I just needed to clear my head. So I drove. Taking random turns around the countryside between Corvallis and Albany I just drifted and sang to random oldies songs on the radio.

I finally stopped at a local Gardening shop called Garlands, bought a couple of items, and left again. Then I kept driving around, grabbed some new pillows and headed home. I had finally calmed down at that point, but up until then I was afraid to turn around. The panic was located at home, where I hadn’t been getting anything done. It’s still here, drifing around, threatening to bring me back down.

So tomorrow will be another day, where I hope to awaken early. A day where I hope my self discipline will be apparent, a day when I will start to move on.

See you tomorrow.

Snowy Adventures

March 21, 2012

It’s snowing. It’s been snowing for over a day now. It seems rather fitting as over a year ago it snowed on almost the same day here in the valley. It feels odd to see the thick flakes drift down. The valley doesn’t normally get such heavy snow fall.

Snow and being outside just makes me yearn for an adventure. Sometimes I wonder if there is something inherent in some people that makes them want to see the world. Many days I see pictures and images and I just want to go! Get out! Come back in weeks, more like months.

But I’m stuck at home translating and crocheting, and watching TV as the snow piles up. Soon I’ll be able to start running again but for now all I can do is stare out at the bright night.

Life altering experiences

March 20, 2012

Over the past two days I’ve been going back over my old blog entries briefly during my efforts to port them all from posterous over to this site. It’s been a much lengthier process than I thought at first. I could have figured out a way to use a script to do the whole thing for me. This particular option became starkly apparent after porting over the first month of data. However, I realized that porting it manually was allowing me to briefly look over my past year of blog entries and better grasp how things have come along.

All in all it was a very enlightening experience. An awesome thing I realized is that my programming education has been pretty constant. Over the past year I’ve progressed through half of the MIT OCW Intro to Computer Science course. When that started to slow down in about October I picked programming back up by writing my game, Science Fiction Tower Power. The next month I dove in again and wrote the CSP Schedule Converter. This past month I’ve redone my entire blog. This next month I’ll be continuing maintenance on existing projects and returning to my game. I also hope to finish up the MIT OCW course as well.

I’ve also learned much about running a business. I’ve learned how to do minimal bookkeeping, organize and keep track of the ever growing amount of documents and files we create, all the while maintaining a social media presence. Robey and I registered FlamingLunchbox and filed for our FEIN (Federal Employer Identification Number). We also survived our first year doing our own taxes for the business. I am still learning, and trying to push myself all the time. This review has really shown just how much my life has changed, how much I’ve learned, and finally given me an inkling as to what I still have left to learn.

Did I mention that this past Friday was the one year anniversary for better living through python? Revisiting some of my original posts and the pain I was processing at that time was difficult. For others it might not be as apparent, but it was easy for me to see how depressed I was. I was struggling. I know that many people were surprised that I jumped into the business and my blog right after what happened. They felt I should wait, give myself some time first, and then start working again. But I couldn’t, and making the decision I did was probably one of the best I have made in a long time.

Starting up this blog gave me back my voice after I felt I had lost it. Another awesome thing? I think some of my thoughts or feelings are resonating with my friends. Either my friends were going to make the changes they have in their life, or maybe…just maybe I’m helping. Maybe simply talking about my issues and problems and…feelings are helping others to do the same. If I’m lucky this is the case; if not I’m sure there is a seat waiting for me somewhere where it’s hot and sticky.

I digress, I always do. Reviewing my blogs I saw my progress, I saw tangible progress. Not something managed and monitored by multiple people who don’t care a lick about me. I saw the progress created by my own thoughts and fingers. I saw progress with my emotional processing and programming capabilities. I saw progress with my writing.

Even more amazing is how much my own writing resonates within me. I see the posts I’ve written and I remember how I felt when I wrote them. The churning emotions, anger, sadness or even despair at times that gripped me. I also remember how elated I was when I made the ships move across the screen for the first time with my game, or how excited I was when I made the command line spit something back out at me. Beauty in your own ability to create, whether it be through the connections in your relationships or threading yarns into afghans. Never deny yourself the ability to try. Creation does not mean perfection, it simply means to make something. And that something will be beautiful to you.

Lesson 1, Why create tools when others share them with you?

March 19, 2012

I use a variety of services for my new blog.  I use a template systems provided by mojombo.  This provides the main structure for the blog.  That means, the code provided includes all the files and necessary set up for the blog template to work through github.  In order to post or make adjustments to my blog, I simply update the repository on github.  If you’re interested in github and what it is, you can follow this simple tutorial for more information and help on downloading it to your computer.  This tutorial will help you setup git on your computer, and get started using this awesome system.  Please note, don’t bother with this unless you’re planning on doing something with code.  Otherwise it may be a bit superfluous.
 
As I mentioned last week I also use Disqus which allows me to provide a comments section, as well as social sharing tools.  These tools are easily accessible, and are used through each blog entries individual page.  It was also easy to implement, simply cutting and pasting a chunk of javascript onto my post.html page.  
 
AddThis is a great service available for those who want something that provides them with social sharing tools that are easy to access and insert into their.  AddThis provides you with a variety of different social service buttons to add to your site, along with a variety of styles.  One of the downsides I’ve found, however, is that the AddThis information does not directly link up to your facebook page from your site.  At least, this is as far as I’m aware of at the moment.  

I mentioned on Friday that twitter provides you with a widget that will insert your twitter feed (although shortened for easier insertion into another web page).  This widget allows you to select the colors for it’s design, but unfortunately no other specifications are allowed.  This widget is just as easy as the other services mentioned above, however it has a specific width value range, and so configuring your page to work appropriately with it can be a bit annoying.  

There is one more service I want to mention, but it’s not directly related to my blog.  This service is called Gravatar.  You can use Gravatar to make one personal avatar your only avatar online.  Gravatar will insert your chosen avatar into a variety of sites, so you don’t have to do it for each one.  It makes the process of being involved in online conversations much easier.  This way you can take part, without all the extra hassle.  

        
 

 

Welcome to my new home!!

March 16, 2012

Here is pythonliving.flaminglunchbox.net. Feel free to check out all pages and links, they should all be accessible at this time. I have not finished porting all of my posts, but it’s in the works. Hopefully in the next week or so the blog content and the subsequent content organization should be complete. There are also a few more javascript things I want to complete for the resume page, but for now we are good to go!

Please let me know if you find any broken links or errors that come up, and I’ll try to get right on fixing them. If you wish to comment on particular posts, simply click on the title and it will bring you to the posts specific page, where Disqus is used to collect and process the comments. You can also use Disqus to tweet or share particular posts on facebook.

Unfortunately I don’t have auto-posting to twitter or facebook anymore, because that set up was through my posterous account. However now I can implement javascript additions whenever I feel like it. That was one of the major drawbacks to posterous, it didn’t allow you to add in your own javascript. Because of that you couldn’t even add in the simply twitter widget that twitter provides you. Besides wanting to learn how to create my own blog site, not being able to post my twitter feed to my blog was a major drawback.

I’m still not amazing at graphics or creating an amazing web design, but that wasn’t wholly the point. I wanted something that was functional, slick and simple, and provided all the needed information when necessary. I wanted it to represent me. I’m fairly into crochet, buttons and creating my own clothes when I can, so I combined other things I love with my drive to learn programming.

See you next week!

Links