御弟哥哥

文章 评论 浏览 29

御弟哥哥 2025-02-21 00:17:42

尝试以下操作:

wget http://archive.apache.org/dist/httpd/httpd-2.2.3.tar.gz
tar -xf httpd-2.2.3.tar.gz
sudo ./configure --prefix=/opt/httpd --with-included-apr --with-ssl=/opt/openssl-1.0.1i --enable-ssl-staticlib-deps --enable-mods-static=ssl
sudo make
sudo make install

Try this:

wget http://archive.apache.org/dist/httpd/httpd-2.2.3.tar.gz
tar -xf httpd-2.2.3.tar.gz
sudo ./configure --prefix=/opt/httpd --with-included-apr --with-ssl=/opt/openssl-1.0.1i --enable-ssl-staticlib-deps --enable-mods-static=ssl
sudo make
sudo make install

Apache HTTPD编译(Make)错误。如何修复它?

御弟哥哥 2025-02-20 04:50:23

解决方案1

在模型类中,假设 xyz ,使用 @jsonkey 映射一个从JSON读取字段的方式。这可以用 /a>进行2个参数:json数据作为 map< string,动态> 和字段名称。这将是以下内容。另外,

import 'package:json_annotation/json_annotation.dart';

part 'xyz.g.dart';

Object? mapper(json, field) => json['name'] ?? json['aStupidName'];

@JsonSerializable(explicitToJson: true)
class XYZ {
  @JsonKey(readValue: mapper)
  String name;
  XYZ({required this.name});

  factory XYZ.fromJson(Map<String, dynamic> json) => _$XYZFromJson(json);
  Map<String, dynamic> toJson() => _$XYZToJson(this);
}

我还建议将API/DB/正常化为标准化,以始终为 name ,因此无需以这种方式注释。

解决方案2

另一方面, 可以像以下内容一样通过手工实现序列化/避难所化。只需使用操作员条件表达式 名称 astupidname 之间。

@JsonSerializable()
class XYZ {

  final String name;

  ...

  XYZ.fromJson(Map<String, dynamic> json)
    : name = json['name'] ?? json['aStupidName'],
    ...;

  Map<String, dynamic> toJson() => {
      'name': name,
      ...
  };
}

Solution 1

In the model class, let's say XYZ, use the @JsonKey to map a how a field is read from JSON. This can be done with JsonKey.readValue that takes 2 arguments: the JSON data as Map<String, dynamic> and the field name. It's going to be something like the following. Also, check out the official docs.

import 'package:json_annotation/json_annotation.dart';

part 'xyz.g.dart';

Object? mapper(json, field) => json['name'] ?? json['aStupidName'];

@JsonSerializable(explicitToJson: true)
class XYZ {
  @JsonKey(readValue: mapper)
  String name;
  XYZ({required this.name});

  factory XYZ.fromJson(Map<String, dynamic> json) => _$XYZFromJson(json);
  Map<String, dynamic> toJson() => _$XYZToJson(this);
}

I'd also recommend normalizing the API/DB/whatever itself to be always name so there is no need to annotate this way.

Solution 2

On the other hand, it's possible to implement the serialization/deserialization by hand like the following. Just use the ?? operator conditional expression between name and aStupidName.

@JsonSerializable()
class XYZ {

  final String name;

  ...

  XYZ.fromJson(Map<String, dynamic> json)
    : name = json['name'] ?? json['aStupidName'],
    ...;

  Map<String, dynamic> toJson() => {
      'name': name,
      ...
  };
}

json_serializable flutter parse并与钥匙连接与模态和映射器的映射

御弟哥哥 2025-02-20 04:13:42

您可以使用以下方法实现输出。

  1. 使用全局邮政变量。

     &lt;?php 
       全球$ post; 
       $ post_slug = $ post-&gt; post_name; 
      ?&gt;
     
  2. 使用php

     &lt;?php
       全球$ WP;
       $ current_url = $ wp-&gt; request;
       echo substr($ current_url,strrpos($ current_url,'/') + 1);
      ?&gt;
     

