Thursday, December 16, 2010

BizTalk: combing two xml message into one

I ran into the situation where I need to combine two messages into one while developing a BizTalk App for Active Directory Integration.
I used SQL typedpooling to get updates of user information from datebase which contains userID and its Manager's ID as well as some other basic user information (comes from Epicor E4SE), since the Active Directory Adapter I was testing only support using DSN to update manager field of AD user, I have to run a AD query first to the the manager's distinguishedName from AD thus the need to combine them into the final Active Update schema.

Inside BizTalk, you select two messages as input and one destination schema as output in a map, let's say the final input is as below:

 <root>  
 <input1>  
 <ManagerID>ABC02</ManagerID>  
 </Input1>  
 <input2>  
 <ad>  
 <filtermatch ObjectPath="LDAP://CN=B\, Miss,OU=Finance,DC=subs,DC=mycompany,DC=com">  
 <property Name="sAMAccountName" Value="ABC01" />  
 <property Name="distinguishedName" Value="CN=B\, Miss,OU=Finance,DC=subs,DC=mycompany,DC=com" />  
 </FilterMatch>  
 <filtermatch ObjectPath="LDAP://CN=B\, Sir,OU=IT Dept,ODC=subs,DC=mycompany,DC=com">  
 <property Name="sAMAccountName" Value="ABC02" />  
 <property Name="distinguishedName" Value="CN=A\, Sir,OU=IT Dept,DC=subs,DC=mycompany,DC=com" />  
 </FilterMatch>  
 </AD>  
 </Input2>  
 </Root>  

the final custom xsl will be as below:

 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">  
 <xsl:output method="xml"/>  
 <xsl:template match="/">  
 <xsl:apply-templates />   
 </xsl:template>  
 <xsl:template match="/">  
 <dsn>  
 <xsl:variable name="Manager" select="Root/Input1/ManagerID/text()" />  
 <xsl:value-of select="Root/Input2/AD/FilterMatch[Property[@Name='sAMAccountName' and @Value=$Manager]][1]/Property[@Name='distinguishedName']/@Value" />  
 </DSN>  
 </xsl:template>  
 </xsl:stylesheet>  

Please note that normally the AD query will only returns 1 record, the reason I put more than one here is to experiment a bit and try to think of the way to handle choosing the right node based on the 'Master' xml input.

The key here is to use a xsl:variable to hold the Key field and use it in the xpath for matching up Xml Node.

So far I have managed to integrate Active Directory, our ERP system (Epicor E4SE) and infopath form together to achieve the 'single point of truth' for user records in a pilot. will write more about details sometime later.

Monday, November 15, 2010

Update List Column Programmatically for SharePoint 2007

Two ways of doing this:

First one is via SharePoint object model:


SPList oList = oWeb.Lists["Technical"];
SPField myField = oList.Fields["Sub-tag"];
String schema = " xx ";
myField.SchemaXml = schema;
myField.Update();


the Second way is via Lists.asmx web service:

XmlNode listNode = mylistsrv.GetList("Technical");
string version = listNode.Attributes["Version"].Value;
string guid = listNode.Attributes["Name"].Value;

XmlDocument xmlDoc = new XmlDocument();
XmlElement updateFields = xmlDoc.CreateElement("Fields");

string fieldXml = "";

updateFields.InnerXml = fieldXml;
XmlNode result = mylistsrv.UpdateList(guid, null, null, updateFields, null, version);

Thursday, July 8, 2010

Adding a button with javascript to sharepoint page

By putting a content editor web part with the following:


<BUTTON onclick="window.location.href='http://intranet/Legal/contracts/Search_URL.aspx?Project_Number='+document.location.href.substr(42,7)">Load\View Project Contracts</BUTTON>

Thursday, July 1, 2010

some useful reference about Kerberos Authentication

- How to: Enable Kerberos Authentication on a SQL Server Failover Cluster

http://msdn.microsoft.com/en-us/library/ms189585%28SQL.90%29.aspx

- ISA Server 2006 does not support using cross-domain or cross-forest trusts to include more than one Active Directory domain in a Kerberos constrained delegation scenario.

http://technet.microsoft.com/en-us/library/bb794858.aspx

Monday, June 21, 2010

Deploying a .NET workflow onto a SharePoint List

1. Copy the DLL your workflow creates from the build directory ( inDebug) to the Global Assembly Cache (GAC)
2. Create a directory in the features directory [C:Program FilesCommon Filesmicrosoft sharedWeb Server Extensions12TEMPLATEFEATURES] and drop both the feature.xml and workflow.xml files into the directory.

3. Install the feature on your farm, using the following command line statements
stsadm -o installfeature -name DocumentMoveAndShortcut

4. Activate the feature to a site collection

stsadm -o activatefeature -name DocumentMoveAndShortcut -url http://moss2007win2008

(or by going thru the site collection settings:
Activate the newly installed feature by navigating to the "Site Collection Features" page, under "Site Action" -> "Site Settings". Scroll down until you see "New Task Workflow", and click "Activate":)

From:

