Tuesday, January 27, 2015
Wednesday, January 21, 2015
Sublime Text Emmet (ex-Zen Coding)
table snippet:
table>tr*2>td*3+tab
generated text:
<table>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
</table>
table>tr*2>td*3+tab
generated text:
<table>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
</table>
Tuesday, January 6, 2015
Elmah Security Settings
<elmah>
<security allowRemoteAccess="1"/>
</elmah>
<add key="elmah.mvc.requiresAuthentication" value="true" />
<add key="elmah.mvc.allowedRoles" value="Admin" />
<security allowRemoteAccess="1"/>
</elmah>
<add key="elmah.mvc.requiresAuthentication" value="true" />
<add key="elmah.mvc.allowedRoles" value="Admin" />
Saturday, December 20, 2014
jQuery UI Autocomplete Changes in 1.10
Legacy 1.9 Code:
$("#searchBox").data("uiAutocomplete")._renderItem = function (ul, item) {
return renderAutoCompleteItems(ul, item);
};
renderAutoCompleteItems = function(ul, item) {
return $("<li />")
.data("item.autocomplete", item)
.append("<a><img style='width:50px; height:50px;' src='" + item.icon + "' /> " + item.label + "</a>")
.appendTo(ul);
};
Updated 1.10 Code:
$("#searchBox").data("ui-autocomplete")._renderItem = function (ul, item) {
return renderAutoCompleteItems(ul, item);
};
renderAutoCompleteItems = function(ul, item) {
return $("<li />")
.data("ui-autocomplete-item", item)
.append("<a><img style='width:50px; height:50px;' src='" + item.icon + "' /> " + item.label + "</a>")
.appendTo(ul);
};
$("#searchBox").data("
return renderAutoCompleteItems(ul, item);
};
renderAutoCompleteItems = function(ul, item) {
return $("<li />")
.data("
.append("<a><img style='width:50px; height:50px;' src='" + item.icon + "' /> " + item.label + "</a>")
.appendTo(ul);
};
Updated 1.10 Code:
$("#searchBox").data("ui-autocomplete")._renderItem = function (ul, item) {
return renderAutoCompleteItems(ul, item);
};
renderAutoCompleteItems = function(ul, item) {
return $("<li />")
.data("ui-autocomplete-item", item)
.append("<a><img style='width:50px; height:50px;' src='" + item.icon + "' /> " + item.label + "</a>")
.appendTo(ul);
};
Monday, December 15, 2014
Friday, December 12, 2014
Upgrade from ASP.NET Identity 1.0 to 2.0
View -> Package Manager Console
PM > Enable-Migrations
PM > Add-Migration UpdateIdentifyName
PM > Update-Database -verbose
PM > Enable-Migrations
PM > Add-Migration UpdateIdentifyName
PM > Update-Database -verbose
using System.Data.Entity.Migrations;
public partial class UpdateIdentifyName : DbMigration
{
public override void Up()
{
RenameColumn(table: "dbo.AspNetUserClaims", name: "User_Id", newName: "UserId");
RenameIndex(table: "dbo.AspNetUserClaims", name: "IX_User_Id", newName: "IX_UserId");
DropPrimaryKey("dbo.AspNetUserLogins");
AddColumn("dbo.AspNetUsers", "FirstName", c => c.String(nullable: false, maxLength: 256));
AddColumn("dbo.AspNetUsers", "LastName", c => c.String(nullable: false, maxLength: 256));
AddColumn("dbo.AspNetUsers", "Email", c => c.String(maxLength: 256));
AddColumn("dbo.AspNetUsers", "EmailConfirmed", c => c.Boolean(nullable: false));
AddColumn("dbo.AspNetUsers", "PhoneNumber", c => c.String());
AddColumn("dbo.AspNetUsers", "PhoneNumberConfirmed", c => c.Boolean(nullable: false));
AddColumn("dbo.AspNetUsers", "TwoFactorEnabled", c => c.Boolean(nullable: false));
AddColumn("dbo.AspNetUsers", "LockoutEndDateUtc", c => c.DateTime());
AddColumn("dbo.AspNetUsers", "LockoutEnabled", c => c.Boolean(nullable: false));
AddColumn("dbo.AspNetUsers", "AccessFailedCount", c => c.Int(nullable: false));
AlterColumn("dbo.AspNetUsers", "UserName", c => c.String(nullable: false, maxLength: 256));
AddColumn("dbo.AspNetUsers", "CreatedDateTime", c => c.DateTime(nullable: false));
AlterColumn("dbo.AspNetRoles", "Name", c => c.String(nullable: false, maxLength: 256));
AddPrimaryKey("dbo.AspNetUserLogins", new[] { "LoginProvider", "ProviderKey", "UserId" });
CreateIndex("dbo.AspNetUsers", "UserName", unique: true, name: "UserNameIndex");
CreateIndex("dbo.AspNetRoles", "Name", unique: true, name: "RoleNameIndex");
DropColumn("dbo.AspNetUsers", "Discriminator");
}
}
Tuesday, December 9, 2014
ASP.NET MVC File Upload through jQuery AJAX
HTML:
<input type="file" name="file" id="file" />
Javascript Submit:
var formData = new FormData();
var file = $("#file")[0].files[0];
formData.append("file", file);
formData.append("SourceId", 1234);
ajaxRequestFormData(window.urls.uploadAttachment, formData)
jQuery AJAX:
ajaxRequestFormData = function (url, model) {
$.ajax({
url: url,
type: "POST",
cache: false,
data: model,
dataType: "json",
contentType: false,
processData: false,
beforeSend: showProgress()
}).done(function (data) {
...
hideProgress();
}).fail(function () {
...
});
};
Controller Action:
public virtual ActionResult UploadAttachment(AttachmentDto attachment)
{
var file = Request.Files[0];
attachment.File = file;
var sourceId = attachment.SourceId;
...
}
Domain Class:
public class AttachmentDto
{
public HttpPostedFileBase File { get; set; }
public decimal SourceId { get; set; }
...
}
<input type="file" name="file" id="file" />
Javascript Submit:
var formData = new FormData();
var file = $("#file")[0].files[0];
formData.append("file", file);
formData.append("SourceId", 1234);
ajaxRequestFormData(window.urls.uploadAttachment, formData)
jQuery AJAX:
ajaxRequestFormData = function (url, model) {
$.ajax({
url: url,
type: "POST",
cache: false,
data: model,
dataType: "json",
contentType: false,
processData: false,
beforeSend: showProgress()
}).done(function (data) {
...
hideProgress();
}).fail(function () {
...
});
};
Controller Action:
public virtual ActionResult UploadAttachment(AttachmentDto attachment)
{
var file = Request.Files[0];
attachment.File = file;
var sourceId = attachment.SourceId;
...
}
Domain Class:
public class AttachmentDto
{
public HttpPostedFileBase File { get; set; }
public decimal SourceId { get; set; }
...
}
Wednesday, November 26, 2014
T-SQL Replace Method
update shows
set ProfileImagePath = replace(ProfileImagePath, '/Content/images/Shows/S', 's')
where Id = 1019
set ProfileImagePath = replace(ProfileImagePath, '/Content/images/Shows/S', 's')
where Id = 1019
Wednesday, November 19, 2014
Tuesday, November 11, 2014
Monday, October 27, 2014
Saturday, October 25, 2014
Wednesday, October 22, 2014
sencha generate app
PS C:\Dev\www\touch\touch-2.4.0> sencha generate app App /dev/www/apps/myapp
Sencha Cmd v5.0.2.270
[INF] Processing Build Descriptor : default
[INF] Loading app json manifest...
[INF] Concatenating output to file C:\dev\www\apps\myapp\build\temp\development\App\sencha-compiler\cmd-packages.js
[INF] writing content to C:\dev\www\apps\myapp\bootstrap.js
[INF] appending content to C:\dev\www\apps\myapp\bootstrap.js
[INF] appending content to C:\dev\www\apps\myapp\bootstrap.js
[INF] appending content to C:\dev\www\apps\myapp\bootstrap.js
Sencha Cmd v5.0.2.270
[INF] Processing Build Descriptor : default
[INF] Loading app json manifest...
[INF] Concatenating output to file C:\dev\www\apps\myapp\build\temp\development\App\sencha-compiler\cmd-packages.js
[INF] writing content to C:\dev\www\apps\myapp\bootstrap.js
[INF] appending content to C:\dev\www\apps\myapp\bootstrap.js
[INF] appending content to C:\dev\www\apps\myapp\bootstrap.js
[INF] appending content to C:\dev\www\apps\myapp\bootstrap.js
Monday, October 20, 2014
Tuesday, October 14, 2014
Saturday, October 11, 2014
Thursday, October 2, 2014
Tuesday, September 30, 2014
Subscribe to:
Posts (Atom)