小编wag*_*325的帖子

更改Jetty默认端口

Jetty默认端口是8080,但我想将默认端口更改为其他端口(9999).

我阅读了一些教程,他们说几乎所有的配置信息都默认保存在文件中jetty.xml,这个文件位于$JETTY_HOME/etc/.然后,将属性更改jetty.port为9999.但是,当我打开该文件时,我找不到其中的jetty.port属性jetty.xml.我目前正在使用Jetty-9.2.1,端口是8080.

我在jetty-http.xml文件下找到了jetty.port属性.即使我在jetty-http.xml文件中将端口更改为8090,Jetty仍然在端口8080上运行.

的jetty.xml

<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">

<!-- =============================================================== -->
<!-- Documentation of this file format can be found at:              -->
<!-- http://wiki.eclipse.org/Jetty/Reference/jetty.xml_syntax        -->
<!--                                                                 -->
<!-- Additional configuration files are available in $JETTY_HOME/etc -->
<!-- and can be mixed in. See start.ini file for the default         -->
<!-- configuration files.                                            -->
<!--                                                                 -->
<!-- For a description of the configuration mechanism, see the       -->
<!-- output of: …
Run Code Online (Sandbox Code Playgroud)

java jetty maven maven-jetty-plugin

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

在调用另一个JSON之前删除Leaflet映射中的所有数据/标记

我正在检索不同的数据,以使用不同的JSON文件标记传单地图.每个单选按钮都会检索不同的JSON文件.但是,当我选择不同的单选按钮时,我无法清除标记.所有标记只是从一个JSON文件添加到另一个.我希望能够在选择不同的单选按钮时清除所有标记.

我四处搜索并阅读了map.removeLayer(MyLayer); 将删除所有标记.所以我创建了一个名为"markers"的标记数组,并放置在一个名为"markersLayer"的层中.当我尝试删除"markersLayer"时,它没有在地图上留下单个标记.现在没有绘制任何内容,而不是清除不同JSON文件中的先前标记.

我只想使用我使用单选按钮选择的特定JSON文件中的数据来显示这些标记.

HTML:

<div style="text-align: center;">
    <h1 id="title">Map Visualization 3</h1>
    <label><input type="radio" class="location" name="location" value="locations1" checked="checked">Location Set 1</label>
    <label><input type="radio" class="location" name="location" value="locations2">Location Set 2</label>
    <label><input type="radio" class="location" name="location" value="locations3">Location Set 3</label>
<ul id="location-list"></ul>
    <div id="map" style="width: 80%; max-width: 900px; height: 600px; margin: 0 auto;"></div>
</div>
Run Code Online (Sandbox Code Playgroud)

JS:

var map;
var markers = [];
var markersLayer;
var updateMap = function() {
    var uri = $('input.location:checked').val() + '.json';
    $.getJSON(uri, function(response){
        $('ul#location-list').empty();


        var locationCoor = []; 
        var marker;

        for(var i=0; i …
Run Code Online (Sandbox Code Playgroud)

json leaflet

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

RefineryCMS Engines错误:没有有效的gemspec

我无法安装任何引擎.从指南安装第一个事件引擎后,我有一个错误,说我没有有效的宝石规格.

Using refinerycms-events (1.0) from source at vendor/extensions refinerycms-events at /Users/lydia/Desktop/projects/cmsex/vendor/extensions/events did not have a valid gemspec. This prevents bundler from installing bins or native extensions, but that may not affect its functionality. The validation message from Rubygems was: authors may not be empty

现在,每当我尝试安装另一个引擎时,命令行说安装已成功,但我无法在bundle show上找到该gem.我无法生成插件和数据库.

我已将这些行添加到我的Gemfile中:

宝石'refinerycms-blog','〜> 2.1.0'

宝石'refinerycms-search','〜> 2.1.0'

这是我的宝石包含在捆绑中:

    Gems included by the bundle:
  * actionmailer (3.2.16)
  * actionpack (3.2.16)
  * activemodel (3.2.16)
  * activerecord (3.2.16)
  * activeresource (3.2.16)
  * activesupport (3.2.16)
  * acts_as_indexed (0.8.3)
  * arel …
Run Code Online (Sandbox Code Playgroud)

ruby validation gem ruby-on-rails refinerycms

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

使用自制程序安装 PostgreSQL 时出错

我正在使用 Mac OS X 10.8.5 并尝试使用自制软件安装 postgreSQL。我修复了运行brew info postgresql 时发生的几个错误和警告。但是,我不知道如何解决其余问题。

\n\n

$brew 信息 postgresql

\n\n
postgresql: stable 9.3.2 (bottled)\nhttp://www.postgresql.org/\nConflicts with: postgres-xc\n/usr/local/Cellar/postgresql/9.3.2 (2924 files, 40M) *\n  Poured from bottle\nFrom: https://github.com/Homebrew/homebrew/commits/master/Library/Formula/postgresql.rb\n==> Dependencies\nRequired: readline \xe2\x9c\x94\nRecommended: ossp-uuid \xe2\x9c\x94\n==> Options\n--32-bit\n    Build 32-bit only\n--enable-dtrace\n    Build with DTrace support\n--no-perl\n    Build without Perl support\n--no-tcl\n    Build without Tcl support\n--without-ossp-uuid\n    Build without ossp-uuid support\n--without-python\n    Build without python support\n==> Caveats\nIf builds of PostgreSQL 9 are failing and you have version 8.x installed,\nyou may need to remove the previous version first. See:\n …
Run Code Online (Sandbox Code Playgroud)

postgresql macos homebrew

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

Rails 4 Heroku postgreSQL错误

我在使用SQLite3将现有应用程序更改为postgreSQL时遇到问题.我正在按照本教程将SQLite3转换为postgreSQL并将其部署到heroku:https://devcenter.heroku.com/articles/sqlite3#running-rails-on-postgres .

我删除了gem'sqlite3'并替换为gem'pg'.修改config/database.yml后,我运行了迁移.

$rake db:create$rake db:migrate导致此错误:

could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
Run Code Online (Sandbox Code Playgroud)

生产中使用的Gemfile:

gem 'rails_12factor'
gem 'thin'
gem 'pg'
Run Code Online (Sandbox Code Playgroud)

以下是我使用本地服务器运行时出现的错误:

/usr/local/rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/connection_adapters/postgresql_adapter.rb:825:in `initialize': could not connect to server: No such file or directory (PG::ConnectionBad)
    Is the server running locally and accepting
    connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
Run Code Online (Sandbox Code Playgroud)

postgresql ruby-on-rails heroku

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

Ruby on Rails 错误:无法在另一个目录中初始化新的 Rails 应用程序,请先切换到非 Rails 目录

我在Desktop/rails_projects. 根据另一篇文章,我必须清空受影响的目录,这会阻止我创建新项目。帖子说.bundle folder如果我用ls -a.

但是,我的问题是我在创建新的 Rails 应用程序之前创建了 rails_projects,这意味着那里什么都没有。另外,我试过在下面创建另一个文件夹Desktop/aNewFolder,同样的事情发生了。也许桌面本身有问题?我不知道。我做ls -aDesktop但我找不到.bundle folder.另外,我不能只是擦除桌面上的所有内容。那太荒谬了。

这就是我尝试在$rails new first_app里面做的事情Desktop/rails_projects

Can't initialize a new Rails application within the directory of another, please change to a non-Rails directory first.
Type 'rails' for help.
Run Code Online (Sandbox Code Playgroud)

当我输入 rails 时收到了这个:

The most common rails commands are:
 generate    Generate new code (short-cut alias: "g")
 console     Start the Rails console (short-cut alias: "c")
 server      Start the …
Run Code Online (Sandbox Code Playgroud)

ruby ruby-on-rails

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

RSpec - 找不到spec/spec_helper.rb

我正在关注Michael Hartl的Ruby on Rails 4书,但找不到spec/spec_helper.rb.这是他的书http://ruby.railstutorial.org/ruby-on-rails-tutorial-book的链接,我正在研究第3章测试驱动开发部分.

我运行此代码来调用RSpec和static_pages_spec.rb

$ rails generate integration_test static_pages      
invoke  rspec      
create    spec/requests/static_pages_spec.rb
Run Code Online (Sandbox Code Playgroud)

在此之后,我需要将Capybara DSL添加到RSpec帮助文件中.

spec/spec_helper.rb

# This file is copied to spec/ when you run 'rails generate spec:install'
…
RSpec.configure do |config|  
.  .  .  
config.include Capybara::DSL
end
Run Code Online (Sandbox Code Playgroud)

问题:我的问题是我无法找到或打开spec/spec_helper.rb.我试过$subl spec/spec_helper.rb但它只打开一个空的文本编辑器文件.

为RSpec和TDD添加了我的Gemfile的跟随:

group :development, :test do  
gem 'sqlite3', '1.3.8'  
gem 'rspec-rails', '2.13.1'
end

group :test do  
gem 'selenium-webdriver', '2.35.1'  
gem 'capybara', '2.1.0'
end
Run Code Online (Sandbox Code Playgroud)

冉:

$ bundle install --without production
$ …
Run Code Online (Sandbox Code Playgroud)

ruby rspec ruby-on-rails

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

调用irb和rails console中的'rubygems'结果=> false.

我试图在irb和rails控制台中使用'awesome_print'gem但是当我调用$ require'rubygems'时它会导致错误.我试过重装但没有用.

ruby-on-rails

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

永久 Maven 安装

如何使 maven 安装永久化?将 apache-maven 下载到 后/usr/local,每次我想使用它时,我都需要打印一系列“导出”命令行。即使在我让 maven 工作之后,当我重新启动终端时 maven 也不起作用。

将此添加到~/.bash_profile

export M2_HOME=/usr/local/apache-maven/apache-maven-3.2.1/
export PATH=$PATH:$M2_HOME/bin
Run Code Online (Sandbox Code Playgroud)

命令行:

$ export M2_HOME=/usr/local/apache-maven/apache-maven-3.2.1/
$ export M2=$M2_HOME/bin
$ export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/home
$ export PATH=$M2:$JAVA_HOME/bin:$PATH
$ mvn –-version

Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T12:37:52-05:00)
Maven home: /usr/local/apache-maven/apache-maven-3.2.1
Java version: 1.6.0_65, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x", version: "10.9.3", arch: "x86_64", family: "mac"
Run Code Online (Sandbox Code Playgroud)

重启命令行后:

$ mvn –-version
-bash: mvn: command not found
Run Code Online (Sandbox Code Playgroud)

我还尝试添加设置 M2、JAVA_HOME …

maven

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

Spree:使用Deface替换类属性

我想使用Deface将类从"第四列"替换为"第三列".

<aside id="sidebar" class="columns four" data-hook>
  <%= yield :sidebar %>
</aside>
Run Code Online (Sandbox Code Playgroud)

我不确定我需要采取什么行动和来源.这就是我到目前为止所拥有的.

Deface::Override.new(:virtual_path => "shared/_sidebar", 
                     :name => "grid", 
                     :set_attributes => '.columns three', 
                     :attributes => {:class => 'pretty', :title => 'This is a link'})
Run Code Online (Sandbox Code Playgroud)

spree

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

在带有 AJAX 的 Leaflet 中使用 JSON 代替 GeoJSON

我正在寻找一种使用 AJAX 在传单中使用 JSON 而不是 GeoJSON 的方法。需要使用 JSON 和 AJAX。

\n\n

我设法使用 AJAX 调用 JSON 文件。但是,现在我很困惑如何使用 JSON 中的数据在地图上绘制标记。我猜我不能使用 L.geoJson()。

\n\n

HTML:

\n\n
<div id="map" style="width: 800px; height: 500px"></div>\n
Run Code Online (Sandbox Code Playgroud)\n\n

这是 JavaScript 文件:

\n\n
var map;\nvar overlay;\n\nvar addPopupsFromLocations = function(locations) {\n  var popups = new Array();\n  locations.forEach(function(location){\n    console.log(\'creating popup for location \' + location.title);\n\n    console.log(location.latitude);\n    console.log(location.longitude);\n      }) ;\n};\n\nfunction init() {\n        var map = L.map(\'map\').setView([51.505, -0.09], 13);\n\n        L.tileLayer(\'https://{s}.tiles.mapbox.com/v3/{id}/{z}/{x}/{y}.png\', {\n            maxZoom: 18,\n            attribution: \'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, \' +\n                \'<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, …
Run Code Online (Sandbox Code Playgroud)

javascript ajax json leaflet

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