How to allow other machines in same LAN (PC/Mac/Mobile Devices) to download from our Electron app? - electron

The question is weird but it’s because I don’t even have any knowledge about this concept.
Here is the thing:
I’m working with an Electron app that is a whiteboard application.
A user can draw something onto the board and export it to PDF.
This PDF will be saved into a folder (I assume AppData folder on Windows or something like that on MacOS), so that other machines can access (download) it.
Now I don’t know how to allow other machines to download this file.
Normally we will need to share the folder (on Windows), and other machines can go to Networks/our-machine to find and download the shared files.
But the owner of this app said that we can download it if both machines are on the same LAN, using some kind of URL like 192.168.x.x:6554/mypdfile_somerandomid.pdf
(this URL can then be turned into a QR code so that mobile devices can use camera to access the link quickly)
I don’t know how is this possible. Can you please suggest some solutions?
Thank you very much

Writing URLs
A URL, or uniform resource locator, is a form of address that refers
to a location or file on a network. The address is formatted like
this:
scheme://servername.example.com/folder
The scheme specifies the protocol or type of server. The example.com
portion of the address is called the domain name. If a username is
required, it is inserted before the server name:
scheme://username#servername.example.com/folder
Some schemes require the port number to be specified. Insert it after
the domain name:
scheme://servername.example.com:port/folder
Without public share that windows offers, you will need other third party software to accomplish what you want, which will do the same as windows does.
Better just share the folder your Electron app uses to export PDFs.

Related

Delphi iOS import/export data file using email

Assuming I have an app on iOS that generates a data file, and I would like the user the ability to import/export that file, how is that best done?
Import from email in xcode/objc:
http://www.raywenderlich.com/1980/email-tutorial-for-ios-how-to-import-and-export-app-data-via-email-in-your-ios-app
Is this possible in Delphi? (i.e. register an ios app as file handler for a specifc file type)
(I am planning on handling export through generating an email attaching a file? I suspect this is probably possible although if anyone knows for sure, feel free to share)
It has been asked why import/export across email is useful.
Because legally EU/US law and cloud storage is difficult with personal data
You don't need any desktop computers
You can sync data between ios and android apps if user changes mobile
You are not bound to any specific cloud provider or anything similar
Quote from above article where author explains where the file path is passed to the app:
application:didFinishLaunchingWithOptions, passing the URL in the
UIApplicationLaunchOptionsURLKey, or via application:handleOpenURL.
But since I have not used Delphi for ages (for mobile), I would just like to know for sure if Delphi supports this or not before buying a new version
You can send files using email. I use the email component from D.P.F Delphi iOS Native Components to send file attachments using email. I don't see any reason why you should not be able to send your data file as long as it is not too big. Use a file extension that is unique to your app.
You could also use iTunes filesharing in order to give your users direct access to your data file. Just set the UIFileSharingEnabled key in your info.plist and store you data file inside of the documents folder. This does require a desktop PC, but it is still a very nice addition to sending backups by email.
Depending on your needs,
I would suggest looking at perhaps saving the file to a server using FTP and Indy and then on the other device you can retrieve it?
http://www.delphipages.com/forum/showthread.php?t=208397
Set the TidFTP connection parameters
Do a FTP put : // ftp.Put('testfile.txt');
Perhaps have a Database with a column that you specify a file version etc
Do a simple Get request if you want to retrive the file with the filename
or Alternatively you can save it to a blob field in a DB and have the other device read the blobfield if you don't want to do it via FTP

Ol3-Cesium Example not working when run from local PC

I can view the OL3-Cesium examples from the website online perfectly.
When I view this example, I get the 3D view when I click on enable/disable button.
Now I have downloaded the release folder. When I try to view the same example from the examples folder, the example does not work the same.
This is the output when I open main.html from my system:
I don't know if I am missing something here
The overall problem is that you are running the example directly from the filesystem. The directory needs to be hosted under a web server, even the most basic server will do. For example, if you have python installed, just run python -m SimpleHTTPServer in the root and browse to http://localhost:8000/.
The exact problem you are seeing is that the default imagery provider is configured to use the same URI protocol as the site being visited, i.e. if you are at an http site, it uses http. If you are at https, it uses https. Since you opened directly from disk, you are using file://, which causes the imagery to try and use file:// as well. Since you have no such imagery on your system nothing shows up in the globe.
It is technically possible to use Cesium and Open Layers completely offline, but care must be taken and it looks like that example was not written with it in mind.

Share path between server and client (delphi) application

