Skip to content

Instantly share code, notes, and snippets.

View itorian's full-sized avatar
🎯
Focusing

Abhimanyu Kumar Vatsa itorian

🎯
Focusing
View GitHub Profile
@itorian
itorian / Download.cshtml
Last active August 29, 2015 13:57
Upload File (Single file at once) to SQL Server Database from Index.cshtml view page and download them from Download.cshtml view page. If you want to upload multiple files once read this gist https://gist.github.com/itorian/9389738
@model IEnumerable<MvcFileUploadToDB.Models.FileUploadDBModel>
@{
ViewBag.Title = "Index";
}
<h2>Index</h2>
<p>
@Html.ActionLink("Upload New", "Index")
@itorian
itorian / Download.cshtml
Last active August 29, 2015 13:57
Upload Files (multiple files once) to SQL Server Database from Index.cshtml view page and download them from Download.cshtml view page. In the previous gist we saw code to upload single file at once here https://gist.github.com/itorian/9385989
@model IEnumerable<MvcFileUploadToDB.Models.FileUploadDBModel>
@{
ViewBag.Title = "Index";
}
<h2>Index</h2>
<p>
@Html.ActionLink("Upload New", "Index")
@itorian
itorian / Default.aspx
Created March 7, 2014 08:15
Code snippets to connect Microsoft Access Database (Office Access) : Checking user availability (custom login) and selecting data and saving data.
<script>
function SaveMember() {
var ID = document.getElementById('<%=hfID.ClientID %>').value;
var OrderStatus = document.getElementById('<%=ddlOrderStatus.ClientID %>').value;
var PaymentStatus = document.getElementById('<%=ddlPaymentStatus.ClientID %>').value;
var DispatchDateTime = document.getElementById('<%=txtDispatchDateTime.ClientID %>').value;
var CourierCompany = document.getElementById('<%=ddlCourierCompany.ClientID %>').value;
var ConsignmentNumber = document.getElementById('<%=txtConsignmentNumber.ClientID %>').value;
var DeliveryDetails = document.getElementById('<%=txtDeliveryDetails.ClientID %>').value;
var Status = document.getElementById('<%=ddlStatus.ClientID %>').value;
@itorian
itorian / AngularJS CRUD in MVC Sample Demo
Last active December 3, 2015 10:58
AngularJS CRUD in MVC Sample Demo
Step 1. Install AngularJS using install-package angularjs or using NuGet Package Manager
Step 2. Insert JS code references on web page or _Layout.cshtml page
<script src="~/Scripts/jquery-1.11.1.min.js"></script>
<script src="~/Scripts/angular.min.js"></script>
<script src="~/Scripts/AngularImp/EnquiryService.js"></script>
<script src="~/Scripts/AngularImp/EnquiryCtrl.js"></script>
Step 3. Create View Page as given below
@itorian
itorian / MVC with Abhimanyu Kumar Vatsa.md
Last active December 5, 2016 16:45
MVC with Abhimanyu Kumar Vatsa
@itorian
itorian / EntityFramework vs LINQ vs ADO.NET - select query samples
Created December 3, 2015 11:24
EntityFramework vs LINQ vs ADO.NET - select query samples
// Entity Framework
public ActionResult GetBokaroStudentEF()
{
var db = GetFromDbContext();
var data = db.Students.Where(i => i.City == "Bokaro");
return View(data);
}
// LINQ
public ActionResult GetBokaroStudentLINQ()
## 1. Install log4net using NuGet
## 2. Add assembly in AssemblyInfo.cs file
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "Web.config", Watch = true)]
## 3. Add settings in web.config
<configuration>
<configSections>
:::
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
@itorian
itorian / Comparing two List<T> to find match in both list, 1st list only, 2nd list only that is Insersect, Minus and Minus Except
Created April 13, 2016 09:09
Comparing two List<T> to find match in both list, 1st list only, 2nd list only that is Insersect, Minus and Minus Except
namespace ConsoleApplication6
{
class Program
{
static void Main(string[] args)
{
List<Items> list1 = new List<Items>();
list1.Add(new Items { name = "abc" });
list1.Add(new Items { name = "abd" });
list1.Add(new Items { name = "aef" });
@itorian
itorian / Azure media services transcoding JobState.Error handling
Last active April 19, 2016 06:12
In case you are facing error in scheduled transcoding task and you would like to know details of the error, you can use below code snippet. More details here http://www.itorian.com/2016/04/azure-media-services-transcoding.html
static public IAsset EncodeToAdaptiveBitrateMP4s(IAsset asset, AssetCreationOptions options)
{
// Default preset settings
//IJob job = _context.Jobs.CreateWithSingleTask(MediaProcessorNames.AzureMediaEncoder,
// MediaEncoderTaskPresetStrings.H264AdaptiveBitrateMP4Set720p,
// asset,
// "Test-Video-" + 100 + "-" + Guid.NewGuid().ToString() + "-Adaptive-Bitrate-MP4",
// AssetCreationOptions.None);
// Custom preset settings
@itorian
itorian / H264MultipleBitrateCustom720p.json
Last active April 19, 2016 07:20
I received two different error messages (.xml preset and .json preset displays different messages) from azure media services encoder.
{
"Version": 1.0,
"Codecs": [
{
"KeyFrameInterval": "00:00:02",
"H264Layers": [
{
"Profile": "Auto",
"Level": "auto",
"Bitrate": 1000,