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

How to find ListTemplateId from a list

Try to create a new List.
Select the list template you want to create.
Before you click Create Button, see the URL.
It should be something like http://site/_layouts/new.aspx?NewPageFilename=TEST%2Estp&FeatureId={00bfea71-3a1d-41d3-a0ee-651d11570120}&ListTemplate=120
and List Template ID is there.
at 6/02/2009 04:32:00 PM

Create "get Public Key"

In VS, Tools => External Tools... => Add
Title: get &Public Key
Command: C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\sn.exe
Arguments: -Tp $(TargetPath)

Right click on the menu => Customize... => Categorize: Tools, External Comman 7...
at 5/14/2009 04:18:00 PM

PWA: Setting User and Group Permission

IT'S NOT UNDER SITE ACTIONS/SITE SETTING

You should see the "Server Settings" on the left hand side if you have right to see it.

at 4/21/2009 01:08:00 PM

Install Caml dll

Copy CodeArt.SharePoint.CamlQuery.dll to folder C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
and GAC place.
at 4/17/2009 11:47:00 AM

VM Ware: Share File between host and virtual

1. Open vmware;
2. Click menu "VM", then select "Settings";
3. Then click "Options" in the new window, and you will see an option "Shared folders Enabled" ;
4. Select it and add some folders;
5. OK, end.
at 3/25/2009 11:19:00 PM

SharePoint 2007: Error on add attachment

If getting error:
Failed to get value of the "Attachments" column from the "Attachments" field type control. See details in log. Exception message: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)..
You have double web parts using the same attachmentUpload. Check in html "view source", you will find two span tags "part1" or two attachment row. Please "Close" one web part.
at 3/11/2009 08:01:00 PM

C# String to Char

string newlineKeyword = ".";

char spliterChar = char.Parse(newlineKeyword);

at 2/04/2009 03:17:00 PM

Open pane tool section

Use this:
javascript:MSOTlPn_ShowToolPane2Wrapper('Edit', this, '" + this.ID + "')
at 1/30/2009 08:44:00 AM

Oracle: ORA-12519, TNS:no appropriate service handler found on application processing

When running application on SUN application server, it suddenly gets "ORA-12519, TNS:no appropriate service handler found" error message when view a page. Sometime page will show up but sometime it gets error.

SOLUTION: under command window. RUN:
lsnrctl services
at 9/02/2008 10:59:00 PM

Javascript: Overwrite layer




at 7/23/2008 09:36:00 AM

JAVA: list system properties

Properties p = System.getProperties();
Enumeration keys = p.keys();
while (keys.hasMoreElements()) {
String key = (String)keys.nextElement();
String value = (String)p.get(key);
System.out.println(key + " ***: " + value);
}

or if we want specific property
String classPath = System.getProperty("java.class.path",".");
System.out.println("classPath = " + classPath);
at 7/18/2008 08:40:00 AM

Javascript: Open in iFrame

In div
style="position:absolute;display:none;background-color:white;border:solid 1px gray;border-style:double; z-index:100;"

in javascript
function showdiv(obj, bState, left, top) {
var oDiv = obj;
/*@cc_on @if (@_jscript_version >= 5)
try {
var oIframe = document.getElementById('HelpFrame');
oIframe.scrolling = 'no';
} catch (e) {
var oIframe = document.createElement('iframe');
var oParent = oDiv.parentNode;
oIframe.id = 'HelpFrame'; oParent.appendChild(oIframe);
}

oIframe.frameborder = 0;
oIframe.style.filter='Alpha(Opacity=80)';
oIframe.style.position = 'absolute';
oIframe.style.top = top;
//oIframe.style.left = left;
oIframe.style.display = 'none'; @end @*/
if (bState) {
oDiv.style.margin = "0px";
oDiv.style.padding = "0px";
oDiv.style.top = top;
//oDiv.style.left = left;
oDiv.style.display = 'block';
/*@cc_on @if (@_jscript_version >= 5)
oIframe.style.top = oDiv.style.top;
oIframe.style.left = oDiv.style.left;
oIframe.style.zIndex = oDiv.style.zIndex - 1;
oIframe.style.width = parseInt(oDiv.offsetWidth);
oIframe.style.height = parseInt(oDiv.offsetHeight);
oIframe.style.visibility = "visible";
oIframe.style.display = 'block'; @end @*/
} else {
/*@cc_on @if (@_jscript_version >= 5)
oIframe.style.display = 'none'; @end @*/
oDiv.style.display = 'none'; }
}
at 7/14/2008 03:55:00 PM

SharePoint: Install Report Service Add-in on SQL Server

