Skip to content

Categories:

MySQL Ant Task

I recently wanted to be able to automate a mysqldump statement from Eclipse using Apache Ant. I’m guessing this code could be cleaned up some to better handle the command line arguments, so if somebody can let me know how it can be cleaned up I’m all ears. However, this worked so I went with it.

Also, I created a ZIP archive of the resulting dump statement.

<property name="local_database_host" value="localhost" />
<property name="local_database_username" value="root"/>
<property name="local_database_password" value="password" />
<property name="local_database_name" value="bzftp_beta"/>
<property name="backup_directory" value="C:/Databases/" />
<property name="backup_file" value="bzftp_beta" />
 
<target name="createDBArchive" description="-->> Create database dump archive file">
	<exec dir="" executable="C:/xampp/mysql/bin/mysqldump.exe">
		<arg line='-u "${local_database_username}" -r "${backup_directory}${backup_file}.sql" ${local_database_name} jos_categories jos_sections jos_content jos_content_frontpage jos_content_rating jos_components jos_menu jos_modules jos_templates_menu'  />
	</exec>
 
	<zip destfile="${backup_directory}${backup_file}.sql.zip" update="true">
		<fileset dir="${backup_directory}">
			<include name="${backup_file}.sql"/>
		</fileset>
	</zip>
</target>

Posted in General.

Tagged with , , .


Joomla Loading Plug-Ins in Custom Components

I was having some trouble determining how to access and use a plugin in a custom component in Joomla.

I finally figured it out and the rather simple code snippet is below…

 
//Gives access to all plugins in the content folder
JPluginHelper::importPlugin('content');
// This variable is passed by reference so we need it later
$campinfo = "";
//I created my own trigger below, but "onContentPrepare" would work fine here
$dispatcher->trigger('onCampPrepare', array ($id, &$campinfo));
//assign are variable to be acessed in the template
$this->assignRef('campinfo', $campinfo);

Posted in General.

Tagged with , .


Joomla Component Global Models

One thing that I often find necessary when creating a custom component in Joomla is the need to have a “Global” model that I can use in some or all of my views. It took me awhile to find documentation on this and what I did find was outdated documentation, so I think it is worth providing some here…

I will use some simple code examples so you can get an idea of how it works.

Prerequisite knowledge

1. Create your global model

Create a file called “global.php” and place it in the “models” folder of you component.

Insert the following code…[global.php]

<?php
defined('_JEXEC') or die ('Resctricted access');
jimport('joomla.application.component.model');
JModel::addIncludePath(JPATH_COMPONENT.DS.'models');
class CustomComponentModelGlobal extends JModel
{
	var $data = null;
	function getData()
	{
		if(empty($this->data))
		{
			$this->data = "My Global Data";		
		}
		return $this->data;
	}
}

2. Modify Controller Code

We will modify the code of the display method in the controller to make our global model available in all of the views.

controller.php

function display()
{
	$view = JRequest::getVar('view');
	if(!$view){
		JRequest::setVar('view', 'default');
	}
 
	$model = $this->getModel('Global');
 
	$document =& JFactory::getDocument();
	$viewType	= $document->getType();
	$viewName	= $view;
	$view = & $this->getView( 
                             $viewName,
                             $viewType, 
                             '',
                             array( 'base_path'=>$this->_basePath));
	$view->setModel($model);
 
	parent::display();
}

3. Access the Global model in the view

view.html.php

function display($tpl=null)
{
	/*
	 * The model can now be accessed in the view
	 * in either way below
	 */
 
	$data =& $this->get('data', 'Global');
        $globalModel = $this->getModel('Global');
        $data =& $globalModel->getData();
 
        //assign the data to a ref for output in the html
        $this->assignRef('myGobalData', $data);
}

Posted in General.

Tagged with , , .


Hide Page Title in WordPress

On my site I am using the Carrington Theme by Crowd Favorite (I’m also using the Carrington Mobile Theme). It’s a great theme!

One problem I had was that on the homepage of my site I wanted to hide the title, so that it would not say “Home” in big black letters. The PHP file that needed to be edited in order to make this happen could not be accessed in the regular Appearance->Editor area. This is because the post on my homepage is a “Page” and not a regular “Post”. So the following is how to edit the default Page template for the Carrington Theme.

  1. Using an FTP client grab wp-content/themes/carrington-blog/content/page.php from your site’s directory.
    Note if you are using the default WordPress theme this equivalent file can be found under wp-content/themes/default/page.php.
  2. Make necessary edits to file and then upload it back to your site.

