unity – Check if Animation State exists before playing it

In Legacy Animation Component of Unity Engine, I want to check if a specific Animation Clip exists in Animation Componenet, or not.

            animationComponenet.Play("clipName");

I have same script attached to different GameObjects. So, there is only a difference of 1,2,3 as ending of the clip name.
For example, GameObject1 has “clipname1”, GameObject2 has “clipname2” as Clips. ANd there are a number of GameObjects like this.
But, I want the same script to play different clips.
So, what I want to do is to call this method “animationComponent.Play(clipname):”.

But since, there is different clips attached to different GameObjects so I want to check before calling Play method.

Like, some way to know if the Animation Componenet contains “clipname1” or “clipname2”. I tried currently “try, catch” way.

    try
    {
        anim.Play(clip1Name);


    }
    catch 
    {
        try
        {
            anim.Play(clip1Name+"1");


        }
        catch 
        {
            try
            {
                anim.Play(clip1Name + "2");


            }
            catch 
            {
                anim.Play(clip1Name + "3");


            }
        }
    }

In order to avoid any Null Reference Exception as error should lead to catch which should succesfully run any animation. But, try/catch doesn’t work. As it is still throwing Null Reference Exception which stops execution if an animation clip is not found.

What would be the most suitable way that it tries different names but still doesn’t throw any Null Reference Exception.

postgresql – psql command, how to enforce certificate check?

I have created a cockroachdb v20.1.0 cluster based on this: https://www.cockroachlabs.com/docs/stable/deploy-cockroachdb-on-premises.html

I have also created a test user like this:

CREATE USER test with password '****';
CREATE DATABASE test;
GRANT ALL ON DATABASE test TO test;
SHOW GRANTS ON DATABASE test;
SHOW GRANTS FOR test;

Then I have created a unix user called test, and tried to connect to this database.

I put this into .pgpass:

localhost:26257:test:test:*****

If I try to connect with psql client, everything seems to be fine:

psql --host=localhost -d test -p 26257

psql (12.2 (Ubuntu 12.2-4), server 9.5.0)
SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES128-GCM-SHA256, bits: 128, compression: off)
Type "help" for help.

test=> 

The connection is encrypted with TLSv1.0, the authentication succeeds.

However, if I try to connect with cocroachdb sql command, then it fails:

$ cockroach sql --host=localhost --user=test                                                                                130 ↵
#
# Welcome to the CockroachDB SQL shell.
# All statements must be terminated by a semicolon.
# To exit, type: q.
#
ERROR: cannot load certificates.
Check your certificate settings, set --certs-dir, or use --insecure for insecure clusters.

problem with CA certificate: not found
Failed running "sql"