* Install SharePointRS.msi from \\hqd1\Software\SharePoint 2007 Installation\ReposerServiceAddIn
*Click Start => Programs => Microsoft SQL Server 2005 => Configuration Tools.
*Click Reporting Services Configuration. The Report Server Installation Instance Selection dialog box appears so that you can select the report server instance you want to configure.
*In Machine Name, specify the name of the computer on which the report server instance is installed. The name of the local computer is specified by default, but you can also type the name of a remote SQL Server instance.
* In Instance Name, choose the SQL Server 2005 Reporting Services instance that you want to configure. Only SQL Server 2005 report server instances appear in the list. You cannot configure earlier versions of Reporting Services.
* Click Connect.
* Click Database Setup to open the Database Setup page.
* Enter the name of the SQL Server Database Engine you want to use.
* Click Connect.
* Click New.
* In the SQL Server Connection dialog box, enter a name for the new database.
* Select the Create the report server database in SharePoint integrated mode check box.
* Click OK.
* On the Database Setup page, specify the credentials that are used to connect to the report server database.
* Choose Service credentials to use the Windows service account and Web service account to connect through integrated security.

Choose Windows credentials to specify a domain user account. A domain user account must be specified as \.

Choose SQL Server credentials to specify a SQL Server login.

Click Apply.

Restart the Report Server Windows service.
at 7/14/2008 08:00:00 AM

CVS: Install on Linux Enterprice 5

The version I download is cvs-1.11.23.tar.gz
Create new folder for CVS
1. Create folder under /opt called "cvs".
2. Copy the file cvs-1.11.23.tar.gz to /opt/cvs
3. Create folder under root called "cvs".
4. Create folder under /cvs called cvsroot

Create new group and user:
1. Create group cvs: groupadd cvs
2. useradd -g cvs -G cvs -d /cvs/cvsroot cvsuser
3. Add password: passwd cvsuser

Change folder owner and group to cvs and cvsuser
1. chgrp -R cvs /cvs
2. chown -R cvsuser /cvs
3. chmod 775 /cvs/cvsroot

Install CVS:
1. Go back to /opt/cvs (Should have the cvs-1.11.23.tar.gz in there)
2. Enter: gunzip cvs.tar.gz
3. Enter: tar -xf cvs.tar
4. Enter: ./configure
5. Enter: make
6. Enter: make install

Setup initial state in /cvs/cvsroot
Enter: cvs -d /cvs/cvsroot init (This will create a CVSROOT and related file under CVSROOT folder).

Create password for user:
1. Enter: vi /cvs/cvsroot/CVSROOT/passwdgen.pl
Content in file should be:

#!/usr/bin/perl
  srand (time());
  my $randletter = "(int (rand (26)) + (int (rand (1) + .5) % 2 ? 65 : 97))";
  my $salt = sprintf ("%c%c", eval $randletter, eval $randletter);
  my $plaintext = shift;
  my $crypttext = crypt ($plaintext, $salt);
  print "${crypttext}\n";


2. Save it.
3. Create a encrypted password: For exampel if password in plant text is "test"
Enter: ./passwdgen.pl "test"
4. Enter: vi /cvs/cvsroot/CVSROOT/passwd
Content should be:
username1:encrptedpassword1:cvsroot
username2:encrptedpassword2:cvsroot

Create Service for CVS:
1. Enter: vi /etc/services
2. Add following tow line in proper placs and save it.

cvspserver 2401/tcp #pserver cvs service
  cvspserver 2401/udp #pserver cvs service

3. Go to: cd /etc/xinetd.d
4. Enter: vi cvspserver
Content should be like this:

service cvspserver
  {
disable = no
port = 2401
socket_type = stream
protocol = tcp
wait = no
user = root
#user = cvsuser
group = cvs
passenv = PATH
server = /usr/bin/cvs
#server = /opt/cvs/cvs-1.11.23
#env = HOME=/var/cvs
#server_args = -f --allow-root=/var/cvs pserver
server_args = -f --allow-root=/cvs/cvsroot pserver
# bind = 127.0.0.1
  }

5. Save it.
6. Restart service: /etc/rc.d/init.d/xinetd restart
7. Check if cvs is running: netstat -l grep cvspserver
8. Result should be like this:
tcp 0 0 *:cvspserver *:* LISTEN
9. Log into CVS
cvs -d :pserver:username1@202.204.114.37:/cvs/cvsroot login

10. Set path
PATH=$PATH:/usr/bin
export PATH
CVSROOT=/home/cvsroot
export CVSROOT

If we want to move old projects to new projects.
1. Copy from old machine /cvs/cvsroot to new machine /cvs/cvsroot
2. Change group and owner:
chgrp -R cvs /cvs
chown -R cvsuser /cvs

SharePoint: Deploy/Remove new wsp feature

