问:
Querying using custom key identifier(Name/ID) in firestore(datastore mode)?
I have a datastore entity like this below

```<code>     Name/ID              Parent                       Rollen             email          first_name      last_name
name=CidassUID  Key(Tenant, 'CidassGroupID')    ["user","admin"]    user@email.com  user first name user last name
</code>```

I would like to make a query w.r.t Name/ID

In GQL I am trying like this

```<code> select * from User where Name/ID='CidassUID'
</code>```

and in python like this..

```<code>    query = client.query(kind='User')
    query.add_filter('Name/ID', '=', 'name=CidassUID')
    return list(query.fetch())
</code>```

Can somebody help how can I get the result via Name/ID?

Thanks a lot

答:
so thats how i solve it in GQL..

```<code>select * from User where __key__= Key(Tenant, 'CidassGroupID', User, 'CidassUID')
</code>```

and for python..

```<code>query_key=client.key('Tenant', 'CidassGroupID','User', 'CidassUID')
query.key_filter(query_key,'=')
</code>```

Body:
I have a datastore entity like this below

     Name/ID              Parent                       Rollen             email          first_name      last_name
name=CidassUID  Key(Tenant, 'CidassGroupID')    ["user","admin"]    user@email.com  user first name user last name

I would like to make a query w.r.t Name/ID

In GQL I am trying like this

 select * from User where Name/ID='CidassUID'

and in python like this..

    query = client.query(kind='User')
    query.add_filter('Name/ID', '=', 'name=CidassUID')
    return list(query.fetch())

Can somebody help how can I get the result via Name/ID?

Thanks a lot

Body:
so thats how i solve it in GQL..

select * from User where __key__= Key(Tenant, 'CidassGroupID', User, 'CidassUID')

and for python..

query_key=client.key('Tenant', 'CidassGroupID','User', 'CidassUID')
query.key_filter(query_key,'=')


来源: stackexchange

问:
Unable to start pulse in Gemfire 9 after using ServerLauncher
I am trying to run Gemfire Server using java code. However, I am unable to start pulse as I get an error saying "geode-web-api war file was not found".

There are no logs printing after this:

[info 2020/02/11 14:32:46.648 GMT  tid=0x1]
  GEODE_HOME:C:\FAST\pivotal-gemfire-9.9.0

[warn 2020/02/11 14:32:46.649 GMT  tid=0x1] geode-web-api war
  file was not found

[info 2020/02/11 14:32:46.649 GMT  tid=0x1] Unable to find
  GemFire Developer REST API WAR file; the Developer REST Interface for
  GemFire will not be accessible.

[info 2020/02/11 14:32:46.650 GMT  tid=0x1] Initializing region
  ParameterizedQueries

[info 2020/02/11 14:32:46.650 GMT  tid=0x1] Initialization of
  region ParameterizedQueries completed

Here is the code I am using to run the ServerLauncher:

```<code>public static void run(String cacheFile, String locator,
                           boolean enableJmx, String jmxPort, String httpPort, String locators) throws Exception {
        if (StringUtils.isEmpty(cacheFile) || StringUtils.isEmpty(locator)) {
            throw new Exception("Could not start Gemfire for configFile " + cacheFile + " and locator " + locator);
        }
        if (enableJmx && StringUtils.isEmpty(jmxPort)) {
            throw new Exception("jmxPort not specified");
        }
        ServerLauncher serverLauncher = new ServerLauncher.Builder()
                .set("cache-xml-file", cacheFile)
                .set("start-locator", locator)
                .set("jmx-manager", "" + enableJmx)
                .set("jmx-manager-start", "true")
                .set("log-level", "debug")
                .set("jmx-manager-port", jmxPort)
                .set("http-service-bind-address", "localhost")
                .set("http-service-port", httpPort)
                .set("jmx-manager-update-rate", "2000")
                .set("start-dev-rest-api", "true")
//                .set("locators", locators)
                .build();
        serverLauncher.start();
}
</code>```

Thanks

答:
I've just tried the following locally (as a quick example) and it works fine:</p>

```<code>
public class TestLocator {
    static {
        System.setProperty("gemfire.home", "/apps/pivotal-gemfire-9.9.1");
    }

    public static void main(String[] args) {
        LocatorLauncher launcher = new LocatorLauncher.Builder()
                .set("jmx-manager", "true")
                .set("jmx-manager-start", "true")
                .set("log-level", "config")
                .set("log-file", "/test/locator.log")
                .set("http-service-bind-address", "localhost")
                .set("http-service-port", "7070")
                .build();
        launcher.start();
    }
}
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I am trying to run Gemfire Server using java code. However, I am unable to start pulse as I get an error saying "geode-web-api war file was not found".

There are no logs printing after this:

[info 2020/02/11 14:32:46.648 GMT  tid=0x1]
  GEODE_HOME:C:\FAST\pivotal-gemfire-9.9.0

[warn 2020/02/11 14:32:46.649 GMT  tid=0x1] geode-web-api war
  file was not found

[info 2020/02/11 14:32:46.649 GMT  tid=0x1] Unable to find
  GemFire Developer REST API WAR file; the Developer REST Interface for
  GemFire will not be accessible.

[info 2020/02/11 14:32:46.650 GMT  tid=0x1] Initializing region
  ParameterizedQueries

[info 2020/02/11 14:32:46.650 GMT  tid=0x1] Initialization of
  region ParameterizedQueries completed

Here is the code I am using to run the ServerLauncher:

public static void run(String cacheFile, String locator,
                           boolean enableJmx, String jmxPort, String httpPort, String locators) throws Exception {
        if (StringUtils.isEmpty(cacheFile) || StringUtils.isEmpty(locator)) {
            throw new Exception("Could not start Gemfire for configFile " + cacheFile + " and locator " + locator);
        }
        if (enableJmx && StringUtils.isEmpty(jmxPort)) {
            throw new Exception("jmxPort not specified");
        }
        ServerLauncher serverLauncher = new ServerLauncher.Builder()
                .set("cache-xml-file", cacheFile)
                .set("start-locator", locator)
                .set("jmx-manager", "" + enableJmx)
                .set("jmx-manager-start", "true")
                .set("log-level", "debug")
                .set("jmx-manager-port", jmxPort)
                .set("http-service-bind-address", "localhost")
                .set("http-service-port", httpPort)
                .set("jmx-manager-update-rate", "2000")
                .set("start-dev-rest-api", "true")
//                .set("locators", locators)
                .build();
        serverLauncher.start();
}

Thanks

Body:
I've just tried the following locally (as a quick example) and it works fine:

public class TestLocator {
    static {
        System.setProperty("gemfire.home", "/apps/pivotal-gemfire-9.9.1");
    }

    public static void main(String[] args) {
        LocatorLauncher launcher = new LocatorLauncher.Builder()
                .set("jmx-manager", "true")
                .set("jmx-manager-start", "true")
                .set("log-level", "config")
                .set("log-file", "/test/locator.log")
                .set("http-service-bind-address", "localhost")
                .set("http-service-port", "7070")
                .build();
        launcher.start();
    }
}


问:
Does EC2 dedicated instance share RAM bandwidth?
If I create a dedicated instance and if it starts on a multi die server, does it share RAM bandwidth of its own CPU? What happens if a neighbor runs some memory bandwidth consuming task? Does it affect my instance?

How is this on a shared instance?

What kind of RAM addressing mode is there? Only on its own numa node or interleaved on all memory sticks of multi-die server?

答:
Dedicated instances may share hardware with your other instances. From EC2 Dedicated Instances:

"Dedicated Instances are Amazon EC2 instances that run in a VPC on
  hardware that's dedicated to a single customer. Your Dedicated
  instances are physically isolated at the host hardware level from
  instances that belong to other AWS accounts. Dedicated instances may
  share hardware with other instances from the same AWS account that
  are not Dedicated instances."

As far as I know, Amazon AWS do not specify exactly how the physical memory hierarchy and bandwidth is divided between different virtual machines on different CPU classes, but we can infer how it is done based on documentation from Intel and Xen/KVM (the hypervisors that EC2 use as base technology).

Note that cache and memory bandwidth are related, but, strictly speaking, there is a difference between cache and memory - cache refers to memory on the CPU, and memory refers to DRAM chips accessible for load/store operations from the CPU. Not all EC2 CPUs have all these technologies, for example, Intel introduced cache management before memory bandwidth management.

The most relevant technology to the question of shared RAM bandwidth is Memory Bandwidth Allocation. This enables the hypervisor to partition memory bandwidth between different CPU cores, so that different instances don't have to share bandwidth. However, this technology wasn't introduced until Skylake, which is used for C5 instances.

Technologies that were introduced in subsequent CPU families:

Xeon E5-2676 v3 (Haswell)

Used by EC2 instances: T2, C4, some M4

Cache Monitoring Technology
(CMT)

"CMT can be used to monitor Last Level Cache (LLC) usage by
  application   threads. With this information, administrators and
  management applications can balance workloads more efficiently to
  improve both application performance and physical resource
  utilization. For example, CMT can be used to reduce the impact of the
  so-called "noisy neighbour" issue in multitenant cloud and data center
  environments." (see Xen Intel Platform QoS
  Technologies)

Cache Allocation Technology (CAT)

"Intel’s Cache Allocation Technology (CAT) helps address shared
  resource
      concerns by providing software control of where data is allocated into the last-level cache (LLC), enabling isolation and prioritization
  of key applications."

Code and Data Prioritization

"Code and Data Prioritization (CDP) as introduced on the Intel® Xeon®
      processor E5 v4 family is a specialized extension to Cache Allocation Technology (CAT), which enables software control over code
  and data placement in the last-level cache (LLC)."

Note that these are all cache management technologies, not memory bandwidth (though obviously related).

Xeon E5-2686 v4 (Broadwell)

Used by EC2 instances: some M4.

Memory Bandwidth Monitoring (MBM).

"Both cache and memory bandwidth can have a large impact on overall
  application performance in complex modern multithreaded and
  multitenant environments.  In the cloud datacenter for instance it is
  important to understand the resource requirements of an application in
  order to meet targets and provide optimal performance. Similarly, some
  applications may over-utilize shared resources, and the capability to
  detect such “noisy neighbor” applications is important. The new Memory
  Bandwidth Monitoring (MBM) feature helps address this issue, for the
  first time, by providing per-thread memory bandwidth monitoring for
  all threads simultaneously."

MBM enables monitoring of memory bandwidth usage, but not direct control. Monitoring is still useful for mitigation - for example, a VM that uses a lot of memory bandwidth could be migrated to a physical machine where more memory bandwidth is available.

Xeon Platinum 8000 (Skylake)

Used by EC2 instances: C5

Memory Bandwidth Allocation (MBA)

"The Intel® Xeon® Scalable processors introduce Memory Bandwidth
  Allocation (MBA), which provides new levels of control over how memory
  bandwidth is distributed across running applications. MBA enables
  improved prioritization, bandwidth management and is a valuable tool
  to help control data center noisy neighbors."

MBA enables direct control and QoS partitioning of memory bandwidth usage.


问:
Can a CSS overflow scrollbar be controlled in Javascript?
I have a div with a class overflow: auto;  Is there a way to control this scrollbar when it appears?

I have a ajax photo gallery (no page refresh) where some caption text is in a div, but the content is of varying length.  If you scroll down in this div and then advance to the next slide, the scrollbar does not go back to the top.  So, I was wondering if there was a way to control this scrollbar.  Thanks.

答:
Update after a test, using elm.scrollTop = 0:

```<code><div style="overflow:auto;height:100px;width:100px">
    <p>test</p>
    <p>test</p>
    <p>test</p>
    <a href="javascript:" onclick="this.parentNode.scrollTop = 0">go up</a>
