Tuesday, September 11, 2012

Programming Is Hard To Understand

I just read this in one of the threads I'm part of.

To be honest, programming is hard but only at the beginning phase. Just like every other things you do the same with riding a bicycle. You'll find it hard to maintain your balance that sometimes you'll end up scraping your knees but once you get the hang of it, you'll totally enjoy it forgetting all the wounds and frustrations throughout the process.

So what do I need to "easily" understand programming?

The answer is simple: learn to LOVE IT.

Haven't you notice if you love to do something no matter how hard or difficult it is you still enjoy doing it without ANY complaints. I always notice this behavior with my other colleagues. Our work is mainly to do programs but only a few are actually enjoying it. Most of them are just treating it as their source of income or just because they are good at it. Remember, not all people who are good at something actually love what they're doing. Maybe they'll just some genius who are born with those talents but their hearts aren't just for it. These kind of people almost always end up not enjoying their life and once they realize this it's already too late.

Wednesday, July 4, 2012

Multiple Instances for Skype 4 on Ubuntu

Skype has a new version for ubuntu! Hooray! The Skype 4 has arrived! But the problem is the multiple instances was gone. So I look for a solution for this, and I found this:

1. Install skype (if you haven't yet)

2. We'll create new copies of the installed skype. Open the terminal and run the following commands:
cp -r ~/.Skype ~/.Skype.first
cp -r ~/.Skype ~/.Skype.second

Friday, June 15, 2012

[jQuery] Know If An Element Exist

Basic syntax:
$('element').length == 0

if($('div#mydiv').length == 0)
        <div id="mydiv">hello world!</div>
    $('div#mydiv').html('hello universe!');

Saturday, June 9, 2012

[Ubuntu] Virtualbox Fullscreen on Ubuntu 10.10 Won't Work

I use Virtualbox to have the Ubuntu 10.10 (64-bit) version in my unit but the Fullscreen function doesn't work properly. If I go to View > Switch to Fullscreen, then the virtualbox window will have a fullscreen but not the ubuntu itself.

So I've research on how to do it and here's what works for me:

sudo apt-get update
sudo apt-get install build-essential linux-headers-$(uname -r)
sudo apt-get install virtualbox-ose-guest-x11 

Apparently, we need to solve first the Guess Additions Issue on Ubuntu 10.10 for the Fullscreen to take effect.

Enjoy! =D

Thursday, June 7, 2012

[Ubuntu] Resize Wubi Disk

If you're wondering what is wubi then let me explain it a bit. Wubi let's you install ubuntu OS via Windows. Although installing ubuntu in a traditional boot-to-CD way still it's more complicated to other non-techie people.

Installing ubuntu using wubi limits your ubuntu drive into 30GB storage disk, not so bad if you're not really using as your primary OS. I, as a web developer and using ubuntu as my primary OS due to my current work, needed to have a larger storage disk but I don't want to backup my file and install ubuntu over again (traditional way). It's a hassle to backup files specially if I need the larger storage right away. So I've done some research and read a lot of articles if it is possible to just resize and extend the storage disk which was installed via wubi. And, yes, I found the solution that works for me.

First, download the wubi-resize_1.5b.sh. Save it on Downloads folder.

Friday, May 25, 2012

[Joomla] The Curious Case of Index.html

(try to imagine some mystery background music while reading the next lines. LOL) We've seen them everywhere scattered along the your files; One in each directory but what are they really? --- index.html.

Yeah, right. When I first started in Joomla then saw this index.html file I was like "what's the use of this one?" Even the novice tutorials on Joomla Docs included this file. I tried removing it and nothing happened so I don't include it anymore when I create an extension. Later on, while browsing the files on the browser I discovered the purpose of that tiny file index.html. So to all programmers, we know that index.html is the default file the browser loads if none of the other files was indicated. So the purpose of index.html is for security.

Security? Yeah, you heard me (or read it) right! This tiny (or zero file size) file does something for your files security. Okay, here's an example, I have a directory named "mytest" that contains two files namely file1.txt and file2.txt. If I locate the "mytest" directory on the browser it will show the files on that directory. Now, I'll add the index.html (empty file) on the "mytest" directory then located it once again on the browser. Can you guess what will display on the browser? If you're thinking that a white blank page will display then you're absolutely correct! You see, the browser searches for the index.html first when nothing on the files in the current directory was indicated. Getch?

Blogger's note: I think post is the most confusing one I created. I guess the current time in my place right now is also the factor on that. It's actually 4:28 AM here so still kind of sleepy. Anyways, any question, clarification, or correction are welcome just post it below on the comments section.


Wednesday, May 23, 2012

[Ubuntu] Install PIL in Virtualenv

I look everywhere on how to install PIL without a hitch. After a few reading, searching, frustrations, installing and uninstalling, I finally found the one that works for me (and for you might as well).

Follow the steps on how to install PIL:
1 install the needed libraries
sudo apt-get install libjpeg-dev libpng-dev zlib1g-dev liblcms1-dev python-dev

2 install the dependencies needed to build PIL
sudo apt-get build-dep python-imaging

3 run these commands
sudo ln -s /usr/lib/i386-linux-gnu/libfreetype.so /usr/lib/
sudo ln -s /usr/lib/i386-linux-gnu/libz.so /usr/lib/
sudo ln -s /usr/lib/i386-linux-gnu/libjpeg.so /usr/lib/

4 Lastly, install PIL
pip install PIL

You should at least see this somewhere
    --- JPEG support available
    --- ZLIB (PNG/ZIP) support available
    --- FREETYPE2 support available

Tuesday, May 22, 2012

[Joomla 2.5] Create New Article Frontend

I have three Joomla 2.5 sites. One on my local and two on a free hosting site. On one of the two sites (on free hosting site), I create a menu item that allows frontend registered users to create an article but was given this error:

The One Who Holds My Heart by Luther Vandross

I'd Rather had bad times with you, then goodtimes with someone else.
I'd rather beside you in a storm, then safe and warm by myself,
I'd rather have hard times together, than to have it easy apart.
I'd rather have the one who holds my heart, who holds my heart.

And then I met someone and thought that she could replace you.
We got along just fine, but wasted time because she was not you.
We had alot of fun, though we knew we were faking
love was not impressed with our connection built on lies, on lies.

So Im here cause i found this one thing is true, that im nothing without you,
I know better now and I've had a change of heart.

This is the last song I heard before I go to sleep. Somehow this song has a different meaning nowadays. LOL!

Thursday, May 10, 2012

[ubuntu] Virtualenv

sudo apt-get install virtualenv
easy_install virtualenv

Create environment
virtualenv <folder name>

Create clean environment
virtual --no-site-packages <folder name>

Activate environment
source <folder name>/bin/activate

Deactivate environment

Note: you can create your environment in any directory as long as you activate it using the right directory path

Wednesday, May 9, 2012

[Joomla] Can't Edit, It's Locked!

Have you seen this lock image from your Joomla backend?

This means that a certain entry is being use by someone or was used by someone and haven't been properly close the entry. You know, that red Close button at the top right of your screen?

Monday, May 7, 2012

Hard Work VS. Talent

"Hard work beat the talent if the talent doesn't work hard"

That every line above was what my trainee told me when I told him I'm not that skillful, just the product of hard work. And I was like nodding slowly and told myself "yeah, it does makes sense".

When I was still in college I use to (silently) compete with my classmates. I know I'm not the cream of the crop so I always work hard and though my output may not be as good as theirs still they are threaten by it.

Saturday, May 5, 2012

[Django] Add CSS files

I can't find any tutorial that specifically tells what how to add CSS files on Django project so after a long adventure and a lot of readings and trial and errors here how I did it:

1. open your settings.py and locate the MEDIA_ROOT and MEDIA_URL
MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media')
MEDIA_URL = '/media/'

If you're wondering what is os.path.join and PROJECT_ROOT then I'll explain it.

On top of the file (settings.py) add the following code:
import os
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))

