c# find number of occurance of substring in string
Regex.Matches(inputstring, substring).Count
Achievement provides the only real pleasure in life
Regex.Matches(inputstring, substring).Count
Posted by
Unknown
at
6:32 pm
0
comments
add the following code into the constructor of the method Configuration:
if (System.Diagnostics.Debugger.IsAttached == false)
{
System.Diagnostics.Debugger.Launch();
}
Posted by
SF
at
11:56 pm
0
comments
when setup datetime display format in javascript it displays datetime value incorrectly, the following are what I have done to ensure my datetime value is displayed correctly
in my javascript I have
@Html.TextBoxFor(model => model.PaidDateTimeLocal, new { Value = Model.PaidDateTimeLocal.ToString("yyyy/MM/dd HH:mm"), @class = "dtpicker" })
Posted by
SF
at
8:28 am
0
comments
In my MVC 5 Code First project I decided to put my domain tables under the out of box ApplicationDbContext
Posted by
SF
at
9:49 pm
0
comments
in my case I have my own dbcontext called MyContext.
1. in the child class MyModel add:
public ApplicationUser User { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Entity().HasRequired(MyModel => MyModel.User);
base.OnModelCreating(modelBuilder);
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Entity().HasRequired(MyModel => MyModel.User);
base.OnModelCreating(modelBuilder);
}
CONSTRAINT [FK_dbo.UserProfiles_dbo.AspNetUsers_User_Id] FOREIGN KEY ([User_Id]) REFERENCES [dbo].[AspNetUsers] ([Id])
Posted by
SF
at
6:30 pm
0
comments
Visual Studio 2015 Community MVC project could not open .cshtml views after installed github update.
Lucky found the solution here
Step 1: remove everything under this folder
C:\Users\abc\AppData\Local\Microsoft\VisualStudio\14.0\ComponentModelCache
Step 2: reopen VS
Posted by
SF
at
10:14 pm
0
comments
TSQL: find out which table a constraint belongs to
SELECT OBJECT_NAME(o.parent_object_id) FROM sys.objects o WHERE o.name = 'ConstraintABC' AND o.parent_object_id <> 0
Posted by
SF
at
3:48 pm
0
comments
this solution worked for me (https://productforums.google.com/d/msg/chrome/ZE4c98nklAw/47xvIIz8zN8J) 1. run cmd as administrator 2. type in "netsh winsock reset" 3. restart pc
Posted by
SF
at
9:04 am
0
comments