Create
@SET STSADM=”c:\program files\common files\microsoft shared\web server extensions\12\bin\stsadm.exe”
%STSADM% -o addsolution -filename OfficeSpaceFeature.wsp
%STSADM% -o deploysolution -name OfficeSpaceFeature.wsp -immediate -allowGacDeployment
%STSADM% -o execadmsvcjobs

if you get error
This solution contains resources scoped for a Web application and must be deployed to one or more Web applications.

stsadm -o deploysolution -name OfficeSpaceFeature.wsp -immediate -allowgacdeployment -allowcaspolicies -url http://tt.it.com

stsadm -o upgradesolution -name PsiCntLib.wsp -filename PsiCntLib.wsp -immediate -allowGacDeployment

Remove
@SET STSADM=”c:\program files\common files\microsoft shared\ web server extensions\12\bin\stsadm.exe”
%STSADM% -o retractsolution -name OfficeSpaceFeature.wsp -immediate
%STSADM% -o execadmsvcjobs
%STSADM% -o deletesolution -name OfficeSpaceFeature.wsp

By the way deploye EVENT EVENT:
stsadm.exe -o installfeature -name EventHandlerFolderName
stsadm.exe -o activatefeature -name EventHandlerFolderName -url http://xxx/webname/ -force
stsadm -o execadmsvcjobs


stsadm -o deactivatefeature -name EventHandlerFolderName-url http://xxx/webname/
-force
stsadm -o uninstallfeature -name EventHandlerFolderName-force
stsadm -o execadmsvcjobs
--stsadm -o deletesolution -name EventHandlerFolderName-override

at 7/10/2008 07:52:00 AM


SharePoint PowerShell 2010


Add-SPSolution “D:\Deploy\MySharePointSolution.wsp
Install-SPSolution –Identity MySharePointSolution.wsp –WebApplication http://myspwebapp –GACDeployment
If you would like to add the solution as sandboxed, you would use the Install-SPUserSolution command instead. To upgrade a solution, we specify which solution is to be updated and with which new solution file:
Update-SPSolution –Identity MySharePointSolution.wsp –LiteralPath “D:\Deploy\MySharePointSolution.wsp” –GacDeployment
To retract and remove a solution, we use the following commands:
Uninstall-SPSolution –Identity MySharePointSolution.wsp –WebApplication http://myspwebapp
Remove-SPSolution–Identity MySharePointSolution.wsp

Working with features

Similarly, commands exist for working with features. The stsadm equivalents:
stsadm –o activatefeature –name MyFeatureName –url http://myspwebapp
stsadm –o deactivatefeature –name MyFeatureName –url http://myspwebapp
Needless to say, there are easy equivalents in PowerShell:
Enable-SPFeature –Identity MyFeatureNameOrGuid –url http://myspwebapp
Disable-SPFeature –Identity MyFeatureNameOrGuid –url http://myspwebapp


Erorr for Spring configuration file

if getting error
Error creating bean with name 'businessBeanFactory' defined in URL [file:/C:/Sun/AppServer/domains/domain1/applications/j2ee-modules/contracts-ejb/beanRefContext.xml]: Instantiation of bean failed; ...
...to convert value of type [java.lang.String] to required type [org.springframework.context.ApplicationContext]; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type

** Check Database conntection.

at 6/05/2008 06:55:00 PM

Disable back button on browser

if(window.history.forward(1) != null) window.history.forward(1);
at 5/13/2008 02:09:00 PM

UNIX: Find PID

ps -df grep gmp
kill -9 [PID]
See memory in kbyte
df -k

at 4/23/2008 02:01:00 PM

Oracle: Error for ORA-16014 and some basic commands

1. Cannot startup instance.
C:/>sqlplus /nolog
SQL> conn username/password as sysdba
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-16014: log 2 sequence# 1383 not archived, no available destinations
ORA-00312: online log 2 thread 1:
'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO02.LOG'

SOLUTION:
SQL> alter database clear unarchived logfile group 2;
SQL> shutdown immediate
Then startup database: (In windows service or do command as follow)
SQL> startup mount

By the way, stop archive use this
SQL> ALTER SYSTEM ARCHIVE LOG STOP;
at 4/23/2008 11:17:00 AM

Java Mail

import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;

Properties property = new Properties();
property.put("smtp server", "test.com");
Session s = Session.getInstance(property,null);
MimeMessage message = new MimeMessage(s);
InternetAddress from = new InternetAddress("from@test.com");
message.setFrom(from);
InternetAddress to = new InternetAddress("to@test.com");
message.addRecipient(Message.RecipientType.TO, to);

message.setSubject("Test from JavaMail.");
message.setText("Hello from JavaMail!");
Transport.send(message);
at 2/14/2008 02:21:00 PM

