I use hugo build static page. But don't have content - hugo

enter image description here
Deploy don't have error.
But there's nothing on my page.
https://sillyhatxu.github.io/

Set the parameters
draft: false
For Example
---
title: "Golang bit operation"
subtitle: "Golang 位运算"
date: 2019-05-27T23:13:11+08:00
author: "one_zheng"
tags: ["golang","algorithm"]
categories: ["golang"]
from: "https://medium.com/learning-the-go-programming-language/bit-hacking-with-go-e0acee258827"
draft: false
---

Related

How to send a JSON array in multipart/form-data in Swagger UI?

I’m trying to send an array of objects through multipart/form-data:
post:
summary: Creates a user
requestBody:
content:
multipart/form-data:
schema:
type: object
properties: # Request parts
id:
type: string
format: uuid
address: # <---------
type: array
items:
type: object
properties:
street:
type: string
city:
type: string
profileImage:
type: string
format: base64
But Swagger UI sends the address array incorrectly - as {},{} instead of [{},{}], that is, without the enclosing square brackets:
I even tried encoding it separately as JSON.
What am I missing, please?
i later got it to work by adding example
post:
summary: Creates a user
requestBody:
content:
multipart/form-data:
schema:
type: object
properties: # Request parts
id:
type: string
format: uuid
address:
type: array
items:
type: object
properties:
street:
type: string
city:
type: string
example:
- street: Jones Street, Manhattan
city: New York
- street: Hollywood Boulevard
city: Los Angeles
profileImage:
type: string
format: base64
my observation is just send or modify what you already have in the example, adding new ones won't be correctly formatted. that is, if you have two items in an array work with those two do not add extra items

Object Fields Missing in Autogenerated Mutation Input for GraphQL AppSync

I have a custom GraphQL schema for a blogging application for my ReactJS app. The main model type is Post.
Post contains a number of properties that have a custom type eg Gallery: [MediaObject]. The majority of these properties with custom types are missing from the automatically generated CreatePostInput by AWS Amplify CLI. This means that I cannot create a Post object that has these properties with custom type.
The lack of these custom type properties is evident in the AppSync console, under Queries. In the Explorer, go to Mutations, click on CreatePost mutation, and you will see that 6 of the 21 properties for Post are missing. The missing properties are tags, attributes, seo, featuredImage, gallery and createdBy.
They are also missing in the autogenerated graphql schema in api > build > schema.graphql in the react app.
I have made multiple clean projects from scratch, and the problem is reproducible. I have updated the amplify cli to 4.51.2 and still no luck.
I would expect the CreatePostInput to have the associated inputs for all of the fields, not just comments (see the autogenerated CreatePostInput below) eg: attribute: AttributeInput, but these are not generated either. This would allow me to create a Post object that has these custom fields populated. However, only the CommentInput has been generated. What am I doing wrong here, or have I misunderstood something?
Thanks!
Below is my gql schema and both the autogenerated CreatePostInput and CommentInput:
type Post #model {
id: ID
createdBy: User
createdAt: AWSDateTime
updatedAt:AWSDateTime
type: PostType!
title: String!
status: Status
content: String!
excerpt: String
slug: AWSURL
wordpressId: Int
wordpressImageURLs: [AWSURL]
author: String
likes: Int
tags: [Tag]
attributes: Attribute
seo: Seo
featuredImage: MediaObject
gallery: [MediaObject]
comments: [Comment]
numberOfComments: Int
}
type User #model {
id: ID
username: String!
firstName: String
lastName: String
email: AWSEmail!
avatar: MediaObject
location: String
createdAt: AWSDateTime
updatedAt: AWSDateTime
Posts: [Post]
}
type Tag #model {
id: ID
postIds: [ID]
name: String!
}
type Attribute #model {
id: ID
postId: ID
link: String
imgUrl: AWSURL
ogImage: AWSURL
ogDescription: String
canonicalLink: AWSURL
}
type Seo #model {
id: ID
postId: ID
metaRobotsNoIndex: String
metaRobotsNoFollow: String
canonical: AWSURL
metaDesc: String
opengraphDescription: String
opengraphModifiedTime: AWSDateTime
opengraphPublishedTime: AWSDateTime
opengraphTitle: String
opengraphUrl: AWSURL
opengraphImage: AWSURL
twitterDescription: String
twitterImage: String
twitterTitle: String
schemaSeo: String
}
type Comment
{
id: ID
postId: ID!
createdBy: ID
author: String
createdAt: AWSDateTime
text: String!
likes: Int
}
type MediaObject #model {
id: ID
linkedId: ID
createdBy: ID
mediaItemUrl: AWSURL
srcSet: String
medium: AWSURL
thumb: AWSURL
sourceURL: AWSURL
description: String
bucket: String
region: String
key: String
type: MediaObjectType
}
type Like #model {
id: ID!
objectVotedOnID: ID!
createdBy: ID
createdAt: AWSDateTime
likeOn: LikeOnType
}
enum PostType {
TOOLS
BLOGS
INSPIRATIONS
NEWS
POSTS
NEWSLETTERS
}
enum LikeOnType {
POST
COMMENT
}
enum Status {
PUBLISH
DRAFT
}
enum MediaObjectType {
IMAGE
VIDEO
AUDIO
}
Autogenerated (only CreatePostInput and CommentInput have been included for brevity), found in amplify > backend > api > build > schema.graphql:
input CreatePostInput {
id: ID
createdAt: AWSDateTime
updatedAt: AWSDateTime
type: PostType!
title: String!
status: Status
content: String!
excerpt: String
slug: AWSURL
wordpressId: Int
wordpressImageURLs: [AWSURL]
author: String
likes: Int
comments: [CommentInput]
numberOfComments: Int
}
input CommentInput {
id: ID
postId: ID!
createdBy: ID
author: String
createdAt: AWSDateTime
text: String!
likes: Int
}
At least for the example, you cited, Post and MediaObject have a one-to-many relationship. That is, a single Post has many MediaObjects. You won't see the many relations of a one-to-many generated on the parent object for mutations.
When creating a parent object that has children, you'll need to do this in 2 steps.
Create the parent object, and return the id.
Using the parentId, create the N child objects.
Here is some documentation from Amplify on how to do this: https://docs.amplify.aws/cli/graphql-transformer/connection#has-many
To anyone else that notices this strange behaviour: The reason why CommentInput is included in the CreatePostInput, whilst the other custom types are not, is because Comment was the only type that I had forgot to label with an #model directive. I assume that this means that AppSync then views this type on the comments field as a set of nested fields, rather than an object with its own DynamoDB table. I have asked the AWS Amplify team and will update this answer when I hear more from them.

