问:
HttpResponseBase replacement in ASP.NET Core MVC
I have a CustomJsonResult class shown below, which is written in ASP.NET MVC:

```<code>using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Web.Mvc;
using System.Web.Script.Serialization;

namespace Web.Authentication
{
public class CustomJsonResult : JsonResult
{
    public override void ExecuteResult(ControllerContext context)
    {
        if (context == null)
        {
            throw new ArgumentNullException("context");
        }

        HttpResponseBase response = context.HttpContext.Response;

        if (!String.IsNullOrEmpty(ContentType))
        {
            response.ContentType = ContentType;
        }
        else
        {
            response.ContentType = "application/json";
        }
        if (ContentEncoding != null)
        {
            response.ContentEncoding = ContentEncoding;
        }
        if (Data != null)
        {
            var isoConvert = new IsoDateTimeConverter();
            isoConvert.DateTimeFormat = _dateFormat;
            response.Write(JsonConvert.SerializeObject(Data, isoConvert));
        }
    }
}
}
</code>```

I converted this to ASP.NET Core MVC. For that I changed the HttpResponseBase to HttpResponse and added this namespace using Microsoft.AspNetCore.Http;

```<code>using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Web.Script.Serialization;

namespace Web.Authentication
{
public class CustomJsonResult : JsonResult
{
    public override void ExecuteResult(ControllerContext context)
    {
        if (context == null)
        {
            throw new ArgumentNullException("context");
        }

        HttpResponse response = context.HttpContext.Response;

        if (!String.IsNullOrEmpty(ContentType))
        {
            response.ContentType = ContentType;
        }
        else
        {
            response.ContentType = "application/json";
        }
        if (ContentEncoding != null)
        {
            response.ContentEncoding = ContentEncoding;
        }
        if (Data != null)
        {
            var isoConvert = new IsoDateTimeConverter();
            isoConvert.DateTimeFormat = _dateFormat;
            response.Write(JsonConvert.SerializeObject(Data, isoConvert));
        }
    }
}
}
</code>```

I'm using this class in controller json method:

```<code>[HttpPost]
    [ValidateAntiForgeryToken]
    public JsonResult GetDataRefreshDate()
    {
        var response = ...
        return new CustomJsonResult()
        {
            Data = response,
            MaxJsonLength = 86753090
        };
    }
</code>```

But After converting, I'm getting errors like

The type or namespace name 'Script' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)

The name 'Data' does not exist in the current context

'HttpResponse' does not contain a definition for 'Write' and no accessible extension method 'Write' accepting a first argument of type 'HttpResponse' could be found (are you missing a using directive or an assembly reference?)

The name 'ContentEncoding' does not exist in the current context

'CustomJsonResult.ExecuteResult(ControllerContext)': no suitable method found to override

答:
```<code>public class CustomJsonResult1 : JsonResult
    {

        public CustomJsonResult1(object value) : base(value)
        {

        }
        public int MaxJsonLength { get; set; }

        public override Task ExecuteResultAsync(ActionContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            HttpResponse response = context.HttpContext.Response;
            if (!String.IsNullOrEmpty(ContentType))
            {
                response.ContentType = ContentType;
            }
            else
            {
                response.ContentType = "application/json";
            }
            var mediaType = new MediaTypeHeaderValue(ContentType);
            if (mediaType.Encoding != null)
            {
                response.ContentType = response.ContentType;
            }

            if (Value != null)
            {
                var isoConvert = new IsoDateTimeConverter();
                isoConvert.DateTimeFormat = null;

                response.WriteAsync(JsonConvert.SerializeObject(Value, isoConvert));
            }
            return Task.CompletedTask;
        }
    }
</code>```

In controller：

```<code>return new CustomJsonResult1(new { result = false, msg = "???" });
</code>```

There is no MaxJsonLength property in Jsonresult  class in asp.net core.
and the "Data"property is replaced with value propert

Body:
I have a CustomJsonResult class shown below, which is written in ASP.NET MVC:

using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Web.Mvc;
using System.Web.Script.Serialization;

namespace Web.Authentication
{
public class CustomJsonResult : JsonResult
{
    public override void ExecuteResult(ControllerContext context)
    {
        if (context == null)
        {
            throw new ArgumentNullException("context");
        }

        HttpResponseBase response = context.HttpContext.Response;

        if (!String.IsNullOrEmpty(ContentType))
        {
            response.ContentType = ContentType;
        }
        else
        {
            response.ContentType = "application/json";
        }
        if (ContentEncoding != null)
        {
            response.ContentEncoding = ContentEncoding;
        }
        if (Data != null)
        {
            var isoConvert = new IsoDateTimeConverter();
            isoConvert.DateTimeFormat = _dateFormat;
            response.Write(JsonConvert.SerializeObject(Data, isoConvert));
        }
    }
}
}

I converted this to ASP.NET Core MVC. For that I changed the HttpResponseBase to HttpResponse and added this namespace using Microsoft.AspNetCore.Http;

using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Web.Script.Serialization;

namespace Web.Authentication
{
public class CustomJsonResult : JsonResult
{
    public override void ExecuteResult(ControllerContext context)
    {
        if (context == null)
        {
            throw new ArgumentNullException("context");
        }

        HttpResponse response = context.HttpContext.Response;

        if (!String.IsNullOrEmpty(ContentType))
        {
            response.ContentType = ContentType;
        }
        else
        {
            response.ContentType = "application/json";
        }
        if (ContentEncoding != null)
        {
            response.ContentEncoding = ContentEncoding;
        }
        if (Data != null)
        {
            var isoConvert = new IsoDateTimeConverter();
            isoConvert.DateTimeFormat = _dateFormat;
            response.Write(JsonConvert.SerializeObject(Data, isoConvert));
        }
    }
}
}

I'm using this class in controller json method:

[HttpPost]
    [ValidateAntiForgeryToken]
    public JsonResult GetDataRefreshDate()
    {
        var response = ...
        return new CustomJsonResult()
        {
            Data = response,
            MaxJsonLength = 86753090
        };
    }

But After converting, I'm getting errors like

The type or namespace name 'Script' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)

The name 'Data' does not exist in the current context

'HttpResponse' does not contain a definition for 'Write' and no accessible extension method 'Write' accepting a first argument of type 'HttpResponse' could be found (are you missing a using directive or an assembly reference?)

The name 'ContentEncoding' does not exist in the current context

'CustomJsonResult.ExecuteResult(ControllerContext)': no suitable method found to override

Body:
public class CustomJsonResult1 : JsonResult
    {

        public CustomJsonResult1(object value) : base(value)
        {

        }
        public int MaxJsonLength { get; set; }

        public override Task ExecuteResultAsync(ActionContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            HttpResponse response = context.HttpContext.Response;
            if (!String.IsNullOrEmpty(ContentType))
            {
                response.ContentType = ContentType;
            }
            else
            {
                response.ContentType = "application/json";
            }
            var mediaType = new MediaTypeHeaderValue(ContentType);
            if (mediaType.Encoding != null)
            {
                response.ContentType = response.ContentType;
            }

            if (Value != null)
            {
                var isoConvert = new IsoDateTimeConverter();
                isoConvert.DateTimeFormat = null;

                response.WriteAsync(JsonConvert.SerializeObject(Value, isoConvert));
            }
            return Task.CompletedTask;
        }
    }

In controller：

return new CustomJsonResult1(new { result = false, msg = "???" });

There is no MaxJsonLength property in Jsonresult  class in asp.net core.
and the "Data"property is replaced with value propert


来源: stackexchange

问:
Errors during downloading metadata for repository 'AppStream'
When I use yum list java*,I get an error like the following：

```<code>[root@crucialer ~]# yum list java*
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
CentOS-8 - AppStream                                                                                17 kB/s | 2.3 kB     00:00
Errors during downloading metadata for repository 'AppStream':
  - Status code: 404 for http://mirrors.cloud.aliyuncs.com/centos/8/AppStream/x86_64/os/repodata/repomd.xml (IP: 100.100.2.148)
Error: Failed to download metadata for repo 'AppStream': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
</code>```
```<code>[root@crucialer ~]# ping 100.100.2.148
PING 100.100.2.148 (100.100.2.148) 56(84) bytes of data.
64 bytes from 100.100.2.148: icmp_seq=1 ttl=102 time=1.94 ms
64 bytes from 100.100.2.148: icmp_seq=2 ttl=102 time=1.88 ms
64 bytes from 100.100.2.148: icmp_seq=3 ttl=102 time=2.08 ms
64 bytes from 100.100.2.148: icmp_seq=4 ttl=102 time=1.94 ms
64 bytes from 100.100.2.148: icmp_seq=5 ttl=102 time=1.93 ms
^C
--- 100.100.2.148 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 8ms
rtt min/avg/max/mdev = 1.883/1.953/2.078/0.076 ms
[root@crucialer ~]# ping www.baidu.com
PING www.a.shifen.com (180.101.49.12) 56(84) bytes of data.
64 bytes from 180.101.49.12 (180.101.49.12): icmp_seq=1 ttl=50 time=15.6 ms
64 bytes from 180.101.49.12 (180.101.49.12): icmp_seq=2 ttl=50 time=15.2 ms
64 bytes from 180.101.49.12 (180.101.49.12): icmp_seq=3 ttl=50 time=15.2 ms
64 bytes from 180.101.49.12 (180.101.49.12): icmp_seq=4 ttl=50 time=15.3 ms
^C
--- www.a.shifen.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 6ms
rtt min/avg/max/mdev = 15.223/15.331/15.581/0.210 ms

</code>```
```<code>
[root@crucialer yum.repos.d]# cat CentOS-Base.repo
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$releasever - Base - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$releasever - Updates - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - 163.com
baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

</code>```

Any suggestions would be greatly appreciated.

答:
This is probably down to the fact that CentOS Linux 8 has reached End Of Life. The linked article explains that you if want keep with CentoOS8 you'll need to change the repos to use vault.centos.org BUT there will be no further updates. If you want maintain updates you should migrate to Centos Stream to - one way to do this:

```<code>sudo dnf --disablerepo '*' --enablerepo=extras swap centos-linux-repos centos-stream-repos
sudo dnf distro-sync
</code>```

Also looking at your config it seems you have some references to Centos7 which might interfere with things, though hopefully the update will deal with them. Note: CentOS7 is supported till 2024-06-30.

ContentLicense: CC BY-SA 4.0

Body:
When I use yum list java*,I get an error like the following：

[root@crucialer ~]# yum list java*
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
CentOS-8 - AppStream                                                                                17 kB/s | 2.3 kB     00:00
Errors during downloading metadata for repository 'AppStream':
  - Status code: 404 for http://mirrors.cloud.aliyuncs.com/centos/8/AppStream/x86_64/os/repodata/repomd.xml (IP: 100.100.2.148)