假设URL: https://ww.test.com /test-page/test-post/data-to-get

输出:我已经检查了数据对数据

,这对我来说是工作的。
让我知道这是否对您有用。

You can achieve your output using below methods.

  1. by using Global post variable.

     <?php 
       global $post; 
       $post_slug = $post->post_name; 
      ?>
    
  2. using PHP

     <?php
       global $wp;
       $current_url = $wp->request;
       echo substr($current_url , strrpos($current_url , '/') + 1);
      ?>
    

Suppose URL: https://ww.test.com/test-page/test-post/data-to-get

OUTPUT: data-to-get

I have checked and it's work for me.
Let me know if this works for you.

在WordPress中从URL获取slug

御弟哥哥 2025-02-19 21:02:45

您需要将 index 更改为“ index ”的“对象密钥”:

const newObj = myArr.reduce((result, value, index) => {
    result[Object.keys(myObj)[index]] = value
    return result
}, myObj)

也就是说, zip + object.fromentries 更适合这份工作:

const zip = (...args) => args[0].map((_, i) => args.map(a => a[i]));

const myObj = {
    first: null,
    second: null,
    third: null
}

const myArr = [ "abc", "def", "ghi"]

const result = Object.fromEntries(
    zip(
        Object.keys(myObj),
        myArr
    )
)

console.log(result)

You need to change index into "an object key at index":

const newObj = myArr.reduce((result, value, index) => {
    result[Object.keys(myObj)[index]] = value
    return result
}, myObj)

That said, zip + Object.fromEntries would be more appropriate for the job:

const zip = (...args) => args[0].map((_, i) => args.map(a => a[i]));

const myObj = {
    first: null,
    second: null,
    third: null
}

const myArr = [ "abc", "def", "ghi"]

const result = Object.fromEntries(
    zip(
        Object.keys(myObj),
        myArr
    )
)

console.log(result)

JS:使用Reedion()用数组元素填充对象

御弟哥哥 2025-02-19 19:00:12

如果您确实必须使用两个具有重叠标识符名称的库(我觉得您很糟糕),那么唯一的干净方法是将它们从分离的.c文件中使用。
IE制作一个.c文件,其中包括一个lib的标头和一个包括另一个lib的标题的第二个.c文件。
重叠宏定义的问题应以这种方式解决。

如果您还具有重叠的链接器标识符(函数名称,全局变量名称...),则有必要将两个代码文件分开链接到相应的LIB。

如果您必须在您编写的一个函数中使用两个LIB的功能,那么真正的麻烦就开始了。这将需要在相应的代码文件中首先将两个功能包裹在唯一命名的函数中,然后可以从另一个代码文件中毫不含糊地调用两个功能。

不要尝试用 #UNDEF 来解决您的问题,这只是一种风险(或根据墨菲法律,保证)的一种方法,即将出乎意料地使用重叠宏名称的错误定义。

简而言之,如果您认为 #UNDEF 可以帮助您,那么您的问题比您知道的要大。

这似乎是愤世嫉俗的,请理解,我只试图让您从我所做的一些严肃的焦痕体验中受益。在存在不洁的重叠符号的情况下进行调试将使您唱歌。正如我在个人资料中提到的那样,我学会了迷信地考虑 #undef 是不幸的。

但是,要回答您写的实际问题,以摆脱“重新定义”症状(不是问题,请注意),您需要在两者之间进行 #undef ,而不是以前。这样,第一个包括定义了有问题的宏。然后它不确定。然后第二个包含再次定义它,而没有看到它已经被定义。

If you really have to use two libraries with overlapping identifier names (poor you, I feel with you) then the only clean way is to use them from separated .c files.
I.e. make one .c file which includes the header for one lib and a second .c file which includes the header of the other lib.
Problems with overlapping macro definitions should be solved this way.

If you additionally have overlapping linker identifiers (function names, global variable names...), then it will be necessary to link the two code files separatly to the corresponding libs.

