2010年2月19日 星期五

DB2: Select table sturcture

select TBNAME, NAME, COLTYPE, LENGTH, NULLS FROM SYSIBM.SYSCOLUMNS
WHERE TBCREATOR = 'schemaname' and TBNAME in ('tablename')

2010年2月10日 星期三

SVN: Eclipse Plugin

1. Help->Install New Software
2. Choose to work with Galileo – http://download.eclipse.org/releases/galileo
3. Unfold Collaboration
4. Choose Subversive SVN Team Provider (Incubation)
5. I employ you to restart Eclipse and don’t use any plugin at this point since they will not work and you will get a message which is similar to this: 0×0040010b: Obtain Project Name’ operation finished with error: Selected SVN connector library is not available or cannot be loaded …’. Instead you rather install a connector library.
6. Help->Install New Software
7. Add a site
8. I used: http://www.polarion.org/projects/subversive/download/eclipse/2.0/update-site/ , but you can probably use any other that has SVNKit or JavaHL connector
9. Unfold Subversive SVN Connectors
10. Select Subversive SVN Connectors, SVNKit (1.3.0), JavaHL (1.6.0) and it’s native libraries.
11. Restart Eclipse
12. Configure SVN Connector by specifying the connector in Window->Preferences->Team->SVN->SVN Connector.

2009年10月16日 星期五

T-Mobile: WAP Setting

Services => WAP => Settings => Edit Profile => SIM1 => Pick any profile => Edit Profile
1:Rename Profile => T-MOBILE WAP
2:Home Page =>http://wap.myvoicestream.com
3:Data account :T-Mobile GPRS
4:Connection type:WAP
5:User Name:(none)
6:Password:(none)

Services => Data Account => GPRS => (chose an unused company name) =>
1:Change Account Name => T-Mobile GPRS
2:APN => wap.voicestream.com
3:User Name: (none)
4:Password:(none)
5:Auth.type: Normal


Primary DNS: 216.155.165.50

Secondary DNS: 216.155.165.51

2009年10月15日 星期四

Junit 4: Add Junit test on Ant

<target name="mytest" description="mytest">

<junit printsummary="yes" haltonerror="yes" haltonfailure="yes" fork="yes"> <formatter type="plain" usefile="false" />

<test name="gov.hud.mfh.business.service.contracts.ContractFinderTest"/> <classpath>
<pathelement path="test"/> <!-- source code place -->
<fileset dir="test"> <!-- source lib place -->
<include name="**/*.jar"/>
<exclude name="**/ant*.jar"/>
</fileset>
<fileset dir="./lib/junit"> <!-- junit lib place -->
<include name="**/*.jar"/>
<exclude name="**/ant*.jar"/>
</fileset> </classpath>
</junit>
</target>

You must Exclude ant*.jar otherwise you will get Error:
No tests found in gov.hud.mfh.business.service.contracts
And USE ANT 1.7.0 TO RUN JUNIT 4.
ANT 1.7.1 might has problem.

Batch Junit Example

<target name="batchtest" description="batchtest">
<junit printsummary="yes" haltonerror="no" haltonfailure="yes" fork="yes">
<formatter type="xml" usefile="true" />
<classpath>
<pathelement path="test"/>
<fileset dir="test">
<include name="**/*.jar"/>
<exclude name="**/ant*.jar"/>
</fileset>
<fileset dir="./lib/junit">
<include name="**/*.jar"/>
<exclude name="**/ant*.jar"/>
</fileset>
</classpath>
<batchtest fork="yes" todir="${reports.junit.dir}" haltonfailure="yes" >
<fileset dir="junit">
<include name="**/*Test*.java"/>
</fileset>
<formatter type="xml"/>
</batchtest>
</junit>
</target>

Junit 4: Error on JUnit4TestAdapter signer information

class "junit.framework.JUnit4TestAdapter"'s signer information does not match signer information of other classes in the same package

Solution: more than one junit.jar appear in the classpath. Please delete the redundant one.

2009年8月16日 星期日

Create Action in ActionMenu

1. Create Files like in directory above.
2. Elements.xml:

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
Id="Simple List Actions"
GroupId="ActionsMenu"
Location="Microsoft.SharePoint.StandardMenu"
Sequence="1101"
Title="My Action"
Description="A Simple Action Menu"
ControlAssembly="CustomActions.SimpleAction, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5483709352c77bd4"
ControlClass="CustomActions.SimpleAction.SimpleActionExample"/></Elements>

3. Feature.xml

<?xml version="1.0" encoding="utf-8" ?>
<Feature xmlns="http://schemas.microsoft.com/sharepoint/"
Id="886DFDD5-B323-4593-9471-717C863F4CB4"
Title="Custom Simple Action Example"
Scope="Web"
Hidden="FALSE"
>
<ElementManifests>
<ElementManifest Location="Elements.xml" />
</ElementManifests>
</Feature>

