小编Gré*_*EUT的帖子

改变Tx蓝牙Linux无效

我想用linux命令行(ubuntu 14.04)改变我的蓝牙设备的信号强度.

我发现我需要使用该命令

sudo hciconfig hci0 inqtpl
Run Code Online (Sandbox Code Playgroud)

改变信号强度,但它不起作用


sudo hciconfig hci0 inqtpl
Run Code Online (Sandbox Code Playgroud)

给我

在此输入图像描述


和hcidump

在此输入图像描述


sudo hciconfig hci0 inqtpl 2
Run Code Online (Sandbox Code Playgroud)

给我

在此输入图像描述


再次使用该命令

sudo hciconfig hci0 inqtpl
Run Code Online (Sandbox Code Playgroud)

给我与第一次完全相同的东西.没有改变.


命令

sudo bccmd psget 0x0017
Run Code Online (Sandbox Code Playgroud)

给我

Unsupported manufacturer
Run Code Online (Sandbox Code Playgroud)

谢谢你的帮助伙伴们

linux bluetooth bluetooth-lowenergy bluez

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

'L'表示UMD全局 - 编译错误

我在我的项目中使用了插件ngx-leafletangular-cli.

我正在尝试使用文档中描述的传单,例如:

在此输入图像描述

问题是当我尝试编译时出现以下错误:

在此输入图像描述

编译:

ng serve --aot
Run Code Online (Sandbox Code Playgroud)

上下文:

在此输入图像描述


我确实尝试L使用以下方式导入:

import { LeafletModule } from '@asymmetrik/ngx-leaflet';

但我在文档和github中找不到任何东西.

我确实删除了模块atm进行编译,但我需要一个解决方法.

这是package.json我使用的:

在此输入图像描述


这是我的组件内部的代码,用户'L':

@Component({
  selector: 'app-map-screens-element',
  templateUrl: './map-screens-element.component.html',
  styleUrls: [
    './map-screens-element.component.scss',
  ],
})

export class MapScreensComponent implements OnInit {
  /**
   * setting map options
   */
  public $mapOptions = {
    // we use the layer openstreetmap
    layers: [
      L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'),
    ],
    zoom: 15,
    center: L.latLng([48.866667, 2.333333]),
  };
}
Run Code Online (Sandbox Code Playgroud)

这里将模块导入我的项目:

import { LeafletModule } from …
Run Code Online (Sandbox Code Playgroud)

typescript webpack angular-cli angular ngx-leaflet

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

获取JSESSIONID值并在AngularJS中创建Cookie

我在AngularJS中使用来自客户端的Web RestFUL API.

app.controller('LoginController', [
    '$http',
    '$cookies', 

    function($http, $cookies) {
      this.credentials = {};

      this.http = $http;

      this.login = function() {
        console.log(this.credentials);

        var authdata = btoa(
            this.credentials.username +
            ':' +
            this.credentials.password
        );

        $http.defaults.headers.common['Authorization'] = 'Basic ' + authdata;

        console.log($http);

        var res = $http.post("http://API_NAME/library");

        res.success(function(data, status, header){
            alert('Successfull func');

            console.log($cookies.get('JSESSIONID'));
        });

        res.error(function(data, status, headers, config) {
            console.log('Error Log');
        });
     };
   },
]);
Run Code Online (Sandbox Code Playgroud)

然后,我有这个Http标题响应

Set-Cookie:JSESSIONID=azekazEXAMPLErezrzez; Path=/; HttpOnly
Run Code Online (Sandbox Code Playgroud)

我正在使用ngCookies获取JSESSIONID值,然后在我的浏览器中手动创建它,但我无法访问它.

我已经在StackOverflow中看到了关于此的所有帖子,但它们已被弃用或完全不清楚.

感谢您的关注和帮助.

javascript cookies http angularjs

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

无法加载资源:net::ERR_CACHE_WRITE_FAILURE

从新选项卡访问我的网站时,我总是在 chrome 上收到此消息:

无法加载资源:net::ERR_CACHE_WRITE_FAILURE

在此处输入图片说明


发生这种情况时,没有加载任何内容并且页面是空白的。使用检查器,我可以看到 app-main 是空的。

在此处输入图片说明

当我按 f5 时,网站加载良好。失败的总是选项卡上的第一个加载。

我以前从来没有遇到过这个问题,这是新的。


我使用快递作为服务器。

我使用角 7.2.7

"@angular/animations": "7.2.7",
"@angular/cdk": "^7.3.3",
"@angular/common": "7.2.7",
"@angular/compiler": "7.2.7",
"@angular/core": "7.2.7",
"@angular/forms": "7.2.7",
"@angular/http": "7.2.7",
"@angular/platform-browser": "7.2.7",
"@angular/platform-browser-dynamic": "7.2.7",
"@angular/router": "7.2.7",
"core-js": "2.6.5",
"rxjs": "6.4.0",
"typescript": "3.1.6",
"zone.js": "0.8.29",
"@angular-devkit/build-angular": "0.13.4",
"@angular/cli": "7.3.4",
"@angular/compiler-cli": "7.2.7",
"@types/core-js": "2.5.0",
"@types/node": "11.10.4",
"codelyzer": "4.5.0",
"concurrently": "4.1.0",
"webpack": "4.29.6",
Run Code Online (Sandbox Code Playgroud)

我应该调查的任何线索?


主要负责人:

我刚刚删除了我的 cookie,现在它运行良好。当我连接并再次获得 cookie 时,我会重现默认值。所以它与cookie系统有关。

google-chrome express angular angular7

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

条件CSS - 悬停 - 溢出

我想在文本太长时隐藏文本,并在将鼠标悬停在文本上时显示它。