</div>
</code>```

ContentLicense: CC BY-SA 3.0

Body:
Update after a test, using elm.scrollTop = 0:

<div style="overflow:auto;height:100px;width:100px">
    <p>test</p>
    <p>test</p>
    <p>test</p>
    <a href="javascript:" onclick="this.parentNode.scrollTop = 0">go up</a>
</div>


问:
Failed to load module script
After deploying an Angular app on Heroku, a blank page is shown when URL is reached and console is showing MIME type errors.

error is:

Failed to load module script: The server responded with a
non-JavaScript MIME type of "text/html". Strict MIME type checking is
enforced for module scripts per HTML spec.

答:
it works for me when use angular8 with express:</p>

```<code>app.use('/', express.static('classvideo'));

app.get('*', (req,res,next) => {
    const indexFile = path.resolve(__dirname + '/classvideo/index.html');
    res.sendFile(indexFile);
});
</code>```

Title: Failed to load module script

Body:
it works for me when use angular8 with express:

app.use('/', express.static('classvideo'));

app.get('*', (req,res,next) => {
    const indexFile = path.resolve(__dirname + '/classvideo/index.html');
    res.sendFile(indexFile);
});


问:
WCF bindings/security configuration for Intranet that uses Mac and Windows?
What bindings and security configurations are best for an environment with Windows and Mac Computers?</p>

答:
The bindings depend entirely on what client software is talking to the service, and not what type of computer it's running on. What's available to the Mac client?

The security configuration depends on the binding, how the service is hosted, the environment... the question is so vague that it can't be answered right now.


问:
Problems after upgrading to Xcode 10: Build input file cannot be found
I upgraded my Xcode SDK to version 10 last night and then find I cannot build.

I'm getting this error:

Build input file cannot be found:
  '/Users/call01/Library/Developer/Xcode/DerivedData/Comp-Lite-Apps-gytvmossqptokeafrddvvmnlzadk/Build/Products/Debug-iphoneos/SG11.app/SG11

which did not exist before my upgrade and I'm tempted to revert back but would like to stick with version 10 if I can resolve this issue.

答:
I ran into this error after renaming a file. Somehow Xcode didn't correctly rename the actual file on disk.

So it wasn't able to find the file. Sometimes the files gets highlights with a red text color. At other times the Swift icon in front of the file was getting a gray overlay.

The fix was simple.

Look into the error and see exactly which file it's unable to find.

Select the file that can't be found.

Go to the 'File Inspector'.  It's on Xcode's right navigation pane.

Click on the folder icon.

Select the correct file.

Clean build and run it again.


问:
Trestle Request unsuccessful. Incapsula incident WebApi error
I'm working with Trestle which is real estate MLS service to get property data etc. I have followed their WebApi docs but I'm getting this error whenever I hit their api it looks like their server thinks that request is from some BOT. Even they recommend using Postman to test api:

Its been 3 days and still cant find any fix. Any help?

答:
You do not seem to be following this documentation correctly.
https://docs-trestle.corelogic.com/GettingStarted/WebAPI

At the moment you are entering the token URL (https://api-prod.corelogic.com/trestle/oidc/connect/token) in the main Postman request URL field. The documentation states that you should use the Get New Access Token button on the Authorization tab of a request. You are entering the token URL in the main Postman request URL field.

This is a default flow for oAuth 2.0 requests in Postman.
https://learning.postman.com/docs/postman/sending-api-requests/authorization/#oauth-20

Example:
This could be your request to retrieve data:

https://api-prod.corelogic.com/trestle/odata/$metadata

On the Authorization tab you should select oAuth 2.0; select Get New Access Token and you will see a view which gives you the functionality you are looking for.

When successful, you will get a pop-up which you need to accept in order to use the API.


问:
The result is different when I apply torch.manual_seed before loading cuda() after loading the model
I tried to make sure my code to be reproducible (always get the same results)

So I applied below settings before my codes.

```<code>os.environ['PYTHONHASHSEED'] = str(args.seed)
random.seed(args.seed)
np.random.seed(args.seed)
torch.manual_seed(args.seed)
torch.cuda.manual_seed(args.seed)
torch.cuda.manual_seed_all(args.seed) # if you are using multi-GPU.
torch.backends.cudnn.benchmark = False
torch.backends.cudnn.deterministic = True
</code>```

With these settings, I always achieved the same results with the same environment and GPU.

Howerver, when I applied torch.manual_seed() after loading the model.

```<code>torch.manual_seed(args.seed)
model = Net()
Net.cuda()
</code>```

```<code>torch.manual_seed(args.seed)
model = Net()
torch.manual_seed(args.seed)
Net.cuda()
</code>```

The above two results were different.
How should I understand this situation?

Does seed reinitialize after loading the model?

答:
The Net.cuda() has no effect on the random number generator. Under the hood it just calls cuda() for all of the model parameters. So basically it's multiple calls to Tensor.cuda().

https://github.com/pytorch/pytorch/blob/ecd3c252b4da3056797f8a505c9ebe8d68db55c4/torch/nn/modules/module.py#L293

We can test this by doing the following:

torch.random.manual_seed(42)
x = torch.rand(1)
x.cuda()
y = torch.rand(1)
y.cuda()
print(x, y)

# the above prints the same as below
torch.random.manual_seed(42)
print(torch.rand(1), torch.rand(1))
```

<p>So that means <code>Net()</code> is using the number generator to initialize random weights within the layers.</p>

<pre class="lang-py prettyprint-override"><code>torch.manual_seed(args.seed)
model = Net()
print(torch.rand(1))

# the below will print a different result
torch.manual_seed(args.seed)
model = Net()
torch.manual_seed(args.seed)
print(torch.rand(1))
</code>```

I would recommend narrowing the scope of how random numbers are managed within your Python source code. So that a global block of code outside of the Model isn't responsible for how internal values are generated.

Simply said, pass the seed as a parameter to the __init__ of the model.

model = Net(args.seed)
print(torch.rand(1))
```

This will force developers to always provide a seed for consistency when using the model, and you can make the parameter optional if seeding isn't always necessary.

I'd avoid using the same seed all the time, because you're going to learn to use parameters that work best with that seed.

Body:
I tried to make sure my code to be reproducible (always get the same results)

So I applied below settings before my codes.

os.environ['PYTHONHASHSEED'] = str(args.seed)
random.seed(args.seed)
np.random.seed(args.seed)
torch.manual_seed(args.seed)
torch.cuda.manual_seed(args.seed)
torch.cuda.manual_seed_all(args.seed) # if you are using multi-GPU.
torch.backends.cudnn.benchmark = False
torch.backends.cudnn.deterministic = True

With these settings, I always achieved the same results with the same environment and GPU.

Howerver, when I applied torch.manual_seed() after loading the model.

torch.manual_seed(args.seed)
model = Net()
Net.cuda()

torch.manual_seed(args.seed)
model = Net()
torch.manual_seed(args.seed)
Net.cuda()

The above two results were different.
How should I understand this situation?

Does seed reinitialize after loading the model?

Body:
The Net.cuda() has no effect on the random number generator. Under the hood it just calls cuda() for all of the model parameters. So basically it's multiple calls to Tensor.cuda().

https://github.com/pytorch/pytorch/blob/ecd3c252b4da3056797f8a505c9ebe8d68db55c4/torch/nn/modules/module.py#L293

We can test this by doing the following:

torch.random.manual_seed(42)
x = torch.rand(1)
x.cuda()
y = torch.rand(1)
y.cuda()
print(x, y)

# the above prints the same as below
torch.random.manual_seed(42)
print(torch.rand(1), torch.rand(1))

So that means Net() is using the number generator to initialize random weights within the layers.

torch.manual_seed(args.seed)
model = Net()
print(torch.rand(1))

# the below will print a different result
torch.manual_seed(args.seed)
model = Net()
torch.manual_seed(args.seed)
print(torch.rand(1))

I would recommend narrowing the scope of how random numbers are managed within your Python source code. So that a global block of code outside of the Model isn't responsible for how internal values are generated.

Simply said, pass the seed as a parameter to the __init__ of the model.

model = Net(args.seed)
print(torch.rand(1))

This will force developers to always provide a seed for consistency when using the model, and you can make the parameter optional if seeding isn't always necessary.

I'd avoid using the same seed all the time, because you're going to learn to use parameters that work best with that seed.


问:
How to animate the command line?
I have always wondered how people update a previous line in a command line. a great example of this is when using the wget command in linux. It creates an ASCII loading bar of sorts that looks like this:

[======>                    ] 37%

and of course the loading bar moves and the percent changes, But it doesn't make a new line. I cannot figure out how to do this. Can someone point me in the right direction?

答:
One way to do this is to repeatedly update the line of text with the current progress. For example:

```<code>def status(percent):
    sys.stdout.write("%3d%%\r" % percent)
    sys.stdout.flush()
</code>```

Note that I used sys.stdout.write instead of print (this is Python) because print automatically prints "\r\n" (carriage-return new-line) at the end of each line. I just want the carriage-return which returns the cursor to the start of the line. Also, the flush() is necessary because by default, sys.stdout only flushes its output after a newline (or after its buffer gets full).

ContentLicense: CC BY-SA 2.5

Title: How to animate the command line?

Body:
One way to do this is to repeatedly update the line of text with the current progress. For example:

def status(percent):
    sys.stdout.write("%3d%%\r" % percent)
    sys.stdout.flush()

Note that I used sys.stdout.write instead of print (this is Python) because print automatically prints "\r\n" (carriage-return new-line) at the end of each line. I just want the carriage-return which returns the cursor to the start of the line. Also, the flush() is necessary because by default, sys.stdout only flushes its output after a newline (or after its buffer gets full).

OwnerDisplayName: Greg Hewgill


