Archive for October 18, 2008

function html to text

function htmltotext($html)
{
$tags = array (
0 => ‘~<h[123][^>]+>~si’,
1 => ‘~<h[456][^>]+>~si’,
2 => ‘~<table[^>]+>~si’,
3 => ‘~<tr[^>]+>~si’,
4 => ‘~<li[^>]+>~si’,
5 => ‘~<br[^>]+>~si’,
6 => ‘~<p[^>]+>~si’,
7 => ‘~<div[^>]+>~si’,
);
$html = preg_replace($tags,”\n”,$html);
$html = preg_replace(‘~</t(d|h)>\s*<t(d|h)[^>]+>~si’,’ – ‘,$html);
$html = preg_replace(‘~<[^>]+>~s’,”,$html);

$html = preg_replace(‘~ +~s’,’ ‘,$html);
$html = preg_replace(‘~^\s+~m’,”,$html);
$html = preg_replace(‘~\s+$~m’,”,$html);

$html = preg_replace(‘~\n+~s’,”\n”,$html);
return $html;
}

Advertisements

October 18, 2008 at 10:12 am Leave a comment

function error php

function error( $message )
{

echo ‘<div style=”color:red;font-weight:bold;font-size:12pt;font-family:monospace”>’.
“infobox::$message</div>”;

} // eof error()

October 18, 2008 at 10:09 am Leave a comment

Function php infoboxes with cookie

function infoboxes()
{
if( isset( $_COOKIE[‘infoboxes’] ))
{
if( $this->debug) echo $_COOKIE[‘infoboxes’];

$this->showinfoboxex = ( $_COOKIE[‘infoboxes’] == ‘ON’ );
}
}

October 18, 2008 at 10:08 am Leave a comment

function checkitems combolbox list c-sharp

public void CheckItem(string sItem)
{
for (int i = 0; i < cblPinakes.Items.Count; i++)
{

if (cblPinakes.Items[i].ToString() == sItem)
{
cblPinakes.SetItemChecked(i, true);
cblPinakes.SetSelected(i, true);
}
}
}

October 18, 2008 at 10:05 am Leave a comment

Function c# Load tables from sql 2000 -2005

public void Load_Tables()
{

dataSetPinakes.Tables[0].Clear();
System.Data.SqlClient.SqlCommand sqlcmdselect = new SqlCommand();
sqlcmdselect.CommandText = “select name, ‘0’ as see  from sysobjects where xtype=’U'” ;
sqlcmdselect.Connection = MSSqlcon;
System.Data.SqlClient.SqlDataAdapter sqlDataAdapter_kos = new SqlDataAdapter();
sqlDataAdapter_kos.SelectCommand = sqlcmdselect;

try
{
sqlDataAdapter_kos.Fill(dataSetPinakes.Tables[0]);

DataRow[] row_select = dataSetPinakes.Tables[0].Select();
cblPinakes.Items.Clear();
for (int bb = 0; bb < row_select.Length; bb++)
{

object obj = row_select[bb][0].ToString();
cblPinakes.Items.Add(obj);

}

DataTable dt = dataSetPinakes.Tables[0].Copy();
dt.Clear();
dt.ReadXml(“Tables.xml”);

DataRow[] rowsel = dt.Select();
for (int ii = 0; ii < rowsel.Length; ii++)
{
if (rowsel[ii][1].ToString() == “1”)
{
CheckItem(rowsel[ii][0].ToString());
}
}

}
catch (Exception ex)
{ MessageBox.Show(ex.ToString()); }

}

October 18, 2008 at 10:03 am Leave a comment

isIdentity sql query

select COLUMNPROPERTY(object_id(‘tmp’),’id1′,’isIdentity’)
sp_configure ‘allow update’, 1
go
reconfigure with override
go
update syscolumns set colstat = colstat – 1
where id = object_id(‘tmp’)
and name = ‘id1’
go
exec sp_configure ‘allow update’, 0
go
reconfigure with override
go

October 18, 2008 at 10:02 am Leave a comment

Function c# run sql destination

public void runsqldestination(string query)
{

string sqlupd = query;

SqlCommand cmd6 = new SqlCommand(sqlupd, MSSqlcon2);
cmd6.CommandTimeout = 99920;

try
{
cmd6.ExecuteNonQuery();

}

catch
{ MessageBox.Show(” Error ! “); }
}

October 18, 2008 at 9:59 am Leave a comment

Older Posts


October 2008
M T W T F S S
« Sep   Feb »
 12345
6789101112
13141516171819
20212223242526
2728293031