Error: Failed to download metadata for repo 'AppStream': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried

[root@crucialer ~]# ping 100.100.2.148
PING 100.100.2.148 (100.100.2.148) 56(84) bytes of data.
64 bytes from 100.100.2.148: icmp_seq=1 ttl=102 time=1.94 ms
64 bytes from 100.100.2.148: icmp_seq=2 ttl=102 time=1.88 ms
64 bytes from 100.100.2.148: icmp_seq=3 ttl=102 time=2.08 ms
64 bytes from 100.100.2.148: icmp_seq=4 ttl=102 time=1.94 ms
64 bytes from 100.100.2.148: icmp_seq=5 ttl=102 time=1.93 ms
^C
--- 100.100.2.148 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 8ms
rtt min/avg/max/mdev = 1.883/1.953/2.078/0.076 ms
[root@crucialer ~]# ping www.baidu.com
PING www.a.shifen.com (180.101.49.12) 56(84) bytes of data.
64 bytes from 180.101.49.12 (180.101.49.12): icmp_seq=1 ttl=50 time=15.6 ms
64 bytes from 180.101.49.12 (180.101.49.12): icmp_seq=2 ttl=50 time=15.2 ms
64 bytes from 180.101.49.12 (180.101.49.12): icmp_seq=3 ttl=50 time=15.2 ms
64 bytes from 180.101.49.12 (180.101.49.12): icmp_seq=4 ttl=50 time=15.3 ms
^C
--- www.a.shifen.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 6ms
rtt min/avg/max/mdev = 15.223/15.331/15.581/0.210 ms

[root@crucialer yum.repos.d]# cat CentOS-Base.repo
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$releasever - Base - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$releasever - Updates - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - 163.com
baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

Any suggestions would be greatly appreciated.

Body:
This is probably down to the fact that CentOS Linux 8 has reached End Of Life. The linked article explains that you if want keep with CentoOS8 you'll need to change the repos to use vault.centos.org BUT there will be no further updates. If you want maintain updates you should migrate to Centos Stream to - one way to do this:

sudo dnf --disablerepo '*' --enablerepo=extras swap centos-linux-repos centos-stream-repos
sudo dnf distro-sync

Also looking at your config it seems you have some references to Centos7 which might interfere with things, though hopefully the update will deal with them. Note: CentOS7 is supported till 2024-06-30.


问:
How to combine GitLab CI job for rule:if with matrix and allow_failure?
I need configure my GitLab CI job like this:

Only job with $CI_PIPELINE_SOURCE == "merge_request_event" is added to Pipeline,

Job is runned multipletimes by matrix for each version defined by matrix PHP_VERSION: [ '7.4', '8.0', '8.1' ].

The '8.1' must but runned with allow_failure: true.

I tried to write rules intuitive as I except rules works, but I'm getting a different result.

I first tried this:

parallel:
matrix:
  - PHP_VERSION: [ '7.4', '8.0', '8.1' ]
rules:
  - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
    when: on_success
  - if: '$PHP_VERSION == "8.1"'
    allow_failure: true
```
<p>It result only to MR event for PHP 8.1 us added to Pipeline.</p>
<p>My next iteration is still wrong:</p>
<pre class="lang-yaml prettyprint-override"><code>  parallel:
    matrix:
      - PHP_VERSION: [ '7.4', '8.0', '8.1' ]
  rules:
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
      when: on_success
    - if: '$PHP_VERSION == "8.1"'
      when: on_success
      allow_failure: true
    - when: on_success
</code>```

This looks better, but it runs job for every other event (not only merge_request_event).

How I can to right combine rules to get result as I declared above?

答:
You could try

```<code>  parallel:
    matrix:
      - PHP_VERSION: [ '7.4', '8.0', '8.1' ]
  rules:
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
      when: on_success
    - if: '$PHP_VERSION == "8.1"'
      when: on_success
      allow_failure: true
    - if: '$PHP_VERSION'
      when: on_success
      allow_failure: false
</code>```

Based on https://docs.gitlab.com/ee/ci/jobs/job_control.html#run-a-matrix-of-parallel-trigger-jobs

Example of execution

Body:
I need configure my GitLab CI job like this:

Only job with $CI_PIPELINE_SOURCE == "merge_request_event" is added to Pipeline,

Job is runned multipletimes by matrix for each version defined by matrix PHP_VERSION: [ '7.4', '8.0', '8.1' ].

The '8.1' must but runned with allow_failure: true.

I tried to write rules intuitive as I except rules works, but I'm getting a different result.

I first tried this:

parallel:
matrix:
  - PHP_VERSION: [ '7.4', '8.0', '8.1' ]
rules:
  - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
    when: on_success
  - if: '$PHP_VERSION == "8.1"'
    allow_failure: true

It result only to MR event for PHP 8.1 us added to Pipeline.

My next iteration is still wrong:

  parallel:
    matrix:
      - PHP_VERSION: [ '7.4', '8.0', '8.1' ]
  rules:
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
      when: on_success
    - if: '$PHP_VERSION == "8.1"'
      when: on_success
      allow_failure: true
    - when: on_success

This looks better, but it runs job for every other event (not only merge_request_event).

How I can to right combine rules to get result as I declared above?

Body:
You could try

  parallel:
    matrix:
      - PHP_VERSION: [ '7.4', '8.0', '8.1' ]
  rules:
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
      when: on_success
    - if: '$PHP_VERSION == "8.1"'
      when: on_success
      allow_failure: true
    - if: '$PHP_VERSION'
      when: on_success
      allow_failure: false

Based on https://docs.gitlab.com/ee/ci/jobs/job_control.html#run-a-matrix-of-parallel-trigger-jobs

Example of execution


问:
TabNavigator extra padding
How to style the TabNavigator Tab's height and padding? Im doing the following:

```<code>import Icon from "react-native-vector-icons/MaterialIcons";
const tabNav = TabNavigator({
  TabItem1: {
      screen: MainScreen,
      navigationOptions: {
          tabBarLabel:"Home",
          tabBarIcon: ({ tintColor }) => <Icon name={"home"} size={20} color={tintColor} />
      }
    },
    TabItem2: {
      screen: MainScreen,
      navigationOptions: {
        tabBarLabel:"Home",
        tabBarIcon: ({ tintColor }) => <Icon name={"home"} size={30} color={tintColor}  />
      }
    },
    TabItem3: {
      screen: MainScreen,
      navigationOptions: {
        tabBarLabel:"Browse",
        tabBarIcon: ({ tintColor }) => <Icon name={"home"} color={tintColor} />
      }
    }
}, {
    tabBarPosition: 'bottom',
    tabBarOptions: {
        activeTintColor: '#222',
        activeBackgroundColor :'yellow',  //Doesn't work
        showIcon: true,
        tabStyle: {
            padding: 0, margin:0,   //Padding 0 here
        },
    iconStyle: {
        width: 30,
        height: 30,
        padding:0       //Padding 0 here
    },
    }
});
</code>```

How do I get rid of the padding between the icon and the label? I did padding:0 in iconStyle and also in tabStyle but no luck. I want no padding below the label too. How do I do that? Thanks.

Found the extra padding is caused by View:

How do i get rid of that?

答:
Ran into a similar problem today and came across this post. My issue however had a - paddingBottom: 30 - being applied to the tabBarStyle.

I did not want to overwrite the package files since it could either lead to unforeseen issues elsewhere or it will be overwritten in future updates.

I simply set the value to it's negative to bring the overall padding being applied to 0 - ie. paddingBottom: -30

Not sure if it'll help someone but it helped me.

ContentLicense: CC BY-SA 3.0

Title: TabNavigator extra padding

Body:
How to style the TabNavigator Tab's height and padding? Im doing the following:

import Icon from "react-native-vector-icons/MaterialIcons";
const tabNav = TabNavigator({
  TabItem1: {
      screen: MainScreen,
      navigationOptions: {
          tabBarLabel:"Home",
          tabBarIcon: ({ tintColor }) => <Icon name={"home"} size={20} color={tintColor} />
      }
    },
    TabItem2: {
      screen: MainScreen,
      navigationOptions: {
        tabBarLabel:"Home",
        tabBarIcon: ({ tintColor }) => <Icon name={"home"} size={30} color={tintColor}  />
      }
    },
    TabItem3: {
      screen: MainScreen,
      navigationOptions: {
        tabBarLabel:"Browse",
        tabBarIcon: ({ tintColor }) => <Icon name={"home"} color={tintColor} />
      }
    }
}, {
    tabBarPosition: 'bottom',
    tabBarOptions: {
        activeTintColor: '#222',
        activeBackgroundColor :'yellow',  //Doesn't work
        showIcon: true,
        tabStyle: {
            padding: 0, margin:0,   //Padding 0 here
        },
    iconStyle: {
        width: 30,
        height: 30,
        padding:0       //Padding 0 here
    },
    }
});

How do I get rid of the padding between the icon and the label? I did padding:0 in iconStyle and also in tabStyle but no luck. I want no padding below the label too. How do I do that? Thanks.

Found the extra padding is caused by View:

How do i get rid of that?


问:
fail to install ruby-filemagic 0.7.2 on mac m1 big sur
Install ruby-filemagic 0.7.2 fail
I'm using mac M1 Bigsur ver 11.5.2

what i already try :

brew install libmagic

already installed but still fail to install ruby-filemagic

here is the log :

```<code>    current directory: /Users/<username>/.rvm/gems/ruby-2.6.5/gems/ruby-filemagic-0.7.2/ext/filemagic
/Users/<username>/.rvm/rubies/ruby-2.6.5/bin/ruby -I /Users/<username>/.rvm/rubies/ruby-2.6.5/lib/ruby/site_ruby/2.6.0 -r ./siteconf20210907-83349-1lgxyp3.rb extconf.rb
checking for -lgnurx... no
checking for magic_open() in -lmagic... no
*** ERROR: missing required library to compile this module
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/Users/<username>/.rvm/rubies/ruby-2.6.5/bin/$(RUBY_BASE_NAME)
    --with-magic-dir
    --without-magic-dir
    --with-magic-include
    --without-magic-include=${magic-dir}/include
    --with-magic-lib
    --without-magic-lib=${magic-dir}/lib
    --with-gnurx-dir
    --without-gnurx-dir
    --with-gnurx-include
    --without-gnurx-include=${gnurx-dir}/include
    --with-gnurx-lib
    --without-gnurx-lib=${gnurx-dir}/lib
    --with-gnurxlib
    --without-gnurxlib
    --with-magiclib
    --without-magiclib

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /Users/<username>/.rvm/gems/ruby-2.6.5/extensions/-darwin-20/2.6.0/ruby-filemagic-0.7.2/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/<username>/.rvm/gems/ruby-2.6.5/gems/ruby-filemagic-0.7.2 for inspection.
Results logged to /Users/<username>/.rvm/gems/ruby-2.6.5/extensions/-darwin-20/2.6.0/ruby-filemagic-0.7.2/gem_make.out

An error occurred while installing ruby-filemagic (0.7.2), and Bundler cannot continue.
Make sure that `gem install ruby-filemagic -v '0.7.2' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  ruby-filemagic
</code>```

log from :  /Users//.rvm/gems/ruby-2.6.5/extensions/-darwin-20/2.6.0/ruby-filemagic-0.7.2/mkmf.log

```<code>have_library: checking for -lgnurx... -------------------- no