On my LAN I have 2 applications running in server/client mode developed with Delphi (but I don't think this is important).
On server PC (where run server application) there is a USB hard disk, this hard disk have many folder and subfolder shared on LAN.
Now I need to do this:
1. The server application must send to client application a shared folder (for example "d:\folder\subfolder\", then the client application must open this path to show the files (using explorer).
2. The user, using client application, must select a shared folder (for example "\SERVER\folder\subfolder\") and send this to server application, the server application must convert this path in local path (for example "d:\folder\subfolder\") and save it inside a database.
My problem is: is there a simple way to:
1. Convert the local path to remote path before send it to client se the client can open it easily?
2. Convert the remote path to local path before save it inside database.
NOTE: the main folder or main drive of shared hard disk can be change.
NOTE2: I'd like use IP address and not windows pc name if possible because it can be change.
I hope I explained.
Thanks
If I understand you correctly you want to acces some files that are inside some shared folder. Right?
If that is true then go and acces to these files unsing the network path which is formed in this manner
\\Networkedcomputer\SharedFolderName\Subfolder\...
where:
NetworkComputer is either a name of computer that is sharing that folder or its IP adress. I asume you are interested in using of IP adresses since you already have acces to that information from your other networked components.
SharedFolderName is the network name that was chosen when specific filder was set to be shared on the network. This name doesen't even have to be the same as the name of actual folder
Subolder can be any subfolder of the share folder
In order to get networked path to your shared folder you do need to know network name of the shared folder.
Perhaps you could even retrieve this information from SelectDirectory method which shows special dialog for selecting of directory, but I'm not sure if it does support networked folders. If not you could make use of OpenDialog.
NOTE: In any case when selecting the shared folder either with the use of SelectDirectory or OpenDialog you would need to go to that folder through Network Places (Network -> MyComputerName) and not directly through MyComputer.
But if you need to aquire the shared name for any local folder programatically I think you would have to go and read that information from registry as I'm not sure there is a specific API call for this.
EDIT: The answer on SO question below refers to several Delphi components that can be used for managing of Shared network resources. So I guess you could use to retrieve the network path for a shared local folder but I haven't tried them out.
How do I remotely obtain a system's network shares and connections?

Want to open a dialog box to open file in web browser based application

Am using JSF and primefaces to develop web application.I want to open existing files on client machines using dialog box which prompts the user to select a path and the corresponding file. Please suggest a component which can be used.
While I doubt the feasibility of your intentions; accessing content directly on a client's machine (some security implications there), a combination of <p:media/> and <p:lightBox/> will work for you. There are file type restrictions imposed by primefaces though (multimedia files and pdf only) The <p:media/> can be embedded in the <p:lightBox/> like so :
<p:lightBox>
<p:media value="{yourBean.filePath}" width="100%" height="300px">
</p:lightBox>
Like I said, I doubt the feasibility of directly streaming content from a client's local filesystem. How do you intend to use the path c:\Users\john doe\my documents\my books\book.pdf on a user's local system within your own web application, without first uploading the file to your own webserver? With image files, you might have some success loading the file into memory and streaming the file directly from RAM using <p:dynaImage/>...consider the scalability of this option too for a high traffic application

Open a file that is on a file server from a webpage?

I am working on an internal application. We have a website that displays all our SSRS reports for a group of work. I have been asked to see if I can link all the files (pdf, word, excel) for the group of work. These files are stored on a file server that users viewing the reports have access to. Each group has its own group of reports and shared files.
Is it possible to open the files (without downloading them) from a webpage? Meaning that they file is opened from the file server? I don't want people to download a copy of the file.
I am pretty sure this can work with IE because sharepoint does it. However, other browsers may have an issue.
EDIT: What I would like is to have a web page with links to the files. When they click on a link (say for a word doc), word will open the file that resides on the file server. Without out a local copy downloaded from the network share.
EDIT2: Please note, I know what I am asking is probably not possible in all browsers. I am more or less just making sure. It seems possible in IE using activeX, but out side of that browsers do a good job at keeping processes inside a sandbox.
3 options. Remember this is for an internal website.
link to the share using file://. This will have the side affect of downloading the file to be viewed. As long as user clicks open every time it should not be a big deal.
Use JavaScript and activeX to open word (excel, reader, ect) passing in the file path as a command line arguments. This works only in IE and in win7 (probably vista) user will get a pop up asking if it is ok for the activeX control to run.
Create a new protocol. openfile://. This would be set up to run an application that is installed on the client machine which would open the file. Since it is internal, the application could be installed on the machines without issues. This also requires a registry change.
I haven't picked one as this change is still being looked into but i figure I would update this in case someone runs into something similar.

Resources