last-modified

Read modified time from one file and use it to set the time for files in a whole directory

China☆狼群 提交于 2019-12-02 03:51:00
问题 In my installer I'm extracting files from archives that don't store time/date attributes, so when they're extracted the last modified date is set to the current date. I would like to set it to the last modified date of the archive file but I can't figure out how. I tried using pieces of the code from here and here but while it didn't give any errors, it didn't work for changing the time. Last modified date would need to be changed for * .* in a folder. Also, where do I need to hook into to

Read modified time from one file and use it to set the time for files in a whole directory

China☆狼群 提交于 2019-12-02 01:39:54
In my installer I'm extracting files from archives that don't store time/date attributes, so when they're extracted the last modified date is set to the current date. I would like to set it to the last modified date of the archive file but I can't figure out how. I tried using pieces of the code from here and here but while it didn't give any errors, it didn't work for changing the time. Last modified date would need to be changed for * .* in a folder. Also, where do I need to hook into to delete these files if the user cancels setup and it starts rolling back changes? I've got it taken care

Getting file last modified date (explorer value not cmd value)

℡╲_俬逩灬. 提交于 2019-12-01 15:56:55
I have written some Excel VBA code to add the filenames, versions, and last modified date/time to a worksheet. The code appears to work fine, except sometimes the time portion of the Last Modified Date for a file will either be exactly 1 hour forward or backward from what I see in an Explorer window. I have noticed the values that my code returns is the same as the modified date/time shown in a cmd window if I perform a dir command. For example, if I look up the dbghelp.dll file in the system32 folder: C:\Windows\System32>dir dbghelp.* Volume in drive C has no label. Volume Serial Number is

浏览器 HTTP 协议缓存机制详解

孤者浪人 提交于 2019-12-01 15:06:05
最近在准备优化日志请求时遇到了一些令人疑惑的问题,比如为什么响应头里出现了两个 cache control、为什么明明设置了 no cache 却还是发请求,为什么多次访问时有时请求里带了 etag,有时又没有带?等等。。。 后来查了一些资料以及同事亲自验证,总算对这些问题有了个清晰的理解,现在整理出来以备忘。 1、缓存的分类 缓存分为服务端侧(server side,比如 Nginx、Apache)和客户端侧(client side,比如 web browser)。 服务端缓存又分为 代理服务器缓存 和 反向代理服务器缓存(也叫网关缓存,比如 Nginx反向代理、Squid等),其实广泛使用的 CDN 也是一种服务端缓存,目的都是让用户的请求走”捷径“,并且都是缓存图片、文件等静态资源。 客户端侧缓存一般指的是浏览器缓存,目的就是加速各种静态资源的访问,想想现在的大型网站,随便一个页面都是一两百个请求,每天 pv 都是亿级别,如果没有缓存,用户体验会急剧下降、同时服务器压力和网络带宽都面临严重的考验。 2、 浏览器缓存机制 详解 浏览器缓存控制机制有两种:HTML Meta标签 vs. HTTP头信息 2.1 HTML Meta标签控制缓存 浏览器缓存机制,其实主要就是HTTP协议定义的缓存机制(如: Expires; Cache-control等)

Getting file last modified date (explorer value not cmd value)

无人久伴 提交于 2019-12-01 14:50:32
问题 I have written some Excel VBA code to add the filenames, versions, and last modified date/time to a worksheet. The code appears to work fine, except sometimes the time portion of the Last Modified Date for a file will either be exactly 1 hour forward or backward from what I see in an Explorer window. I have noticed the values that my code returns is the same as the modified date/time shown in a cmd window if I perform a dir command. For example, if I look up the dbghelp.dll file in the

How can I get last modified timestamp in Lua

家住魔仙堡 提交于 2019-12-01 09:06:15
I am trying to work on Lua file handling. So, I am able to open, read, write, close the files. local session_debug = io.open("/root/session_debug.txt", "a") session_debug:write("Some text\n") session_debug:close() How can I know the last modified date timestamp of this file. There's no built-in function in standard Lua that does this. One way to get it without third-party libraries is to take use of io.popen . For example, on Linux, you could use stat : local f = io.popen("stat -c %Y testfile") local last_modified = f:read() Now last_modified is the timestamp of the last modified time of

Safari not sending “If-Modified-Since” and “If-None-Match” headers

别说谁变了你拦得住时间么 提交于 2019-12-01 03:01:15
I'm generating dynamic content with PHP. I'm sending the following HTTP-header: HTTP/1.1 304 Not Modified Date: Sun, 09 Dec 2012 17:24:41 GMT Server: Apache Connection: keep-alive, Keep-Alive Keep-Alive: timeout=1, max=100 Etag: "237f43b800e655dbe6567f7d32d34c99" Expires: Sun, 16 Dec 2012 17:24:41 GMT Cache-Control: max-age=604800 Vary: Accept-Encoding I later check for the Etag to send a header('HTTP/1.1 304 Not Modified') if it matches. This works perfectly with Chrome and Firefox. However, Safari (Version 6.0.2) does not send "If-Modified-Since" and "If-None-Match" headers. This is the

ASP.NET MVC getting last modified date/FileInfo of View

妖精的绣舞 提交于 2019-11-30 22:29:07
I'm required to include the last modified date on every page of my applications at work. I used to do this by including a reference to <%= LastModified %> at the bottom of my WebForms master page which would return the last modified date of the current .aspx page. My code would even check the associated .aspx.cs file, compare the last modified dates, and return the most recent date. Does anyone know if you can read the FileInfo of a MVC View? I would like to include it in the master page, if possible. I have a base controller that all wired up and ready to go. All I need to know is how to

How to get File Created Date and Modified Date [duplicate]

主宰稳场 提交于 2019-11-30 16:47:14
This question already has an answer here: Check last modified date of file in C# 4 answers I have an .NET EXE file . I want to find the file created date and modified date in C# application. Can do it through reflection or with IO stream? You could use below code: DateTime creation = File.GetCreationTime(@"C:\test.txt"); DateTime modification = File.GetLastWriteTime(@"C:\test.txt"); You can do that using FileInfo class: FileInfo fi = new FileInfo("path"); var created = fi.CreationTime; var lastmodified = fi.LastWriteTime; File.GetLastWriteTime to Get last modified File.CreationTime to get

Why does django-lint tell me the `auto_now_add` is deprecated?

不想你离开。 提交于 2019-11-30 13:52:07
Hi fellow Djangonauts: I checked my project with django-lint , and it yields: W:211,16:MyModel: timestamp: Uses superceded auto_now or auto_now_add The commit message : auto_now/auto_now_add not technically deprecated, but they still suck. Why do they say auto_now/auto_now_add "suck"? I had no problem implementing the created/last-updated pattern with these two field parameters. Is there a better approach for this pattern? Custom Field classes? And why (if this approach is better) it hasn't been integrated into Django? The correct fix is to pass a callable as the field's default that returns