问:
C++ usual arithmetic conversions not converting
First, I'd like to point out that I did read some of the other answers with generally similar titles. However, those either refer to what I assume is an older version of the standard, or deal with promotions, not conversions.

I've been crawling through "C++ Crash Course", where the author states the following in the chapter exploring built-in operators:

If none of the floating-point promotion rules apply, you then check
whether either argument is signed. If so, both operands become signed.
Finally, as with the promotion rules for floating-point types, the size of the
largest operand is used to promote the other operand: ...

If I read the standard correctly, this is not true, because, as per cppreference.com,

If both operands are signed or both are unsigned, the operand with lesser conversion rank is converted to the operand with the greater integer conversion rank

Otherwise, if the unsigned operand's conversion rank is greater or equal to the conversion rank of the signed operand, the signed operand is converted to the unsigned operand's type.

Otherwise, if the signed operand's type can represent all values of the unsigned operand, the unsigned operand is converted to the signed operand's type

Otherwise, both operands are converted to the unsigned counterpart of the signed operand's type.

What confuses me even more is the fact that the following code:

```<code>printf("Size of int is %d bytes\n", sizeof(int));
printf("Size of short is %d bytes\n", sizeof(short));
printf("Size of long is %d bytes\n", sizeof(long));
printf("Size of long long is %d bytes\n", sizeof(long long));
unsigned int x = 4000000000;
signed int y = -1;
signed long z = x + y;
printf("x + y = %ld\n", z);
</code>```

produces the following output:

```<code>Size of int is 4 bytes
Size of short is 2 bytes
Size of long is 8 bytes
Size of long long is 8 bytes
x + y = 3999999999
</code>```

As I understand the standard, y should have been converted to unsigned int, leading to an incorrect result. The result is correct, which leads me to assume that no conversion happens in this case. Why? I would be grateful for any clafirication on this matter. Thank you.

(I would also appreciate someone telling me that I won't ever need this kind of arcane knowledge in real life, even if it's not true - just for the peace of mind.)

答:
If I read the standard correctly, this is not true

You're correct. CCC is wrong.

As I understand the standard, y should have been converted to unsigned int,

It did.

The result is correct, which leads me to assume that no conversion happens in this case.

You assume wrong.

Since -1 is not representable unsigned number, it simply converts to the representable number that is representable and is congruent with - 1 modulo the number of representable values. When you add this to x, the result is larger than any representable value, so again result is the representable value that is congruent with the modulo. Because of the magic of how modular arithmetic works, you get the correct result.

Body:
First, I'd like to point out that I did read some of the other answers with generally similar titles. However, those either refer to what I assume is an older version of the standard, or deal with promotions, not conversions.

I've been crawling through "C++ Crash Course", where the author states the following in the chapter exploring built-in operators:

If none of the floating-point promotion rules apply, you then check
whether either argument is signed. If so, both operands become signed.
Finally, as with the promotion rules for floating-point types, the size of the
largest operand is used to promote the other operand: ...

If I read the standard correctly, this is not true, because, as per cppreference.com,

If both operands are signed or both are unsigned, the operand with lesser conversion rank is converted to the operand with the greater integer conversion rank

Otherwise, if the unsigned operand's conversion rank is greater or equal to the conversion rank of the signed operand, the signed operand is converted to the unsigned operand's type.

Otherwise, if the signed operand's type can represent all values of the unsigned operand, the unsigned operand is converted to the signed operand's type

Otherwise, both operands are converted to the unsigned counterpart of the signed operand's type.

What confuses me even more is the fact that the following code:

printf("Size of int is %d bytes\n", sizeof(int));
printf("Size of short is %d bytes\n", sizeof(short));
printf("Size of long is %d bytes\n", sizeof(long));
printf("Size of long long is %d bytes\n", sizeof(long long));
unsigned int x = 4000000000;
signed int y = -1;
signed long z = x + y;
printf("x + y = %ld\n", z);

produces the following output:

Size of int is 4 bytes
Size of short is 2 bytes
Size of long is 8 bytes
Size of long long is 8 bytes
x + y = 3999999999

As I understand the standard, y should have been converted to unsigned int, leading to an incorrect result. The result is correct, which leads me to assume that no conversion happens in this case. Why? I would be grateful for any clafirication on this matter. Thank you.

(I would also appreciate someone telling me that I won't ever need this kind of arcane knowledge in real life, even if it's not true - just for the peace of mind.)


问:
PyCharm autocomplete for imported modules
I'm new to Python and trying to get comfortable with the syntax and the language. I gave PyCharm a shot and found it very comfortable.

The only problem is that auto-completion isn't working as I expected and it is very important to me as part of the learning process and looking into some modules.

My code works even without the autocomplete but I'm very used to it and really wish to enjoy this feature.

I tried changing my project interpreter back and forth and nothing changed. I tried restarting PyCharm, the computer - didn't work. I tried Invalidate Cache, made sure the power save mode is off - nada.

Here is an example of missing autocomplete for lxml:

And here is the interpreter window:

答:
Install KITE, its a super fast auto suggest engine for python. It works for Pycharm,Sublime etc...
For more details view this youtube video</p>


问:
Rating star is cutting from the end
i have implemented android native rating bar but when i set number of star to 10 it will cut from the end of the screen its happening in some devices can anybody help me how can i manage to display 10 star consistently on all mobile devices?</p>

```<code> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_marginBottom="@dimen/_15sdp"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<TextView
    android:id="@+id/tValueLabel"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginEnd="@dimen/_5sdp"
    android:textSize="@dimen/_11ssp" />

<RatingBar
    android:id="@+id/ratingBar"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    style="?android:attr/ratingBarStyleIndicator"
    android:isIndicator="false"
    android:layout_marginTop="@dimen/_5sdp"
    android:stepSize="1.0" />

</LinearLayout>
</code>```

答:
Make changes to your width parameter as per your need:

android:layout_width="xx dp"

Title: Rating star is cutting from the end

Body:
i have implemented android native rating bar but when i set number of star to 10 it will cut from the end of the screen its happening in some devices can anybody help me how can i manage to display 10 star consistently on all mobile devices?

 <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_marginBottom="@dimen/_15sdp"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<TextView
    android:id="@+id/tValueLabel"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginEnd="@dimen/_5sdp"
    android:textSize="@dimen/_11ssp" />

<RatingBar
    android:id="@+id/ratingBar"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    style="?android:attr/ratingBarStyleIndicator"
    android:isIndicator="false"
    android:layout_marginTop="@dimen/_5sdp"
    android:stepSize="1.0" />

</LinearLayout>


问:
Error running "ionic cordova build android' after installin firebase package.Execution failed for task ':app:compileDebugJavaWithJavac'
After i installed the firebase package from ionic docs, and configured firebase for cloud-messaging, when i run "ionic cordova build android" i get these errors:

```<code>D:\Projects\Evento\Evento\platforms\android\app\src\main\java\org\apache\cordova\firebase\FirebasePlugin.java:610: error: method getByteArray in class FirebaseRemoteConfig cannot be applied to given types;
                        : FirebaseRemoteConfig.getInstance().getByteArray(key, namespace);
                                                            ^
  required: String
  found: String,String
  reason: actual and formal argument lists differ in length
D:\Projects\Evento\Evento\platforms\android\app\src\main\java\org\apache\cordova\firebase\FirebasePlugin.java:629: error: method getValue in class FirebaseRemoteConfig cannot be applied to given types;
                        : FirebaseRemoteConfig.getInstance().getValue(key, namespace);
                                                            ^
  required: String
  found: String,String
  reason: actual and formal argument lists differ in length
D:\Projects\Evento\Evento\platforms\android\app\src\main\java\org\apache\cordova\firebase\FirebasePlugin.java:686: error: no suitable method found for setDefaults(Map<String,Object>,String)
                        FirebaseRemoteConfig.getInstance().setDefaults(defaultsToMap(defaults), namespace);
                                                          ^
    method FirebaseRemoteConfig.setDefaults(Map<String,Object>) is not applicable
      (actual and formal argument lists differ in length)
    method FirebaseRemoteConfig.setDefaults(int) is not applicable
      (actual and formal argument lists differ in length)
D:\Projects\Evento\Evento\platforms\android\app\src\main\java\org\apache\cordova\firebase\FirebasePlugin.java:885: error: cannot find symbol
                        myTrace.incrementCounter(counterNamed);
                               ^
  symbol:   method incrementCounter(String)
  location: variable myTrace of type Trace
D:\Projects\Evento\Evento\platforms\android\app\src\main\java\org\apache\cordova\firebase\FirebasePluginMessagingService.java:144: error: constructor Builder in class Builder cannot be applied to given types;
            NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, channelId);
                                                             ^
  required: Context
  found: FirebasePluginMessagingService,String
  reason: actual and formal argument lists differ in length
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: D:\Projects\Evento\Evento\platforms\android\app\src\main\java\org\apache\cordova\file\AssetFilesystem.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
5 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 12s
> Task :app:compileDebugJavaWithJavac FAILED
33 actionable tasks: 5 executed, 28 up-to-date
D:\Projects\Evento\Evento\platforms\android\gradlew: Command failed with exit code 1 Error output:
D:\Projects\Evento\Evento\platforms\android\app\src\main\java\org\apache\cordova\firebase\FirebasePlugin.java:610: error: method getByteArray in class FirebaseRemoteConfig cannot be applied to given types;
                        : FirebaseRemoteConfig.getInstance().getByteArray(key, namespace);
                                                            ^
  required: String
  found: String,String
  reason: actual and formal argument lists differ in length
D:\Projects\Evento\Evento\platforms\android\app\src\main\java\org\apache\cordova\firebase\FirebasePlugin.java:629: error: method getValue in class FirebaseRemoteConfig cannot be applied to given types;
                        : FirebaseRemoteConfig.getInstance().getValue(key, namespace);
                                                            ^
  required: String
  found: String,String
  reason: actual and formal argument lists differ in length
D:\Projects\Evento\Evento\platforms\android\app\src\main\java\org\apache\cordova\firebase\FirebasePlugin.java:686: error: no suitable method found for setDefaults(Map<String,Object>,String)
                        FirebaseRemoteConfig.getInstance().setDefaults(defaultsToMap(defaults), namespace);
                                                          ^
    method FirebaseRemoteConfig.setDefaults(Map<String,Object>) is not applicable
      (actual and formal argument lists differ in length)
    method FirebaseRemoteConfig.setDefaults(int) is not applicable
      (actual and formal argument lists differ in length)
D:\Projects\Evento\Evento\platforms\android\app\src\main\java\org\apache\cordova\firebase\FirebasePlugin.java:885: error: cannot find symbol
                        myTrace.incrementCounter(counterNamed);
                               ^
  symbol:   method incrementCounter(String)
  location: variable myTrace of type Trace
D:\Projects\Evento\Evento\platforms\android\app\src\main\java\org\apache\cordova\firebase\FirebasePluginMessagingService.java:144: error: constructor Builder in class Builder cannot be applied to given types;
            NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, channelId);
                                                             ^
  required: Context
  found: FirebasePluginMessagingService,String
  reason: actual and formal argument lists differ in length
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: D:\Projects\Evento\Evento\platforms\android\app\src\main\java\org\apache\cordova\file\AssetFilesystem.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
5 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org
</code>```

