白龙吟

文章 评论 浏览 615

白龙吟 2025-02-05 05:21:00

我试图玩高度和宽度值。我认为这可以帮助您。

@keyframes bounce2 {
  0% {
    transform: translate(0, -300%);
    height: 120px;
  }
  12% {
    height: 120px;
  }
  20% {
    transform: translate(0, 0);
    height: 90px;
    width: 110px;
  }
  40% {
    transform: translate(0, -150%);
    height: 110px;
    width: 100px;
  }
  50% {
    height: 110px;
    width: 100px;
  }
  60% {
    transform: translate(0, 0);
    height: 95px;
    width: 105px;
  }
  80% {
    transform: translate(0, -75%);
    height: 95px;
  }
  100% {
    transform: translate(0, 0);
  }
}

I tried to play with height and width values. I think it can help you.

@keyframes bounce2 {
  0% {
    transform: translate(0, -300%);
    height: 120px;
  }
  12% {
    height: 120px;
  }
  20% {
    transform: translate(0, 0);
    height: 90px;
    width: 110px;
  }
  40% {
    transform: translate(0, -150%);
    height: 110px;
    width: 100px;
  }
  50% {
    height: 110px;
    width: 100px;
  }
  60% {
    transform: translate(0, 0);
    height: 95px;
    width: 105px;
  }
  80% {
    transform: translate(0, -75%);
    height: 95px;
  }
  100% {
    transform: translate(0, 0);
  }
}

仅使用CSS和HTML进行一次弹跳,每次连续弹跳的高度降低。

白龙吟 2025-02-04 21:29:03

您是否尝试过:

let sorted = await Sensor.findById(req.params.id).sort({
  "students.laps": -1
}).exec();

console.log("sorted", sorted);
}
catch (err) {
  console.log(err);
}

Have you tried:

let sorted = await Sensor.findById(req.params.id).sort({
  "students.laps": -1
}).exec();

console.log("sorted", sorted);
}
catch (err) {
  console.log(err);
}

白龙吟 2025-02-04 12:37:13

因此,如果您只需要将“ ID”替换为“类”并返回,则可以使用ExtendScript进行简单的操作。

第一个脚本打开您的svg文件,将“类”替换为“ id”,添加到文件名'_id'中,并将新的SVG文件保存到同一文件夹中:

