Side Topic on Launching Maestro workflow from a link

By defaut the behavior of launching the maestro workflow would ask users to go to task console and select the workflow and then click on Launch button

looks like below: (The link to access task console is : http://siteurl/maestro/taskconsole)

Usually once you install maestro workflow, it will dynamicall create a task console link on the navigation bar.

For example, if I want to lauch my membership application workflow, I would need to get to the task console link and initiate the workflow over here.

1-1

So then once you refresh the page, the workflow you have selected would appear under the task console table and display a status as active meaning the workflow has started.

1-2

Now the question is : how would we initiate a workflow from a direct link on the navigation bar?

So in this case, look at the picture 1-1, on the navigation menu bar, the link “Apply for the membership” should initiate the membership application workflow for us.

To acheive this goal, I created a customized module “launchmaestrolinks”. The module could be at below:

Note: This module is a put-together work from a few gurus and the intitial idea is learned from the drupal forum.

Download the module from here…

After the module is downloaded, here are a few things you need to do to install it!

  1. Copy the zip file to [site_corecode]/sites/all/modules
  2. Unzip the file to install the module.
  3. Enable the module “Launch Maestro Links” 

          Login to your site with administrator priviledges, and then go to Administration->Modules. You should find a simlar screen as below:

         

           Make sure you click the checkbox to enable the module and then save the configuration.

        4.  Once you have enabled the module, go to navigation bar to create and configure the maestrow workflow links.

             Before you create the navigation link for the maestrow workflow, make sure you know about the template number of the maestrow workflow you are referring to.

             For example you could locate the template id number by going to Administration->Structure->Maestro Workflows. In this case, I am going to create the direct link on the navigation bar for my Membership Application Workflow. The template id number is 1.

           

            Now we go to Administration-> Structure->Menus

            Click on the operation “list links” beside Navigation.

            We could simply add a link by clicking on  at the top of the list links.

            Note: the link path should follow the standard as : mastrolinks/<template_id>. So in my example, it would be 1.

           

               Now you could see the link “Apply for the Membership” would show up at the navigation bar and once you click that link.

               It will automatically kick off the workflow: Membership Applicaiton Workflow.

               End of the instructions and have fun with the new module.

               Merry Christmas to everyone!!

Advertisements

Backup exsiting data and load data dump into Database

Export current data dump as a backup.

   Method 1: Use utility exp

  • Login to the Database Server.
  • Start a windows command prompt, click on Start > Run
  • Type in cmd in the dialog box and click on OK.
  • Change directory to the root C:\ >

Type in the following command:

exp <user_toexport>/<user_toexport_password>

file=<directory>\dumpFileName.dmp log=<directory>\logFileName.log owner=<to_user> buffer=10000

Press [Enter]

The backup dump file will be found in the directory you specified.

For example: the following command is to export sample data from SAMPLE database:

exp sample/sample file=C:\sample.dmp log=C:\sample.log owner=sample buffer=100000

   Method 2: using Data Pump expdp

  • Login to the Database Server.
  • Start a windows command prompt, click on Start > Run
  • Type in cmd in the dialog box and click on OK.
  • Type in the following command to connect to the SAMPLE database

SQLPLUS system/<system password>

Press [Enter]

e.g. SQLPLUS system/<system password>

Execute the following commands to create a database directory. This directory must point to a valid directory on the same server as the database:

SQL> CREATE or REPLACE DIRECTORY <directory_name> AS ‘<directory\folder>\‘;

Directory created.

SQL> GRANT READ, WRITE on directory <directory_name> to <user_toexport>/

e.g.  CREATE or REPLACE DIRECTORY imp_dir as ‘D:\db_dump’;

GRANT READ, WRITE on directory imp_dir to bisbtm;

·         Create a folder under directory

·         Type in the following command:

expdp <user_toexport>/<user_toexport_password>

directory=< directory_name> dumpfile=dumpFileNam.dmp 

e.g. expdp sample/sample directory=imp_dir dumpfile=samp.dmp

Press [Enter]

The backup dump file will be found in the directory you specified.

To be continued….

         

Tweaking within Drupal 7

Warning: fileowner(): stat failed for temporary://upd16E2.tmp in update_manager_local_transfers_allowed() (line 932 of C:\Program Files (x86)\EasyPHP-12.0\www\aapi\modules\update\update.manager.inc).
The error occurs under the page of installing a new module like below:

  
 

Reason: The error displayed is caused by the incorrect tmp directory that is set up in the file system. I intentionally copied my website data from one server to the other server. And the orginal tmp folder directory is not applicable for the same location on the new server.

Solution: Go to Home-> Administration->Media->File System. Change the corresponding field.

Missing Manage Fields Link on Content Type Pages

Go to Modules and search for Field UI, make sure the module is enabled.

Drupal site running slow and out of memory issue

You might run into some errors as below complaining the memory exhaustion.

One cause would be not having enough php memory. You should look at the php.ini and locate the key word “memory_limit

The code snippet below is from my local php.ini. You could see it only has 128M as the memory. I increase it to 1024M. The error goes away and the drupal site is running a lot faster.

Use customized font in drupal 7

I assume that you have already chosen your best theme and you are willing to add a little bit more variety in fonts besides using the default ones that are provided by your current theme.

One method I would recommend is using google web fonts. They have abundant collections of the most popular fonts frequently used by different websites.

How to use it in Drupal Theme?

  1. Go through the choices of fonts from here: http://www.google.com/webfonts#
  2. Find style.css under your theme folder usually at: [site_corecode]/themes/<theme_name>

          If you could not find your theme under this directory, try the other dir at: [site_corecode]/sites/all/themes/<theme_name.

    3.   Modify style.css and add the following code at the beginning of the file.

          For example: @import url(http://fonts.googleapis.com/css?family=Oswald);

         You should find the @import code from Step 1. Pick the font and then click on  at the right bottom corner of that font.

         And then on the quick use page, you could see the step 2:Choose the character sets you want:. Find the option: @import and copy the code.

   4. Now you should be able to use the imported fonts anywhere by referring to the font-family like below:

     font-family: ‘Droid Sans‘, sans-serif;

    The other method is to use customized fonts you have downloaded and refer it at your style.css using @font-face.

     Suppose the font you are looking forward to using is Sansation_Light and you have already downloaded the ttf file : Sansation_Light.ttf

     Put this ttf file under the location : [site_corecode]/sites/default/files/

     And then add the following code at the beginning of the style.css file.


@font-face{
font-family: myFirstFont;
src: url('/<site_name>/sites/default/files/Sansation_Light.ttf');
}

     So then whenever you want to use this font, you could simply replace the font-family to myFirstFont.

Side Topic on Maestro Workflow with Drupal 7

When I was building the demo website for the clients using maestro workflow in drupal 7, I have encouted with the following errors:

   Only variables should be passed by reference in maestro_accept_reject()

 

   By looking at their code of the maestro_common.module snippet at blow, there seems no problem with the code itself. However, the release of PHP 4.4 and 5.0.5, a change has been made to the engine that has resulted in some new errors popping up in existing code. The errors showing above didnot hurt the basic functionality but creating annoying user experience.

   After researching around for fixing the problem while and understanding php developers’ determinative attitude on pushing the new change in, I have figured out a way to reformat the code above to get the php engine happy.

   So now the error goes away by having the code reformatted as below:

   Hope this would help people that has suffered the same problem!

 

Create a readonly LDAP Bind DN with Oracle OID

Although the Oracle Directory Manager is a powerful tool, as the application server administrator you will probably find it easier to use the web based tool oiddas or the OID Self Service Console.  The OID Self Service Console (SSC) is part of the Delegated Administration Services.  This tool is much easier to use when managing a user. 

1. login to Oracle Identity Management Self-Service Console(OIDDAS)

To access SSC,open your browser and point to the infrastructure OHS port, and add the oiddas directory to the URL.

http://your-domain:7777/oiddas/

2. Once you click login, since our environment is a SSO-Enabled environment. It would
transfer you to the SSO login page. Here you have to use the orcladmin binding
account.

3. Click OK, then you would be able to login to oiddas like below:

4. Click Directory tab on this page

5. Click Create to create a new user called readonly. Fill in the basic information
of this user.

6. Once you click submit, you could be able to search out the user under the
directory

7. Click privileges to set the required permissions for this user. For now, we don’t
set anything in order for it to be read only.

8. Test if we could use the account to bind to our current LDAP Server.

Possible Issues and solutions:

This issue is because DSA service is not started. Check the status of the current settings.See the pic below:

But in fact, when you use ./opmnctl startall
The components: DSA, LogLoader,dcm-daemon WON’T be automatically started. You have to start them one by one by using the following command:

opmnctl startproc ias-component=dcm-daemon
opmnctl startproc ias-component=dsa
opmnctl startproc ias-component=LogLoader

Improve Database performance by analyzing tables

A little bit background why we need to analyze tables, indexes, clusters:

         Sometimes we have changes for the tables, for example if we have regular ETL process that constantly modifies the database structure or table contents. The statistics that Oracle collects from the last table analyzation might be out of sync with the current data dictionary. And this information is often used by the optimizer when querying. Therefore querys base against the old statistics would run slow and the database performance could be decreased because of the changed statistic not being collected accordingly.

       What statistics does Oracle collect by the analyzation?

         Oracle will collect statistic on the number of rows, the number of empty data blocks, the number of blocks below the high water mark, the average data block free space, the average row length, and the number of chained rows in a table when the Oracle ANALYZE TABLE command is performed.Oracle ANALYZE TABLE can be used to collect statistics on a specific table.

          When using Oracle ANALYZE TABLE all domain indexes marked LOADING or FAILED will be skipped.

          Oracle will also calculate PCT_ACESS_DIRECT statistics for index-organized tables when using Oracle ANALYZE TABLE

         Note:Before analyzing a table with the Oracle ANALYZE TABLE command you must create function based indexes on the table.

        Two options for analyzing tables: Computes Statistics VS Estimate Statistics

Computes Statistics Estimate Statistics
Method Full Table Scan Sampling
Accuracy High Depends on the sample
Cost High Low

        Computer Statistics Analyzation uses the full table scan again the entire Oracle table. Upon completion of the command, the data dictionary would be updated with the highly accurate statistics by the cost-based optimizer.However, Estimate Statistics Analyzaiton would take samples from the table and the samples are stored in the data dictionary.

       Note: You need to weight the time and database resource against the accuracy of the statistics before considering which method should take at your current point of view. For small to medium tables, use analyze table table_name compute statistics. For larger tables take a sample (for example, analyze table table_name estimate statistics sample 20 percent).

         Utilize TOAD for table analyzations

          Login Toad with your database connection. Select the table you want to analyze and right click on Analyze Table.

  

    Once you get to the analyzation page, select the tables you want to do analyzation on and click on the green arrow to start analyzing the table.By default the method would be estimate statistics as shown in the picture below.

The success information is displayed after the analyzation.

You could also change the mode to be compute statistics by switching to the Options tab and modify the Analyze Functions as shown below:

              Utilize SQLPLUS for table analyzations

             Login to SQLPLUS with your database connection as below:

            A better solution : Utilize DBMS_STATS to collect statistics

Here is a code snippet for how we are gonna invoke the dbms_stats package in 10g.Just note that Oracle Analyze table commands are now considered to be old fashioned. And the dbms_stats package are used more and more frequently in packages because it provides high quality infomation about tables and indexes.

BEGIN

FMIS_SYNCH.SYNCH_REF_TABLES_WITH_FMIS;

DBMS_STATS.GATHER_SCHEMA_STATS

(

ownname=>'yourowner',

options => 'GATHER AUTO',

estimate_percent => DBMS_STATS.auto_sample_size,

method_opt=>'for all columns size repeat',

cascade => true,

degree=>12

);


END;

For a more detailed information on the features that Oracle 11g Database has offered. Please take a look at the guru’s blog as below:

http://www.dba-oracle.com/art_builder_dbms_stats.htm

Dropping Tables(Options and Recovery)

This blog is mainly for analyzing dropping table commands for Oracle SQL. You might have seen the dropping table commands like below:

   1.drop table table_name;   
   2.drop table table_name cascade constraints;
   3.drop table table_name purge;
   

and wonder what would Oracle Database do behind the scenes for dropping table commands?

Basically, if there are no keywords specified as the first command shows, Oracle Database would perform the following operations:

  • All rows from the table are dropped.

  • All table indexes and domain indexes are dropped, as well as any triggers defined on the table, regardless of who created them or whose schema contains them. If table is partitioned, then any corresponding local index partitions are also dropped.

  • All the storage tables of nested tables and LOBs of table are dropped.

  • When you drop a range-, hash-, or list-partitioned table, then the database drops all the table partitions. If you drop a composite-partitioned table, then all the partitions and subpartitions are also dropped.

The first question is Why am I getting the error: ORA-02449: unique/primary keys in table referenced by foreign keys

Answer: The Oracle error is caused by the attempt to drop a table with unique or primary keys referenced by foreign keys in another table, or in other word, the table that is referenced as a parent table by a foreign key constraint in a parent-child relationship that established between two tables through a foreign key. Oracle does not allow to drop tables referenced by foreign keys of other tables without specifying the CASCADE CONSTRAINTS option in the DROP TABLE statement, or to drop the parent table without first removing the foreign key.

The solution and workaround for the error when you want to drop tables referenced by child tables, is to use the CASCADE CONSTRAINTS option in the DROP TABLE statement.

That is why we use: 2. drop table table_name cascade constraints;

Now the question is What if I accidentally delete the table and want to recover it back?

Here comes the keyword PURGE that differentiates a normal dropping command and a purged one. See the table below for comparisons between the two statements.

DROP TABLE WITHOUT PURGE DROP TABLE WITH PURGE
Release the space No Yes
Rollbackable Yes No

Unless you specify the PURGE clause, the DROP TABLE statement does not result in space being released back to the tablespace for use by other objects, and the space continues to count toward the user’s space quota. Additionally, the first command only results in the to-be-dropped table and its dependent objects being placed into the recycle bin. Specify PURGE if you want to drop the table and release the space associated with it in a single step.

Note: You cannot roll back a DROP TABLE statement with the PURGE keyword clause, nor you can recover the table if you have dropped it with PURGE clause. So be cautious and intentionally.

So how could we recover the tables in the recycle bin?

One feature of Oracle 10g is recyclebin, which allows you to recover dropped tables.With recyclebin, any tables you drop do not actually get deleted. Instead, Oracle renames the table and its associated objects to a system-generated name that begins with BIN$.

Look at the following example to get a better understanding:

Let us first create a testing table called studentinfo that contains one row as below.

Now we want to drop this table and look into recycle bin to find it.

You could see the object name is changed because of the dropping action.

You could still query it as you would do before with this new object name. Because the table data is still there and if you want to undo the drop action, you could use the FLASHBACK command like below:

The next time when we drop the same table, oracle database would associate a new object name for the table. So you would understand that after a table is dropped, it is just renamed. It is still part of your tablespace, and this space counts against your user tablespace quota.This space would not release until you purge the table out of the recycbin.

So now goes my last question: Will the dropped tables stay in the recycle bin forever if there is no action made toward it later on?

The answer is NO. When your tablespace runs out of space or until you reach your user quota on the tablesapce. At that point, Oracle database would purge the objects at one time, starting with the ones dropped the longest time ago, until there is enough space for the current operation.