Loopback insert model and its relational data - loopbackjs

I'm trying to insert a model (oc_product) and its relational (oc_product_description) data.
The model is inserting but the relational data isn't. I'm not getting any error message.
My relational config in oc_product.
"relations": {
"ocProductDescriptions": {
"type": "hasOne",
"model": "oc_product_description",
"foreignKey": "product_id",
"options": {
"nestRemoting": true,
"validate": true,
"forceId": false
}
},
},
oc_product_description.js product_id field config
"product_id": {
"type": "Number",
"id": true,
"generated": true,
"length": null,
"precision": 10,
"scale": 0,
"mysql": {
"columnName": "product_id",
"dataType": "int",
"dataLength": null,
"dataPrecision": 10,
"dataScale": 0,
"nullable": "N"
}
},
code to create instance
app.models.oc_product.create(ocProduct, function(err, instance) {
if (err) {
console.log(err);
} else {
console.log('created');
console.log(instance);
}
});
logged instance
created
{ model: '6932849427639',
viewed: 0,
isbn: '',
image: '/var/www/3.0.2.0-OpenCart/products/3/npten-a18-lg.jpg',
shipping: 1,
manufacturer_id: 8,
sku: 'SKU',
upc: 'UPC',
ean: 'EAn',
jan: '',
mpn: 'A18',
price: 16.1,
length: 99,
width: 98,
height: 97,
location: 'London, Uk',
quantity: 100,
minimum: 1,
subtract: 1,
weight: 0.3,
stock_status_id: 7,
points: 0,
sort_order: 3,
weight_class_id: 1,
length_class_id: 1,
status: 1,
tax_class_id: 9,
date_available: 2018-08-30T05:55:05.000Z,
date_added: 2018-08-30T05:55:05.000Z,
date_modified: 2018-08-30T05:55:05.000Z,
ocProductDescription:
{ language_id: '1',
name: 'Tenda A18 AC1200 Dual-Band WiFi Repeater',
description: 'A18 is an AC1200 dual-band WiFi repeater dedicated for two-storey houses, villas, and multi-room houses with an area over 120 square meters. It offers up to 300 Mbps data rate on 11n band and 867 Mbps data rate on 11ac band. With two external omni-directional antennas, A18 can provide larger WiFi coverage, as well as extreme fast data rate, satisfying applications such as playback of 1080P HD videos, massively multiplayer online games, and high-speed download. With the upgrade Setup Wizard, it only takes you three steps to configure your repeater, which is easy to use. A18 also works better with other brands\' WiFi router available on the market. For whole home WiFi coverage, A18 is your best choice.<br/><br/><b>Gigabit WiFi Repeater Works Well with Optical Routers</b><br/><b>AC1200 Dual Band WiFi Repeater Tenda A18</b><br/><br/><b>Works Well with Optical Routers for Strong Wall Penetration Capacity on 5 GHz Band</b><br/>Ordinary 11AC routers performs poorly on wall penetration on 5 GHz band. With A18 to repeat 5 GHz WiFi network, data transmission rate on 5 GHz band can be up to 867 Mbps, giving a full play to your 100 Mbps optical broadband. By resolving the weakness of WiFi coverage on 5 GHz band, A18 brings you with fast internet experience at home.<br/><br/><b>Scan Quality Channel Automatically for Stable, Reliable and Fast Internet Experience</b><br/>Equipped with high quality PCB dual band antennas, the radio frequency distance between antennas of A18 has been improved to um. Each antenna provides both 2.4 GHz and 5 GHz WiFi networks, and extends WiFi networks both on 2.4 GHz and 5 GHz bands . A18 can automatically select high quality channel for you when signal fluctuates, and keeps your devices online even in the move by switching to the network with stronger signals automatically.<br/><br/><b>Visual Signal LED Guides You to Find the Best Position</b><br/>Guided by the color of Signal LED, you can easily find the best position for your repeater according to your actual network environment. Blue indicates good connection , and red indicates bad connection.<br/><br/><b>Configure Your Repeater via Smart Phones/Tablets</b><br/>Simplicity is practical. You can configure your repeater via smart phones or Tablets<br/><br/><b>Elegant and Compact Appearance</b><br/>Featured with a small size, it is easy for you to plug A18 into your electrical outlet.<br/><br/><b>One More 100 Mbps LAN port for Wired Extension</b><br/>Signal is full but the internet is still inaccessible? Want to watch online TV programs on a LCD TV with LAN port but without WiFi adapter? <br/>A18 can relieve you from these two painstaking. By connecting the Ethernet cable from your router to the LAN port of A18, you can extend your existing WiFi network in wired manner. To watch online TV programs, you just need to connect the LAN port of A18 that has extended successfully to the LAN port of your LCD TV.<br/><br/><b>More functions</b><br/>Hide SSID, Extend your existing WiFi network via WPS button, Mix WPA/WPA2 encryption mode<br/>- Hide SSID<br/>- WPS Function<br/>- Encryption Mode<br/><br/><b>Port</b><br/>1 x 10/100 Mbps RJ45<br/><br/><b>Buttons</b><br/>Reset<br/>WPS<br/><br/><b>LED</b><br/>1 x Signal LED<br/>1 x WPS LED<br/>1 x Power LED<br/><br/><b>Power Supply</b><br/>9V 0.8A, built-in<br/><br/><b>Plug Types</b><br/>National Standard, US Standard, European Standard, UK Standard, Brazil Standard<br/><br/><b>Power Consumption</b><br/>No-load: 2.8W, Full-load: 5.2W<br/><br/><b>Dimension</b><br/>80 x 58 x 48 mm<br/><br/><b>Standard & Protocol</b><br/>IEEE 802.11a, IEEE 802.11n, and IEEE 802.11ac wave2 on 5 GHz<br/>IEEE 802.11b, IEEE 802.11g, and IEEE 802.11n on 2.4 GHz<br/><br/><b>Data Rate</b><br/>802.11b: 11 Mbps<br/>802.11g: 54 Mbps<br/>802.11n: 300 Mbps<br/>802.11ac: 867 Mbps<br/><br/><b>Frequency Band</b><br/>11n: 2.412-2.484 GHz<br/>11ac: 5.15-5.25 GHz<br/><br/><b>Transmit Power</b><br/>2.4 GHz: 16dBm<br/>5 GHz: 12dBm<br/><br/><b>RSSI</b><br/>2.4 GHz:<br/>11b-1M:-97dBm<br/>11g-54M:-76dBm<br/>11n-20M-MCS7:-74dBm<br/>11n-40M-MCS7:-72dBm<br/>5 GHz:<br/>11a-6M:-95dBm<br/>11n-20M-MCS7:-74dBm<br/>11n-40M-MCS7:-72dBm<br/>11ac-80M-MCS9:-63dBm<br/><br/><b>Antenna</b><br/>2 x External 2dBi dual-band omni-directional antenna (non-detachable)<br/><br/><b>Channel</b><br/>11n: 20/40MHz by default<br/>11ac: 80MHz by default<br/><br/><b>Operating Mode</b><br/>Repeater Mode<br/>AP Mode<br/><br/><b>Wireless Security</b><br/>Default encryption mode: Mix WPA-PSK/WPA2-PSK<br/>WPA algorithm: TKIP<br/><br/><b>DHCP Server</b><br/>Supported<br/><br/><b>System Tool</b><br/>Firmware upgrade, Restore factory settings, Login password, and Reboot<br/><br/><b>Temperature</b><br/>Operating temperature:0ºC~40ºC<br/>Storage temperature:-40ºC~70℃<br/>HumidityOperating humidity:(10 90)% RH, non-condensing<br/>Storage temperature:5%~90%RH, non-condensing<br/><br/><b>Package Content</b><br/>1 x AC1200 Dual Band WiFi Repeater<br/>1 x Quick Installation Guide',
tag: 'tag',
meta_title: 'meta tag title',
meta_description: 'Meta Tag Description',
meta_keyword: 'Meta Tag Keywords' },
product_id: 4 }

