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.

=D

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

Install
sudo apt-get install virtualenv
OR
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
deactivate

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:
Related Posts Plugin for WordPress, Blogger...