问题是当文本没有溢出时它也会触发。如何添加条件“如果文本溢出则执行翻译,如果文本没有溢出则不执行翻译”

如果可能的话,我更喜欢css解决方案而不是javascript解决方案,以避免不必要的复杂性(每次有文本时我都需要使用它)

PS:解决方案可以是scss标记。

.case {
  cursor: pointer;
  display: flex;
  width: 10em;
  height: 3em;
  overflow: hidden;
  background-color: #444444;
  color: white;
  margin-top: 2em;
  margin-bottom: 2em;
  flex-direction: row;
  align-items: center;
}

.sp {
  width: 100%;
  height: auto;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  display: block;
}

.case:hover .sp {
  transition: 1.3s;
  overflow: inherit;
  margin-left: -100%;
  width: auto;
  text-overflow: inherit;
  transition-timing-function: linear;
}
Run Code Online (Sandbox Code Playgroud)
<div class="case">
  <span class="sp">Short text</span>
</div>

<div class="case">
  <span …
Run Code Online (Sandbox Code Playgroud)

html css

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

打字稿打字封装

在下面的例子中,我试图描述一个我想稍后使用的复杂的打字稿类型FinalType。问题是,由于它的复杂性,这种类型需要声明污染页面IntermediaryType/的中间类型IntermediaryType2

操场

type IntermediaryType = {
  decisiveKey: true,
  mutatedKey: (params: any) => void,
} | {
  decisiveKey: false,
  mutatedKey?: false,
}

interface IntermediaryType2 {
  foo?: string,
  bar?: boolean,
}

type FinalType = IntermediaryType & IntermediaryType2;

const Foo = (param: FinalType) => {}

Foo({
  decisiveKey: true,
  mutatedKey: () => {},
});
Run Code Online (Sandbox Code Playgroud)

我的问题是,有什么方法可以使中间类型无法访问,并且只允许使用FinalType?


我已经看到您可以使用括号括起部分代码,例如:

{
  type IntermediaryType = {
    decisiveKey: true,
    mutatedKey: (params: any) => void,
  } | {
    decisiveKey: false,
    mutatedKey?: …
Run Code Online (Sandbox Code Playgroud)

javascript encapsulation typescript typescript-typings

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

特定键上的部分&lt;&gt;

我有一个描述 mongodb 数据库数据的打字稿接口,如:

interface Foo {
  _id: string,
  name: string,

  fish: {
    _id: string,
    name: string,   
  },
}
Run Code Online (Sandbox Code Playgroud)

我有一种方法可以构建要插入数据库的数据,例如:

function pushNewFish() {
   const obj: Foo = {
      name: 'obiwan',

      fish: {
         name: 'kenobi',
      },
  };

  // ...
}
Run Code Online (Sandbox Code Playgroud)

问题是:我没有实现_id特定于数据库的每个元素。

我有可能使用,Partial<Foo>但这不是我要找的。

我也有可能把 every_id: string变成_id ?: string,但感觉不对。

有没有办法做到:

interface FooDatabase { ... }

type Foo = Partial<'_id', FooDatabase>;
Run Code Online (Sandbox Code Playgroud)

? 谢谢

interface typescript typescript-typings

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

全球地图消失

我在Leaflet.js中使用OpenStreetMap .

我有一张带有室内照片的地图.问题是当我放大,街道消失.你知道什么可以解决这个问题吗?技巧或提示!

在此输入图像描述

在此输入图像描述


编辑:

// Load the Map
this.map_ = L.map($(selector)[0], {
    center: [
      48.8459382,
      2.2863024,
    ],

    maxZoom: 24,
    zoom: 20,
});
Run Code Online (Sandbox Code Playgroud)

javascript openstreetmap leaflet

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

正则表达从10000到1800000

我需要检查字符串是否包含10000到1800000之间的数字.

我带来了以下正则表达式:

^[1-9][0-9]{4}$|^[0-9]{6}$|^1[0-7][0-9]{5}$|^1800000$+
Run Code Online (Sandbox Code Playgroud)

是否有更好或更优化的方式来执行它?


const regex = /^[1-9][0-9]{4}$|^[0-9]{6}$|^1[0-7][0-9]{5}$|^1800000$/;

const mustFailTests = [
  '9999',
  '15',
  '00015',
  '-15000',
  '1800001',
  '9000000',
  '0',
  '',
];

const mustWorkTests = [
  '10000',
  '1800000',
  '200000',
  '25018',
  '778410',
  '1000000',
  '1205900',
];

const start = Date.now();

mustFailTests.forEach((x) => {
  const ret = regex.test(x);

  console.log(`${x} must fail : result ${ret}`);
});

console.log('--------------------------------');

mustWorkTests.forEach((x) => {
  const ret = regex.test(x);

  console.log(`${x} must succeed : result ${ret}`);
});

for (let i = 0; i < 500000; i += 1) {
  mustWorkTests.forEach(x => …
Run Code Online (Sandbox Code Playgroud)

regex optimization mongodb

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

Prefer destructuring - already exisiting variable

my linter is giving me trouble about destructuring.

在此处输入图片说明


When I'm trying to destructure, it makes me an error, like in the following snippet :

const data = {
  status: 'example',
};

let status = 'foo';

{
  status,
} = data;

console.log(status);
Run Code Online (Sandbox Code Playgroud)

Is there any ways to use destructuration when the variable already exists?


Using let again :

const data = {
  status: 'example',
};

let status = 'foo';

let {
  status,
} = data;

console.log(status);
Run Code Online (Sandbox Code Playgroud)

javascript destructuring node.js ecmascript-6 eslint

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