so based on the codes above, os.path.join and PROJECT_ROOT gets the current path where your project was located in your drive/server/etc.

The "media" is simple the folder where your css files will be saved.

moving on...

[Django] Create a Super User manually

Whenever the database was first sync, it will prompt if you want to create a super user but what if somewhere in the future you want to create another super user without creating one from the admin view?

Using the terminal, go to your project folder then use the following code:
python manage.py createsuperuser

After that code, you will be prompted to enter your username, email and password.

You now have created a super user account manually and using the terminal!

Wednesday, May 2, 2012

Install then Uninstall then Install then Uninstall...What are you doing?!

Most of those new to Joomla does this: install the component(or module, plugin or template) then you found some error so you'll uninstall it again (to convince yourself that the changes are really taking effect even though you can just edit it) then install again the updated copy. Found another error, uninstall again, then install again.

Isn't that such a hassle? In order for you to not do that install-uninstall-install thing then all you need to do is add this code in your xml installer file:

Sunday, April 22, 2012

[Ubuntu][Sqlite3] Display all Tables

Here's how to display all tables on ubuntu terminal

Activate sqlite3:
sqlite3 my_database_name.db

Display all tables:
SELECT name FROM sqlite_master WHERE type='table' ORDER BY name;

Friday, April 20, 2012

[HTML][Javascript] Mailto + Subject and Body

When we create a link that points to our mail we commonly use this:
<a href="mailto:my_email@test.com">Send me your Feedback!</a>

How about adding a subject on the email? Yes, we can also do that.
<a href="mailto:my_email@test.com?subject=my subject">Send me your Feedback!</a>

How about adding an email content? Another check!
<a href="mailto:my_email@test.com?subject=my subject&body=my content here">
    Send me your Feedback!</a>

Thursday, April 19, 2012

[HTML] Marquee Party!

Hey! I've been searching on something to do when I came across a site that has a moving text. At first, I thought that it's some javascript code or something that makes it move but when I use firebug to look at the code I saw that it's using the <marquee> tag. I haven't use the marquee tag for a long time so I decided to explore the said tag once again.

Wednesday, April 18, 2012

[Django] Know Your Django Version

There are cases where you want to know what version of Django was installed in your machine.
Here's how to know such:
import django
note that VERSION are all in capital letters

(1, 4, 0, 'final', 0)

