当梦初醒

文章 评论 浏览 31

当梦初醒 2025-02-21 02:13:26

在项目 root 中创建一个.postCSSRC文件

Create a .postcssrc file in your project root

Tailwind CSS与React App不起作用 - 无影响

当梦初醒 2025-02-21 00:27:18

仅在调用功能时运行。您必须在循环中调用 main()

while True:
    main()
    correct = input("Does this look correct? ")
    if correct.upper() == "NO":
        print("Let's try again then")
    else:
        print("Have a great day then!")
        break

Functions only run when they're called. You have to call main() in the loop.

while True:
    main()
    correct = input("Does this look correct? ")
    if correct.upper() == "NO":
        print("Let's try again then")
    else:
        print("Have a great day then!")
        break

Python忽略了这一部分代码

当梦初醒 2025-02-21 00:25:35

CSP标头指令对应于IFRAMES,

  • FRAFER-SRC
  • 框架-AnceStors

可以说您的网站 xyz.com 和Google的网站“ Google.com”。
网站xyz.com有自己的CSP可以控制,

    1. 谁可以加载xyz.com作为iframe,由 frame-ancestors决定指令
    1. 谁可以在'xyz.com'中加载为iframe,由 frame-src 指令

相同的方案适用于Google.com(他们的CSP可以决定,他们可以在其应用程序中加载为iframe;可以将Google.com加载为iFrame)

每个HTML文档都有自己的CSP响应标头,不会干扰其主机应用程序(父帧)或其IFRAMES(子框架)。

xyz.com 的CSP仅决定谁应该加载它&除此之外

​站点是否应作为框架加载。

可详细参考:

CSP Header directive corresponding to iframes ,

  • frame-src
  • frame-ancestors

lets say your site xyz.com and google's site "google.com".
Site xyz.com has its own csp which can controls,

    1. Who can load xyz.com as iframe, decided by frame-ancestors directive
    1. Who can be loaded inside 'xyz.com' as iframe, decided by frame-src directive

same scenario applies for google.com ( whose csp can decide, whom to be loaded as iframe inside its app & whom can load google.com as iframe )

Each html document has its own csp response header, which will not interfere with its host app (parent frame) or its iframes (child frames).

xyz.com 's CSP only decides whom should load it & whom it should load as frame, it cannot control its host frame or child frame ( they are considered as separate entities )

Apart from this another header X-FRAME-OPTIONS is also available with minimal control options to decide whether a site should load as frame or not.

For detailed reference :

加载在iframe物质的站点或只是我的网站的CSP标头?

当梦初醒 2025-02-20 21:21:56
df %>%
  group_by(patient) %>%
  slice_tail(n=2) %>%
  filter(n()==2) %>%
  ungroup()
df %>%
  group_by(patient) %>%
  slice_tail(n=2) %>%
  filter(n()==2) %>%
  ungroup()

最后2个观测值分组序列

当梦初醒 2025-02-20 17:49:04

在Windows下的完整Oracle客户端的情况下,我们确实遇到了此错误“数据库:错误:错误在试图检索错误的错误ORA-01804”中,并且我们花了很长时间才能解决它。在笔记本电脑上,指向bin-folder的路径变量中的Oracle客户端已经设置了通过Pythons脚本设置的唯一需要设置的环境变量,这是一个:

os.putenv('ld_library_path','c:c:c:c:c:c:c:c:c:c:c: \ ora19c64 \ product \ 19.3.0 \ client_64 \ bin')

这不是直观的指向ld_library_path到bin-folter而不是lib折叠器,但它解决了问题。

With a full Oracle client under Windows we did run into this error “DatabaseError: Error while trying to retrieve text for error ORA-01804” as well and it took us quite a while to solve it. With on the laptop the Oracle client in the Path-variable pointing to the bin-folder and with TNS_ADMIN already set the only needed environment variable to be set via the Pythons script was this one:

os.putenv('LD_LIBRARY_PATH', 'C:\Ora19c64\product\19.3.0\client_64\bin')

It is not intuitive to point for LD_LIBRARY_PATH to the bin-folder instead of the lib-folder, but it solved the issue.