4. SimpleActionExample.cs

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.WebPartPages;
using System.Diagnostics;
using System.Web.UI;
using Microsoft.SharePoint;
namespace CustomActions.SimpleAction
{
public class SimpleActionExample: System.Web.UI.WebControls.WebControl
{
protected override void OnLoad(EventArgs e)
{
EnsureChildControls();
base.OnLoad(e);
}
protected override void CreateChildControls()
{
SPWeb site = SPContext.Current.Web;
MenuItemTemplate _action = new MenuItemTemplate();
_action.Text = "My Action1";
_action.Description = "My Action1";
_action.ImageUrl = "/_layouts/images/NEWITEM.GIF";
_action.ClientOnClickNavigateUrl = "http://www.ttt.com";
Controls.Add(_action);
}

7. Deploy Descripture
cd "$(ProjectDir)"xcopy "$(TargetDir)*.dll" "C:\Inetpub\wwwroot\wss\VirtualDirectories\80\bin\" /ys"
%programfiles%\microsoft visual studio 8\sdk\v2.0\bin\gacutil" /i "$(TargetPath)" /nologo /f

xcopy "TEMPLATE" "%CommonProgramFiles%\Microsoft Shared\web server extensions\12\TEMPLATE\" /ys


6. Deploy the feature.
stsadm -o deactivatefeature -name CustomSimpleAction -url http://site/ -force
stsadm -o uninstallfeature -name CustomSimpleAction -force
stsadm -o execadmsvcjobs

stsadm.exe -o installfeature -name CustomSimpleAction
stsadm.exe -o activatefeature -name CustomSimpleAction -url http://site/ -force
stsadm -o execadmsvcjobs
iisreset

Then you found the action is not comming out......
Why????
Answer is here. You have to put it on SafeControl.

<SafeControl Assembly="CustomActions.SimpleAction, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5483709352c77bd4" Namespace="CustomActions.SimpleAction" TypeName="*" Safe="True" />

Use

<?xml version="1.0" encoding="utf-8" ?>
<Solution xmlns="http://schemas.microsoft.com/sharepoint/" SolutionId="C467C5CE-5290-4A2B-A243-092F5A51E4E0" >
<FeatureManifests>
<FeatureManifest Location="CustomActions.SimpleAction\feature.xml" />
</FeatureManifests>
<Assemblies>
<Assembly DeploymentTarget="GlobalAssemblyCache" Location="CustomActionOCRPDFInList.dll">
<SafeControls>
<SafeControl
Assembly="CustomActions.SimpleAction, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5483709352c77bd4"
Namespace="CustomActions.SimpleAction"
TypeName="*"
Safe="True" />
</SafeControls>
</Assembly>
</Assemblies>
</Solution>

Or directly put in Web.config file

2009年8月3日 星期一

Invalid postback or callback argument

EXCEPTION:

Invalid postback or callback argument. Event validation is enabled using in configuration or in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

Just make sure EnableEventValidation is set to false on web.config, otherwise the following error is being thrown:

Hide Workflow Link on Item Context Menu for Document List

1. Open CORE.JS on C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\1033
2. find the words: function AddDocLibMenuItems(m, ctx)
3. under the function, find words: AddWorkflowsMenuItem(m, ctx);
4. comment that out. or Add if (ctx.ListTitle != "Test Document") to focus on some list title.
5. Save it of course.

2009年6月11日 星期四

Set up SQL mail on SQL Server 2005

Solve the problem on "Enable the use of 'Database Mail XPs' by using sp_configure"

USE Master
GO
sp_configure 'show advanced options', 1
GO
reconfigure with override
GO
sp_configure 'Database Mail XPs', 1
GO
reconfigure
GO
sp_configure 'show advanced options', 0
GO

at 6/09/2009 02:00:00 PM

User for Imcomplete Survey

I cannot find the answer to open the imcomplete survey. Some people say they can see the imcomplete response if the site template is TEAM site. But I still canot see it.
The only thing I can see is the user list with imcomplete survey and SQL is like:

select a2.nvarchar3, a2.nvarchar1, a2.nvarchar2, a2.nvarchar10, a2.nvarchar14, a1.tp_CheckoutUserId
from AllUserData a1
inner join AllUserData a2
on a1.tp_CheckoutUserId = a2.tp_ID
where a1.tp_ListId = 'A841EA21-20EC-4B79-AAC0-F1AD25F6278E'
and a1.tp_CheckoutUserId is not null and a2.tp_ContentType = 'Person' order by a2.nvarchar1
at 6/09/2009 09:32:00 AM