Event ID Errors: 6398, and 6641 on Event Log

If you find out there is still no use for solution on http://support.microsoft.com/?id=946517 and http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1205873&SiteID=1

Try this:
Central Administration > Application Management > Check Services Enabled in this Farm > Check Services Enabled in this Farm
and see if any service has error on the page.

Then open IIS Manager, Go to Application Pools, check every application pool has wrong access user name and password.
at 2/07/2008 10:08:00 AM

Interrupt Upgrade SP service by getting "http://go.microsoft.com/fwlink?LinkID=96177"

Open SQL Server and run SQL comment

USE master;
GO
EXEC sp_configure 'show advanced option', '1';

You can review it by using
EXEC sp_configure;

Then run =>Start/Program/Microsoft Office Server/Configures SharePoint Products and Technologies.

Someone also recommend to run command in command window
psconfig -cmd upgrade -force
Then run =>Start/Program/Microsoft Office Server/Configures SharePoint Products and Technologies.
at 2/06/2008 03:59:00 PM

2009年6月9日 星期二

Running Sun application server as a background service

Run command:

/opt/SUNWappserver/bin/asadmin start-domain --domaindir /opt/SUNWappserver/domains --user admin

Fail when you startup Application First time on UNIX

It you see the error message:
/var/appserver/domains is not a directory

when running:
asadmin start-domain domain1

