codingdir logo sitemap sitemap |

After attempting to ge the instruction of vide.js correct, does this code look correct?

By : , Category : video.js

It looks correct, though you'll want to make sure the src attribute of the source tag points to a specific video file that's already been uploaded to the web somewhere.

<source src="" type='video/mp4' />
ReLated :

Entity Framework will pick Id as the primary key, and as yours is a string you need to supply it yourself (which you are not doing.)

It's preferable to have an int as your primary key so EF can make it an identity column in the database.

A few other observations too:

  1. The FileUpload post action is taking a Book object that isn't used other than as a variable in your action, instead just declare a new Book object inside the method.
  2. The fileName and path variables are not needed.
  3. Do you need both Id and BookId? I would remove BookId.

I would suggest your Book.cs looks like this:

public partial class Book
    public int Id { get; set; }

    public string BookName { get; set; }
    public string BookPath { get; set; }

    public virtual User User { get; set; }

And your post action:

public ActionResult FileUpload(HttpPostedFileBase file)
    if (ModelState.IsValid)
        if (file.ContentLength > 0)
            fname = Path.GetFileName(file.FileName);
            filepath = Path.Combine(Server.MapPath("~/App_Data/Uploads"), fileName);

            Book bk = new Book
                BookName = fname,
                BookPath = filepath



        return RedirectToAction("Index", "Home");
        return View();


From the comments you made above, there is an additional change you need to make to the Book class. First you need to tell Entity Framework that your Id property if the key using the [Key] attribute. Secondly for the Id column you should do one of these:

  1. Remove Id (as Entity Framework will create one for you)
  2. Rename Id to UserId to allow Entity Framework to automatically link it to the User property.
  3. Add an attribute to the User property to tell it the name of the column to use, for example [ForeignKey("Id")]

I would suggest either 1 or 2 so it is more obvious what the column is when looking at the database:

public partial class Book
    public int BookId { get; set; }

    public string BookName { get; set; }
    public string BookPath { get; set; }

    public string UserId { get; set; }
    public virtual User User { get; set; }

one problem that I see is that you have used only time(). this function does not return time for your time zone. if you need time for your time zone, you need to use localtime() to get correct time.

Your question is very vague, but are you looking to do something like this? I assume this is a java related question.

This uses a try catch to attemt to parse the int. If an exception is thrown by the parseInt function than the catch block will catch the exception.

 1  class Exception3
 2  {
 3     public static void main(String[] args)
 4     {
 5        try{
 6           if (Integer.parseInt(args[0]) == 0)
 7           {
 8              // its okay?
 9           }
10        }
11        catch(OutOfBoundsException e)
12        {
13            // handle exception
14        }
15     }  

The proxy that your corp uses requires NTLM authentication. It's not the standard basic access authentication. So you can't use urllib.request.ProxyHandler to set up the proxy directly.

You may use other softwares like Cntlm to transform your corp's proxy to a standard http proxy.


Message :
Login to Add Your Comments .
How to disable registered OpenCL platforms on Windows?
Is Observable broken in Angular 2 Beta 3?
Cross-thread operation not valid when using Invoke
How to pass an IEnumerable or queryable list of properties from Controller to View
Finding numbers after a certain keyword using Python
Pocketsphinx recognizes random phrases in a silence
Passing non-thread-safe objects through thread-safe containers
React scroll nav
BizTalk WCF-BasicHttp Adapter does not allow Empty string for Service Certificate Props
Why property ''cause" of Exception is repeating forever?
Privacy Policy 2017 © All Rights Reserved .