Search for field name ends with - odata

I am new to OData and I have a scenario to search for field name that contains words I am looking for. Below is the data I would like to search for the field name that ends with _isApproved. I am not sure if it possible to do such search.
[
{
"name": "John",
"address": "123 Example Dr.",
"city": "Frederick",
"zipcode": 654334,
"extension_345435423_isApproved": true
},
{
"name": "Smith",
"address": "124 Example Dr.",
"city": "Frederick",
"zipcode": 654374
}
]

Related

Postman - POST users into BIM 360 bug?

https://forge.autodesk.com/en/docs/bim360/v1/reference/http/users-POST/#example
Following the link above, I am trying to create a new user in BIM 360 using Postman but I am unable to set their name. I tried to create a similar user into my own account as shown below.
URI:
https://developer.api.autodesk.com/hq/v1/accounts/:account_id/users
Method: POST
Authorization: Bearer **************************
Content-Type: application/json
Body:
{
"email": "john.smith#mail.com",
"company_id": ************************************,
"nickname": "Johnny",
"first_name": "John",
"last_name": "Smith",
"address_line_1": "The Fifth Avenue",
"address_line_2": "#301",
"city": "shanghai",
"postal_code": "20000",
"state_or_province": "Shanghai",
"country": "China",
"phone": "1234567",
"company": "Autodesk",
"job_title": "software developer",
"industry": "IT",
"about_me": "Nothing here"
}
However the result when sending this request creates a new user with the name New Member as shown below.
{
"account_id": ************************************,
"role": "account_user",
"status": "not_invited",
"company_id": ************************************,
"company_name": "Autodesk",
"last_sign_in": null,
"default_role": null,
"default_role_id": null,
"access_level": "account_user",
"id": ************************************,
"email": "john.smith#mail.com",
"name": "New Member",
"nickname": "Johnny",
"first_name": "New",
"last_name": "Member",
"uid": null,
"image_url": "http://static-dc.autodesk.net/etc/designs/v201412151200/autodesk/adsk-design/images/autodesk_header_logo_140x23.png",
"address_line_1": "The Fifth Avenue",
"address_line_2": "#301",
"city": "New York",
"postal_code": "10011",
"state_or_province": "New York",
"country": "United States",
"phone": "(634)329-2353",
"company": "Autodesk",
"job_title": "Software Developer",
"industry": "IT",
"about_me": "Nothing here",
"created_at": "2016-07-27T19:09:31.998Z",
"updated_at": "2019-02-19T08:59:57.852Z"
}
Is this a bug? When I check BIM 360 the user is created with the name New Member and I am unable to create any members with my own custom names. Are there any solutions to this?
The name attribute will not be synced between BIM360 and Identity services until the user logs in for the first time.
Before then name won’t be set and will default to New Member.

Importing JSON or CSV data to Firestore using Swift

It appears there is still no way to import JSON or CSV files directly to a Firestore database. Many of the suggestions are for JavaScript-based apps that do not translate well to Swift. Does anyone have a good Swift solution for adding data to a Firestore database using JSON/CSV?
//example json
[
{
"name": "Stone Cove Marina Inc",
"email": "NOT IN SAMPLE",
"category": "Docks",
"category2": "Marinas",
"category3": "Dock Builders",
"address": "134 Salt Pond Rd",
"city": "Wakefield",
"state": "RI",
"zip": 2879,
"phone": "(401) 783-8990",
"website": "http://stonecovemarinari.com"
},
{
"name": "Bluehaven Homes",
"email": "NOT IN SAMPLE",
"category": "General Contractors",
"category2": "Home Builders",
"category3": "",
"address": "5701 Time Sq",
"city": "Amarillo",
"state": "TX",
"zip": 79119,
"phone": "(806) 452-2545",
"website": "http://www.bluehavenhomes.com/"
}
]
//here is the database structure
//collection is "businesses"; each "business" gets a document id; within each document id set the data
database.collection("businesses").document().setData(/*data here*/)
You can try
let str = """
[
{
"name": "Stone Cove Marina Inc",
"email": "NOT IN SAMPLE",
"category": "Docks",
"category2": "Marinas",
"category3": "Dock Builders",
"address": "134 Salt Pond Rd",
"city": "Wakefield",
"state": "RI",
"zip": 2879,
"phone": "(401) 783-8990",
"website": "http://stonecovemarinari.com"
},
{
"name": "Bluehaven Homes",
"email": "NOT IN SAMPLE",
"category": "General Contractors",
"category2": "Home Builders",
"category3": "",
"address": "5701 Time Sq",
"city": "Amarillo",
"state": "TX",
"zip": 79119,
"phone": "(806) 452-2545",
"website": "http://www.bluehavenhomes.com/"
}
]
"""
do {
let json = try JSONSerialization.jsonObject(with:str.data(using:.utf8)!, options: []) as! [[String: Any]]
for var i in 0...json.count - 1
{
database.collection("businesses").document().setData(json[i])
}
} catch {
print(error)
}

