Compare local file to downloaded file - c#-2.0

I am using below code to download file from below URI.
File needs to be only downloaded only if it does not exist in Local Machine.
Below code should run only if Application is trying to find the file. It finds on local machine but there is also a updaed version on Server. HOw i can check if file on local machine and server are same.
Or File present on server has been updated. So that below code should download file in two conditions
if File does not exist on local machine
if file on Server has been updated , in this case file also exist on local machine but we need to download newer verion of file and replace order one.
System.Net.WebClient webClient = new System.Net.WebClient();
try
{
webClient.DownloadFile("https://message.com/hello.csv", fieldsFilePath);
}

1 is just file exist
2 You would have to check the header and see if there is size information in there, try the WebRequest class. Then compare that to the size of the local file.

Related

Grails: get all files from War

I am using Grails 3.1.1
Last month, I had my project, but my hard-disk became corrupted because of a bad sector. I tried bringing my hard-disk to a "Recovery DATA"'s store.
But that store cannot recover my data, so my project's data is gone now.
But I still have the War file on my customer's server.
I just want to know: Is it possible to get my project back from a War file?
My War file is still running on the server, but all my source code is gone.
No it's not possible to recover your entire project, including source code, from a WAR file. The WAR contains the compiled version of your code, not the source.
If you don't have any option and need to rewrite the application again, I'll suggest some ways:
Remove your hard-disk from laptop/desktop. purchase HDD internal sata to external USB case for desktop/laptop hard disk. which connects with connectors with circuit(Sometimes this helps you in boot-sector error also).
Connect it to the laptop and check is it showing HDD. If yes check data is available not. If HDD size showing correctly but data not available then you can recover data with " EaseUS Data Recovery" software.
If all above fails?
Copy your project war from server to local computer.
Install WinRAR or any other unzip software.
Select and open your war file with it.
See above screenshot,
Where assets folder contains js, css, images and all your other files.
which may be minified if you set minifyJs = true and minifyCss = true in your application.yml
Now, see very important folder called WEB-INF
See above image which contains two folders:
classes : This is very important folder which contains your controllers class files and gsp files.
Controller files are .class files where for each action from controller will generate separate .class file. You can de-compile dot class files using many online/offline tools.
In case of gsp you will get original files.
Also you will get application.yml and other files as it is.
Hope it helps you.

URLSession - Download remote directory

I am currently using code based on this turtorial http://sweettutos.com/2015/11/06/networking-in-swift-how-to-download-a-file-with-nsurlsession/ to download a remote file using URLSession.downloadTask. This was suprisingly simple. However I would now like to download the entire contents of a remote directory.
Can I use URLSessionDownloadTask or is this only for single files? If not then how can I obtain a list of the files contained in the remote directory so that I can use downloadTask on each of them individually?
First of all you are thinking it in wrong way.
From the remote server, only a file that can be downloaded(not the folder) and save inside the app. The file extension that you have to download should be configure from a server side. Then the client side which you can use Sweettutos tutorial.
First thing you have to do was :
Talk with the server side developer that he had to zip the remote directory in (.zip or .rar) that you can download it only.
Then, at your code download the url which the server-side given to you and save it in document directory, extract and read the file which you want to.
At the URLSession Documentation :
Download tasks retrieve data in the form of a file, and support
background downloads and uploads while the app is not running.
So, there is no way you can download remote directory (unknown file extension) until you make that remote file available to some file extensions from the server-side.

How can i set "FILES_ROOT" to a folder on server?

I want to use RoxyFileMan to manage uploaded images and files. But I should save them on the server. As you know, RoxyFileMan Upload uploads files and images in a folder named Uploads in a fileman directory. We can change FILES_ROOT to another local path to change the directory files get uploaded to.
But, I want to upload files on the server and then read them from the server after they've been uploaded so that they can be edited in ckeditor.
Can anyone please provide advice/guidance on how to achive this outcome?
It's not very clear how your question is meant, but if I understand you correctly, you are using RoxyFileMan on a local server and want to upload files to a remote online server, right?
Roxy uploads files to a directory on the server it is run from. Which means if run from localhost, it will use directory on your localhost. If run from a server, it will use a directory on server.
As far as my knowledge goes, you cannot upload from a localhost to an online server directly.
You could maybe achieve that using some custom script to open an FTP connection, but then you would have to also remake all the code to also load images from there... which would be rather silly.

Access files in Torch iOS

I have an image file and I want to access it in my Lua file. I already put the file in the project folder. However the call
local path = system.pathForFile("xxx", system.DocumentsDirectory) fails to work.
How should I do it?

How to refer file located in current application into file in SD card

I have a one script file in my current application.. The path for same look like this.
D:\myproj\Example\www\abc.js
while running my application in device it will download one file into my SDcard dynamically.
I need to parse my downloaded application and need to set this "abc.js" file path in this.
I can able to set path if my file is in SDCard , but dont know how to refer path which is in my current application..
If you have that file on SDCard, then the full path to it will be as follows:
file:///SDCard/myproj/Example/www/abc.js
ADDITIONAL INFO:
If your file is located in cod file, then there is a way, but it is not documented and it is not guaranteed that it will work on all devices and RIM OS versions.
Code below shows document.htm encapsulated in modulename.cod in BlackBerry browser.
BrowserSession session = Browser.getDefaultSession();
session.displayPage("cod://modulename/document.htm" );
Try to use cod://modulename/abc.js to specify path to your js file.
To reference an application embedded file (in this case an image file stored in images directory):
"file:///local/images/embedded_img.png"

Resources