On my site I wanted to hide the title (<h1>) tag on my homepage. The homepage had an ID of 2 so I used the following PHP code to achieve my desired result.

Note: to find the id of a post or page in the WordPress admin look at the URL string in your browser when editing a post or a page. It will have somewhere in there the word post=<a #> “a #” is the id of that post or page.

<?php if(get_the_ID() != 2){ ?>
         <h1 class="entry-title full-title"><?php the_title() ?></h1>
<?php } ?>

If you didn’t want page titles to ever appear you could just delete everything between the <h1> tags.

Posted in General.

Tagged with , , .


traderdomains.com is a scam

I received an email this morning saying that [InsertDomainHere].com was available. I had been interested in acquiring this domain for sometime. I was not sure how traderdomains.com knew this, but somehow they did. They wanted $49.99 to secure the domain. I quickly did a search to see if traderdomains.com was actually real domain broker and came up with this post. Traderdomains.com is a total scam.

It turns out that the domain name I was interested in was indeed available, and owned by nobody. I was thus able to scoop it up for a normal domain registration fee of $10.00 or less. So be warned traderdomains.com, traderdomains.org, traderdomains.net, etc. is a complete scam.

Posted in General.

Tagged with , .


Microsoft Outlook 2010

I have been playing around recently with the Technical Preview of Microsoft Office and most specifically Outlook 2010. So far I have been quite happy with it.

The main thing that is different design wise is that it has the ribbon like other 2007 Office programs. They must have done some significant work to make it snappier because it definitely is. I’m guessing using the 64bit version helps as well.

Here are some of the great features that it has.

  1. It is 64 bit.
  2. Does not crash as much as my 2007.
  3. Organizes emails into conversations. This is similar to gmail. (at first I was annoyed but now I like it)

The quickness of it vs. 2007 and that it has a 64 bit version is a huge improvement, but beyond that it doesn’t seem to me there are too many other reasons people will want to upgrade. For me these two are enough, but others may think about holding off.

Posted in General.

Tagged with , , .


MooTools target in IE

When using MooTools 1.11 the event object target property can not be read by IE. The way to correct this is to use the following…

        var target = $(e.target || e.srcElement);

Here it is with surrounding code…

 
$('elementId').addEvent('click', function(e) {
	var target = $(e.target || e.srcElement);
	if(target.checked){
		//do something here
	} else {
		//do something here
	}
});

Posted in General.

Tagged with , .


Sharing Calendars

I have been curious for awhile about how my wife and I could share our personal calendars easily. Adding to the dilemma was the fact that I use a Microsoft Exchange Server for my scheduling and my wife uses Google Calendar.

I suspected that there was likely an easy way for us to share our calendars but I just has not taken the time to look into it.

How it is done…

In Outlook:

  1. In Outlook with your calendar selected select “Publish Online” from the ribbon bar (I’m using Outlook 2010)
  2. You will want to select Publish to Office Online
  3. I made my calendar publicly availible to anyone just to avoid any annoying permission issues.
  4. You can then select to share your calendar with others.
  5. You will be given a link that you can use in Google Calendar that will read in your calendar

Back in Google:

  1. In Google Calendar under “Other Calendars” click settings
  2. Then click “Import Calendars”
  3. Then select the Add URL tab.
  4. Copy & Paste the link you were given in Outlook into the Google Calendar area.
  5. Now your Outlook Calendar is shared to Google Calendar.

Posted in General.

Tagged with , .


New BlackBerry Tour 9630

Just over a week ago I purchased a new cell phone. I also had to switch providers, but that is another story.

Here it is…

Blackberry Tour 9630

Until last week I had never had a “Smart Phone” so this is new experience for me.

Things I like…

  • Synchronizes with Microsoft Exchange (a big reason I purchased this in the first place)
  • Ability to tether with my laptop
  • Google Maps App
  • Will play MP4 videos
  • Wall Street Journal Reader App

Things I was slightly bummed by…

  • This particular Black Berry does not have WiFi capability.
  • The default Media Player App will not broadcast audio to a Bluetooth headset. I had hoped to listen to music on my headset while I biked back and forth from work.
  • The IHeartRadio app is not yet available for the Tour

All in all I’m quite happy with it, it exceeded most expectations but fell short in a couple others.


Posted in General.

Tagged with , .


Site Updated! Finally

After several months of doing almost nothing with my website I actually have one.

It seems a developers or designers own website is the item at the bottom of the stack. But this is not the case for Acts Media anymore.

Posted in General.

Tagged with .