Is there a way to ask InstallShield to set "modified" timestamp for installed files to current date/time? - installshield

I have an application that precomputes and caches some data after installation. The logic to check if we need to rebuild this cache was pretty and simple: if the cache "modified" timestamp is older than the source file, then we need to update it. This way when we change something in this file or simply install a new version of application, timestamp of relevant source file is going to be updated, become bigger than timestamp of cached file and cache will be rebuilt once. Then "cached" file timestamp gets bigger than "source" and no further rebuilds happen.
Well, it worked, except it turns out now that InstallShield does not set "modified" timestamp for files, just copies timestamps of original files. Is there a way to override this behavior and force IS to set "modified" timestamps to date/time of the moment of installation?

Related

How to auto Archive by version history

I want to put the files from Document library A into another document library called Archive. I have to version history enabled, limited to 10. when a new file gets added in, the older files get deleted. How can I move them to another document library called Archive. How can I achieve this? Please advise.
Using MS Flow you can build a simple workflow that will copy a file from one library to another one. The workflow can be triggered upon file add (list item) event. Everything can be done in MS Flow browser designer. When adding file to archive library you need to change its file name (e.g. add time stamp) so you will not overwrite existing file in archive library.

getting info from an MS SQL .bak file

I am writing an Electron app that, among many other things, restores an unknown .bak file to a MS SQL server and then extracts more information. In order to do this successfully, I need to extract some info from that .bak file programmatically (so SSMS cannot be used). I will be using sqlcmd, since that can be run by Electron's node.js backend. Unfortunately, I have a bit of a chicken and egg problem, because it seems I cannot restore a .bak file without knowing things about the paths for the .mdf files specified within the .bak file (that cannot be found without first restoring it). There is a RESTORE WITH MOVE option, though this seems to also require knowledge of the paths inside the .bak, which cannot be determined from the .bak itself. How might I get this information, or is it impossible?
Read about RESTORE FILELISTONLY.
At this link you'll find further statements one can use together with RESTORE in order to fetch meta data.
The returned resultset of FILELISTONLY will give you the LogicalName, the file's type (Data or Log), information about the file group and much more.
The other statements provide other meta data. Just check it out...

Kentico 8.2 - Is there a way to delete Attachment History from the GUI

Our attachments have been stored in our database for a very long time, and it has caused the database to become huge and our backups to be extremely unreliable. We have moved our attachments to the file system and that shaved off a great deal of size.
Now our largest table is CMS_AttachmentHistory. I've been able to test brute force deleting every row in SQL (and every row in the CMS_VersionAttachment junction table). But is there a way to accomplish this in the Kentico Admin GUI without having to resort to this?
When I say brute force delete, I mean:
DELETE FROM dbo.CMS_VersionAttachment
DELETE FROM dbo.CMS_AttachmentHistory
There is an option in the GUI that will do this, but it's also going to impact the page version history. If you go to Settings > Content > Content management and look in the Workflow section, you can see a setting named Version history length. Reducing this to a lower number (I believe 20 is the default) will reduce the version history stored to reflect the new value by deleting the unneeded rows.
This will affect all version history though, not just the attachment, but also the pages themselves. That being the case, you would need to decide if you need/want to keep the version history of the pages or not.
If you don't want to lose that history, then I'd say that a good option would be to write a script that can set the AttachmentBinary column to null for the records that you don't need/want (given that you say that you now store the files on the filesystem, any current versions will have the correct value, so this is probably all of them)
Not sure about 8.2. But you can try to experiment with recycle bin/objects. There are a couple topics: topic 1 and topic 2. I just check it puts there attachment every time you delete it, even though I have in setting "files on disc". You can do like Kentico recommends set binary field to null or write script using API.

Get creation date of an Excel file via PackageProperties class

I generate a heavy file using Apache POI within 10 minutes. To minimize the memory usage and time, I generate the file only when I detect a change in my record. If not, I will just fetch the old most recent Excel file for download. The problem is how can I get the creation date of the old Excel file? I am thinking of using the Apache's PackageProperties class although I don't know how to achieve that.
Get the file via FileInputStream.
Read that file via new XSSFWorkbook(FileInputStream inputStream).
I don't know the next step here to connect #2 and #4.
Next is get the PackageProperties attribute of that workbook.
Use the PackageProperties.getCreatedProperty() to get the creation date.
If there is a change detected after the creation date of the file, we then start generating the file, then overwrite the old version of the file with the new one, then proceeds to download. If there are no changes detected, proceeds to download the previous file.
Now, how can I get that PackageProperties attribute of the workbook?
I had checked this other entry with a similar case (but using a CSV rather than Excel), but it seems using the last modified property of the file is not always identical to the creation date.

Modify .csproj in pre-build event

tl;dr: How to modify the .csproj file during publishing with ClickOnce while executing pre-build events?
Long:
I'm using TFS hosted by Microsoft for version control of my solution.
When publishing with ClickOnce, I get the latest revision number + 1 without problems. I also can successfully write the new version number into the .csproj file outside my build-process.
The problem is, that the .csproj file doesn't get updated during the build process - it might be in a write-lock. I get a notification inside Notepad++ about the modification of the file, but the file still contains the old version and VS didn't notice any changes.
The only solution by now I found to resolve this issue:
Move the revision update into the post-build events and add 2 instead of one to the actual revision number. Unfortunately this would cause that revision number would be out of date whenever other developers check-in code.
Ok, strike that... :(.
After some more diffing, you'll need to override the GenerateApplicationManifest target to get this to work. That target doesn't use a *DependsUpon propertygroup, so it's harder to overwrite. The whole flow is defined in the Microsoft.Common.Targets file which you can find in the %windir%\Microsoft.NET\Framework{cpu}\{version} folder.
See also:
http://social.msdn.microsoft.com/Forums/vstudio/en-US/3a94df52-74c1-4fca-a830-ab530ec49207/use-msbuild-to-create-clickonce-app-files-in-alternate-location

Resources