The real trouble starts if you then have to use functionalities from both libs in one function written by you. That will require to first wrap the two functionalities in uniquely named functions in the corresponding code files, which then can be unambigously called from another code file to use both.

Do not try to solve your problem with #undef, that is just a way to risk (or, according to murphy law, guarantee) that the wrong definition of overlapping macro names will be used unexpectedly.

In short, if you think that #undef could help you, then your problem is larger than you are aware of.

This might seem cynical, please understand that I only try to let you benefit from some serious scorch-mark experiences I made. Debugging in the presence of uncleanly overlapping symbols will get you singed. As I have mentioned in my profile, I learned to supersticiously consider #undef to be unlucky.

But, to also answer the actual question you wrote, to get rid of the "redefinition" symptom (not the problem, mind) you need to do the #undef BETWEEN the two includes, not before. That way the first include defines the problematic macro. Then it gets undefined. Then the second include defines it again, without seeing it already being defined.

#UNDEF似乎对宏重新定义没有影响(警告C4005)

御弟哥哥 2025-02-18 18:58:52
#wave.stop {
  animation-play-state: paused;
}

不将动画播放状态应用于实际动画(行)元素。
CSS规则应该看起来像这样:

#wave.stop .t {
  animation-play-state: paused;
}

我还建议使用类选择器避免不必要的高特异性
(由ID选择器在CSS规则中引入)。

var wave = document.getElementById("wave")
wave.addEventListener('click', function(e) {
  e.currentTarget.classList.toggle('stop');
})
.loader {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

#wave {
  height: 10em;
  fill: black;
}

.stop {
  border: 1px solid red;
}

.stop .t {
  animation-play-state: paused;
}

.t {
  transform-origin: center;
  animation: pulse 1s infinite forwards;
  transform: scale(1, 0.5)
}

.Line_1 {
  animation-delay: 0.15s;
}

.Line_2 {
  animation-delay: 0.3s;
}

.Line_3 {
  animation-delay: 0.45s;
}

.Line_4 {
  animation-delay: 0.6s;
}

.Line_5 {
  animation-delay: 0.75s;
}

.Line_6 {
  animation-delay: 0.9s;
}

.Line_7 {
  animation-delay: 1.05s;
}

.Line_8 {
  animation-delay: 1.2s;
}

.Line_9 {
  animation-delay: 1.35s;
}

@keyframes pulse {
  0% {
    transform: scale(1, 0.5)
  }
  50% {
    transform: scale(1, 1)
  }
  100% {
    transform: scale(1, 0.5)
  }
}
<div class="loader">
  <svg class="wave" id="wave" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 38.05">
        <path id="Line_1" class="t Line_1" data-name="Line 1" d="M0.91,15L0.78,15A1,1,0,0,0,0,16v6a1,1,0,1,0,2,0s0,0,0,0V16a1,1,0,0,0-1-1H0.91Z"/>
        <path id="Line_2" class="t Line_2" data-name="Line 2" d="M6.91,9L6.78,9A1,1,0,0,0,6,10V28a1,1,0,1,0,2,0s0,0,0,0V10A1,1,0,0,0,7,9H6.91Z"/>
        <path id="Line_3" class="t Line_3" data-name="Line 3" d="M12.91,0L12.78,0A1,1,0,0,0,12,1V37a1,1,0,1,0,2,0s0,0,0,0V1a1,1,0,0,0-1-1H12.91Z"/>
        <path id="Line_4" class="t Line_4" data-name="Line 4" d="M18.91,10l-0.12,0A1,1,0,0,0,18,11V27a1,1,0,1,0,2,0s0,0,0,0V11a1,1,0,0,0-1-1H18.91Z"/>
        <path id="Line_5" class="t Line_5" data-name="Line 5" d="M24.91,15l-0.12,0A1,1,0,0,0,24,16v6a1,1,0,0,0,2,0s0,0,0,0V16a1,1,0,0,0-1-1H24.91Z"/>
        <path id="Line_6" class="t Line_6" data-name="Line 6" d="M30.91,10l-0.12,0A1,1,0,0,0,30,11V27a1,1,0,1,0,2,0s0,0,0,0V11a1,1,0,0,0-1-1H30.91Z"/>
        <path id="Line_7" class="t Line_7" data-name="Line 7" d="M36.91,0L36.78,0A1,1,0,0,0,36,1V37a1,1,0,1,0,2,0s0,0,0,0V1a1,1,0,0,0-1-1H36.91Z"/>
        <path id="Line_8" class="t Line_8" data-name="Line 8" d="M42.91,9L42.78,9A1,1,0,0,0,42,10V28a1,1,0,1,0,2,0s0,0,0,0V10a1,1,0,0,0-1-1H42.91Z"/>
        <path id="Line_9" class="t Line_9" data-name="Line 9" d="M48.91,15l-0.12,0A1,1,0,0,0,48,16v6a1,1,0,1,0,2,0s0,0,0,0V16a1,1,0,0,0-1-1H48.91Z"/>
      </svg>
