Change default Apache port

Default Apache port number is 80, means that you can access your local web server at localhost:80. What if you want to change this number? Follow the steps below, where we are changing our port to 8010.

In Linux/Mac, open /etc/apache2/ports.conf with your favorite text editor and change the following:

NameVirtualHost *:8010
Listen :8010

You might also need to open /etc/apache2/sites-enabled/<your default file> and change the following:

<VirtualHost *:8010>

In Windows, look for httpd.conf (for example, if you are using Xampp, open .\xampp\apache\conf\httpd.conf) and change the following:

Listen 8010

Restart your server and browse your local site with the new port.

Searching text in files using grep

Somehow, ack-grep doesn’t work as well anymore, so I’m switching to the good old grep.

grep -iRn keyword path

-i to ignore case sensitivity
-R for recursive search 
-n to display line numbers

Example:

grep -iRn "Thank you for registering" /var/www/mysite

Using vim, you can use the :n command to jump to specific line (replace n with line number).

You can also use the / command in Vim, to search for texts. Jump through previous/next searches with using the N/n command.

Finding meaning in meaninglessness

There was a short period of my life where I felt that everything was meaningless.

It was a good period.

Think about it — if everything is meaningless, then there would be no point of doing anything at all. No point of working hard to prove your worth in your career. No point of thinking about her and the complications that come along. No point of chasing deadlines on responsibilities that you put upon yourself. No point to even level up your Priest character in Dragon Nest.

Nothing, or no one, matters in this life.

Upon this realization, enlightenment happened. All hell broke loose. I was set free.

Free from expectations from others, and myself. Free from ego and pride, from guilt and regret. Free to do anything that I want to. And so I did.

It was a good period. Let me be reminded.

The Happiness Project

For the sake of happiness, there are too much qualities about myself that I would like to have. I’d like to be radically focused at work, have more empathy towards others, speak less. I’d like to remember that my source of joy doesn’t come from one particular person, I wish I have more humility, and I wanted to call home more often.

So I did some goal setting activities on self-improvisation, outlining categories – God in the first column, family in the second, career, friends, and so on. Then I scored myself on them on a weekly basis. But there were too many things to remember, I got overwhelmed, and under-performing categories demotivated the rest. It didn’t last long.

For 2012, I am taking a different approach. I’ll go slower, I’ll tackle them one by one. Inspired by The Happiness Project by Gretchen Rubin, I am having a theme for each month, on qualities that I wanted to have.

For January, it is the month of being content. It is important to start this journey knowing that I am enough. I am sufficient. Being content will prepare me for the rest of the other challenges. Most importantly, even if this whole project doesn’t really turn out the way I wanted it to be, I am still content of who I am.

Instead of scoring myself on the theme, I decided to do something that I do best – write. Every time an internal conflict arises, I turn to my trusty notebook and write about how I should be content on the matter. When I write about it, I am reminded of many good things – my comfortable shelter, abundance of friends, well-equipped intellect. By the end of the day, I realized that I have the honor to not just being content, but also being grateful.

Hopefully when I have write them enough, these qualities would be ingrained into my subconscious. They would become parts of me.

The first half of January has been going really good so far. Looking forward to another half, and beyond.

I need some time to think

We never really give ourselves some time to think. Not since the Internet.

The computer is one hell of a distraction machine. We are on auto-pilot the moment we put our hands on the keyboard, typing ‘Facebook’ into the address bar as if it is a subconscious act, wired into our brain to fill every two-seconds gap we have in this life. Scary, scary world we are living in.

When I am outside, there are a lot of things on my mind. On the train, in the coffee shop, even while staring throughout the window. I think of ideas, problems, and reflections.

The only thing that is left to do is to put those ideas into a tangible manner. Write it down. Don’t let them go to waste.

But first, I need some time, to think.

My frustration with online bookmarking

I used to have a piles of bookmarks, organized religiously on my trusty Opera browser. Then came Macbook, Opera sucks in it, so I switched between multiple browsers but the bookmarks never tag along (‘tag along’, geddit?). Even now when I have settled comfortably on a Windows machine with Chrome, I don’t keep bookmarks in my browser anymore. Organizing by folders is so old school.

