https://wiki.openstreetmap.org/wiki/Overpass_API/Installation#Setting_up_the_Web_API I have been using Overpass api(web api) using cgi, but i need to move to fastcgi to improve performance.hence i need to know how to alter my apache(2.4.18) httpd.conf file to use with fcgi module? P.S: Overpass api does not use php, rather we send the query to binary file, so in other words i need to know how to use fcgi module for binary files?
https://github.com/drolbr/Overpass-API/issues/209
This is the fastcgi version for Overpass-Api.
Related
I've been working on a Ruby parser, that fetches data from different API sources, and compile this data into a clear read-to-use JSON file.
For my use case, i need to store the data i'm initially fetching from the different sources as i don't want to fetch them each time I use the code.
For now i'm writing the JSON i'm receiving from the API sources locally into different JSON files stored in a data folder where my ruby script is. Then i read those files again, parse them and generate my new formatted JSON file that i'm gonna use later in a Rails app.
For that matter i want to create a Gem from this ruby script, which i'm currently working on. Nevertheless i'm not sure to fully understand how and where i should store that data (the one i'm fetching and the one i'm generating).
For now i have tried to simply keep the code as is and simply try to write the file like so:
URI.open("path/to/where/i/wanna/store/file.json", "wb") do |file|
file << URI.open(fetched_data_url).read
end
But wherever i try to write the data i get a :
No such file or directory # rb_sysopen path/to/where/i/wanna/store/file.json
Which in a way does not surprise me that much as i expected it to work in different ways in the context of a Gem. But i'm still missing something here about how to handle this. I'm not sure to fully understand how that all works, especially when you use paths in a gem that will ultimately be used in a rails project.
So several questions here:
Whenever you use a path to write a file inside a Gem, is that path relative to the gem or to the project that will ultimately use that Gem? (and consequently will the file be written inside the project that uses the Gem?)
In that precise use case here, what should i do about it? Where and how do i store my data so that i can use it later? knowing that i need to store it as a JSON file and that for now any attempt of writing a file ends up with an error.
Any input on what i'm misunderstanding here would be much appreciated ! Thanks !
Whenever you use a path to write a file inside a Gem, is that path relative to the gem or to the project that will ultimately use that Gem?
There is nothing special about using file paths whether the code is part of a Gem or not.
path/to/where/i/wanna/store/file.json is a relative path, which means it is looked up relative to the current working directory of the user who started the script. That's nothing special about Gems, that's not even anything to do with Ruby. That is just how file paths work. Relative paths are relative to the current working directory, absolute paths are not.
Where and how do i store my data so that i can use it later?
This depends largely on the Operating System Environment. Different OS Environments have different conventions where to store what kind of files. E.g. your files look like they fit the definition of a cache and Windows has a dedicated folder for caches, as does macOS, as do Linux distributions that follow the Linux Standard Base, as do Desktop Environments that follow the Free Desktop Standards, as does Android, as does iOS, …
For example, the Free Desktop Group has the XDG Base Directory Specification, which defines directories for application state, application data, application cache, and many other things for XDG-compliant environments. Microsoft has similar specifications for Windows. The LSB has something to say as well.
I need my ROR app to search files like pdf, xml, doc, xls etc...
I'm using apache solr to do this.I'm sending query string to the solr url and able to retrieve the details in json format and display the file names in my app views.
I need to make the file names clickable so as to open those files.I don't know how to make this.Any help will be great.Is there any option in apache solr to open those files or any gem supports this.
In apache solr app screens also I,m not able to open files.I don't know whether there is any option in apache solr.This may sound quite silly, but I'm new to Apache solr and don't have much idea about the working of solr.
I don't know much about document searching. If you use sunspot solr gem there is an add-on which is used for document searching. Have a look at this: sunspot_cell
Can someone point me to some documentation/libraries for working with files in a Rails app?
Specifically I need to scan folders for files and for each one read & parse some data from it. I've not done this in Ruby before so not sure where to look.
Thanks!
Parsing files is very easy in Ruby. To do it in Rails, you simply use the Ruby file libraries. Without knowing what you want to do I can't give you any examples, but I can point you to the Ruby API.
File: http://www.ruby-doc.org/core-1.9.3/File.html
Directory: http://www.ruby-doc.org/core-1.9.3/Dir.html
I'm testing it and Nokogiri does not seem to respect Robots.txt file. Is there someway to make it respect? It seems like common question, but I could not find any answer online.
Nokogiri parses the HTML or webpage that you give it. It does not know anything about the robots.txt file for the domain where the page you happen to have requested resides.
I presume that you want to ignore in-site links that are in robots.txt?
Since you've tagged this Rails, I'll assume you use Ruby. In that case you can use the Mechanize library which has the facility to use the robots.txt file.
There is also the original Perl version and other language ports if you prefer those.
The task: Serve the files located in a local folder on the server to clients over http/80.
In the end, I plan to emulate the folder on the client but that doesn't concern my question.
So, there is an existing Rails app (rest based/xml) on that server that the clients would use in conjunction with these files.
I don't need any logic to be done on the files either on upload or download so I ask myself:
Do I need to involve my Rails app in serving these files?
Shouldn't the webserver solely handle the link between the local files and the clients?
Would this new Rails Metal or Rack integration be part of the solution? (not familiar with either)
I guess the important thing here is http over port 80.
Thanks for any pointers or advice on the matter,
cheers, Max
I know that with the good time investment I could look all this up for a couple of hours and figure it out but I am very very busy saves me alot of time.
Apache? Just add another <Directory> section to your configuration for the Rails app:
Alias /static-files /path/to/the/static-files
<Directory /path/to/the/static-files>
Order allow, deny
Allow from all
# whatever else you need, Options, AllowOverride, etc.
</Directory>
Put the files in a subdirectory of the "public" directory - as with stylesheets and javascripts
you can use X-Sendfile if you are using Apache or Lighty (see this blog post). Nginx supports X-Accel-Redirect. Both of these approaches will let your web server directly send the file without involving your rails app.