I have tried removing the plugin and reinstalling.

I have updated the cordova, ionic and firebase to the latest version.

Also, I have removed firebase and installed from ionic docs and removed onTokenRefresh and replaced with onTokenNew into the subclass FirebaseMessaingSerice, and safely deleted FirebasePluginServiceId.

I have removed the platform and reinstalled all plugins.

I have updated the google-services.json but no effect.

Still I get these errors and cannot run in android.

My guess is there is some version incompatibility here, but cannot find it.

Here are my versions and configuration:

```<code>Ionic:

   Ionic CLI                     : 5.2.1 (C:\Users\arbi_\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework               : @ionic/angular 4.4.0
   @angular-devkit/build-angular : 0.13.9
   @angular-devkit/schematics    : 7.3.9
   @angular/cli                  : 7.3.9
   @ionic/angular-toolkit        : 1.5.1

Cordova:

   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : android 8.0.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.0.1, (and 13 other plugins)

Utility:

   cordova-res : not installed
   native-run  : 0.2.5

System:

   NodeJS : v10.15.3 (C:\Program Files\nodejs\node.exe)
   npm    : 6.4.1
   OS     : Windows 10
</code>```

Build.Gradle

```<code>/* Licensed to the Apache Software Foundation (ASF) under one
   or more contributor license agreements.  See the NOTICE file
   distributed with this work for additional information
   regarding copyright ownership.  The ASF licenses this file
   to you under the Apache License, Version 2.0 (the
   "License"); you may not use this file except in compliance
   with the License.  You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing,
   software distributed under the License is distributed on an
   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   KIND, either express or implied.  See the License for the
   specific language governing permissions and limitations
   under the License.
*/

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        google()
        jcenter()
        maven { url 'https://maven.fabric.io/public' } // Fabrics Maven repository from cordova-plugin-firebase
    }

    dependencies {
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files

        classpath 'com.android.tools.build:gradle:3.3.0'

        classpath 'com.google.gms:google-services:4.2.0' // google-services dependency from cordova-plugin-firebase

        classpath 'io.fabric.tools:gradle:1.25.4' // fabric dependency from cordova-plugin-firebase
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        google() // Google's Maven repository from cordova-plugin-firebase
    }

    //This replaces project.properties w.r.t. build settings
    project.ext {
      defaultBuildToolsVersion="28.0.3" //String
      defaultMinSdkVersion=19 //Integer - Minimum requirement is Android 4.4
      defaultTargetSdkVersion=28 //Integer - We ALWAYS target the latest by default
      defaultCompileSdkVersion=28 //Integer - We ALWAYS compile with the latest by default
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

</code>```

Project Properties

```<code>target=android-28
android.library.reference.1=CordovaLib
android.library.reference.2=app
cordova.system.library.1=com.squareup.okhttp3:okhttp-urlconnection:3.10.0
cordova.system.library.2=com.android.support:support-v4:24.1.1+
cordova.system.library.3=com.android.support:support-annotations:27.+
cordova.system.library.4=com.squareup.okhttp3:okhttp:3.12.0
cordova.gradle.include.1=cordova-plugin-firebase/evento-build.gradle
cordova.system.library.5=com.google.android.gms:play-services-tagmanager:+
cordova.system.library.6=com.google.firebase:firebase-core:17.0.0
cordova.system.library.7=com.google.firebase:firebase-messaging:19.0.1
cordova.system.library.8=com.google.firebase:firebase-config:18.0.0
cordova.system.library.9=com.google.firebase:firebase-perf:18.0.1
</code>```

答:
So that other people can benefit, like I did*, Jeremy Belolo's answer here solved the problem both for the person that askes this question (according to his statement anyway :-) ) and for me: https://stackoverflow.com/a/56694042/1928380

I copy the important part: Just adding these plugins, solved the problem.

```<code>ionic cordova plugin add cordova-plugin-androidx
ionic cordova plugin add cordova-plugin-androidx-adapter
</code>```

*
This is not my answer, nor do I claim any credits for it. But, I was not opening this item for days, because in the search results it showed 0 answers, when in fact the answer hidden in the comments solves my problem too!

Body:
After i installed the firebase package from ionic docs, and configured firebase for cloud-messaging, when i run "ionic cordova build android" i get these errors:

D:\Projects\Evento\Evento\platforms\android\app\src\main\java\org\apache\cordova\firebase\FirebasePlugin.java:610: error: method getByteArray in class FirebaseRemoteConfig cannot be applied to given types;
                        : FirebaseRemoteConfig.getInstance().getByteArray(key, namespace);
                                                            ^
  required: String
  found: String,String
  reason: actual and formal argument lists differ in length
D:\Projects\Evento\Evento\platforms\android\app\src\main\java\org\apache\cordova\firebase\FirebasePlugin.java:629: error: method getValue in class FirebaseRemoteConfig cannot be applied to given types;
                        : FirebaseRemoteConfig.getInstance().getValue(key, namespace);
                                                            ^
  required: String
  found: String,String
  reason: actual and formal argument lists differ in length
D:\Projects\Evento\Evento\platforms\android\app\src\main\java\org\apache\cordova\firebase\FirebasePlugin.java:686: error: no suitable method found for setDefaults(Map<String,Object>,String)
                        FirebaseRemoteConfig.getInstance().setDefaults(defaultsToMap(defaults), namespace);
                                                          ^
    method FirebaseRemoteConfig.setDefaults(Map<String,Object>) is not applicable
      (actual and formal argument lists differ in length)
    method FirebaseRemoteConfig.setDefaults(int) is not applicable
      (actual and formal argument lists differ in length)
D:\Projects\Evento\Evento\platforms\android\app\src\main\java\org\apache\cordova\firebase\FirebasePlugin.java:885: error: cannot find symbol
                        myTrace.incrementCounter(counterNamed);
                               ^
  symbol:   method incrementCounter(String)
  location: variable myTrace of type Trace
D:\Projects\Evento\Evento\platforms\android\app\src\main\java\org\apache\cordova\firebase\FirebasePluginMessagingService.java:144: error: constructor Builder in class Builder cannot be applied to given types;
            NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, channelId);
                                                             ^
  required: Context
  found: FirebasePluginMessagingService,String
  reason: actual and formal argument lists differ in length
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: D:\Projects\Evento\Evento\platforms\android\app\src\main\java\org\apache\cordova\file\AssetFilesystem.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
5 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 12s
> Task :app:compileDebugJavaWithJavac FAILED
33 actionable tasks: 5 executed, 28 up-to-date
D:\Projects\Evento\Evento\platforms\android\gradlew: Command failed with exit code 1 Error output:
D:\Projects\Evento\Evento\platforms\android\app\src\main\java\org\apache\cordova\firebase\FirebasePlugin.java:610: error: method getByteArray in class FirebaseRemoteConfig cannot be applied to given types;
                        : FirebaseRemoteConfig.getInstance().getByteArray(key, namespace);
                                                            ^
  required: String
  found: String,String
  reason: actual and formal argument lists differ in length
D:\Projects\Evento\Evento\platforms\android\app\src\main\java\org\apache\cordova\firebase\FirebasePlugin.java:629: error: method getValue in class FirebaseRemoteConfig cannot be applied to given types;
                        : FirebaseRemoteConfig.getInstance().getValue(key, namespace);
                                                            ^
  required: String
  found: String,String
  reason: actual and formal argument lists differ in length
D:\Projects\Evento\Evento\platforms\android\app\src\main\java\org\apache\cordova\firebase\FirebasePlugin.java:686: error: no suitable method found for setDefaults(Map<String,Object>,String)
                        FirebaseRemoteConfig.getInstance().setDefaults(defaultsToMap(defaults), namespace);
                                                          ^
    method FirebaseRemoteConfig.setDefaults(Map<String,Object>) is not applicable
      (actual and formal argument lists differ in length)
    method FirebaseRemoteConfig.setDefaults(int) is not applicable
      (actual and formal argument lists differ in length)
D:\Projects\Evento\Evento\platforms\android\app\src\main\java\org\apache\cordova\firebase\FirebasePlugin.java:885: error: cannot find symbol
                        myTrace.incrementCounter(counterNamed);
                               ^
  symbol:   method incrementCounter(String)
  location: variable myTrace of type Trace
D:\Projects\Evento\Evento\platforms\android\app\src\main\java\org\apache\cordova\firebase\FirebasePluginMessagingService.java:144: error: constructor Builder in class Builder cannot be applied to given types;
            NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, channelId);
                                                             ^
  required: Context
  found: FirebasePluginMessagingService,String
  reason: actual and formal argument lists differ in length
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: D:\Projects\Evento\Evento\platforms\android\app\src\main\java\org\apache\cordova\file\AssetFilesystem.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
5 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

I have tried removing the plugin and reinstalling.

I have updated the cordova, ionic and firebase to the latest version.

Also, I have removed firebase and installed from ionic docs and removed onTokenRefresh and replaced with onTokenNew into the subclass FirebaseMessaingSerice, and safely deleted FirebasePluginServiceId.

I have removed the platform and reinstalled all plugins.

I have updated the google-services.json but no effect.

Still I get these errors and cannot run in android.

My guess is there is some version incompatibility here, but cannot find it.

Here are my versions and configuration:

