2011年12月1日 星期四

Add Command Window on Right-click Properties

Create a text file named command.prompt.reg


  • Add command



Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\Command Prompt\Command]
@="cmd.exe /k pushd %L"



  • Save it.
  • Run the file.

2011年11月28日 星期一

VMWare: Cannot turn on file from XP Mode

Open vmx file
Add:

virtualHW.version = "8"
scsi0.present = "TRUE"
memsize = "2048"
xpmode.enabled = "TRUE"

VMWare: Mouse is not work from XP Mode to VMWare


If converting from XP Mode to VMWare and you mouse is not working.
  1. Check  if you install VMWare Tools under VM menu. (remember restart VM after install it)
  2. Check if you still have Driver not working on VM in Device Manager.
NOW. THIS IS THE TRICK:
  1. Go go Control panel (use Keyboard).
  2. Go to Mouse
  3. Go to  Pointer options
  4. Check Display Pointer trails
  5. Reduce trail size to zero

2011年11月22日 星期二

VMWare: install vmdk file


  1. Go START ⇒ Program ⇒ VMWare Player
  2. Click “Create a New Virtual Machine”
  3. Choose “I will install the operating system later.”
  4. Choose OS ⇒ Next
  5. Type in Name and choose the location ⇒ Next
  6. Type in disk size ⇒ Next
  7. Click Finish
  8. Close VMWare Player
  9. Go to File Explorer (My computer)
  10. Go to location and replace the vmdk file from old one to new one.
  11. Open VMWare Player again (Go START ⇒ Program ⇒ VMWare Player)
  12. Choose the one and power on the VM.

2011年11月3日 星期四

Syn with node agent memory JVM options


Making sure the synchronous actions occur when your start your instance-cluster.

Answer: By default, running the command, asadmin start-node-agent NODE-AGENT-NAME will not actually register synchronization for all entries/parameters/configuration for the cluster configuration in GlassFish V2 update 1 or Application Server 9.1 when starting up the cluster... To make sure synchronization kicks in when starting the cluster use the following two commands;

./asadmin start-node-agent --startinstances=false NODE-AGENT-NAME
./asadmin start-cluster CLUSTER-NAME

2011年9月26日 星期一

JDeveloper: ADF: Custom Converter

1. Create Converter: 

package com.pyramid.misc;

import java.util.Map;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;

public class PhoneConverter implements Converter  {
    public PhoneConverter() {
     
    }

    public Object getAsObject(FacesContext facesContext,
                              UIComponent uiComponent, String value) {
      if (value == null || (value.trim().length() == 0))
              {
                  return value;
              }
   
      // format phone numbers to display correctly
   
        String phone = value.trim();
        if (phone.length() == 10) {
            phone = phone.substring(0, 3) + "-" + phone.substring(3, 6) + "-" + phone.substring(6, 10);
        }
        else if (phone.matches("\\d{10}\\s*\\d+")) {
            phone = phone.replaceAll("\\s+", "");
            phone = phone.substring(0, 3) + "-" + phone.substring(3, 6) + "-" + phone.substring(6, 10) + " x" + phone.substring(10);
        }
 
      return phone;
    }

    public String getAsString(FacesContext facesContext,
                              UIComponent uiComponent, Object value) {
        String phoneNumber = (String)value;
         if (phoneNumber == null || (phoneNumber.trim().length() == 0))
          {
              return "";
          }
          String phone = phoneNumber.trim();


          if (phone.length() == 10) {
              phone = phone.substring(0, 3) + "-" + phone.substring(3, 6) + "-" + phone.substring(6, 10);
          }
          else if (phone.matches("\\d{10}\\s*\\d+")) {
              phone = phone.replaceAll("\\s+", "");
              phone = phone.substring(0, 3) + "-" + phone.substring(3, 6) + "-" + phone.substring(6, 10) + " x" + phone.substring(10);
          }
       
        return phone;
    }
}

2. Register on faces-config.xml file (or faces configuration file)
<faces-config
...

     <converter>
    <description>A Converter for phone number</description>
    <converter-id>PhoneConverter</converter-id>
    <converter-class>
        com.pyramid.misc.PhoneConverter
   
</converter>

...
</faces-config>

3. Use in field:


 <af:outputText value="#{row.Phone}" id="ot3">
                       <f:converter converterId="PhoneConverter"/>
                   </af:outputText>
                 

2011年9月20日 星期二

SharePoint 2007: Display Attachment List


Display file links:

foreach (String fileAtt in attachmentsAtt)
{
          String attachmentAbsoluteURL =
          item.Attachments.UrlPrefix // gets the containing directory URL
          + fileAtt;
   // Add ToDo here
}


Get SPFile from Attachment:
SPAttachmentCollection attachmentsAtt = item.Attachments;
 foreach (String fileAtt in attachmentsAtt)
{
             SPFile file = web.GetFile(attachmentsAtt.UrlPrefix + fileAtt);
             // Add ToDo here
}


2011年9月15日 星期四

Glassfish: ReflectPermission suppressAccessChecks error


If you get something like on glassfish:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name '__ContractService': Initialization of bean failed; nested exception is java.security.AccessControlException: access denied (java.lang.reflect.ReflectPermission suppressAccessChecks)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)

Go to Admin console => Configurations => [target] => security 
Uncheck Security Manager.

VMWare: Take Ownership Fail

1. GO TO VM/[servername] folder.
2. Delete *.lck

2011年9月12日 星期一

Weblogic: Create new and start up Managed Server


Create a new managed Server
1. Go to console.
2. Click Environment => Servers => New
3. Give a new name and use different port from other servers.
4. Save