By the way, in case you want to know what's the latest version
import django


Tuesday, April 17, 2012

[Javascript] Checkbox Check/Uncheck All Toggle Switch

Checkbox are useful when you intend to use more than one response or data so what if the user want to check all the available info? This is where the toggle switch happened to be useful.

Here's the code:
<script language="javascript">
  function checkAll(list, tick)
    for (i = 0; i < list.length; i++)
      list[i].checked = tick.checked? true:false
<form id="mylist" name="list">
  <input type="checkbox" name="toggle" onclick="
    javascript:checkAll(document.list.check, this)" />All
  <input type="checkbox" name="check" value="one" />One
  <input type="checkbox" name="check" value="two" />Two
  <input type="checkbox" name="check" value="three" />Three
  <input type="checkbox" name="check" value="four" />Four
  <input type="checkbox" name="check" value="five" />Five

All One Two Three Four Five

Tuesday, April 10, 2012

[Joomla]Execute Modules with Parameters

In other post Execute Modules Manually, I showed how to load modules but without setting its parameters which is somewhat a downside because what if you want to set some parameters.

Wednesday, April 4, 2012

[Joomla] How to get the new ID when using JTable

If you're using the JFactory::getDBO when inserting a new row in the database, you can easily access the ID of the newly inserted row via insertid() function but in most cases (specially from the backend) we use JTable to insert the rows. The question is: how to get the new id when using the JTable class? Here's how:

First, we instantiate the JTable we're going to use
$mytable = $this->getTable('some_table');

Next, we'll get the new ID
$db = $mytable->getDBO();
$newID = $db->insertId();

[JavaScript] Determine Screen Resolution

Every wonder how to detect your computer's screen resolution? Using javascript, you can. Here's how:
  document.write('Screen Resolution: ' + 
    screen.width + " x " + screen.height);

Here's the sample result:

Monday, April 2, 2012

[PHP][Javascript] Detect if Cookies are Enabled or Disabled

When we create a website, there are some applications that needed for the cookies to be enabled. If the cookies are disabled then the user's must be inform that their cookies must be enabled. And to inform the users, we need to detect if the cookies are enabled or not.

[Joomla] Change Browser Header Text

Ever wonder how to change the browser header text? Most of the time, the header text displays the name or title of the menu item or the component so you only have a limited power to change the text.

You're wrong!

You can change manually the browser header text through this codes:
$document =& JFactory::getDocument();
$document->setTitle('My Header Text Title');

Although you can do it using the traditional way:
  <title>My Header Text Title</title>

But pfft that's an old style.

Sunday, March 25, 2012

Why I Won't Go For The Best?

I was having a break from studying python when I came across this article from Yahoo! News. This article is entitled How To Build a Brilliant Team.

Upon reading the article, I remember my style in choosing my own team back in college. In college, I tend to choose the "average" people than the "best". Why? Simply because people who knows that they are the "best" are arrogant, so full of him/herself, and think that he/she is the right one. But I'm not referring that all of them are like that, it's just sometimes their high level skills goes into their heads.

Now, let me tell you about the "average" ones. When I say "average", I mean they're programming skills are not that good unlike the "best" ones. You see, the university I attended focus more on programming so those who lack programming skills are categorize as the weaker ones. Lucky me that programming is my strength although I don't consider myself as part of the "best" group still I could sometimes compete with them.

"So if the "average" people are not so good then why choose them as part of your team? Surely they're just hold you back."

Good question! I choose them because they're humble and even though programming is not their strength they are "best" in other fields which they don't happened to notice unless given a chance. I have a friend and she's good talking in front of people which happened to be weakness. I got this butterflies in my stomach when every time I in front of other people. I'm like "what if I said the wrong word? What if I'm too boring? Would they listen to me?". So I am always like that unlike her. She talk with confidence, with grace although she admitted to me that she also got nervous but she's just good in hiding it. Impressive! And yes, it's not really obvious. Another "best" thing about her is she's good in designing and writing. She's an artistic kind of person so whenever the work is about designing stuff then I would surely grab her, and she's also good in writing things. I like writing but I'm more of like direct person so when I could answer the question with one sentence, then I would only write one sentence but with her, she could write a paragraph. Another brilliant thing with her is she have a good attitude. She have this aura that makes you feel relax and welcome like you can tell her anything you want and she'll just simply listen and give here opinion (in a nice way) every now and then. A good friend and a good team mate indeed!

For the second question, the answer is no. No, they won't hold me back and never will. Actually, they help me achieve my goals. As I said, they have their own "best" skills so my programming skills, their talking skills, their designing skills, their management skills, and whatever skills will make my team achieve whatever we want. Imagine if all of us have the same skills, let's say programming. Most likely argument would happen because everyone thinks that their way is the best. Of course, in other cases this situation won't happened but the possibility is there.

So next time maybe you need to take a look at the "other" skills of a person for you not to overlook an awesome and talented person.

Wednesday, March 14, 2012

Detect Browser Info

When it comes to detecting browser info in PHP, we stick to the basic by using get_browser() but it doesn't properly display the browser types/names. If you're using Joomla, you'll most likely use the Joomla browser detection library.

[Joomla] Include Helper Class