Ionic:

   Ionic CLI                     : 5.2.1 (C:\Users\arbi_\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework               : @ionic/angular 4.4.0
   @angular-devkit/build-angular : 0.13.9
   @angular-devkit/schematics    : 7.3.9
   @angular/cli                  : 7.3.9
   @ionic/angular-toolkit        : 1.5.1

Cordova:

   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : android 8.0.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.0.1, (and 13 other plugins)

Utility:

   cordova-res : not installed
   native-run  : 0.2.5

System:

   NodeJS : v10.15.3 (C:\Program Files\nodejs\node.exe)
   npm    : 6.4.1
   OS     : Windows 10

Build.Gradle

/* Licensed to the Apache Software Foundation (ASF) under one
   or more contributor license agreements.  See the NOTICE file
   distributed with this work for additional information
   regarding copyright ownership.  The ASF licenses this file
   to you under the Apache License, Version 2.0 (the
   "License"); you may not use this file except in compliance
   with the License.  You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing,
   software distributed under the License is distributed on an
   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   KIND, either express or implied.  See the License for the
   specific language governing permissions and limitations
   under the License.
*/

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        google()
        jcenter()
        maven { url 'https://maven.fabric.io/public' } // Fabrics Maven repository from cordova-plugin-firebase
    }

    dependencies {
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files

        classpath 'com.android.tools.build:gradle:3.3.0'

        classpath 'com.google.gms:google-services:4.2.0' // google-services dependency from cordova-plugin-firebase

        classpath 'io.fabric.tools:gradle:1.25.4' // fabric dependency from cordova-plugin-firebase
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        google() // Google's Maven repository from cordova-plugin-firebase
    }

    //This replaces project.properties w.r.t. build settings
    project.ext {
      defaultBuildToolsVersion="28.0.3" //String
      defaultMinSdkVersion=19 //Integer - Minimum requirement is Android 4.4
      defaultTargetSdkVersion=28 //Integer - We ALWAYS target the latest by default
      defaultCompileSdkVersion=28 //Integer - We ALWAYS compile with the latest by default
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Project Properties

target=android-28
android.library.reference.1=CordovaLib
android.library.reference.2=app
cordova.system.library.1=com.squareup.okhttp3:okhttp-urlconnection:3.10.0
cordova.system.library.2=com.android.support:support-v4:24.1.1+
cordova.system.library.3=com.android.support:support-annotations:27.+
cordova.system.library.4=com.squareup.okhttp3:okhttp:3.12.0
cordova.gradle.include.1=cordova-plugin-firebase/evento-build.gradle
cordova.system.library.5=com.google.android.gms:play-services-tagmanager:+
cordova.system.library.6=com.google.firebase:firebase-core:17.0.0
cordova.system.library.7=com.google.firebase:firebase-messaging:19.0.1
cordova.system.library.8=com.google.firebase:firebase-config:18.0.0
cordova.system.library.9=com.google.firebase:firebase-perf:18.0.1

Body:
So that other people can benefit, like I did*, Jeremy Belolo's answer here solved the problem both for the person that askes this question (according to his statement anyway :-) ) and for me: https://stackoverflow.com/a/56694042/1928380

I copy the important part: Just adding these plugins, solved the problem.

ionic cordova plugin add cordova-plugin-androidx
ionic cordova plugin add cordova-plugin-androidx-adapter

*
This is not my answer, nor do I claim any credits for it. But, I was not opening this item for days, because in the search results it showed 0 answers, when in fact the answer hidden in the comments solves my problem too!


问:
Checkbox that submits form on click
I'm using Codeigniter and wants to know how I can make a checkbox that submits the form on click?

Secondly, this checkbox will be one of several checkboxes that will act as a filter like products > $20, products < $30, how do i pass it in the url? I'm thinking /1+2+3

答:
The javascript questions seem to have been solved already; let's step to the codeigniter ones.

You can pass the url in one of those two ways.

Idiomatic but limited: as /1/2/3/4/etc. The controller function handling that url could both use func_get_args to read them or, if you already know how many parameters will be passed at the most, give a default value of null to all non-necessary paramenters;

Not Codeigniterish but seriously better for search parameters: enable the query strings on your config file, pass arguments as you would normally with GET (min=2&max=3 and so on) and get their value with CI's input class ($min = $this->input->get('min')).

Title: Checkbox that submits form on click


问:
openvr: move in view direction
I am programming an application with openvr and opengl and I want the camera to move in the direction it is looking at. So when you put on the hmd and look in a certain direction the virtual camera should fly in that direction so you can move around.

So the position of the hmd is provided by openvr with a call to VRCompositor()->WaitGetPoses and this should be analogous to the inverse of the view matrix, so if I extract the third coulmn of the matrix I should get the view direction and then I can translate my model matrix along that direction to move the scene.

```<code>m_mat4HMDPose = VRCompositor()->WaitGetPoses;
m_mat4HMDPose = inverse(m_mat4HMDPose);
vec4 direction = m_mat4HMDPose * vec4(0.0, 0.0, -1.0, 0.0);
model = translate(model, vec3(direction.x, direction.y, direction.z));
</code>```

This seems to be not completly wrong, but this does not work for all directions. Sometimes I look to the left but I am translated to the right, and vice versa. This also happens with up/down, and the translation will change when Im rotating the hmd around the z-axis.

I also tried to follow this tutorial https://www.youtube.com/watch?v=QREKO1sf8b8 for unity, and I got the movement working with unity, but I cannot convert the code back to run with my opengl application. I tried to implement the euler and quaternion conversion, but with no success.

I am feeling that I need to transform my direction vector with an additional matrix, so it will point in the right direction all the time, but I cannot figure out how o_o

Does anyone know what the mistake is, or knows a way how to implement this movement?

答: okay I found the mistake I need to multiply the direction with the inverse of the hmd pose, so vec4 direction = inverse(m_mat4HMDPose) * vec4(0.0, 0.0, 1.0, 0.0);

Title: openvr: move in view direction

Body:
I am programming an application with openvr and opengl and I want the camera to move in the direction it is looking at. So when you put on the hmd and look in a certain direction the virtual camera should fly in that direction so you can move around.

So the position of the hmd is provided by openvr with a call to VRCompositor()->WaitGetPoses and this should be analogous to the inverse of the view matrix, so if I extract the third coulmn of the matrix I should get the view direction and then I can translate my model matrix along that direction to move the scene.

m_mat4HMDPose = VRCompositor()->WaitGetPoses;
m_mat4HMDPose = inverse(m_mat4HMDPose);
vec4 direction = m_mat4HMDPose * vec4(0.0, 0.0, -1.0, 0.0);
model = translate(model, vec3(direction.x, direction.y, direction.z));

This seems to be not completly wrong, but this does not work for all directions. Sometimes I look to the left but I am translated to the right, and vice versa. This also happens with up/down, and the translation will change when Im rotating the hmd around the z-axis.

I also tried to follow this tutorial https://www.youtube.com/watch?v=QREKO1sf8b8 for unity, and I got the movement working with unity, but I cannot convert the code back to run with my opengl application. I tried to implement the euler and quaternion conversion, but with no success.

I am feeling that I need to transform my direction vector with an additional matrix, so it will point in the right direction all the time, but I cannot figure out how o_o

Does anyone know what the mistake is, or knows a way how to implement this movement?


问:
Unable to show image in HTML
I have the next markup.

In my page when try run it I get an 404 error.

But if I past the url right into browser the image is ok.
Whats is wrong?

```<code><div><img
      src="https://web.whatsapp.com/pp?e=https%3A%2F%2Fpps.whatsapp.net%2Fv%2Ft61.24694-24%2F69967158_105130884210215_5937970591215107630_n.jpg%3Foe%3D5E4A86E5%26oh%3Dd44d882a44d05134b2770b848964d524&t=s&u=558196302385-1574472598%40g.us&i=1574472599"
      alt="">
  </div>
</code>```

Here is the image in my browser:

答:
when you add a image in html you should make sure that your site is working correctly at your side whatsapp web is open and you are copying a image link but at the same side when i run this code image is not appearing it means that this url is temporary when you login to your whatsapp on web a new url is made every single time so you can't embed this url but on the same side if you copy a image url from facebook it will give you an output because facebook shares your profile globally but on whatsapp your profile is private so you cannot use whatsapp data in that way.
Hope you understand because i'm very weak in english.</p>

Title: Unable to show image in HTML

Body:
I have the next markup.

In my page when try run it I get an 404 error.

But if I past the url right into browser the image is ok.
Whats is wrong?

Here is the image in my browser:


问:
Write a typesafe 'pick' function in typescript
lodash has the pick function which is used as follows:

```<code>var object = { 'a': 1, 'b': '2', 'c': 3 };

_.pick(object, ['a', 'c']);
// => { 'a': 1, 'c': 3 }
</code>```

I would like to write a type-safe version of this in typescript.

Usage of this function should be

```<code>pick(object, "a", "b")
</code>```

The goal is to conserve type safety.

Is this possible to achieve?

答:
With Object.fromEntries (es2019):

function pick<T extends object, K extends keyof T> (base: T, ...keys: K[]): Pick<T, K> {
  const entries = keys.map(key => ([key, base[key]]));
  return Object.fromEntries(entries);
}
```

Body:
lodash has the pick function which is used as follows:

var object = { 'a': 1, 'b': '2', 'c': 3 };

_.pick(object, ['a', 'c']);
// => { 'a': 1, 'c': 3 }

I would like to write a type-safe version of this in typescript.

Usage of this function should be

pick(object, "a", "b")

The goal is to conserve type safety.

Is this possible to achieve?


问:
Incorrect value for big integers sqlite
So in short when inserting huge integers to sqlite3 database like example 302140846680178689 it ends up saved as 302140846680178700 and I don't know why sometimes the last 1-2 digits are incorrect.

I say sometimes because it isn't consistent. For example 197918569894379520 will  remain 197918569894379520.

Python code to recreate (I'm using 3.7.6 64bit):

import sqlite3
conn = sqlite3.connect("example.db")

some_id = 302140846680178689
c = conn.cursor()
c.execute("CREATE TABLE example(one TEXT, two INTEGER, three BIG INT)")
c.execute("INSERT INTO example VALUES (?,?,?)", (some_id, some_id, some_id))
conn.commit()
conn.close()
```

<p>The resulting table looks like: </p>

```+--------------------+--------------------+--------------------+
|     one(TEXT)      |    two(INTEGER)    |   three(BIG INT)   |
+--------------------+--------------------+--------------------+
| 302140846680178689 | 302140846680178700 | 302140846680178700 |
+--------------------+--------------------+--------------------+
```

<p>I expected same result for integer and big int as per point 3.1.1. of the docs it seems big int is just another name for integer and it will be integer regardless? Sqlite will internally manage the size as quote <code>INTEGER. The value is a signed integer, stored in 1, 2, 3, 4, 6, or 8 bytes depending on the magnitude of the value.</code></p>

<p>So the maximum size for integer seems to be 2^63-1 which is big enough to fit <code>302140846680178689</code> and it also doesn't seem to be some rounding error from the module as <code>print(int(float(302140846680178689)) - 302140846680178689)</code> gives <code>-1</code> and yet I have difference of 11.</p>

<p>Update: Giving more info as per questions in comments</p>

```print(sqlite3.version)
> 2.6.0

print(sqlite3.sqlite_version)
> 3.28.0

c.execute("SELECT typeof(two) FROM example;")
print(c.fetchall())
> [('integer',)]
```

<p>Adding this at end of script:</p>

```print(type(some_id))
> <class 'int'>
```

答:
Ok so the irony is that I myself didn't test the code I posted with manual queries.

I didn't want to manually make queries with code just to view data but instead I used sqlite viewer, more specifically https://sqliteonline.com/

Now I tested with manual query from code and it returned the correct value however opening the database in that viewer returns incorrect values for some reason (it really didn't occur to me that the viewer was at fault since it's literally just queryingSELECT * FROM example, now I even tried different versions of it and still the same incorrect result).

Edit reply from dev: The viewer works on the library "SQLite.js" and the maximum number in JavaScript is 9007199254740991 so any number more will be rounded.

Title: Incorrect value for big integers sqlite

Body:
So in short when inserting huge integers to sqlite3 database like example 302140846680178689 it ends up saved as 302140846680178700 and I don't know why sometimes the last 1-2 digits are incorrect.

I say sometimes because it isn't consistent. For example 197918569894379520 will  remain 197918569894379520.

Python code to recreate (I'm using 3.7.6 64bit):

import sqlite3
conn = sqlite3.connect("example.db")

some_id = 302140846680178689
c = conn.cursor()
c.execute("CREATE TABLE example(one TEXT, two INTEGER, three BIG INT)")
c.execute("INSERT INTO example VALUES (?,?,?)", (some_id, some_id, some_id))
conn.commit()
conn.close()

The resulting table looks like:

+--------------------+--------------------+--------------------+
|     one(TEXT)      |    two(INTEGER)    |   three(BIG INT)   |
+--------------------+--------------------+--------------------+
| 302140846680178689 | 302140846680178700 | 302140846680178700 |
+--------------------+--------------------+--------------------+

I expected same result for integer and big int as per point 3.1.1. of the docs it seems big int is just another name for integer and it will be integer regardless? Sqlite will internally manage the size as quote INTEGER. The value is a signed integer, stored in 1, 2, 3, 4, 6, or 8 bytes depending on the magnitude of the value.

So the maximum size for integer seems to be 2^63-1 which is big enough to fit 302140846680178689 and it also doesn't seem to be some rounding error from the module as print(int(float(302140846680178689)) - 302140846680178689) gives -1 and yet I have difference of 11.

Update: Giving more info as per questions in comments

print(sqlite3.version)
> 2.6.0

print(sqlite3.sqlite_version)
> 3.28.0

c.execute("SELECT typeof(two) FROM example;")
print(c.fetchall())
> [('integer',)]

Adding this at end of script:

print(type(some_id))
> <class 'int'>


问:
How to redirect to another component after checking conditions in angular 8?
I am new to Angular 8 and i am making a login component and after entering username password i want to redirect to another component using route thats my code i have done this much :

my login component.ts:

```<code>       import { Component, OnInit } from '@angular/core';
       import{FormGroup,FormBuilder,Validators} from '@angular/forms'

@Component({
  selector: 'app-login',
  templateUrl: './login.component.html',
  styleUrls: ['./login.component.css']
})
export class LoginComponent implements OnInit {
  myForm:FormGroup
  submitted=false;
  _baseURL : string;
  formvalid: boolean;
   user:string;
   pwd:string;
  constructor(private formbuilder:FormBuilder){}

  ngOnInit(){
    this.myForm = this.formbuilder.group({
    username:['',Validators.required],
    password:['',[Validators.required,Validators.pattern("^(?=.*?[a-z])(.{13,}|(?=.*?[A-Z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,12})$")]]
    });
    this._baseURL="";
    this.formvalid=false;
  }

  Submitme(){
    this.submitted = true;

    if (this.myForm.invalid) {
      this.formvalid=false;
        return;
    }
    if (this.myForm.valid) {
      this.formvalid=true;
    this._baseURL= 'Welcome'+" "+ this.myForm.controls.username.value;
  }
  this.user=this.myForm.controls.username.value;
  this.pwd=this.myForm.controls.password.value;
}
rest(){
  this.myForm.reset();
  this.submitted = false;
}
}
</code>```

my login component html is:

```<code>        <h1 class="text-center" [hidden]="formvalid">Login</h1>
          <form [formGroup]="myForm" (ngSubmit)="Submitme()" class="text-center">
           <div class="container bg-dark" [hidden]="formvalid" style="border: 1px solid black;">
         <div class="row mt-3">
           <div class="col-lg-5">
         <label for="name" class="text-white">Username :</label>
         </div>
         <input type="text" formControlName="username" class="col-lg-4 form-control"
           [ngClass]="{ 'is-invalid': submitted && myForm.controls.username.errors }">
          <div *ngIf="submitted && myForm.controls.username.errors" class="text-danger">
            <div *ngIf="myForm.controls.username.errors.required">First Name is required</div>
        </div>
       </div>
     <div class="row mt-2">
           <div class="col-lg-5">
       <label for="pwd" class="text-white">Password :</label>
         </div>
      <input type="password" formControlName="password" class="col-lg-4 form-control"
      [ngClass]="{ 'is-invalid': submitted && myForm.controls.password.errors }">
       <div *ngIf="submitted && myForm.controls.password.errors" class="text-danger">
     <div *ngIf="myForm.controls.password.errors.required">password is required</div>
      <div *ngIf="myForm.controls.password.errors.pattern">Pwd must contain atleast one upper and
    lower case character one special character one digit and 8 characters in length  </div>
   </div>
    </div>
     <button class="btn btn-primary mt-2 mb-3" type="submit"
   [routerLink]="'/afterlog'">Submit</button>
     <input type="button" (click)="rest()" value="Reset" class="btn btn-primary mt-2 mb-3">
 </div>
      </form>
</code>```

After login i want to redirect to another component with welcome message using routing in angular 8:
Thanks in advance!!!!

答:
Define routes in your module file (eg. app.module):

```<code>import { RouterModule, Routes } from '@angular/router';

const appRoutes: Routes = [
  { path: 'welcome', component: WelcomeComponent },
];

@NgModule({
   imports: [
    RouterModule.forRoot(appRoutes)
  ],
  ...
})
</code>```

And in your login component:

```<code>import { Router } from '@angular/router';

constructor(private formbuilder: FormBuilder, private _router: Router) { }

Submitme() {
  ...
  this._router.navigateByUrl('/welcome');  // open welcome component
}
</code>```

For more details refer here.

Body:
I am new to Angular 8 and i am making a login component and after entering username password i want to redirect to another component using route thats my code i have done this much :

my login component.ts:

       import { Component, OnInit } from '@angular/core';
       import{FormGroup,FormBuilder,Validators} from '@angular/forms'

@Component({
  selector: 'app-login',
  templateUrl: './login.component.html',
  styleUrls: ['./login.component.css']
})
export class LoginComponent implements OnInit {
  myForm:FormGroup
  submitted=false;
  _baseURL : string;
  formvalid: boolean;
   user:string;
   pwd:string;
  constructor(private formbuilder:FormBuilder){}

  ngOnInit(){
    this.myForm = this.formbuilder.group({
    username:['',Validators.required],
    password:['',[Validators.required,Validators.pattern("^(?=.*?[a-z])(.{13,}|(?=.*?[A-Z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,12})$")]]
    });
    this._baseURL="";
    this.formvalid=false;
  }

  Submitme(){
    this.submitted = true;

    if (this.myForm.invalid) {
      this.formvalid=false;
        return;
    }
    if (this.myForm.valid) {
      this.formvalid=true;
    this._baseURL= 'Welcome'+" "+ this.myForm.controls.username.value;
  }
  this.user=this.myForm.controls.username.value;
  this.pwd=this.myForm.controls.password.value;
}
rest(){
  this.myForm.reset();
  this.submitted = false;
}
}

my login component html is:

Login

          <form [formGroup]="myForm" (ngSubmit)="Submitme()" class="text-center">

         Username :

         <input type="text" formControlName="username" class="col-lg-4 form-control"
           [ngClass]="{ 'is-invalid': submitted && myForm.controls.username.errors }">

First Name is required

       Password :

      <input type="password" formControlName="password" class="col-lg-4 form-control"
      [ngClass]="{ 'is-invalid': submitted && myForm.controls.password.errors }">

password is required

Pwd must contain atleast one upper and
    lower case character one special character one digit and 8 characters in length

     <button class="btn btn-primary mt-2 mb-3" type="submit"
   [routerLink]="'/afterlog'">Submit</button>
     <input type="button" (click)="rest()" value="Reset" class="btn btn-primary mt-2 mb-3">

      </form>

After login i want to redirect to another component with welcome message using routing in angular 8:
Thanks in advance!!!!

Body:
Define routes in your module file (eg. app.module):

import { RouterModule, Routes } from '@angular/router';

const appRoutes: Routes = [
  { path: 'welcome', component: WelcomeComponent },
];

@NgModule({
   imports: [
    RouterModule.forRoot(appRoutes)
  ],
  ...
})

And in your login component:

import { Router } from '@angular/router';

constructor(private formbuilder: FormBuilder, private _router: Router) { }

Submitme() {
  ...
  this._router.navigateByUrl('/welcome');  // open welcome component
}

For more details refer here.


问:
Kakfa Partition in Docker
I have Kubernetes ckuster created with kafka pods.
I am using docker image confluentinc/cp-kafka:5.3.2 for this.

I want to add more partition to it.
Can you let me know if there is a config or env in confluentinc/cp-kafka:5.3.2 to change the partition size

答:
User topic-partition counts are not a docker environment variable

You can increase partitions using kafka-topics command

Kafka topic partitions

Title: Kakfa Partition in Docker


问:
Using Bitbucket, how do I get commits from one branch into another?
At my new job, where we use git with Bitbucket, we have a master branch, a new-features branch and a fix-these branch.

I've been making all my changes to the fix-these branch. After committing them, I push them to origin/fix-these using SourceTree. So far, so good.

In Bitbucket, how do I make the fix-these branch so that it includes the few commits that have been made recently to new-features? (And then I just "pull origin/fix-these" to make my local copy current, right?)

答: You cant, you'll have to use git commands. Would have been nice with a web interface for it like pull requests.</p>


问:
Blazor, new layout Indexes
I understand that in Blazor you can't have two pages with the page address as "/"

But say you're using a separate layout for the not found layout, how would you specify the default page?

```<code><Router AppAssembly="@typeof(Program).Assembly">
<Found Context="routeData">
    <AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
</Found>
<NotFound>
    <CascadingAuthenticationState>
        <LayoutView Layout="@typeof(NotFoundLayout)">
            <h1>404</h1>
            <p>Sorry, there's nothing at this address.</p>
        </LayoutView>
    </CascadingAuthenticationState>
</NotFound>
</code>```

In a Blazor app I set Index.razor to target MainLayour, with the page as "/",
I then created a not found page to target NotFoundLayout, with the page as "/" also.

I thought this would work but it did not.

So how would you specify the default page to be rendered in @body for the NotFoundLaout?

Thanks in advance :)

答:
Why would you do such a thing ?

However, do the following:

Create your NotFoundLayout component like this:

NotFoundLayout.razor

```<code>  @inherits LayoutComponentBase

  <div class="main">
   <div class="content px-4">
      @Body
   </div>
  </div>

  @code {}
</code>```

In App.razor use this:

```<code><LayoutView Layout="@typeof(NotFoundLayout)">
        <h1>404</h1>
        <p>Sorry, there's nothing at this address.</p>
         <p>BlazorApp2 is the namespace where the Pages folder
         resides, in which the Index component live. You can use a
         using directive instead :)</P>
        <BlazorApp2.Pages.Index />
</LayoutView>
</code>```

That is all.
Note: All you have to do is render the Index component within the LayoutView element. Run your app, enter a faulty url, and you'll see '404' , 'Sorry, there's nothing at this address.', and the content rendered by the Index element. Remember, all the content within the opening LayoutView element and closing LayoutView element is of RenderFragment delegate type, known conventionally as ChildContent, and it is made available to your NotFoundLayout component via the LayoutComponentBase.Body parameter property

Hope this helps...

Title: Blazor, new layout Indexes

Body:
I understand that in Blazor you can't have two pages with the page address as "/"

But say you're using a separate layout for the not found layout, how would you specify the default page?

<Router AppAssembly="@typeof(Program).Assembly">
<Found Context="routeData">
    <AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
</Found>
<NotFound>
    <CascadingAuthenticationState>
        <LayoutView Layout="@typeof(NotFoundLayout)">

404

Sorry, there's nothing at this address.

        </LayoutView>
    </CascadingAuthenticationState>
</NotFound>

In a Blazor app I set Index.razor to target MainLayour, with the page as "/",
I then created a not found page to target NotFoundLayout, with the page as "/" also.

I thought this would work but it did not.

So how would you specify the default page to be rendered in @body for the NotFoundLaout?

Thanks in advance :)

