Monday, April 4, 2016

Word Casing check in BizTalk BRE

I got one reuirement where in I will have any case type of word as an input and i have to put if condition on that word in BizTalk BRE.


Problem : from input schema element value can be come in any casing format(Upper case, Lower case, Camel case)

input schema element should be checked using the BizTalk BRE if statment

Solution : Out of box BizTalk supports Match predicate which checks the elements with regular experssion matches with the left hand oprand.

Predicate : Match

Regular Expression : (?i)vikas\b


Input Schema :

<ns0:PO xmlns:ns0="http://POSchemas.PO">
<POName>vikas</POName>
<PONum>PO_12</PONum>
<POAmount>0</POAmount>
<PODate>2011-01-01</PODate>
<Items>
<ItemName>Screw</ItemName>
<ItemQty>5</ItemQty>
<UnitPrice>2.1</UnitPrice>
<ItemSum>1.2</ItemSum>
</Items>
</ns0:PO>


Test Result :

CONDITION EVALUATION TEST (MATCH) 4/4/2016 4:10:11 AM
Rule Engine Instance Identifier: 5d772604-6224-4e40-8455-656f09ab4807
Ruleset Name: LowerCaseCheck
Test Expression: True == Match(TypedXmlDocument:POSchemas.PO:/PO.POName, (?i)vikas\b)
Left Operand Value: True
Right Operand Value: True
Test Result: True

Hope this will Helps!!!!


Regards,

Sunday, January 4, 2015

How to enable and disable Audio/Video Recording with Microsoft OneNote

During past few days i was encountering the issues of Recording option is disabled and i was not able to records the meetings held client and other senior persons.

After some google analysis i found that some reasons my Recording functionality is stopped/disabled. then i tried to search the options to enable the Recording and i found only one way to achieve it throguh Registry

here is the path where you need to set the approprite option to enable/disable

HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\12.0\OneNote\options\audio

Enable : set 0
Disable : set 1

make sure if you have multiple office versions installed you need to make same changes for all versions.

hope this will be helpful to you!!!!

Tuesday, April 15, 2014

Get Duplicate number of records for a column in one Table using Group By and Having clause

Those who are looking for some solution of how to get the number of duplicate records in a Table for particular rows. here is how we can achieve this requirement.

SELECT G_USER,COUNT(G_USER) FROM USER_PROFILE GROUP BY G_USER HAVING COUNT(G_USER) >1


 Using the Group By and Having clause of T-Sql we can achive this requirement stated in sample above, all you need to do is change the Table name and Column Name with your database objects names.

Hope would be Helpful!!
 

Saturday, November 9, 2013

Query to Check Currently running queries on Database server

If you are looking for which query executing on server you can use the following query to get the result


SELECT sqltext.TEXT,
req.session_id,
req.status,
req.command,
req.cpu_time,
req.total_elapsed_time
FROM sys.dm_exec_requests req
CROSS APPLY sys.dm_exec_sql_text(sql_handle) AS sqltext


if you want to kill some long running query then you can fire following command to terminate the query execution

kill [process id]


Happy Coding.

Wednesday, October 30, 2013

Generate Random Alpha Numeric Number with

When we require to generate unique id without using NEWID() function of sql, here is the good alternative to generate unique alpha nemuric identifier to use at primary key.

DECLARE @alpha_numeric VARCHAR(16)
SET @alpha_numeric=''

SELECT @alpha_numeric=@alpha_numeric+CHAR(n) FROM
( SELECT TOP 16 number AS n FROM master..spt_values WHERE TYPE='p' and (number between 48 and 57 or number between 65 and 90) ORDER BY NEWID()) AS t

SELECT @alpha_numeric


Hope this will be helpful to generating manual alpha numeric identifier.

Happy Coding!!

Saturday, November 20, 2010

configuration management database (CMDB)

Hey Guys,

Before sometime writing to this post i was also among you people about what is CMDB, but after doing some research i came to know that it is very helpful for Enterprise Level Applications and Infrastructure projects.

