小编Gia*_* P.的帖子

本地主机上的 MongoDB 监控服务

是否有可以在本地主机或本地机器上运行的 MongoDB 服务器性能监控工具?我在使用 MongoDB 监控服务等第三方托管工具时担心隐私问题。

performance mongodb

5
推荐指数
1
解决办法
5959
查看次数

我们如何在 React Native 中的向下滚动事件中隐藏标签栏

我正在使用 react-native-tab-view 模块在我的应用程序中实现选项卡。选项卡工作正常,但我希望当用户向下滚动列表时,应使用动画隐藏选项卡栏。

我正在使用的模块链接,即 https://github.com/react-native-community/react-native-tab-view

这是我的代码:-

import React, { Component } from 'react';
import { View, Text, ScrollView, ActivityIndicator } from 'react-native';
import { TabViewAnimated, TabBar, SceneMap } from 'react-native-tab-view';

import styles from './Styles';

// First tab component
const FirstRoute = () => (
  <ScrollView>
    <Text>1</Text>
    <Text>1</Text>
    <Text>1</Text>
    <Text>1</Text>
    <Text>1</Text>
    <Text>1</Text>
    <Text>1</Text>
    <Text>1</Text>
    <Text>1</Text>
    <Text>1</Text>
    <Text>1</Text>
    <Text>1</Text>
    <Text>1</Text>
    <Text>1</Text>
  </ScrollView>
);

export default class BookingDetail extends Component {