Add library into new managed Server:
1. Go to console
2. Click on Deployment => adf.oracle.domain(1.0,11.1.1.0.0) => Target
3. Choose new managed server
4. Save
5. Repeat the 1-4 actions on library:

  • adf.oracle.domain.webapp(1.0,11.1.1.1.0)
  • jsf(1.2,1.2.9.0)
  • jstl(1.2,1.2.0.1)
  • ohw-rcf(5,5.0)
  • ohw-uix(5,5.0)
  • UIX(11,11.1.1.1.0)
  • oracle.adf.dconfigbeans(1.0,11.1.1.0.0)
  • oracle.adf.management(1.0,11.1.1.1.0)
  • oracle.dconfig-infra
  • oracle.jrf.system.filter
  • oracle.jsp.next(11.1.1,11.1.1)
  • oracle.sdp.client(11.1.1,11.1.1)
  • oracle.soa.workflow.wc(11.1.1,11.1.1)
  • oracle.webcenter.framework(11.1.1,11.1.1)
  • oracle.webcenter.framework.view(11.1.1,11.1.1)
  • oracle.webcenter.jive.dependency(11.1.1,11.1.1)
  • oracle.webcenter.skin(11.1.1,11.1.1)
  • oracle.wsm.seedpolicies(11.1.1,11.1.1) – only if you have installed Oracle Webservices Manager.
  • oracle.portlet-producer.jpdk(11.1.1,11.1.1)
  • oracle.portlet-producer.wsrp(11.1.1,11.1.1)
  • DMS application
  • wsm-pm

6. Go to console => Environment/Startup and Shutdown Classes:
7. Choose each item and add target to new managed server.



Start up new server on Windows:
1. Start up the domain
2. Go to %oracle_home%/user_projects/domains/[your domain]/bin
3. Create a shortcut on startManagedWebLogic.cmd on Desktop
4. Go to properties on the shortcut => Shortcut tab
5. Add [manage server name] & into target like C:/..../startmanagedWebLogic.cmd newManagedServer &
6. Double click on Shortcut.


Following is from 

Oracle recommends creating a separate  schema to store custom Webcenter application metadata. Using existing  schemas may corrupt seeded repositories.
  1. Run rcu from RCU_HOME/bin folder. Skip the first screen.
  2. Specify Database connection parameters in the next step.
  3. From “Select Components” screen, specify “ORAFMWSCHOOL” for “Create a new Prefix”. Select Oracle AS Repository Components –> AS Common Schemas –> Metadata Services. Click Next.
  4. Enter schema password and confirm the same.
  5. Click Next and then Finish.
This creates ORAFMWSCHOOL_MDS schema in the database.
Login to Enterprise Manager console using http://localhost:7001/em
Click on “Metadata Repositories” link from left sidebar.
image
Click on “mds-soa” to bring up SOA MDS repository detail screen. From “Metadata Repository” menu under mds-soa, select Administration –> Register/Deregister.
image
From Database Repositories section, click on “Register…”. Enter database details and click on Query.
image
Select ORAFMWSCHOOL_MDS from the list of displayed Metadata Repositories. Enter a Repository Name and Schema password we created in Step 2.
This completes registration of repository with Oracle Weblogic server domain.



2011年7月28日 星期四

ava.security.AccessControlException: access denied (java.lang.RuntimePermission createClassLoader)

System got error when you deploy EJB or War file:
ava.security.AccessControlException: access denied (java.lang.RuntimePermission createClassLoader)

Go to Admin Console => Configuration => Security
Do not check Security Manager

restart app server.

Reference to http://java.dzone.com/articles/hudson-security-manager

2011年7月21日 星期四

Db2 Backup

You have to turn on Administration Server.

C:.../> DB2ADMN SETID [username] (Enter)
C:.../> DB2ADMIN START

Then go to edit window and do the backup.
OR
CONNECT TO [schema Name];
QUIESCE DATABASE IMMEDIATE FORCE CONNECTIONS;
CONNECT RESET;
BACKUP DATABASE [schema Name]TO "C:\db2data" WITH 2 BUFFERS BUFFER 1024 PARALLELISM 1 WITHOUT PROMPTING;
CONNECT TO [schema Name];
UNQUIESCE DATABASE;
CONNECT RESET;

2011年7月12日 星期二

2011年6月2日 星期四

Oracle: Startup sequence

1. Get in SQLPlus:
C:/>sqlplus /nolog

2. Log in as sysdba
SQL> conn username/password as sysdba

3. Startup databas
SQL> startup mount;

4. Start up listener:
Go back to command line: C:/lsnrctl start

5. start instance
Log in as sysdba SQL> alter database open;

6. startup console
Go back to command line: emctl start dbconsole

2011年4月11日 星期一

Address already in use: JVM_Bind:8080

Under %JBoss folder%\server\default\deploy\jboss-web.deployer
Find a file: server.xml
Find port: 8080
Replace another unused one.

2011年3月23日 星期三

Display Map

Map hm = HashMap();
...

Set set = hm.entrySet();


Iterator i = set.iterator();

while(i.hasNext()){
Map.Entry me = (Map.Entry)i.next();
System.out.println(me.getKey() + " : " + me.getValue() );
}

2011年3月11日 星期五

Truncate Log file in SQL Server 2008: Shrink database

BACKUP log with truncate_only

DBCC SHRINKfile(2, 1, truncateonly)

2011年1月28日 星期五

BEA-000000: Rowkey does not have any primary key attributes

The Error: Rowkey does not have any primary key attributes.
Because the query for the displaying list doesn't have "Primary key".

2011年1月21日 星期五

Oracle: Check ISNUMBER

select decode(translate('A123456','1234567890','Y'),'Y','Y','N') from dual

select decode(translate('123456','1234567890','Y'),'Y','Y','N') from dual