</div>

#wave.stop {
  animation-play-state: paused;
}

Doesn't apply the animation-play-state to the actually animated (line) elements.
The css rule should rather look something like this:

#wave.stop .t {
  animation-play-state: paused;
}

I also recommend to use class selectors to avoid unnecessarily high specificity
(introduced by id selectors in your css rules).

var wave = document.getElementById("wave")
wave.addEventListener('click', function(e) {
  e.currentTarget.classList.toggle('stop');
})
.loader {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

#wave {
  height: 10em;
  fill: black;
}

.stop {
  border: 1px solid red;
}

.stop .t {
  animation-play-state: paused;
}

.t {
  transform-origin: center;
  animation: pulse 1s infinite forwards;
  transform: scale(1, 0.5)
}

.Line_1 {
  animation-delay: 0.15s;
}

.Line_2 {
  animation-delay: 0.3s;
}

.Line_3 {
  animation-delay: 0.45s;
}

.Line_4 {
  animation-delay: 0.6s;
}

.Line_5 {
  animation-delay: 0.75s;
}

.Line_6 {
  animation-delay: 0.9s;
}

.Line_7 {
  animation-delay: 1.05s;
}

.Line_8 {
  animation-delay: 1.2s;
}

.Line_9 {
  animation-delay: 1.35s;
}

@keyframes pulse {
  0% {
    transform: scale(1, 0.5)
  }
  50% {
    transform: scale(1, 1)
  }
  100% {
    transform: scale(1, 0.5)
  }
}
<div class="loader">
  <svg class="wave" id="wave" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 38.05">
        <path id="Line_1" class="t Line_1" data-name="Line 1" d="M0.91,15L0.78,15A1,1,0,0,0,0,16v6a1,1,0,1,0,2,0s0,0,0,0V16a1,1,0,0,0-1-1H0.91Z"/>
        <path id="Line_2" class="t Line_2" data-name="Line 2" d="M6.91,9L6.78,9A1,1,0,0,0,6,10V28a1,1,0,1,0,2,0s0,0,0,0V10A1,1,0,0,0,7,9H6.91Z"/>
        <path id="Line_3" class="t Line_3" data-name="Line 3" d="M12.91,0L12.78,0A1,1,0,0,0,12,1V37a1,1,0,1,0,2,0s0,0,0,0V1a1,1,0,0,0-1-1H12.91Z"/>
        <path id="Line_4" class="t Line_4" data-name="Line 4" d="M18.91,10l-0.12,0A1,1,0,0,0,18,11V27a1,1,0,1,0,2,0s0,0,0,0V11a1,1,0,0,0-1-1H18.91Z"/>
        <path id="Line_5" class="t Line_5" data-name="Line 5" d="M24.91,15l-0.12,0A1,1,0,0,0,24,16v6a1,1,0,0,0,2,0s0,0,0,0V16a1,1,0,0,0-1-1H24.91Z"/>
        <path id="Line_6" class="t Line_6" data-name="Line 6" d="M30.91,10l-0.12,0A1,1,0,0,0,30,11V27a1,1,0,1,0,2,0s0,0,0,0V11a1,1,0,0,0-1-1H30.91Z"/>
        <path id="Line_7" class="t Line_7" data-name="Line 7" d="M36.91,0L36.78,0A1,1,0,0,0,36,1V37a1,1,0,1,0,2,0s0,0,0,0V1a1,1,0,0,0-1-1H36.91Z"/>
        <path id="Line_8" class="t Line_8" data-name="Line 8" d="M42.91,9L42.78,9A1,1,0,0,0,42,10V28a1,1,0,1,0,2,0s0,0,0,0V10a1,1,0,0,0-1-1H42.91Z"/>
        <path id="Line_9" class="t Line_9" data-name="Line 9" d="M48.91,15l-0.12,0A1,1,0,0,0,48,16v6a1,1,0,1,0,2,0s0,0,0,0V16a1,1,0,0,0-1-1H48.91Z"/>
      </svg>
