Posts for Tag: writing

Introducing Simple Rails Blog

Yes, a new blog. I know what you are thinking: "Who the hell cares?". But read me out.

A while back i looked at wordpress and thought "i don't really need all this stuff, do i?". Turns out i didn't. And if you are at least a little bit like me you will agree that sometimes less is more. After searching for some alternatives i ended up with two solutions: A company hosted blog (tumblr, blogger, and others) or hand made. I chose the latter. 

So let me introduce you to my new open-source Rails blog. Developed with simplicity in mind, it allows you to write and (easily, even automatically) tag posts. That's it.

Full source code is available at bitbucket. If you are a Rails developer (or a plain developer with an open mind) you will find it trivial to adapt it to your needs.

Enjoy, Pedro

Thoughts on writing

Sometimes i wonder why anyone enjoys writing at all.

As if my mind was not confusing enough, with all the absurd and senseless thoughts that run through my head all day long. Why the hell would i want to write any of that on paper? For later to recall, as the famous Portuguese ad went? I know i will "later" laugh while reading all of it but that can't be the only purpose? To organize chaos? To try to motivate myself to write, so i don't lose the skill? To not allow my calligraphy to completely die on me? To try to keep some grammatical capacity i might still possess?

It is definitely not to burn time! Between work, computer games, playing guitar or drums, practice martial arts, and so many other possible occupations, i can think of better choices to spend it.

Then why? Is there a goal? Just good for the soul? :)

Red Hot Chili Peppers lyrics generator

Here's a little something i tried yesterday: a ruby script that mixes and matches verbs, nouns, adjectives, and colors to come up with crazy ass lyrics, red hot style. Enjoy :)

$nouns = IO.readlines('names.txt') $adjectives = IO.readlines('adjectives.txt') $verbs = IO.readlines('verbs.txt') $adjectives << ['red','blue','green','white','black','yellow','brown','gray'] $pronouns = IO.readlines('pronouns.txt') $adverbs = IO.readlines('adverbs.txt') $prepositions = IO.readlines('prepositions.txt')

def get_rand(collection) sleep rand / 10000 collection[rand * collection.length.to_i - 1] end

def preposition_phrase "#{get_rand($prepositions).strip} the #{get_rand($nouns).strip}" end

def adjectivated_subject_phrase the_part = "the" if rand.to_f > 0.5 adjective = get_rand($adjectives).strip if rand.to_f > 0.5 return "#{the_part} #{adjective} #{get_rand($nouns).strip}" if the_part and adjective nil end

def generate_phrase as = adjectivated_subject_phrase adjectivated_subject_part = as.nil? ? get_rand($pronouns).strip : as preposition_part = rand.to_f > 0.5 ? preposition_phrase : "" verb_part = get_rand($verbs).strip object_part = rand.to_f > 0.25 ? get_rand($nouns).strip : "" the_part = (rand.to_f > 0.5 and object_part != "") ? "the" : "" adverb_part = rand.to_f > 0.75 ? get_rand($adverbs).strip : ""

"#{adjectivated_subject_part} #{preposition_part} #{verb_part} #{the_part} #{object_part} #{adverb_part}".squeeze(" ").strip end

def generate_lyrics result = "" (1..5).each do first_phrase = generate_phrase new_phrase = generate_phrase while new_phrase[-2, 2] != first_phrase[-2, 2] or new_phrase.split(" ")[-1] == first_phrase.split(" ")[-1] do new_phrase = generate_phrase end result << "#{first_phrase}\r\n#{new_phrase}\r\n\r\n" end result end

puts generate_lyrics Here are the sources: rhcp_lyrics_v2.tar. As a bonus there is a script to see how many attempts are required to reach the phrase "The quick brown fox" :)

How to lose half your page visits in 1 month (and how to recover from it)

A while back i changed my blog domain name from to However, i was dumb enough not to redirect the traffic to the new name - in a transition period. The result? A drop from 100+ visits per day to less than 20.

I have to admit that it kind of bummed me out a little. Being a Buddhist-light i tried my best not to let it get to me and told myself that it would eventually recover just as long as i kept writing stuff that can help some people - combined with nicely chosen post titles and search engine keywords.

Turns out i was right: a couple of months later the visits are slowly recovering - as you can see from the screenshot of my analytics account.

That is all very neat but where is the "helping people" part, you might ask. Here it is: I thought i might share some of the techniques i currently employ to attract people to look at what i write. They are no different from what others have blogged about before, but it's always good to share this information around with prospective new bloggers:

Write about stuff that you think will help other people. This may mean writing about solutions to problems you yourself encountered, or just writing about interesting stuff you did/saw/ate/whatever that other humans will possibly find interesting :) Read a lot of news/blogs/stories about stuff that you have interest in. And *write insightful* comments on them. Most comments systems will allow you to enter your URL and/or twitter name and will show those in the comments you write. This is a great way to drive the curious people back to your site; For every helpful post you write, submit the link to the major news sites (think digg, reddit, hacker news, etc). This will make sure that search engines will have more interest in your site, since you will be linked back when they crawl those. It will also make some more people aware of what you are writing, which leads me to the following point... ...Write catchy post titles. And by catchy i don't mean cheesy or sensationalist. Create a habit of getting to the point in your titles while - at the same time - being original to entice curiosity. Writing titles is a form of art in itself, believe me; Link whenever you are referencing something that can be linked to. Again, search engines will use this information to your advantage in page rankings. And other bloggers will appreciate the traffic, so it's a win-win situation :)

That's it. Happy blogging, and feel free to drop me a line ;)