jquery - asp.net autocomplete

http://www.eggheadcafe.com/tutorials/aspnet/18b6a1fa-a7cf-4507-84f2-15056fe65bb7/autocompletion-with-jque.aspx

ek:


  1. <script type="text/javascript">  
  2.    $(document).ready(function() {  
  3.        $("input#<%=txtKelime.ClientID %>").autocomplete('Ara.aspx').result(function(event, item) {  
  4.            $("#<%=txtGizliAlan.ClientID %>").val(item.toString().split(",")[1]);  
  5.        });  
  6. });      
  7. script>  
  8.   
  9. <form runat="server" id="form1">  
  10.     <asp:textbox id="txtKelime" runat="server">  
  11.     <asp:textbox id="txtGizliAlan" runat="server" style="display:none">  
  12. asp:textbox>asp:textbox>form> 


linq to sql - [error] row not found or changed

I solved this error by redragging over a table from the server explorer to the designer and re-building. So indeed, the designer was out-of-synch with the actual SQL Table.

http://social.msdn.microsoft.com/forums/en-US/linqprojectgeneral/thread/c672c8ee-bf2a-41b4-bb8b-aa76cc5d9b95/

How to copy data off your Zune

Figured this out earlier today:

I highly recommend backing up these registry values before modifying anything. If you don’t know how to do that, I don’t recommend that you even attempt this right now =)

Make sure your Zune is not plugged in and your Zune software isn’t running
open up regedit by going to the start menu and selecting “run”. Type regedt32 and hit “OK”
Browse to HKEY_LOCAL_MACHINE\System\ControlSet001\Enum\USB\
Search for “PortableDeviceNameSpace”. This should be contained in the Vid_####&Pid_####\########_-_########_-_########_-_########\Device Parameters within the above …\USB\ The ##’s listed here will be numbers and letters specific to your Zune
Change the following values:
EnableLegacySupport to 1
PortableDeviceNameSpaceExcludeFromShell to 0
ShowInShell to 1
Plug in your Zune, and make sure the Zune Software starts up.
Hopefully at this point you can open up “My Computer” and browse your device, though it does NOT show up as a drive letter.
Right now I can access it both as a harddrive and sync through the Zune Software.

[Edit: This was first posted here and ZuneBoards.com after I figured it out. For more information, check out ZuneBoards.com!]

http://phaleux.com/?p=8

asp.net - türkçe karakter sorunu


ASP.Net ile kod yazmaya başlamadan önce yaşamanız muhtemelen olan bir sorunu şimdiden çözelim. Kod yazmaya geçtiğinizde muhtemelen sayfanızda kullandığınız kontrollerde Türkçe karakterlerin yok olduğunu göreceksiniz. Bu yüzden önce bu durumdan nasıl kurtuluruz onu görelim ondan sonra kod yazmaya geçeceğiz…

   Ancak isterseniz kısa biraz bilgi verelim.ASP.Net’in tanımlı karakter kodlama tekniği UTF-8’dir yani siz aşağıdaki ayarlamalardan hiç birini yapmazsanız ASP.Net varsayılan ayar olan UTF-8’i kullanacaktır. İşin güzel tarafı eğer UTF-8 kullanılırsa sayfanıza Türkçe karakterler görebilirsiniz ve hiçbir ayar yapmanıza gerek yoktur; fakat işin kötü tarafı kullandığınız metin editörünüzün UTF-8’i desteklemesi lazım. Eğer bu kodlamayı desteklemeyen bir editör kullanırsanız, editörünüz kodlarınızı ANSI formatında kaydeder ve sizin karakterleriniz yok olur gider…

   Eğer siz UTF-8’i desteklemeyen bir editör kullanıyorsanız (örn:Homesite 4.5) ve Türkçe karakter sorunu yaşamak istemiyorsanız o zaman bütün web tasarımcılarının aşina olduğu bir karakter kodlama yöntemini kullanacağız ISO 8859-9 kodlaması. Bu kod Türkçe için özel bir koddur ve web tasarımı ile az çok uğraşan herkesin bildiği bir koddur. Ancak bu kodlamayı kullanmak için bazı ayarlamalar yapmak lazımdır..

   ISO kodlamasını kullanarak ASP.Net’te Türkçe karakter sorunu yaşamamak için web.config dosyasında ve sayfamızda ayarlar yapmamız lazım.

   Web.config dosyayı bildiğiniz gibi ASP.Net uygulamalarımız hakkında bazı ayarları yapmamızı sağlayan ve bu ayarları barındıran XML dosyasıdır. Aşağıda Türkçe karakter ayarı yapılmış bir web.config dosyasının kodları var. Ancak bu sadece bizi ilgilendiren kısmı, normalde bu sayfada daha çok şey var.






   Şimdi .aspx uzantılı sayfalarımızda yapacağımız ayara geçelim.ASP.Net sayfamızın “Page Directive”’inde yani ile başlayan satırında da Türkçe karakter kullanacağımızı belirtmemiz lazım. Bu satır aşağıdaki gibi olmalıdır.



   Ama bir dakika, bu da ne? 25899, hani biz ISO kullanıyorduk? Bu sayı ASP.Net’te bizim iso-8859-9 ‘a denk düşen bir kodlama.

   Eğer yukarıdaki 2 ayarı yaptıysanız sayfalarınızda Türkçe karakter sorunu olmaması lazım. Ancak dikkat etmeniz gereken bir nokta web.config te böyle bir kodlamadan bahsederken, sayfamızda kod olarak başka bir dile işaret edecek bir kodlama kullanırsanız sayfalarınızın kafası karışır..

   Sanıyorum artık Türkçe probleminiz kalmamıştır…



