rejetto forum

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - skb

Pages: 1
1
Not sure if this is a bug or merely my problem, but the auto checks for updates had been working fine, and then started getting errors.

As a check, I downloaded the plain HFS.exe onto a different PC on a different network, started it, and checked for updates there, and get the same error.

(Not a big issue, as I can manually update once we go past 2.3m, but I am wondering if it is down for everyone or just me)

I originally thought I broke it with changes to my security settings, but turning off the firewall doesn't make any difference.

On my "production" server, the logs show updates were working fine through June 8,
Quote
6/8/2019 11:31:19 AM               Check update: no new version

but then started failing on the next check:
Quote
6/9/2019 11:31:59 AM               Check update: failed

Are updates from within HFS working for all of you?

Thanks, Steve

2
Not really debugged this at all yet; I've merely noticed it in my modified version of the standard template, and then restore the default one to confirm it wasn't just me.

If a file name includes numbers, and you rename it to insert a "$" before those numbers, the $ and some numbers are deleted from the name.

The specific example I found was attempting to rename the file name "SCS_A01_10039.CSV" to "SCS_A01_$10039.CSV".

The resulting file name became: "SCS_A01_039.CSV".  That is, the "$10" was deleted from the new name.

"$" works fine in other parts of the string, but before a digit 1-9, the $ and one or two digits are removed.


3
HTML & templates / Documentation for item-resource?
« on: July 25, 2016, 01:56:34 AM »
Is there documentation for %item-resource%?

On the list in the forums at http://www.rejetto.com/forum/html-templates/hfs-templates-vars-and-section-help/ , it is mentioned, but with no explanation.

In the docs on the wiki, at http://www.rejetto.com/wiki/index.php?title=HFS:_Template_symbols , it is not mentioned at all.

More generally, what is a simple way to find out the value of various symbols with test code? That is, while I'm trying to figure stuff out, what sample code could I put into, say, an [upload-completed] event handler to show me the values of various symbols for each file?  Can I write stuff to, say, the java script console?

Or, would it be better to use the [upload-success] section for this sort of temporary debug output?

Thanks for clues,
Steve

4
Does the "template revision" line in the default hfs.tpl get changed whenever there are changes to this template?

That is, if I download the current version of hfs.exe, and choose the command  "Menu > HTML Template > Edit", it will generate an hfs.tpl file in the same folder as the hfs.exe file, and in this file, it has:

"Welcome! This is the default template for HFS 2.3
template revision TR2."

Can I assume that these lines change whenever Rejetto makes any revisions to the default template? 

For example, back with version 2.3f, Rejetto fixed a bug with cookies and file renames in the default template. Did this version string change with that update?  I didn't think to check at that time...

5
HTML & templates / Limits to uploaded files by size?
« on: July 26, 2015, 01:11:39 AM »
Is there an easy way to restrict uploads to "small" sizes, e.g. only files less than 100KB?

Can the system know the file size before it is uploading it? Alternatively, is there any way to abort an upload if the file is larger than a limit? Or, perhaps drop it after the upload is complete? Do we know the size when the [upload completed] event happens? Is it possible to delete a large file at that point?

I fear that this question might be answered already, but the terms I tried to search for (like "file size") are so widely used that I did not find useful results.

Thanks for any pointers.
Steve

6
I see from reading the default template that HFS uses a "session ID" cookie named HFS_SID for its rename and comment actions, but I don't really get how this cookie works or what it accomplishes. This cookie is involved with rename operations because in the "ajax" function, there is:
Code: [Select]
data.token = getCookie('HFS_SID');
but I'm not clear where or how that cookie gets set.

The problem I'm having is that sometimes (but frequently enough to be annoying) the cookie apparently gets messed up, and the rename command fails with "Error: bad session".  I've not yet been able to work out what circumstances cause this situation to occur, but once it does, then it continues until I clear cookies from my browser, and restart the browser.