It is clearly stated in the cockroachdb docs ( https://www.cockroachlabs.com/docs/stable/authentication.html#client-authentication ) that the cockroachdb client always needs a CA certificate to validate the node’s certificate.

In the postgresql documentation ( https://www.postgresql.org/docs/12/libpq-ssl.html ) they say the following:

By default, PostgreSQL will not perform any verification of the server
certificate. This means that it is possible to spoof the server
identity (for example by modifying a DNS record or by taking over the
server IP address) without the client knowing. In order to prevent
spoofing, the client must be able to verify the server’s identity via
a chain of trust.

This documentation also tells that when “sslmode is set to verify-full” then libpq will verify the server’s certificate.

However, I do not see any command line option (for the psql command!) to turn on certification verification forcedly.

Is there an environment variable or a command line option for psql that will enforce certificate check for the connection?

8 – How to get drupal to check for a twig template in the active theme folder before checking the module folder?

I’m developing a contrib module for Drupal 8 that sends email notifications to group members when new content has been posted in groups they have subscribed to. The module defines some new view modes for nodes and comments. It then uses these new view modes to render the contents of the emails it sends out. The module defines a theme hook suggestion for each view mode and supplies a twig template for each view mode.

It works fine as is. The twig templates from within the module are utilized without a problem. What I’m not understanding is why copies of these templates placed within the active theme are not utilized. I’m familiar with the process of copying an existing twig template into a theme to be modified. But no matter what I do the template from the module is always used in this case. It was my understanding Drupal searches for suitable twig templates in the theme first and then works backward but perhaps my module is missing something.

Here are code samples for more details.

Define the view mode for comments – in modules/contrib/group_subscription/config/install/core.entity_view_mode.comment.group_subscription_immediate

langcode: en
status: true
dependencies:
  module:
    - comment
id: comment.group_subscription_immediate
label: 'Group Subscription Immediate (comment)'
targetEntityType: comment
cache: true

Define the theme hook suggestion – in modules/contrib/group_subscription/group_subscription.module

/**
 * Implements hook_theme()
 */
function group_subscription_theme($existing, $type, $theme, $path) {
  return (
    'comment__group_subscription_immediate' => (
      'base hook' => 'comment',
    )
  );
}

/**
 * Implements hook_theme_suggestions_comment_alter()
 */
function group_subscription_theme_suggestions_comment_alter(array &$suggestions, array $variables) {
  if ($variables('elements')('#view_mode') == 'group_subscription_immediate') {
    $suggestions() = 'comment__group_subscription_immediate';
  }
}

Please let me know if there is anything else I can provide to help me figure this out. I’ve been working with Drupal for years but am still relatively new to D8 and this is my first attempt at creating a module to give back. Thanks in advance!

sharepoint on prem – Check permissions not accurate for AD Group changes

I’ve removed a user from an AD group, though check permissions is still showing them as having permissions due to that group.

I’m aware of WindowsTokenLifetime, but that is set to 10 hours, while the check permissions is still wrong after 16 hours. Is there a different token that expires on a different schedule? At what point will check permissions show accurate data after a change in windows group membership?

This is SharePoint 2019.

check if one expression can be transformed into another

My question is how to use Mathematica to check if one expression can be transformed into another:

Example 1:
$ax^2+bx+c$ into $Kcdot(x+alpha)^2+beta$, and then show me $K(a,b,c)$ and so on.

Example 2:
Say I have the Maxwell equations:

$nabla cdot mathbf{E} = frac{rho}{varepsilon_0}$, $nabla times mathbf{E} = -dot {mathbf{B}}$, $nabla cdot mathbf{B} = 0$, $nabla times mathbf{B} = mu_0 (varepsilon_0 mathbf{j} + dot{mathbf{E}})$.

Can I follow from this an expression of the form $alpha ddot {mathbf{E}}+beta mathbf{E}=0$?

Example 3:
$c_1 cos(omega t) + c_2 sin(omega t)$ into $A cos (omega t + delta)$. How do I mark the dependencies, so that $A$ is $A(c_1, c_2)$ but not $A(t)$?

How do I check what is in my iCloud Music Library?

I wanted to switch my Apple Store country but I got a warning that I have an iCloud music library that will be lost if I switch countries. But I looked in the music app at “My Library” and there weren’t any songs in there. Where can I see what is in my iCloud music library?

Check out my tech site

Advertising

y u no do it?

Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

Starts at just $1 per CPM or $0.10 per CPC.

language agnostic – How to check whether module or class is network interface, socket?

Background

Simplifying, assume I want to write some tool for code-analysis, which tell me which files – class/module – are/have some kind of network interface(s). No matter if it’s REST Controller, DB connection, RPC or simple socket.

Restrictions

I want to achive this automatically. What do I mean by that? I don’t want to use any regex stuff to search network-specific keywords in method names or strings like GET, POST, other http operations, URLs, IP addresses and other things which are related to certain protocol. I want to obtain if class use some socket operations under the hood. Even if it’s app build on e.g http framework, and all network operations are hidden in deeper dependencies.

Example

We have some REST controller, which listen on particular URL. If we use some HTTP framework, then probably such controller is injected as dependency to other class and this class is injected to other class and so on, where finally we have some network socket which listen on low level network interface. I assume that every programming environment has some atomic socket abstraction, or couple of such, which are used by every network interface.

Question

How can I properly fulfill such requirements? The goal is to indicate places where are located network inputs and outputs of the system. Can I achieve that using tool written in only one programming language or do I have to write individual tool every technology?

PS. Post is language-agnostic in general, but some example in java or python would be helpful.

Super Fast Dedicated Server in Thailand, check thaihosting.asia special deals! | NewProxyLists

Thaihosting.asia is an IT service company and has since 1995 dealt with the Internet, operation and development. Our product areas include commercial web hosting, server hosting, domain registration, shopping systems, payment solutions, content management systems and IT outsourcing. Thaihosting.asia have always, and will always be known for service, quality and stability. It is our mission to provide quality services at reasonable prices, as well as provide our customers with a personal and unique service. We will not just be an anonymous supplier, but a professional partner.

Get a dedicated server in Thailand, hosted in a modern data center in Bangkok. Choose between Intel Core i3 and Xeon processors and get up to 32 GB of RAM – with no monthly traffic limit on your connection. We use the latest generation Supermicro hardware to deliver dedicated servers here in Thailand, which enables us to deliver dedicated servers with excellent performance and reliability. Bandwidth for our Thai servers is provided by a number of different domestic and international ISPs. This means you get a fast and stable connection 24/7. Our Danish and Thai team will help you get your Thai server up and running fast. We provide 24/7 support for all of our dedicated server products. Read more about our Hostingcenter in Bangkok.

Features of our Dedicated Servers in Thailand:

  • Supports all popular operating systems such as CentOS, Ubuntu, Debian and Windows
  • All Thai servers come with IPMI interface for remote management and console access
  • Directly connected to the biggest Thai ISPs for blazing fast national transfers
  • Full Root or Administrator access
  • Support is available 24/7 by chat and e-mail.
  • Gigabit Ethernet support

30-day money back guarantee on all Thai servers!

Server Thai Basic
฿3,900/ mo
Intel Core i3-6100 @ 3.70GHz 2 cores
100 Mbps network
1 TB SATA3 HD
Unlimited Bandwidth
8 GB RAM
Configure

Server Thai Business
฿4,900/ mo
Intel Xeon E3–1240v5 @ 3.50GHz 4 cores
100 Mbps network
2 TB SATA3 HD
Unlimited Bandwidth
16 GB RAM
Configure

Server Thai RAID
฿5,900/ mo
Intel Xeon E3–1240v5 @ 3.50GHz 4 cores
100 Mbps network
2×2 TB SATA3 HD
Unlimited Bandwidth
32 GB RAM
Configure

– Add 1 Extra IP Address for 150 Baht / month
– Upgrade to 1 Gbps shared line for 1,000 Baht / month

Strong hosting services in green data center:

  • Free support, daily backups and effective protection against viruses and spam.
  • We build your server, manage your IT and keeps technology running.

What you see above are the servers we always have in stock. However, should you have any special hardware requirements, you are more than welcome to Contact us. You can also catch us on the live chat (bottom of every page) around the clock. You are never alone if you choose Thaihosting.asia as your partner.

Powershell Check Scheduled Task Status

I’ve got a PS1 script that is automatically run by Windows Task Scheduler and checks the status of a different scheduled task on the same machine.

If ((Get-ScheduledTask  -CimSession Sever1 -TaskName Task1).State -eq 'Disabled')
    {
    Do Something
        }
    Exit
    }
ElseIf ((Get-ScheduledTask  -CimSession Sever1-TaskName Task1).State -eq 'Ready')
    {
    Exit
    }

When I run this manually through a Powershell ISE window this works fine, however when I run this script from Windows Task Scheduler it will not return the state of the other task, it’s just blank. Why does this not work when running it as a scheduled task? Is there a different command or parameter that I need to use?