Sun Application Server Startup Command: /opt/SUNWappserver/bin/asadmin start-domain --domaindir /opt/SUNWappserver/domains --user admin

Thursday, December 27, 2007

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.

Tuesday, October 23, 2007

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.

Wednesday, September 26, 2007

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>

Thursday, August 23, 2007

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;

Wednesday, July 18, 2007

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]#

Friday, July 06, 2007

No copy and paste on textfield

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

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

Tuesday, July 03, 2007

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

Thursday, May 17, 2007

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)

Creating a custom Site Definition in MOSS 2007

1. Go to: C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\SiteTemplates, Then copy the sts directory and paste it in the same directory. Rename the Copy of sts directory to CustomSite

2. Go to: C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\1033
Copy the sts directory and paste it to the same directory.
Rename the Copy of STS directory to
CustomSite

3. Under C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\1033\XML
Create a file called WEBTEMPSAMPLE.XML in the following directory:

Put the following XML into the WEBTEMPCustomSite.XML file:

<?xml version="1.0" encoding="utf-8" ?>

<!-- _lcid="1033" _version="12.0.4017" _dal="1" -->

<!-- _LocalBinding -->

<Templates xmlns:ows="Microsoft SharePoint">

<Template Name="PSIWeb" ID="10002">

<Configuration ID="0" Title="Custom Site" Hidden="FALSE" ImageUrl="/_layouts/images/stsprev.png" Description="This sample template creates a site for teams to create, organize, and share information quickly and easily. It includes a Document Library, and basic lists such as Announcements, Calendar, Contacts, and Quick Links." DisplayCategory="CustomSite Definitions" > </Configuration>

<!-- <Configuration ID="1" Title="Custom Blank Site" Hidden="FALSE" ImageUrl="/_layouts/images/stsprev.png" Description="This sample template creates a Windows SharePoint Services-enabled Web site with a blank home page. You can use a Windows SharePoint Services-compatible Web page editor to add interactive lists or any other Windows SharePoint Services features." DisplayCategory="Custom Site Definitions" > </Configuration>

<Configuration ID="2" Title="Custom Document Workspace" Hidden="FALSE" ImageUrl="/_layouts/images/dwsprev.png" Description="This sample template creates a site for colleagues to work together on documents. It provides a document library for storing the primary document and supporting files, a Task list for assigning to-do items, and a Links list for resources related to the document." DisplayCategory="Custom Site Definitions" > </Configuration> -->

</Template>

</Templates>

4. Restart IIS:
Start/Run/cmd ENTER
Run this command iisreset


Thursday, April 26, 2007

ASP: Permission denied 'CreateObject' for creating Word.Application in Windows 2003

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.

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!

Thursday, April 05, 2007

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.

Friday, March 30, 2007

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>

Monday, March 12, 2007

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:

Tuesday, March 06, 2007

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'

Friday, February 02, 2007

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

Thursday, February 01, 2007

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!

Friday, January 19, 2007

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

Wednesday, January 10, 2007

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>

Wednesday, January 03, 2007

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)