Body:
Why would you do such a thing ?

However, do the following:

Create your NotFoundLayout component like this:

NotFoundLayout.razor

  @inherits LayoutComponentBase

  <div class="main">
   <div class="content px-4">
      @Body
   </div>
  </div>

  @code {}

In App.razor use this:

<LayoutView Layout="@typeof(NotFoundLayout)">
        <h1>404</h1>
        <p>Sorry, there's nothing at this address.</p>
         <p>BlazorApp2 is the namespace where the Pages folder
         resides, in which the Index component live. You can use a
         using directive instead :)</P>
        <BlazorApp2.Pages.Index />
</LayoutView>

That is all.
Note: All you have to do is render the Index component within the LayoutView element. Run your app, enter a faulty url, and you'll see '404' , 'Sorry, there's nothing at this address.', and the content rendered by the Index element. Remember, all the content within the opening LayoutView element and closing LayoutView element is of RenderFragment delegate type, known conventionally as ChildContent, and it is made available to your NotFoundLayout component via the LayoutComponentBase.Body parameter property

Hope this helps...


问:
Text exceeding maximum height and width of the container
desktop:

mobile devices:

Hello I have a problem my text is passing my maximum height
I would like my container to follow the height and that my text has maximum width of my container my text

code:

```<code><div className="App">
  <div class="wrapper">
    <div className="text">
      <div class="card-info">
        <div class="card-about">
          <a class="card-tag tag-news">NEWS</a>
          <div class="card-time">6/11/2018</div>
        </div>
      </div>
      <h3 className="textxd">dasssssssssssssssss</h3>
      <p className="textxd">
        aaaaaaaaaaaaa dasuhdasudhu dasuhduashu aaaaaaaaaaaaa dasuhdasudhu
        dasuhduashu aaaaaaaaaaaaa da aaaaaaaaaaaaa dasuhdasudhu dasuhduashu
        aaaaaaaaaaaaa dasuhdasudhu dasuhduashu aaaaaaaaaaaaa dasuhdasudhu
        dasuhduashu aaaaaaaaaaaaa dasuhdasudhu dasuhduashusuhdasudhu
        dasuhduashu aaaaaaaaaaaaa dasuhdasudhu dasuhduashu
      </p>
    </div>
  </div>
</div>
</code>```