DB Connect失败Python CX_oracle -ORA -01804

当梦初醒 2025-02-20 08:53:00

另一种方式

col2_df = pd.DataFrame(df["Col2"].tolist())

Another way

col2_df = pd.DataFrame(df["Col2"].tolist())

python pandas-在数据框架中仅爆炸一列

当梦初醒 2025-02-19 23:34:50

放置-params 不是一种类型,它是一个值。

考虑使用新的安装代码:

int* buf = new int;
int* a = new(buf)(int);

如果我们围绕 buf 删除括号,则编译器可以轻松地检测 buf 不是类型。

int* a = new buf(int); // compile error

即使我们创建了一个名为 buf 的类型,规则首先找到内部范围中的名称:

class buf {         // found second
    buf(int) {}
};

int main() {
    int *buf = new int;  // found first
    int* a = new buf(int); // compile error
    return 0;
}

根据此答案当类型和值处于相同的范围时,首先找到该值。例如:

class buf {         // found second
    buf(int) {}
};
int *buf = new int;  // found first

int main() {
    int *a = new buf(int);  // compile error
    return 0;
}

placement-params is not a type, it is a value.

Consider this code with a placement new:

int* buf = new int;
int* a = new(buf)(int);

If we remove parenthesis around buf, the compiler can easily detect buf is not a type.

int* a = new buf(int); // compile error

Even if we create a type named buf, by the name lookup rules, the name in the inner scope is found first:

class buf {         // found second
    buf(int) {}
};

int main() {
    int *buf = new int;  // found first
    int* a = new buf(int); // compile error
    return 0;
}

According to this answer, when type and value are in a same scope, the value is found first. For example:

class buf {         // found second
    buf(int) {}
};
int *buf = new int;  // found first

int main() {
    int *a = new buf(int);  // compile error
    return 0;
}

可以重写新的编译吗?

当梦初醒 2025-02-19 18:57:41

好吧,在面对这个问题大约两个月后,我终于发现Vuetify和Tailwind CSS遇到一些问题,如果您遇到同样的问题并且实际上使用Vuetify + Tailwind CSS考虑使用前缀用于尾翼类

https://tailwindcss.com/docs/configuration#prefix

Well after facing this problem for about 2 months I finally find out that vuetify and tailwind css have some problems working together, if you are facing same problem and actually are using vuetify + tailwind css consider using prefix for tailwind classes

https://tailwindcss.com/docs/configuration#prefix

tailwindcss-填充和保证金不在响应式断点上工作

当梦初醒 2025-02-19 12:59:04

浮点数使用2的指数,而不是10。

10^100 ~ 1.1429873912822749822157835483053 x 2^332.

相反,尽管2^332具有99个重要数字,但它可以完全表示为浮点。

Floating-point uses exponents of 2 not 10.

10^100 ~ 1.1429873912822749822157835483053 x 2^332.

Conversely, though 2^332 has 99 significant digits, it can be represented exactly as a float.

为什么1E100不能完全代表64位浮动?

当梦初醒 2025-02-19 09:24:06

并不完全熟悉,但是从逻辑上讲,这是有道理的:

函数返回未来,完成后,返回字节。 实际执行异步FN时,它将移动 x ,这是具有生命周期的参考。从技术上讲,X 可以在未来完成之前删除。为了防止这种情况

Not entirely familiar, but logically it makes sense:

The function returns a Future that, when completed returns a byte. When the async fn is actually executed, it moves x, which is a reference with a lifetime. Technically x could be dropped before the Future is completed. To prevent this the lifetime trait guarantees that the return value of the function lives at least as long as x

什么是IMPH特征+ '生命周期

当梦初醒 2025-02-19 08:09:03
let network = ['ABC', 'DES', 'FDD', 'BGR']; 
for (i = 0; i < network.length; i++) {
 temp = "<span style = 'border:3px dotted #399bff;'>" + network[i] + "</span>"
  if (i != network.length-1) {
  temp +=" <bold style = 'color : #d77300;'> <i class='fa fa-long-arrow-right'></i></bold>";
  }
 network[i] = temp; 
} 
console.log(network.join());