  // default states
  state = {
    index: 0,
    routes: [
      { key: …
Run Code Online (Sandbox Code Playgroud)

reactjs react-native react-native-scrollview react-native-android react-native-tab-view

5
推荐指数
0
解决办法
1022
查看次数

Tailwind 与 Next 一起运行会出现语法错误

./node_modules/next/dist/compiled/css-loader/cjs.js??ruleSet[1].rules[3].oneOf[7].use[1]!./node_modules/next/dist/compiled/postcss-loader/cjs.js??ruleSet[1].rules[3].oneOf[7].use[2]!./node_modules/next/dist/compiled/resolve-url-loader/index.js??ruleSet[1].rules[3].oneOf[7].use[3]!./node_modules/next/dist/compiled/sass-loader/cjs.js??ruleSet[1].rules[3].oneOf[7].use[4]!./styles/style.scss
/home/user/node_modules/color/index.js:257
            lum[i] = (chan <= 0.039_28) ? chan / 12.92 : ((chan + 0.055) / 1.055) ** 2.4;
                              ^^^^^

SyntaxError: Invalid or unexpected token
Run Code Online (Sandbox Code Playgroud)

tailwind-css

5
推荐指数
1
解决办法
3165
查看次数

Android在React-Native App中使用Axios将图像上传到服务器时出现问题

尝试从Android上传/发布图片时出现以下网络错误。在iOS上完美运行。当FormData中不包含图像时,在Android上完美运行。

export function formatAvatarData(uri) {
  const form = new FormData();
  form.append('avatar', {
    uri: uri,
    type: 'file',
    name: 'image.jpg',
  });
  return form;
}
Run Code Online (Sandbox Code Playgroud)

iOS-[预期工作] uri: file:///Users/bobfriston/Library/Developer/CoreSimulator/Devices/16E84C5E-2545-408C-B870-38054DFA3471/data/Containers/Data/Application/7D2F59E5-450A-4A60-962A-D5C368DCD8DF/Documents/images/F5AD02D9-6C3E-46E5-B54E-D5C98206BAAA.jpg

ANDROID URI-[以下给出了网络错误] uri: content://com.google.android.apps.photos.contentprovider/0/1/content%3A%2F%2Fmedia%2Fexternal%2Fimages%2Fmedia%2F79/ORIGINAL/NONE/1408072274

Error: Network Error
    at createError (createError.js:15)
    at XMLHttpRequest.handleError (xhr.js:87)
    at XMLHttpRequest.dispatchEvent (event-target.js:172)
    at XMLHttpRequest.setReadyState (XMLHttpRequest.js:542)
    at XMLHttpRequest.__didCompleteResponse (XMLHttpRequest.js:378)
Run Code Online (Sandbox Code Playgroud)

注意:“ react-native”:“ = 0.42.3”

AndroidManifest.xml具有以下权限:

android.permission.INTERNET"
android.permission.SYSTEM_ALERT_WINDOW"/>
android.permission.CAMERA" />
android.permission.WRITE_EXTERNAL_STORAGE"/>
Run Code Online (Sandbox Code Playgroud)

android multipartform-data form-data react-native axios

4
推荐指数
2
解决办法
4320
查看次数

js代码删除字符串中数字之间的空格

有什么方法可以删除字符串中的空格吗?

var str = "商店是 5 6 7 8"

处理后输出应该是这样的:“商店是5678”

这该怎么做?

javascript

3
推荐指数
2
解决办法
2189
查看次数

如何使用MongoDB聚合框架获取最后一个子字符串?

假设我有这些文件

> db.coll.find().toArray()
[
    {
        "_id" : ObjectId("5a36c3e218948d0722457078"),
        "locality" : "Nasimi, Baku, Azerbaijan"
    },
    {
        "_id" : ObjectId("5a36c3e218948d0722457079"),
        "locality" : "Garland, TX, USA"
    },
    {
        "_id" : ObjectId("5a36c3e218948d072245707a"),
        "locality" : "Halytskyi District, Lviv, Lviv Oblast, Ukraine"
    },
    {
        "_id" : ObjectId("5a36c3e218948d072245707b"),
        "locality" : "Tozeur, Tunisia"
    }
]
Run Code Online (Sandbox Code Playgroud)

我只想获取国家/地区,即最后一个逗号 ( ', ') 之后的内容。

例如

[
    "Azerbaijan",
    "USA",
    "Ukraine",
    "Tunisia"
]
Run Code Online (Sandbox Code Playgroud)

我已经设法获取第一个逗号的索引及其后的内容,但我不知道如何获取最后一个逗号。

[
    "Azerbaijan",
    "USA",
    "Ukraine",
    "Tunisia"
]
Run Code Online (Sandbox Code Playgroud)

这是可行的,但它会将所有结果加载到 JavaScript Mongo Shell 的内存中,但如果可以使用单个 MongoDB 聚合命令来完成,那就更理想了。

db.coll
  .aggregate([
    {
      $project: {
        lastIndexOf: …
Run Code Online (Sandbox Code Playgroud)

mongodb aggregation-framework

2
推荐指数
1
解决办法
1940
查看次数

不可能复制轻字体?

我试图复制这个网站菜单的字体,但当我把风格放在我自己的WordPress CSS主题中时,我仍然得到它的大胆版本.有没有特别的技巧,所以我可以得到字体的轻版本?得到的字体与他们所拥有的相同.

css fonts webfonts google-webfonts

1
推荐指数
1
解决办法
4581
查看次数

使用MongoDB的$ graphLookup的问题

我有两个收藏。sources

[
  {
    "_id": "0001",
    "name": "John Doe"
  },
  {
    "_id": "0002",
    "address": "123 Some Place"
  },
  {
    "_id": "0003",
    "phone": "5555555555"
  }
]
Run Code Online (Sandbox Code Playgroud)

connections

[
  {
    "_id": "0001.0002",
    "_from": "0001",
    "_to": "0002",
    "probability": 0.8
  },
  {
    "_id": "0002.0003",
    "_from": "0002",
    "_to": "0003",
    "probability": 0.6
  }
]
Run Code Online (Sandbox Code Playgroud)

我正在尝试进行图遍历$graphLookup以获取所有源连接的列表。这是我的代码:

[
  {
    "_id": "0001",
    "name": "John Doe"
  },
  {
    "_id": "0002",
    "address": "123 Some Place"
  },
  {
    "_id": "0003",
    "phone": "5555555555"
  }
]
Run Code Online (Sandbox Code Playgroud)

这将返回destinations为空的数组。我希望它包含两个记录(0002和0003)。 …

mongodb graph-traversal

1
推荐指数
1
解决办法
1118
查看次数

Fabric js canvas into pdf(TCPDF)

我使用fabric.js绘制一些明信片(背景,图像,文字).我想基于这张卡创建pdf.所以我将json对象发送到php并使用foreach来获取所有元素.但是当我在同一分辨率(761x430)上创建文档并从json设置边距,位置和其他值时,pdf中的对象位置与结构js中的对象位置不同.所以我应该做的是,我的pdf中的位置与画布上的位置相同.要创建pdf我使用TCPDF.

JSON文件

{"objects":[{"type":"text","originX":"center","originY":"center","left":531.22,"top":249,"width":115,"height":31.2,"fill":"e2ddcf","stroke":null,"strokeWidth":5,"strokeDashArray":null,"strokeLineCap":"butt","strokeLineJoin":"miter","strokeMiterLimit":10,"scaleX":1.14,"scaleY":1,"angle":0,"flipX":false,"flipY":false,"opacity":1,"shadow":null,"visible":true,"clipTo":null,"backgroundColor":"","text":"MOJE T?O","fontSize":24,"fontWeight":"normal","fontFamily":"Times New Roman","fontStyle":"normal","lineHeight":1.3,"textDecoration":"","textAlign":"left","path":null,"textBackgroundColor":"","useNative":true},{"type":"image","originX":"center","originY":"center","left":63,"top":304,"width":66,"height":66,"fill":"rgb(0,0,0)","stroke":null,"strokeWidth":1,"strokeDashArray":null,"strokeLineCap":"butt","strokeLineJoin":"miter","strokeMiterLimit":10,"scaleX":1,"scaleY":1,"angle":340.06,"flipX":false,"flipY":false,"opacity":1,"shadow":null,"visible":true,"clipTo":null,"backgroundColor":"","src":"src_to_picture","filters":[]}],"background":"cyan","backgroundImage":"src_to_my_picture","backgroundImageOpacity":1,"backgroundImageStretch":true}
Run Code Online (Sandbox Code Playgroud)

PHP代码

$pdf = new MYPDF("L", "px", array(761, 430), true, 'UTF-8', false, false, $objects->backgroundImage, $objects->background);
    $pdf->SetCreator(PDF_CREATOR);
    $pdf->SetLeftMargin(0);
    $pdf->SetRightMargin(0);
    $pdf->SetHeaderMargin(0);
    $pdf->SetFooterMargin(0);
    $pdf->setPrintFooter(false);
    #$pdf->setPrintHeader(false);
    $pdf->AddPage();
    foreach ($objects->objects as $object) {
        $pdf->StartTransform();
        switch ($object->type) {
            case 'text':
                $align = $this->setAlign($object->textAlign);
                $style = $this->setStyle($object->fontStyle);
                $newColor = $this->hex2RGB($object->fill);
                $pdf->setXY($object->left, $object->top);
                $pdf->SetFont("times", $style, $object->fontSize);
                $pdf->SetTextColor($newColor['red'], $newColor['green'], $newColor['blue']);
                $pdf->MultiCell(0, $object->height, $object->text, 0, $align, false, 1, '', '', true, 0, false, true, 0, 'T', false);
                break;
            case 'image':
                $pdf->setXY($object->left, $object->top);
                $pdf->Rotate(360-$object->angle);
                $pdf->Image($object->src, $object->left, …
Run Code Online (Sandbox Code Playgroud)

php pdf json canvas

0
推荐指数
1
解决办法
3380
查看次数