Helpers, in my own understanding, are some of the Joomla files that are usually use when they can't be classified either as a mode, view, or controller. So when we intend to use them, we need to include them. There are many way on how to include helpers like using include, include_once, require, or require_once but because we are using Joomla it would be cool to use the Joomla way. And just like in including the helper file in PHP, there are also many ways to do it but I will only show one of the many ways because this is what I usually use.

Thursday, March 8, 2012

Get favicon from any site using Google

To get the favicon from a website, follow this code/url format:


Note to not include the http:// or https://

Wednesday, March 7, 2012

localhost only shows white page?

Have you encountered where you localhost was only displaying a white space? No matter how many times you restart your local server (may it be wamp or xampp) still nothing happened?

In my part the problem was the port got conflict with skype. So I logged out the skype, restart my wamp, and logged in my skype again. I check again the localhost in my browser and it now works!

If you're 100% sure that you haven't done anything with your server configurations then it is possible that it is just a port conflict. Don't panic like what I did. hahaha...


Friday, March 2, 2012

[JavaScript] Display Symbols in Alert

Alerts are what we usually use to prompt users about something. And sometimes we need to prompt something like an email address. We all know that email address have the @ symbol. Most likely will just add the @ symbol but once checking your work, the alert box is empty or maybe some codes will show on the page.

The problem here is symbols won't show in alert boxes. The solution? you need to type its unicode value instead of the symbol itself.

So for @ symbol, its unicode value is \u0040.

For example, instead of...
alert('contact us at customer@service.com');

The code must be like this...
alert('contact us at customer\u0040service.com');

Note that not only symbols have unicode values, other characters also have such as letters.

To convert characters to unicode, click here.

Tuesday, February 28, 2012

[MySQL] Reset Auto Increment

Sometimes when we create a program that was paired with a database, we test it like hundred or thousand times before we say that it was working correctly. As a result of this the id, which was always auto incremented will now be starting in like more or less 100 so often we just delete the table and create it again for the id to start again on zero. There is a way to reset the auto increment counter by altering the table itself. Here's the code:

This will start the counter at zero

This will start the counter at 10

Thursday, February 23, 2012

First Person VS Third Person

Writers have their own preferences how to write their stories whether it's on first person or in third person.

First Person is where you use "I". A lot of new writers usually use this method for it's easy for them to pretend that they are the the character they are writing. Based on my experience, yes, it's easy to used this kind of writing style.

The advantage of using this method is you can concentrate only in one character at a time. You can go deeply into details of what the characters feels, sees, or thinking. Remember that writing in this manner, you cannot show the other characters thoughts so if you cannot make a strong points or scenes then you're story would be boring which result to its disadvantage. Sometimes you need to show the thoughts of other characters of the story but since you're using the first person method, you cannot do so.

Third Person writing is using "he/she". This method is kind of complicated for you'll shift from one character to another that can become an advantage or disadvantage to you depending on how you shift between the characters. Just be careful using this method for it may also confuse your readers from the shifting like one moment character A is talking then on the next paragraph the scene was change to character B without giving a hint of character change.

Another method is the Second Person where "you" was used. I haven't use this style but I've seen this mostly on short stories throughout the web.

Overall, I'm confident writing whether in first person and third person but I prefer writing in third person for I can just shift between the characters without much hassle though I can do that in first person but it's kind of complicated.

A Daughter's Love

This is some story I created when I was having a programmer's block. I don't know if it's good or something but this is just a draft of some story in my mind.


There's a mother who loves her husband dearly. When her husband died she lost all her will to live. She lost her job, she leave her two children to starve, she got drunk every day.

One day, she noticed that her daughter always come home late like almost midnight. One night, she waited for her daughter to arrive. At quarter to midnight her daughter arrived. Immediately she slapped her hard. The daughter was taken aback. She started yelling at her daughter and accusing things but her daughter remain silent while crying quietly. Once she had enough, she go to her room and immediately sleep came for she was already drunk.

The next day, her daughter came home again at the same time. And again she slapped her and nag at her but still her daughter remain quiet throughout her outburst.

This went on every night, with an occasional another physical blow from her. One day, someone inform her that her daughter got an accident and was now in the hospital. When she reach the hospital, the doctor inform her that her daughter is already dead.

She cried hard all day. She can't believe that another member of her family was dead when she haven't move on yet on her husband's death. She reminisce the times when she hit and accused her. She knows it was wrong but she needed some outlet of her grief.

Hours after her son arrived at the hospital. She hug him tightly for he is the only family she had. Her eight year old son asked, "where is my big sister?". She can't find the words how to explain the situation to him so she simply answered him, "she already followed his dad."

On the day of her daughter's burial, a man approached her. "you must be pretty sad to lost such a good friend like her" the man told her. She was confused with what the man said so she looked at him and recognize that he was the priest in the church they used to attend before her husband died. Before she could ask what he's talking about he handed him a booklet, "She told me to give that to you". She look at the booklet and found out that it was a bank passbook. She open it and was surprise to see the big amount. "did you know that she go to school during day time and works different jobs at night? I think she have three different jobs. She is a very kind child, working for her family to go on with their life. She told me about her mother and I pity her for not seeing a child of God." he pause for a moment and looked at her. "You must be very proud as her best friend". And with that, he left.

