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月23日 星期三
2011年3月11日 星期五
Truncate Log file in SQL Server 2008: Shrink database
BACKUP log with truncate_only
DBCC SHRINKfile(2, 1, truncateonly)
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".
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
select decode(translate('123456','1234567890','Y'),'Y','Y','N') from dual
2010年12月17日 星期五
Save Attachment
I don't know if this is work but just for reference.
///
/// Programmatically Attach document in SPDocument Library
///
void documentAttachmentInSPList()
{
//SPListItem spListItem = null; //write code to get the SPListItem.
//fileUpload is control ID of ASP.Net FileUpload control
if (!string.IsNullOrEmpty(fileUpload.FileName))
{
//Get file extension ( *.doc OR *.docx )
string fileExtension
= fileUpload.FileName.Substring(fileUpload.FileName.IndexOf("."));
//FILENAME is file name visible in SPListItem
//Check file is already added or not. If added then delete it.
for (int i = 0; i < spListItem.Attachments.Count; i++)
{
if ((spListItem.Attachments[i] != null)
&& (spListItem.Attachments[i].Equals("FILENAME" + fileExtension)))
{
spListItem.Attachments.Delete("FILENAME" + fileExtension);
break;
}
}
//Attach the file.
spListItem.Attachments.Add("FILENAME" + fileExtension, fileUpload.FileBytes);
//LISTNAME is SPList's name
//See the attached file as link in user-created custom column.
string attachmentURL = Request.Url.Scheme + "://" + Request.Url.Authority
+ "/Lists/" + "LISTNAME" + "/Attachments/" + spListItem.ID + "/";
spListItem["Attached File"]
= attachmentURL + "FILENAME" + fileExtension + ", View FILE";
}
}
///
/// Programmatically Attach document in SPDocument Library
///
void documentAttachmentInSPList()
{
//SPListItem spListItem = null; //write code to get the SPListItem.
//fileUpload is control ID of ASP.Net FileUpload control
if (!string.IsNullOrEmpty(fileUpload.FileName))
{
//Get file extension ( *.doc OR *.docx )
string fileExtension
= fileUpload.FileName.Substring(fileUpload.FileName.IndexOf("."));
//FILENAME is file name visible in SPListItem
//Check file is already added or not. If added then delete it.
for (int i = 0; i < spListItem.Attachments.Count; i++)
{
if ((spListItem.Attachments[i] != null)
&& (spListItem.Attachments[i].Equals("FILENAME" + fileExtension)))
{
spListItem.Attachments.Delete("FILENAME" + fileExtension);
break;
}
}
//Attach the file.
spListItem.Attachments.Add("FILENAME" + fileExtension, fileUpload.FileBytes);
//LISTNAME is SPList's name
//See the attached file as link in user-created custom column.
string attachmentURL = Request.Url.Scheme + "://" + Request.Url.Authority
+ "/Lists/" + "LISTNAME" + "/Attachments/" + spListItem.ID + "/";
spListItem["Attached File"]
= attachmentURL + "FILENAME" + fileExtension + ", View FILE";
}
}
2010年11月17日 星期三
Show Menu on Blank aspx page
Remove from page:
<asp:Content ContentPlaceHolderId="PlaceHolderLeftNavBar" runat="server"></asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderNavSpacer" runat="server"></asp:Content>
Find the "PlaceHolderPageImage" and add image:
<asp:Content ContentPlaceHolderId="PlaceHolderPageImage" runat="server"><IMG SRC="/_layouts/images/blank.gif" width=1 height=1 alt=""></asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderLeftNavBar" runat="server"></asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderNavSpacer" runat="server"></asp:Content>
Find the "PlaceHolderPageImage" and add image:
<asp:Content ContentPlaceHolderId="PlaceHolderPageImage" runat="server"><IMG SRC="/_layouts/images/blank.gif" width=1 height=1 alt=""></asp:Content>
2010年11月12日 星期五
Get Url for Current page
To Ensure the page is reachable. User:
SPUtility.GetPageUrlPath(HttpContext.Current));
SPUtility.GetPageUrlPath(HttpContext.Current));
2010年11月11日 星期四
Save Multiple Users into SharePoint List
SPFieldUserValueCollection pmCollection = new SPFieldUserValueCollection();
for...{
SPUser user= SPContext.Current.Site.RootWeb.AllUsers[your username];
SPFieldUserValue UserName = new SPFieldUserValue(web, user.ID, user.ID.ToString());
pmCollection.Add(UserName);
}
SPContext.Current.ListItem[your field name] = pmCollection;
// save item
SaveButton.SaveItem(SPContext.Current, false, string.Empty);
SPContext.Current.ListItem.Update();
for...{
SPUser user= SPContext.Current.Site.RootWeb.AllUsers[your username];
SPFieldUserValue UserName = new SPFieldUserValue(web, user.ID, user.ID.ToString());
pmCollection.Add(UserName);
}
SPContext.Current.ListItem[your field name] = pmCollection;
// save item
SaveButton.SaveItem(SPContext.Current, false, string.Empty);
SPContext.Current.ListItem.Update();
2010年11月8日 星期一
Create List Item Menu on Specific List
1. Goto "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES" and create a folder (Exampel: CustomListItemMenu )
2. Create “Feature.xml”
<?xml version="1.0" encoding="utf-8" ?>
<Feature xmlns="http://schemas.microsoft.com/sharepoint/"
Id="{C7B4AEEE-88D8-46eb-80AB-666228D19280}"
Scope="Web"
Title="Custom Action ***"
Version="1.0.0.0"
Description="Anything you can input">
<ElementManifests>
<ElementManifest Location="MenuItems.xml"/>
</ElementManifests>
</Feature>
3. Create “MenuItems.xml” which can be named anything else as long as you provide appropriate reference in “ElementManifest” section described above. Here is what we’ll have in our “MenuItems.xml”:
<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
Id="Name of the action"
RegistrationType="ContentType"
ShowInLists = "True"
RegistrationId="0x010060E9BA54FF561C4E8F05788698ABF445"
Location="EditControlBlock"
Sequence="101"
Title="Open as Word 2003***"
>
<UrlAction Url="~site/_layouts/CustomAction.aspx?ID={ItemId}& amp;List={ListId}"/>
</CustomAction>
</Elements>
NOTE:
You need to find out
RegistrationType="ContentType" RegistrationId="0x010060E9BA54FF561C4E8F05788698ABF445"
1. Go Setting => List Settings => Advanced Settings
2. Select the Yes radio button on the “Allow management of content types”
3. Click OK
4. On the Setting page. Find the Content Type section and click on "item" or your default content type"
5. Copy the “ctype” value in URL as your RegistrationId
6. Copy this value into the RegistrationId attribute
If you want to do list type. Setting is:
RegistrationType="List"
RegistrationId="100"
RegistrationId = templateID
Go here to find out.
4. The key item in the definition above is to set the “RegistrationId” to the “ListTemplate” value we have taken down earlier. This will ensure the context menu item will be attached only to the types we have specified.
stsadm -o deactivatefeature -name CustomListItemMenu -url http://site -force
stsadm -o uninstallfeature -name CustomListItemMenu -force
stsadm -o execadmsvcjobs
stsadm.exe -o installfeature -name CustomListItemMenu
stsadm.exe -o activatefeature -name CustomListItemMenu -url http://site -force
stsadm -o execadmsvcjobs
iisreset
2. Create “Feature.xml”
<?xml version="1.0" encoding="utf-8" ?>
<Feature xmlns="http://schemas.microsoft.com/sharepoint/"
Id="{C7B4AEEE-88D8-46eb-80AB-666228D19280}"
Scope="Web"
Title="Custom Action ***"
Version="1.0.0.0"
Description="Anything you can input">
<ElementManifests>
<ElementManifest Location="MenuItems.xml"/>
</ElementManifests>
</Feature>
3. Create “MenuItems.xml” which can be named anything else as long as you provide appropriate reference in “ElementManifest” section described above. Here is what we’ll have in our “MenuItems.xml”:
<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
Id="Name of the action"
RegistrationType="ContentType"
ShowInLists = "True"
RegistrationId="0x010060E9BA54FF561C4E8F05788698ABF445"
Location="EditControlBlock"
Sequence="101"
Title="Open as Word 2003***"
>
<UrlAction Url="~site/_layouts/CustomAction.aspx?ID={ItemId}& amp;List={ListId}"/>
</CustomAction>
</Elements>
NOTE:
You need to find out
RegistrationType="ContentType" RegistrationId="0x010060E9BA54FF561C4E8F05788698ABF445"
1. Go Setting => List Settings => Advanced Settings
2. Select the Yes radio button on the “Allow management of content types”
3. Click OK
4. On the Setting page. Find the Content Type section and click on "item" or your default content type"
5. Copy the “ctype” value in URL as your RegistrationId
6. Copy this value into the RegistrationId attribute
If you want to do list type. Setting is:
RegistrationType="List"
RegistrationId="100"
RegistrationId = templateID
Go here to find out.
4. The key item in the definition above is to set the “RegistrationId” to the “ListTemplate” value we have taken down earlier. This will ensure the context menu item will be attached only to the types we have specified.
stsadm -o deactivatefeature -name CustomListItemMenu -url http://site -force
stsadm -o uninstallfeature -name CustomListItemMenu -force
stsadm -o execadmsvcjobs
stsadm.exe -o installfeature -name CustomListItemMenu
stsadm.exe -o activatefeature -name CustomListItemMenu -url http://site -force
stsadm -o execadmsvcjobs
iisreset
2010年9月28日 星期二
64 bit: Cannot recycle connection pool
Error:
C:\WINDOWS\SysWOW64>iisapp.vbs /a "SharePoint - 80" /r
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
Input Error: Can not find script file "C:\WINDOWS\system32\iisapp.vbs".
Solution:
I copied iisapp.vbs, cmdlib.wsc and iisschlp.wsc over from %WINDIR%\System32 to %WINDIR%\SysWOW64
I registered cmdlib.wsc and iisschlp.wsc using regsvr32 cmdlib.wsc and regsvr32 iisschlp.wsc respectively
C:\WINDOWS\SysWOW64>iisapp.vbs /a "SharePoint - 80" /r
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
Input Error: Can not find script file "C:\WINDOWS\system32\iisapp.vbs".
Solution:
I copied iisapp.vbs, cmdlib.wsc and iisschlp.wsc over from %WINDIR%\System32 to %WINDIR%\SysWOW64
I registered cmdlib.wsc and iisschlp.wsc using regsvr32 cmdlib.wsc and regsvr32 iisschlp.wsc respectively
訂閱:
文章 (Atom)