I used to be a power user of Delicious as well. Every link that I saved is tagged meticulously. Every few months I will go through all of them, one by one, to make sure the details are correct. Links are re-tagged, tags are renamed, and so on.

So I tried moving my bookmarks into Delicious, but it doesn’t feel right. In my browser, bookmarks are the main domain, they are the “sites that I check out for cool stuff”. In Delicious, bookmarks are links to specific article, they are “stories on topic that I want to refer later”. But this is not much of a problem. Rather, it is just a tolerable annoyance.

It became a problem when my Delicious links reached the thousands. Delicious allowed searching by combining tags, but I need more than that. I need to exclude specific tag. My Delicious bookmarks consisted of 90% ‘software’, what if I wanted to search bookmarks that are not?

Back then I wished for a folder/category feature in Delicious, mainly for my browser’s bookmarks, as well as bigger categories such as ‘desktop software’, or ‘web apps’. Recently they had introduced the Stack feature. I haven’t tried it as much yet, but I have long abandoned Delicious. It is way cluttered now, with all those unnecessary thumbnails.

Pinboard looks promising, with a neat and fast interface. I’m willing to pay $10 for it, if only they have the exclusion-of-tag feature.

Guess I will have to roll out my own app then.

January, being content

January is the month of contentment. It is important to start this journey knowing that I am enough, I am sufficient.

I am grateful for my strengths, I do not moan of my weaknesses. Who I am now is the best person I could have ever been.

I open my heart and mind to all possibilities of learning. There is no rush, no plan, no goal. Just, learn.

I am surrounded by a blanket of love from family and friends. I am loved. I will always be loved.

2012, to create

2011 was the year of ‘now’. I made decisions on matters that I had been holding back for long. I got a passport, traveled out of the country, quit my job. It was fun, I have no regrets.

2012 will be the year of ‘creating’. I’ll write, draw, take photos, and record videos. I’ll leave notes and postcards to my friends. I’ll produce essays that will be of use to others. I’ll contribute to the society.

What more can the heart of a man desire?

Time

Two interesting definitions of time, according to Bergson/Minkowski:

Becoming.  An abstract, dimensional aspect of time, which gives rise to the habit of measuring time (seconds, minutes, hours); the idea of representing time on an axis, as we would spatial dimensions; the concept of the duration of an event (the distance between two points on the temporal axis); the idea of being late (once again the distance between two points on the temporal axis).

The succession of events. A concrete aspect of temporal order: we wake up, we take a shower, we have breakfast, we study, we have lunch, we have a nap, we play, we eat, and we go to bed. Children come to have this notion of time before they develop the idea of abstract time which passes regardless of the events that take place.

Suicide?

Recently it has occurred to me that suicide attempt isn’t such a rare case around us. But then a friend suggested that it might just be me, attracting these kind of energy (I’m using ‘energy’ instead of ‘people’ because the latter sounds too judgmental, and human being shouldn’t be labeled).

She might be right.

So what? I am still a good person. So are the people around me. So are you.

It is the hopelessness. The self-loathing. The one thousand and one questions that keep ringing in our heads, never to be solved or answered.

But there is a way for us to be happy again. One day we are going to look at things in a different perspective, and we are going to be stronger.

If you are contemplating suicide, seek help. Call Befrienders KL at +603-79568144 or +603-79568145. Pour it out.

There is a lot of people that understands you, even if you don’t see them now. I understand you. You matter to me.

Adding pages in Rails

Study notes for Ruby on Rails 3 Tutorial, Michael Hartl: Chapter 3

In this chapter, we will learn how to use Rails to perform the most basic routine of creating a website – adding pages. Throughout the exercise, we will familiarize ourselves with controllers and views, routes, and how all three of them connect together. We will also get to know some basic concepts in Rails, particularly in working with views, which are layout and instance variables.
Continue reading

Putting God first

A good Muslim:

  1. Is always in the constant need of support from Allah as he makes effort to help himself.
  2. Seeks to earn the pleasure of Allah in everything that he does. He is not concerned with seeking the approval of others.
  3. His sole purpose in life is to serve his Lord, the Almighty.