fileinfo

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

核能气质少年 提交于 2019-12-19 03:54:06
问题 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

GetFiles with multiple extensions [duplicate]

有些话、适合烂在心里 提交于 2019-12-17 02:23:05
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Can you call Directory.GetFiles() with multiple filters? How do you filter on more than one extension? I've tried: FileInfo[] Files = dinfo.GetFiles("*.jpg;*.tiff;*.bmp"); FileInfo[] Files = dinfo.GetFiles("*.jpg,*.tiff,*.bmp"); 回答1: Why not create an extension method? That's more readable. public static IEnumerable<FileInfo> GetFilesByExtensions(this DirectoryInfo dir, params string[] extensions) { if

FileInfo.OpenText() Fails To Read Special Characters E.G. üò°

家住魔仙堡 提交于 2019-12-12 11:21:29
问题 Have some text files that display many characters as � in TextBox and TextBlock. How can I properly read and display these files in .NET WPF? File read where fi is a FileInfo. fileText = fi.OpenText().ReadToEnd(); In WPF I get the � character for ü ò ° and other special characters. Have tried multiple fonts. Culture is en-EN. If I read the file as a Stream I get the special characters System.IO.Stream fsIn = fi.OpenRead(); if (fsIn.Length == 0) return; int curInt = -1; StringBuilder sb = new

.htaccess enable php fileinfo extension

醉酒当歌 提交于 2019-12-12 11:09:58
问题 I've used shared host for hosting my application and the version is php5.3.27 . I'm getting an error like Call to undefined function finfo_open() So I've gone through some articles where I suggested by enabling fileinfo extension in .htaccess. For the first time I'm getting this error. Please help me to get the solution. The work would be more appreciated. 回答1: See this answer: In your php.ini file, make sure you have something like this in it: extension=fileinfo.so or if you're on windows,

Call to undefined function finfo_open()

我的梦境 提交于 2019-12-12 10:23:47
问题 In my phpinfo, it say's that the fileinfo is enabled. But Im still getting the error Call to undefined function finfo_open() . What am I missing? Please see the image of my configuration command. EDIT : I don't have a direct access to php.ini because im using a shared hosting. I can request them to update it for me but im not exactly sure what other else are needed to enable other than fileinfo . 回答1: In your php.ini there should be something similar to ;extension=fileinfo.so or ;extension

How to edit core properties of .xlsx file with Python?

强颜欢笑 提交于 2019-12-11 15:19:44
问题 I'm attempting to populate some of the core property fields for Excel files (namely the subject, category, and title fields) and am having trouble finding a way to do so. I was able to accomplish this with .docx files using the docx module like so: doc = docx.Document(file) name = doc.tables[1]._cells[43].text data = doc.tables[0]._cells[1].text numbers = re.findall('\d{9}', data) doc.core_properties.title = numbers[0] doc.core_properties.category = numbers[1] doc.core_properties.subject =

How to get the number of pages of a pdf file in Android?

£可爱£侵袭症+ 提交于 2019-12-10 16:35:47
问题 Can you help me find out the number of pages of a pdf document on Android, that will support down to at least api version 16. I am extracting document information but can't see a solution to get the total amount of pages. This Is what I doo so far: private void extractDocumentDataFromUri(Uri uri) { String[] dataFileds = new String[]{ MediaStore.MediaColumns.DATA, OpenableColumns.DISPLAY_NAME, OpenableColumns.SIZE}; Cursor cursor = context.getContentResolver().query(uri, dataFileds, null, null

Is it safe to create a FileInfo on a file that is currently being written to?

左心房为你撑大大i 提交于 2019-12-10 03:47:17
问题 In my application (C# 4.5 winforms app) I periodically check the contents of a folder and store the details of any files found into a database. Within this routine, I create a FileInfo instance using new FileInfo(path) , and I read the properties CreationTime , LastWriteTime , LastAccessTime , Length and Attributes . I never call any methods on the FileInfo instance. What I want to know: is there any risk of corruption, locking or runtime errors if a file is currently being written to by a

Caching FileInfo properties in C#

回眸只為那壹抹淺笑 提交于 2019-12-10 01:45:43
问题 From the MSDN documentation for the FileInfo.Name property, I see that the data for the property is cached the first time it is called and will only be updated subsequently by using the Refresh method. I've the following questions which I can't find or aren't too clear in the documentation: Is the data for all properties cached at the same time? Is the Refresh method called on creation of the FileInfo , or only when a property is called for the first time? If I've called one property, e.g.

DirectoryInfo.GetFiles method not returning any files

有些话、适合烂在心里 提交于 2019-12-08 12:03:57
问题 I'm trying to return the .config files that exist in %WINDIR%\System32\inetsrv\config . For this I am using the following code: DirectoryInfo configFolder = new DirectoryInfo(Environment.ExpandEnvironmentVariables("%WINDIR%") + @"\System32\inetsrv\"); FileInfo[] configFiles = configFolder.GetFiles("*.config"); This returns zero objects into configFiles . If I use another folder (say D:\DropBox) is works fine! This code used to work, has something changed?? Also, FileInfo fi = new FileInfo