As I've found out this currently isn't possible.

Related

How to get the document quality score in google document AI as the "Intelligent document quality processor" is not available now?

How to get the document quality score in google document AI as the "Intelligent document quality processor" is not available now?
Used general-ocr and tried to get the entities(as the documentation shows entities has the quality score), but no entities found.
Here is the information about getting Document Quality information from the Document OCR Processor.
Note - For the Document OCR processor, you must use processor version pretrained-ocr-v1.1-2022-09-12 to get the quality information.
Document OCR Processor - Handling the Processing Response
Starting with processor
version
pretrained-ocr-v1.1-2022-09-12, the Document
OCR
processor can also perform quality assessment of a document based on
its readability. This quality assessment is a quality score in [0, 1], where 1 means perfect quality. The quality score is returned
in the
Page.imageQualityScores
field. All detected defects are listed as quality/defect_* and
sorted in descending order by confidence value.
{
"pages": [
{
"imageQualityScores": {
"qualityScore": 0.7811847,
"detectedDefects": [
{
"type": "quality/defect_document_cutoff",
"confidence": 1.0
},
{
"type": "quality/defect_glare",
"confidence": 0.97849524
},
{
"type": "quality/defect_text_cutoff",
"confidence": 0.5
}
]
}
}
]
}

Split money on minting between more than one wallet solana metaplex & candymachine

