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
django.VERSION
note that VERSION are all in capital letters

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


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

Result:
'1.4'

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
  }
</script>
<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
</form>

Result:
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');
...
$myTable->store();

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:
<script>
  document.write('Screen Resolution: ' + 
    screen.width + " x " + screen.height);
</script>

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:
<head>
  <title>My Header Text Title</title>
</head>

But pfft that's an old style.
Related Posts Plugin for WordPress, Blogger...