mkdir /var/appserver (I didn't have to do this but maybe you do.)
mkdir /var/appserver/domains
asadmin create-domain --domaindir /var/appserver/domains --adminport 4848 --instanceport 8080 --adminuser admin domain1


Then you will see:
Please enter the admin password>
Please enter the admin password again>
Please enter the master password>
Please enter the master password again>
Using default port 7676 for JMS.
Using default port 3700 for IIOP.
Using default port 8181 for HTTP_SSL.
Using default port 3820 for IIOP_SSL.
Using default port 3920 for IIOP_MUTUALAUTH.
Using default port 8686 for JMX_ADMIN.
Domain domain1 created.

asadmin start-domain domain1
and move on to confirmation.

at 12/27/2007 11:48:00 AM

SharePoint 2007: Hide Create at/Modified by on Display form

open C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\GLOBAL\Lists\USERS\schema.xml- Go to about 246 line and disable all the Default part.

SharePoint 2007: Update global links Like My Links

Open C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\CONTROLTEMPLATES\MyLinks.ascx

Add a line
<td class="ms-globallinks"><a href="http://www.google.com">google</a></td>

under line
<td class="ms-globallinks"><asp:Literal id="hlMySiteSpacer" runat="server" /></td>
at 9/26/2007 06:09:00 AM

SharePoint 2007: Get Current Web, List ...

SPList currentList = SPContext.Current.List;
SPWeb currentSite = SPContext.Current.Web;
SPSite currentSiteCollection = SPContext.Current.Site;
SPWebApplication currentWebApplication = SPContext.Current.Site.WebApplication;
SPListItem item = (SPListItem)SPContext.Current.Item;
SPUser user = SPContext.Current.Web.CurrentUser;

at 8/23/2007 04:53:00 AM

Linux: start samba

Disable SELinux
go to /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Only targeted network daemons are protected.
# strict - Full SELinux protection.
SELINUXTYPE=targeted


Go to startx to setup samba user.....(Mmm....)

/etc/init.d/smb restart


add new password on CVS
./passwdgen.pl username password groupname >> passwd

Firewall: go http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch14_:_Linux_Firewalls_Using_iptables

How To Start iptables

[root@bigboy tmp]# service iptables start
[root@bigboy tmp]# service iptables stop
[root@bigboy tmp]# service iptables restart

To get iptables configured to start at boot, use the chkconfig command:.
[root@bigboy tmp]# chkconfig iptables on

Determining The Status of iptables
You can determine whether iptables is running or not via the service iptables status command. Fedora Core will give a simple status message. For example
[root@bigboy tmp]# service iptables status
Firewall is stopped.
[root@bigboy tmp]#

at 7/18/2007 03:27:00 PM

No copy and paste on textfield

If you don't want anyone to paste on some field. Add attributeonpaste="event.returnValue=false;"

at 7/06/2007 10:33:00 AM

SharePoint 2007: Move Site

Move whole site:
1. backup command:
stsadm -o backup -url http://sharepointdev:55 -filename c:\filename.dat
2. create a web application (Do not create site collection)
3. restore command:
stsadm -o restore -url http://sharepointdev:260 -filename c:\filename.dat -overwrite

Move sub site:
1. Save site to a template. How to? See http://itsmesunny.blogspot.com/2007/07/sharepoint-2007-save-as-site-template.html
2. Go to Site setting/Site Template. Click and save template to HD and copy to the other machine if machines are different. Then copy to the other machine.
3. Go to the new site. and use Site setting/Site template ot load to New web site.
4. Create a site and use new template as site template.

Or:
1. use command:
stsadm.exe -o export -url http://sharepointdev -filename c:\filename.dat
2. Move to the other machine.
3. use command:
stsadm.exe -o import -url http://sharepointdev -filename c:\filename.dat

at 7/06/2007 07:10:00 AM

SharePoint 2007: Save as site template

Just add _layouts/savetmpl.aspx after http site name.
Example: if the site is http://mysite/
Use: http://mysite/_layouts/savetmpl.aspx
at 7/03/2007 08:09:00 AM

SharePoint: Add custom Master Page in Site definition

1. Go To C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\GLOBAL
Copy Default.master to another one name myMaster.master.
Edit some layout if needed.

2. Create your own Site Definition. See http://itsmesunny.blogspot.com/2007/05/creating-custom-site-definition-in-mos

3. Edit ONET.xml under C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\SiteTemplates\[Your Site Template]\xml
...
<Configurations>
<Configuration ID="-1" Name="NewWeb" />

<Configuration ID="0" Name="Default"
CustomMasterUrl="_catalogs/masterpage/myMaster.master">
...
<Configuration ID="1" Name="Blank">
...
</Configuration>
</Configurations>

<Modules>

<Module Name="CustomMasterPage" List="116" Url="_catalogs/masterpage" RootWebOnly="FALSE" SetupPath="global">

<File Url="myMaster.master" Type="GhostableInLibrary" IgnoreIfAlreadyExists="TRUE" />

</Module>

4.Edit Default.aspx under C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\SiteTemplates\[Your Site Template]\xml

<%@ Page language="C#" MasterPageFile="~masterurl/custom.master"
(Note: Don't change the name custom.master to your file name. It doesn't mean that)

at 5/17/2007 03:48:00 PM

Creating a custom Site Definition in MOSS 2007

1. Click Start/run
2. Type in commend dcomcnfg. Choose Computer/My computer/DCOM config. Then right click on Microsoft Word Document

3. In Identity tab. check The interactive user. Then click OK.

4. Right click on My computer and choose Properties.


5. Under COM Security tab. Click Edit Default. Select user as following:
Access Permission:
SYSTEM
SELF
Everyone
Administrators
IUSR_(ServerName)
IWAM_(ServerName)
INTERACTIVE

Launch and Activation Permissions:
SYSTEM
Administrators
INTERACTIVE
Everyone
IUSR_(ServerName)
IWAM_(ServerName)

Then, most important thing. RESTART THE MACHINE.

at 5/17/2007 10:24:00 AM

SQL Mail setup with exchange server in SQL Server 2000

1. Use the user who will be in the profile in Outlook log on to system.
2. Setup mail in Outlook with exchange server. Remeber the Profile name we setting in the Outlook (Default may be named "Outlook").
3. Go to SQL Mail Configuration under Support Service in SQL Server 2000
4. Type in the profile name you setting in the Outlook. (You will found Error occur)
5. Go to Administrative Tools/Service. Find two services call SQLAgent and MSSqlServer.
6. Right click on this two service. In the Logon tab. Check This account. Type in the user's username, password and comfirm password.
Done!
at 4/26/2007 03:59:00 PM

Create Web Part "HelloWorld" to SharePoint 2007

1. Open Visual Studio and create an new project.
2. Choose Web Part as picture:
3 Edit content in HelloWorld123.cs and program like:

using System;
using System.Runtime.InteropServices;
using System.Web.UI;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Serialization;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.WebPartPages;
namespace HelloWork123
{
[Guid("a12d4678-34a5-4281-9d69-a3ab28a30c59")]
public class HelloWork123 : System.Web.UI.WebControls.WebParts.WebPart
{
public HelloWork123()
{
this.ExportMode = WebPartExportMode.All;
}
protected override void Render(HtmlTextWriter writer)
{
// TODO: add custom rendering code here.
writer.Write("Hello Hello Ha..Ha..Ha..");
}
}
}

4. Right click on Project HelloWorld123 and choose property

Choose correct browser with URL. 5. Hit F5 to start debug. or go to cmd(command window), cd to your project location. For example, here is C:\dev\SharePoint\HelloWorld\HelloWork123\HelloWork123\bin\Debug>
execute setup.bat. This will give the detail of deply process.
6. Go to SharePoint 2007 and go to the page I want to add a web part
7. Click on Add a new web part and we can find HelloWorld123 are on the list.


at 4/05/2007 09:55:00 AM

JNDI on Sun Application Server 8.0

1. Go to sun application server and setting something like following:
















2. create a java file: PropertiesFactory.java and save it like directory gov/hud/cpd/gmp/business/service

package gov.hud.cpd.gmp.business.service;

import java.util.Hashtable;
import java.util.Properties;

import javax.naming.Context;
import javax.naming.Name;
import javax.naming.Reference;
import javax.naming.spi.ObjectFactory;

public class PropertiesFactory implements ObjectFactory {


public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment) throws Exception {

Reference ref=(Reference)obj;
Properties props = new Properties();
props.setProperty("username", (String)(ref.get("username").getContent()));
props.setProperty("password", (String)(ref.get("password").getContent()));
props.setProperty("sshhost", (String)(ref.get("sshhost").getContent()));


return props;
}

}

