temporary-files

git ignore vim temporary files

冷暖自知 提交于 2019-11-28 14:58:05
What is the correct way to make git ignore temporary files produced by vim in all directories (either globally across the system or locally for a single project)? nunopolonia Vim temporary files end with ~ so you can add to the file .gitignore the line *~ Vim also creates swap files that have the swp and swo extensions. to remove those use the lines: *.swp *.swo This will ignore all the vim temporary files in a single project If you want to do it globally, you can create a .gitignore file in your home (you can give it other name or location), and use the following command: git config --global

PHP tmpfile() returns false

瘦欲@ 提交于 2019-11-28 11:25:13
I've got an image upload script which was previously working. It's now broken, and I've traced the problem down to one line: $temp = tmpfile(); // $temp === false The tmpfile() function is returning false. I can't seem to figure out why. I'm having a hard time wading through Google on this one. The script it only broken on my local test environment, OSX 10.6.7, running MAMP 1.9.5. Fortunately the live site is working fine. tmpfile() returns false if it is unable to create the temporary file. Make sure your tmp folder is writable and try and check what sys_get_temp_dir() function returns. It

PHP temporary file upload not valid Image resource

时光怂恿深爱的人放手 提交于 2019-11-28 10:58:41
问题 Hi I have a class for resizing images (resizeManager.php): Class ResizeManager { // *** Class variables private $image; private $width; private $height; private $imageResized; function __construct($fileName) { // *** Open up the file $this->image = $this->openImage($fileName); // *** Get width and height $this->width = imagesx($this->image); $this->height = imagesy($this->image); } ## -------------------------------------------------------- private function openImage($file) { // *** Get

C# - How to Delete temporary internet files

此生再无相见时 提交于 2019-11-28 10:24:08
I want to clear the temporary Internet files folder completely. The location of the folder, e.g., C:\Users\Username\AppData\Local\Microsoft\Windows\Temporary Internet Files , depends on the version of Windows, so it has to be dynamic. use this path: Environment.SpecialFolder.InternetCache string path = Environment.GetFolderPath(Environment.SpecialFolder.InternetCache) //for deleting files System.IO.DirectoryInfo di = new DirectoryInfo(path); foreach (FileInfo file in di.GetFiles()) { file.Delete(); } foreach (DirectoryInfo dir in di.GetDirectories()) { dir.Delete(true); //delete subdirectories

How can I create a ramdisk in Python?

喜夏-厌秋 提交于 2019-11-28 07:12:22
I want to create a ramdisk in Python. I want to be able to do this in a cross-platform way, so it'll work on Windows XP-to-7, Mac, and Linux. I want to be able to read/write to the ramdisk like it's a normal drive, preferably with a drive letter/path. The reason I want this is to write tests for a script that creates a directory with a certain structure. I want to create the directory completely in the ramdisk so I'll be sure it would be completely deleted after the tests are over. I considered using Python's tempfile , but if the test will be stopped in the middle the directory might not be

git creates files ending in ~?

狂风中的少年 提交于 2019-11-28 07:02:56
问题 Just started using git on my mac. I have one file in my repository called README . When I change it, git puts another file in the directory called README~ containing the previous version. Is it git doing this? Why is git doing this? How can I stop git doing this? (don't just want to add it to .gitignore , but I guess I could do that but I'd rather understand why I'm getting these files in the first place..) (It's hard to search for an answer on Google cos of trying to search on "~") 回答1: The

How can I unlock a file that is locked by a process in .NET [duplicate]

对着背影说爱祢 提交于 2019-11-28 06:56:10
This question already has an answer here: Unlock Files for deletion 2 answers I want my application to clean all the temp files it used, the problem is that not all the temp files are under my control, so I just want to "brutally" unlock them in order to delete them programatically. Take a look at this article. I think that you'll struggle to do this in C# natively, even using interop, but writing a C++/CLI wrapper assembly may be a good compromise. Note also that the user needs to have the SE_DEBUG privilege for this to work. I've struggled with this as well, and ended up just shelling out to

How to create a temporary file that can be read by a subprocess?

末鹿安然 提交于 2019-11-28 04:51:26
I'm writing a Python script that needs to write some data to a temporary file, then create a subprocess running a C++ program that will read the temporary file. I'm trying to use NamedTemporaryFile for this, but according to the docs, Whether the name can be used to open the file a second time, while the named temporary file is still open, varies across platforms (it can be so used on Unix; it cannot on Windows NT or later). And indeed, on Windows if I flush the temporary file after writing, but don't close it until I want it to go away, the subprocess isn't able to open it for reading. I'm

How do I automatically delete tempfiles in c#?

寵の児 提交于 2019-11-28 03:32:59
What are a good way to ensure that a tempfile is deleted if my application closes or crashes? Ideally I would like to obtain a tempfile, use it and then forget about it. Right now I keep a list of my tempfiles and delete them with an eventhandler that triggers on Application.ApplicationExit. Is there a better way? Nothing is guaranteed if the process is killed prematurely, however, I use " using " to do this.. using System; using System.IO; sealed class TempFile : IDisposable { string path; public TempFile() : this(System.IO.Path.GetTempFileName()) { } public TempFile(string path) { if (string

Font.createFont leaves files in temp directory

送分小仙女□ 提交于 2019-11-28 03:27:21
问题 The code below does its work but leaves copies of the font file in the temp directory each time it is run. These files are named +~JF7154903081130224445.tmp where the number seems random for each created file. InputStream fontStream = this.getClass().getResourceAsStream("handsean.ttf"); Font baseFont = Font.createFont(Font.TRUETYPE_FONT, fontStream); fontStream.close(); I have found years-old discussions in forums at sun.com and other resources on the web where this is recognized as a bug in