"gcc -o conftest -I/Users/<username>/.rvm/rubies/ruby-2.6.5/include/ruby-2.6.0/-darwin20 -I/Users/<username>/.rvm/rubies/ruby-2.6.5/include/ruby-2.6.0/ruby/backward -I/Users/<username>/.rvm/rubies/ruby-2.6.5/include/ruby-2.6.0 -I. -I/opt/local/include -I/usr/local/include -I/usr/include  -I/opt/homebrew/opt/libyaml/include -I/opt/homebrew/opt/libksba/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/zlib/include -I/opt/homebrew/opt/openssl@1.1/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -Wno-error=implicit-function-declaration -ggdb3 -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens  -fno-common -pipe conftest.c  -L. -L/Users/<username>/.rvm/rubies/ruby-2.6.5/lib -L/opt/local/lib -L/usr/local/lib -L/usr/lib -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openssl@1.1/lib -L. -fstack-protector-strong -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openssl@1.1/lib     -lruby.2.6   "
ld: warning: directory not found for option '-L/opt/local/lib'
ld: warning: directory not found for option '-L/usr/local/opt/openssl/lib/'
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

"gcc -o conftest -I/Users/<username>/.rvm/rubies/ruby-2.6.5/include/ruby-2.6.0/-darwin20 -I/Users/<username>/.rvm/rubies/ruby-2.6.5/include/ruby-2.6.0/ruby/backward -I/Users/<username>/.rvm/rubies/ruby-2.6.5/include/ruby-2.6.0 -I. -I/opt/local/include -I/usr/local/include -I/usr/include  -I/opt/homebrew/opt/libyaml/include -I/opt/homebrew/opt/libksba/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/zlib/include -I/opt/homebrew/opt/openssl@1.1/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -Wno-error=implicit-function-declaration -ggdb3 -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens  -fno-common -pipe conftest.c  -L. -L/Users/<username>/.rvm/rubies/ruby-2.6.5/lib -L/opt/local/lib -L/usr/local/lib -L/usr/lib -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openssl@1.1/lib -L. -fstack-protector-strong -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openssl@1.1/lib     -lruby.2.6 -lgnurx   "
ld: warning: directory not found for option '-L/opt/local/lib'
ld: warning: directory not found for option '-L/usr/local/opt/openssl/lib/'
ld: library not found for -lgnurx
clang: error: linker command failed with exit code 1 (use -v to see invocation)
checked program was:
/* begin */
 1: #include "ruby.h"
 2:
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7:   if (argc > 1000000) {
 8:     int (* volatile tp)(void)=(int (*)(void))&t;
 9:     printf("%d", (*tp)());
10:   }
11:
12:   return 0;
13: }
14:
15: int t(void) { ; return 0; }
/* end */

--------------------

have_library: checking for magic_open() in -lmagic... -------------------- no

"gcc -o conftest -I/Users/<username>/.rvm/rubies/ruby-2.6.5/include/ruby-2.6.0/-darwin20 -I/Users/<username>/.rvm/rubies/ruby-2.6.5/include/ruby-2.6.0/ruby/backward -I/Users/<username>/.rvm/rubies/ruby-2.6.5/include/ruby-2.6.0 -I. -I/opt/local/include -I/usr/local/include -I/usr/include  -I/opt/homebrew/opt/libyaml/include -I/opt/homebrew/opt/libksba/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/zlib/include -I/opt/homebrew/opt/openssl@1.1/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -Wno-error=implicit-function-declaration -ggdb3 -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens  -fno-common -pipe conftest.c  -L. -L/Users/<username>/.rvm/rubies/ruby-2.6.5/lib -L/opt/local/lib -L/usr/local/lib -L/usr/lib -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openssl@1.1/lib -L. -fstack-protector-strong -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openssl@1.1/lib     -lruby.2.6 -lmagic   "
conftest.c:14:57: error: use of undeclared identifier 'magic_open'
int t(void) { void ((*volatile p)()); p = (void ((*)()))magic_open; return !p; }
                                                        ^
1 error generated.
checked program was:
/* begin */
 1: #include "ruby.h"
 2:
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7:   if (argc > 1000000) {
 8:     int (* volatile tp)(void)=(int (*)(void))&t;
 9:     printf("%d", (*tp)());
10:   }
11:
12:   return 0;
13: }
14: int t(void) { void ((*volatile p)()); p = (void ((*)()))magic_open; return !p; }
/* end */

"gcc -o conftest -I/Users/<username>/.rvm/rubies/ruby-2.6.5/include/ruby-2.6.0/-darwin20 -I/Users/<username>/.rvm/rubies/ruby-2.6.5/include/ruby-2.6.0/ruby/backward -I/Users/<username>/.rvm/rubies/ruby-2.6.5/include/ruby-2.6.0 -I. -I/opt/local/include -I/usr/local/include -I/usr/include  -I/opt/homebrew/opt/libyaml/include -I/opt/homebrew/opt/libksba/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/zlib/include -I/opt/homebrew/opt/openssl@1.1/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -Wno-error=implicit-function-declaration -ggdb3 -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens  -fno-common -pipe conftest.c  -L. -L/Users/<username>/.rvm/rubies/ruby-2.6.5/lib -L/opt/local/lib -L/usr/local/lib -L/usr/lib -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openssl@1.1/lib -L. -fstack-protector-strong -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openssl@1.1/lib     -lruby.2.6 -lmagic   "
ld: warning: directory not found for option '-L/opt/local/lib'
ld: warning: directory not found for option '-L/usr/local/opt/openssl/lib/'
ld: library not found for -lmagic
clang: error: linker command failed with exit code 1 (use -v to see invocation)
checked program was:
/* begin */
 1: #include "ruby.h"
 2:
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7:   if (argc > 1000000) {
 8:     int (* volatile tp)(void)=(int (*)(void))&t;
 9:     printf("%d", (*tp)());
10:   }
11:
12:   return 0;
13: }
14: extern void magic_open();
15: int t(void) { magic_open(); return 0; }
/* end */

--------------------

</code>```

can somebody help me, I got stuck on this ...
*notes ---
as information i use rbenv before , is it possible that it causes conflict or something ? now i use rmv

答:
gem install ruby-filemagic -v 0.7.2 -- \
  --with-magic-lib=$(brew --prefix)/lib \
  --with-magic-include=$(brew --prefix)/include
```

Body:
Install ruby-filemagic 0.7.2 fail
I'm using mac M1 Bigsur ver 11.5.2

what i already try :

brew install libmagic

already installed but still fail to install ruby-filemagic

here is the log :

    current directory: /Users/<username>/.rvm/gems/ruby-2.6.5/gems/ruby-filemagic-0.7.2/ext/filemagic
/Users/<username>/.rvm/rubies/ruby-2.6.5/bin/ruby -I /Users/<username>/.rvm/rubies/ruby-2.6.5/lib/ruby/site_ruby/2.6.0 -r ./siteconf20210907-83349-1lgxyp3.rb extconf.rb
checking for -lgnurx... no
checking for magic_open() in -lmagic... no
*** ERROR: missing required library to compile this module
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/Users/<username>/.rvm/rubies/ruby-2.6.5/bin/$(RUBY_BASE_NAME)
    --with-magic-dir
    --without-magic-dir
    --with-magic-include
    --without-magic-include=${magic-dir}/include
    --with-magic-lib
    --without-magic-lib=${magic-dir}/lib
    --with-gnurx-dir
    --without-gnurx-dir
    --with-gnurx-include
    --without-gnurx-include=${gnurx-dir}/include
    --with-gnurx-lib
    --without-gnurx-lib=${gnurx-dir}/lib
    --with-gnurxlib
    --without-gnurxlib
    --with-magiclib
    --without-magiclib

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /Users/<username>/.rvm/gems/ruby-2.6.5/extensions/-darwin-20/2.6.0/ruby-filemagic-0.7.2/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/<username>/.rvm/gems/ruby-2.6.5/gems/ruby-filemagic-0.7.2 for inspection.
Results logged to /Users/<username>/.rvm/gems/ruby-2.6.5/extensions/-darwin-20/2.6.0/ruby-filemagic-0.7.2/gem_make.out

