Restlet framework - Edit agent.properties file - libraries

I'm using the ClientInfo class from RESTlet to get the user agent from the browser used by the client.
It works fine but it is kind of out-dated (the new Opera is detected as Chrome, and so on...) so I want manually insert my templates to the agent.properties file. The problem is I don't know where the agent.properties file is. I just have the jar file from RESTlet.
From the link above, it says:
Restlet users has the ability to define their own way to extract data
from the "user-agent" header. It is based on a list of templates
declared in a file called "agent.properties" and located in the
classpath in the sub directory "org/restlet/data".
Anyone knows where is that agent.properties file?

It is in the core restlet library jar (org.restlet) at version 2.2, Sitting in the same package as the ClientInfo class. I have not checked back to 2.0 but I suspect that it remains there.
the github location for the master copy is currently at https://github.com/restlet/restlet-framework-java/blob/master/modules/org.restlet/src/org/restlet/data/agent.properties and I'm sure that a patch to deal with upgraded browser versions, could be welcomed.

Related

Download File from Dropbox folder in Rails application

I am trying and failing to download a single file from a "open for public" dropbox folder which a 3rd party created for others to use. I am trying to use this within my Ruby On Rails Application (file is changing but folder stays the same all the time).
I want to:
List all files in that public folder
Make sure that there is only this one file
... and this file has the appropriate filename (ending in .xlsx in my case -> an Excel file)
Download the file (e.g. using RestClient gem)
Save as an attachment to a new database record (Record is existing already and is used inside the app)
Thanks for any hints on how to proceed here! I Than plan to update the file with a cron-job daily.
Its kind of an API to the public :-)
Thought there must be a simple gem to interact with dropbox folders but couldnt't find any.
I used Rest-Client to open the dropbox folder and Nokogiri to parse the content but cant work through the glibberish produced. I gave up after an hour of work and decided to ask here!
Dropbox does offer a public Dropbox API, but it doesn't offer an official SDK for Ruby in particular, but you can either use the Dropbox API HTTPS endpoints directly, or via a third party library if there is one that works for your use case.
Exactly how you would accomplish this would depend on the specifics of the scenario so you may want to read through some guides first to get started, e.g.: Getting Started and File Access.
For instance, depending on how you have access to the content (e.g., directly via a folder in a connected account, or via a shared link, etc.) some of the following endpoints may be useful:
https://www.dropbox.com/developers/documentation/http/documentation#files-download
https://www.dropbox.com/developers/documentation/http/documentation#files-list_folder
https://www.dropbox.com/developers/documentation/http/documentation#files-list_folder-continue
https://www.dropbox.com/developers/documentation/http/documentation#sharing-get_shared_link_metadata
https://www.dropbox.com/developers/documentation/http/documentation#sharing-get_shared_link_file
The Dropbox API v2 Explorer can also be a useful tool for trying out Dropbox API calls.

Getting Twitter data in a web extension without remote scripts

I am developing a WebExtension for Firefox. In order to post my extension, it must not have any remote scripts in it.
In order to display some tweets in my extension's menu, I have used the Twitter-Post-Fetcher library, but I can't post my extension with it because the library uses remote scripts from twitter.com.
I prefer not to use the Twitter API if possible, because the requests would come from the extension's users.
No remote scripts means that if you are going execute code in the context of your extension, then the code must be included in the extension package, not hosted on some server. While there may be other ways to accomplish this (e.g. running the code in the page context, which may be acceptable, but may not), the default way to accomplish this is to: download the code that you are executing and use a copy that you include in the extension package.
This is the case for all code, including libraries such as jQuery. It is highly recommended that the code be an exact byte-by-byte copy of code that can be downloaded from a public repository, and that you indicate within your extension package the exact URL you used to obtain the code.
The reason for this is security. If downloading code at runtime was permitted, then that code could be trivially changed at any time. It would mean that having the add-on reviewed by Mozilla would be of no benefit.
Please see the Review Policies page on MDN, and all the pages linked from there, for more details.

Using tamper data from within my plugin

I'm trying to develop an extension to modify certain script loads on the fly in Firefox (eg. building a JSON params file having a fixed file name, intercepting it's original load and injecting the custom file in). Is there any way to utilize the functionality of Tamper data or similar plugins for the intercept and replace part? Or could someone please point to a resource which could help me do the intercepting by myself?
Please pardon me if this was obvious, I'm starting out with plugin development for Firefox.
I solved this myself, went with a separate ASP.net project to perform these functions and redirected to generated files using Fiddlercore packages

how can i know the physical path from selected file (fileupload bootstrap)

I´m making a web application in MVC, I have a view where I select a file from my pc directory (like opendialog form in windows applications), bootstrap´s fileupload gets the file name but I want to know his physical path to. Because I want to save it in my data base (where file come from).
Anybody can help me??
Thank you in advance!
You can't, this information is never sent to the server for obvious security reasons. Only the filename is sent to the server. So you cannot store the physical path where the file originated from the client machine on your server.
When you upload a file via a web browser, the actual file path is not supplied. This is seen as being a security feature.
There is no way to circumvent this using pure HTML. Some people get around it by using a plugin such as Flash or Silverlight to upload the file, but I recommend living with this feature if you can.

Bug in MonoTouch/MonoDevelop or something else?

I load up a few XML files with my app in Mono when deploying to iPhone. I edited one of those XML files in Windows through a LAN connection to the Mac on which the file resided. After editing the xml file the app seems to refuse the xml file exists anymore. THe properties are still 'copy always' and 'content' where relevant for the XML file, I know it exists and I can even open and edit it MonoDevelop. But in app isolatedstorage.fileexists("filename.xmL") ALWAYS returns false.
I deleted the file and daded it back in, I copy+pasted the file, heck, I even renamed another xml file to the same filename and that xml file stopped being recognized.
Not sure what to do now?
Did you try "File.Exists" ?
Keep in mind that IsolatedStorage's main goal is to isolate the files from outside (the application) usages. As such MonoDevelop will copy to the application folder, but not in the isolated storage. Same is true for desktop applications, MonoMac apps...
FWIW IsolatedStorage API exists in MonoTouch to help you port existing code (from the 'desktop' framework or WP7) but there's no reason (beside portability) to use it. In iOS applications are already isolated (from each other) and so are their files.

Resources