Start > Microsoft SharePoint 2010 Products > SharePoint 2010 Management Shell
$contentService = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
$contentService.RemoteAdministratorAccessDenied = $false
$contentService.Update()
2012年2月24日 星期五
2012年1月11日 星期三
JPA: How To Dynamic Set up Default Schema for Different Environment on Spring
In the property file:
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="persistenceUnitName" value="xxxunitname" />
<property name="jpaProperties" ref="hibernateProperties" />
</bean>
<bean id="hibernateProperties"
class="com.pa.test.CustomPropertiesFactoryBean">
<property name="nullable">
<map>
<entry key="hibernate.default_schema" value="xxx"/>
</map>
</property>
</bean>
Create your own class:
public class CustomPropertiesFactoryBean extends PropertiesFactoryBean {
private Map nullable;
public Map getNullable ( )
{
return nullable;
}
public void setNullable ( Map nullable )
{
this.nullable = nullable;
}
@Override
protected Object createInstance ( ) throws IOException
{
Properties result = super.mergeProperties();
String defaultschema =
{get from other place like other database or JNDI option or JVM option}
if (StringUtils.hasText(defaultschema)) {
result.put("hibernate.default_schema", defaultschema);
} else {
for (String key : nullable.keySet())
{
if (StringUtils.hasText(nullable.get(key)))
{
result.put(key, nullable.get(key));
}
}
}
return result;
}
}
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="persistenceUnitName" value="xxxunitname" />
<property name="jpaProperties" ref="hibernateProperties" />
</bean>
<bean id="hibernateProperties"
class="com.pa.test.CustomPropertiesFactoryBean">
<property name="nullable">
<map>
<entry key="hibernate.default_schema" value="xxx"/>
</map>
</property>
</bean>
Create your own class:
public class CustomPropertiesFactoryBean extends PropertiesFactoryBean {
private Map
public Map
{
return nullable;
}
public void setNullable ( Map
{
this.nullable = nullable;
}
@Override
protected Object createInstance ( ) throws IOException
{
Properties result = super.mergeProperties();
String defaultschema =
{get from other place like other database or JNDI option or JVM option}
if (StringUtils.hasText(defaultschema)) {
result.put("hibernate.default_schema", defaultschema);
} else {
for (String key : nullable.keySet())
{
if (StringUtils.hasText(nullable.get(key)))
{
result.put(key, nullable.get(key));
}
}
}
return result;
}
}
2012年1月9日 星期一
Glassfish won't start up by error "EMBEDDED Broker start failure:code = 1"
if you get error: EMBEDDED Broker start failure:code = 1 and can't start up the app server.
- Go to C:\Sun\AppServer\domains\domain1\imq\instances\imqbroker
- Delete "lock" file.
- Start up server
2011年12月1日 星期四
Add Command Window on Right-click Properties
Create a text file named command.prompt.reg
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\Command Prompt\Command]
@="cmd.exe /k pushd %L"
- 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"
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.
- Check if you install VMWare Tools under VM menu. (remember restart VM after install it)
- Check if you still have Driver not working on VM in Device Manager.
- Go go Control panel (use Keyboard).
- Go to Mouse
- Go to Pointer options
- Check Display Pointer trails
- Reduce trail size to zero
2011年11月22日 星期二
VMWare: install vmdk file
- Go START ⇒ Program ⇒ VMWare Player
- Click “Create a New Virtual Machine”
- Choose “I will install the operating system later.”
- Choose OS ⇒ Next
- Type in Name and choose the location ⇒ Next
- Type in disk size ⇒ Next
- Click Finish
- Close VMWare Player
- Go to File Explorer (My computer)
- Go to location and replace the vmdk file from old one to new one.
- Open VMWare Player again (Go START ⇒ Program ⇒ VMWare Player)
- 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;
}
}
<af:outputText value="#{row.Phone}" id="ot3">
<f:converter converterId="PhoneConverter"/>
</af:outputText>
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>
<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
}
訂閱:
文章 (Atom)