An error occurred while installing ruby-filemagic (0.7.2), and Bundler cannot continue.
Make sure that `gem install ruby-filemagic -v '0.7.2' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  ruby-filemagic

log from :  /Users//.rvm/gems/ruby-2.6.5/extensions/-darwin-20/2.6.0/ruby-filemagic-0.7.2/mkmf.log

have_library: checking for -lgnurx... -------------------- no

"gcc -o conftest -I/Users/<username>/.rvm/rubies/ruby-2.6.5/include/ruby-2.6.0/-darwin20 -I/Users/<username>/.rvm/rubies/ruby-2.6.5/include/ruby-2.6.0/ruby/backward -I/Users/<username>/.rvm/rubies/ruby-2.6.5/include/ruby-2.6.0 -I. -I/opt/local/include -I/usr/local/include -I/usr/include  -I/opt/homebrew/opt/libyaml/include -I/opt/homebrew/opt/libksba/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/zlib/include -I/opt/homebrew/opt/openssl@1.1/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -Wno-error=implicit-function-declaration -ggdb3 -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens  -fno-common -pipe conftest.c  -L. -L/Users/<username>/.rvm/rubies/ruby-2.6.5/lib -L/opt/local/lib -L/usr/local/lib -L/usr/lib -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openssl@1.1/lib -L. -fstack-protector-strong -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openssl@1.1/lib     -lruby.2.6   "
ld: warning: directory not found for option '-L/opt/local/lib'
ld: warning: directory not found for option '-L/usr/local/opt/openssl/lib/'
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

"gcc -o conftest -I/Users/<username>/.rvm/rubies/ruby-2.6.5/include/ruby-2.6.0/-darwin20 -I/Users/<username>/.rvm/rubies/ruby-2.6.5/include/ruby-2.6.0/ruby/backward -I/Users/<username>/.rvm/rubies/ruby-2.6.5/include/ruby-2.6.0 -I. -I/opt/local/include -I/usr/local/include -I/usr/include  -I/opt/homebrew/opt/libyaml/include -I/opt/homebrew/opt/libksba/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/zlib/include -I/opt/homebrew/opt/openssl@1.1/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -Wno-error=implicit-function-declaration -ggdb3 -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens  -fno-common -pipe conftest.c  -L. -L/Users/<username>/.rvm/rubies/ruby-2.6.5/lib -L/opt/local/lib -L/usr/local/lib -L/usr/lib -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openssl@1.1/lib -L. -fstack-protector-strong -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openssl@1.1/lib     -lruby.2.6 -lgnurx   "
ld: warning: directory not found for option '-L/opt/local/lib'
ld: warning: directory not found for option '-L/usr/local/opt/openssl/lib/'
ld: library not found for -lgnurx
clang: error: linker command failed with exit code 1 (use -v to see invocation)
checked program was:
/* begin */
 1: #include "ruby.h"
 2:
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7:   if (argc > 1000000) {
 8:     int (* volatile tp)(void)=(int (*)(void))&t;
 9:     printf("%d", (*tp)());
10:   }
11:
12:   return 0;
13: }
14:
15: int t(void) { ; return 0; }
/* end */

--------------------

have_library: checking for magic_open() in -lmagic... -------------------- no

"gcc -o conftest -I/Users/<username>/.rvm/rubies/ruby-2.6.5/include/ruby-2.6.0/-darwin20 -I/Users/<username>/.rvm/rubies/ruby-2.6.5/include/ruby-2.6.0/ruby/backward -I/Users/<username>/.rvm/rubies/ruby-2.6.5/include/ruby-2.6.0 -I. -I/opt/local/include -I/usr/local/include -I/usr/include  -I/opt/homebrew/opt/libyaml/include -I/opt/homebrew/opt/libksba/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/zlib/include -I/opt/homebrew/opt/openssl@1.1/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -Wno-error=implicit-function-declaration -ggdb3 -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens  -fno-common -pipe conftest.c  -L. -L/Users/<username>/.rvm/rubies/ruby-2.6.5/lib -L/opt/local/lib -L/usr/local/lib -L/usr/lib -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openssl@1.1/lib -L. -fstack-protector-strong -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openssl@1.1/lib     -lruby.2.6 -lmagic   "
conftest.c:14:57: error: use of undeclared identifier 'magic_open'
int t(void) { void ((*volatile p)()); p = (void ((*)()))magic_open; return !p; }
                                                        ^
1 error generated.
checked program was:
/* begin */
 1: #include "ruby.h"
 2:
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7:   if (argc > 1000000) {
 8:     int (* volatile tp)(void)=(int (*)(void))&t;
 9:     printf("%d", (*tp)());
10:   }
11:
12:   return 0;
13: }
14: int t(void) { void ((*volatile p)()); p = (void ((*)()))magic_open; return !p; }
/* end */

"gcc -o conftest -I/Users/<username>/.rvm/rubies/ruby-2.6.5/include/ruby-2.6.0/-darwin20 -I/Users/<username>/.rvm/rubies/ruby-2.6.5/include/ruby-2.6.0/ruby/backward -I/Users/<username>/.rvm/rubies/ruby-2.6.5/include/ruby-2.6.0 -I. -I/opt/local/include -I/usr/local/include -I/usr/include  -I/opt/homebrew/opt/libyaml/include -I/opt/homebrew/opt/libksba/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/zlib/include -I/opt/homebrew/opt/openssl@1.1/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -Wno-error=implicit-function-declaration -ggdb3 -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens  -fno-common -pipe conftest.c  -L. -L/Users/<username>/.rvm/rubies/ruby-2.6.5/lib -L/opt/local/lib -L/usr/local/lib -L/usr/lib -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openssl@1.1/lib -L. -fstack-protector-strong -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openssl@1.1/lib     -lruby.2.6 -lmagic   "
ld: warning: directory not found for option '-L/opt/local/lib'
ld: warning: directory not found for option '-L/usr/local/opt/openssl/lib/'
ld: library not found for -lmagic
clang: error: linker command failed with exit code 1 (use -v to see invocation)
checked program was:
/* begin */
 1: #include "ruby.h"
 2:
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7:   if (argc > 1000000) {
 8:     int (* volatile tp)(void)=(int (*)(void))&t;
 9:     printf("%d", (*tp)());
10:   }
11:
12:   return 0;
13: }
14: extern void magic_open();
15: int t(void) { magic_open(); return 0; }
/* end */

--------------------

can somebody help me, I got stuck on this ...
*notes ---
as information i use rbenv before , is it possible that it causes conflict or something ? now i use rmv


问:
Import multi-nested subfolders in python neatly
I have the following directory structure:

.
├── main.py
└── subfolder1
    ├── file1.py # def hello(): print("hello")
    ├── __init__.py
    └── subfolder2
        ├── file2.py # def world(): print("world")
        └── __init__.py
```
<p>I'm trying to be to access functions from both <code>subfolder1/file.1py</code> and <code>subfolder/subfolder2/file2.py</code>.</p>
<p>I have an empty <code>__init__.py</code> in each nested folder as per the documentation I could find. I'm assuming that's necessary. (Update: I've just now removed the <code>__init__.py</code>'s from both subfolders and it still works. I thought having this was necessary?)</p>
<p>Contents of <code>main.py</code>:</p>
<pre class="lang-py prettyprint-override"><code>import subfolder1.file1
import subfolder1.subfolder2.file2

subfolder1.file1.hello()
subfolder1.subfolder2.file2.world()
</code>```

When I execute main.py, both functions are called correctly. But the syntax is more cumbersome than I'd like, I don't want to have to repeatedly specify directory paths in subsequent imports.

I've tried doing something like

import subfolder1 as sub1
import sub1.subfolder2 as sub2

sub1.file1.hello()
sub2.file2.world()
```
<p>But my IDE's Pylance alerts me that <code>Import "sub1.subfolder2" could not be resolved</code> and the terminal outputs on execution</p>
```Traceback (most recent call last):
  File "/home/me/project/main.py", line 2, in <module>
    import sub1.subfolder2 as sub2
ModuleNotFoundError: No module named 'sub1'
```

I've seen online the sys.append('/path/to/subfolder') method, but I don't like having to take up a line of code before every multi-nested import. It defeats the purpose, as my goal is to avoid repeatedly typing out paths, whether in the import statement or a sys.append() method.

Are there any ways to do multi-level modularization more elgantly/succintly in Python?

答:
Nice Minimal Reproducible Example !

About __init__.py files, see this question, but the gist is :

They were required in Python2 and Python3.3 to indicate that a directory is a python package (from which you can import), but it is now optional (Python >= 3.4).

It defines what ends up in your module subfolder1 when you do import subfolder1.

See the Python language reference about packages.

Given your initial architecture, you can see what does your sub1 module contains/defines using dir :

# file: main.py
import subfolder1 as sub1
print(dir(sub1))
# ['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__']
```
<p>As all of these are <strong>dunder methods</strong> related to the Python import machinery, it should not come as a surprise that <code>sub1.subfolder2</code> fails : there is actually no <code>subfolder2</code> in <code>sub1</code>.</p>
<p>Contrast with this example :</p>
<pre class="lang-py prettyprint-override"><code>import logging
print(dir(logging))
# logging stuff :
#   [..., 'CRITICAL', 'DEBUG', 'ERROR', 'FATAL', 'Logger', 'getLogger', ...
# regular module/package/import stuff :
#    '__all__', '__author__', '__builtins__', '__cached__', '__date__', '__doc__', '__file__', '__loader__', '__name__',
#    '__package__', '__path__', '__spec__', '__status__', '__version__', ...
# and names of other modules :
#    'os', 're', ..., 'sys', 'threading', 'time', ...]

# which means I can do :
print(logging.DEBUG)
# 10
print(logging.__author__)
# Vinay Sajip <vinay_sajip@red-dove.com>
print(logging.sys.version)
# 3.9.10 (main, Jan 15 2022, 18:17:56)
# [GCC 9.3.0]
import sys
print(sys.version)
# 3.9.10 (main, Jan 15 2022, 18:17:56)
# [GCC 9.3.0]
print(logging.sys is sys)
# True
</code>```

If you take a look at the implementation for your (C)Python library sys, for example using your IDE's "go-to-definition" you will get an __init__.py file (mine is /usr/lib/python3.9/logging/__init__.py). And it defines exactly what dir listed to me.

(I chose logging because it is implemented in pure Python, while other libraries may not)

Your __init__.py file defines what will be in subfolder1 when you do just import subfolder1.

How to control what ends up in your library ?

import logging
from logging import *
print(DEBUG)  # 10
print(sys.version)  # NameError: name 'sys' is not defined
```
<p>because</p>
```import logging
print("DEBUG" in logging.__all__)  # True
print("sys" in logging.__all__)  # False
```
<p>Citing this answer about <code>__all__</code> :</p>
<blockquote>
<p>It's a list of public objects of that module, as interpreted by import *. It overrides the default of hiding everything that begins with an underscore.</p>
</blockquote>
<p>Now, to answer your question "how to import neatly" :</p>
<pre class="lang-py prettyprint-override"><code># file: subfolder1/__init__.py
from . import file1
</code>```

# file: subfolder1/subfolder2/__init__.py
from . import file2
```
<pre class="lang-py prettyprint-override"><code># file: main.py
import subfolder1 as sub1
import subfolder1.subfolder2 as sub2
sub1.file1.hello()
sub2.file2.world()
</code>```

You can't import sub1.subfolder2 because Python won't find a sub1 package (unless by messing with loaders).

But you can import subfolder1.subfolder2 because there exist a directory subfolder1/subfolder2.

What you could also do is :

# file: subfolder1/__init__.py
from . import subfolder2
from . import file1
```
<pre class="lang-py prettyprint-override"><code># file: main.py
import subfolder1 as sub1
sub1.file1.hello()
sub1.subfolder2.file2.world()
</code>```

or else :

# file: subfolder1/__init__.py
from . import subfolder2 as sub2
from . import file1
```
<pre class="lang-py prettyprint-override"><code># file: main.py
import subfolder1 as sub1
sub1.file1.hello()
sub1.sub2.file2.world()
</code>```

Body:
I have the following directory structure:

.
├── main.py
└── subfolder1
    ├── file1.py # def hello(): print("hello")
    ├── __init__.py
    └── subfolder2
        ├── file2.py # def world(): print("world")
        └── __init__.py

I'm trying to be to access functions from both subfolder1/file.1py and subfolder/subfolder2/file2.py.

I have an empty __init__.py in each nested folder as per the documentation I could find. I'm assuming that's necessary. (Update: I've just now removed the __init__.py's from both subfolders and it still works. I thought having this was necessary?)

Contents of main.py:

import subfolder1.file1
import subfolder1.subfolder2.file2

