04.04.2010
Categories: english | Add a Comment
public static T Clone(T source) { if (!typeof(T).IsSerializable) { throw new ArgumentException("The type must be serializable.", "source"); } if (Object.ReferenceEquals(source, null)) { return null; } IFormatter formatter = new BinaryFormatter(); Stream stream = new MemoryStream(); using (stream) { formatter.Serialize(stream, source); stream.Seek(0, SeekOrigin.Begin); return (T)formatter.Deserialize(stream); } }
04.04.2010
Categories: english | Add a Comment
protected void mail(){ string Server = "smtp.googlemail.com"; int port = 587; SmtpClient cl = new SmtpClient(Server, port); cl.EnableSsl = true; MailMessage msg = new MailMessage(); cl.Credentials = new System.Net.NetworkCredential("***@googlemail.com", "***"); { msg.From = new MailAddress("***@googlemail.com"); msg.To.Add(new MailAddress("***@googlemail.com")); msg.Subject = "test"; msg.IsBodyHtml = true; msg.Body = "test2"; } cl.Send(msg); }
04.04.2010
Categories: english | Add a Comment
To iterate through Javascript objects you can simply use the for each statement.
04.04.2010
Categories: english | Add a Comment
Display Date/Time as GMT in Sql Anywhere select cast('1995-12-15 04:58:08.000' as dateTime) as _d, DATEFORMAT('1995-12-15 04:58:08.000', 'Ddd, DD Mmm YYYY HH:MM:SS') || ' GMT' DATE_LNG, CASE DATEPART(cdw, _d) WHEN 1 then 'Mon' WHEN 2 then 'Tue' WHEN 3 then 'Wed' WHEN 4 then 'Thu' WHEN 5 then 'Fri' WHEN 6 then 'Sat' WHEN 7 then [...]
04.04.2010
Categories: english | Add a Comment
Read XML with BOM Data from GZ file in a SQL Anywhere Database. select cast ( CSCONVERT(decompress(xp_read_file('c:\x.gz')), 'char_charset', 'utf-8', 'read_bom=on' ) as XML)
04.04.2010
With this statement you can select the database methodes currently in use by a connection in a Sql Anywhere database. select isnull(connection_property ('CurrentProcedure',number),'') currentProc, * from sa_conn_info(); The select statement returns the following result where currently no procedure is in use. currentProcNumberNameUseridDBNumberLastReqTimeReqTypeCommLinkNodeAddrClientPortServerPortBlockedOnLockRowIDLockIndexIDLockTableUncommitOps 2SQL_DBC_1972bfe8DBA02010-10-05 19:34:58.765FETCHlocal00000 1Sybase Central 3DBA02010-10-05 19:34:57.229CLOSElocal00000
04.04.2010
Categories: english | Add a Comment
An Interview with Eric Farrar Product Manager on Sybase’s SQL Anywhere Stephan: Hi Eric, First of all thank you very much for taking time to answer a few questions. Articles on your Blog indicate that you are not only a Product Manager but also an experienced developer. Maybe you can introduce yourself a little? Eric: [...]