</div>

如何在单击时停止SVG动画?

御弟哥哥 2025-02-18 15:34:33

添加高度:'100%' card父元素样式的属性,在这种情况下,具有类名称 .cards .cards 的div so:

<div className="cards" style={{ height: '100%' }}>{cardItems}</div>

可能有效。

Add height: '100%' property for the card parent element style, in this case, the div with the class name .cards like so:

<div className="cards" style={{ height: '100%' }}>{cardItems}</div>

that might work.

如何将选项卡边框与项目长度对齐?

御弟哥哥 2025-02-18 12:12:30

循环在divs上。在每个div中,使用 queryselector()查找嵌套 p ,使用 .textContent 获取其内容,并将其分配给Div的数据项目属性。

document.querySelectorAll('div.content_section_item').forEach(
    div => div.dataset.item = div.querySelector('p').innerText
);
<div class="content_section_item" data-item="">
  <img src="">
  <p>table</p>
</div>
<div class="content_section_item" data-item="">
  <img src="">
  <p>table</p>
</div>
<div class="content_section_item" data-item="">
  <img src="">
  <p>others</p>
</div>

Loop over the divs. In each div, use querySelector() to find the nested p, get its contents with .textContent, and assign that to the div's data-item property.

document.querySelectorAll('div.content_section_item').forEach(
    div => div.dataset.item = div.querySelector('p').innerText
);
<div class="content_section_item" data-item="">
  <img src="">
  <p>table</p>
</div>
<div class="content_section_item" data-item="">
  <img src="">
  <p>table</p>
</div>
<div class="content_section_item" data-item="">
  <img src="">
  <p>others</p>
</div>

如何插入a&lt; p&gt;标记为数据属性,将文本纳入其父元素?

御弟哥哥 2025-02-18 06:09:13

代码的问题是,所有类似按钮都只有一个加载标志。您需要按按钮加载标志。您应该创建一些&lt; like button /&gt; < /code>组件,该组件将具有自己的加载状态,然后在.map中使用&lt; like button /like button /like button /of。您只需要将其移动到一个级别,即按钮级别即可。还使用 MAP 内的密钥。

Problem with your code is that you have only one loading flag for all like buttons. You need loading flag per like button. You should create some <LikeButton /> component that will have it's own loading state, and then use <LikeButton /> in .map. You just need to move it one level down, to button level. Also use keys inside map.

反应:post.map()内部的单独加载按钮,例如/不喜欢

御弟哥哥 2025-02-17 13:27:16

您的代码似乎正确。检查此 link 。最好不要设置视频的高度。

        .videos {
    width: 450px;
}
table {
  border-spacing: 0;
  border-collapse: collapse;
}

your code seems correct. check this link. it is better not to set the height of your video.

        .videos {
    width: 450px;
}
table {
  border-spacing: 0;
  border-collapse: collapse;
}

如何编写代码以更改视频的宽度/高度

御弟哥哥 2025-02-17 02:18:54

您可以检查vlaue是否是nan,默认为零

isnan(arrr)?0:parseint(arrr,10))>