subfolder1.file1.hello()
subfolder1.subfolder2.file2.world()

When I execute main.py, both functions are called correctly. But the syntax is more cumbersome than I'd like, I don't want to have to repeatedly specify directory paths in subsequent imports.

I've tried doing something like

import subfolder1 as sub1
import sub1.subfolder2 as sub2

sub1.file1.hello()
sub2.file2.world()

But my IDE's Pylance alerts me that Import "sub1.subfolder2" could not be resolved and the terminal outputs on execution

Traceback (most recent call last):
  File "/home/me/project/main.py", line 2, in <module>
    import sub1.subfolder2 as sub2
ModuleNotFoundError: No module named 'sub1'

I've seen online the sys.append('/path/to/subfolder') method, but I don't like having to take up a line of code before every multi-nested import. It defeats the purpose, as my goal is to avoid repeatedly typing out paths, whether in the import statement or a sys.append() method.

Are there any ways to do multi-level modularization more elgantly/succintly in Python?

Body:
Nice Minimal Reproducible Example !

About __init__.py files, see this question, but the gist is :

They were required in Python2 and Python3.3 to indicate that a directory is a python package (from which you can import), but it is now optional (Python >= 3.4).

It defines what ends up in your module subfolder1 when you do import subfolder1.

See the Python language reference about packages.

Given your initial architecture, you can see what does your sub1 module contains/defines using dir :

# file: main.py
import subfolder1 as sub1
print(dir(sub1))
# ['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__']

As all of these are dunder methods related to the Python import machinery, it should not come as a surprise that sub1.subfolder2 fails : there is actually no subfolder2 in sub1.

Contrast with this example :

import logging
print(dir(logging))
# logging stuff :
#   [..., 'CRITICAL', 'DEBUG', 'ERROR', 'FATAL', 'Logger', 'getLogger', ...
# regular module/package/import stuff :
#    '__all__', '__author__', '__builtins__', '__cached__', '__date__', '__doc__', '__file__', '__loader__', '__name__',
#    '__package__', '__path__', '__spec__', '__status__', '__version__', ...
# and names of other modules :
#    'os', 're', ..., 'sys', 'threading', 'time', ...]

# which means I can do :
print(logging.DEBUG)
# 10
print(logging.__author__)
# Vinay Sajip <vinay_sajip@red-dove.com>
print(logging.sys.version)
# 3.9.10 (main, Jan 15 2022, 18:17:56)
# [GCC 9.3.0]
import sys
print(sys.version)
# 3.9.10 (main, Jan 15 2022, 18:17:56)
# [GCC 9.3.0]
print(logging.sys is sys)
# True

If you take a look at the implementation for your (C)Python library sys, for example using your IDE's "go-to-definition" you will get an __init__.py file (mine is /usr/lib/python3.9/logging/__init__.py). And it defines exactly what dir listed to me.

(I chose logging because it is implemented in pure Python, while other libraries may not)

Your __init__.py file defines what will be in subfolder1 when you do just import subfolder1.

How to control what ends up in your library ?

import logging
from logging import *
print(DEBUG)  # 10
print(sys.version)  # NameError: name 'sys' is not defined

because

import logging
print("DEBUG" in logging.__all__)  # True
print("sys" in logging.__all__)  # False

Citing this answer about __all__ :

It's a list of public objects of that module, as interpreted by import *. It overrides the default of hiding everything that begins with an underscore.

Now, to answer your question "how to import neatly" :

# file: subfolder1/__init__.py
from . import file1

# file: subfolder1/subfolder2/__init__.py
from . import file2

# file: main.py
import subfolder1 as sub1
import subfolder1.subfolder2 as sub2
sub1.file1.hello()
sub2.file2.world()

You can't import sub1.subfolder2 because Python won't find a sub1 package (unless by messing with loaders).

But you can import subfolder1.subfolder2 because there exist a directory subfolder1/subfolder2.

What you could also do is :

# file: subfolder1/__init__.py
from . import subfolder2
from . import file1

# file: main.py
import subfolder1 as sub1
sub1.file1.hello()
sub1.subfolder2.file2.world()

or else :

# file: subfolder1/__init__.py
from . import subfolder2 as sub2
from . import file1

# file: main.py
import subfolder1 as sub1
sub1.file1.hello()
sub1.sub2.file2.world()


问:
'globalThis' underfined for Jest test cases
I am using globalThis property specifically globalThis.scrollTo(0,0) in my React WebApp.

I am using Jest for unit testing alongwith Enzyme.

As of test cases fail as it is unable to identify globalThis and says that 'globalThis' is undefined.

Is there a way to introduce globalThis into the tests just like jsdom does for window etc ?

For Example

-- abc.tsx --

```<code>const abc: React.FC<CustomProps> = props => {
useEffect(() => {
globalThis?.scrollTo(0,0);
}
}
</code>```

-- abcTest.tsx --

```<code>wrapper = mount(<abc/>);
</code>```

mount produces error that "globalThis" is undefined

答:
You can add these code to the top

!function(t){function e(){var e=this||self;e.globalThis=e,delete t.prototype._T_}"object"!=typeof globalThis&&(this?e():(t.defineProperty(t.prototype,"_T_",{configurable:!0,get:e}),_T_))}(Object);
```

More details

Body:
I am using globalThis property specifically globalThis.scrollTo(0,0) in my React WebApp.

I am using Jest for unit testing alongwith Enzyme.

As of test cases fail as it is unable to identify globalThis and says that 'globalThis' is undefined.

Is there a way to introduce globalThis into the tests just like jsdom does for window etc ?

For Example

-- abc.tsx --

const abc: React.FC<CustomProps> = props => {
useEffect(() => {
globalThis?.scrollTo(0,0);
}
}

-- abcTest.tsx --

wrapper = mount(<abc/>);

mount produces error that "globalThis" is undefined

Body:
You can add these code to the top

!function(t){function e(){var e=this||self;e.globalThis=e,delete t.prototype._T_}"object"!=typeof globalThis&&(this?e():(t.defineProperty(t.prototype,"_T_",{configurable:!0,get:e}),_T_))}(Object);

More details


问:
module 'tensorboard.summary._tf.summary' has no attribute 'FileWriter'
Why is tensor flow throwing me this exception " module 'tensorboard.summary._tf.summary' has no attribute 'FileWriter'" each time i try to run my MCP Neuron, How can i go about solving the issue at hand ? I have search on stack but couldn't find any solution that fit my problem. can anyone help me out.</p>
```<code># McCulloch Pitt Neuron built with Tensorflow and represented with
# Tensorboard

import tensorflow as tf
import numpy as np
import os

PATH = os.getcwd()

LOG_DIR = PATH+ '/output/'
tf.compat.v1.disable_eager_execution()

# 1.Configuration to optimize CPU performance by defining
#   thread pools. For this example 4 is enough. A variable
#   replace the constant
config = tf.compat.v1.ConfigProto(
    inter_op_parallelism_threads=4,
    intra_op_parallelism_threads=4
)

# 2.Defining the x values, their w weights,the b bias,y weight calculation
#   and the s sigmoid activation function

x = tf.compat.v1.placeholder(tf.float32, shape=(1, 5), name='x')
w = tf.compat.v1.placeholder(tf.float32, shape=(5, 1), name='w')
b = tf.compat.v1.placeholder(tf.float32, shape=(1), name='b')
y = tf.matmul(x, w) + b
s = tf.nn.sigmoid(y)

# 3.Starting a session providing constants as weight inputs
#   The Perceptron,a neuron that can learn its weights, will provide  with our present day
#   automatic weight calculations
with tf.compat.v1.Session(config=config) as tfs:
    tfs.run(tf.compat.v1.global_variables_initializer())

    w_t = [[.1, .7, .75, .60, .20]]
    x_1 = [[10, 2, 1., 6., 2.]]
    b_1 = [1]
    w_1 = np.transpose(w_t)

    value = tfs.run(s,
        feed_dict={
            x: x_1,
            w: w_1,
            b: b_1
        }
    )

print ('value for threshold calculation',value)
print ('Availability of lx',1-value)

#___________Tensorboard________________________

#with tf.Session() as sess:

Writer = tf.summary.FileWriter(LOG_DIR, tfs.graph)
Writer.close()

def launchTensorBoard():
    import os
    os.system('tensorboard --logdir='+LOG_DIR)
    return

import threading
t = threading.Thread(target=launchTensorBoard, args=([]))
t.start()

tfs.close()

</code>```

答:
Try using either:

Writer = tf.summary.create_file_writer(LOG_DIR)
```
<p>Or this if you want to also pass a graph:</p>
<pre class="lang-py prettyprint-override"><code>Writer = tf.compat.v1.summary.FileWriter(LOG_DIR, tfs.graph)
</code>```

See the docs for more information.

Body:
Why is tensor flow throwing me this exception " module 'tensorboard.summary._tf.summary' has no attribute 'FileWriter'" each time i try to run my MCP Neuron, How can i go about solving the issue at hand ? I have search on stack but couldn't find any solution that fit my problem. can anyone help me out.

# McCulloch Pitt Neuron built with Tensorflow and represented with
# Tensorboard

import tensorflow as tf
import numpy as np
import os

PATH = os.getcwd()

LOG_DIR = PATH+ '/output/'
tf.compat.v1.disable_eager_execution()

# 1.Configuration to optimize CPU performance by defining
#   thread pools. For this example 4 is enough. A variable
#   replace the constant
config = tf.compat.v1.ConfigProto(
    inter_op_parallelism_threads=4,
    intra_op_parallelism_threads=4
)

# 2.Defining the x values, their w weights,the b bias,y weight calculation
#   and the s sigmoid activation function

x = tf.compat.v1.placeholder(tf.float32, shape=(1, 5), name='x')
w = tf.compat.v1.placeholder(tf.float32, shape=(5, 1), name='w')
b = tf.compat.v1.placeholder(tf.float32, shape=(1), name='b')
y = tf.matmul(x, w) + b
s = tf.nn.sigmoid(y)

# 3.Starting a session providing constants as weight inputs
#   The Perceptron,a neuron that can learn its weights, will provide  with our present day
#   automatic weight calculations
with tf.compat.v1.Session(config=config) as tfs:
    tfs.run(tf.compat.v1.global_variables_initializer())

    w_t = [[.1, .7, .75, .60, .20]]
    x_1 = [[10, 2, 1., 6., 2.]]
    b_1 = [1]
    w_1 = np.transpose(w_t)

    value = tfs.run(s,
        feed_dict={
            x: x_1,
            w: w_1,
            b: b_1
        }
    )

print ('value for threshold calculation',value)
print ('Availability of lx',1-value)

#___________Tensorboard________________________

#with tf.Session() as sess:

Writer = tf.summary.FileWriter(LOG_DIR, tfs.graph)
Writer.close()

def launchTensorBoard():
    import os
    os.system('tensorboard --logdir='+LOG_DIR)
    return

import threading
t = threading.Thread(target=launchTensorBoard, args=([]))
t.start()

tfs.close()

Body:
Try using either:

Writer = tf.summary.create_file_writer(LOG_DIR)

Or this if you want to also pass a graph:

Writer = tf.compat.v1.summary.FileWriter(LOG_DIR, tfs.graph)

See the docs for more information.


问:
Play video when mouse hovers trigger object
I'm designing a page where i want the video for each post to play when the user hovers the post. I've set it up like this:

```<code><div class="project-link-block">
<div class="video-cover">
<video class="playonhover"height="100%" width="100%" muted playsinline loop data-object-fit="cover">