如果要打印箭头执行的条件最后1
[ network.length -1 ]

let network = ['ABC', 'DES', 'FDD', 'BGR']; 
for (i = 0; i < network.length; i++) {
 temp = "<span style = 'border:3px dotted #399bff;'>" + network[i] + "</span>"
  if (i != network.length-1) {
  temp +=" <bold style = 'color : #d77300;'> <i class='fa fa-long-arrow-right'></i></bold>";
  }
 network[i] = temp; 
} 
console.log(network.join());

an if condition to print arrows execpt last 1
[ network.length - 1 ]

显示最后的索引箭头问题

当梦初醒 2025-02-19 06:36:11

如果您浏览kotlin的 collections 包装包装有很多whoooole poxpare您可以使用的东西,是的!许多不同的功能使您可以深入研究特定的数据(例如键或值与条目,或提供索引)或在处理集合时获得特定的行为。

您给出的示例基本上都是同一回事。 函数在各种类型的集合上:

inline fun <T> Array<out T>.forEach(action: (T) -> Unit)
(source)

// a bunch of other Kotlin-specific Array types

inline fun <T> Iterable<T>.forEach(action: (T) -> Unit)
inline fun <K, V> Map<out K, V>.forEach(
    action: (Entry<K, V>) -> Unit)
inline fun <T> Iterator<T>.forEach(operation: (T) -> Unit)

