小编Ish*_*han的帖子

如何在chrome扩展中使用jQuery?

我正在写一个chrome扩展名.我想jQuery在我的扩展中使用.我没有使用任何背景页面,只是一个后台脚本.

这是我的文件:

manifest.json

{
    "manifest_version": 2,

    "name": "Extension name",
    "description": "This extension does something,",
    "version": "0.1",

    "permissions": [
        "activeTab"
    ],

    "browser_action": {
        "default_icon": "images/icon_128.png"
    },

    "background": {
        "scripts": ["background.js"],
        "persistent": false
    },

    "icons": {
        "16": "images/icon_16.png",
        "48": "images/icon_48.png",
        "128": "images/icon_128.png"
    }
}
Run Code Online (Sandbox Code Playgroud)

我的background.js文件只运行另一个名为的文件work.js

// Respond to the click on extension Icon
chrome.browserAction.onClicked.addListener(function (tab) {
    chrome.tabs.executeScript({
        file: 'work.js'
    });
});
Run Code Online (Sandbox Code Playgroud)

我的扩展的主要逻辑是在里面work.js.我认为这个问题的内容并不重要.

我想问的是如何在扩展中使用jQuery.因为我没有使用任何背景页面.我不能只是添加jQuery.那么如何在我的扩展中添加和使用jQuery呢?

我尝试从background.js文件中运行jQuery和我的work.js.

// Respond to the click …
Run Code Online (Sandbox Code Playgroud)

javascript jquery asynchronous google-chrome google-chrome-extension

111
推荐指数
4
解决办法
9万
查看次数

libclntsh.so.12.1:运行node-oracledb示例时无法打开共享对象文件错误

我的目标是从Ubuntu连接到VMWare客户机(OpenSuse)上的oracle数据库.

现在我只安装了oracledb驱动程序,并尝试运行给定的示例连接程序.

我所遵循的步骤来自github INSTALL页面.到目前为止我所做的是这些:

1)因为我已经安装了node.js,所以我跳过了步骤3.1.

2)我已成功下载并解压缩了步骤3.2中提到的基本sdk.

3)因为我找不到任何命名的包,libaio但我确实找到了libaio1.所以我安装了libaio1.

4)我LD_LIBRARY_PATH在我的电脑上创建了环境变量和它的内容/opt/oracle/instantclient.

5)如步骤3.3中所述 ; 即使在我的情况下它不是强制性的; 我制作了两个环境变量:OCI_LIB_DIR内容/opt/oracle/instantclientOCI_INC_DIR内容/opt/oracle/instantclient/sdk/include.

6)已安装node-oracledb.

我正在尝试运行示例连接程序.我正在使用的代码是https://github.com/ishanatmuz/oracle-test.当我跑步时,node connect.js我收到此错误.

/home/ishan/node.js/oracle-test/node_modules/oracledb/lib/oracledb.js:28
throw err;
          ^
Error: libclntsh.so.12.1: cannot open shared object file: No such file or directory
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require …
Run Code Online (Sandbox Code Playgroud)

oracle node.js node-oracledb

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

如何在mongoDB中使用户的电子邮件独一无二?

我正在收集用户的数据.这将是非常基本的,包括用户的电子邮件,用户的密码(散列)和字符串数组.

{
    email: 'user@example.com',
    password: 'password hash',
    arr: []
}
Run Code Online (Sandbox Code Playgroud)

我想确保不能有两个相同的插入email.我读到_idmongoDB默认是唯一的,它使用一些特殊的数据结构来提高性能.

如何确保email遗骸保持唯一,如果可能,我可以利用该_id领域提供的性能优势吗?

编辑:我还想确保没有null值,email并且没有不包含该email字段的文档.

indexing mongodb

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

ImportError:运行ninja-ide时没有名为Qsci的模块

我正在尝试安装和运行ninja-ide http://ninja-ide.org/home/

但是,当我尝试运行ninja-ide时,我遇到了这个错误

ImportError: No module named Qsci
Run Code Online (Sandbox Code Playgroud)

我一直试图安装ninja-ide整夜.

我尝试了从源代码安装的所有内容,使用各种博客中提到的apt-get依赖项进行安装.

我安装了一切.SIP,PyQt4,Qscintilla,各种依赖.

我在做的Python的安装文件夹的符号链接/usr/local/include/python2.7的蟒蛇被安装在/usr/include/python2.7.

我甚至将Qsci文件夹复制/usr/include/qt4/usr/lib/python2.7/dist-packages/PyQt4/usr/local/lib/python2.7/dist-packages/PyQt4.

我现在厌倦了安装一切.我仍然无法弄清楚为什么它给了我

ImportError: No module named Qsci
Run Code Online (Sandbox Code Playgroud)

我整晚都在搜索Google和Stack Overflow.

python qscintilla

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

如何在Android和Unity之间进行通信?

我可以从互联网上的文章和Unity自己的学习部分http://unity3d.com/learn中找出如何在Android项目中嵌入一个统一项目.我遇到的麻烦是在Unity和Android之间进行通信.我需要向Unity发送一些JSON数据,其中包含要显示的数字和值以及几个图像的URL.从内部统一的场景我想做一些动画.根据用户的选择,我需要向我们的服务器发送适当的请求并打开不同的活动.

在正常的Android开发中,我会使用Bundle将信息从一个活动传递到另一个活动,但我无法弄清楚如何使用Unity和Android做同样的事情.从Unity的场景到我的应用程序的用户选择也是一个需要解决的问题.

android unity-game-engine

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

无法解析“./graphql”

我正在关注本教程https://docs.amplify.aws/start/q/integration/react/