3. make a jar file(only this file) using comment under root folder in cmd:
jar cf ftpJndi.jar *.*
(Remember to restart sun application server.)
4. copy it to [sun folder]\AppServer\domains\domain1\lib\ext as a library
or add in classpath in program as library.
  • If sun application server cannot find this factory class, It will directory return java.naming.Reference type in prop = (Reference) envCtx.lookup(dsName); below.

5. create another file in program like following:
package gov.hud.cpd.gmp.business.service;

import java.util.Properties;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

public final class JndiConnector {

public static ftpConnectionDao getContextName() throws NamingException {
ftpConnectionDao ftpConn = null;
Properties prop = null;
try {
InitialContext ctx = new InitialContext();
String dsName = "FtpConnection";
Context envCtx = (Context) ctx.lookup("java:comp/env");
prop = (Properties) envCtx.lookup(dsName);
ftpConn = new ftpConnectionDao();
ftpConn.setUsername(prop.getProperty("username"));
ftpConn.setPassword(prop.getProperty("password"));
ftpConn.setSshhost(prop.getProperty("sshhost"));

} catch (Exception e) {
e.printStackTrace();
}
return ftpConn;
}
}


and dao file:
package gov.hud.cpd.gmp.business.service;

public class ftpConnectionDao {

private String username;
private String password;
private String sshhost;
public String getSshhost() {
return sshhost;
}
public void setSshhost(String sshhost) {
this.sshhost = sshhost;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
}

6. in web.xml
<resource-ref>
<description>Ftp JNDI Reference</description>
<res-ref-name>FtpConnection</res-ref-name>
<res-type>java.util.Properties</res-type>
<res-auth>Container</res-auth>
</resource-ref>

7. in sun-web.xml
<resource-ref>
<res-ref-name>FtpConnection</res-ref-name>
<jndi-name>FtpConnection</jndi-name>
</resource-ref>
 
3/30/2007 11:45:00 AM

Install SharePoint 2007

1. Install .NET Framwork 3.0
2. Install SQL Server 2005 SP2
3. Make sure SMTP and index server installed on the server. You may need to restart machine.
4. Install SharePoint: refer to http://mindsharpblogs.com/bill/archive/2006/06/27/1153.aspx
NOTE: Stop before create Web Application
5. Setup Outgoing email.
Central Administration > Operations > Outgoing E-Mail Settings
[Your exchange server]
From address: [administrator's email]
To address: [administrator's email]

6. Set Incoming Email
Central Administration > Operations > Incoming E-Mail Settings
Configure Incoming E-Mail Settings
Enable sites on this server to receive e-mail?

Settings mode:


Use the SharePoint Directory Management Service to create distribution groups and contacts?

E-mail server display address: mylist @




7. Start Office SharePoint Server Search Service

Central Administration > Operations > Services on Server > Office SharePoint Server Search Service Settings
Configure Office SharePoint Server Search Service Settings on server hqspsdev

Use this server for indexing content

Use this server for serving search queries

Reduced


8. Start Windows SharePoint Services Serch Service
Central Administration > Operations >Services on Server > Windows
SharePoint Services Search Service Settings

Configure Windows SharePoint Services Search Service Settings on server hqspsdev

Database Server

Database Name


9. Start Excel Calculation Services and Document Conversion Load Balancer Service
10. Start Launcher Service Setting
Load Balancer server:


Port Number:

at 3/12/2007 04:34:00 PM

DUMP TRANSACTION LOG on SQL Server

dump transaction test with no_log
DBCC SHRINKFILE(PSIWeb_log, 20)
BACKUP LOG PSIWeb WITH TRUNCATE_ONLY
DBCC SHRINKFILE(PSIWeb_log, 1)
GO
exec sp_detach_db 'PSIWeb', 'true'
exec sp_attach_single_file_db @dbname = 'PSIWeb',
@physname = 'C:\MSSQL7\Data\PSIWeb_Data.MDF'
at 3/06/2007 10:23:00 AM

Black list on Shopping Store.

It's terribly to have some shopping experience with some web shopping store. They have cheap price on the list but later on they will try some way to charge you more or they will say no stock if you don’t buy more.

  • Bananaboatcamera.com
  • BestPriceCameras.com
  • ExpressCameras.com
  • TheCameraPros.com

And some price comparison site doesn’t give right rate on the store.

  • ShopCartUSA.com


So, there is a big risk to have a search on the Google. A “search engine” doesn’t mean a “search Good Site engine”, especially on Sponsored Links and AD section

2/02/2007 10:56:00 AM

SAMSUNG T619: Make my own mp3 Ringtone

Finally, it works. Make sure your data cable is "Real Data Cable", not just power cable.

On Quicktime Pro:
Open file/[audio file].
Export file/movie to 3gp
In the dialog window, Select Audio tab.
Audio Format - AAC-LC (Music)
Data Rate - 64kbps
Channels - Stereo
Output Sample Rate - 44.1khz
Encoding quality - Best.

On Samsung PC Studio:
Get into Media management.
Select all media. Right click on frame and select Get From PC..
Choose 3gp file and import into phone.

On phone:
menu/fun & app/my sound/music/.../set as/ringtone

DONE!
2/01/2007 02:22:00 PM

SQL Server: export Resultsets into Text file and Retrieve back

create table #errorlog(line varchar(2000))
execute master.dbo.xp_cmdshell 'osql -S10.1.1.6 -E -Q"execute PSIWebV3.dbo.sp_Test" -o"c:\temp\sp_out.txt" -s"" '
insert into #errorlog
execute master.dbo.xp_cmdshell 'type "c:\temp\sp_out.txt" '
select line from #errorlog
at 1/19/2007 05:18:00 PM

JavaScript: Automatically popup window on saving file

a jwcid="helpWindow" onClick="var helpwindow=window.open(this.href,'helpwin','width=650,
height=450,left=100,top=100,resizable=yes,scrollbars=yes');
helpwindow.focus();return false">Help/a>
at 1/10/2007 04:19:00 PM

Add/Update/Delete/Select comment on SQL Server 2000

EXEC sp_addextendedproperty 'MS_Description', 'Employee ID', 'user', dbo, 'table', employee, 'column', empId

EXEC sp_updateextendedproperty 'MS_Description', 'Employee ID', 'user', dbo, 'table', employee, 'column', empId

EXEC sp_dropextendedproperty 'caption', 'user', dbo, 'table', 'employee', 'column', empId

SELECT *
FROM ::fn_listextendedproperty (NULL, 'user', 'dbo', 'table', 'employee', 'column', default)
at 1/03/2007 10:23:00 AM

Sun Application Server 8.2 with jconsole on JVM

Go to sun application server login page and login.
Go Configuration/Admin Service/System.
See the port setting....

In comment line window, type in jconsole and Enter..
Set port as same as the port provide upper.

Running Ant for cvs difference

ant -Dcvstagdiff.starttag=iteration_20 -Dcvstagdiff.endtag=iteration_21 diff-tag-to-tag
Posted at 9/28/2006 09:17:00 AM 0 comments

Library 'tacos' not found in application namespace.

Add following into [gmp(website)].application file
< id="tacos" path="classpath:/net/sf/tacos/Tacos.library">
at 9/13/2006 10:00:00 PM

Directly set maxlength on Form object from database

In darpa project,

SQL = "select syscolumns.name as colname,syscolumns.length as collen, "
SQL = SQL & "systypes.name as typename from syscolumns, systypes "
SQL = SQL & " where object_name(syscolumns.id) = 'survey'"
SQL = SQL & " and syscolumns.xtype = systypes.xtype"

SET qs = Conn.Execute(SQL)
ind = 1
If not qs.EOF Then
Do While NOT qs.EOF
Execute( qs("colname") & "=" & qs("collen"))

ind = ind + 1
qs.MoveNext
Loop
End If
qs.Close
9/03/2006 09:52:00 PM

HTML STYLE: Menu or Layer will orverlapping Form Element

his will dynamic create a new iframe to cover the 'div'. So Form object won't be in the front.


MS Access Select List will actually update data

PROBLEM: Select List will change the value if set Control Source on Properties, or it will add a empty selection on the select list.
ANSWER:
1. Don't set anything on Control Source on Select List's properties.
2.
Private Sub Form_Load()
Me.Combo0.Requery
Me.Combo0 = Me.Combo0.ItemData(0)
End Sub

at 8/02/2006 02:35:00 AM 0 comments

Log for using AJAX

In web portal, use
EmpReviewUpd.asp
EmpReviewUpd_xt.asp
EmpReviewCommendAjax.js
to see the example

Hibernate: Get Length and Type attribute from property on mapping file using JAVA

After get configuration, you can get length from property.

public Configuration getConfiguration() {
Configuration configuration = new Configuration();
setMappings(configuration);

Iterator classMappings = configuration.getClassMappings();
while (classMappings.hasNext()) {
PersistentClass cm = (PersistentClass) classMappings.next();
Iterator propertyIterator = cm.getPropertyIterator();
while (propertyIterator.hasNext()) {
Property element = (Property) propertyIterator.next();
//Logger.debug(cm.getEntityName() + " = " + element.getName());
Iterator columnIterator = element.getValue().getColumnIterator();
while (columnIterator.hasNext()) {
Column col = (Column) columnIterator.next();
//Logger.debug(col.getName() + " > " + col.getLength());
}
}
}
return configuration;
}

private void setMappings(Configuration configuration) {
String[] files = new String[] { "AvailabilityCode", "StateCode",
"StatusCode", "SuitabilityCode", "ReasonCode", "Property",
"PropertyHistory", "Publication", "Agency", "PasswordHistory",
"UnsuitableReason", "User", "PropertyNumberSequence",
"FieldOfficeCode", "FieldOfficePoc", "DodDepartment",
"BracApplication", "Contact", "ContactType" };
for (int i = 0; i <>
at 6/09/2006 05:25:00 PM

Hibernate is slow with JRE 1.5

Hibernate is slow with JRE 1.5. We still don't know why, but the fact is SLOW. We wrote a native SQL instead of Hibernate SQL to generate complexes SQL command. Following is record from Steve's Email:

We found out what the problem was attributed to. It was a very strange and quite frankly a misleading performance issue within Hibernate during the loading of the resultset into memory. We couldn’t pinpoint why it was failing (so slow), but were able to narrow down by a process of elimination (poor elimination). It turns out that we know the issue is one of two things:

· Running Hibernate on Solaris

· Running Hibernate using JDK 1.5

We really don’t care what the issue is because we’ve figured out how to tweak the code and fixed the problem.
Posted by Sunny Young at 5/31/2006 07:43:00 PM

Tapesty group pick up my question.

It's happy to know that Tapestry group pick up my question about 508 compliance on ALT tag on FormTable. To work a way around, I just use Javascript to assign it when body onload.

for (i = 11; i< 14; i++) {
myImage = document.getElementsByTagName('img')[i];
if (myImage != null && myImage != 'undefined') {
if (myImage.src.indexOf('arrow-up.gif')>0) {
myImage.setAttribute('alt','Sort Ascending');
} else if (myImage.src.indexOf('arrow-down.gif')>0) {
myImage.setAttribute('alt','Sort Descending');
}
}
}

Posted by Sunny Young at 5/31/2006 01:53:00 PM

Tapestry: LinkSubmit problem for browsing back

The way to fix it:Copy the LinkSubmit.jwc and LinkSubmit.java file from Tapestry. Rename it and extend to LinkSubmit.java

// make sure the submit function is on the page (once)

if (cycle.getAttribute(ATTRIBUTE_FUNCTION_NAME) == null)

{

Add This =>>body.addInitializationScript("document." + formName + "._linkSubmit.value = null;");

body.addBodyScript("function submitLink(form, elementId) { form._linkSubmit.value = elementId; if (form.onsubmit == null form.onsubmit()) form.submit(); }");

cycle.setAttribute(ATTRIBUTE_FUNCTION_NAME, this);}

Please refer this to http://mail-archives.apache.org/mod_mbox/jakarta-tapestry-dev/200506.mbox/%3C594252918.1118656487914.JavaMail.jira@ajax.apache.org%3E
Posted at 5/25/2006 08:10:00 PM

Release Project Procedure

Update release-note-xx.docCommit it
-
Update Label
-
Run label (.bat) file
-
Base on CVS Diff, write the release note
-
Posted at 5/25/2006 07:54:00 PM

Migration db from Production to Local

-
Export data from production (configuration is from "property" file)to local though SQL Server/import
-
Export data to cache ant -f migration.xml save-export
-
Commit export-data.zip to CVS
To import into database use ant -Denvironment=qa migrate-db-cached
Posted at 5/25/2006 05:58:00 PM 0 comments

Cannot logon to Microsoft Shared Point on Windows 2003

To solve this problem, set sucurity directly under Website instead of under Shared point web site.- Check Basic authentication only.- Assign domain name in the text field.
Posted at 5/24/2006 11:05:00 AM

Baseball Ticket

Just got ticket for tonight National with Houston. Lucky...
Posted at 5/22/2006 02:02:00 PM

It's me

This is me, the world I have.
I wish category can be apply on blog.
Posted at 5/22/2006 01:14:00 PM