http://www.altinsoft.com/destek/haber/370-programlama-dilleri-aspnet-ile-turkce-karakter.html

linq to sql - başka tablolardaki ilişkili kayıtları silmek

bir tablodan bir kayıt silinecekken bu kayıtla ilişkili diğer tablolardaki tüm kayıtlar da otomatik olarak silinmek isteniyorsa...

örnek:
prod tablosundan bir kayıt silinecek ve bunla ilgili olarak prod_lang ve prod_usagaearea tablolarındaki ilişkili kayıtlar da silinecek ise;

prod & prod_lang ve prod & prod_usagearea tabloları arasındaki ilişkiler (associations) 'de delete rule özelliği cascade olarak ayarlanmalı.

linq to sql - left outer join with

            var prod_Langs = from p_l in db.Prod_Langs
                             join p in db.Prods on p_l.ProdID equals p.ProdID
                             join p_ua in db.Prod_UsageAreas on p_l.ProdID equals p_ua.ProdID
                             where (catId == null || catId < 1 || p.CatID == catId)
                                   && (brandId == null || brandId < 1 || p.BrandID == brandId)
                                   && (usageAreaId == null || usageAreaId < 1 || p_ua.UsageAreaID == usageAreaId)
                                   && p_l.LangID == langId
                             select p_l;

yerine


            var prod_Langs = from p_l in db.Prod_Langs
                             join p in db.Prods on p_l.ProdID equals p.ProdID
                             join p_ua in db.Prod_UsageAreas on p.ProdID equals p_ua.ProdID
                                into data from x in data.DefaultIfEmpty()
                             where (catId == null || catId < 1 || p.CatID == catId)
                                   && (brandId == null || brandId < 1 || p.BrandID == brandId)
                                   && (usageAreaId == null || usageAreaId < 1 || x.UsageAreaID == usageAreaId)
                                   && p_l.LangID == langId
                             select p_l;

linq join'i inner join olarak sql'e çeviriyor. left outer join için

into data from x in data.DefaultIfEmpty()

kısmını ekledik.

http://www.oguzyagmur.com/PermaLink,guid,b9fcc750-0e3b-43e4-a9e8-212ee94afa4e.aspx

linq to sql - [error] An attempt was made to remove a relationship between a [mastertable] and a [detailtable]. However, one of the relationship's foreign keys (detailtable.foreignkey1) cannot be set to null