I think the issue may come up when I switch between two different instances of HFS, e.g. when I work with a copy on localhost during development, and also with a "production" copy on a host out on the net, where I have the same username on both instances. (If this is the only trigger, then I don't have to worry about actual users hitting this cookie problem, but I can't tell.)

It also seems more likely to occur if I have not used the server for several days, but again, I can't tell if this is actually a trigger, or just coincidence. (Perhaps my session cookie "expires" if I don't log in for a few days, and then I get this when I next log in?)

Or, is there an issue if the server is restarted between my logins?

I'd like to understand the situation enough to know what circumstances actually cause it, so I can know if it might actually crop up for real users. So far, I have not been able to find that pattern that reproduces the "bad session" error on rename or comment.

Can anyone explain how cookies are supposed to work, and how they interact with the rename process, and what the HFS_SID cookie is about?

It gets tested (I think) with the following macro:
Code: [Select]
check session=break|if={.{.cookie|HFS_SID.} != {.postvar|token.}.}|result=bad session

but again, I don't really know what that does, or when, or why.

Thanks for any clues!
Steve

7
HTML & templates / Format of " (1)" added to duplicate file name?
« on: March 06, 2015, 04:39:10 AM »
Is it possible to change the format of the numbers added to an uploaded file name when the menu item "Upload > Number files on upload instead of overwriting" is selected?

Currently, HFS adds " (uniqueNumber)" at the end of the name, and the embedded space is a pain for some command line file processing.

Is there any way to change the format to just "(uniqueNumber)" without the dang space?

In the [upload name] event, %item-name% has the file's original, possibly duplicate name, without the added string, " (1)", say. Is there a different %tag% that has what will be the file's name after HFS makes it unique?

Alternatively, I suppose I could use [upload completed], and search for names with " (" in them, and then rename them to remove the space, but that seems worse than fixing the name before the file is saved.

Steve

8
HTML & templates / %comment% in ~files.lst ?
« on: February 22, 2015, 11:23:43 PM »
I'm thinking this is by design rather than a bug, but wanted to check: It does not seem that the %comment% tag provides any output to the basic text "~files.lst" page.

I have a simple hfs.filelist.tpl that for files that currently does just: 
Code: [Select]
%files%

[files]
%list%

[file]
%item-name% %item-modified% %item-size-b%

[folder]


This has been working as expected.

Today, I added "%comment%" after my %item-size-b% entry, restarted HFS, and got no change in output.

I've searched the forum for %comment%, and see that there's a long history of adding support for complex HTML and multiline output. My guess is that this makes it impossible to use comments in the text output for ~files.lst  .

But, just to confirm, is there any way to get say, just the bare first line of a comment into the text-only output?

Thanks,
Steve

9
Note: version 2.3e corrects the bug mentioned below. Now sorting columns work as expected.  :D


On the standard hfs.tpl, the default sort link goes through four states when you click it repeatedly. I'd like to change the code so it just toggles two states, forward and reverse sort of the given column.

E.g I have "Name" selected in HFS>Menu>Other Options>Default Sorting; so if I don't click anything, files are alphabetical.

When I repeatedly click the "Size" button, the search URL changes as follows:
?sort=s (that is, sorted by size, smallest first)
?rev=1(reversed, but no field specifier, so in my case, sorted Z-A by name)
?rev=1&sort=s(sorted by size, biggest first)
(fourth click gives no sort code, so in my case, sorted A-Z by name)
?sort=s ( cycle repeats... )

I'd like it to just toggle the order of the selected field, e.g. when size is clicked repeatedly, alternate between these two states:
?sort=s (that is, sorted by size, smallest first)
?rev=1&sort=s(sorted by size, biggest first)
?sort=s ( and repeat... )

