小编Vla*_*col的帖子

如何在输入内添加按钮

我想要实现这个目标: 在此输入图像描述

我希望蓝色箭头充当带有悬停和onclick触发器的按钮; 这可能吗??

html css html5 html-input css3

53
推荐指数
4
解决办法
18万
查看次数

在 ES6 javascript 中检测 FOR OF 循环中的最后一次迭代

有多种方法可以找出 a forandfor...in循环的最后一次迭代。但是我如何找到循环中的最后一次迭代for...of。我在文档中找不到。

for (item of array) {
    if (detect_last_iteration_here) {
        do_not_do_something
    }
}
Run Code Online (Sandbox Code Playgroud)

javascript iterator loops for-loop ecmascript-6

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

无需打开IDE即可从Visual Studio控制台运行解决方案

我正在使用Visual Studio 2010 SP1.

我第一次尝试的是这个:

  1. 从开始菜单打开Visual Studio控制台工具
  2. 导航到项目文件夹(已包含可执行文件)
  3. 跑: msbuild myproject.sln or msbuild myproject.sln /p:Configuration=Release
  4. 这构建成功,但我找不到要运行的可执行文件

 

  1. 我尝试的第二件事是上面的步骤1和2
  2. 运行: devenv myproject.sln /Build and devenv myproject.sln /Run
  3. 这有点工作但似乎打开IDE来运行构建
  4. 重点是避免使用ide.

现在,如何在不打开IDE的情况下构建和运行解决方案?

- - - - - - - - - - - - - 固定 - - - - - - - - - - - - -------

问题是我在错误的地方寻找可执行文件(noob错误).我最终使用这个批处理文件:

msbuild myproj.sln /p:configuration=Release
cd (("Path to executable" usually in the Debug/Release Folder))
myExecutableName
cd (("Path to original folder"))
Run Code Online (Sandbox Code Playgroud)

msbuild console command-line visual-studio-2010 devenv

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

Xcode:计算字符串数组中的元素

有没有快速的方法可以获得NSString数组中的字符串数量?

NSString *s[2]={@"1", @"2"}
Run Code Online (Sandbox Code Playgroud)

我想从中检索2的长度.我有类似的东西(s.size)我知道有-length方法但是对于字符串而言不是字符串数组.我是Xcode的新手请温柔.

xcode objective-c

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

在安装Appcelerator Studio时连接到下载服务器时出错

在此输入图像描述

这是在此处发布的相同错误:https://community.appcelerator.com/topic/3021/installing-on-ubuntu-14-04

我安装了:

oracle-jdk6 nodejs and nodejs-legacy

运用

appcelerator x64

在Ubuntu 14.04上(附件中的规格)

还跑了:

sudo apt-get install libjpeg62 libwebkitgtk-1.0-0 echo 'export MOZILLA_FIVE_HOME=/usr/lib/mozilla' >> ~/.bashrc

并试过:

sudo apt-get install ia32-libs 但这不起作用,而是我使用了这个:

sudo -i cd /etc/apt/sources.list.d echo "deb http://old-releases.ubuntu.com/ubuntu/ raring main restricted universe multiverse" >ia32-libs-raring.list apt-get update apt-get install ia32-libs

我在这里找到:如何在Ubuntu 14.04 LTS(Trusty Tahr)中安装ia32-libs

谢谢

在此输入图像描述

ubuntu titanium appcelerator

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

如何将node.js客户端连接限制为2?

我基本上只是尝试允许2个客户端同时连接到该应用程序.我该怎么做呢?

这是我的服务器代码:

var express = require('express'),
    app = express(),
    server = require('http').createServer(app),
    io = require('socket.io').listen(server);

var osc = require('node-osc');

var client = new osc.Client('127.0.0.1', 12345);

server.listen(3000);

app.get('/', function(req, res){

    res.sendfile(__dirname + '/index.html');
});

io.sockets.on('connection', function(socket){
    socket.on('send message', function(data){
        client.send('/oscAddress', parseInt(data));
    });
});
Run Code Online (Sandbox Code Playgroud)

websocket node.js express socket.io

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

防止iframe滚动捕获youtube iframe嵌入chrome

我有一个标准的youtube嵌入来自随机视频的iframe:

<iframe width="560" height="315" 
src="https://www.youtube.com/embed/ixJ5NbvXg_A" frameborder="0"
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen></iframe>
Run Code Online (Sandbox Code Playgroud)

