Bài đăng

Lỗi không attach được Database vào SQL server 2008

Sau mấy lần sao chép file mdf từ máy cơ quan về nhà và ngược lại thỉnh thoảng lại bị lỗi không attach được vào SQL server 2008 với những thông báo lỗi đại loại như " An exception occurred while executing a Transact-SQL statement or batch". Copy file Database cần attach vào đúng thư mục có cấu trúc như ở máy cơ quan thì cũng có lúc được, cũng có lúc không, xét về nguyên tắc thì việc làm trên là vô lý nhưng sự thực là cũng có lúc nó được. Cuối cùng tìm kiếm trên internet thì có người bày cho cách xử lý như sau: - Phân lại quyền truy cập trên hệ thống cho file .mdf và file .ldf + Chuột phải vào file .mdf chọn Properties chọn sang thẻ Security + Click chọn  Edit  tiếp theo chọn  Add  => click  Advanced...  => click  Find Now  =>tìm đến tài khoản  EveryOne  rồi click OK => click tiếp Ok sau đó click vào tài khoản  EveryOne  vừa  Add  nhìn xuống dưới click chọn vào  Full Control  => click  Ok  và Ok  + Làm tương tự cho file .ldf - Vào trong SQL server attac

Cấu hình webconfig MVC đưa lên host

<?xml version="1.0" encoding="utf-8"?> <!--   For more information on how to configure your ASP.NET application, please visit   http://go.microsoft.com/fwlink/?LinkId=301880   --> <configuration>   <configSections>     <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->     <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,Log4net" />     <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />     <section name="dotless" type="dotless.Core.configuration.DotlessConfigurationSectionHandler, dotless.Core" />   </configSections>   <connectionStrings>     <add name="ABCEntit

TRANG THAM KHẢO: http://nice-tutorials.blogspot.com/

Trang web tham khảo:  http://nice-tutorials.blogspot.com/

Limit the Number of Characters in a Textarea or Text Field

THAM KHẢO TRÊN:  http://www.mediacollege.com/internet/javascript/form/limit-characters.html This script allows you to set a limit on the number of characters a user can enter into a textarea or text field, like so: (Maximum characters: 100) You have   characters left. Step 1 - Create Function Insert the following code into the page head: <script language="javascript" type="text/javascript"> function limitText(limitField, limitCount, limitNum) { if (limitField.value.length > limitNum) { limitField.value = limitField.value.substring(0, limitNum); } else { limitCount.value = limitNum - limitField.value.length; } } </script> Step 2 - Create Text Area Use the following code to create the form and text area (if necessary, change the name of the form and text area to suit your needs): <form name="myform"> <textarea name="limitedtextarea" onKeyDown="limitText(this.form.limitedtextarea,this.form.countd

Debug visually with Code Map debugger integration

Link gốc: http://s.ch9.ms/Series/Visual-Studio-2012-Premium-and-Ultimate-Overview/Visual-Studio-Ultimate-2012Debug-visually-with-Code-Map-debugger-integration

Controller và Actions trong ứng dụng ASP.NET MVC theo http://jou.vn

Bài viết đầu tiên của chương thứ II sẽ giới thiệu với bạn về controller và action trong ứng dụng ASP.NET MVC. Nền tảng ASP.NET MVC ánh xạ các URL đến các lớp được gọi là controller. Các controller được dùng để xử lý các request gọi đến, quản lý dữ liệu được nhập bởi người dùng, tương tác, và thực thi logic ứng dụng hợp lý. Một lớp controller thường gọi các view để sinh ra mã HTML trả về cho request. Lớp cơ bản nhất được các controller kế thừa có tên là ControllerBase, lớp này cung cấp các mã quản lý mô hình MVC chung nhất. Lớp Controller được kế thừa từ ControllerBase, và là lớp mặc định dùng cho việc cài đặt controller. Lớp Controller có trách nhiệm: TÌm kiếm action thích hợp để gọi và kiểm ra xem thử action đó có thể gọi được hay không. Lấy các giá trị được gởi lên từ request để sử dụng như là tham số cho các action Xử lý tất cả các lỗi có thể xảy ra trong suốt quá trình thực thi phương thức ac

Facebook Style Wall Posts and Comments using Knockout.js and ASP.NET Web API by http://techbrij.com

Hình ảnh
In this article, we will implement Facebook style wall posting with following features using Knockout.js , jQuery and ASP.NET MVC 4 with Web API . 1. Add new post and display the latest post first 2. Add new comment to post 3. Display date time in fuzzy time stamps (e.g. 5 mins ago..) 4. Auto-grow textarea for long posting and commenting 5. Comment link to toggle comment box 6. Display user avatar for posts and comments Here is the final output: Database Structure: The edmx view generated from database is as follows: In UserProfile table, AvatarExt is used to store extension of user thumbnail and it is stored in the application with UserId + . + AvatarExt. Post table is used for Wall posts and PostComment table is used for comments. Other tables(not displayed in the image, common tables) are used to implement SimpleMembershipProvider. Getting Started: 1. Create ASP.NET MVC 4 > Internet Application Project in VS2012. 2. In Models, Add new item “ADO.