css:

```<code>.App {
  padding: 20px;
  font-family: sans-serif;
  text-align: center;
  background: red;
  height: 40vh;
}

.wrapper {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 30vh;
  max-height: 30vh;
  border-radius: 10px;
  cursor: pointer;
  background:blue;

}
.textxd {
  margin-top: 10px;
  margin-bottom: 5px;
}
.text {
  height: 100%;
  max-height: 30vh;
  padding: 0.15rem 1.25rem;
  color: white;
  transition: all 0.3s ease-in;
  ${({ isHover }) =>
    isHover &&
    `
  color:black;
  transition: all 0.3s ease-in;
   `}
}
.card-about {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
}
.card-tag {
  width: 60px;
  max-width: 100px;
  padding: 0.2rem 0.5rem;
  font-size: 12px;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 1px;
  background: #ffab00;
  color: #fff;
}
.card-info {
  position: relative;
}
</code>```

I do not know how I could solve this I would need to leave my container and responsive text that my container follows the height of the text or that the text has a maximum height

答:
If you want the class wrapper with the same height, then use
    overflow: scroll. like this -->

```<code>.wrapper { ...  overflow : scroll; }
</code>```

OR Else use height : auto;

```<code>.wrapper { ...  height : auto;   }
</code>```

Body:
desktop:

mobile devices:

Hello I have a problem my text is passing my maximum height
I would like my container to follow the height and that my text has maximum width of my container my text

code:

          NEWS

6/11/2018

dasssssssssssssssss

        aaaaaaaaaaaaa dasuhdasudhu dasuhduashu aaaaaaaaaaaaa dasuhdasudhu
        dasuhduashu aaaaaaaaaaaaa da aaaaaaaaaaaaa dasuhdasudhu dasuhduashu
        aaaaaaaaaaaaa dasuhdasudhu dasuhduashu aaaaaaaaaaaaa dasuhdasudhu
        dasuhduashu aaaaaaaaaaaaa dasuhdasudhu dasuhduashusuhdasudhu
        dasuhduashu aaaaaaaaaaaaa dasuhdasudhu dasuhduashu

css:

.App {
  padding: 20px;
  font-family: sans-serif;
  text-align: center;
  background: red;
  height: 40vh;
}

.wrapper {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 30vh;
  max-height: 30vh;
  border-radius: 10px;
  cursor: pointer;
  background:blue;

}
.textxd {
  margin-top: 10px;
  margin-bottom: 5px;
}
.text {
  height: 100%;
  max-height: 30vh;
  padding: 0.15rem 1.25rem;
  color: white;
  transition: all 0.3s ease-in;
  ${({ isHover }) =>
    isHover &&
    `
  color:black;
  transition: all 0.3s ease-in;
   `}
}
.card-about {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
}
.card-tag {
  width: 60px;
  max-width: 100px;
  padding: 0.2rem 0.5rem;
  font-size: 12px;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 1px;
  background: #ffab00;
  color: #fff;
}
.card-info {
  position: relative;
}

I do not know how I could solve this I would need to leave my container and responsive text that my container follows the height of the text or that the text has a maximum height

Body:
If you want the class wrapper with the same height, then use
    overflow: scroll. like this -->

.wrapper { ...  overflow : scroll; }

OR Else use height : auto;

.wrapper { ...  height : auto;   }


问:
Disable the "Weekend" on SSRS Date Type Parameter
I have a report and the report has parameter (@date) for user to pick a date.

Currently, my parameter (@date) use Parameter Properties > Default Values >  =Today() (For set today date as default paramter).

But I also want the parameter can disable the weekend days.
So the user only can select the weekday.

How can i do it ? Please help.

答:
You cannot disable weekends on the date picker. If the user selects a weekend date and that will not result in error. May I suggest using visibility to hide your tables/matrices based on the date they select?

In your table(s) properties, go to the table visibility option and use this expression:

```<code>=IIF(weekday(Parameters!YourParameterName.Value) = 1, TRUE,IIF(weekday(Parameters!YourParameterName.Value) = 7, TRUE, FALSE))
</code>```

Add a textbox after your table(s), include an "error message" in the textbox to display for users if they select a weekend date. Go to the textbox property, visibility option and use this expression:

```<code>=IIF(weekday(Parameters!YourParameterName.Value) = 1, FALSE, IIF(weekday(Parameters!YourParameterName.Value) = 7, FALSE, TRUE))
</code>```

I'm using nested IIF function in here but you can use SWITCH if desired.

The result is when a weekend date is selected, your textbox will be displayed with your message. Otherwise your table(s) will show.

Body:
You cannot disable weekends on the date picker. If the user selects a weekend date and that will not result in error. May I suggest using visibility to hide your tables/matrices based on the date they select?

In your table(s) properties, go to the table visibility option and use this expression:

=IIF(weekday(Parameters!YourParameterName.Value) = 1, TRUE,IIF(weekday(Parameters!YourParameterName.Value) = 7, TRUE, FALSE))

Add a textbox after your table(s), include an "error message" in the textbox to display for users if they select a weekend date. Go to the textbox property, visibility option and use this expression:

=IIF(weekday(Parameters!YourParameterName.Value) = 1, FALSE, IIF(weekday(Parameters!YourParameterName.Value) = 7, FALSE, TRUE))

I'm using nested IIF function in here but you can use SWITCH if desired.

The result is when a weekend date is selected, your textbox will be displayed with your message. Otherwise your table(s) will show.


问:
why is cocoapods dependency installed failed when creating a react native app?
I am a fresh man for using react native. And I am following the get started of react native on my Mac. When I use npx react-native init AwesomeProject to create a new app, then I get a result shows me:

```<code>✔ Downloading template
✔ Copying template
✔ Processing template
⠋ Installing CocoaPods dependencies (this may take a few minutes)
[!] Invalid `Podfile` file: [!] /usr/local/bin/node -e console.log(require('@react-native-community/cli').bin);

internal/modules/cjs/loader.js:796
    throw err;
    ^

Error: Cannot find module '@react-native-community/cli'
Require stack:
- /Users/rionay/Desktop/react-native/AwesomeProject/ios/[eval]
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:793:17)
    at Function.Module._load (internal/modules/cjs/loader.js:686:27)
    at Module.require (internal/modules/cjs/loader.js:848:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at [eval]:1:13
    at Script.runInThisContext (vm.js:116:20)
    at Object.runInThisContext (vm.js:306:38)
    at Object.<anonymous> ([eval]-wrapper:9:26)
    at Module._compile (internal/modules/cjs/loader.js:955:30)
    at evalScript (internal/process/execution.js:80:25) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/Users/rionay/Desktop/react-native/AwesomeProject/ios/[eval]' ]
}
.

 #  from /Users/rionay/Desktop/react-native/AwesomeProject/ios/Podfile:42
 #  -------------------------------------------
 #
 >    use_native_modules!
 #  end
 #  -------------------------------------------

✖ Installing CocoaPods dependencies (this may take a few minutes)
error Error: Failed to install CocoaPods dependencies for iOS project, which is required by this template.
Please try again manually: "cd ./AwesomeProject/ios && pod install".
CocoaPods documentation: https://cocoapods.org/
</code>```

