MVC4项目下对redis进行增删该查

Models文件下实体类:

  1. public class Book
  2. {
  3. public string BookName {get;set;}
  4. public string Author {get;set;}
  5. public string Edition {get;set;}
  6. public string Publisher {get;set;}
  7. public string Summary { get; set; }
  8. public long Id { get; set; }
  9. public int InStock { get; set; }
  10. }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

  1. public class Person
  2. {
  3. public int Id { get; set; }
  4. public string Name { get; set; }
  5. }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 1
  • 2
  • 3
  • 4
  • 5

BookService.cs代码:

  1. public class BookService : Service
  2. {
  3. public IRepository Repository { get; set; }
  4. public object Post(AddBook request)
  5. {
  6. var id = Repository.AddBook(request.ISBN, request.BookName, request.Author, request.Edition, request.Publisher, request.Summary);
  7. return new AddBookResponse { ISBN = id };
  8. }
  9. public object Get(Books request)
  10. {
  11. return new BooksResponse{ books = Repository.GetBooks()};
  12. }
  13. }
  14. public class BooksResponse
  15. {
  16. public IEnumerable<Book> books { get; set; }
  17. }
  18. [Route("/books", "GET")]
  19. public class Books
  20. {
  21. }
  22. [Route("/books", "POST")]
  23. public class AddBook
  24. {
  25. public long ISBN { get; set; }
  26. public string BookName { get; set; }
  27. public string Author { get; set; }
  28. public string Edition { get; set; }
  29. public string Publisher { get; set; }
  30. public string Summary { get; set; }
  31. public int InStock { get; set; }
  32. }
  33. public class AddBookResponse
  34. {
  35. public long ISBN { get; set; }
  36. }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44

Repository.cs代码:

  1. public interface IRepository
  2. {
  3. long AddBook(long ISBN, string BookName, string Author, string Edition, string Publisher, string Summary);
  4. IEnumerable<Book> GetBooks();
  5. Book GetBooks(long isbn);
  6. void UpdateStock(Book book);
  7. }
  8. public class Repository : IRepository
  9. {
  10. IRedisClientsManager RedisManager { get; set; }
  11. public Repository(IRedisClientsManager redisManager)
  12. {
  13. RedisManager = redisManager;
  14. }
  15. public IEnumerable<Book> GetBooks()
  16. {
  17. using (var redisClient = RedisManager.GetClient())
  18. {
  19. var redisUsers = redisClient.As<Book>();
  20. return redisUsers.GetAll();
  21. }
  22. }
  23. public Book GetBooks(long isbn)
  24. {
  25. using (var redisClient = RedisManager.GetClient())
  26. {
  27. var redisUsers = redisClient.As<Book>();
  28. return redisUsers.GetById(isbn);
  29. }
  30. }
  31. public long AddBook(long isbn, string bookName, string author, string edition, string publisher, string summary)
  32. {
  33. using (var redisClient = RedisManager.GetClient())
  34. {
  35. var redisUsers = redisClient.As<Book>();
  36. if(redisUsers.GetById(isbn) !=null)
  37. {
  38. var book = GetBooks(isbn);
  39. book.InStock++;
  40. UpdateStock(book);
  41. return isbn;
  42. }
  43. else
  44. {
  45. var book = new Book() { Id = isbn, BookName = bookName, Author = author, Edition = edition, Publisher = publisher, Summary = summary, InStock = 1 };
  46. redisUsers.Store(book);
  47. return isbn;
  48. }
  49. }
  50. }
  51. public void UpdateStock(Book book)
  52. {
  53. using (var redisClient = RedisManager.GetClient())
  54. {
  55. var redisUsers = redisClient.As<Book>();
  56. redisUsers.Store(book);
  57. };
  58. }
  59. }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73

HomeController.cs代码:

  1. public class HomeController : Controller
  2. {
  3. //
  4. // GET: /Home/
  5. public ViewResult Index(int? page)
  6. {
  7. using (var redisClient = new RedisClient("127.0.0.1", 6379, "123456", 1))
  8. {
  9. var pageIndex = page ?? 1;
  10. var pageSize = 20;
  11. var redisUsers = redisClient.As<Book>();
  12. var books = redisUsers.GetAll().OrderByDescending(a => a.Id).ToPagedList(pageIndex, pageSize);
  13. ViewBag.pageOfBooks = books;
  14. return View();
  15. }
  16. }
  17. }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17