我重复了几次以获得一些滚动溢出.

<html>
<head></head>
<body>
<iframe width="560" height="315" src="https://www.youtube.com/embed/Mm2eYfj0SgA" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>
<iframe width="560" height="315" src="https://www.youtube.com/embed/Mm2eYfj0SgA" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>
<iframe width="560" height="315" src="https://www.youtube.com/embed/Mm2eYfj0SgA" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>
<iframe width="560" height="315" src="https://www.youtube.com/embed/Mm2eYfj0SgA" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>
<iframe width="560" height="315" src="https://www.youtube.com/embed/Mm2eYfj0SgA" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>
<iframe width="560" height="315" src="https://www.youtube.com/embed/Mm2eYfj0SgA" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; …
Run Code Online (Sandbox Code Playgroud)

html javascript youtube iframe youtube-api

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

Django 加载 ES6 javascript 文件

我想在 Django 的 index.html 中使用 ES6 中的导入功能。

我不想编译到 ES5 以实现浏览器兼容性。我想假设所有用户都拥有兼容 ES6 的浏览器。

因此我不需要像 Babel 这样的 ES6 到 ES5 编译器:https : //github.com/kottenator/django-compressor-toolkit

如果可以的话,我只想提供 ES6 Javascript 和浏览器来编译它。

我试过:

<!-- Index.html -->
<script type="module" src="{% static 'app.js' %}"></script>
Run Code Online (Sandbox Code Playgroud)
//app.js
(function(){
  console.log("Hello from App.js");
})();
Run Code Online (Sandbox Code Playgroud)
# settings.py
if DEBUG:
    import mimetypes
    mimetypes.add_type("module", ".js", True)
Run Code Online (Sandbox Code Playgroud)

我得到的错误:

加载模块脚本失败:服务器以“text/plain”的非 JavaScript MIME 类型响应。每个 HTML 规范对模块脚本执行严格的 MIME 类型检查。


更新 1:我试过:

<script type="module" src="{% static 'app.js' %}"></script>
<script nomodule  src="{% static 'app.js' %}"></script>
<script type="module">import "{% static 'main.mjs' …
Run Code Online (Sandbox Code Playgroud)

django django-templates django-staticfiles ecmascript-6 es6-modules

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

回形针,存储的实际文件在哪里?

这就是我配置附件的方式:

has_attached_file :image, {styles: { small: "64x64", med: "100x100", large: "200x200" },
                  :url  => "/assets/images/users/:id/:style/:basename.:extension",
                  :path => ":rails_root/public/assets/images/users/:id/:style/:basename.:extension",
                  :default_url => "users/default/:style/missing.png"}
Run Code Online (Sandbox Code Playgroud)

输出似乎是正确的:

<img alt="Missing" src="/assets/images/users/3/small/missing.png?1426087812">

但是,当我导航到Windows资源管理器中的路径时,我看不到任何文件.

我正在开发模式下运行.这是原因吗?我怎样才能找到实际的文件?

ruby-on-rails paperclip ruby-on-rails-3

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

div位置+运算符不能按预期工作

为什么这样有效:

newDiv.style.top = topBar.style.height.split("px")[0]+"px";
->>><div style="top: 30.31px;" class="lineSeparator"></div>
Run Code Online (Sandbox Code Playgroud)

这也有效

newDiv.style.top = topBar.style.height.split("px")[0]-2+"px";
->>><div style="top: 28.31px;" class="lineSeparator"></div>
Run Code Online (Sandbox Code Playgroud)

这也有效

newDiv.style.top = topBar.style.height.split("px")[0]/2+"px";
->>><div style="top: 15.15px;" class="lineSeparator"></div>
Run Code Online (Sandbox Code Playgroud)

但这不起作用:

newDiv.style.top = topBar.style.height.split("px")[0]+2+"px";
->>><div style="top: 30.31px;" class="lineSeparator"></div>
Run Code Online (Sandbox Code Playgroud)

我也尝试过:

newDiv.style.top = (topBar.style.height.split("px")[0]+2)+"px";
Run Code Online (Sandbox Code Playgroud)

这是我的完整代码:

function generateSeparators(n){
    for(var i=0;i<n;i++){
        var newDiv=document.createElement("div");
        newDiv.style.top = topBar.style.height.split("px")[0]+"px";
        newDiv.className = "lineSeparator";
        sideBar.appendChild(newDiv);

    }
}
Run Code Online (Sandbox Code Playgroud)

javascript css

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