HTML pages loading and showing them in .txt file - java

I'm trying to build a search engine in java where i have a folder "crawler" to store downloads but when I open my project and click on that file my computer gets stuck because it tries to load all the urls and texts parsed from the html pages (100k+) and tries to show them in .txt files in the "crawler" folder.
How can I prevent loading and showing them in the file ?

Store your data files somewhere outside of your project. Use e.g. a properties file to store the location to your crawler folder. You should only include such files in your project like source code. Something you would upload to Git or SVN. Not the data files your application operates on. If you would store this data in a database, you wouldn't include the whole database in your project, but only the SQL files to create the tables and views.

Related

Where to put an excel file in a dynamic web project so that I can write and read it.(use it as DB)

I have a dynamic web project where I have login and register user and I am using POI to read and write the details in an excel file.
I want to deploy this project as WAR file on tomcat.
But the issue here is Tomcat is not able to find the excel file's path.
So where should I place the excel file.
Right approach would be to
Make a directory on your OS outside of the tomcat.
Write a startup servlet which will check if the directory already exists.
If the directory exists, go ahead and create the excel file into that directory, instead of keeping an already build file, that way you make sure that the excel file is not tampered by any developer accidentally and is only constructed by the application.

Create a new folder and insert files in that folder. Google Drive

I want to create a hidden folder in user's Google drive root directory and then want to insert some text files in that folder and later want to retrieve that files. I tried the quick guide and files are uploading fine but in the root directory and files are visible to user. From here I know how to create an empty folder. . But from here I do not understand how to use that code to insert the file in a particular folder.
So my Question is how to create hidden folder and perform CURD operations on files using drive API.
You're looking for the appdata folder. See here:
https://developers.google.com/drive/appdata

how can i open a file from specific folder of server to browser in jsp

I'm doing a web application where I can upload and download pdf files from server.
In this I created a pdf files and stored its path on the database.
What I want is when I search by some criteria (like filename) I should get list of files from db. When I click open link it should be opened in jsp.
Downloading part was done by me. What I need is just to open a pdf in jsp.
is it possible to open server file from jsp?
Place those files outside WEB-INF folder and access. WEB-INF folder is secure in a Java EE environment. By placing your files inside the WebContent folder and outside the WEB-INF folder will help you to access those files for download. You need to mention the full path for that file. E.g for an image your path will be https://localhost:9444/AppName/resources/theme/images/logo.png

Copy file to assets folder

After searching 1 hour i do not found any solution to my problem.
I want to move a file from sdcard to assets folder and also overwrite the existing file in assets folder (both file are sqlite database have same name with just a little difference in data )
??
Actually, The behaviour of the android .apk file is read only so the directory structure which are in that apk file follows the same, So no one can write this files or make changes on that at runtime,that's why You can't make a changes in /asset folder at runtime. you can read file from it (means copy files which are available in asset to any internal storage or /sdcard but not write it to vice-versa)
Its apply on all the directories which are build in .apk files. As per docs.
Assets folder are not Writable it is only readable so you cant copy from sdcard to assets, yes you can copy from assets to sdcard
If you want other apps not to access your database then what you can do is
Download the database from website. create a temp database also in app directory.
getDatabasePath() this will give you the path of the dummy database you have created now replace this with the one you downloaded.
PS.: User and apps having root access still able to access it and you cant do anything in that scenario

how to download folder containing files(pdf,png etc) from php server in android

i want to download folder containing files like pdf,jpg,png etc from web services.I have written a application that can download pdf,png file.But i want to download folder containing several files. So my question is- is it possible to download folder and if yes then how can i download folder from server in android. thank you
If you can download one file, why wouldn't you be able to download several? Create the folder on Android, queue the files and start the next download when the current is finished, filling the folder. Also Android supports ZIP, so that might be your best call.
Folder is nothing but an FILE but a different type of file. Once you get the folder you can list down the files in it. You already have URL with the folder, u just need to append the URL of the folder to the files in it and download them one by one.

Categories