React Structured Data with graphql query

Has anyone tried to implement this in a react project? There is not much in the documentation on the github/npm website. When I am trying to inject data is there a specific way to add graphql data?
JSX:
<JSONLD>
<Generic jsonldtype="event" schema={{
name: "${adv_event.title}",
description: "${adv_event.body}",
startDate: "YYYY-MM-DDT:HH:MM",
endDate: "YYYY-MM-DDT:HH:MM",
image: "",
}}>
<Generic type="location" jsonldtype="Place" schema={{ name: "test", }}/>
</Generic>
</JSONLD>
What I have tried:
name: "${adv_event.title}",
name: "`${adv_event.title}`",
name: {adv_event.title},
I was going to delete the post but, if any others are looking for this question in the future:
Answer is
name: `${adv_event.title}`,

Is it possible to extract audio from soundcloud-widget

I have a p5 canvas that makes visuals accords to the song it plays.
I try to add SoundCloud-widget as another music resource for user (and not just local uploading).
Are there is a way to extract the audio/blob/m3u8 from the widget? just set the display of the widget to "none" it is not enough because the song not going through p5 canvas.
The widget sends the music in HLS protocol, however when getting into network tab and filter for m3u8 couldn't find anything.
Right now I've got from
widget.getCurrentSound(currentSound => {
console.log(currentSound)
}
in my console -
artwork_url: 'https://i1.sndcdn.com/artworks-000217481049-b5k347-large.jpg'
comment_count: 1412
commentable: true
created_at: "2017-04-12T16:00:36Z"
description: ""
display_date: "2017-04-12T16:00:36Z"
domain_lockings: []
download_count: 0
download_url: null
downloadable: false
duration: 262710
embeddable_by: "all"
full_duration: 262710
genre: "Deep House"
has_downloads_left: true
id: 317363228
kind: "track"
label_name: null
last_modified: "2019-08-02T11:58:38Z"
license: "cc-by"
likes_count: 29882
media: {transcodings: Array(2)}
monetization_model: "NOT_APPLICABLE"
permalink: "mysong"
permalink_url: "https://soundcloud.com/...."
playable: true
playback_count: 1549676
policy: "ALLOW"
public: true
publisher_metadata: {urn: "soundcloud:tracks:XXXXXX", artist: "... ", id: 111111111}
purchase_title: "Free Download !"
purchase_url: null
release_date: null
reposts_count: 3378
secret_token: null
sharing: "public"
state: "finished"
streamable: true
tag_list: "my song""
title: "my song"
uri: "https://api.soundcloud.com/tracks/11111"
urn: "soundcloud:tracks:3111111"
user: {soundcloud user obj}
user_id: 11111111
visuals: null
waveform_url: "https://wave.sndcdn.com/XXXXXXX.json"
_resource_id: 11111111
_resource_type: "sound"
__proto__: Object
Thanks in advance :)

How to print data in an array of objects with mongodb and angularjs

I am trying to append some data to a div with ng-repeat.
I am using angularjs and MongoDB without mongoose. Any help would be greatly appreciated.
An array of objects from server:
[
{
_id: "5a733e96aa3c4e1202b347e5",
image: "lerem",
title: "Hydration",
about: "Hydration is key",
article: "hydor lorem ipsum",
__v: 0
},
{
_id: "5a7345b1aa3c4e1202b347e6",
image: "lerem",
title: "Hydration",
about: "Hydration is key",
article: "hydor loremm",
__v: 0
},
{
_id: "5a735c752aaeb91470fcda61",
image: "lerem",
title: "Hydration",
about: "Hydration is key",
article: "hydor lorm",
__v: 0
}
]
Angularjs ng-repeat:
<div ng-controller="ArticleController" ng-repeat="articles in articles | filter:article" class="articles">
<h1>{{article.image}}</h1>
<h1>{{article.title}}</h1>
<h1>{{article.about}}</h1>
<h1>{{article.article}}</h1>
</div>
controller for article:
$http.get("/articles", function(articles) {}
<div ng-controller="ArticleController" ng-repeat="article in articles | filter:article" class="articles">
<h1>{{article.image}}</h1>
<h1>{{article.title}}</h1>
<h1>{{article.about}}</h1>
<h1>{{article.article}}</h1>
</div>
should work. Please note that I changed articles in articles to article in articles for distinguishing purpose. Also, it is advisable to use Mongoose while working with angular. Kind of makes things easier to work with.

Resources