I am new to blockchain and i am trying to play with blockchain so I used metaplex and candy-machine to upload and mint dummy nft's which is working fine. The opensource repositories that I am playing with are below:
https://github.com/metaplex-foundation/metaplex
https://github.com/exiled-apes/candy-machine-mint
Then for learning purposes, I wanted to divide minting and secondary sales into more than one wallet so I changed JSON and added three test wallets into the creator's array.
{
"name": "#0",
"symbol": "%$%",
"description": "description goes here",
"seller_fee_basis_points": 500,
"image": "image.png",
"external_url": "",
"edition": 0,
"attributes": [
{
"trait_type": "Background",
"value": "Street"
}
],
"properties": {
"files": [
{
"uri": "image.png",
"type": "image/png"
}
],
"category": "image",
"creators": [
{
"address": "<public address 1>",
"share": 34
},
{
"address": "<public address 1>",
"share": 33
},
{
"address": "<public address 1>",
"share": 33
}
]
}
}
But the problem is splitting is happening on secondary sales and not on minting. On minting the wallet set as treasury resource is getting all amount. I want to split the transaction amount on minting too.
Interestingly, I found this quote in the metaplex documentation:
The SPL Metadata program supports storing up to five co-creators that
share potential future profits from sales for the items as defined by
seller_fee_basis_points . Each creator needs to be added as part of
the minting process and is required to approve metadata that was used
in his name using the sign_metadata endpoint. Unverified artwork
cannot be sold with Metaplex.
During the first sale, creators share in 100% of the proceeds, while
in follow up sales, they share in proceeds as a percentage determined
by seller_fee_basis_points. Whether or not a metadata is considered in
second sale or not is determined by the primary_sale_happened boolean
on the Metadata account.
My interpretation of this is that the expected behavior should be for the initial sale to get divided between creators using the ratios defined by each creator's share. Sounds like you're experiencing something different.
Keep in mind that this documentation is for the parent project. Candy-machine-mint seems to be a fork and they may have altered some of that behavior.
The source code of the code of the contract you are intersted in can be found here: https://github.com/metaplex-foundation/metaplex-program-library/blob/master/nft-candy-machine/program/src/lib.rs
At line 247 the transfer of sol is called to a single treasury address of the candy machine. To change it to multiple addresses this contract would have to be updated and redeployed.
Another alternative I have seen deployed in the solana community atm is a second contract which will split the funds evenly. Unfortunately, the creator of this contract has been charging for it and has not open-sourced it yet. They can be found on the metaplex discord if you are interested.

AWS media convert thumbnail genrated from video get rotated?

In my application, I'm using AWS media-convert jobs to generate the thumbnail from my video uploaded to s3. The video gets uploaded from mobile. It works fine when I record a video from my mobile and uploads it at the same time. I got thumbnail generated properly.
But when I upload a pre-recorded video from the same mobile and upload it the thumbnail for that video get rotated by -90 degree.
Not sure what could be the problem here.
It sounds like there is rotation metadata embedded in the video file that is being recording with the mobile device. Devices, like the iPhone, do this automatically depending on the orientation of the phone while it's recording. This data will tell MediaConvert to change rotation of the input file. By default, MediaConvert will use no rotation, I would suggest flipping this to 'AUTO', and let the service correctly rotate video accordingly.
Apples Quicktime file format (1), and ISO 14496-12 (Section A.6) should have more details about this piece of metadata if you are interested.
JSON Settings with Rotate set to AUTO:
"Inputs": [
{
"AudioSelectors": {
"Audio Selector 1": {
"Offset": 0,
"DefaultSelection": "DEFAULT",
"ProgramSelection": 1
}
},
"VideoSelector": {
"ColorSpace": "FOLLOW",
"Rotate": "AUTO",
"AlphaBehavior": "DISCARD"
},
"FilterEnable": "AUTO",
"PsiControl": "USE_PSI",
"FilterStrength": 0,
"DeblockFilter": "DISABLED",
"DenoiseFilter": "DISABLED",
"TimecodeSource": "EMBEDDED",
"FileInput": "s3://bucket123/test.mov"
}
]
== Documentation ==
[1] https://docs.aws.amazon.com/mediaconvert/latest/ug/manually-specified-rotation.html
[2]https://docs.aws.amazon.com/mediaconvert/latest/apireference/jobs.html#jobs-prop-videoselector-rotate
[3] https://developer.apple.com/standards/qtff-2001.pdf

Retrieve data of a facebook page with graph API

