cycle error on cloning linq object

error: "Object graph for type 'TestLinq.PersonAddress' contains cycles and cannot be serialized if reference tracking is disabled.”

solution: change the 'Serialization Mode' to 'Unidirectional'.

source: http://stackoverflow.com/questions/1432501/clone-linq-object-error-object-graph-for-type-testlinq-personaddress-contains

clone linq object

///



/// Clones any object and returns the new cloned object.
///

/// The type of object.
///
The original object./// The clone of the object.
public static T Clone(T source)
{
var dcs = new DataContractSerializer(typeof(T));
using (var ms = new System.IO.MemoryStream())
{
dcs.WriteObject(ms, source);
ms.Seek(0, System.IO.SeekOrigin.Begin);
return (T)dcs.ReadObject(ms);
}
}


source:http://stackoverflow.com/questions/2178080/linq-to-sql-copy-original-entity-to-new-one-and-save

session killer script

this one line of script is a killer of asp.net session on ie 7, 8, and 9 browsers (maybe ie6, i didn't test it):

$(document).ready(function() {
// for remembering the selected tabs
$("div[id*='tabs']").tabs({ cookie: { expires: 999, name: this.id }, cache: false, collapsible: true });
}

script'i 2 parça halinde yazmak buna neden oluyor.


//        // for remembering the selected tabs
        //        $("div[id*='tabs']").tabs({ cookie: { expires: 999, name: this.id }, cache: false, collapsible: true });

        // fade effect
        $("div[id*='tabs']").tabs({
            fx: {
                opacity: 'toggle',
                duration: 'fast'
            },
            cookie: { expires: 999, name: this.id }, cache: false, collapsible: true
        });

t-sql find object references

select object_name(object_id), OBJECT_DEFINITION(object_id)
from sys.objects
where OBJECT_DEFINITION(object_id) like '%CDS%' and type='P'

örn: ProductId alanının kullanıldığı sp'ler.

streamreader encoding

sorun: doğru encoding verilmezse türkçe karakterler okunamıyor.

çözüm:
StreamReader sr = new StreamReader("ornek.txt", Encoding.GetEncoding("windows-1254"));
textBox1.Text = sr.ReadToEnd();

Value cannot be null. Parameter name: name

add web reference ile web service eklenirken, veya web service çalıştırılırken, dbml'in güncel olmaması nedeniyle bulunamayan nesneler (stored procedure vb.) bu hataya neden olabiliyor.

indexed view with schemabinding

ALTER VIEW [dbo].[Vw_View1] WITH SCHEMABINDING AS
SELECT ...
FROM ...

CREATE UNIQUE CLUSTERED INDEX [IX_Index1] ON [dbo].[Vw_View1]
(
[Column1] ASC
)
GO

related errors:
Cannot create index on view  because the view is not schema bound.

http://www.mssqltips.com/tip.asp?tip=1610

checkboxlist prerender

protected void cblDilekceTipi_PreRender(object sender, EventArgs e)
{
foreach (ListItem item in cblDilekceTipi.Items)
{
item.Text = item.Text.Replace(" Dilekçesi", "");
}
}

ie6 background image

{ background: transparent url('../img/external.gif') no-repeat; padding-left: 10px; height: 20px; float: left; position: relative; filter: alpha(opacity=40); opacity: .40; }

the critical points are bold.

fixed bottom bar (facebook style) with jquery

http://ryan.rawswift.com/2009/02/15/fixed-that-bar-at-the-bottom-like-facebook/

search this blog (most likely not here)