She cried once again. She felt so guilty with all the bad things she did to her daughter. Her son approach her and gave her a bottle of beer. Confused, she asked her son "why are you giving me this?" Her son replied "Because my big sis told me that old people like the taste of beer so they forgot the pain just like when I got a wound on my knee she gave a chocolate then i forgot about how my knee hurt."

She hug her son tightly as if he is the source of her life. She decided to live for her daughter and for her husband.

Tuesday, February 21, 2012

Luke 4:8

Jesus answered, "It is written:
'Worship the Lord your God and serve him only'"

Thursday, February 16, 2012

See you in Dreamland

I'm done reading Song of the Lioness by Tamora Pierce last night so this morning I started reading Dreamland by Sarah Dessen. While reading the prologue, I read the line "see you in dreamland".

Reading the line, I laugh internally. I was actually using that phrase when I say my good nights to people without knowing that it was actually use in a book.

Wednesday, February 15, 2012

A Post-Valentine Qoute For You

To love is to risk rejections,
to live is to risk dying,
to hope is to risk failure.

It's a line from an article my friend shared yesterday. I just read it this morning and found that line then I thought that it's perfect!

The article if beautiful, I must say. You should it read!

Tuesday, February 14, 2012

I Got Chocolates!

Hey! look at what I got on valentines day!

No flowers? Yup no flowers. I'm not fond of them. They would just decay after a couple of days. At least for chocolate, I could eat them. Nyam, nyam!

♥ Happy Valentines! ♥

The first thought that came into my mind when I woke up this valentine's day is "no date, no expense"

I find it funny how I thought of that phrase. Yes, I don't have a date today but this coming Saturday, I do have. I'm still sticking on my "straight home on working day" attitude.

My co-worker's and I are joking around where were we going after work. Some replied they would hang out with friends in some buffet, some said they have a dinner with their love ones but me, I said I would go straight home. hahaha...

Anyway, I don't know what to say. I guess I'll just leave you some bible passage.

"Love is patient, love is kind. It is not jealous, is not pompous, it is not inflated, it is not rude, it does not seek its own interests, it is not quick-tempered, it does not brood over injury, it does not rejoice over wrongdoing but rejoices with the truth. It bears all things, believes all things, hopes all things, endures all things." (1 Corinthians 13:4-8)

Eating Fruits

I decided to open my old email account and found this piece of information. It's a kinda long yet I assure you it's informative.


We all think eating fruits means just buying fruits, cutting it and just popping it into our mouths. It's not easy as you think. It's important to know how and when to eat.

What is the correct way to eating fruits?


If you eat fruit like that, it will play a major role to detoxify your system, supplying you with a great deal of energy for weight loss and other life activities.

Let's say you want to eat two slices of bread and then a slice of fruit. The slice of fruit is ready to go straight through the stomach into the intestines, but it is prevented from doing so...

Sunday, February 12, 2012

Until Death Do Us Part

I was browsing on my facebook wall when I came across this story. It struck me reading it, giving me goosebumps in the process. I cannot find the original author of this story for it was just shared from person to person but if given a chance, I would give the credit on that person.


“When I got home that night as my wife served dinner, I held her hand and said, I’ve got something to tell you. She sat down and ate quietly. Again I observed the hurt in her eyes.

Suddenly I didn’t know how to open my mouth. But I had to let her know what I was thinking. I want a divorce. I raised the topic calmly. She didn’t seem to be annoyed by my words, instead she asked me softly, why?

I avoided her question. This made her angry. She threw away the chopsticks and shouted at me, you are not a man! That night, we didn’t talk to each other. She was weeping. I knew she wanted to find out what had happened to our marriage. But I could hardly give her a satisfactory answer; she had lost my heart to Jane. I didn’t love her anymore. I just pitied her!

A (Stupid) Lesson I've Learned as a Programmer

Always double check if you're editing the right file

Have you ever been in a situation where you know you're doing the right thing yet the result is still wrong? Yes, I've been in that situation a lot of times, actually.

It may sound stupid to be editing the wrong file but believe me once in a while you'll found yourself in the same scenario. Editing in three different sites with the same file, who wouldn't be confused with that?

In the end, you'll just laugh at yourself just like I do every time. =P

God's Measurement

God is saying to His people,

I will rejoice with you on your big day,
but I will measure you on your low day.
I will rejoice with you in victory
but I will measure you when you take defeat.
I will rejoice with you in success
but I will measure you when you fail
I will cheer you when you’re up;
but I will measure you when you’re down
I will cheer you when you win
but I will measure you when you lose.
I will praise you when you’re on top
but I will measure you when you’re on bottom.
I will congratulate you when you’re on the top of the mountain

Saturday, February 11, 2012

[Joomla] Hello World Component ver 5

For this version, I'll add the template in our View

First, create the xml file and name it jchelloworld.xml
<?xml version="1.0" encoding="utf-8"?>
<install type="component" version="1.5" method="upgrade">
  <name>JC Hello World</name>
  <creationDate>February 2012</creationDate>
  <author>Joef Clarin</author>
  <description>JC Hello World</description>

