I am trying to disable the warning from pylsp that my line is too long.
However, evertime I open or save a python file I notice a message that pyflake, mccabe and pycodestyle are completed and I get a warning that some lines are too long.
I cannot seem to find a way to disable this.
Can someone tell me what I am missing or give an example on how they did it?
My init.lua is from kickstart.vim, where I added the following
pylsp = {
configurationSources = { 'flake8' },
plugins = {
flake8 = {
enabled = false,
ignore = { 'E501', 'E231' },
maxLineLength = 88,
},
black = {enabled = true},
autopep8 = { enabled = false },
mccabe = {enabled = false},
pycodestyle = {
enabled = false,
ignore = { 'E501', 'E231' },
maxLineLength = 88,
},
pyflakes = {enabled = false},
}
},
installed packages (mason.vim):
black
flake8
yapf
python-lsp-server
Related
I'm trying to persist container data and for that I want to mount a volume. Here is my task definition which throws the unknown volume error despite declaring it.
aws_ecs_task_definition.wordpress: Creating... Error: ClientException: Unknown volume 'wordpress-volume'.
locals {
username = jsondecode(data.aws_secretsmanager_secret_version.wordpress.secret_string)["username"]
password = jsondecode(data.aws_secretsmanager_secret_version.wordpress.secret_string)["password"]
}
resource "aws_ecs_task_definition" "wordpress" {
family = "wordpress"
container_definitions = jsonencode([{
name = "wordpress"
image = "wordpress"
essential = true
cpu = 256
memory = 512
entryPoint = [ "sh", "-c"]
command = ["ls -la /var/www/html"]
volumes = [{
name = "wordpress-volume"
efsVolumeConfiguration = {
fileSystemId = aws_efs_file_system.wordpress.id
}
}]
mountPoints = [{
sourceVolume = "wordpress-volume"
containerPath = "/var/www/html"
readOnly = false
}]
environment = [{
name = "WORDPRESS_DB_HOST"
value = "127.0.0.1"},
{
name = "WORDPRESS_DB_USER"
value = local.username
},
{
name = "WORDPRESS_DB_PASSWORD"
value = local.password
},
{
name = "WORDPRESS_DB_NAME"
value = "wordpressdb"
}]
portMappings = [{
protocol = "tcp"
containerPort = 80
hostPort = 80
}]
}])
network_mode = "awsvpc"
requires_compatibilities = ["FARGATE"]
execution_role_arn = aws_iam_role.ecs_task_execution_role.arn
task_role_arn = aws_iam_role.ecs_task_role.arn
cpu = 1024
memory = 3072
}
Your volumes definition isn't supposed to be inside container_definitions but is part of aws_ecs_task_definition resource arguments.
So, you should move this part outside:
volumes = [{
name = "wordpress-volume"
efsVolumeConfiguration = {
fileSystemId = aws_efs_file_system.wordpress.id
}
}]
to
resource "aws_ecs_task_definition" "wordpress" {
...
volume {
name = "wordpress-volume"
efs_volume_configuration {
file_system_id = aws_efs_file_system.wordpress.id
}
}
...
}
see the docs:
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_task_definition#volume-block-arguments
https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_TaskDefinition.html
And container definition docs:
https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_ContainerDefinition.html
Attempting to assign a click event to a scatter plot point through Highcharts.net wrapper. The event appears in the javascript output but never fires when a point is clicked. The chart renders well, it is interactive, zooms, hovers, etc. Everything works except the click event. I have tried the click event in both the PlotOptionsSeries location and in the ScatterSeries location.
var chartOptions = new Highsoft.Web.Mvc.Charts.Highcharts
{
Chart = new Highsoft.Web.Mvc.Charts.Chart
{
SpacingTop = 20,
SpacingBottom = 20,
SpacingLeft = 20,
SpacingRight = 20,
ZoomType = Highsoft.Web.Mvc.Charts.ChartZoomType.Xy
},
XAxis = new List<Highsoft.Web.Mvc.Charts.XAxis>
{
new Highsoft.Web.Mvc.Charts.XAxis
{ Max = 150, Min = -150,GridLineWidth = 1, TickInterval = 50,
PlotLines = new List<Highsoft.Web.Mvc.Charts.XAxisPlotLines> { new Highsoft.Web.Mvc.Charts.XAxisPlotLines { Value = 0, Width = 2, ZIndex = 5 } }
}
},
YAxis = new List<Highsoft.Web.Mvc.Charts.YAxis>
{
new Highsoft.Web.Mvc.Charts.YAxis
{
Title = new Highsoft.Web.Mvc.Charts.YAxisTitle { Text = "" },
Max = 150, Min = -150, GridLineWidth = 1, TickInterval = 50,
PlotLines = new List<Highsoft.Web.Mvc.Charts.YAxisPlotLines> { new Highsoft.Web.Mvc.Charts.YAxisPlotLines { Value = 0, Width = 2, ZIndex = 5 } }
}
},
PlotOptions = new Highsoft.Web.Mvc.Charts.PlotOptions
{
Series = new Highsoft.Web.Mvc.Charts.PlotOptionsSeries
{
AllowPointSelect = true,
},
Scatter = new Highsoft.Web.Mvc.Charts.PlotOptionsScatter
{
Marker = new Highsoft.Web.Mvc.Charts.PlotOptionsScatterMarker
{
Radius = 5,
States = new Highsoft.Web.Mvc.Charts.PlotOptionsScatterMarkerStates
{
Hover = new Highsoft.Web.Mvc.Charts.PlotOptionsScatterMarkerStatesHover
{
Enabled = true,
LineColor = "rgb(100,100,100)"
}
}
},
States = new Highsoft.Web.Mvc.Charts.PlotOptionsScatterStates
{
Hover = new Highsoft.Web.Mvc.Charts.PlotOptionsScatterStatesHover
{ }
}
}
},
Series = new List<Highsoft.Web.Mvc.Charts.Series>
{
new Highsoft.Web.Mvc.Charts.ScatterSeries
{
Name = "Dots",
Color = "rgba(223, 83, 83, .5)",
Data = pts3, // Here we put the dbase data into the chart
ZIndex = 6,
Events = new Highsoft.Web.Mvc.Charts.ScatterSeriesEvents
{
Click = "function () {alert('Clicked');console.log('Clicked');}"
},
Tooltip = new Highsoft.Web.Mvc.Charts.ScatterSeriesTooltip
{
HeaderFormat = "",
PointFormat = "<h5>{point.name}<br /></h5>"+"<b>Love It:</b>{point.x} " +
"<b>Challenge:</b>{point.y}",
FooterFormat = "",
FollowPointer = true
}
}
}
};
chartOptions.ID = "teachaggchart";
var renderer = new Highsoft.Web.Mvc.Charts.Rendering.HighchartsRenderer(chartOptions);
It seems that you have found a bug in the wrapper.
I already reported it and it is fixed in new version (8.0.0.2) which should be available now.
How to get the newest version you can find here: http://dotnet.highcharts.com/Highcharts/Demo/Docs?section=UpgradeToStandard
Let me know whether it works in the new version.
I am creating an application using Docker on ECS. I have the following Terraform file (concatenated for ease of reading):
resource "aws_ecs_cluster" "my-cluster" {
name = "my-cluster"
}
resource "aws_launch_configuration" "ecs" {
name = "ECS Cluster"
image_id = "ami-1c002379"
instance_type = "m4.xlarge"
security_groups = ["sg-4218de2a"]
iam_instance_profile = "${aws_iam_instance_profile.ecs.name}"
# TODO: is there a good way to make the key configurable sanely?
key_name = "my-key"
associate_public_ip_address = true
user_data = "#!/bin/bash\necho ECS_CLUSTER='${aws_ecs_cluster.my-cluster.name}' > /etc/ecs/ecs.config"
}
resource "aws_iam_role" "ecs_host_role" {
name = "ecs_host_role"
assume_role_policy = "${file("policies/ecs-role.json")}"
}
resource "aws_iam_role_policy" "ecs_instance_role_policy" {
name = "ecs_instance_role_policy"
policy = "${file("policies/ecs-instance-role-policy.json")}"
role = "${aws_iam_role.ecs_host_role.id}"
}
resource "aws_iam_policy_attachment" "ecs_for_ec2" {
name = "ecs-for-ec2"
roles = ["${aws_iam_role.ecs_host_role.id}"]
policy_arn = "arn:aws:iam::aws:policy/service-role/AmazonEC2ContainerServiceforEC2Role"
}
resource "aws_iam_role" "ecs_service_role" {
name = "ecs_service_role"
assume_role_policy = "${file("policies/ecs-role.json")}"
}
resource "aws_iam_role_policy" "ecs_service_role_policy" {
name = "ecs_service_role_policy"
policy = "${file("policies/ecs-service-role-policy.json")}"
role = "${aws_iam_role.ecs_service_role.id}"
}
resource "aws_iam_instance_profile" "ecs" {
name = "ecs-instance-profile"
path = "/"
role = "${aws_iam_role.ecs_host_role.name}"
}
resource "aws_autoscaling_group" "ecs-cluster" {
availability_zones = ["us-east-2a", "us-east-2b"]
name = "ECS ${aws_ecs_cluster.my-cluster.name}"
min_size = "1"
max_size = "2"
desired_capacity = "1"
health_check_type = "EC2"
launch_configuration = "${aws_launch_configuration.ecs.name}"
vpc_zone_identifier = ["subnet-8e9abce7"]
}
resource "aws_alb" "front-end" {
name = "alb"
internal = false
security_groups = ["sg-4218de2a"]
subnets = ["subnet-8e9abce7", "subnet-e11d779a"]
enable_deletion_protection = true
}
resource "aws_alb_listener" "front_end" {
load_balancer_arn = "${aws_alb.front-end.arn}"
port = "80"
protocol = "HTTP"
default_action {
target_group_arn = "${aws_alb_target_group.fe-tg.arn}"
type = "forward"
}
}
resource "aws_alb_target_group" "fe-tg" {
name = "fe-tg"
port = 8080
protocol = "HTTP"
vpc_id = "vpc-22eeb84b"
health_check {
path = "/poc/healthy.html"
}
}
resource "aws_autoscaling_attachment" "asg_attachment_bar" {
autoscaling_group_name = "${aws_autoscaling_group.ecs-cluster.name}"
alb_target_group_arn = "${aws_alb_target_group.fe-tg.arn}"
}
resource "template_file" "task_container_definition" {
template = "${file("container-defintion.json.tpl")}"
vars {
aws_region = "${var.region}"
aws_account = "${var.account}"
image = "${var.image}"
tag = "${var.tag}"
}
}
resource "aws_ecs_task_definition" "my-td" {
family = "my-task"
container_definitions = "${template_file.task_container_definition.rendered}"
}
resource "aws_ecs_service" "poc" {
name = "poc-v4"
cluster = "${aws_ecs_cluster.my-cluster.name}"
task_definition = "${aws_ecs_task_definition.my-td.arn}"
desired_count = 3
iam_role = "${aws_iam_role.ecs_service_role.arn}"
depends_on = ["aws_iam_role_policy.ecs_service_role_policy", "aws_alb_listener.front_end"]
deployment_maximum_percent = 200
deployment_minimum_healthy_percent = 51
load_balancer {
target_group_arn = "${aws_alb_target_group.fe-tg.id}"
container_name = "greeter"
container_port = 0
}
placement_constraints {
type = "memberOf"
expression = "attribute:ecs.availability-zone in [us-east-2a, us-east-2b]"
}
placement_strategy {
type = "binpack"
field = "cpu"
}
}
Task Definition Template:
[{
"environment": [],
"name": "greeter",
"mountPoints": [],
"image": "${aws_account}.dkr.ecr.${aws_region}.amazonaws.com/${image}:${tag}",
"cpu": 0,
"portMappings": [
{
"containerPort": 8080, "hostPort": 0
}
],
"memory": 2048,
"memoryReservation": 1024,
"essential": true,
"volumesFrom": []
}]
I am asking ECS to spin up at least 3 tasks within my service. But, for some reason, my Application Load Balancer isn't putting the Ephemeral Ports into the health check. It's putting the actually tomcat port (8080).
When I create a service by hand it works just fine, but using Terraform it doesn't. Does anything stick out?
Yes, I saw the setting. the resource aws_alb_listener is only used to define default rule (the last, lowest priority rule)
Please add resource aws_alb_listener_rule, sample codes for you:
resource "aws_alb_listener_rule" "static" {
listener_arn = "${aws_alb_listener.front_end.arn}"
priority = 100
action {
type = "forward"
target_group_arn = "${aws_alb_target_group.fe-tg.arn}"
}
condition {
field = "path-pattern"
values = ["/static/*"]
}
}
You can add more resource aws_alb_listener_rule with different priority (100, 101, 102,...).
With it, you should be fine to get dynamic ports properly.
I want to play a video in landscape mode. But Alas! it's being displayed in Potrait mode.
My build.setting file is configured properly. My whole game is in landscape mode but this video orientation thing is disturbing everything.
My code is
media.playVideo("media/ending.mp4", false)
My build.setting code is
settings = {
android =
{
usesPermissions =
{
"android.permission.VIBRATE",
},
},
orientation = {
default = "landscapeRight",
supported = { "landscapeRight", "landscapeLeft"}
},
iphone = {
plist = {
UIAppFonts =
{
"Literaturnaya Book.ttf"
},
UIStatusBarHidden = false,
UIPrerenderedIcon = false,
UIApplicationExitsOnSuspend = true,
},
},
androidPermissions =
{
"android.permission.INTERNET",
"android.permission.ACCESS_NETWORK_STATE"
},
android =
{
usesPermissions =
{
"android.permission.INTERNET",
"android.permission.ACCESS_WIFI_STATE",
"android.permission.READ_PHONE_STATE",
"android.permission.ACCESS_NETWORK_STATE",
},
},
}
Any help would be highly appreciated.
Thanks,
I have the code below which has ben spat out of an XML parse but i'm unsure as to what I should do to consolidate it. How would I add all the 'string' items into an array??
Parser:
NSData *data=[NSData dataWithContentsOfURL:[NSURL URLWithString:[NSString stringWithFormat:#"http://www.url.net/directory/%#",fileName]]];
NSDictionary *dict=[XMLParser dictionaryForXMLData:data error:nil];
NSLog(#"%#",dict);
XMLParser is a custom class.
NSLog:
plist = {
dict = {
key = (
{
text = "\n\n\tmapFile";
},
{
text = "\n\tmapPreviewFile";
},
{
text = "\n\tmapScale";
},
{
text = "\n\tmapper";
},
{
text = "\n\tterrain";
},
{
text = "\n\tTopLeft";
},
{
text = "\n\tTopRight";
},
{
text = "\n\tBottomLeft";
},
{
text = "\n\tBottomRight";
}
);
string = (
{
text = "\n\thttp://www.url.com";
},
{
text = "\n\thttp://www.url.com";
},
{
text = "\n\t1 : 2 500";
},
{
text = "\n\tSeb O'H (2014)";
},
{
text = "\n\tUrban (school)";
},
{
text = "\n\t42.87067222225,147.31143055";
},
{
text = "\n\t42.8645138888888894, 147.3160527777777";
},
{
text = "\n\t42.87067222222222, 147.3160527777777";
},
{
text = "\n\t42.8645138888888894, 147.31143055555555";
}
);
text = "\n";
};
text = "\n";
version = "1.0";
};
I've tried many methods but still can't seem to get it working. So in simple my question is, how do I put a row in an NSDictionary into an NSArray.
Thanks.
You can simply filter the array using valueForKeyPath
NSArray *text = [data valueForKeyPath:#"plist.dict.string.text"];