AdminController.cs代码:

  1. public class AdminController : Controller
  2. {
  3. private readonly static string getBookInfoUri = "http://isbndb.com/api/v2/json/KWC08NFB/book/";
  4. //http://isbndb.com/api/v2/json/[your-api-key]/book/9780849303159
  5. // GET: /Admin/
  6. public ActionResult Index()
  7. {
  8. using (var redisClient = new RedisClient("127.0.0.1",6379,"123456",1))
  9. {
  10. var redisUsers = redisClient.As<Book>();
  11. ViewBag.pageOfBooks = redisUsers.GetAll();
  12. return View();
  13. }
  14. }
  15. public ActionResult PersonList()
  16. {
  17. using (var redisClient = new RedisClient("127.0.0.1", 6379, "123456", 1))
  18. {
  19. var redisPerson = redisClient.As<Person>();
  20. ViewBag.pageOfPersons = redisPerson.GetAll();
  21. return View();
  22. }
  23. }
  24. //[HttpPost]
  25. public ActionResult CreateFromId(string isbn)
  26. {
  27. string fullUri = getBookInfoUri + isbn;
  28. HttpWebRequest webRequest = GetWebRequest(fullUri);
  29. HttpWebResponse response = (HttpWebResponse)webRequest.GetResponse();
  30. string jsonResponse = string.Empty;
  31. using (StreamReader sr = new StreamReader(response.GetResponseStream()))
  32. {
  33. jsonResponse = sr.ReadToEnd();
  34. }
  35. JObject o = JObject.Parse(jsonResponse);
  36. Book newBook = new Book();
  37. newBook.Id = long.Parse(isbn);
  38. newBook.BookName = (string)o["data"][0]["title"];
  39. newBook.Author = (string)o["data"][0]["author_data"][0]["name"];
  40. newBook.Edition = (string)o["data"][0]["edition_info"];
  41. newBook.Publisher = (string)o["data"][0]["publisher_text"];
  42. newBook.Summary = (string)o["data"][0]["summary"];
  43. using (var redisClient = new RedisClient("127.0.0.1", 6379, "123456", 1))
  44. {
  45. var redisUsers = redisClient.As<Book>();
  46. //添加单条数据
  47. redisUsers.Store(newBook);
  48. //添加多条数据
  49. //redisUsers.StoreAll(ListBook);
  50. //查询
  51. //Linq支持
  52. ViewBag.pageOfBooks = redisUsers.GetAll();
  53. //return View();
  54. }
  55. return View("Index");
  56. }
  57. public ActionResult CreatePerson()
  58. {
  59. Person p1 = new Person() { Id = 1, Name = "刘备" };
  60. Person p2 = new Person() { Id = 2, Name = "关羽" };
  61. Person p3 = new Person() { Id = 3, Name = "张飞" };
  62. Person p4 = new Person() { Id = 4, Name = "曹操" };
  63. Person p5 = new Person() { Id = 5, Name = "典韦" };
  64. Person p6 = new Person() { Id = 6, Name = "郭嘉" };
  65. List<Person> ListPerson = new List<Person>() { p2, p3, p4, p5, p6 };
  66. using (IRedisClient RClient = new RedisClient("127.0.0.1", 6379, "123456", 1))
  67. {
  68. IRedisTypedClient<Person> IRPerson = RClient.As<Person>();
  69. IRPerson.DeleteAll();
  70. //------------------------------------------添加--------------------------------------------
  71. //添加单条数据
  72. IRPerson.Store(p1);
  73. //添加多条数据
  74. IRPerson.StoreAll(ListPerson);
  75. //------------------------------------------查询--------------------------------------------
  76. //Linq支持
  77. Response.Write(IRPerson.GetAll().Where(m => m.Id == 1).First().Name); //刘备
  78. //注意,用IRedisTypedClient的对象IRPerson的Srore()添加的才能用IRPerson()方法读取
  79. Response.Write(IRPerson.GetAll().First(m => m.Id == 2).Name); //关羽
  80. //------------------------------------------删除--------------------------------------------
  81. /*
  82. IRPerson.Delete(p1); //删除 刘备
  83. Response.Write(IRPerson.GetAll().Count()); //5
  84. IRPerson.DeleteById(2); //删除 关羽
  85. Response.Write(IRPerson.GetAll().Count()); //4
  86. IRPerson.DeleteByIds(new List<int> { 3, 4 }); //删除张飞 曹操
  87. Response.Write(IRPerson.GetAll().Count()); //2
  88. IRPerson.DeleteAll(); //全部删除
  89. Response.Write(IRPerson.GetAll().Count()); //0
  90. */
  91. }
  92. return Content("");
  93. }
  94. [HttpPost]
  95. public ActionResult Create(Book bookInfo)
  96. {
  97. return RedirectToAction("Index");
  98. }
  99. private static HttpWebRequest GetWebRequest(string formattedUri)
  100. {
  101. Uri serviceUri = new Uri(formattedUri, UriKind.Absolute);
  102. return (HttpWebRequest)System.Net.WebRequest.Create(serviceUri);
  103. }
  104. }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132

