Wow. I just spent a few hours debugging a problem with my PHP file upload. Turns out the fix was to include an ‘id’ attribute on the file input element. Have no idea why that is required or works, but it does.
Tag Archives: file
In the best Homo sapien tradition…
I was cleaning some old Xbox controllers. Dead skin had compacted into the grooves along the edges, and I needed something to scrape it out. I tried some of my tools, but everything was too big and wouldn’t fit in the groove. So I grabbed a big paperclip and busted out my file to hone my own tool. Works great! :)
How to create a file and mount it as a filesystem
As seen over on How do I create a file and mount it as a filesystem? the answer is that you need to use the
-o loop option:
mount -o loop /path/to/file /path/to/mount
Modulinos In Bash
Via Hacker News today: Modulinos In Bash. “A modulino is a file which behaves like a library when it is imported, and like a script when executed.”
Today I am hoping to learn a little about Docker, and I have found this series of four articles I intend to read:
- Getting Started with Docker
- Docker essentials – Images and Containers
- Docker essentials – More work with images
- Docker Essentials – The docker file
I will also need to do some reading on Docker and MySQL.
Also Leo says: btw about docker, I’d prefer not to create new images for docker hub, I’d rather have the images get built directly on the server where it’s running. All from a single docker compose file, so probably just with docker compose build paths. Yes, ok so:
- I want a docker-compose.yml file in a folder, which would automatically build/start the relevant services
- leave room for an .env file with options like port and other relevant stuff (https://docs.docker.com/compose/environment-variables/)
- make the wiki image get built using a Dockerfile, probably located in one of the subfolders (https://email@example.com/how-to-understand-building-images-with-docker-compose-24cbdbc0641f)
- docker containers are supposed to be immutable (they arent, but should be treated as if they are). So make sure the docker-compose file lists all the relevant volume mounts (using relative paths on the host, so that they end up in the same folder as the docker compose file) to things like the database and other persistent data
though I guess the more general requirements would be:
- It should all be contained in a single folder (again, with a docker-compose.yml at the root of it most likely)
- I should be able to move the folder around wherever I want while the compose stack is down
- The containers shouldn’t contain any persistent data. I should be able to start, stop, delete, re-build any containers in the stack (probably only one container, but maybe you’ll include more) without any data being lost.
Safely Creating And Using Temporary Files
An excellent run down on Safely Creating And Using Temporary Files.
Linux File Timestamps Explained: atime, mtime, and ctime
Today I discovered an article explaining Linux file system timestamps: Linux File Timestamps Explained: atime, mtime, and ctime; and a good thing too, because I always thought ‘ctime’ was ‘create time’, but not so! Turns out that ‘ctime’ is ‘change time’, similar to ‘mtime’ but apparently cannot be set from userspace. My investigations were prompted by my investigations info how `borg create` identified changed files.
Omitting date completed from MySQL dump file
By default when you run a dump with ‘mysqldump’ the date of the dump is appended to the file, e.g.:
jj5@love:~/desktop/experiment$ udiff * --- dbt__jj_dev_1__svn_jdrepo.1.sql 2019-06-11 18:11:13.267758230 +1000 +++ dbt__jj_dev_1__svn_jdrepo.2.sql 2019-06-11 18:12:03.856075974 +1000 @@ -32,4 +32,4 @@ /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-06-10 21:59:44 +-- Dump completed on 2019-06-10 12:06:49
This causes dumps for a single database that has not changed to have two dumps which differ. It’s better to have dumps from the same unchanged database to be the same. To facilitate that add the –skip-dump-date option when running ‘mysqldump’.
See here for the back-story.
Salt file.recurse source file not found (file encoding issue)
So I was running this:
/var/www/jj-web-1-www.jj5.net-sixsigma: file.recurse: - clean: True - user: root - group: root - dir_mode: 755 - file_mode: 644 - source: salt://inst/mediawiki-1.29 - require: - pkg: apache2
And getting an error like this:
---------- ID: /var/www/jj-web-1-www.jj5.net-sixsigma Function: file.recurse Result: False Comment: #### /var/www/jj-web-1-www.jj5.net-sixsigma/vendor/james-heinrich/getid3/getid3/module.audio.ac3.php #### Source file 'salt://inst/mediawiki-1.29/vendor/james-heinrich/getid3/getid3/module.audio.ac3.php?saltenv=base' not found #### /var/www/jj-web-1-www.jj5.net-sixsigma/vendor/james-heinrich/getid3/getid3/module.audio-video.mpeg.php #### Source file 'salt://inst/mediawiki-1.29/vendor/james-heinrich/getid3/getid3/module.audio-video.mpeg.php?saltenv=base' not found Started: 14:27:18.352264 Duration: 134735.945 ms Changes: ----------
The issue was that the source files mentioned weren’t in UTF-8 format. To convert the files I ran, e.g.:
$ iconv -f WINDOWS-1252 -t UTF-8//TRANSLIT < module.audio-video.mpeg.php.bak > module.audio-video.mpeg.php
(Actually I couldn’t get the ‘iconv’ command to work so I edited manually in Vim)