[Joomla] Hello World Component ver 4

For this version, I'll add the template in our View

First, create the xml file and name it jchelloworld.xml
<?xml version="1.0" encoding="utf-8"?>
<install type="component" version="1.5" method="upgrade">
  <name>JC Hello World</name>
  <creationDate>February 2012</creationDate>
  <author>Joef Clarin</author>
  <description>JC Hello World</description>

[Joomla] Hello World Component ver 3

For this version, I'll add the "V" in MVC

First, create the xml file and name it jchelloworld.xml
<?xml version="1.0" encoding="utf-8"?>
<install type="component" version="1.5" method="upgrade">
  <name>JC Hello World</name>
  <creationDate>February 2012</creationDate>
  <author>Joef Clarin</author>
  <description>JC Hello World</description>

[Joomla] Hello World Component ver 2

For this version, we will be using the "C" in MVC.

First, create the xml file and name it jchelloworld.xml
<?xml version="1.0" encoding="utf-8"?>
<install type="component" version="1.5" method="upgrade">
  <name>JC Hello World</name>
  <creationDate>February 2012</creationDate>
  <author>Joef Clarin</author>
  <description>JC Hello World</description>

[Joomla] Hello World Component ver 1

Whenever a developer want to learn a new language or framework, it always starts on creating on what we call "Hello World" application or program. So in this post (and on the next ones), I'll teach you on how to create a "Hello World" in Joomla component. This will also let you have an overview of how the MVC structure works in Joomla.

I won't explain every code in this post because this post will be about the codes. Maybe in other post, I will.

[Joomla 1.5 Extension] JC Daily Message 1.0.0

A simple module that displays a daily message set on module's parameter
You can use the module as a reminder, daily bible verses, or some other stuff.

Download module.

[Joomla 1.5 Extension] JC Random Facts 1.0.0

I created a simple Joomla component and module. If you're new to Joomla, then you'd find the said extensions easy to read and study the codes.

JCRandomFacts component let's you add, edit and remove a fact.

JCRandomFacts module displays one fact save from the component.

Download component and module.

Tuesday, February 7, 2012

[PHP] Referred by Who?

Want to know where you viewers came from? Or which site referred you? PHP have a code for that!

$refer = $_SERVER['HTTP_REFERER'];
echo "You were referred by " . $refer;

Sample Output:
You were referred by http://entertainmentgames09.blogspot.com

Joshua 24:15 (NIV)

Choose for yourselves this day
whom you will serve

Monday, February 6, 2012

True, True!

How to Block Sites in Windows?

There are many ways to block a site. The most common is through the browser but what if I use another browser? It still have a glitch eh? Another is through antivirus. I'm not really familiar with this but yes you can block sites using it. What if I disabled the antivirus? In this post, I will show you how to block sites by digging into Windows files. This is not the most effective way but people usually don't bother looking at files that has to do during Windows OS installation. So here's how to do it:

Sunday, February 5, 2012

Late Night Dinner

10:43 pm. Yup, the current time right now and I'm just about to eat my dinner. As far as I can remember, this would be my first time eating this late. What can I say, I lost track of time. But don't tell my mom! She'll scold me for not eating at the right time. =P

PS. The photo is a crap, I know. To me, it looks like worms. Ew, Disgusting! What am I even thinking?! I'm eating it like right now! That's spaghetti if you can't figure out what it is. hahaha...

Guitar Neck Focus

This is my guitar. I know what you're thinking --- Wow, you know how to play the guitar! Yeah, right (note the sarcasm). Actually, I'm still learning how to play it and it's frustrating! Anyway, this is not about my guitar skills but about the picture. I know it's poorly captured because I only use my cellphone for this one but I like the angle and how it was focus on the guitar neck.

Proverbs 16:3

Commit to the Lord whatever you do,
and your plans will succeed

Friday, February 3, 2012

Father's Love Letter

Father's Love Letter
An Intimate Message From God To You.

My Child,

You may not know me,
but I know everything about you.
Psalm 139:1

I know when you sit down and when you rise up.
Psalm 139:2

I am familiar with all your ways.
Psalm 139:3

Even the very hairs on your head are numbered.
Matthew 10:29-31

For you were made in my image.
Genesis 1:27

In me you live and move and have your being.
Acts 17:28

For you are my offspring.
Acts 17:28

I knew you even before you were conceived.
Jeremiah 1:4-5

Wednesday, February 1, 2012

MySQL Tricks

I was rummaging on my college stuff last night when I came across to some of my database subject notes.

Displays all the data that ends with letter 'a'
SELECT * FROM table1 WHERE column1 LIKE '%a';

Displays all the data with letter 'a'
SELECT * FROM table1 WHERE column1 LIKE '%a%';

Displays all the data that starts with letter 'a'
SELECT * FROM table1 WHERE column1 LIKE 'a%';

Displays all the data but limits the displayed data to only 4 characters
note: no spaces between the underscores. I just emphasize that there are four underscores
SELECT * FROM table1 WHERE column1 LIKE '_ _ _ _';

Displays all the data that starts with 'an', 'be' and 'cy'
SELECT * FROM table1 WHERE column1 IN ("an", "be", "cy");

