我有最新的docker安装(没有boot2docker),我无法连接到本地运行的dockerized redis实例.你能告诉我这里我做错了什么吗?
创建了docker,将端口6379映射到127.0.0.1:6379
bash-3.2$ docker run -p 127.0.0.1:6379:6379 --name webmonitor-redis -d redis
3291541d58ab16c362f9e0cd7017d179c0bc9aef3a1323e79f1e1ca075e171c9
Run Code Online (Sandbox Code Playgroud)
docker ps输出:
bash-3.2$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3291541d58ab redis "/entrypoint.sh redis" 14 seconds ago Up 6 seconds 127.0.0.1:6379->6379/tcp webmonitor-redis
Run Code Online (Sandbox Code Playgroud)
尝试从外部容器(但运行容器的同一主机)连接,连接失败:
bash-3.2$ ./src/redis-cli
Could not connect to Redis at 127.0.0.1:6379: Connection refused
not connected> exit
Run Code Online (Sandbox Code Playgroud)
如果我尝试从另一个容器连接,它可以工作..
bash-3.2$ docker run -it --link webmonitor-redis:redis --rm redis sh -c 'exec redis-cli -h "$REDIS_PORT_6379_TCP_ADDR" -p "$REDIS_PORT_6379_TCP_PORT"'
172.17.0.8:6379>
Run Code Online (Sandbox Code Playgroud)
这是docker检查容器:
bash-3.2$ docker inspect 3291541d58ab
[
{
"Id": "3291541d58ab16c362f9e0cd7017d179c0bc9aef3a1323e79f1e1ca075e171c9", …Run Code Online (Sandbox Code Playgroud) 我希望能够使用Javascript提取包含所有广告系列跟踪信息的Google Analytics跟踪Cookie中存储的数据.它需要使用ga.js而不是urchin.js来使用较新版本的GA.我找到了一个与urchin.js一起使用的方法,但我们不会将其用于跟踪.有谁知道如何提取Campaign,Source,Medium,Content和Term从cookie谷歌使用?
我目前正在寻找一种解决方案来选择(或突出显示)OpenLayers.Layer.Vector中的向量.
我已经构建了一个简单的网格表,用户可以在其中选择一个向量(以WKT格式的字符串给出),该向量应突出显示图层上的相应向量.当用户访问网站时,网格表中的所有向量都将绘制到地图上的矢量图层.
我发现我需要OpenLayers.Control.ModifyFeature的selectFeature(feature)函数或者OpenLayers.Control.SelectFeature(参见dev.openlayers.org/apidocs/files/OpenLayers/Control/SelectFeature-js.html的select(功能(可能不存在或不再存在?).请参阅邮件列表中的帖子:osgeo-org.1803224.n2.nabble.com/Programatically-Select-a-Feature-tt2192485.html# a2193928更多信息.
我尝试了以下但没有成功,所以我希望有人可以抓住这些代码行,并可以向我展示一个有效的代码片段;-)
// ... some initializing code
this.vlayer = new OpenLayers.Layer.Vector("VectorLayer"); // VectorLayer
// some controls
this.openLayerControlPoint = new OpenLayers.Control.DrawFeature(this.vlayer, OpenLayers.Handler.Point);
this.openLayerControlPolygon = new OpenLayers.Control.DrawFeature(this.vlayer, OpenLayers.Handler.Polygon);
this.openLayerControlModify = new OpenLayers.Control.ModifyFeature(this.vlayer, {
mode: OpenLayers.Control.ModifyFeature.RESHAPE | OpenLayers.Control.ModifyFeature.DRAG,
standalone: false
});
// just deactivate to make sure everything is really deactivated
this.openLayerControlPoint.deactivate();
this.openLayerControlPolygon.deactivate();
this.openLayerControlModify.deactivate();
// add the just created layer to the map
this.map.addLayer(this.vlayer);
// add all (deactivated) controls to the map
this.map.addControl(this.openLayerControlPoint);
this.map.addControl(this.openLayerControlPolygon);
this.map.addControl(this.openLayerControlModify);
Run Code Online (Sandbox Code Playgroud)
后来的代码: …
我正在调试下面的问题,并发布我正在调试和处理的解决方案,解决方案或类似的问题发布在几个论坛上,但我认为解决方案有一个错误,当num [0] = 0或一般num [x] = x?我对么?如果我错了,请随时纠正我.
给定包含n + 1个整数的数组nums,其中每个整数在1和n之间(包括1和n),证明必须存在至少一个重复的数字.假设只有一个重复的数字,找到重复的数字.
注意:您不能修改数组(假设该数组是只读的).您必须仅使用常量O(1)额外空间.您的运行时复杂度应小于O(n2).数组中只有一个重复的数字,但它可以重复多次.
int findDuplicate3(vector<int>& nums)
{
if (nums.size() > 1)
{
int slow = nums[0];
int fast = nums[nums[0]];
while (slow != fast)
{
slow = nums[slow];
fast = nums[nums[fast]];
}
fast = 0;
while (fast != slow)
{
fast = nums[fast];
slow = nums[slow];
}
return slow;
}
return -1;
}
Run Code Online (Sandbox Code Playgroud) 我想在openlayers 2.13中使用cubiccurve,并且我已经添加了必要的文件,但是绘制时绘制的是线而不是曲线.
文件可在网站上找到:http://trac.osgeo.org/openlayers/ticket/1715#no1
绘制曲线对我们来说非常重要,我无法控制自己的曲线.
可以帮助我吗?
有谁知道这个错误是什么?
java.lang.ExceptionInInitializerError
at presentation.utils.HibernateCommon.buildSessionFactory(HibernateCommon.java:39)
at presentation.utils.HibernateCommon.<clinit>(HibernateCommon.java:19)
at filter.HibernateSessionRequestFilter.init(HibernateSessionRequestFilter.java:28)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3709)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4363)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:627)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: java.lang.NoClassDefFoundError: javax/persistence/EntityListeners
at
org.hibernate.cfg.annotations.reflection.JPAMetadataProvider.getDefaults(JPAMetadataProvider.java:96)
at org.hibernate.annotations.common.reflection.java.JavaReflectionManager.getDefaults(JavaReflectionManager.java:226)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1358)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1829)
at presentation.utils.HibernateCommon.buildSessionFactory(HibernateCommon.java:35)
... 29 more …Run Code Online (Sandbox Code Playgroud) 我有一个稳定的产品,使用角1.2.23.最近,我决定转向棱角1.4.3.在与所有依赖项的几个兼容性问题之后,我的应用程序工作正常,但所有单元测试用例都已经开始失败.投资后我意识到,如果我升级所有依赖项的版本但保持角度在先前版本即1.2.23, testcases工作正常.有角度1.4.3,由于某种原因,单元测试中的依赖注入失败.
以下是bower.json中更新的依赖项列表.
"dependencies": {
"angular-cookies": "1.4.3",
"bootstrap": "3.0.3",
"angular-ui-router": "0.2.15",
"angular-gettext": "2.1.0",
"angular": "1.4.3",
"angular-ui-utils": "3.0.0",
"restangular": "1.4.0",
"angular-route": "1.4.3",
"momentjs": "2.10.6",
"angular-i18n": "1.4.3"
}
Run Code Online (Sandbox Code Playgroud)
以下是测试文件 -
describe("Module: x.xyz", function () {
describe("Factory: xyz", function () {
var service;
beforeEach(function () {
module('x.xyz');
inject(function ($injector) {
service = $injector.get("xyz");
});
});
describe("Testing service(): ", function () {
describe('Testing getXYZDescription(): ', function () {
it('should return the description for the xyz event name passed if it is available', function () …Run Code Online (Sandbox Code Playgroud)