<source src="https://player.vimeo.com/progressive_redirect/playback/671122426/rendition/720p?loc=external&signature=e1562e4b2a73a9f37492359547fef09f8a3ed47a9d12fd77089930fc656a7d8e" type="video/mp4">
Your browser doesn't support HTML5 video tag.
</video>

</div>
</div>
</code>```
```<code><script>
$(document).ready(function() {
  $(".playonhover").on("mouseover", function(event) {
    this.play();

  }).on('mouseout', function(event) {
    this.pause();

  });
})
</script>
</code>```

This works, but I actually want the video to play when the top div (class .project-link-block) is hovered, not the video itself. Is there any way to do this? Switching the class in the JS didn't work. Using Webflow for this, in case it's relevant.

答:
Did you also change this when you switched the class? Once you switch the class, the video element is no longer this.

```<code><head>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
</head>
<div class="project-link-block">
  <div class="video-cover">
    <video class="playonhover" height="100%" width="100%" muted playsinline loop data-object-fit="cover">
      <source
        src="https://player.vimeo.com/progressive_redirect/playback/671122426/rendition/720p?loc=external&signature=e1562e4b2a73a9f37492359547fef09f8a3ed47a9d12fd77089930fc656a7d8e"
        type="video/mp4">
      Your browser doesn't support HTML5 video tag.
    </video>
  </div>
</div>
<script>
  $(document).ready(function () {
    $(".video-cover").on("mouseover", function (event) {
      $(".playonhover").get(0).play();
    }).on('mouseout', function (event) {
      $(".playonhover").get(0).pause();
    });
  })
</script>
</code>```

Body:
I'm designing a page where i want the video for each post to play when the user hovers the post. I've set it up like this:

<video class="playonhover"height="100%" width="100%" muted playsinline loop data-object-fit="cover">

<source src="https://player.vimeo.com/progressive_redirect/playback/671122426/rendition/720p?loc=external&signature=e1562e4b2a73a9f37492359547fef09f8a3ed47a9d12fd77089930fc656a7d8e" type="video/mp4">
Your browser doesn't support HTML5 video tag.
</video>

This works, but I actually want the video to play when the top div (class .project-link-block) is hovered, not the video itself. Is there any way to do this? Switching the class in the JS didn't work. Using Webflow for this, in case it's relevant.

Body:
Did you also change this when you switched the class? Once you switch the class, the video element is no longer this.

<head>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
</head>
<div class="project-link-block">
  <div class="video-cover">
    <video class="playonhover" height="100%" width="100%" muted playsinline loop data-object-fit="cover">
      <source
        src="https://player.vimeo.com/progressive_redirect/playback/671122426/rendition/720p?loc=external&signature=e1562e4b2a73a9f37492359547fef09f8a3ed47a9d12fd77089930fc656a7d8e"
        type="video/mp4">
      Your browser doesn't support HTML5 video tag.
    </video>
  </div>
</div>
<script>
  $(document).ready(function () {
    $(".video-cover").on("mouseover", function (event) {
      $(".playonhover").get(0).play();
    }).on('mouseout', function (event) {
      $(".playonhover").get(0).pause();
    });
  })
</script>


问:
UIActivityViewController Change Navigation Bar text color
I am creating a UIActivityViewController and trying to change its text color after tapping the share messages icon.

By default, I set my navigation bar text colors to white in the AppDelegate like so

```<code>UINavigationBar.appearance().tintColor = whiteColor
UIBarButtonItem.appearance().tintColor = whiteColor
</code>```

However for just the UIActivityViewController I want to make it the default (i.e. black title text, and the blue Cancel button)

I have tried the following to no luck:

```<code>let shareText = "text to share"
let activityViewController = UIActivityViewController(activityItems: [shareText], applicationActivities: [])

activityViewController.navigationController?.navigationBar.tintColor = UIColor.black
activityViewController.navigationController?.navigationItem.rightBarButtonItem?.tintColor = UIColor.blue

present(activityViewController, animated: true, completion: nil)
</code>```

The result is still the same with white text:

If you look closely in the image, the navigation bar has white text in the title and right bar button items.

答:
I have tried all above code but it was breaking while cancel and open action sheet again. So I come up with below solution, hope it works for other too</p>
```<code>UIButton.appearance(whenContainedInInstancesOf: [UINavigationBar.self]).tintColor = .systemBlue
UIBarButtonItem.appearance(whenContainedInInstancesOf: [UINavigationBar.self]).tintColor = .systemBlue
UIBarButtonItem.appearance().setTitleTextAttributes([.foregroundColor: UIColor.systemBlue], for: .normal)
activityVC.completionWithItemsHandler = { (activityType, completed: Bool, _: [Any]?, _: Error?) in
    if activityType == nil || completed {
        UIButton.appearance(whenContainedInInstancesOf: [UINavigationBar.self]).tintColor = .white
        UIBarButtonItem.appearance(whenContainedInInstancesOf: [UINavigationBar.self]).tintColor = .white
        UIBarButtonItem.appearance().setTitleTextAttributes([.foregroundColor: UIColor.white], for: .normal)
    }
}
</code>```

Body:
I am creating a UIActivityViewController and trying to change its text color after tapping the share messages icon.

By default, I set my navigation bar text colors to white in the AppDelegate like so

UINavigationBar.appearance().tintColor = whiteColor
UIBarButtonItem.appearance().tintColor = whiteColor

However for just the UIActivityViewController I want to make it the default (i.e. black title text, and the blue Cancel button)

I have tried the following to no luck:

let shareText = "text to share"
let activityViewController = UIActivityViewController(activityItems: [shareText], applicationActivities: [])

activityViewController.navigationController?.navigationBar.tintColor = UIColor.black
activityViewController.navigationController?.navigationItem.rightBarButtonItem?.tintColor = UIColor.blue

present(activityViewController, animated: true, completion: nil)

The result is still the same with white text:

If you look closely in the image, the navigation bar has white text in the title and right bar button items.

Body:
I have tried all above code but it was breaking while cancel and open action sheet again. So I come up with below solution, hope it works for other too

UIButton.appearance(whenContainedInInstancesOf: [UINavigationBar.self]).tintColor = .systemBlue
UIBarButtonItem.appearance(whenContainedInInstancesOf: [UINavigationBar.self]).tintColor = .systemBlue
UIBarButtonItem.appearance().setTitleTextAttributes([.foregroundColor: UIColor.systemBlue], for: .normal)
activityVC.completionWithItemsHandler = { (activityType, completed: Bool, _: [Any]?, _: Error?) in
    if activityType == nil || completed {
        UIButton.appearance(whenContainedInInstancesOf: [UINavigationBar.self]).tintColor = .white
        UIBarButtonItem.appearance(whenContainedInInstancesOf: [UINavigationBar.self]).tintColor = .white
        UIBarButtonItem.appearance().setTitleTextAttributes([.foregroundColor: UIColor.white], for: .normal)
    }
}


问:
How to compile and link callback class (for ROS messages)
Essentially I have defined a class to handle my callbacks, with the declarations and definitions split between a header and source file. However I am having troubles compiling a file which then uses said callback (despite me attempted to link the object file of the callback), specifically I get a linker error:

```<code>[ 98%] Linking CXX executable /home/salih/documents/university/3/6001/code/devel/lib/sdr_ros/sdr_ros
/usr/bin/ld: CMakeFiles/sdr_ros.dir/src/sdr_ros.cpp.o: in function `main':
sdr_ros.cpp:(.text+0x41e): undefined reference to `sdr_ros::TravelInfoCallback::callback(boost::shared_ptr<sdr_ros::TravelInfo_<std::allocator<void> > const> const&)'
collect2: error: ld returned 1 exit status
</code>```

Package is called sdr_ros & the message it's dealing with is called TravelInfo which is stored in the msg directory.

include/travel_info_callback.hpp (Header file):

```<code>#ifndef TRAVEL_INFO_CALLBACK_HPP
#define TRAVEL_INFO_CALLBACK_HPP
#pragma once

#include <tuple>

#include "sdr_ros/TravelInfo.h" // message itself

/**
  * @brief This file contains declarations for callback functionality which processes TravelInfo ROS message
  */

namespace sdr_ros {

    class TravelInfoCallback {
        /**
          * @brief TravelInfoCallback - class to store values returned by callback pertaining to distance / angles changes
          */
        private:
            float _delta_x, _delta_y, _delta_z ;

            float _yaw, _pitch, _roll ;

        public:
            /**
              * @brief TravelInfoCallback - constructor initialises class values
              */
            TravelInfoCallback() noexcept ;

            /**
              * @brief distance - method returning tuple of distance travelled along x, y, z
              * @return std::tuple<float, float, float> - value pertaining to distance travelled along x, y, z axis
              */
            ::std::tuple<float, float, float> distance() const noexcept ;

            /**
              * @brief heading - method returning tuple of euler angles yaw, pitch, roll
              * @return std::tuple<float, float, float> - value pertaining to distance travelled around the (yaw) z, (pitch) y, (roll) x axis
              */
            ::std::tuple<float, float, float> heading() const noexcept ;

            /**
              * @brief callback - method extracting distance travelled and heading angle from ROS message
              * @param const sdr_ros::TravelInfoConstPtr& - const reference to boost shared pointer to ROS message storing distance travelled and heading angle
              */
            void callback(const TravelInfoConstPtr&) noexcept ;

            // below are defaulted and deleted methods
            TravelInfoCallback(const TravelInfoCallback&) = delete ;
            TravelInfoCallback& operator=(const TravelInfoCallback&) = delete ;
            TravelInfoCallback(TravelInfoCallback&&) = delete ;
            TravelInfoCallback&& operator=(TravelInfoCallback&&) = delete ;
            ~TravelInfoCallback() noexcept = default ;
    } ;

}

#endif // TRAVEL_INFO_HPP
</code>```

src/travel_info.cpp

```<code>#include <tuple>

#include "sdr_ros/TravelInfo.h" // message itself

#include "travel_info_callback.hpp"