How to represent typical json information

Below JSON contains 4 items in an array. If you look at each item it is some what shows incomplete keys. I am unable to figure out how to represent the consistent data in iOS (of any UI design patterns). By looking at the below information somewhat they are interlinked to each other for example parent key value information is same as company key value and also in employees one value is same as name key value. This seems to be very typical.
{
"arays": [
{
"company": "Microchip",
"parent": "File",
"employees": [
"John",
"Mike"
]
},
{
"company": "Apple",
"mobiles": [
"111-111-1111",
"121-121-1212"
]
},
{
"company": "File",
"parent": "Apple",
"addresses": [
"2600 space center blvd",
"2700 university dr"
]
},
{
"name": "John",
"mobiles": [
"222-222-2222"
],
"addresses": [
"Time Square, NY"
]
}
]
}

Rails MongoDb has_many and embeds_many

I have the following table structure for example - Users, Projects.
Users has_many Projects
Projects has_many Photos
But i want to embedded certain basic content of Projects and Photos into the Users Table so that i can reduce the number of database calls for certain pages.
Below is the structure i have come up with.
Users Table
[
{
"id": "LONG-MONGO-ID-HERE-USER-1",
"name": "Harsha MV",
"email": "harsha#mink7.com",
"gender": "male",
"telephone": "9986377561",
"is_pro": 1,
"projects": [
{
"id": "LONG-MONGO-ID-HERE-PROJECT-1",
"name": "Nike",
"url": "http://nike.com",
"logo": "logo_nike.jpg",
"photos": [
{
"title": "Some title for an Image",
"file": "project1_photo1.jpg"
},
{
"title": "another title for an Image",
"file": "project1_photo2.jpg"
}
]
},
{
"id": "LONG-MONGO-ID-HERE-PROJECT-2",
"name": "BMW",
"url": "http://bmw.com",
"logo": "logo_bmw.jpg",
"photos": [
{
"title": "Some title for an Image",
"file": "project2_photo1.jpg"
},
{
"title": "another title for an Image",
"file": "project2_photo2.jpg"
}
]
}
]
},
{
"id": "LONG-MONGO-ID-HERE-USER-2",
"name": "Pruthvi Gowda",
"email": "pruthvi#mink7.com",
"gender": "male",
"telephone": "9982318016",
"is_pro": 0,
"projects": [
{
"id": "LONG-MONGO-ID-HERE-PROJECT-3",
"name": "Adidas",
"url": "http://adidas.com",
"logo": "logo_adidas.jpg",
"photos": [
{
"title": "Some title for an Image",
"file": "project1_photo3.jpg"
},
{
"title": "another title for an Image",
"file": "project1_photo4.jpg"
}
]
},
{
"id": "LONG-MONGO-ID-HERE-PROJECT-2",
"name": "BMW",
"url": "http://bmw.com",
"logo": "logo_bmw.jpg",
"photos": [
{
"title": "Some title for an Image",
"file": "project2_photo1.jpg"
},
{
"title": "another title for an Image",
"file": "project2_photo2.jpg"
}
]
}
]
}
]
Projects Table
[
{
"id": "LONG-MONGO-ID-HERE-PROJECT-1",
"name": "Nike",
"url": "http://nike.com",
"logo": "logo_nike.jpg",
"about": "Lorem Ipsum is simply dummy text of the printing and typesetting industry.",
"testimonial": "e middle of text. All the Lorem Ipsum generators on the Internet tend",
"photos": [
{
"title": "Some title for an Image",
"description": "um is simply dummy text of the printing and t",
"file": "project1_photo1.jpg"
},
{
"title": "another title for an Image",
"description": "text of the printing and t um is simply dummy",
"file": "project1_photo2.jpg"
}
],
"user": {
"id": "LONG-MONGO-ID-HERE-USER-1",
"name": "Harsha MV",
"email": "harsha#mink7.com"
}
},
{
"id": "LONG-MONGO-ID-HERE-PROJECT-2",
"name": "BMW",
"url": "http://bmw.com",
"logo": "logo_bmw.jpg",
"about": "It is a long established fact that a reader will be distracted by the",
"testimonial": "from sections 1.10.32 and 1.10.33 of de Finibus Bonorum et Malorum",
"photos": [
{
"title": "Some title for an Image",
"description": "um is simply dummy text of the printing and t",
"file": "project2_photo1.jpg"
},
{
"title": "another title for an Image",
"description": "text of the printing and t um is simply dummy",
"file": "project2_photo2.jpg"
}
],
"user": {
"id": "LONG-MONGO-ID-HERE-USER-1",
"name": "Harsha MV",
"email": "harsha#mink7.com"
}
}
]
As I have understood MongoDb is all about replication of data. is this the right way of designing the database structure.
class User
include Mongoid::Document
field :first_name, type: String
field :last_name, type: String
field :company_name, type: String
embeds_many :projects, class_name: "Project"
has_many :projects, class_name: "Project"
end
Can i do something like the above so that i can save two instance of the same data.
But as you see in the embedded document i am not storing all the data from the projects - how can i strict it from adding all the data as embedded document but stored as a separate table?
It is not possible to add same model as both embedded and referenced collection. You can put the structure as same you have mentioned initially by referencing the project collection in user.
And create dummy model say ImportantProject which will be embedded in User and you can sync up the data project in this model while making changes in database.