这是这些集合的源代码(每个函数下都有一个源链接 很有用!

public inline fun <T> Iterable<T>.forEach(action: (T) -> Unit): Unit {
    for (element in this) action(element)
}

public inline fun <K, V> Map<out K, V>.forEach(action: (Map.Entry<K, V>) -> Unit): Unit {
    for (element in this) action(element)
}

public inline fun <T> Iterator<T>.forEach(operation: (T) -> Unit): Unit {
    for (element in this) operation(element)
}

主页, rel =“ nofollow noreferrer”> basic for 循环,正如文档所说迭代。您的示例基本上与正在发生的事情相同,只是在 foreach -&gt中的各个点跳入;循环基础 - &gt;获取迭代器进程。

唯一不同的部分是当您调用条目时,返回 set 保留键/值 entry 配对 - 因此您正在迭代那,而不是地图本身。但是,等等,如果您在 MAP 上调用 iterator(),会发生什么

public inline operator fun <K, V> Map<out K, V>.iterator(): Iterator<Map.Entry<K, V>> = entries.iterator()

它使用条目本身!所以,是的,他们都是一样的


,我认为这取决于这

  • 不需呼叫 hasnext()在其上或任何
  • 适合Kotlin的声明样式,可以链接,并自动通过变量传递,而不是您必须声明它们
  • 有时是基本的 循环对于您正在做的事情更可读,尤其是在修改某种结果 actibal时(这与 fold <更可比) /代码> foreach ,但无论如何
  • 条目 map 意味着您在链条链时要明确有关正在使用的内容 foreach 上您如何指定或值仅与这些范围 for each 相同,但它更清楚

If you browse through Kotlin's Collections package there is a whoooole lot of stuff you can use, yeah! Lots of different functions that let you drill down into specific pieces of data (like keys or values vs entries, or providing indices) or getting specific behaviour as you process a collection.

The examples you've given are all basically the same thing though. Here's the page for all the forEach functions on the various types of collections:

inline fun <T> Array<out T>.forEach(action: (T) -> Unit)
(source)

// a bunch of other Kotlin-specific Array types

inline fun <T> Iterable<T>.forEach(action: (T) -> Unit)
inline fun <K, V> Map<out K, V>.forEach(
    action: (Entry<K, V>) -> Unit)
inline fun <T> Iterator<T>.forEach(operation: (T) -> Unit)

And here's the source code for those (there's a source link under every function's main page, useful to know about! You can see exactly how they work)

public inline fun <T> Iterable<T>.forEach(action: (T) -> Unit): Unit {
    for (element in this) action(element)
}

public inline fun <K, V> Map<out K, V>.forEach(action: (Map.Entry<K, V>) -> Unit): Unit {
    for (element in this) action(element)
}

public inline fun <T> Iterator<T>.forEach(operation: (T) -> Unit): Unit {
    for (element in this) operation(element)
}

So really they're all wrappers for a basic for loop, which as the documentation says, iterates through anything that provides an iterator. Your examples are all basically the same thing that's happening, just jumping in at various points in the forEach -> basic for loop -> get an iterator process.

The only part that's different is when you call entries, which returns a Set holding the key/value Entry pairs - so you're iterating over that, rather than the Map itself. But wait, what does happen if you call iterator() on a Map?

public inline operator fun <K, V> Map<out K, V>.iterator(): Iterator<Map.Entry<K, V>> = entries.iterator()

It uses entries itself! So yeah they're all the same thing


Really I think it comes down to this

  • no need to call iterator() on anything unless you know you need one for some reason, like you're going to be calling hasNext() on it or whatever
  • forEach fits with Kotlin's more declarative style, can be chained, and automatically passes in variables instead of you having to declare them
  • sometimes a basic for loop is more readable for what you're doing though, especially if you're modifying some kind of result variable (which is more comparable to a fold than a forEach but anyway
  • accessing entries on a Map means you're being explicit about what you're working with when you chain a forEach onto it, similar to how you can specify keys or values and only work with those. It's the same as just calling forEach on the map itself, but it's clearer

如何在科特林的地图上迭代

当梦初醒 2025-02-18 18:48:23

f的值不应该为0?

使用标准C,没有。使用 scanf(“%d”,&amp; i) int 溢出,结果为 undfeined

使用 scanf() in unix (哪个(哪个)有变化),我发现没有预防溢出的不确定行为。

最好抛弃(不使用) scanf()并使用 fgets()用于所有用户输入。


代码可以尝试文本宽度限制和更广泛的类型:

intmax_t bigd;
//          vv --- width limit
if (scanf("%18jd",&bigd) == 1 && bigd >= INT_MIN && bigd <= INT_MAX) {
  d = (int) bigd;
} else {
  puts("Oops");
}

然而,在 int 的新颖实现上却有困难,宽度与 intmax_t 一样宽。


scanf()返回0时找到 int 找到的文本输入。

OP的问题中缺少的关键设计元素是超过 int 范围的用户输入应该发生什么?第一个“ 333333333”之后停止阅读?

什么是最佳,取决于OP想要如何详细处理错误条件 - 尚未说明的事情。

Shouldnt the value of f be 0?

With standard C, no. With scanf("%d",&i), on int overflow, the result is undefined.

With scanf() in Unix (of which there are variations), I find no prevention of undefined behavior with overflow.

Best to ditch (not use) scanf() and use fgets() for all user input.


Code could try a textual width limit and a wider type:

intmax_t bigd;
//          vv --- width limit
if (scanf("%18jd",&bigd) == 1 && bigd >= INT_MIN && bigd <= INT_MAX) {
  d = (int) bigd;
} else {
  puts("Oops");
}

Yet that has trouble on novel implementations where int is as wide as intmax_t.


scanf() returns 0 when no int textual input found.

A key design element missing from OP's questions is what should happen to user input that exceeds the int range? Stop reading after the first `"333333333"?

What is best, depends on how OP wants to handle, in detail, error conditions - something not yet stated.

scanf()无法检测到错误输入

当梦初醒 2025-02-18 14:42:33

我已经为Angularjs创建了一个指令 - 受到Geekymonkey的答案的重大启发,但没有jQuery依赖。

demo: “ nofollow”> http://plnkr.co/eedit/8tppczijvo3vsapsettyr?预览

markup

&lt; div class =“ fittext” max-font-size =“ 50” text =“您的文本都在这里...”&gt;&lt;&lt;/div&GT ;

指令

app.directive('fittext', function() {

  return {
    scope: {
      minFontSize: '@',
      maxFontSize: '@',
      text: '='
    },
    restrict: 'C',
    transclude: true,
    template: '<div ng-transclude class="textContainer" ng-bind="text"></div>',
    controller: function($scope, $element, $attrs) {
      var fontSize = $scope.maxFontSize || 50;
      var minFontSize = $scope.minFontSize || 8;

      // text container
      var textContainer = $element[0].querySelector('.textContainer');

      angular.element(textContainer).css('word-wrap', 'break-word');

      // max dimensions for text container
      var maxHeight = $element[0].offsetHeight;
      var maxWidth = $element[0].offsetWidth;

      var textContainerHeight;
      var textContainerWidth;      

      var resizeText = function(){
        do {
          // set new font size and determine resulting dimensions
          textContainer.style.fontSize = fontSize + 'px';
          textContainerHeight = textContainer.offsetHeight;
          textContainerWidth = textContainer.offsetWidth;

          // shrink font size
          var ratioHeight = Math.floor(textContainerHeight / maxHeight);
          var ratioWidth = Math.floor(textContainerWidth / maxWidth);
          var shrinkFactor = ratioHeight > ratioWidth ? ratioHeight : ratioWidth;
          fontSize -= shrinkFactor;

        } while ((textContainerHeight > maxHeight || textContainerWidth > maxWidth) && fontSize > minFontSize);        
      };

      // watch for changes to text
      $scope.$watch('text', function(newText, oldText){
        if(newText === undefined) return;

        // text was deleted
        if(oldText !== undefined && newText.length < oldText.length){
          fontSize = $scope.maxFontSize;
        }
        resizeText();
      });
    }
  };
});

I've created a directive for AngularJS - heavely inspired by GeekyMonkey's answer but without the jQuery dependency.

Demo: http://plnkr.co/edit/8tPCZIjvO3VSApSeTtYr?p=preview

Markup

<div class="fittext" max-font-size="50" text="Your text goes here..."></div>

Directive

app.directive('fittext', function() {

  return {
    scope: {
      minFontSize: '@',
      maxFontSize: '@',
      text: '='
    },
    restrict: 'C',
    transclude: true,
    template: '<div ng-transclude class="textContainer" ng-bind="text"></div>',
    controller: function($scope, $element, $attrs) {
      var fontSize = $scope.maxFontSize || 50;
      var minFontSize = $scope.minFontSize || 8;

      // text container
      var textContainer = $element[0].querySelector('.textContainer');

      angular.element(textContainer).css('word-wrap', 'break-word');

      // max dimensions for text container
      var maxHeight = $element[0].offsetHeight;
      var maxWidth = $element[0].offsetWidth;

      var textContainerHeight;
      var textContainerWidth;      

      var resizeText = function(){
        do {
          // set new font size and determine resulting dimensions
          textContainer.style.fontSize = fontSize + 'px';
          textContainerHeight = textContainer.offsetHeight;
          textContainerWidth = textContainer.offsetWidth;

          // shrink font size
          var ratioHeight = Math.floor(textContainerHeight / maxHeight);
          var ratioWidth = Math.floor(textContainerWidth / maxWidth);
          var shrinkFactor = ratioHeight > ratioWidth ? ratioHeight : ratioWidth;
          fontSize -= shrinkFactor;

        } while ((textContainerHeight > maxHeight || textContainerWidth > maxWidth) && fontSize > minFontSize);        
      };

      // watch for changes to text
      $scope.$watch('text', function(newText, oldText){
        if(newText === undefined) return;

        // text was deleted
        if(oldText !== undefined && newText.length < oldText.length){
          fontSize = $scope.maxFontSize;
        }
        resizeText();
      });
    }
  };
});

自动大小动态文本以填充固定尺寸的容器

当梦初醒 2025-02-18 11:14:19

使用node.js elasticsearch客户端时,您必须将查询包装到身体属性中并将其传递给搜索。

const response = await elasticClient.search({
  index: 'index2',
  body: {
    query: {
      match_all: {}
    }
  }
});

When using the Node.js ElasticSearch client, you have to wrap the query into a body property and pass it to the search.

const response = await elasticClient.search({
  index: 'index2',
  body: {
    query: {
      match_all: {}
    }
  }
});

node.js elasticsearch响应空白_source

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

更多

友情链接

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