/**
  * @brief This file contains defintions for callback functionality which processes travel_info ROS message
  */

sdr_ros::TravelInfoCallback::TravelInfoCallback() noexcept : _delta_x(0.f), _delta_y(0.f), _delta_z(0.f), _yaw(0.f), _pitch(0.f), _roll(0.f) {} ;

std::tuple<float, float, float> sdr_ros::TravelInfoCallback::distance() const noexcept
{
    return std::tuple<float, float, float>{
        this->_delta_x, this->_delta_y, this->_delta_z
    } ;
}

std::tuple<float, float, float> sdr_ros::TravelInfoCallback::heading() const noexcept
{
    return std::tuple<float, float, float>{
        this->_yaw, this->_pitch, this->_roll
    } ;
}

inline void sdr_ros::TravelInfoCallback::callback(const sdr_ros::TravelInfoConstPtr& travel_info) noexcept
{
    this->_delta_x = travel_info->delta_x ;
    this->_delta_y = travel_info->delta_y ;
    this->_delta_z = travel_info->delta_z ;
    this->_yaw = travel_info->yaw ;
    this->_pitch = travel_info->pitch ;
    this->_roll = travel_info->roll ;
}
</code>```

src/sdr_ros (source code using callback)

```<code>#include <ros/ros.h>
#include <ros/console.h>
#include <ros/callback_queue.h>

#include <string>
#include <cmath>

#include <geometry_msgs/Pose.h>

#include "sdr_ros/TravelInfo.h"

#include "preprocessing.hpp"
#include "pose.hpp"
#include "travel_info_callback.hpp"

/**
  * @brief This file serves as the ROS node which reads from the network and calls relevant functionality to calculate and distribute pose information
  */

int main(int argc, char** argv)
{
    /* Initialisation */
    const std::string node_name = "sdr_ros" ;
    ros::init(argc, argv, node_name); ROS_INFO_STREAM(node_name << " running") ; // initialise ROS node
    ros::NodeHandle nh("~") ; // handle to ROS communications (topics, services)

    sdr::Pose pose ;
    std::string initial_pose_file ;
    if(nh.getParam("initial_pose_file", initial_pose_file))
    {
        pose = sdr::extract_initial_pose(initial_pose_file) ;
    }

    sdr_ros::TravelInfoCallback cb ; // callback object with methods
    ros::Subscriber sub = nh.subscribe<sdr_ros::TravelInfo>("/travel_info", 100, &sdr_ros::TravelInfoCallback::callback, &cb) ; // subscribe to topic distance_info

    geometry_msgs::Pose pose_msg ;
    ros::Publisher pub = nh.advertise<geometry_msgs::Pose>("/odometry", 1) ; // publishes information about where car as XYZ, orientation as quaternion

    /* Main functionality */
    while(ros::ok()) // while ROS is running - the actual useful computation
    {
        /* Get info */
        if(ros::getGlobalCallbackQueue()->callOne() == ros::CallbackQueue::CallOneResult::Empty) continue ;
        // ^ we can't simply use `ros::spinOnce` as there's no indication of an empty queue, meaning we'd be processing the same message multiple times, exponentially increasing predicted distance.

        const auto [delta_x, delta_y, delta_z] = cb.distance() ;
        if(!delta_x && !delta_y && !delta_z)
        {
            continue ; // no point processing odom when we haven't moved
        }
        const auto [yaw, pitch, roll] = cb.heading() ;

        pose.update_position(delta_x, delta_y, delta_z) ;
        pose.update_orientation(yaw, pitch, roll) ;

        pose_msg.position.x = pose.position()(0,0) ;
        pose_msg.position.y = pose.position()(0,1) ;
        pose_msg.position.z = pose.position()(0,2) ;
        pose_msg.orientation.x = pose.orientation().x() ;
        pose_msg.orientation.y = pose.orientation().y() ;
        pose_msg.orientation.z = pose.orientation().z() ;
        pose_msg.orientation.w = pose.orientation().w() ;

        ROS_INFO_STREAM("Current position: " << pose_msg.position) ;
        ROS_INFO_STREAM("Current orientation: " << pose_msg.orientation << '\n') ;

        /* Publish odometry */
        pub.publish(pose_msg) ;
    }

    /* E(nd) O(f) P(rogram) */
    return 0 ;
}
</code>```

CMakeLists.txt:

```<code>cmake_minimum_required(VERSION 3.2)
project(sdr_ros)

## Compile as C++20, supported in ROS Kinetic and newer
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CXX_FLAGS "-Wall -Wextra")
set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_RELEASE "-O0")

find_package(Eigen3 REQUIRED)

################################################
##    Find catkin macros and libraries        ##
################################################
find_package(catkin REQUIRED COMPONENTS
    roscpp
    rospy
    std_msgs
    tf
    nav_msgs
    genmsg
    message_generation
)

## System dependencies are found with CMake's conventions
# find_package(Boost REQUIRED COMPONENTS system)

################################################
## Declare ROS messages, services and actions ##
################################################

## Generate messages in the 'msg' folder
add_message_files(
    DIRECTORY
        msg
    FILES
        TravelInfo.msg
)

## Generate services in the 'srv' folder
#add_service_files(
#    FILES
#)

## Generate added messages and services with any dependencies listed here
generate_messages(
    DEPENDENCIES
        std_msgs
        geometry_msgs
)

###################################
## catkin specific configuration ##
###################################
## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if your package contains header files
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
#    INCLUDE_DIRS
#        include
#        ${EIGEN3_INCLUDE_DIR}
#        libraries/sdr/include/
    CATKIN_DEPENDS
        message_runtime
)

###########
## Build ##
###########

add_subdirectory(libraries/sdr)

## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
    include
    libraries/sdr/include/
    ${EIGEN3_INCLUDE_DIR}
    ${catkin_INCLUDE_DIRS}
)