Extended Choice Parameter plugin Multi-Level Select

OK, so I downloaded this plugin:
https://wiki.jenkins-ci.org/display/JENKINS/Extended+Choice+Parameter+plugin
And select Multi-Level Single Select as the type of parameters.
The problem is that when I have multiple parameters selected and I want to use these parameters in shell in a build, I can only select the LAST parameter
So if I do $PARAM_NAME it only outputs the last parameters, but I want all the parameters that I selected, not just the last one.
Here is a picture for demonstration
You aren't building the parameter based on the selections, you are navigating to the value that you want. I.E. Country --->State ---->City
You aren't building a CountryStateCity variable, you are stating that the City variable is the value you select.
I could get the nearest to this by using Extended Choice Parameter > JSON Parameter Type > JSON Parameter Config Groovy Script.
import org.boon.Boon;
def jsonEditorOptions = Boon.fromJson(/{
disable_edit_json: true,
disable_properties: true,
no_additional_properties: true,
disable_collapse: true,
disable_array_add: false,
disable_array_delete: false,
disable_array_reorder: false,
theme: "bootstrap3",
iconlib: "fontawesome5",
schema: {
"type": "object",
"title": "",
"required": [
"Locations"
],
"properties": {
"Locations": {
"type": "array",
"format": "table",
"title": "",
"uniqueItems": true,
"items": {
"type": "object",
"title": "Location",
"properties": {
"Country": {
"type": "string",
"propertyOrder" : 1,
"enum": [
"USA",
"Germany",
"India"
]
},
"City": {
"type": "string",
"propertyOrder" : 2,
"enum": [
"New York",
"Frankfurt",
"Mumbai"
]
},
"Neighborhood": {
"type": "string",
"propertyOrder" : 3
}
}
},
"default": [{
"Country": "USA",
"City": "New York",
"Neighborhood": "Times Square"
}]
}
}
}
/);
You can visit the plugin page and json-editor.github.io to create and validate your
JSON schemas as seen above.
This is how it appears in Jenkins:
Note that however, it still does not provide a context sensitive
second column based on what is selected in the first column. The
second column rather behaves exactly like the first column where you
select from a pre-defined list without any filters.
On printing the variable Location, it returns this JSON:
{"Locations":[{"City":"New York","Country":"USA","Neighborhood":"Times Square"},{"City":"Frankfurt","Country":"Germany","Neighborhood":"Bornheim"},{"City":"Mumbai","Country":"India","Neighborhood":"Vile Parle"}]}
I met the same problem, so I added a 'row number' column to the parameters file:
Country City Row
United States San Francisco 1
United States Chicago 2
Mexico Mexico City 3
Mexico Cancun 4
This way, the plugin returns the row number and I can address that row from the parameters file.

Resources