http://vspug.com/andynoon/2008/02/06/sharepoint-2007-workflow-with-visual-studio-2008/
http://philwicklund.com/archive/2008/02/12/deploying-a-net-visual-studio-workflow-into-a-sharepoint-list-in-10-easy-steps-part-2-of-2-deploying-the-workflow.aspx

Monday, June 14, 2010

Business Data Catalog & Custom List

A new notes:

1. With Microsoft ® Business Data Catalog Definition Editor, there is need to manually change MethodInstance to Type "Finder";
2. Unless Single Signin is implemented, the ADF need to have 'RevertToSelf' as authentication mode rather than 'PassThrough';

3. make sure MOSS user have access to database used here;


Here is a link about using SSIS to importing data into sharepoint custom list:

http://www.onlinetechblog.com/blog/index.php/2009/07/how-import-data-to-sharepoint-list-using-ssis/

Thursday, April 15, 2010

"Transaction context in use by another session" and linked server

if you use linked server and loopback server then call SPs using the linked server, this scenario is not supported.

you will need to modify the code to call the SP directly.

Tuesday, March 23, 2010

Get Tomcat installation directory in Java

System.getProperty("catalina.base")

Excel VBA - "operation is not allowed when the object is closed"

This is normally caused by the stored procedure called, you will need to place 'set nocount on' on top of the SP to eliminate the extra information returned.

Monday, March 1, 2010

Mission Critical: SQL Server 2008 General Maintenance

Mission Critical: SQL Server 2008 General Maintenance

15 February 2010

by Buck Woody

 

CTL10.02.001

Revision 09/21/2009 A

SQL Server 2OO8

General Maintenance

CRITICAL TASK LIST PROGRAM

This document contains steps that will assist you in the day-to-day SQL Server 2008 RTM Enterprise Edition (non-clustered) operations. It defines the basics of standard maintenance and checks for a single Instance of SQL Server 2008, and should be used as a starting point.

Review each item, placing a check in the “Confirmed” column when the task line is complete. Any line not marked “Confirmed” should stop the process until you have completed that line item.

This CTL is not meant to be a replacement for the official documentation from the product manufacturer.  

CTL NUMBER

