20100204

PHP Oracle [notice] child pid NNNN exit signal Bus error (10)

After some frustration I learned from a forum post that the default password time limit for Oracle 11g is 120 days. Once you get close to that you will go into a grace period, where PHP's oci connection dies on you with no explanation. You will notice a message like this in you apache log:
  • [notice] child pid NNNN exit signal Bus error (10) in the apache log.
Step 1: Change your password, or rather lets just keep it as it is...
  • ALTER USER myname IDENTIFIED BY mypassword
Step 2: Make us not have to do this again:
  • ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;
Hope this helps someone.

20090707

Eliminating Mysterious Oracle Indexes

Oracle by default will create cryptic names for indexes unless you specify your own. To get a list of all the indexes currently in use for your schema you can execute:
> select * from user_indexes;
Anything that starts with SYS_ and ends with a $ is an autogenerated index name. It is good to have a common format for your indexes so that any errors are meaningful. address_id_pk is much more readable than SYS_IL0000088969C00006$$. Over here we use the [table]_[column]_[type] format so we can know at a glance where to hunt for the problem.

While doing this I noticed that LOB and CLOB field types automatically generate a SYS_blahblahblah$$ index, polluting your clean design. If that rubs you the wrong way, you can specify the index name for them as well, but the code is a bit messier.

20090605

Zend_Paginator with Search Params

I have noticed a couple posts out there asking how to incorporate a search with the Zend_Paginator component so that the search params follow along. Here is one way to do it, assuming we are searching for a person in our database.

1. Set up the action to capture the parameters

2. Set up our router to accept the params

3. Modify the example paginator view partial

4. Pass the search params to the paginatorControl view helper


1. Set up the action to capture the parameters


Throughout this example I assume that the search form is labeled 'search'.
public function listAction()
{
$form = new My_Form_Search();

//figure out what page they want to be on with a default of 1
$page = (int)$this->_getParam('page', 1);
$recordsPerPage=15;

//set up our default search
$model = new Default_Model_Person();
$select = $model->select();

//capture the input params
if ($this->_request->getParam('search',0) || $this->_request->isPost()){

//if it is a post, populate the form and reset the page to 1
if ($this->_request->isPost()){
$form->populate($this->_request->getPost());
$page = 1;
}
else{ //'search' showed up via the GET param
$form->populate($this->_request->getParams());
}
//make sure the submitted data is valid and modify select statement
if ($form->valid()){
$search = $form->getValue('search');
$select->where('name like ?',$search.'%');
}
}

//set up the paginator with our select query
$paginator = new Zend_Paginator(new Zend_Paginator_Adapter_DbTableSelect($select));

$paginator->setCurrentPageNumber($page);
$paginator->setItemCountPerPage($recordsPerPage);

//set our view parameters. the third one (searchParams) is
// the key difference from a lot of the other examples out there
$this->view->paginator = $paginator;
$this->view->form = $form;
$this->view->searchParams = array('search'=>$form->getValue('search'));
}

2. Set up our router to accept the params


<config>
<people_path>
<route>people/:page/:search</route>
<defaults>
<module>people</module>
<controller>index</controller>
<action>list</action>
<page>1</page>
<search/><!-- by default the search param is empty -->
</defaults>
<reqs>
<page>\d+</page>
</reqs>
</people_path>
</config>

3. Modify the example paginator view partial


You need to add the search param to the url router on the view partial. Find the relevant lines and toss in the search param to the param array:

<a href="<?php echo  $this->url(array('page' => $this->previous, 'search'=> $this->search)); ?>">
<a href="<?php echo $this->url(array('page' => $page, 'search'=> $this->search)); ?>">
<a href="<?php echo $this->url(array('page' => $this->next, 'search'=> $this->search)); ?>">

4. Pass the search params to the paginatorControl view helper


A little known fact is that you can pass in a fourth parameter to the paginatorControl view helper. We want to give it our search params that we defined above:
echo $this->paginationControl($this->paginator,'Elastic','pagination_control.phtml',$this->searchParams);

And you should be good to go!

20090113

NetBeans IDE 6.5 - MSSQL Server Connection

Sure, I don't use this blog anymore but in the hopes that this will shorten the need for others to figure out how to do it...
  1. Get and install the Microsoft SQL Server JDBC driver OR the opensource jtds driver (libjtds-java in Synaptic Package Manager)
  2. Start up NetBeans
  3. Menu -> Window -> Services (or CTRL-5)
  4. Expand "Databases"
  5. Right-click on Drivers and select "New Driver"
  6. Click "Add..." in the "New JDBC Driver" window, navigate to the driver (/usr/share/java/jtds.jar), and click "Open"
  7. Right-click on either the new "Microsoft SQL Server 2005" or "jTDS" driver option, select "Connect using..."
  8. Fill in your database information (port 1433 is often not necessary to enter) and click OK
  9. Here is the tricky part. It asks you for a Schema. Select "dbo"
Why the "SCHEMA" is "dbo" I do not know, nor do I care particularly. But it works.

20050125

My Blog Has Moved!
You should go to Drakos7.net to see my blog from now on. Becuase I have my own site/domain I can do things like use PSG for blogging instead.
So! Go to Drakos7.net from now on.

End of line

20041213

Go see "The Incredibles". It is worth the price of admission. The themes of family, identity, and heroism are well done.

20041102

As of Reformation Day I am now officially an elder in the Presbyterian Church in America. This is a large responsiblity and a great honor for me to have the congregation New Life Presbyterian here in Ithaca elect me and Christian Anible. Did you know that the Greek word translated to elder is "Presbyter"?