Set the number of Copies with Printjs - printjs

Is there way to set the number of copies to be printed by "printjs library" and to not allow user to change this number ?

Related

Labview Saving multiple segments into one file

I am converting an SDK vi provided by a data acquisition card company to suit my needs. The original vi records multiple data segments in the card memory and displays in a waveform graph on the front panel without any saving to file function. I can input "Number of Records" to set how many segments (waveforms) I want to acquire. Once the acquisition is over, I can click on "segment" (a "control" on the front panel to input a number) to view the nth segment. To save all the data segments into one file, I put the "Write Delimited Spreadsheet VI" in this VI, with attache to file and transpose function.
My problem is that once I add the save file function, the VI is only saving one segment if the "Run" is set at "False," and then by clicking the arrow to add one in the "Segment" control on the front panel, the next segment data will be saved in the same file and attach after the previously segment. Or the VI will keep saving data without stopping if the "Run" is set at "True. What I want is when I set the "Number of Records" as X (an integer), the file will save X segments. I tried to add a counter to automatically add one each time and replace the "Segment" input but was not working.
I feel that I am getting very close to what I want but after a week I decided to ask for help. Any comments and suggestions welcome. Thank you.
A counter is needed. Add it to shift register of the While Loop (not the For Loop!).
Add saving of data to the While Loop (move it out from For Loop).
Increase counter (in the While Loop), and save data until the counter reaches Segment’s value.
Let me also give one recommendation: try to change current implementation to some more flexible design pattern (such as State Machine or Producer-Consumer). Currently, your code is quite messy, coupled, etc. - so it could be a challenge to debug it or to add new features. Both of the patterns mentioned can be explored more by looking at the Project Templates (available when you create a new project).

USN Journal : Has File been Updated

I have written a module in Delphi that enumerates all the files on a volume.
How do I get to know the files that were updated / deleted / created since my last backup ?
Noticed that the FileUSNReference number and the ParentFileUSNReference number change upon any update done to the file. If I have stored the file details during my previous backup and if I compare the numbers with the current Reference numbers I can get to know that the files have changed.
Just need to know if this is a reliable method as this is just my observation and I do not know if this is how it is supposed to be

How do I create a CFSTR_FILEDESCRIPTOR of unknown size?

I have an email client that allows the user to export a folder of email as a MBOX file. The UX is that they drag the folder from inside the application to an explorer folder (e.g. the Desktop) and a file copy commences via the application adding CFSTR_FILEDESCRIPTOR and CFSTR_FILECONTENTS to the data object being dropped. The issue arises when working out how to specify the size of the "file". Because internally I store the email in a database and it takes quite a while to fully encode the output MBOX, especially if the folder has many emails. Until that encoding is complete I don't have an exact size... just an estimate.
Currently I return an IStream pointer to windows, and over-specify the size in the file descriptor (estimate * 3 or something). Then when I hit the end of my data I return a IStream::Read length less then the input buffer size. Which causes Windows to give up on the copy. In Windows 7 it leaves the "partial" file there in the destination folder which is perfect, but in XP it fails the copy completely, leaving nothing in the destination folder. Other versions may exhibit different behaviour.
Is there a way of dropping a file of unknown size onto explorer that has to be generated by the source application?
Alternatively can I just get the destination folder path and do all the copy progress + output internally to my application? This would be great, I have all the code to do it already. Problem is I'm not the process accepting the drop.
Bonus round: This also needs to work on Linux/GTK and Mac/Carbon so any pointers there would be helpful too.
Windows Explorer use three methods to detect size of stream (in order of priority):
nFileSizeHigh/Low fields of FILEDESCRIPTOR structure if FD_FILESIZE flags is present.
Calling IStream.Seek(0, STREAM_SEEK_END, FileSize).
Calling IStream.Stat. cbSize field of STATSTG structure is used as MAX file size only.
To pass to Explorer a file with unknown size it is necessary:
Remove FD_FILESIZE flags from FILEDESCRIPTOR structure.
IStream.Seek must not be implemented (must return E_NOTIMPL).
IStream.Stat must set cbSize field to -1 (0xFFFFFFFFFFFFFFFF).
Is there a way of dropping a file of unknown size onto explorer that has to be generated by the source application?
When providing CFSTR_FILEDESCRIPTOR, you don't have to provide a file size at all if you don't know it ahead of time. The FD_FILESIZE flag in the FILEDESCRIPTOR::dwFlags field is optional. Provide an exact size only if you know it, otherwise don't provide a size at all, not even an estimate. The copy will still proceed, but the target won't know the final size until IStream::Read() returns S_FALSE to indicate the end of the stream has been reached.
Alternatively can I just get the destination folder path and do all the copy progress + output internally to my application?
A drop operation does not provide any information about the target at all. And for good reason - the source doesn't need to know. A drop target does not need to know where the source data is coming from, only how to access it. The drag source does not need to know how the drop target will use the data, only how to provide the data to it.
Think of what happens if you drop a file (virtual or otherwise) onto an Explorer folder that is implemented as a Shell Namespace Extension that saves the file to another database, or uploads it to a remote server. The filesystem is not involved, so you wouldn't be able to manually copy your data to the target even if you wanted to. Only the target knows how its data is stored.
That being said, the only way I know to get the path of a filesystem folder being dropped into is to drag&drop a dummy file, and then monitor the filesystem for where the drop target creates/copies the file to. Then you can replace the dummy file with your real file. But this is not very reliable, and not very friendly to the target.

