小编Big*_*bie的帖子

问题渲染谷歌地图在第二个渲染在对话框中

我有一个网站,我已经建立了90%的jQuery与ajax,所以我想通过单击按钮呈现不同的地图,没有页面刷新.

我可以在第一次渲染时正常工作,如下图所示.

在此输入图像描述

但是当我重新加载或更改为另一个时,我得到这个:(我认为它仍然使用点渲染地图.只是画布不正确)

在此输入图像描述

这是我的映射代码:

window.initialize_map = function() {
    function getMiles(i) {
        return i*0.000621371192;
    }
    function toHHMMSS(i) {
        var sec_num = parseInt(i, 10); // don't forget the second param
        var hours   = Math.floor(sec_num / 3600);
        var minutes = Math.floor((sec_num - (hours * 3600)) / 60);
        var seconds = sec_num - (hours * 3600) - (minutes * 60);

        if (hours   < 10) {hours   = "0"+hours;}
        if (minutes < 10) {minutes = "0"+minutes;}
        if (seconds < 10) {seconds = "0"+seconds;}
        time = hours+' …
Run Code Online (Sandbox Code Playgroud)

javascript jquery google-maps google-maps-api-3

13
推荐指数
1
解决办法
273
查看次数

JQVMAP选择的区域使用JSFIDDLE Demo取消选择

好的我在我的网站上有一个JQVMAP来选择搜索框的状态.在我添加Clear功能之前,一切都很顺利.

我还必须将成员HardCode Link中的补丁合并到补丁中

找到解决方案,将jqvmap.js文件中的第466行更改为:

regionClickEvent = $.Event('regionClick.jqvmap');

jQuery(params.container).trigger(regionClickEvent, [code, mapData.pathes[code].name]);
Run Code Online (Sandbox Code Playgroud)

这是我初始化它的方式:

// with this Code it will select states and change the color of selected states plus save the codes of selected states into a hidden field

$('#omap').vectorMap(
    {
        map: 'usa_en',
        backgroundColor: '#fff',
        borderColor: '#000',
        borderWidth: 4,
        color: '#f4f3f0',
        enableZoom: false,
        hoverColor: '#fece2f',
        hoverOpacity: null,
        normalizeFunction: 'linear',
        scaleColors: ['#b6d6ff', '#005ace'],
        selectedColor: '#db9b15',
        selectedRegion: null,
        showTooltip: true,
        multiSelectRegion: true,
        onRegionClick: function(element, code, region) {
            if(highlight[code]!=='#db9b15'){
                highlight[code]='#db9b15';
                origin …
Run Code Online (Sandbox Code Playgroud)

javascript jquery jqvmap

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

手动更改设计密码

好吧,我拥有的是我为客户服务团队构建的API.我们可以创建帐户和用户,一切都很好.

但是当我构建它以更改用户密码时,它会更改它们但不会登录.

创建一个帐户我有这个编码:

  def create
    params["user"].delete("user_id") // this is being sent in from the api..
    params["user"]["encrypted_password"] = Password.new(Password.create(params["user"]["password"]))
    params["user"]["password"] = Password.new(Password.create(params["user"]["password"]))
    user = User.create(params["user"])
    if user
      render json: {company: user}, status: 200
    else
      render json: {message: "Problem creating company"}, status: 500
    end
  end
Run Code Online (Sandbox Code Playgroud)

这很有效

但是当我去更新用户时:

  params["user"]["encrypted_password"] = Password.new(Password.create(password))
  params["user"]["password"] = Password.new(Password.create(password))
Run Code Online (Sandbox Code Playgroud)

不能正常工作

def update
    user = User.find(params[:id])
    password = params["user"].delete("user_password")
    if password && !password.blank?
      puts password
      params["user"]["encrypted_password"] = Password.new(Password.create(password))
      params["user"]["password"] = Password.new(Password.create(password))
    end

    if user.update_attributes(params["user"])
      render json: {company: user}, status: …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails devise

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

在ColdFusion中的数据库中解析存储为字符串的HTML

我接管了这个ColdFusion项目,发现我需要一个包含HTML的数据库字段中的值.字段数据看起来像这样(没有新行):

<wddxPacket version="1.0">
    <header />
    <data>
        <struct>
            <var name="en">
                <string>3 Nights' Lodging</string>
            </var>
            <var name="sp">
                <string>3 Noches alojamiento</string>
            </var>
        </struct>
    </data>
</wddxPacket>
Run Code Online (Sandbox Code Playgroud)

我想要使​​用这些数据,但我只需要之间的文字:

<var name='en'><string>3 Nights' Lodging</string></var>

我使用ColdFusion删除HTML的函数:

#REReplaceNoCase(pkg.title, "<[^><]*>", '', 'ALL')#
Run Code Online (Sandbox Code Playgroud)

但是当我使用它时,我得到这样的东西:

3 Nights' Lodging3 Noches alojamiento
Run Code Online (Sandbox Code Playgroud)

我想要的只是:

3 Nights' Lodging
Run Code Online (Sandbox Code Playgroud)

coldfusion parsing wddx

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

监控Redis中的单个队列

我有一个具有多个队列的 Rails 项目。我有能力登录和监控redis。但它显示来自所有队列的信息。有没有办法只显示单个队列的信息?

telnet localhost 6379
AUTH {PASSWORD}
MONITOR
Run Code Online (Sandbox Code Playgroud)

这些是我的队列

  - user_posting
  - notify_queue
  - load_posting
  - truck_posting
  - hotload_posters_posting
  - major_posters_posting
  - scrape_posting
  - second_chance
Run Code Online (Sandbox Code Playgroud)

只想看到 Truck_posting

ruby-on-rails redis

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

Access-Control-Allow-Origin Rails项目,跨域,无路由匹配[OPTIONS]

我正在我的Rails项目中实现一个API:我有一个示例HTML页面来测试我在rails网站上的实现...我无法更改发送请求的站点上的编码.(下面的代码).我必须让我的rails项目接受请求.

我把它包含在我的ApplicationController中

  before_filter :allow_cross_domain_access
  def allow_cross_domain_access
    response.headers["Access-Control-Allow-Origin"] = '*'
    response.headers["Access-Control-Allow-Methods"] = "GET, PUT, POST, DELETE, OPTIONS"
  end
Run Code Online (Sandbox Code Playgroud)

当我用这个发布到我的网站时,我得到

XMLHttpRequest cannot load http://192.168.1.65:3000/post_everywhere/0/loads. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. The response had HTTP status code 404
Run Code Online (Sandbox Code Playgroud)

rails控制台显示:

  Started OPTIONS "/post_everywhere/0/loads" for 192.168.1.184 at 2015-02-02 09:20:42 -0600
  2015-02-02 09:20:42 FATAL --
  ActionController::RoutingError (No route matches [OPTIONS] "/post_everywhere/0/loads"):
Run Code Online (Sandbox Code Playgroud)

事情是我想要它POST不使用OPTIONS

我设置我的路线像这样:

  resources :post_everywhere do
    post :create_account
    post :update_account
    post :validate_account
    post …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails cors ruby-on-rails-3

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

DirectoryNotFoundException C#将XML文件加载到控制台应用程序时出错

我是C#的新手,并尝试解析XML文档,但我不断收到错误消息,找不到目录

显然\bin\Debug,程序启动时我的xml文件和数据文件夹没有被复制到

下面是我的代码:

收到错误:

An unhandled exception of type 'System.IO.DirectoryNotFoundException' occurred in mscorlib.dll

Additional information: Could not find a part of the path 'C:\Users\Alfred\Source\Workspaces\CIS151_MEY\AlfredM Books XML\AlfredM Books XML\bin\Debug\Data\Books.xml'.
Run Code Online (Sandbox Code Playgroud)

类文件:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Xml;
using System.Xml.Linq;
using System.Reflection;

namespace AlfredM_Books_XML
{
    class XmlHelper
    {
        public static XDocument GetBookDocument()
        {
            string appPath = System.Reflection.Assembly.GetExecutingAssembly().Location;

            FileInfo asm = new FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location);

            FileInfo fi = new FileInfo(asm.DirectoryName + @"\Data\Books.xml");

            XDocument doc = XDocument.Load(fi.FullName);
            return doc; …
Run Code Online (Sandbox Code Playgroud)

c#

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

如何在C#Windows窗体应用程序中动态创建网格

我有一个项目,需要在Windows窗体应用程序上动态创建一个网格,每个单元格上都有一个点击监听器.

网格需要12 X 12

我已经研究过这个并且无法找到将网格添加到Windows窗体应用程序的方法.我见过WPF的解决方案,但没有看到Windows Forms的解决方案.

如果你能指出我正确的方向,将不胜感激任何帮助

网格将需要与战舰游戏一起使用

c# grid

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