function steamrollArray(arr) {
  
  let myArr= arr 
  .join(" ")
  .replace(/[\s+\W+]/g," ")
  .replace(/\s+/g," ")
  .split(" ")
return myArr
.map((arrr) => isNaN(arrr)?0:parseInt(arrr,10))
}

console.log(steamrollArray([1, {}, [3, [[4]]]]))

You can check if the vlaue is NaN and default to zero

isNaN(arrr)?0:parseInt(arrr,10))

function steamrollArray(arr) {
  
  let myArr= arr 
  .join(" ")
  .replace(/[\s+\W+]/g," ")
  .replace(/\s+/g," ")
  .split(" ")
return myArr
.map((arrr) => isNaN(arrr)?0:parseInt(arrr,10))
}

console.log(steamrollArray([1, {}, [3, [[4]]]]))

我的数字或parseint()函数如何避免一个不是数字的字符串

御弟哥哥 2025-02-17 01:55:07

这个新版本的问题 0.69.0

您可以使用 0.68.2 版本。
只需执行以下操作:

npx react-nitive init projectname-version 0.68.2

This problem for new version 0.69.0

You can use 0.68.2 version.
Just execute the following:

npx react-native init ProjectName --version 0.68.2

当我使用COMAND“ NPX REACT-NITAGIT INIT SARFARAZ”安装React Antive应用程序时。

御弟哥哥 2025-02-17 01:15:05

@trepetaky我能够通过使用 pip install Chardet 安装缺失的模块片来解决此问题

@Trepetaky I was able to resolve this issue by installing the missing module chardet with pip install chardet

我可以导入请求库

御弟哥哥 2025-02-16 12:15:12

由于您的目标是按作者名称进行搜索:

result = Blog.objects.filter(Q(blog_title__icontains=search) | Q(author__name__icontains=search)

原因是作者字段确实是 furet> rutian_id ,因此除非您引用 name 链接到作者 fk 字段的字段。

但是,如果您使用的是django 用户模型,则必须说: rution__username__icontains = search 如果您是通过用户名,<代码> first_name for firstName, last_name for lastName等。对于自定义用户模型,您可以通过引用字段的名称来采用相同的方法作者__FieldName__IContains = search

Since your goal is to search by author name you should do:

result = Blog.objects.filter(Q(blog_title__icontains=search) | Q(author__name__icontains=search)

The reason is that the author field is really an author_id so it wouldn't work just like that unless you refer the name field which links to the author FK field.

But if you're using the django User model you'd have to say: author__username__icontains=search if you're searching by username, first_name for firstname, last_name for lastname, etc. For a custom User model, you'd take the same approach by referring the name of the field author__fieldname__icontains=search.

相关字段的查找无效:​​iContains(使用exourthkey时

御弟哥哥 2025-02-16 09:25:13

continue

just offering another alternative, using the proper formula

numbers = [
        2892921,
        1939929,
        2929202,
        1758690
]
def sum_n(number):
  return number*(number+1)/2
sums = [sum_n(number) for number in numbers]

print(sums)
print(sum(sums))

output:

[4184497402581.0, 1881663232485.0, 4290113643003.0, 1546496137395.0]
11902770415464.0

Speed

this is actually about 14748x faster than the previous code, as my tests:

from timeit import timeit
numbers = [
        2892921,
        1939929,
        2929202,
        1758690
]
def sum_n(number):
  return number*(number+1)/2

def sum_n_old(number):
    return sum(range(1,number+1))

def create_sums():
    sums = [sum_n(number) for number in numbers]
    return sums,sum(sums)
def create_sums_old():
    sums = [sum_n_old(number) for number in numbers]
    return sums,sum(sums)


print("@XxJames07 method",new:=timeit(create_sums,number=10)*100,"ms")
print("@matszwecja method: ",old:=timeit(create_sums_old,number=10)*100,"ms")
print("XxJames method is",f"{old/new}x times faster")

output:

@XxJames07 method 0.03255000337958336 ms
@matszwecja method:  480.06977000040933 ms
XxJames method is 14748.685719078234x times faster

总结所有组件,然后转到接下来

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

更多

友情链接

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