小编Ale*_*xei的帖子

Typescript 对类型参数类的泛型约束

如何对 TypeScript 类型参数施加约束。在 c# 中,您可以使用构造{ where T:class}?

type-constraints typescript

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

如何获取 og_object 或共享 url 的 Facebook 帖子?

博客网站上的文章发布在多个 Facebook 页面上,我需要获取包含特定文章 url 的 facebook 帖子 url 列表。

可以og_object使用此请求通过文章 url 获取详细信息:

https://graph.facebook.com/v2.5/?id=http://spoilednyc.com/2015/02/10/16-bucket-list-must-dos-real-new-yorkers&access_token=ACCESS_TOKEN
Run Code Online (Sandbox Code Playgroud)

结果将是:

 "og_object": {
"id": "794284920664423",
"description": "New York City has so much to offer beyond the attractions most known to tourists. Want to go off the beaten path, here are some suggestions for you.",
"title": "Beyond the Tourist Attractions: 16 Bucket List Must-Dos for 'Real' New Yorkers",
"type": "article",
"updated_time": "2016-02-19T11:21:26+0000",
"url": "http://spoilednyc.com/2015/02/10/16-bucket-list-must-dos-real-new-yorkers/"
},
"share": {
"comment_count": 0,
"share_count": 15247
},
"id": "http://spoilednyc.com/2015/02/10/16-bucket-list-must-dos-real-new-yorkers"
}
Run Code Online (Sandbox Code Playgroud)

从这一点上,我可以找到,例如,使用的评论列表 …

facebook-graph-api

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

如何在另一个路由组中添加路由组..Laravel 5

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

Route::group(['middleware' => 'cors'], function(Router $router){

});

Route::group([

  'prefix' => 'api/v1',
  'namespace' => 'Api'

], function () {

    Route::post('/auth/register', [
    'as' => 'auth.register',
    'uses' => 'AuthController@register'
  ]);

  Route::post('/auth/login', [

    'as' => 'auth.login', …
Run Code Online (Sandbox Code Playgroud)

routes laravel-5

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

如何将dll文件添加到Git Repository

我正在使用 bitbucket 来托管我的 git 存储库。我添加了一个名为 ExtLibs 的新文件夹并添加了一堆 dll。但是,当我尝试签入这些文件时,它们不会出现在 SourceTree 中。

如何将包含(dll)文件的文件夹添加到 repo?

我从这里使用 .gitignore (c#/VS2013)

在此处输入图片说明

git bitbucket atlassian-sourcetree sourcetree

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

如何在 GPT-3 上保存预训练的 API?

我有一个关于 GPT-3 的问题。正如我们所知,我们可以给网络提供一些例子并“调整”模型。

  1. 向模型展示示例。
  2. 保存这些示例。
  3. 重用 API。

import openai

class Example():
    """Stores an input, output pair and formats it to prime the model."""
def __init__(self, inp, out):
    self.input = inp
    self.output = out

def get_input(self):
    """Returns the input of the example."""
    return self.input

def get_output(self):
    """Returns the intended output of the example."""
    return self.output

def format(self):
    """Formats the input, output pair."""
    return f"input: {self.input}\noutput: {self.output}\n"


class GPT:
    """The main class for a user to interface with the OpenAI API.
    A …
Run Code Online (Sandbox Code Playgroud)

python gpt-3

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

Angular - iPhone/iPad上的ng-blur问题

我用 AngularJS 1.4.7

我有可编辑的输入.如果我们专注于输入后,点击该输入区域外,脚本会做功能"save()"ng-blur.一切都正常工作,但iPhone 5/6iPad不起作用(在不执行任何东西ng-blur).我不知道为什么,但我推断出这个问题在focus/touch起作用.有人知道问题出在哪里?

javascript iphone ios angularjs

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

如何检测手机是否连接android auto

我正在开发一个音频播放器应用程序,我需要确定用户的设备何时连接到 Android Auto。

该应用程序具有警报功能,我想确保它不会在用户开车时响起。

为了确定我的音乐服务 ( MediaBrowserService) 是否工作,我可以在 onCreate 和 onDestroy 中使用一些标志,或者为“com.google.android.gms.car.media.STATUS”操作注册接收器- 但这是一个坏主意,因为闹钟可以随时触发。不仅是当我的音乐服务运行时。

对于警报,我使用AlarmManager和待定意图。

也许有人面临类似的问题?

java android alarmmanager android-auto

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

AMP:如何更改amp-accordion标题的背景颜色?

我试图改变amp-accordion中标题的背景颜色.我能够做到这一点的唯一方法是应用.-amp-accordion-header无效的样式.

background-color amp-html

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

C# Selenium ChromeDriver:以管理员身份运行时 Google Chrome 失败

我在 Chrome 中使用 Selenium Web Driver C# 时遇到了一个常见情况:如果运行测试的进程是“以管理员身份运行”(Visual Studio 或 nunit3-console.exe)Chrome 将无法加载。

语境

  • 操作系统:Windows 7 x64
  • Chrome:版本 64.0.3282.167(官方版本)(64 位)
  • Selenium.Chrome.WebDriver (chromedriver.exe): 2.35.0
  • 本地政策不允许 chrome 扩展

脚步

  1. 启动一个也会初始化驱动程序的测试

    var options = new ChromeOptions();
    
    //TODO: check if really needed
    options.AddAdditionalCapability("useAutomationExtension", false);
    options.AddArguments("--allow-no-sandbox-job");
    options.AddArguments("--ignore-certificate-errors");
    
    var driver = new ChromeDriver(options);
    
    Run Code Online (Sandbox Code Playgroud)
  2. ChromeDriver 启动成功:

    Starting ChromeDriver 2.35.528161 (5b82f2d2aae0ca24b877009200ced9065a772e73) on
    port 61771
    Only local connections are allowed.
    
    DevTools listening on ws://127.0.0.1:12890/devtools/browser/e50864bd-9c30-445c-a3f8-e33d6b6e5b49
    
    Run Code Online (Sandbox Code Playgroud)
  3. Chrome 已打开,但该选项卡无法加载

chrome 失败选项卡

  1. 如果我在附加时刷新选项卡,我会收到以下异常信息:

WebDriver.dll 中发生了“System.InvalidOperationException”类型的异常,但未在用户代码中处理

附加信息:会话未创建异常

从选项卡崩溃

(会话信息:chrome=64.0.3282.167)

(驱动信息: chromedriver=2.35.528161 (5b82f2d2aae0ca24b877009200ced9065a772e73),platform=Windows NT 6.1.7601 SP1 x86_64) …

selenium google-chrome selenium-chromedriver selenium-webdriver

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

尝试通过ng update升级到Angular Material 8时,获得了@ angular / *版本〜9.0.0-next-0。为什么会有这种差异?

我正在尝试使用此处的说明将Angular 7应用程序升级到Angular 8 。一切顺利,直到最后一步:

ng更新@ angular / material

这将Angular Material软件包更新为8.1.2,但也将@ angular / *软件包升级为一个相当奇怪的不需要的版本:〜9.0.0-next.0

Angular Material 7-> 8升级效果

这是有问题的(我不得不摆脱一个非必需的dev依赖关系,该依赖关系要求Angular <= 8),因为我不想超越最新的稳定版本8

我该如何解决?

angular angular8 angular-material-8

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