var file = File.openDialog();
if (file) {
    file.open('r');
    var contents = file.read();
    file.close();

    contents = contents.replace(/class="/g, 'id="');

    var new_file_name = file.fullName.replace(/\.svg$/, '_id.svg');
    var new_file = File(new_file_name);
    new_file.open('w');
    new_file.write(contents);
    new_file.close();
}

第二个脚本使VICE RESSA ID:替换为“ ID”。 ',将“ _class”添加到文件名中,然后将文件保存到同一文件夹中。

var file = File.openDialog();
if (file) {
    file.open('r');
    var contents = file.read();
    file.close();

    contents = contents.replace(/id="/g, 'class="');

    var new_file_name = file.fullName.replace(/(_id\.svg|\.svg)$/, '_class.svg');
    var new_file = File(new_file_name);
    new_file.open('w');
    new_file.write(contents);
    new_file.close();
}

如果您觉得足够勇敢,可以将更新的内容保存到没有备份的情况下,将更新的内容保存到同一SVG文件中,例如:

var file = File.openDialog();
if (file) {
    file.open('r');
    var contents = file.read();
    file.close();

    contents = contents.replace(/class="/g, 'id="');
    // or 
    // contents = contents.replace(/id="/g, 'class="');

    file.open('w');
    file.write(contents);
    file.close();
}

So if all you need is to replace 'id' to 'class' and back, it can be done pretty easy with Extendscript.

The first script opens your svg file, replaces 'class' to 'id', adds to the file name '_id' and saves the new svg file into the same folder:

var file = File.openDialog();
if (file) {
    file.open('r');
    var contents = file.read();
    file.close();

    contents = contents.replace(/class="/g, 'id="');

    var new_file_name = file.fullName.replace(/\.svg$/, '_id.svg');
    var new_file = File(new_file_name);
    new_file.open('w');
    new_file.write(contents);
    new_file.close();
}

The second script makes vice versa: replaces 'id' with 'class', adds '_class' to the file name and saves the file into the same folder.

var file = File.openDialog();
if (file) {
    file.open('r');
    var contents = file.read();
    file.close();

    contents = contents.replace(/id="/g, 'class="');

    var new_file_name = file.fullName.replace(/(_id\.svg|\.svg)$/, '_class.svg');
    var new_file = File(new_file_name);
    new_file.open('w');
    new_file.write(contents);
    new_file.close();
}

If you feel brave enough you can save the updated contents into the same svg file with no backups, like this:

var file = File.openDialog();
if (file) {
    file.open('r');
    var contents = file.read();
    file.close();

    contents = contents.replace(/class="/g, 'id="');
    // or 
    // contents = contents.replace(/id="/g, 'class="');

    file.open('w');
    file.write(contents);
    file.close();
}

Adobe Illustratore在SVG图像上删除了我的类名称。我该如何防止这种情况?

白龙吟 2025-02-04 11:42:56

免责声明:此答案不会“修复”服务帐户秘密的自动创建,而是显示了如何将秘密与服务帐户相关联。

对于较新的Docker桌面4.8.1(对于Mac),您可以手动创建秘密:

kubectl apply -f - <<EOF
apiVersion: v1
kind: Secret
metadata:
  name: default-secret
  annotations:
    kubernetes.io/service-account.name: default
type: kubernetes.io/service-account-token
EOF

然后您可以通过编辑服务帐户配置,运行:

kubectl edit serviceaccounts default

您可以在末尾添加秘密,将 秘密与服务帐户联系起来。 ,就像:

apiVersion: v1
kind: ServiceAccount
metadata:
  creationTimestamp: "XXXX-XX-XXTXX:XX:XXZ"
  name: default
  namespace: default
  resourceVersion: "XXXX"
  uid: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
secrets:
- name: default-secret

之后,您可以将令牌用于所需目的。

Disclaimer: This answer will not "fix" the automatic creation of secrets for service accounts, but shows how you can associate a secret to a service account.

For the newer Docker Desktop 4.8.1 (for Mac), you can create the secret manually:

kubectl apply -f - <<EOF
apiVersion: v1
kind: Secret
metadata:
  name: default-secret
  annotations:
    kubernetes.io/service-account.name: default
type: kubernetes.io/service-account-token
EOF

And then you can associate the secret to the service account by editing the service account configuration, run:

kubectl edit serviceaccounts default

There you can add the secret, at the end, like:

apiVersion: v1
kind: ServiceAccount
metadata:
  creationTimestamp: "XXXX-XX-XXTXX:XX:XXZ"
  name: default
  namespace: default
  resourceVersion: "XXXX"
  uid: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
secrets:
- name: default-secret

After that, you'll be able to use the token for the required purposes.

Mac Kubernetes的Docker-Desktop不创建秘密或serviceAccounts

白龙吟 2025-02-04 09:47:23

在下面使用jQuery的壁橱方法

$(input).closest('.imgshow'). attr('src', e.target.result);

并完成JavaScript

$(".imgshowinput").change(function () {
readURL(this);
});
function readURL(input) {
   if (input.files && input.files[0]) {
     var reader = new FileReader();

     reader.onload = function (e) {
          $(input).closest('.imgshow'). attr('src', e.target.result);
     }

    reader.readAsDataURL(input.files[0]);
 }
}

Use closet method of jquery as below

$(input).closest('.imgshow'). attr('src', e.target.result);

and complete javascript

$(".imgshowinput").change(function () {
readURL(this);
});
function readURL(input) {
   if (input.files && input.files[0]) {
     var reader = new FileReader();

     reader.onload = function (e) {
          $(input).closest('.imgshow'). attr('src', e.target.result);
     }

    reader.readAsDataURL(input.files[0]);
 }
}

共享同一类时仅更新单个元素

白龙吟 2025-02-04 09:26:20

搜索您的Apache Server文件中的 phpinidir 。在xampp中,它在 \ apache \ conf \ extra \ httpd-xampp.conf 下。我的phpinidir指令看起来像:

<IfModule php7_module>
    PHPINIDir "P:/xampp7.3/php"
</IfModule>

Search your apache server files for PHPINIDir. In XAMPP it is under \apache\conf\extra\httpd-xampp.conf. My PHPINIDir directive looks like:

<IfModule php7_module>
    PHPINIDir "P:/xampp7.3/php"
</IfModule>

***错误*** PHP配置加载的文件是:c:/wamp64/bin/php/php8.1.0/php.ini-应该是:c:/wamp64/bin/apache/apache/apache/apache2.4.53.1/bin /php.ini

白龙吟 2025-02-04 06:17:43

据我所知,您无法避免在Java中的方法签名中指定参数。

但是我认为这是Java的重要功能,因为它是在编译时间检查参数类型,并避免将错误的参数传递给函数时出现的所有问题。

如果要避免重复和样板代码,则有很多可以提供帮助的库,例如“ Project Lombok”。

As far as i know you can't avoid specify the arguments in a method signature in Java.

But I think that it's a great feature of Java, because it's check the parameters type at compilation time and avoid all the problems that comes when you pass the wrong arguments to a function.

If you want avoid repetitive and boilerplate code there are lot of libraries to help, like "Project Lombok".

在创建对象构造函数时,如何避免重复参数名称(即几乎与对象的属性相同的名称)?

白龙吟 2025-02-04 06:02:19

在Java 8和Junit 5(木星)中,我们可以主张例外,如下所示。
使用 org.junit.jupiter.api.assertions.assertthrows

公共静态&lt; t可以扩展可投掷&gt; t essertthrows(class&lt; t&gt; endiveptype,
可执行执行)

断言,所提供的可执行文件的执行会抛出ExpectyType的例外并返回例外。

如果抛出了任何例外,或者抛出了其他类型的例外,则此方法将失败。

如果您不想对异常实例执行其他检查,请忽略返回值。

@Test
public void itShouldThrowNullPointerExceptionWhenBlahBlah() {
    assertThrows(NullPointerException.class,
            ()->{
            //do whatever you want to do here
            //ex : objectName.thisMethodShoulThrowNullPointerExceptionForNullParameter(null);
            });
}

该方法将在 org.junit.jupiter.api 中使用功能界面可执行

请参阅:

In Java 8 and JUnit 5 (Jupiter) we can assert for exceptions as follows.
Using org.junit.jupiter.api.Assertions.assertThrows

public static < T extends Throwable > T assertThrows(Class< T > expectedType,
Executable executable)

Asserts that execution of the supplied executable throws an exception of the expectedType and returns the exception.

If no exception is thrown, or if an exception of a different type is thrown, this method will fail.

If you do not want to perform additional checks on the exception instance, simply ignore the return value.

@Test
public void itShouldThrowNullPointerExceptionWhenBlahBlah() {
    assertThrows(NullPointerException.class,
            ()->{
            //do whatever you want to do here
            //ex : objectName.thisMethodShoulThrowNullPointerExceptionForNullParameter(null);
            });
}

That approach will use the Functional Interface Executable in org.junit.jupiter.api.

Refer :

Junit 5:如何断言一个例外?

白龙吟 2025-02-03 22:10:44

之所以发生这种情况,是因为您的 showmenu 函数是箭头函数。

这里请参考函数的范围,而不是组件

使用经典函数,

这是一个示例

new Vue({
  el: '#app',
  data: () => {
    return {
      open: false
    }
  },
  
  methods: {
    toggleOpen1(){
      this.open = !this.open
    },
    toggleOpen2: () => {
      this.open = !this.open
    }
  }
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app">
  <div>Open : {{ open }}</div>
  <button @click="toggleOpen1">Toggle open 1</button>
  <button @click="toggleOpen2">Toggle open 2</button>
</div>

如您所见, toggleopen1 (经典函数)方法可以正常工作,而 toggleopen2 (箭头函数)不起作用。

This happen because your showMenu function is an arrow function wich change the scope of this.

Here this refer to the scope of the function instead of the components

Use a classic function instead

Here is an example

new Vue({
  el: '#app',
  data: () => {
    return {
      open: false
    }
  },
  
  methods: {
    toggleOpen1(){
      this.open = !this.open
    },
    toggleOpen2: () => {
      this.open = !this.open
    }
  }
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app">
  <div>Open : {{ open }}</div>
  <button @click="toggleOpen1">Toggle open 1</button>
  <button @click="toggleOpen2">Toggle open 2</button>
</div>

As you can see, the toggleOpen1 (classic function) methods work whereas the toggleOpen2 (arrow function), doesn't work.

无法读取未定义的nuxt.js的属性

白龙吟 2025-02-02 23:33:17

呼叫

lines.add(input.nextLine);

需要() .nextline()末端的,因为它是扫描仪类中的一个空隙方法。它甚至可以(但通常不应该)重写:

String input = new Scanner(file).nextLine();

因为它本质上只是扫描仪对象的一部分。

The call

lines.add(input.nextLine);

Needs ( ) on the end of the .nextLine() because it is a void method within the Scanner class. it could even (but usually shouldn't) be rewritten:

String input = new Scanner(file).nextLine();

Because it is essentially just a piece of the Scanner object.

java.util.Scanner拒绝接受下一个(或任何)输入

白龙吟 2025-02-01 07:21:21

错误很明显
无法访问属性“菜”,this.props.favarites.favorites为null
由于某种原因,收藏夹对象为null,您无法访问Null对象的属性菜肴

favorite={this.props.favorites.favorites?.dishes?.some((dish) => dish._id === params.dishId)}

The error is obvious
cannot access property "dishes", this.props.favorites.favorites is null
for some reason the favorites object is null and you cannot access the property dishes of the null object

favorite={this.props.favorites.favorites?.dishes?.some((dish) => dish._id === params.dishId)}

node.js -react.js Web应用程序无法用url中的参数渲染视图

白龙吟 2025-02-01 05:53:47

您的循环访问 this.active.size()而无需任何同步。 java的 不保证(如果 ever )一个查看共享变量的线程,如果看起来不使用某种形式的同步与该线程的线程,则会看到其他线程的更改其他线程。


如果您想 poll 代码>活动列表,然后考虑执行这样的事情:

while (true) {
    synchronized(lock) {
        if (this.active.size() <= 0) break;
    }
    try {
        Thread.sleep(1000);
    }
    catch (InterruptedException ex) {
        ex.printStackTrace();
    }
}

sleep()呼叫使其他线程有机会运行。没有睡眠,运行此循环的线程将使用100%的CPU,这可能不利于您的应用程序的性能。


但是,有比民意调查更好的选择。您可以这样做才能等到活动列表变为空。

synchronized(lock) {
    while (this.active.size() > 0) {
        lock.wait();
    }
}

wait() 临时呼叫 lock ,然后等待另一个线程 notify() 锁定,最后,它在锁定之前重新锁定锁:

public void done(ThreadToolWorker worker) {
    synchronized (lock) {
        log.info("start done");
        this.active.remove(worker);
        if (active.size() > 0) {
            addWorkers();
        }
        else {
            lock.notifyAll();
        }
        log.info("done done");
    }
}

Your loop accesses this.active.size() without any synchronization. Java's memory visibility rules do not guarantee when (if ever) one thread that looks at shared variables will see changes made by other threads if the thread that's looking does not use some form of synchronization with the other threads.


If you want to poll the state of the active list, then consider doing something like this:

while (true) {
    synchronized(lock) {
        if (this.active.size() <= 0) break;
    }
    try {
        Thread.sleep(1000);
    }
    catch (InterruptedException ex) {
        ex.printStackTrace();
    }
}

The sleep() call gives other threads a chance to run. Without the sleep, the thread that's running this loop will use 100% of a CPU, which may be detrimental to the performance of your application.


But there are better options than polling. You could do this to wait until the active list becomes empty.

synchronized(lock) {
    while (this.active.size() > 0) {
        lock.wait();
    }
}

The wait() call temporarily releases the lock, then it waits for another thread to notify() the lock, and finally, it re-locks the lock before it returns:

public void done(ThreadToolWorker worker) {
    synchronized (lock) {
        log.info("start done");
        this.active.remove(worker);
        if (active.size() > 0) {
            addWorkers();
        }
        else {
            lock.notifyAll();
        }
        log.info("done done");
    }
}

为什么Java Muti-Threaded代码僵局

白龙吟 2025-02-01 04:24:01

转到文件&gt; 预订&gt; 设置

从默认用户设置中选择 liveserver config

在内部单击 lives> liveserver.settings.custombrowser 选择 chrome /代码>。

Go to Files > Prefrences > Settings

From Default User settings choose LiveServer Config

Inside it click on pen icon to the left on liveServer.settings.CustomBrowser select chrome.

如何使用VS代码更改默认浏览器,s&quort使用Live Server打开&quot?

白龙吟 2025-01-31 16:47:06

这样的事情应该解决问题:

class _TriggerState extends State<Trigger> {
  @override
  Widget build(BuildContext context) {
    MyProvider _myProv = Provider.of<MyProvider>(context);
    //
    if (isFirstRun) {
      //Set the first techincian:
      isFirstRun = false;
      // //Trigger Firestore request:
      WidgetsBinding.instance!.addPostFrameCallback((_) => _myProv.requestTasks());

    }
    return Page();
  }
}

Something like this should do the trick:

class _TriggerState extends State<Trigger> {
  @override
  Widget build(BuildContext context) {
    MyProvider _myProv = Provider.of<MyProvider>(context);
    //
    if (isFirstRun) {
      //Set the first techincian:
      isFirstRun = false;
      // //Trigger Firestore request:
      WidgetsBinding.instance!.addPostFrameCallback((_) => _myProv.requestTasks());

    }
    return Page();
  }
}

如何从回调函数调用changeNotifier?扑

白龙吟 2025-01-31 10:03:30

self.sum_of_divisor_helper(self.list1[self.x])

前缀

sum_of_divisor_helper(self.list1[self.x])

当您引用类内部的方法时,请尝试使用 self

Try

self.sum_of_divisor_helper(self.list1[self.x])

instead of

sum_of_divisor_helper(self.list1[self.x])

Use the self prefix when you're referring to a method inside of your class.

与类实施生成器

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

更多

友情链接

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文