But to me the existing sortlink macro is hard going! Here it is:
Code: [Select]
            {.set|sortlink| {:<a href="{.trim|
                    {.get|url|sort=$1| {.if| {.{.?sort.} = $1.} |  rev={.not|{.?rev.} .} /if.} /get.}
                /trim.}">{.!$2.}{.if| {.{.?sort.} = $1.} | &{.if|{.?rev.}|u|d.}arr;.}</a>:} .}
            <th>{.^sortlink|n|Name.}{.^sortlink|e|.extension.}
            <th>{.^sortlink|s|Size.}
            <th>{.^sortlink|t|Timestamp.}
            <th>{.^sortlink|d|Hits.}

Can someone explain how to modify the sortlink macro so that that it skips those other two parts of the cycle?

Thanks

10
HTML & templates / Can I set the filter programatically?
« on: February 11, 2015, 08:02:08 AM »
I hope this is basic, but I guess I don't really get how it works. I would like to generate a particular ?filter string in response to a user button press and apply it to the current folder view.

In my application, which is based on the standard hfs.tpl, our data files are named in a particular way, which makes it useful to show only certain subsets based on the names. Rather than making the users type ?filter lines into their address bar, I'd like to have buttons and scripts for some common filters, similar to the idea of the "Select" box of the template, e.g. A button to show all files, which would clear the ?filter from the URL; a button to filter by specific file name codes; and also a "Mask" button for the user to enter the pattern they want, which gets expanded to a filter line.

BUT: what do I do with my filter string to refresh the page with that filter added to the URL? Can I do it from Javascript, or from a HFS macro, or either way?

E.g. for project code "A31", I'd prompt the user for the code, and make a filter string like "?filter=BD_A31_*" . Once I've generated that string, how do I apply it to the current folder view?

Thanks for any hints and pointers!
Steve



11
After selecting and archiving some files, if you try to delete that set of files, you get the delete prompt, but the action that happens is a second archive download.

To reproduce, go to a folder with some files, where you have delete privileges. (Bug occurs either with a user with delete rights, or else with "anyone" can delete.) Select one or more files and click the "Archive" button, and download the .tar file.

Then, with the same files selected, click "Delete". After the prompt, the "archive" file save prompt is shown again, rather than the files being deleted.

In fact, even if you change the selection, all attempts to delete are instead seem to give archive prompts.

To clear this, navigate back to home, and then return to the folder. Now selecting files and deleting works.

After I first found this bug with my system, I re-tested it with a clean download and all settings reset and a new VFS.

I'm running Win8.1 64-bit. Bug happens with both Chrome and Firefox.

12
Kind of a general question, more about "why" to code things a particular way, but also a specific "how". What sorts of things do you do with the built-in macros rather than Javascript? I'm trying to gain understanding of each, but don't really get how they fit together.

Are macros only for HFS events, whereas Javascript is necessary for button onclick handling? Is it possible to mix them? Are there pluses and minuses to either approach? Can I trigger an HFS event from a Javascript button click handler?

I'm currently reading through the docs and  the standard template code, and exploring how to modify it in some simple ways. As an example, I want to make a custom version of rename, to process a list of specific file names in a particular way; we will change only a few ID character positions of each file name, so we can process a batch in one go.

When I read the scripting commands page, I found the rename macro:
   {.rename | A | B.}
which renames the file A to B. I assumed I'd be using this macro for each file in my list, as well as .cut and .set  and all to build the new file names.

I'd also like to change each file's timestamp to the current time when it is renamed, which I was thinking to do via {.exec| touch <filename>.}, but it is not clear how to blend macro functions in with Javascript actions.

However, the built-in "Rename" button handler does it in pure Javascript instead, e.g.:

[...some setup code ommitted...]
ezprompt(
    this.innerHTML,
    {"type":"text", "default":getItemName(a[0])},
    function(s){ajax("rename", {from:getItemName(a[0]), to:s});}
);

Is this just because it is the event handler for the button, or are there other reasons to use Javascript rather than macros? Not clear to me how or if it is possible to mix macros and Javascript functions; when do macros "execute" with respect to the Java script functions on the page?

Is there any way to get at the {.exec .} macro from within a click handler for rename? Or, conversely, is there any way to have Javascript run commands on files on the host system? (I've only used Javascript in client side code, which is restricted from such access by the browser.)

Thanks for any general light you can shed!

Steve

13
HTML & templates / filelist.tpl ignored?
« on: December 22, 2014, 04:00:44 AM »
I would like to get a basic file list that also gives the modification time for each file. From the docs page http://www.rejetto.com/wiki/index.php?title=HFS:_Hidden_things

I added a basic filelist.tpl text file to my C:\hfs folder, which is where I have my hfs.exe file. Then I changed to just item-name rather than item-full-url, and also added %item-modified% . Thus, my full filelist.tpl is now:

Code: [Select]
%files%

[files]
%list%

[file]
%item-name%
%item-modified%

[folder]
%item-name%


I'm running version 2.3d(292) which I just downloaded, so I hope it is current. However, the output with ~files.lst is unchanged with this filelist.tpl added; I still get the full url for the files, with no time stamps.

Here is a listing of my HFS folder:
Quote
C:\>dir hfs
 Volume in drive C has no label.
 Volume Serial Number is C8D9-DF60

 Directory of C:\hfs

12/21/2014  10:52 PM    <DIR>          .
12/21/2014  10:52 PM    <DIR>          ..
12/21/2014  08:54 PM               404 bus-files.vfs
12/21/2014  10:20 PM                94 filelist.tpl
12/21/2014  08:24 PM         2,499,072 hfs.exe
12/21/2014  10:52 PM             3,956 hfs.ini
12/21/2014  08:22 PM    <DIR>          servedfiles
               4 File(s)      2,503,526 bytes
               3 Dir(s)  206,939,844,608 bytes free

I've tried "Debug > Temporarily Reset Options" and it made no difference.

Am I missing something obvious? Seems like this should just work

14
Hi,

Just learning my way around HFS, and have not tried much yet, so maybe this is simple to figure out on my own. I'm working on an Android Phonegap (thus Javascript) app that will be used for data collection into some CSV files from the server. At the start of the shift the user will connect to the LAN with the HFS server, and my program on their tablet will connect to their folder on the server, and  download one or more data files with XMLHttpRequest(GET ... ). They will add data to the records from these files through out the day (which is the point of my app) and then at the end of the shift upload the files to the server with XMLHttpRequest(PUT ...)

One thing I see in online docs for XMLHttpRequest() is that the server should return the response header "Access-Control-Allow-Origin: *" to allow my apps to access the server "cross site" from javascript. Testing with a fixed file path from localhost, Chrome fails to download without this header, and warns (on the developer console): "XMLHttpRequest cannot load http://localhost/files/skb/test.txt. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. "

Is it possible to add this header to the HFS output?

Beyond that, I'd like to make it as easy as possible for my code to get a list of files and md5 values. I'm thinking I'll have a fairly standard top level  HFS template, which I would use to add a folder and user account for each Android data-gathering device, with each folder accessible by a single user for upload and download access. The app has a dialog for entering the URL (e.g. http://serveraddr/userfolder ) as well as the username and password to connect. (Though for first testing, just on my LAN, I'm not doing passwords yet)

I would like the template for these "android readable" folders to be as simple to parse as possible, perhaps just an <a></a> per file with the file name and md5 hash. The idea is that my app would first request the index.html page in its folder, and parse this to get the file names that it needs to download, and then would check each file's hash.

Conversely, at the end of the day, the app would upload the processed files (which will have altered filenames so they don't clash with the originals.) The app would compute a hash, upload a file, and then check that the server has the correct hash and delete its local copy of the data.

Any useful pointers on this sort of thing? Has anyone posted a template designed for machine readability?

Thanks,
Steve

Pages: 1