Prevent duplicate data in Webix File Manager? - file-manager

Can we prevent duplicate names of files and folders in the same folder
to avoid data replication? Is there any built-in
functionality in Webix File Manager?

I solve it by myself. You can prevent duplicate data by controlling response which contain "id" and "value" with a new id and a new file name. You can control it at backend in my case MVC controller.

Related

Can S3 Select search multiple objects?

I'm testing out S3 Select and as far as I understand from the examples, you can treat a single object (CSV or JSON) as a data store.
I wanted to have a single JSON document per S3 object and search the entire bucket as a 'database'. I'm saving each 'file' as <ID>.json and each file has JSON documents with the same schema.
Is it possible to search multiple objects in a single call? i.e. Find all JSON documents where customerId = 123 ?
It appears that Amazon S3 Select operates on only one object.
You can use Amazon Athena to run queries across paths, which will include all files within that path. It also supports partitioning.
Simple, just iterate over the folder key in which you have all the files and grab the key and use the same to leverage S3 Select.

Does emrfs support custom query parameters in s3 url?

Is it possible to add customer query parameters in s3 url?
We would like to add some custom meta data to S3 objects, but would like it to be transparent to EMRFS
Something like:
s3://bucket-name/object-name?x-amz-meta-tag=magic-tag
Then in our PySpark or hadoop job, we would like to write:
data.write.csv('s3://bucket-name/object-name?x-amz-meta-tag=magic-tag')
Trying this on the emrfs shows that it treats "object-name?x-amz-meta-tag=magic-tag" as the entire object name instead of ignoring the query parameters.
I can't speak for the closed source EMRFS, but for the ASF s3 connectors, the answer is "no". Interesting proposal though; maybe you should think about contributing it to the ASF. Of course, that adds a new problem: what if existing users are creating files with ? in their names —how to retain compatibility.

Apartment gem: How to rename tenant?

Can we able to rename the tenant in apartment-gem or we have to drop the tenant and create a new one to achieve this.
Please provide me some suggestions
I don't think this is available through the apartment gem, but it is fairly simple to do with a SQL query. It depends on your setup though.
If you are using Postgresql with a schema for each tenant:
ALTER SCHEMA old RENAME TO new;
If you are using MySql, you should rename the table name prefixes for the tenant. This should work if the databases are on the same file system:
RENAME TABLE current_tenant.table TO new_tenant.table;
Disclaimer: not tested.
You can change name (in my case subdomain) doing something like this:
1) Your schema should be some unique column in Tenant model (schema_id is fine). I am generating it's value from subdomain and Tenant ID.
2) In apartment.rb you require "apartment/elevators/generic". Then
config.tenant_names = -> { Tenant.pluck :schema_id }
so you use schema stuff like tenant name.
Then on the bottom of the file add
Rails.application.config.middleware.use "Apartment::Elevators::Generic", lambda { |request|
Tenant.find_by(subdomain: request.host.split(".").first).schema_id
}
Now after you make proper subdomain requests stuff, you or your tenant user can edit name/subdomain and data in schemas will be safe.
PS: Also see here - https://github.com/influitive/apartment/issues/242

Password encnryption in Liquibase properties file

To manage migration with Liquibase, I am using a properties file that holds all the information about the database connection. The pitfall of this file is that it discloses my database password since it is a plain text file. Is there a way to avoid that ? Does Liquibase support any kind of encryption for the properties file ?
Have a look on this jira: https://liquibase.jira.com/browse/CORE-1932
Looks like you may use your own property provider class to handle encryption etc. I haven't seen any docs for it, but you can browse commits for this task.

Possible to add a new column to an Amazon SimpleDB domain with a default value?

You can dynamically put a new attribute on a single record in a domain, but that attribute remains null for all other records. Is there an "update * set newattribute='defaultval" style statement that I can execute that will add the new attribute to all the other records? I have a lot of records and would prefer not to loop over them all and do it programatically.
I don't think there is any such option. We had a similar problem and had to do a hack. We added the Attribute_Name_Default as a separate attribute. We then wrote a wrapper for the Aws SimpleDB client which would check the default attribute for each attribute and assign the value to the original attribute before returning to actual code. Using dependency injection we did not have to change any code. If dependency injection is not an option just checkout the aws client from github make the change and use that jar as a dependency.