System.InvalidOperationException: An attempt was made to remove a relationship between a Order and a OrderDetail. However, one of the relationship's foreign keys (OrderDetail.OrderID) cannot be set to null.
To fix this we need to indicate to the model that we want to delete the OrderDetail when it's OrderID is set to null. Unfortunately this cannot be done in the O/R designer so you have to open the model in an XML editor. Fortunately, once you change it the designer won't mess with it again unless you remove the class completely. Open the dbml file with the XML Editor (just right-click on it an select "Open with...") and locate the XML that describes the OrderDetail class. Notice the association under the OrderDetail table:
<Table Name="dbo.OrderDetail" Member="OrderDetails">
  <Type Name="OrderDetail">
    <Column Name="OrderDetailID" Type="System.Int32" DbType="Int NOT NULL IDENTITY" 
            IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
    <Column Name="OrderID" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
    <Column Name="ProductID" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
    <Column Name="Quantity" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
    <Column Name="Price" Type="System.Decimal" DbType="Money" CanBeNull="true" />
    <Column Name="Modified" Type="System.Data.Linq.Binary" DbType="rowversion NOT NULL" 
            CanBeNull="false" IsVersion="true" />
    <Association Name="Order_OrderDetail" Member="Order" ThisKey="OrderID" 
                 Type="Order" IsForeignKey="true"/>
     Name="Product_OrderDetail" Member="Product" ThisKey="ProductID" 
                 Type="Product" IsForeignKey="true" />
  Type>
We need to add an attribute here called DeleteOnNull and set it to true in order to be able to delete a child row independently in the database when calling SubmitChanges(). Once we make this change we can now delete just a single OrderDetail from the grid and save normally:
<Association Name="Order_OrderDetail" Member="Order" ThisKey="OrderID" Type="Order" 
             IsForeignKey="true" DeleteOnNull="true"/>
The other option to fix this issue is to modify the Delete Rule to "Cascade" on the relationship in the database. In that case the designer correctly infers this attribute on the association.

http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx

not: 1. yol sorunu çözdü.

not 2. eğer ilişki prod, usagearea, prod_usagearea biçimindeyse;

[Association(Name="Prod_Prod_UsageArea", Storage="_Prod", ThisKey="ProdID", OtherKey="ProdID", IsForeignKey=true, DeleteOnNull = true)]

[Association(Name = "UsageArea_Prod_UsageArea", Storage = "_UsageArea", ThisKey = "UsageAreaID", OtherKey = "UsageAreaID", IsForeignKey = true, DeleteOnNull = true)]

prod_usagearea tablosu:
prodid (primarykey, int, not null)
usageareaid (primarykey, int, not null)

c# 3.x - List.Insert

var countries = Application["CountryList"] as List;
countries.Insert(0, new Country {CountryID = 0, Title = "Ülke"});

Application["CountryList"]'e de bir Country ekliyor.

Bunun yerine;

var countries = new List();
countries.Add(new Country {CountryID = 0, Title = "Ülke"});
countries.AddRange(Application["CountryList"] as List);

sql server - [error] Error 3154: The backup set holds a backup of a database other than the existing database

Eğer işlem yaptığın SQL Server Instance' ında açmak (Restore) için belirttiğin veritabanı adında bir veritabanı zaten varsa ve açmak istediğin veritabanından farklı bir veritabanıysa (mesela senin oluşturmadığın bir db ise ve sana sadece bak dosyası gönderilmişse) bu hatayı alırsın.

facebook app - asp.net facebook application links

http://www.alialtugkoca.com/arsiv/facebook-uygulama-gelistirme-1-gerekenler-onhazirlik/

http://www.marketing-ninja.com/asp-net/5-facebooknet-development-tips/

http://www.stevetrefethen.com/wiki/Facebook%20application%20development%20in%20ASP.NET.ashx?NoRedirect=1

http://www.stevetrefethen.com/blog/DevelopingFacebookApplicationsInCWithASPNET.aspx

css - rounded border for images

.xxx ul a img
{
border: 3px solid #f6b900;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
}

sql server 2008 - database publishing

http://blog.sqlauthority.com/2009/07/29/sql-server-2008-copy-database-with-data-generate-t-sql-for-inserting-data-from-one-table-to-another-table/