Admin视图文件夹:Index.cshtml内容:

  1. @{
  2. ViewBag.Title = "Index";
  3. Layout = "~/Views/Shared/_Layout.cshtml";
  4. }
  5. <h2>Admin</h2>
  6. <table>
  7. <tr>
  8. <th>
  9. ISBN
  10. </th>
  11. <th>
  12. Book Name
  13. </th>
  14. <th>
  15. Author
  16. </th>
  17. <th>
  18. Edition
  19. </th>
  20. <th>
  21. Number In Stock
  22. </th>
  23. <th></th>
  24. </tr>
  25. @foreach (var item in ViewBag.pageOfBooks)
  26. {
  27. <tr>
  28. <td>
  29. @item.Id
  30. </td>
  31. <td>
  32. @item.BookName
  33. </td>
  34. <td>
  35. @item.Author
  36. </td>
  37. <td>
  38. @item.Edition
  39. </td>
  40. <td>
  41. @item.InStock
  42. </td>
  43. <td>
  44. @Html.ActionLink("Edit", "Edit", new { id=item.Id }) |
  45. @Html.ActionLink("Details", "Details", new { id=item.Id }) |
  46. @Html.ActionLink("Delete", "Delete", new { id=item.Id })
  47. </td>
  48. </tr>
  49. }
  50. </table>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55

PersonList.cshtml内容:

  1. @model dynamic
  2. @{
  3. ViewBag.Title = "Person";
  4. Layout = "~/Views/Shared/_Layout.cshtml";
  5. }
  6. <h2>Admin</h2>
  7. <table>
  8. <tr>
  9. <th>
  10. ID
  11. </th>
  12. <th>
  13. 名字
  14. </th>
  15. <th>
  16. 功能
  17. </th>
  18. </tr>
  19. @foreach (var item in ViewBag.pageOfPersons)
  20. {
  21. <tr>
  22. <td>
  23. @item.Id
  24. </td>
  25. <td>
  26. @item.Name
  27. </td>
  28. <td>
  29. @*@Html.ActionLink("Edit", "Edit", new { id = item.Id }) |
  30. @Html.ActionLink("Details", "Details", new { id = item.Id }) |
  31. @Html.ActionLink("Delete", "Delete", new { id = item.Id })*@
  32. </td>
  33. </tr>
  34. }
  35. </table>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39

Home视图文件夹:Index.cshtml内容:

  1. @{
  2. ViewBag.Title = "Index";
  3. Layout = "~/Views/Shared/_Layout.cshtml";
  4. }
  5. @using PagedList.Mvc;
  6. @using PagedList;
  7. @foreach (var item in ViewBag.pageOfBooks)
  8. {
  9. <div class ="bookSmall">
  10. <h3>@item.BookName</h3>
  11. <p>@item.Author</p>
  12. <p>@item.Edition</p>
  13. <p>@item.InStock</p>
  14. @Html.ActionLink("More Details", "Details", new { Id = item.Id})
  15. </div>
  16. }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17

运行结果如图:



 
 