## Declare a C++ executable
add_library(travel_info_callback ${CMAKE_CURRENT_SOURCE_DIR}/src/travel_info_callback.cpp)
target_include_directories(travel_info_callback PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_link_libraries(travel_info_callback ${catkin_LIBRARIES})
add_dependencies(travel_info_callback sdr_ros_generate_messages_cpp)

add_executable(sdr_ros src/sdr_ros.cpp)
target_link_libraries(sdr_ros ${catkin_LIBRARIES} travel_info_callback detailed_exception.o preprocessing.o pose.o yaml-cpp)
add_dependencies(sdr_ros sdr_ros_generate_messages_cpp)
</code>```

I hope I've given enough information and that someone can help. Much appreciated

答:
```<code>**inline** void sdr_ros::TravelInfoCallback::callback(const sdr_ros::TravelInfoConstPtr& travel_info) noexcept
</code>```

I accidentally left the inline keyword within the function header. Removing it allowed for a proper function declaration which resolved all my issues

Body:
Essentially I have defined a class to handle my callbacks, with the declarations and definitions split between a header and source file. However I am having troubles compiling a file which then uses said callback (despite me attempted to link the object file of the callback), specifically I get a linker error:

[ 98%] Linking CXX executable /home/salih/documents/university/3/6001/code/devel/lib/sdr_ros/sdr_ros
/usr/bin/ld: CMakeFiles/sdr_ros.dir/src/sdr_ros.cpp.o: in function `main':
sdr_ros.cpp:(.text+0x41e): undefined reference to `sdr_ros::TravelInfoCallback::callback(boost::shared_ptr<sdr_ros::TravelInfo_<std::allocator<void> > const> const&)'
collect2: error: ld returned 1 exit status

Package is called sdr_ros & the message it's dealing with is called TravelInfo which is stored in the msg directory.

include/travel_info_callback.hpp (Header file):

#ifndef TRAVEL_INFO_CALLBACK_HPP
#define TRAVEL_INFO_CALLBACK_HPP
#pragma once

#include <tuple>

#include "sdr_ros/TravelInfo.h" // message itself

/**
  * @brief This file contains declarations for callback functionality which processes TravelInfo ROS message
  */

namespace sdr_ros {

    class TravelInfoCallback {
        /**
          * @brief TravelInfoCallback - class to store values returned by callback pertaining to distance / angles changes
          */
        private:
            float _delta_x, _delta_y, _delta_z ;

            float _yaw, _pitch, _roll ;

        public:
            /**
              * @brief TravelInfoCallback - constructor initialises class values
              */
            TravelInfoCallback() noexcept ;

            /**
              * @brief distance - method returning tuple of distance travelled along x, y, z
              * @return std::tuple<float, float, float> - value pertaining to distance travelled along x, y, z axis
              */
            ::std::tuple<float, float, float> distance() const noexcept ;

            /**
              * @brief heading - method returning tuple of euler angles yaw, pitch, roll
              * @return std::tuple<float, float, float> - value pertaining to distance travelled around the (yaw) z, (pitch) y, (roll) x axis
              */
            ::std::tuple<float, float, float> heading() const noexcept ;

            /**
              * @brief callback - method extracting distance travelled and heading angle from ROS message
              * @param const sdr_ros::TravelInfoConstPtr& - const reference to boost shared pointer to ROS message storing distance travelled and heading angle
              */
            void callback(const TravelInfoConstPtr&) noexcept ;

            // below are defaulted and deleted methods
            TravelInfoCallback(const TravelInfoCallback&) = delete ;
            TravelInfoCallback& operator=(const TravelInfoCallback&) = delete ;
            TravelInfoCallback(TravelInfoCallback&&) = delete ;
            TravelInfoCallback&& operator=(TravelInfoCallback&&) = delete ;
            ~TravelInfoCallback() noexcept = default ;
    } ;

}

#endif // TRAVEL_INFO_HPP

src/travel_info.cpp

#include <tuple>

#include "sdr_ros/TravelInfo.h" // message itself

#include "travel_info_callback.hpp"

/**
  * @brief This file contains defintions for callback functionality which processes travel_info ROS message
  */

sdr_ros::TravelInfoCallback::TravelInfoCallback() noexcept : _delta_x(0.f), _delta_y(0.f), _delta_z(0.f), _yaw(0.f), _pitch(0.f), _roll(0.f) {} ;

std::tuple<float, float, float> sdr_ros::TravelInfoCallback::distance() const noexcept
{
    return std::tuple<float, float, float>{
        this->_delta_x, this->_delta_y, this->_delta_z
    } ;
}

std::tuple<float, float, float> sdr_ros::TravelInfoCallback::heading() const noexcept
{
    return std::tuple<float, float, float>{
        this->_yaw, this->_pitch, this->_roll
    } ;
}

inline void sdr_ros::TravelInfoCallback::callback(const sdr_ros::TravelInfoConstPtr& travel_info) noexcept
{
    this->_delta_x = travel_info->delta_x ;
    this->_delta_y = travel_info->delta_y ;
    this->_delta_z = travel_info->delta_z ;
    this->_yaw = travel_info->yaw ;
    this->_pitch = travel_info->pitch ;
    this->_roll = travel_info->roll ;
}

src/sdr_ros (source code using callback)

#include <ros/ros.h>
#include <ros/console.h>
#include <ros/callback_queue.h>

#include <string>
#include <cmath>

#include <geometry_msgs/Pose.h>

#include "sdr_ros/TravelInfo.h"

#include "preprocessing.hpp"
#include "pose.hpp"
#include "travel_info_callback.hpp"

/**
  * @brief This file serves as the ROS node which reads from the network and calls relevant functionality to calculate and distribute pose information
  */

int main(int argc, char** argv)
{
    /* Initialisation */
    const std::string node_name = "sdr_ros" ;
    ros::init(argc, argv, node_name); ROS_INFO_STREAM(node_name << " running") ; // initialise ROS node
    ros::NodeHandle nh("~") ; // handle to ROS communications (topics, services)

    sdr::Pose pose ;
    std::string initial_pose_file ;
    if(nh.getParam("initial_pose_file", initial_pose_file))
    {
        pose = sdr::extract_initial_pose(initial_pose_file) ;
    }

    sdr_ros::TravelInfoCallback cb ; // callback object with methods
    ros::Subscriber sub = nh.subscribe<sdr_ros::TravelInfo>("/travel_info", 100, &sdr_ros::TravelInfoCallback::callback, &cb) ; // subscribe to topic distance_info

    geometry_msgs::Pose pose_msg ;
    ros::Publisher pub = nh.advertise<geometry_msgs::Pose>("/odometry", 1) ; // publishes information about where car as XYZ, orientation as quaternion

    /* Main functionality */
    while(ros::ok()) // while ROS is running - the actual useful computation
    {
        /* Get info */
        if(ros::getGlobalCallbackQueue()->callOne() == ros::CallbackQueue::CallOneResult::Empty) continue ;
        // ^ we can't simply use `ros::spinOnce` as there's no indication of an empty queue, meaning we'd be processing the same message multiple times, exponentially increasing predicted distance.

        const auto [delta_x, delta_y, delta_z] = cb.distance() ;
        if(!delta_x && !delta_y && !delta_z)
        {
            continue ; // no point processing odom when we haven't moved
        }
        const auto [yaw, pitch, roll] = cb.heading() ;

        pose.update_position(delta_x, delta_y, delta_z) ;
        pose.update_orientation(yaw, pitch, roll) ;

        pose_msg.position.x = pose.position()(0,0) ;
        pose_msg.position.y = pose.position()(0,1) ;
        pose_msg.position.z = pose.position()(0,2) ;
        pose_msg.orientation.x = pose.orientation().x() ;
        pose_msg.orientation.y = pose.orientation().y() ;
        pose_msg.orientation.z = pose.orientation().z() ;
        pose_msg.orientation.w = pose.orientation().w() ;

        ROS_INFO_STREAM("Current position: " << pose_msg.position) ;
        ROS_INFO_STREAM("Current orientation: " << pose_msg.orientation << '\n') ;

        /* Publish odometry */
        pub.publish(pose_msg) ;
    }

    /* E(nd) O(f) P(rogram) */
    return 0 ;
}

CMakeLists.txt:

cmake_minimum_required(VERSION 3.2)
project(sdr_ros)

## Compile as C++20, supported in ROS Kinetic and newer
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CXX_FLAGS "-Wall -Wextra")
set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_RELEASE "-O0")

find_package(Eigen3 REQUIRED)

################################################
##    Find catkin macros and libraries        ##
################################################
find_package(catkin REQUIRED COMPONENTS
    roscpp
    rospy
    std_msgs
    tf
    nav_msgs
    genmsg
    message_generation
)

## System dependencies are found with CMake's conventions
# find_package(Boost REQUIRED COMPONENTS system)

################################################
## Declare ROS messages, services and actions ##
################################################

## Generate messages in the 'msg' folder
add_message_files(
    DIRECTORY
        msg
    FILES
        TravelInfo.msg
)

## Generate services in the 'srv' folder
#add_service_files(
#    FILES
#)

## Generate added messages and services with any dependencies listed here
generate_messages(
    DEPENDENCIES
        std_msgs
        geometry_msgs
)

###################################
## catkin specific configuration ##
###################################
## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if your package contains header files
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
#    INCLUDE_DIRS
#        include
#        ${EIGEN3_INCLUDE_DIR}
#        libraries/sdr/include/
    CATKIN_DEPENDS
        message_runtime
)

###########
## Build ##
###########

add_subdirectory(libraries/sdr)

## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
    include
    libraries/sdr/include/
    ${EIGEN3_INCLUDE_DIR}
    ${catkin_INCLUDE_DIRS}
)

## Declare a C++ executable
add_library(travel_info_callback ${CMAKE_CURRENT_SOURCE_DIR}/src/travel_info_callback.cpp)
target_include_directories(travel_info_callback PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_link_libraries(travel_info_callback ${catkin_LIBRARIES})
add_dependencies(travel_info_callback sdr_ros_generate_messages_cpp)

add_executable(sdr_ros src/sdr_ros.cpp)
target_link_libraries(sdr_ros ${catkin_LIBRARIES} travel_info_callback detailed_exception.o preprocessing.o pose.o yaml-cpp)
add_dependencies(sdr_ros sdr_ros_generate_messages_cpp)

I hope I've given enough information and that someone can help. Much appreciated

Body:
**inline** void sdr_ros::TravelInfoCallback::callback(const sdr_ros::TravelInfoConstPtr& travel_info) noexcept

I accidentally left the inline keyword within the function header. Removing it allowed for a proper function declaration which resolved all my issues


问:
XSL FO 2 blocks on the same row without table
Hello any clue to align the title with the OPTION text without using table?

```<code><xsl:choose>
                <xsl:when test="@product='OPTION'">
                <fo:block-container keep-together.within-line="always">
                    <fo:block>
                        <xsl:apply-templates select="*[contains(@class, ' topic/title ')]"/>
                    </fo:block>
                    <fo:block xsl:use-attribute-sets="title__option">
                        <xsl:text>OPTION </xsl:text>
                            <xsl:text> </xsl:text>
                    </fo:block>
                </fo:block-container>
                </xsl:when>
            <xsl:otherwise>
                <xsl:apply-templates select="*[contains(@class, ' topic/title ')]"/>
            </xsl:otherwise>
        </xsl:choose>
</code>```

Thanks, cheers

答:
My sollution:</p>
```<code>        <fo:block>
            <fo:inline-container inline-progression-dimension="49.9%">
                <fo:block text-align="left">
                    content1
                </fo:block>
            </fo:inline-container>
            <fo:inline-container inline-progression-dimension="49.9%">
                <fo:block text-align="right">
                    content2
                </fo:block>
            </fo:inline-container>
        </fo:block>
</code>```

Body:
Hello any clue to align the title with the OPTION text without using table?

<xsl:choose>
                <xsl:when test="@product='OPTION'">
                <fo:block-container keep-together.within-line="always">
                    <fo:block>
                        <xsl:apply-templates select="*[contains(@class, ' topic/title ')]"/>
                    </fo:block>
                    <fo:block xsl:use-attribute-sets="title__option">
                        <xsl:text>OPTION </xsl:text>
                            <xsl:text> </xsl:text>
                    </fo:block>
                </fo:block-container>
                </xsl:when>
            <xsl:otherwise>
                <xsl:apply-templates select="*[contains(@class, ' topic/title ')]"/>
            </xsl:otherwise>
        </xsl:choose>

Thanks, cheers

Body:
My sollution:

        <fo:block>
            <fo:inline-container inline-progression-dimension="49.9%">
                <fo:block text-align="left">
                    content1
                </fo:block>
            </fo:inline-container>
            <fo:inline-container inline-progression-dimension="49.9%">
                <fo:block text-align="right">
                    content2
                </fo:block>
            </fo:inline-container>
        </fo:block>


问:
How to add a circle to ListView
I have a listview.I want to put texts and a circle filled with specific color in listview items.Text are different but circle should have one color only.Anyone having idea how to do it?</p>

答: You need to create a custom ListAdapter, override its getView() method and return any view you want. Usually BaseAdatper or ArrayAdapter classes are used as the base class. Then you need to attach this adapter to the ListView using ListView.setAdapter() and that's all.

Title: How to add a circle to ListView


答:
For drawing two types of charts you can add two series for example.

```<code>  series: [{
      data: [4, 3, 5, 6, 2, 3]
    },
    {
      type: 'column',
      data: [4, 3, 5, 6, 2, 3].reverse()
    }
  ]
</code>```

Demo: https://jsfiddle.net/BlackLabel/4b6g9doy/

About loading data from json you can found here:
preprocess-data-using-json

Dynamic load data: https://www.highcharts.com/demo/stock/dynamic-update

But this example is JavaScript related, you need to find a way to port it to python.

Title: dynamic highcharts with json data every 1 second

Body:
I have json_data like below

[{"n":"0","y":"450","prediction_value":"449.191"},{"n":"1","y":"451.117","prediction_value":"451.259"},{"n":"2","y":"354.17","prediction_value":"354.352"},{"n":"3","y":"439.781","prediction_value":"439.939"},{"n":"4","y":"451.436","prediction_value":"451.611"},{"n":"5","y":"448.935","prediction_value":"448.991"},{"n":"6","y":"451.935","prediction_value":"451.806"},{"n":"7","y":"370.045","prediction_value":"369.802"},{"n":"8","y":"447.232","prediction_value":"447.231"},{"n":"9","y":"410.612","prediction_value":"410.873"},{"n":"10","y":"423.815","prediction_value":"423.923"},{"n":"11","y":"451.707","prediction_value":"451.867"},{"n":"12","y":"425.391","prediction_value":"425.287"},{"n":"13","y":"395.942","prediction_value":"395.905"},{"n":"14","y":"436.397","prediction_value":"436.682"},{"n":"15","y":"405.184","prediction_value":"405.027"},{"n":"16","y":"372.175","prediction_value":"372.128"}]

I want to draw 2 types of graph

1st graph have X=n, and Y=y, so y=f(n)

2nd graph have X=n, and Y=prediction_value, so prediction=f(n)

How can I draw two highcharts graph in same panel?

Body:
For drawing two types of charts you can add two series for example.

  series: [{
      data: [4, 3, 5, 6, 2, 3]
    },
    {
      type: 'column',
      data: [4, 3, 5, 6, 2, 3].reverse()
    }
  ]

Demo: https://jsfiddle.net/BlackLabel/4b6g9doy/

About loading data from json you can found here:
preprocess-data-using-json

Dynamic load data: https://www.highcharts.com/demo/stock/dynamic-update

But this example is JavaScript related, you need to find a way to port it to python.