Displays all the data but sorted by its 'name'
SELECT * FROM table1 ORDER BY name;

Displays only the first 20 data
SELECT * FROM table1 LIMIT 20;

Displays the number of data that have 'asdf' entry
SELECT COUNT(*) FROM table1 WHERE column1 = 'asdf';

Determines what data have the highest entry
SELECT MAX(column1) FROM table1;

Tuesday, January 31, 2012

[Joomla] Be a Super Administrator!

Sometimes we are curious of what goes at the back. And being "only" a registered user can't seem to get rid of that curiosity. So here's a way on how to change your ACL status.

Assuming you have database access. If you don't have any I'm afraid you can't proceed to the next steps.

First, let's create a test user.

Save your new user and make sure you remember the important details (refer to image above)

Now, let's go to the database. Open jos_users and look for the test user that you just created.

Change the gid into 25 and usertype into Super Administrator.

[Joomla] Execute Modules Manually

Modules are easy to execute given that it can be place anywhere as long you assign it to a specific position but what if you want to display a module within a component?

Here's the code on how to load a single module:
$module = JModuleHelper::getModule('mod_module','modtitle'); 
echo JModuleHelper::renderModule($module);

The downside with this is it won't apply its parameters. I think there's a way on how to do this but I haven't figure it out yet.

A Thought to Ponder

The best way to appreciate your job
is to imagine yourself without one

Saturday, January 28, 2012

A Thought to Ponder

The greatest weapon to deceive others is to smile


Are those GIFs above familiar? Yes, they are what we call preloaders. They let the users know that a certain page or data was still loading or processing at the moment. Even a simple phrase, "Please wait a moment, processing data..." is called a preloader.

Usually, preloaders are used in registration validation, installers, searching and many more. The most common site I know who uses this is facebook. Look at the fourth GIF above, how many times have you seen that in facebook, huh?

But what's its used? Are they just some decorations on the site?

Yes, they are somewhat a decoration or something but a useful decoration. Imagine when a site is still processing a data and all it this is a white screen, you'll most likely think that the site has stop responding because all you can see is just plain white. So you'll end up refreshing the page. But using a preloader, you know that a certain site was still loading a data.


Friday, January 27, 2012

[PHP] Get Whole URL in Address Bar

Sample URL: http://www.google.com/pacman/

We will use two PHP functions:


Code 1:


Code 2:

To get the whole URL:
echo 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];

Wednesday, January 25, 2012

[Joomla] Copy Backend Pagination Style to Frontend

Using Pagination in frontend have a different look compared from the backend



If you compare the two, of course the backend pagination style is much better. So I will discuss on how to override the frontend pagination so that it will be the same with the backend.

First, look for /administrator/templates/khepri/html/pagination.php and copy the contents of pagination_list_footer($list) and pagination_list_render($list) functions.

Second, look for /templates//html/pagination.php and remove the contents of pagination_list_footer($list) and pagination_list_render($list) functions then paste those codes you copied from the first step.

Third, copy the /administrator/templates/khepri/css /general.css file to your /templates//css/. Of course you could manually copy the css scripts you only needed for the pagination but you may miss to copy some to it’s better to just copy the whole css file.

Fourth, go to /administrator/templates/khepri/images/ and copy all images that its filename starts with j_button2. Then paste them to /templates//images/

There you have it! Backend pagination style now on your frontend. enjoy learning. =D

[jQuery] Change Element Class Name

  <span class=”old_class”>hello there!</span>

Change the class using jQuery:
$('div span').removeClass('old_class').addClass('new_class');

  <span class="new_class">hello there!</span>

Colossians 3:17

And whatever you do, whether in word or deed, do it all in the name of the Lord Jesus, giving thanks to God the Father through him.

Tuesday, January 24, 2012

A Though to Ponder

Only music can let us sing
Only music can make our feet dance
And only music can let our mind reminiscing back to our past
but what’s important about music is
they can be the voice of what we feel inside
especially when we are mute by the words of our hearts


I always hate tracing an error. How, where, when did the error occur? Arrg, I hate that. I'd rather start from scratch than trace an error.

Anyways, enough of my rambling. I encountered this error while creating a component:


Possible problem with this type of error is incorrect link to view or misspelled view name. Or the worst, you forgot to create the view (hahaha...)

[Joomla] Error: View cannot be found

You created a component, everything was perfect. It runs in your local drive the way you expect it to be, but once you installed it on live server, it says "View Cannot Be Found"

What's wrong, it's running just in fine in my local? Did I misspelled a file or a folder? Did I forgot to assign the view? The model?

If your answers to those questions are NO and you know it yourself that nothing's wrong, then maybe you got the problem in how you capitalized the letters in your file names or folders names.

In Windows, "myComponent" is equal with "mycomponent" while in Linux, "myComponent" is "myComponent" not "mycomponent".

Got it?

So it's better to not use PascalCasing or camelCasing in your file names and folder names just to be safe.

It's just one small mistake but believe me, I've been figuring out the error for hours without knowing that I just need to convert to small letters my component's folder names.

PascalCasing and camelCasing

