I am using jZebra applet to print a dynamic generated text file. But it seems, the browser cached the file and printing the same old contents even after file contents are changed. "applet.clear()" did not help me. What am I missing?
A dirty trick for forcing against caching is to simply put a JavaScript timestamp at the end of the URL. This makes the URL appear unique to the web browser and works for me every time, especially for IE and should also correct your problem for Java.
If you have a URL, i.e.
var url = "http://foo.bar";
Change it to:
var url = "http://foo.bar?" + new Date().getTime();
Since jZebra allows the file URL to be provided either as a parameter, or allows the contents of the file to be appended, you should probably specify how you're appending your file next time for better clarification.
-Tres
Related
I have Django model with Image field, but sometimes I don't need to actually upload file and store path to it, but I need to store only path. Especially url. I mean, I have web client, that receives both foreign urls like sun1-17.userapi.com and url of my own server, so sometimes I don't need to download but need to store url. Is it possible, to store url in ImageField, or I need to make CharField and save files via python? If its impossible, how do I save file in python3, having one, sent me via multipart?
The URL field in the ImageField is ReadOnly, so you cannot write it. You should probably use in addition a URLField (better than a CharField) to save the URLs.
You can allow null values on both and use only the appropriate one according to your scenario.
class FilePathField(path='', match=None, recursive=False, > allow_files=True, allow_folders=False, max_length=100, **options)
A CharField whose choices are limited to the filenames in a certain directory on the filesystem.
Has some special arguments, of which the first is required:
FilePathField.path
Required. The absolute filesystem path to a directory from which this FilePathField should get its choices. Example: "/home/images".
For more info visit the doc https://docs.djangoproject.com/en/3.0/ref/models/fields/#django.db.models.FilePathField
Uploaded filename in Catalog-->Downloads section are like this:
Chrysanthemum.jpg.bafd8619f8e86bba3b8c90063b2910d2
in this example Chrysanthemum.jpg is filename and What's usage this: .bafd8619f8e86bba3b8c90063b2910d2 ?
Without knowing anything about Opencart I would say that it's an easy way to make sure that if you upload two images with the same name but different content they won't replace each other. If it's indeed a hash of the content thats appended then that would also ensure that if you upload the same image twice it will still only be stored once.
In cases when two attachments with the same filename are attached to a Notes Document, the second file is renamed internally to something like ATTXXXX. Even if the first filename is deleted and document re-saved, the internal filename remains cryptic.
There doesn't seem to be any way to retrieve the original Filename through back-end functions. I have looked high and low in LS but also in the C++ API, and could find nothing. It seems to be a trick that can only be done in the front-end. I am not sure where the information in the file icon graphic is stored, and whether it is accessible. In simple cases it would be possible to do a rename, I suppose (i.e. there is a single attachment and a single file icon graphic).
Could anybody confirm that this is, indeed a limitation of Notes or is there a cool way to solve this?
This is causing me some headaches whilst processing a large number of documents. My customer has trouble believing that there are some things that can only be done in the front end.
You should be able to get the original filename, even with duplicates.
It is not when the file is attached that the name is changed, it is when you detatch it.
You are probably using the .Name property, try the .Source property of the EmbeddedObject, that should return the original filename.
From the help:
If the NotesEmbeddedObject is an embedded object or object link, this property returns the internal name that Notes uses to refer to the source document.
If the NotesEmbeddedObject is a file attachment, this property returns the file name of the original file.
Syntax
To get: source$ = notesEmbeddedObject.Source
It's in the CD records for the rich text -- you will see it if you use NotesPeek to examine the contents of the rich text item. But I don't think it's accessible through the NotesRichText navigator class, so I'm pretty sure you would have to go the C API and parse through the CD records. Or, the MIDAS Rich Text API can probably get it, but that's third party software. I.e., not free.
I use wininet (with an nsis plugin called inetc) to download a file.
I want to save the file with the same file name that is used in the url for example http://some.domain.com/myfile.doc should be saved as myfile.doc. The problem is when I have a url with redirection. For example I can get http://some.domain.com/ which redirects to http://some.domain.com/myfile.doc, and I want to save it as myfile.doc.
How do I tackle this problem?
INetC was not really designed to support that but I guess you could call INetC::head in a loop and parse the returned header until it is no longer a redirect...
Edit:
Since INetC is only designed to deal with files named by the caller it just relies on the high-level WinInet default handling.
While it might be possible to modify INetC or create a new plugin, it might be less work to just have the server do the work. It could return the content-disposition header that INetC::head can download or a special URL like server.com/?getname that just returns the name so you grab the name first with INetC::get and then perform the real INetC::get with the correct destination filename...
ok so what I am trying to do is manually handle my assets when using express. What I mean is that I do not what to have to have every stylesheet/javascript file on every page. So I wanted to be able to specify in each route whether I wanted to use another javascript file or not. Ex:
app.get('/testing',function(req,res,next){
assets.addJS('my-javascript-file');
res.render('testing');
});
So now when the template goes to render I want all of those javascript files that have been added in a local variable. I do not want to pass them on each call to render because I will want to add javascript in other places and may not necessarily need to send anything to the template which would cause me not to pass it by accident. Another thing that I want to implement is caching. I know by default it sends back the 304 not modified once it has the asset but I dont even want it making that request so I was hoping to do a query string on the files when they are output with maybe the last time they were modified and that way if I change them it will automatically tell the users browser to get the newest files but other than that it will cache them saving me bandwidth / requests (amazon s3 charges for these). If anyone can point me in the right direction or if there is already a plugin out there for this please let me know. Thanks.
You could build an asset manager around this:
app.get(function(req, res) {
res.locals.files = [ 'somefile.js', 'somefile2.js' ];
res.render('someview');
});
The view would just create multiple script files.
head
each file in files
script(src=base_url + '/' + file)
If you want to merge the files into one request you probably need to extend this even more. You could create a route that can take an array of files and merges them on each request. You can serve files with res.sendFile. This will take care of all the headers and caching if I remember correctly.