But I have installed CocoaPods by sudo gem install cocoapods, and it shows me:

```<code>Successfully installed cocoapods-1.8.4
Parsing documentation for cocoapods-1.8.4
Done installing documentation for cocoapods after 3 seconds
1 gem installed
</code>```

So What's the problem? How can I fix it? Thank you very much!

答:
It's a bug, had the same problem this morning. I fixed it by doing

```<code>npm i @react-native-community-cli
</code>```

After that i went in the ios folder and could do pod install succesfully

Body:
I am a fresh man for using react native. And I am following the get started of react native on my Mac. When I use npx react-native init AwesomeProject to create a new app, then I get a result shows me:

✔ Downloading template
✔ Copying template
✔ Processing template
⠋ Installing CocoaPods dependencies (this may take a few minutes)
[!] Invalid `Podfile` file: [!] /usr/local/bin/node -e console.log(require('@react-native-community/cli').bin);

internal/modules/cjs/loader.js:796
    throw err;
    ^

Error: Cannot find module '@react-native-community/cli'
Require stack:
- /Users/rionay/Desktop/react-native/AwesomeProject/ios/[eval]
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:793:17)
    at Function.Module._load (internal/modules/cjs/loader.js:686:27)
    at Module.require (internal/modules/cjs/loader.js:848:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at [eval]:1:13
    at Script.runInThisContext (vm.js:116:20)
    at Object.runInThisContext (vm.js:306:38)
    at Object.<anonymous> ([eval]-wrapper:9:26)
    at Module._compile (internal/modules/cjs/loader.js:955:30)
    at evalScript (internal/process/execution.js:80:25) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/Users/rionay/Desktop/react-native/AwesomeProject/ios/[eval]' ]
}
.

 #  from /Users/rionay/Desktop/react-native/AwesomeProject/ios/Podfile:42
 #  -------------------------------------------
 #
 >    use_native_modules!
 #  end
 #  -------------------------------------------

✖ Installing CocoaPods dependencies (this may take a few minutes)
error Error: Failed to install CocoaPods dependencies for iOS project, which is required by this template.
Please try again manually: "cd ./AwesomeProject/ios && pod install".
CocoaPods documentation: https://cocoapods.org/

But I have installed CocoaPods by sudo gem install cocoapods, and it shows me:

Successfully installed cocoapods-1.8.4
Parsing documentation for cocoapods-1.8.4
Done installing documentation for cocoapods after 3 seconds
1 gem installed

So What's the problem? How can I fix it? Thank you very much!

Body:
It's a bug, had the same problem this morning. I fixed it by doing

npm i @react-native-community-cli

After that i went in the ios folder and could do pod install succesfully


问:
A page can have only one server-side Form tag
I have read the other results, but nothing specific to my issue.

I realize having two form tags with runat="server" does not work.  My problem is that I require a form in the Master Page file to handle the menus and such, and the 'child' page of my application also requires a form tag to handle its operations.

I have tried to remove the form tag in my 'child' pages, but the code-behind doesn't see that I am using the form tag in the Master Page.  Due to this, compilation fails ("The name 'form1' does not exist in the current context")

How can I attain the goal of keeping my menus in the Master Page working, while keeping my 'child' pages from erroring out when compiling?

答:
If you go the route of removing all the form tags from all the child pages (which I would suggest), you can add a reference to the Master Page's Form tag as a property that can be accessed by the child pages.  Here would be the Master Page code behind:

```<code>public HtmlForm form1 {
    get { return this.form1; }
}
</code>```

Then you could reference from the child page:

```<code>public void MyMethod() {
    HtmlForm theForm = ((MyMasterPageType)this.Master).form1;
    theForm.Controls.Add(...);
}
</code>```

And if you set the MasterPageType in the child pages, you can reference directory with this.Master.form1 (add this to the markup page of the child page):

```<code><%@ MasterType TypeName="MyMasterPageType" %>
</code>```

Body:
If you go the route of removing all the form tags from all the child pages (which I would suggest), you can add a reference to the Master Page's Form tag as a property that can be accessed by the child pages.  Here would be the Master Page code behind:

public HtmlForm form1 {
    get { return this.form1; }
}

Then you could reference from the child page:

public void MyMethod() {
    HtmlForm theForm = ((MyMasterPageType)this.Master).form1;
    theForm.Controls.Add(...);
}

And if you set the MasterPageType in the child pages, you can reference directory with this.Master.form1 (add this to the markup page of the child page):

<%@ MasterType TypeName="MyMasterPageType" %>


问:
Replace() with Split()
I need to enter a "0" in case there's only one digit after the comma, how does replace() work in this situation?

var a = "2x 250,5";

console.log(a.replace(a.split(",")[1], a.split(",")[1] + 0));

//expected result
// 2x 250,50

//Output
//2x 2500,5```

答:
You could search for a comma, digit and end of string and add a zero at the end.

var a = "2x 250,0";

console.log(a.replace(/,\d$/, '$&0'));```

Title: Replace() with Split()


问:
Receive video data buffer by the Appsrc Gstreamer on Android JNI
I'm trying to display a received data from an UDP Socket (which already token
by a Callback from the of AppSink)

Here is my code which is supposed to display the received data :

static void
gst_native_receive_video_data(JNIEnv *env, jobject thiz, jbyteArray array) {

```<code>jbyte *data = (*env)->GetByteArrayElements(env, array, NULL);
jsize size = (*env)->GetArrayLength(env, array);

GstBuffer *buffer = gst_buffer_new_allocate(NULL, size, NULL);
gst_buffer_fill(buffer, 0, data, size);

gchar *videoConsumerString = g_strdup_printf(
        "appsrc name=source is-live=true do-timestamp=true min-latency=0 max-latency=100000000 ! video/x-raw,format=RGB,width=320,height=240,framerate=30/1 ! videoconvert ! autovideosink");
GstElement *consumer = gst_parse_launch(videoConsumerString, NULL);
g_free(videoConsumerString);

GstElement *source = gst_bin_get_by_name(GST_BIN(consumer), "source");
gst_app_src_push_buffer(GST_APP_SRC(source), buffer);
gst_element_set_state(consumer, GST_STATE_PLAYING);

gst_object_unref(source);
gst_object_unref(consumer);

(*env)->ReleaseByteArrayElements(env, array, data, JNI_ABORT);
</code>```

}

Please give me the correct way to display the received data.

Thank you in advance for your help.

P.S: I'm newbie on Gstreamer Community

答:
I fixed the issue , as the pipeline must be on another thread so i put it on another thread.
Here is the pipeline which used the read the buffer data :

```<code>pCustomData->pipeline = gst_parse_launch ("appsrc name=source ! application/x-rtp, encoding-name=H264 ! rtpjitterbuffer drop-on-latency=false latency=10 ! rtph264depay ! h264parse ! queue ! avdec_h264 ! queue ! videoconvert ! videoflip method=counterclockwise ! autovideosink",&error);
</code>```

and the method to read the received external data :

static void
gst_native_receive_video_data(JNIEnv *env, jobject thiz, jbyteArray array) {

```<code>jbyte *temp = (*env)->GetByteArrayElements(env, array, NULL);
jsize size = (*env)->GetArrayLength(env, array);

GstBuffer *buffer = gst_buffer_new_allocate(NULL, size, NULL);
gst_buffer_fill(buffer, 0, temp, size);

GstElement *source = gst_bin_get_by_name(GST_BIN(pCustomData->pipeline), "source");
gst_app_src_push_buffer(GST_APP_SRC(source), buffer);

gst_object_unref(source);

(*env)->ReleaseByteArrayElements(env, array, temp, JNI_ABORT);
</code>```

}

Body:
I'm trying to display a received data from an UDP Socket (which already token
by a Callback from the of AppSink)

Here is my code which is supposed to display the received data :

static void
gst_native_receive_video_data(JNIEnv *env, jobject thiz, jbyteArray array) {

jbyte *data = (*env)->GetByteArrayElements(env, array, NULL);
jsize size = (*env)->GetArrayLength(env, array);

GstBuffer *buffer = gst_buffer_new_allocate(NULL, size, NULL);
gst_buffer_fill(buffer, 0, data, size);

gchar *videoConsumerString = g_strdup_printf(
        "appsrc name=source is-live=true do-timestamp=true min-latency=0 max-latency=100000000 ! video/x-raw,format=RGB,width=320,height=240,framerate=30/1 ! videoconvert ! autovideosink");
GstElement *consumer = gst_parse_launch(videoConsumerString, NULL);
g_free(videoConsumerString);

GstElement *source = gst_bin_get_by_name(GST_BIN(consumer), "source");
gst_app_src_push_buffer(GST_APP_SRC(source), buffer);
gst_element_set_state(consumer, GST_STATE_PLAYING);

gst_object_unref(source);
gst_object_unref(consumer);

(*env)->ReleaseByteArrayElements(env, array, data, JNI_ABORT);

}

Please give me the correct way to display the received data.

Thank you in advance for your help.

P.S: I'm newbie on Gstreamer Community

Body:
I fixed the issue , as the pipeline must be on another thread so i put it on another thread.
Here is the pipeline which used the read the buffer data :

pCustomData->pipeline = gst_parse_launch ("appsrc name=source ! application/x-rtp, encoding-name=H264 ! rtpjitterbuffer drop-on-latency=false latency=10 ! rtph264depay ! h264parse ! queue ! avdec_h264 ! queue ! videoconvert ! videoflip method=counterclockwise ! autovideosink",&error);

and the method to read the received external data :

static void
gst_native_receive_video_data(JNIEnv *env, jobject thiz, jbyteArray array) {

jbyte *temp = (*env)->GetByteArrayElements(env, array, NULL);
jsize size = (*env)->GetArrayLength(env, array);

GstBuffer *buffer = gst_buffer_new_allocate(NULL, size, NULL);
gst_buffer_fill(buffer, 0, temp, size);

GstElement *source = gst_bin_get_by_name(GST_BIN(pCustomData->pipeline), "source");
gst_app_src_push_buffer(GST_APP_SRC(source), buffer);

gst_object_unref(source);

(*env)->ReleaseByteArrayElements(env, array, temp, JNI_ABORT);

}