PascalCasing is where the first letter of each word is in upper case. It's the same with ucwords in php. This is usually used in naming a class.

camelCasing is where the first letter of the first word is in lowercase while the first letter of the subsequent words are in uppercase. It's the same with ucwords in php except that the first letter is in lowercase. This is usually used in naming a function or variables.

Monday, January 23, 2012

A Though to Ponder

Life may not always be easy
but it will always be beautiful
if you allow it to be

Luke 1:37

For with God nothing is impossible

[Joomla] Load Module within an Article

{loadposition module}

loadposition indicates that a module is about to be loaded

module is the position of the module that will be loaded

But what if you only want to load a specific module in a particular position? There two ways to do this. The first is a trick with the position name while the other is using a third party plugin.

1. Trick with the position name

Though the Position value is a drop down, it is editable so you can freely change it in any word you want. So using the position in the image above, the syntax now would be:
{loadposition loadarticle}

2. Third party plugin
You can download the plugin here

The syntax is like this:
{module [63]}

For versions 2 and up, module chromes like none, xhtml, rounded can be define:
{module [63|rounded]}

A Thought to Ponder

Everything is possible
if only one will see
through the eyes of a child

Sunday, January 22, 2012

Nested Parentheses

Problem: Write a program to determine if a string consists of properly nested parentheses



Saturday, January 21, 2012

[MySQL] Inner Join, Left Join, Right Join

Often, common joins such as Inner Join, Left Join and Right Join confused people so I will have little demonstration to compare the difference between the three.

Sample Tables:
| id   | name    | location |
|    1 | erin    |        1 |
|    2 | roran   |        2 |
|    3 | vincent |        1 |
|    4 | travis  |        0 |

| id   | place      |
|    1 | california |
|    2 | new york   |
|    3 | tenessee   |
|    4 | hawaii     |
|    5 | italy      |

Inner Join:
INNER JOIN displays only the fields from User table who have pairs on Location table
SELECT User.id, User.name, Location.place
INNER JOIN Location on User.location=Location.id;
| id   | name    | place      |
|    1 | erin    | california |
|    2 | roran   | new york   |
|    3 | vincent | california |

Left Join:
LEFT JOIN displays the all fields from User table then display place field its paired of
SELECT User.id, User.name, Location.place
LEFT JOIN Location on User.location=Location.id;
| id   | name    | place      |
|    1 | erin    | california |
|    2 | roran   | new york   |
|    3 | vincent | california |
|    4 | travis  | NULL       |

Right Join:
RIGHT JOIN displays the all fields from Location table then display id and name fields its paired of
SELECT User.id, User.name, Location.place
RIGHT JOIN Location on User.location=Location.id;
| id   | name    | place      |
| NULL | NULL    | tenessee   |
| NULL | NULL    | hawaii     |
| NULL | NULL    | italy      |
|    1 | erin    | california |
|    2 | roran   | new york   |
|    3 | vincent | california |

Note: In the example above, User table was referred as the left table while Location table was referred to as Right table

[Joomla] Load CSS and Javascript

Load CSS:
$document =& JFactory::getDocument();

Load Javascript:
$document =& JFactory::getDocument();

jQuery noConflict():
$document =& JFactory::getDocument();

Note: In loading a script, the path should be a url, not a directory.

Modulus 11

Problem: create a program which will ask for an input number and determine whether it is a multiple of 11. Range: 1-100 digits (not one to one hundred, but 100 digits)

CLUE: use string for the input for even the long long int cannot hold a 100-digit number



[Joomla] Content or Modules not showing

If you are creating your own Joomla template instead of downloading one online, you might have encountered this codes:
<jdoc:include type="component">
<jdoc:include type="modules" name="sidebar">

Looking at those codes, it seems that nothing’s wrong with them but once you run your Joomla site, the content and modules under sidebar position are not showing.

The problem? You forgot to add the slash( / ) at the end. So the correct code must be like this:
<jdoc:include type="component" />
<jdoc:include type="modules" name="sidebar" />

To know more about Jdoc statement click here

Count Without Loops

Problem: write a program to display number from 1-10 without using any looping statements (for, while, do) and only using one parameter.



Friday, January 20, 2012

A Though to Ponder

The mind of a writer is not as organized
as his work appears to be

Thursday, January 19, 2012

Even Small Things Can Make a Day Worthwhile

I was getting ready for my day and by 5:45 am, I’m already out of the house walking down the familiar path for me to get my ride. As I was walking, I see the things and scenarios that usually occur at that time of the day. Trisikad drivers trying to get my attention asking me if I want to get a ride, taxi drivers having their early breakfast or simply sleeping inside their cabs, and I even cross paths again with the old man wearing his usual attire, an old style hat, white button down shirt and white shorts, having his usual morning jog. In other words "just another normal day".

Just when I was about to turned around the corner, I met an unfamiliar face. He also was an old man, I think he’s already around sixties, also having his morning jog. It’s nothing unusual, at first, but he suddenly waved at me, smiled and said "Gandang umaga! God bless you!" For a split second, I was simply taken aback and before I knew it, I was smiling. I remember back in my college days, there’s this priest who smiled and greets everyone he met.
Related Posts Plugin for WordPress, Blogger...