.NET平台下Redis使用(三)【ServiceStack.Redis学习】的更多相关文章

  1. Redis(三)Redis基本命令操作与API

    一Redis 连接 Redis 连接命令主要是用于连接 redis 服务. 实例 以下实例演示了客户端如何通过密码验证连接到 redis 服务,并检测服务是否在运行: redis 127.0.0.1: ...

  2. 【Redis】三、Redis安装及简单示例

    (四)Redis安装及使用   Redis的安装比较简单,仍然和大多数的Apache开源软件一样,只需要下载,解压,配置环境变量即可.具体安装过程参考:菜鸟教程Redis安装.   安装完成后,通过r ...

  3. Redis系列(三):Redis的持久化机制(RDB、AOF)

    本篇博客是Redis系列的第3篇,主要讲解下Redis的2种持久化机制:RDB和AOF. 本系列的前2篇可以点击以下链接查看: Redis系列(一):Redis简介及环境安装. Redis系列(二): ...

  4. Redis(三)--- Redis的五大数据类型的底层实现

    1.简介 Redis的五大数据类型也称五大数据对象:前面介绍过6大数据结构,Redis并没有直接使用这些结构来实现键值对数据库,而是使用这些结构构建了一个对象系统redisObject:这个对象系统包 ...

  5. Redis(三)Redis附加功能

    一.慢查询分析 许多存储系统(例如MySql)提供慢查询日志帮助开发和运维人员定位系统存在的慢操作. 所谓慢查询日志就是系统在命令执行前后计算每条命令的执行时间,当超过预设阈值,就将这条命令的相关信息 ...

  6. Redis系列三(redis配置文件分析)

    在第一篇文章中有提到过redis.conf这个文件,这个文件就是redis-server的具体配置了.要使用好redis,一定要搞清楚redis的配置文件,这样才能最大的发挥redis的性能. # B ...

  7. Redis分布式锁(ServiceStack.Redis实现)

    1.设计思路 由于Redis是单线程模型,命令操作原子性,所以利用这个特性可以很容易的实现分布式锁.A用户端在Resdis写入1个KEY,其他的用户无法写入这个KEY,实现锁的效果.A用户使用完成后释 ...

  8. redis(三):Redis 命令(python)

    import redis from redis import StrictRedis redis=StrictRedis(host='localhost',port=6379,db=0,passwor ...

  9. Redis探索之路(三):Redis的五种数据类型String和Hash

    一:String 存储二进制数据,可以图片,序列化对象 GET,SET SETNX(not exist)  setnx age 33 返回 0,1 SETEX设置有效期   SETEX COLOR 2 ...

  10. ASP.NET MVC 学习笔记-2.Razor语法 ASP.NET MVC 学习笔记-1.ASP.NET MVC 基础 反射的具体应用 策略模式的具体应用 责任链模式的具体应用 ServiceStack.Redis订阅发布服务的调用 C#读取XML文件的基类实现

    ASP.NET MVC 学习笔记-2.Razor语法   1.         表达式 表达式必须跟在“@”符号之后, 2.         代码块 代码块必须位于“@{}”中,并且每行代码必须以“: ...

随机推荐

  1. vue之基础---组件基础

    (1)基本示例 Vue组件示例 /* 先注册组件,定义一个名为button-component的新组件 */ Vue.component('button-component',{ data:funct ...

  2. HDU多校Round 5

    Solved:3 rank:71 E. Everything Has Changed #include <bits/stdc++.h> using namespace std; const ...

  3. linux cp复制文件 直接覆盖

    命令: \cp -rf aaaa/* bbbb 复制aaa下的文件到bbb目录

  4. <MyBatis>入门一 HelloWorld

    1.HelloWorld 导入依赖 <!-- https://mvnrepository.com/artifact/org.mybatis/mybatis --> <dependen ...

  5. vue-cli项目结构分析

    总体框架 一个vue-cli的项目结构如下,其中src文件夹是需要掌握的,所以本文也重点讲解其中的文件,至于其他相关文件,了解一下即可. 文件结构细分 1.build——[webpack配置] bui ...

  6. mesh topology for airfoil, wing, blade, turbo

    ref Ch. 5, Anderson, CFD the basics with applications numerical grid generation foundations and appl ...

  7. js中的三种弹框分别是alert(),confirm(),prompt()

    1.alert(): ①写在<script>标签中 ②括号中的内容为字符串或者整型 ③点击确认即可关闭,无返回值 2.confirm(): ①写在<script>标签中 ②括号 ...

  8. 【18】AngularJS 包含

    AngularJS 包含 在 AngularJS 中,你可以在 HTML 中包含 HTML 文件. 在 HTML 中包含 HTML 文件 在 HTML 中,目前还不支持包含 HTML 文件的功能. 服 ...

  9. HDU1507 Uncle Tom's Inherited Land*

    题目是跟 zoj1516是一样的,但多了匹配后的输出 详解zoj1516可见http://www.cnblogs.com/CSU3901130321/p/4228057.html #include & ...

  10. [luoguP2158] [SDOI2008]仪仗队(数论)

    传送门 可以看出 (i, j) 能被看到,(i * k, j * k) 都会被挡住 暴力 所以 gcd(i, j) == 1 的话 ans ++ 那么可以枚举一半(中轴对称),求解答案,只能拿30分 ...