web service - The test form is only available for requests from the local machine

<configuration>

<system.web>

<webServices>

<protocols>

<add name=”HttpGet”/>

<add name=”HttpPost”/>

</protocols>

</webServices>

</system.web>

</configuration>

linq to sql - Type 'http://microsoft.com/wsdl/types/:char' is not declared

web service char alan içeren bir objeyi döndüremiyor.

char alanı varchar'a çevirdiğim halde, dbml'de değişmiyor. elle değiştirmek gerekiyor.
aynı şekilde wsdl'de de elle değişiklikler gerekebilir.

web service - Cannot merge schemas with targetNamespace='http://tempuri.org/'. Several mismatched declarations were found: Schema item 'complexType' named 'Page'...

Cannot merge schemas with targetNamespace='http://tempuri.org/'. Several mismatched declarations were found: Schema item 'complexType' named 'Page' from namespace 'http://tempuri.org/'.

geçersiz:
[WebMethod]
public void Create(Page page, out string errors)
{
PageController controller = new PageController();
controller.Create(page, out errors);
}

geçerli:
[WebMethod]
public void Create(string title, out string errors)
{
PageController controller = new PageController();
var page = new Page();
page.Title = title;
controller.Create(page, out errors);
}

daha iyi bir çözüm:
[WebMethod]
public void Create(SerializableEntity page, out string errors)
{
_controller.Create(page.Entity, out errors);
}

Parametre olarak Page'i (yani complextype'ı) kabul etmiyor.

Not: LinqSqlSerialization.dll

web service - Use the MessageName property of the WebMethod custom attribute to specify unique message names for the methods

Step 1: Use diffrent MessageName attribute values.

public class MyWS : System.Web.Services.WebService
{
[WebMethod(MessageName = "GetItemById")]
public Item GetItem(int id)
{
...
}

[WebMethod(MessageName = "GetItemByUniqueTitle")]
public Item GetItem(string uniqueTitle)
{
...
}
}

Step 2: Set your webservice binding: ConformsTo = WsiProfiles.None

web service - linq to sql & web service

public class IntertechWS : System.Web.Services.WebService
{
[WebMethod]
public SerializableEntity<Page> GetPage(int id)
{
PageController ctrl = new PageController();
Page page = ctrl.GetPage(id);

SerializableEntity<Page> entity = new SerializableEntity<Page>(page);
return entity;

//IntertechDBDataContext db = new IntertechDBDataContext();
//var page = db.Pages.SingleOrDefault<Page, SerializableEntity<Page>>(p => p.PageID == id);
//return page;
}

[WebMethod]
public List<SerializableEntity<Page>> GetSubPages(int id, int langId)
{
PageController ctrl = new PageController();
return ctrl.GetSubPages(id, langId).ToList<Page, SerializableEntity<Page>>();

//IntertechDBDataContext db = new IntertechDBDataContext();
//var pages = db.Pages.ToList<Page, SerializableEntity<Page>>();
//return pages;
}
}


linq to sql - Make Entities Serializable (LINQ to SQL)

http://msdn.microsoft.com/en-us/library/bb546185.aspx

Code Generation Tool (SqlMetal.exe)

System.InvalidOperationException: A circular reference was detected while serializing an object of type

One of the important that things that you will likely have to do at one point or another with entity objects is serialize them. This could be for Web Services most commonly but could be for any sort of storage or transport scenario.

There are a number of pitfalls with this scenario however, primarily because LINQ to SQL will very likely generate circular references into your entity model from your data and XML Serialization will fail outright in that scenario. For example, say you have a customer and projects table and if you let LINQ generate the one to many relationship it will create Customer entity with a Projects property and a Project entity with a Customer property.

For code scenarios this is probably a good thing - you want to be able to see all Projects and filter that list in your code.

Unfortunately in a serialization scenario this doesn't work because you essentially have a circular reference - Customer ->Projects -> Customer. So we have a 1 -> Many and a 1 - 1 relationship going back to the original object here.


LINQ to SQL and Serialization

search this blog (most likely not here)