在此步骤https://docs.amplify.aws/start/getting-started/setup/q/integration/react/#install-amplify-libraries安装aws-amplify@aws-amplify/ui-react

当我尝试像这样导入 aws-amplify 时:import Amplify from "aws-amplify"; 我在 webpack 中收到此错误:

Module not found: Error: Can't resolve './graphql' in '/home/ishan/amplify_start/node_modules/@aws-amplify/pubsub/node_modules/graphql'
Did you mean 'graphql.js'?
BREAKING CHANGE: The request './graphql' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request …
Run Code Online (Sandbox Code Playgroud)

amazon-web-services webpack graphql aws-amplify

6
推荐指数
0
解决办法
922
查看次数

animateLayoutChanges为true导致布局在android中上下移动

我将元素从一个Horizo​​ntalScrollView拖动到另一个Horizo​​ntalScrollView.

当我删除我从底部Horizo​​ntalScrollView删除视图并将其添加到顶部Horizo​​ntalScrollView.我通过设置xml来动画更改android:animateLayoutChanges="true"

这些变化正在变得生动,这不是问题所在.问题在于,无论何时触发这些动画,布局都会上下移动.当我拖动一个项目时,它会向上移动而在另一个拖动时它会向下移动.它会重复所有后续的拖累.

这是一个显示问题的视频:https://sendvid.com/uqnnwc4v

我的XMl是这样的:

<RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="320dp">
        <include layout="@layout/content_package_description_horizontal_view"/>
       ........
    </RelativeLayout>
..........
..........
..........
<HorizontalScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:scrollbars="none"
        android:scrollbarSize="0dp">
        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:animateLayoutChanges="false">
            <!-- Package list -->
            <include layout="@layout/service_single_hero"/>
            <include layout="@layout/service_single_hero"/>
            <include layout="@layout/service_single_hero"/>
            <include layout="@layout/service_single_hero"/>
            <include layout="@layout/service_single_hero"/>
            <include layout="@layout/service_single_hero"/>
            <include layout="@layout/service_single_hero"/>
            <include layout="@layout/service_single_hero"/>
            <include layout="@layout/service_single_hero"/>
            <include layout="@layout/service_single_hero"/>
            <include layout="@layout/service_single_hero"/>
            <include layout="@layout/service_single_hero"/>
            <include layout="@layout/service_single_hero"/>
            <include layout="@layout/service_single_hero"/>
        </LinearLayout>
    </HorizontalScrollView>
Run Code Online (Sandbox Code Playgroud)

我正在添加到上面的Horizo​​ntalScrollView中

// Adding to Horizontal view
    FrameLayout thisHorizontalBigItem = (FrameLayout) getLayoutInflater().inflate(
            R.layout.package_description_horizontal_item_big, null, false);
    TextView thisHorizontalBigTextView = …
Run Code Online (Sandbox Code Playgroud)

android android-animation

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

django errno 104 连接被对等方重置

我正在尝试在 AWS EC2 上的 Ubuntu 实例上运行我的 django 服务器。我正在使用 Gunicorn 来运行服务器,如下所示:

gunicorn --workers 4 --bind 127.0.0.1:8000 woc.wsgi:application --name woc-server --log-level=info --worker-class=tornado --timeout=90 --graceful-timeout=10

当我发出请求时,我在浏览器上收到 502,错误网关。这是服务器日志http://pastebin.com/Ej5KWrWs

settings.py 文件中根据主机名更改行为的某些部分是

iUbuntu 是我笔记本电脑的主机名

if socket.gethostname() == 'iUbuntu':
    '''
    Development mode
    "iUbuntu" is the hostname of Ishan's PC
    '''
    DEBUG = TEMPLATE_DEBUG = True
else:
    '''
    Production mode
    Anywhere else than Ishan's PC is considered as production
    '''
    DEBUG = TEMPLATE_DEBUG = False

if socket.gethostname() == 'iUbuntu':
    '''Development'''
    ALLOWED_HOSTS = ['*', ]
else:
    '''Production Won't …
Run Code Online (Sandbox Code Playgroud)

python django amazon-ec2 rabbitmq celery

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

Android 中的 Google 地图未调用 onClusterItemInfoWindowClick

编辑:这个问题是关于 Android 上的谷歌地图。

我正在尝试为带有聚类的标记制作自定义信息窗口。我按照这里给出的说明/sf/answers/1537528541/

我做了这些:

设置集群管理器作为信息窗口适配器

// Setting custom cluster marker manager for info window adapter
    map.setInfoWindowAdapter(mClusterManager.getMarkerManager());
    mClusterManager.getMarkerCollection().setOnInfoWindowAdapter(new MyLocationInfoWindowAdapter());
Run Code Online (Sandbox Code Playgroud)

为 clusterItem 信息窗口设置单击侦听器

mClusterManager.setOnClusterItemInfoWindowClickListener(new ClusterManager.OnClusterItemInfoWindowClickListener<LocationMarker>() {
        @Override
        public void onClusterItemInfoWindowClick(LocationMarker locationMarker) {
            Toast.makeText(context, "info window Click", Toast.LENGTH_SHORT).show();
        }
    });
Run Code Online (Sandbox Code Playgroud)

这是我的信息窗口适配器

private class MyLocationInfoWindowAdapter implements GoogleMap.InfoWindowAdapter {
    @Override
    public View getInfoWindow(Marker marker) {
        return null;
    }

    @Override
    public View getInfoContents(Marker marker) {
        TextView helloTextView = new TextView(getContext());
        helloTextView.setText("Hello Info contents");
        helloTextView.setClickable(false);
        return helloTextView;
    }
}
Run Code Online (Sandbox Code Playgroud)

android google-maps google-maps-markers

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