I have a list of html files in a folder with naming convention file-name + time-stamp (for example report122345). Here 122345 is file creation hour minutes second. I want to select the latest file and open it by another html code.
Well, you cannot do in pure HTML. You’ll need to add some Javascript.
(Look at How do I load an HTML page in a <div> using JavaScript? )
Basically you need 1 or 2 web services :
Returns all filenames, so you javascript can chose the one to load
Load the demanded file
If conditions are not dependents on client entry, you can combine both of them.
Related
My situation is...
I have few hundreds of chrome html files on one folder, and I want to replace certain text(ex. james) to another text(ex. tom) for every html files. Honestly, I'm just a beginner to python, so may I get a detailed code of it? I need 1. how to open every html file in one folder 2. how to find certain text on html 3. how to replace it to another text (on python) Thanks a lot.
you can just open up the directory in VSC and bulk replace all the instances of any string in all the HTML files directly. I required to do the same and found this to be a very convenient method.
I can upload an image, then on its File page I can transclude a Cargo-enabled template that stores some metadata about that image, and later query that template's table in order to create a gallery. However, the manual addition of the template to the File page is tedious and error-prone (e.g. incorrectly naming other pages in various template fields). Is there an extension, perhaps something like Page Forms, that would allow me to simplify this process, so that I could upload an image and populate its metadata on a single page? Is there any simpler workflow in base MediaWiki to achieve this result?
I'm not familiar with Page Form based solution,
What i've done in a similar case (added a templates to 3 sets of ~1k pages) is to use pywikibot (its a library that allows you to do some automated processes in your mediawiki, that an external tool).
The solution is depend on your template, Does your template receive any arguments?
Template without arguments, its enough just to add "{{My_Template}}" to the page, You can achieve this with pywikibot's add text.py script
Template with arguments, that more complicated, In this case i would write a simple python script that will use pywikibot and add the required text (There are several options here)
2.1. Add of relevant files to category with category script, Then in your script iterate over all pages in the category using:
"from pywikibot import pagegenerators" and
"pagegenerators.CategorizedPageGenerator"
2.2. Using:
"pagegenerators.SearchPageGenerator" and passing a namespace + filtering the files you want by predefine knowledge.
BTW, if you are uploading many files, you can use BatchUpload
I received web-service documentation in html format, but it is very unfriendly when it comes to search for a specific word. Using index file it displays list of names of each request on the left and when you click on a particular one then on the right it displays description and content of this request.
Unfortunately I have to do some mapping with web-services that we already have. When searching through CTRL + F it only goes trough the left side (list), doesn't matter if you place cursor over the description on the right, click and try to search this way too - it doesn't work.
My idea is to extract all html files that have been provided to us into one word document (this way I can go through descriptions not only trough the list of names). Unfortunately all I can reach is that these files open in separate word files (one html file per one word file). It's almost 1000 requests to be mapped and working this way is going to take forever...
So the question is: How to combine more than one html file into one word file?
There two ways to merge html files
Using Command Line
Copy all html files that you want to merge into a folder.
Navigate to that folder using terminal or command prompt.
Execute following commands
on Mac/Linux
cat *.html > output.html
on Windows :
type *.html > output.html
Using already available tools
https://www.sobolsoft.com/howtouse/combine-html-files.htm, html-merge (Windows Only)
In order to convert merged html file to a word document, read here.
I can't find a more appropriate. I'm using PhpStorm to create web content (php, html, css, js..) and I'm facing the problem of long files (not even so long few hundred lines enough to be lost) where it gets hard to find things and remove unnecessary content.
I was wondering if there is a functionality, plugin or external file manager where it creates different files from one file on disk.
For example: when we have a .css file, for sure it's content is dealing with different features/parts of the html but they are all on the same html page. So it's a bad idea to create different .css file for each part, but it would be nice to have different virtual files for each part/feature where we can code and debug separately our code; but they are saved to same file.
Lets say:
common_header.css: deals with headers
common_menu.css: deals with menu (some menu we have on our page)
common_footer.css: deals with what ever to the end of page
... and so on
So now while coding we see different files (best as a subtree of the original file) some thing like that on file manager:
....other file // the dot here should be + since subtree hidden
common.css // the dot here should be - since subtree is shown
common_header.css
common_menu.css
common_footer.css
...
....other file
But when on disk they are all on the same file common.css that is loaded to our browser as one too.
If your target is to reduce the number of files being loaded from your server, after the application has been deployed, you might merge and compress your files as shown here.
In case you don't want to waste computing time to compress the files on each call, you could adjust your build process to generate them once during build (something like minify).
Let's say I have a URL http://example.com/path/to/document.html
That's the html document, the file, that has no external css or js.
If I open it in Google Chrome and save it with Ctrl+S locally, the content is changed. The content of that html file starts with <!-- saved from url= which is not I want at all. I need to get the exact html document, even spaces count.
The second option is to copy it with Ctrl+U (View Source), Select All and paste it into new document, save it and rename it. This is better, however spaces, tabs and end of file will be different depending on what operation system I'm using.
I need the exact copy of that html file - byte to byte.
How to make it?
This is a practical question as I need slightly modify that document.
I'm sorry there is no any source code in my question, but this question is about web developing.
Any ideas?
Thank you.
P.S. Of course that document could be generated by php or whatever, the part of the code can be even extracted from the db, but not in my case. I know that's a plain file.
I'd delete the comment after saving from Chrome, use wget in a linux environment, or open the page as an InputStream in Java. Do all three, run a diff, and if two arrived identical assume that's the file on the server.
Why do you need a byte-for-byte copy of the file on the server anyway, and why can't you ftp the file? There is always the chance that the server will serve different html files depending on your user-agent, but there are other tools which may be better than Chrome for getting your copy and many can spoof a user-agent as well.