how increase the maximum number of simultaneously existing ports in erlang using windows

i am using windows and i want to Set the maximum number of simultaneously existing ports to 65536. in Erlang docs it says:
ERLAG doc here , visit for syntax
+Q Number|legacy
Sets the maximum number of simultaneously existing ports for this system if a Number is passed as value. Valid range for
Number is [1024-134217727]
On Windows the default value is set to 8196 because the normal OS
limitations are set higher than most machines can handle.
If legacy is passed as value, the legacy algorithm for allocation of
port identifiers will be used. Using the legacy algorithm, identifiers
will be allocated in a strictly increasing fashion until largest
possible identifier has been reached. Note that this algorithm suffers
from performance issues and can under certain circumstances be
extremely expensive. The legacy algoritm is deprecated, and the legacy
option is scheduled for removal in OTP-R18.
i used below syntax but it gives me syntax error, whats wrong ?
Since my reputation doesnt allow me to just comment, I'll just answer...
If you dont like to start the erlang VM through a batch script or the command window, you can create a link to the werl.exe and edit the Command it executes by right clicking and changing the Properties of said link. For example:
Default link Target: "C:\Program Files (x86)\erl5.10.4\bin\werl.exe"
Would become: "C:\Program Files (x86)\erl5.10.4\bin\werl.exe" +Q 65536
This also allows for different configurations for different projects/applications.
Another way would be, to use .bat scripts instead of a link.

compare 2 files and copy source if different from destination - vbscript?

I'm working on Windows XP and I need to make a script that would compare 2 files (1 on a server and 1 on a client). Basically, I need my script to check if the file from the client is different from the server version and replace the client version if it finds a difference (in the file itself, not only the modification date).
As you suggest, you can skip the date check as that can be changed without the contents changing.
First check that the sizes are different. If so, that may be enough to conclude that they are different. This can have false positives too though depending on the types of files. For example a unicode text file may contain the exact same content as an ansi text file, but be encoded with two bytes per character. If it's a script, it would execute with exactly the same results, but be twice the size.
If the sizes are the same, they may still contain different bytes. The brute force test would be to load each file into a string and compare them for equality. If they are big files and you don't want to read them all into memory if not necessary, then read them line by line until you encounter a difference. That's assuming they are text files. If they aren't text files, you can do something similar by reading them in fixed size chunks and comparing those.
Another option would be to to run the "fc" file compare command on the two files and capture the result and do your update based on that.

Resources