Here i am sharing some basics with you to familiar with CMDB

DEFINITION -
A configuration management database (CMDB) is a database that contains all relevant information about the components of the information system used in an organization's IT services and the relationships between those components. A CMDB provides an organized view of data and a means of examining that data from any desired perspective. Within this context, components of an information system are referred to as configuration items (CI). A CI can be any conceivable IT component, including software, hardware, documentation, and personnel, as well as any combination of them. The processes of configuration management seek to specify, control, and track configuration items and any changes made to them in a comprehensive and systematic fashion.


The IT Infrastructure Library (ITIL) best practices standards include specifications for configuration management. According to ITIL specifications, the four major tasks of configuration management are:

(1)Identification of configuration items to be included in the CMDB
(2)Control of data to ensure that it can only be changed by authorized individuals
(3)Status maintenance, which involves ensuring that current status of any CI is consistently recorded and kept updated
(4)Verification, through audits and reviews of the data to ensure that it is accurate.

Guys i am sharing only basics of what CMDB is and duties it performs. i am sure you will go far than me and explore more...!!!

Happy Coding

C# program that interfaces with MS Access: Store data (text, image) in an Access database file

1. Open a new Visual C# .NET windows application. Name the project CreateDatabase.

2. Design a form. Add three Textboxes and two Buttons

3. Set Name property of Textboxes to “txtDatabase”, “txtStudentName” and “txtStudentPicture”.

4. Set Name property of Buttons to “btnCreateTable” with text property “Create Table” and “btnSave” with text property “Save”.

5. In the code file add namespace:

using System.Text;

using System.Data.OleDb;

6. Double click on the Button “Create Table” and pest the following code into the “btnCreateTable_Click” event.



OleDbCommand Cmd;
string SQL = "";
OleDbCommand objCmd = new OleDbCommand();

OleDbConnection Con = new OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;data
source=" + txtDatabase.Text + "");

SQL = "CREATE
TABLE tblStudentInfo ([StudentID] COUNTER, [StudentName] TEXT(50), [Picture]
OLEObject)";
Cmd = new
OleDbCommand(SQL, Con);

Con.Open();
objCmd = new OleDbCommand(SQL,
Con);

objCmd.ExecuteNonQuery();
Con.Close();
7. Double click on the Button “btnSave” and pest the following code into the “btnSave_Click” event.

StoreData(ImageToStream(txtStudentPicture.Text));
8. Add the following modules to the code file.

private byte[] ImageToStream(string fileName)

{
Bitmap image = new Bitmap(fileName);
MemoryStream stream = new
MemoryStream();

image.Save(stream, System.Drawing.Imaging.ImageFormat.Bmp);
return stream.ToArray();
}

private void
StoreData(byte[] content)
{

OleDbConnection
conn = new OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;data source="
+ txtDatabase.Text + "");

conn.Open();

if (conn.State.Equals(ConnectionState.Closed))

conn.Open();
try
{
OleDbCommand insert = new OleDbCommand("Insert into tblStudentInfo (StudentName,Picture)
values(@StudentName,@image)", conn);

OleDbParameter
picParameter = insert.Parameters.Add("@StudentName",
OleDbType.VarChar );

picParameter.Value = txtStudentName.Text;

picParameter.Size = 50;
OleDbParameter
imageParameter = insert.Parameters.Add("@image", SqlDbType.Binary);

imageParameter.Value = content;

imageParameter.Size = content.Length;

insert.ExecuteNonQuery();
MessageBox.Show("Data
Stored successfully");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
MessageBox.Show(ex.StackTrace.ToString());
}
finally
{

conn.Close();
}
}
9. Press F5 to build and run the project.

Put your database name with location like c:\MyAccessDB in the text box “txtDatabase”, put student name in the text box “txtStudentName” and put student picture path in the text box “txtStudentPicture” then press the “Create Table” Button and after that press “Save” button to save the student information to the database table.