I used (in 2012) to code with FQL and I was able to make some features such as
FQL query to fetch all data of a facebook page
Actually, FB migrate to graph API.
My question is : Is it possible to retrieve public data of a page (or person) with graph API, even if I'm not a fan of that page (or not a friend )
Yes, everything that you want to do is quite possible with the Graph API. Unless the Page / Group is private, then you will be able to fetch their public data without having to like the page.
https://developers.facebook.com/docs/graph-api
A useful tool that Facebook has provided is the Graph Explorer that allows you to test your queries and see what information will come back: https://developers.facebook.com/tools/explorer
As a specific example that you can fetch without any auth tokens: http://graph.facebook.com/cineplex will return
{
"id": "11751844989",
"about": "Starring Galaxy, Cineplex Odeon, SilverCity, Famous Players, Colossus, Coliseum, Cinema City & Scotiabank Theatres.",
"can_post": false,
"category": "Movie",
"checkins": 0,
"cover": {
"cover_id": "10150491543319990",
"offset_x": 0,
"offset_y": 0,
"source": "https://scontent.xx.fbcdn.net/hphotos-xpf1/v/t1.0-9/s720x720/10377524_10150491543319990_3410282243848063213_n.png?oh=47c4eb7d50a4d259236ee7c2bbb3300a&oe=55C89C6E",
"id": "10150491543319990"
},
"description": "For showtimes and theatre locations check out www.cineplex.com.\n\nCineplex Entertainment is the largest motion picture exhibitor in Canada and owns, leases or has a joint-venture interest in 162 theatres with 1,639+ screens serving approximately 77 million guests annually. Headquartered in Toronto, Canada, Cineplex operates theatres across Canada and is the exclusive provider of UltraAVX\u2122 and the largest exhibitor of digital, 3D and IMAX projection technologies in the country. Proudly Canadian and with a workforce of approximately 10,000 employees. \n",
"directed_by": "Cineplex Entertainment",
"has_added_app": false,
"is_community_page": false,
"is_published": true,
"likes": 414426,
"link": "https://www.facebook.com/Cineplex",
"name": "Cineplex",
"parking": {
"lot": 0,
"street": 0,
"valet": 0
},
"phone": "1-800-333-0061",
"plot_outline": "ESCAPE WITH US",
"starring": "Cineplex Odeon, Galaxy, SilverCity, Scotiabank Theatres, Famous Players, Colossus, Coliseum and Cinema City",
"talking_about_count": 5147,
"username": "Cineplex",
"website": "www.cineplex.com",
"were_here_count": 0
}

How do I get the date of the Facebook Album as seen on Facebook?

Is there a way in which I could get the Album Date of an Album as seen on Facebook?
Here is a sample screenshot of one of the albums that I would like the data to be retrieved.
Please check this album https://www.facebook.com/media/set/?set=a.470385546361350.110064.186460284753879&type=3
I want to specifically get the January 24 data.
I have used http://graph.facebook.com/470385546361350 but it only returns the create and update dates as shown below
{
"id": "470385546361350",
"from": {
"category": "Local business",
"name": "Philippine Business for the Environment",
"id": "186460284753879"
},
"name": "BFI, Letran, PBE Ink MOA for GHG Management Course",
"description": "Start them young. This was the intention of BPI Foundation Inc. (BFI), Colegio de San Juan de Letran, and the Philippine Business for the Environment (PBE) upon forging an agreement last January 22 in training select Letran college students on greenhouse gas (GHG) inventory and management. On hand were Mr. Florendo G. Maranan, Executive Director of BFI; Fr. Tamerlane R. Lana, OP, President of Letran; and Mr. Bonar A. Laureto, Executive Director of PBE. The program, known as \u201cBPI Greenhouse Gas Inventory and Management Program for University Students,\u201d is made available to 100 Letran college students who have the aptitude in understanding the relationship between environmental stewardship and good business praxis and who are willing to participate in future GHG inventory services. The students are also encouraged to donate one history book to Letran\u2019s partner public school, promoting the spirit of social justice and development. The syllabus and material for the five-day course, prepared by PBE, will make use of an Activity-Analysis-Abstraction-Application process. This will enable the students to gain technical and applied knowledge and skills on GHG inventory and management that are currently applied in various workplaces. At the end of the program, the students are expected to become active in GHG inventory and management and other environmental advocacies of Letran.",
"link": "https://www.facebook.com/album.php?fbid=470385546361350&id=186460284753879&aid=110064",
"cover_photo": "470385596361345",
"count": 3,
"type": "normal",
"created_time": "2013-02-05T08:00:04+0000",
"updated_time": "2013-02-06T04:36:38+0000",
"can_upload": false,
"likes": {
"data": [
{
"id": "100002097532966",
"name": "Krex Lopezbaliza"
}
],
"paging": {
"next": "http://graph.facebook.com/470385546361350/likes?limit=25&offset=25&__after_id=100002097532966"
}
}
}