white spaces - slack (webhook) - slack-api

It looks like there is no option post a message containing a table on to slack. I am trying to build a table using text formatting. In the below example the text isn't aligned because first row has text ROW1 and second row has text ROW. Is there a way to add a white space after ROW in order to align this text?
{"text" : "ROW1\t\t\t\tCOL1\nROW\t\t\t\tCOL2"}

Generally speaking, you can use Slack's message builder to test the rendering of your messages.
This being said, while I dont think you can simply "push" spaces to the right, you could use the pipe symbol like this :
"text": "ROW1|\t\t\t\tCOL1\nROW |\t\t\t\tCOL2"
Another possibility, with minor changes, is to use attachements with fields like this
"attachments": [
{
"fields": [
{
"title": "Col1",
"value": "text1",
"short": true
},
{
"title": "Col2",
"value": "text2",
"short": true
}
]
}
]

Related

Part colour doesn't pull through from Configured Products

I have an issue that I have created 4 derived Products from a single part, that each part has a different Colour / Material set within it. I have the 4 Products called as PossibleChildren in my main part but when I try and bring in one of the 4 Products which ever is the first colour I pick, is the only colour that will select, so if for example I select RED for my first part, if I then pick the BLUE part it still only places the RED part. I created the 4 Products by importing this text...
"item_id","configuration"
"sub_s2_8t15","{""componentId"":""racksystems_test:sub_fronttile"",""parameters"":
{""tileColour"":""racksystems_test:s2_8t15""}}"
"sub_s2_7t58","{""componentId"":""racksystems_test:sub_fronttile"",""parameters"":
{""tileColour"":""racksystems_test:s2_7t58""}}"
"sub_s2_4t50","{""componentId"":""racksystems_test:sub_fronttile"",""parameters"":
{""tileColour"":""racksystems_test:s2_4t50""}}"
"sub_twinwall","{""componentId"":""racksystems_test:sub_fronttile"",""parameters"":
{""tileColour"":""racksystems_test:twinwall""}}"
And then in the master.json part I call the 4 created Products...
"itemId": "racksystems_test:sub_s2_8t15",
"condition":"((version=='Rack')&&(company=='BetaTest'))"
}, {
"itemId": "racksystems_test:sub_s2_7t58",
"condition":"((version=='Rack')&&(company=='BetaTest'))"
}, {
"itemId": "racksystems_test:sub_s2_4t50",
"condition":"((version=='Rack')&&(company=='BetaTest'))"
}, {
"itemId": "racksystems_test:sub_twinwall",
"condition":"((version=='Rack')&&(company=='BetaTest'))"
},
I have a KEY in the sub_fronttile.json as this..
{
"key": "tileColour",
"type": "Material",
"labels": {
"en": "Tile Colour?"
},
"defaultValue": "",
"valueObjects": [
{
"value": "racksystems_test:red",
"labels": {
"en": "Black"
}
},
........
Then call the colour in my geometry like this...
AddCube(Vector3f{infillWidth-20,materialThickness,infillHeight-20});
SetObjSurface(tileColour);
MoveMatrixBy(Vector3f{20,-offset,40});
So master.json is my main part and sub_fronttile.json contains my products
Is tileColour a global parameter? If yes, then the global value is assigned on dock. If tileCoulour is not a global parameter, this should not happen unless an assignmentOnDock is used.
In order to workaround the assignment in global parameters, it might help to:
have two parameters instead, tileColour_local, tileColour_global where one is global and not visible, other is not global and is visible.
tileColour_global.onValueChange: "if (parameter.userTriggeredChange) { tileColour_local = tileColour_global; }

With the Google Slides API is there a ways to know the height of the text in a shape?

I want to have a shape with text where the text fits neatly inside the shape. To do this I need to know how tall the text in a textElement will be inside a given shape, is there a way to do this?
Answer:
You can get the information of the font size of text inside a Shape using presentations.get with a field mask.
More Information:
The structure of a Shape with text is as follows (irrelevant fields omitted):
{
"shapeType": enum (Type),
"text": {
"textElements": [
{
"textRun": {
"style": {
"fontSize": {
"magnitude": 18,
"unit": "PT"
},
}
},
}
],
},
...
}
You can get this with the field mask:
slides/pageElements/shape/text/textElements/textRun/style/fontSize
Example Request:
slides.presentations.get({
"presentationId": "1x1iiFW0TbP3yPXRldYogXLEGT-tYfa79a2X8ZDIq8tU",
"fields": "slides/pageElements/shape/text/textElements/textRun/style/fontSize"
});
Note: The API does not return if the text wraps across multiple lines or not. This isn't retrievable due to the nature of font sizes. If the font you were using is a monospace font, it may however be possible to work this out based on the width of the Shape and the width of the characters contained within it.
References:
Text - Page.TextStyle | Slides API | Google Developers
Working with field masks | Slides API | Google Developers

Show data table from JSON in iPad app

I have a API which returns JSON:
{
"id": 1,
"name": "A green door",
"price": 12.50,
"tags": ["home", "green"]
}
{
"id": 2,
"name": "A blue door",
"price": 13.50,
"tags": ["work", "blue"]
}
In iPad app, I need to show this in the following data table format:
id name price tags
1 A green door 12.50 home, green
2 A blue door 13.50 work, blue
I have tried the following https://github.com/brightec/CustomCollectionViewLayout but it does not work.
How can it be done?
You can create a simple table view. I created a simple example with your data. Sorry, I don't have time to add comments and the UI is basic.
Check the following example:
Show data into table view

Hide Group Title in Form by hyperoslo

I do not want to show the Group Title but I cannot seem to find a way to do this. I have tried setting group title to empty string, nil, and not setting its value at all.
Is it possible to do this? If yes, any pointers would be appreciated.
In your style make all the headers transparent. Using UIAppearance:
[[FORMGroupHeaderView appearance] setHeaderBackgroundColor:[UIColor clearColor]];
There's an example that does this. Check Payment Demo.
You can make only only of the headers transparent by sending any invalid HEX value, for example: clearcolor
[
{
"id":"group-id",
"styles":{
"background_color":"clearcolor"
},
"sections":[
{
"id":"section-0",
"fields":[
{
"id":"email",
"title":"Email",
"type":"email",
"input_type": "email",
"size":{
"width":100,
"height":1
}
}
]
}
]
}
]

labelColor not responding in Passbook coupon type pass

All my Passbook environment works fine (PHP/MySQL based server for pass generation and signing, and the pass download - webview based download, emailing the pass or presenting inside my app with PassKit).
The only thing that is not working is the color of the labelColor in the primary fields of a coupon type pass.
I have (in the pass.json file):
"foregroundColor" : "rgb(30, 30, 30)",
"backgroundColor" : "rgb(230, 230, 230)",
"labelColor" : "rgb(30, 30, 30)",
The foregroundColor and backgroundColor work fine, but the labelColor (presented on top of the strip image) is white, instead of the labelColor specified.
According to AppleĀ“s Passbook package reference, the labelColor is optional
"Optional. Color of the label text, specified as a CSS-style RGB triple. For example, rgb(255, 255, 255). If omitted, the label color is determined automatically."
In this case, the strip image is a clear image so, the text should be black (even if labelColor omitted and the color determined automatically), but the try appears white in the pass
Any help would be appreciated.
... e
Label and foreground colors are only applied to primary field labels and values when there is no strip image in the pass. Where a strip image exists, the text color is automatically changed to white.
There is an undocumented parameter stripColor that can be used to set the colour of the text over a strip image. This changes both the field and the label.
This parameter has been around since the early iOS6 betas. However, use with caution. Just because it works today is no guarantee it will work in the future.
I found that using the "stripColor" does change the text in the strip outside of the "foregroundColor" parameter. This is still the case in iOS 8+
Here is example of where to put the "stripColor" in the json.
passJson = {
"formatVersion": 1,
"passTypeIdentifier": "pass type goes here",
"serialNumber": "serialNumber goes here",
"teamIdentifier": "",
"organizationName": "",
"description": "",
"logoText": "My Logo",
"foregroundColor": "rgb(150,0,150)",
"backgroundColor": "rgb(255, 255, 255)",
"labelColor": "rgb(0, 0, 0)",
"stripColor": "rgb(255,255,255)",
"associatedStoreIdentifiers": [
],
"associatedApps": [
{
"title": "Name of your app"
}
],
"barcode": {
"message": "coupon",
"format": "PKBarcodeFormatPDF417",
"messageEncoding": "iso-8859-1",
"altText": "coupon"
},
"coupon": {
"primaryFields": [
{
"key": "offer",
"label": "Offer text 2",
"value": "Offer text 1"
}
],
"secondaryFields": [
{
"label": "Expires",
"value": "09/26/2015",
"key": "expires"
}
],
"backFields": [
{
"label": "TERMS AND CONDITIONS",
"value": "Back of pass",
"key": "terms"
}
]
}
}

Resources