This Critical Task List is identified by a CTL number in the upper right-hand side of this document. You should use the latest CTL (identified by the date and an alpha-numeric code.

HOW TO BE ASSURED OF HAVING LATEST DATA

You can add additional information to this checklist based on your organization’s need.

CONTENT

Critical Task List 10.02.001All content is the sole responsibility of the server owner; Microsoft Corporate provides no warranties implied or implicit in this document. This document is not a product of the Microsoft Corporation. 

SUPPLEMENTS

Official Site Link: (Not available at this revision level)

Whenever you receive a supplement affecting your checklist, write in the appropriate information. Printed replacement checklist pages will be made available to you as quickly as possible. A notation on the bottom inside corner of these pages will indicate that they reflect certain supplements.

COMMENTS AND QUESTIONS

Comments and questions should be directed through buck.woody@microsoft.comCritical Task Lists Managers

Buck Woody “Real World DBA”(MSFT U.S.).

Frequency

Task

References

Confirmed

Post-Installation

Server and Database Settings Configured for Environment.

http://bit.ly/H6z28

http://bit.ly/1zwba

 

 

Latest Service Packs Installed.

http://bit.ly/196VzN

 

 

Database Mail Configured and Tested.

http://bit.ly/8uEUn

http://bit.ly/RR9xt

 

 

Maintenance Wizard or other Automated Maintenance Implemented.

http://bit.ly/16nhdL

http://bit.ly/Uqoyh

 

 

Baseline Performance Metrics Created and Archived.

 http://bit.ly/gVyI0

 

Daily

Backups Checked.

http://bit.ly/2Ihz0f

 

 

Windows Event Logs Reviewed.

http://bit.ly/1uGRe

 

 

SQL Server Error Logs Reviewed.

http://bit.ly/2Gk967

 

 

Drive Space Checked.

http://bit.ly/3mdRPj

 

 

Jobs History Reviewed.

http://bit.ly/1gm4qM

 

 

Backups Taken.

http://bit.ly/sKgwj

 

 

Indexes Updated.

http://bit.ly/7wpHx

 

 

Statistics Updated.

http://bit.ly/3XGBKA

 

Weekly

Indexes Reviewed.

http://bit.ly/2DpOMR

 

 

Long-Running Queries Reviewed

http://bit.ly/45RCm

 

 

Data Archival Performed.

http://bit.ly/sKgwj

 

 

Security Reviewed.

http://bit.ly/1asALb

 

 

Service Packs and OS Security Bulletins Evaluated and Applied.

http://bit.ly/q46L0

http://bit.ly/pAGp2

 

Monthly

Security Tests Performed.

http://bit.ly/119slV

 

 

New Performance Baseline Recorded.

http://bit.ly/gVyI0

 

 

Restore Tests Performed on Production Server to Backup Server.

http://bit.ly/4vG8s

 

Yearly

Performance Reviews Completed from Baseline Comparisons.

http://bit.ly/gVyI0

 

 

Growth Predictions Created from Baseline Metrics.

http://bit.ly/vWSqS

 

 

Instance Audit Performed.

http://bit.ly/12WPkh

 

 

Version Upgrade Plan Evaluated.

http://bit.ly/e5MIy

 



From http://www.simple-talk.com/sql/database-administration/mission-critical-sql-server-2008-general-maintenance/


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________

Thursday, February 25, 2010

use web service to transfer multiple files at once in c#

I recently wrote a web service for E4SE, eBackoffice and PeachTree financial application (which is a financial app used by a branch office) integration, since our E4SE/EBO servers are running on our data centre while PeachTree app runs at remote office and I don't yet have the access to the remote site, I have decided to write a web service to transfer the data output. I have to point out though, the core EBO procedures were written by our colleague not by me:-)

Here are the highly summarized steps:

1. use zip lib (dotnetzip etc) to compress multiple files into 1 archive;
2. Create web service method that has a return type of byte array, read the content of the zip archive and return it;
3. on client side, call the web service and catch the returned value into a MemoryStream, flush it into filestream;
4. if neccessary, write code to extract the zip file automatically

Sunday, February 14, 2010

Transparent Proxy with squid

squid.conf:

* httpd_accel_host virtual
* httpd_accel_port 80
* httpd_accel_with_proxy on
* httpd_accel_uses_host_header on
* acl our_networks src xx.xx.xx.xx yy.yy.yy.0/24
//xx.xx.xx.xx -> ip for outgoing interface
//yy.yy.yy.0 -> internal IP
* http_access allow our_networks
* http_access allow localhost
* http_access deny all


Script for iptables:

// eth0 -> internal NIC
// eth1 -> outgoing NIC
iptables --flush # Flush all the rules in filter and nat tables
iptables --table nat --flush
iptables --delete-chain
iptables --table nat --delete-chain
iptables --table nat --append POSTROUTING --out-interface eth1 -j MASQUERADE
iptables --append FORWARD --in-interface eth0 -j ACCEPT
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128

policy based route and transparent proxy

Consider the following scenario:
you have a default gateway that connects to corporate WAN as well as providing external access, since internet access is occupying a significant amount of bandwidth, you want to redirect internet traffic to an alternative internet connection, probably local broadband link.

I have been thinking about a way to achieve this for sometime and came up with the idea:

1. use a logon scirpt to define route, direct all corporate traffic to use corporate WAN gateway and external access to use the alternative connection.
2. install linux + squid + iptables on the machine that connect directly to the local broadband, configure it as a transparent proxy to take advantage of caching.

this hasn't been tested yet, hopefully I will be able to build the lab when I get some spare time.

Continued:

this approach seems to be bit buggy and may not be the best option, I am looking into the following relevant topic: PBR, WPAD, WCCP and hopefully will find out something more robust.

the best way I can think of now is to add an interface to the WAN router which connect to the transparent proxy, configure the router with static route to corporate WAN interface for internal traffic and all other traffic to go thru the transparent proxy.

Thursday, February 11, 2010

A simple iptables config file

*filter
-A INPUT -i lo -j ACCEPT
# -A INPUT –p tcp --syn -m limit --limit 5/second -j ACCEPT
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 8080 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 53 -j ACCEPT
-A INPUT -p udp -m udp --dport 53 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 25 -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -s [IPADDR] -j DROP
-A INPUT -j DROP
COMMIT

Sunday, January 17, 2010

setting up exchange 2007 on a single server without edge server

1. install all exchange 2007 roles except edge server;
2. configure mx record;
3. create send connector;
4. create receive connector (internet) and enable anonymous access;
5. add accepted domain address space;
6. map owa web address to external web;

Sunday, January 10, 2010

KB970876 - Error 1316.A network error occurred while attempting to read from the file SSCERuntime-ENU.msi

You may receive "Error 1316.A network error occurred while attempting to read from the file Path\SSCERuntime-ENU.msi" error message when you repair an instance SQL Server 2008

http://support.microsoft.com/kb/970876

vmware vcb backup & CLi commands

VCB Backup with/without VC:

vcbmounter -h virtualcenter -u vcbadmin -p MyPassword1 -a name:blackberry -r e:\vcbbackup\blackberry -t fullvm -m san
vcbmounter -h esxi host -u vcbadmin -p MyPassword1 -a name:blackberry -r e:\vcbbackup\blackberry -t fullvm -m ndb

Manage VM:

(Esxi 4)
vim-cmd vmsvc/getallvms
vim-cmd vmsvc/power.off vmid
vim-cmd vmsvc/power.on vmid
vim-cmd vmsvc/power.reboot vmid

host_shutdown.sh

(ESx 3.5)
# vmware-cmd -l
# vmware-cmd /nas/vms/FreeBSD/FreeBSD.vmx start|stop|reset|suspend|getstat

shutdown -h now


References:
http://www.cyberciti.biz/tips/vmware-cmd-utility-examples.html
http://robertbchase.blogspot.com/2008/12/vmware-esxi-ssh-cli-commands.html

Elevating LLM Deployment with FastAPI and React: A Step-By-Step Guide

  In a   previous exploration , I delved into creating a Retrieval-Augmented-Generation (RAG) demo, utilising Google’s gemma model, Hugging ...