问题列表 - 第38643页

如何使用postgres在heroku服务器上创建新数据库

我想在Heroku服务器上创建一个PostgreSQL数据库.

我的database.yml

production:
  adapter: postgresql

  encoding: utf8

  database: ddb
  username: postgres

  port: 5432
  password: admin

  host: localhost
Run Code Online (Sandbox Code Playgroud)

当我运行heroku rake db:create它时给我错误:

mydatabase already exists
    (in /disk1/home/slugs/181380_8d7032f_f439-4fe4f5a6-f181-4150-a968-fadcf45f0af5/mnt)
Run Code Online (Sandbox Code Playgroud)

我已经尝试了各种不同的数据库名称,但得到相同的消息.

我该如何解决这个错误?

postgresql heroku

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

浏览/迭代div的每个输入元素

<div id="arraydiffid">
    <input type="hidden" name="array_diff[]" value="0" />
    <input type="hidden" name="array_diff[]" value="1" />
    <input type="hidden" name="array_diff[]" value="2" />
    <input type="hidden" name="array_diff[]" value="3" />

    <div class='hello'>
        somethings
    </div

    <input type="hidden" name="array_diff[]" value="4" />

    <span>hello</span>

    <input type="hidden" name="array_diff[]" value="5" />        
</div>
Run Code Online (Sandbox Code Playgroud)

如何只浏览所有"输入类型隐藏"的孩子?(而不是其余的,如div或span)我试过:

$('#arraydiffid>children').each(function(){
    alert($(this).value());
}); 
Run Code Online (Sandbox Code Playgroud)

jquery

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

window.onbeforeunload,但对于一个框架?

我试图提出关于离开网页的警告信息,但它嵌套在框架集中.

如果我在浏览器中将网页加载为根页面,则显然会触发window.onbeforeunload触发器,但在框架集内加载时不会触发.

编辑:它在Chrome 7或Safari 5中不起作用,但它适用于Internet Explorer 8和FireFox 3.6.是否有修复/解决方法,以便我可以在Chrome 7和/或Safari 5中使用它?

我究竟做错了什么?

这是我试过的:

function closePageWarning()
{
    return "Are you sure you want to leave this page?"
}

window.onbeforeunload = closePageWarning
Run Code Online (Sandbox Code Playgroud)

测试文件:

test1.html(带有unbeforeunload脚本的页面)

<html>
    <body>
        <script language="javascript">
        function closePageWarning()
        {
            return "Are you sure you want to leave this page?";
        }

        window.onbeforeunload = closePageWarning;
        </script>
        <a href="http://www.bitbucket.org">bitbucket</a>
    </body>
</html>
Run Code Online (Sandbox Code Playgroud)

test2.html(frameset)

<html>
    <frameset cols="20%, 80%">
        <frame name="menu" src="test3.html" />
        <frame name="content" src="test1.html" />
    </frameset>
</html>
Run Code Online (Sandbox Code Playgroud)

test3.html(菜单,用脚本触发框架更改)

<html>
    <body>
        <a target="content" href="http://www.bitbucket.org">bitbucket</a>
    </body> …
Run Code Online (Sandbox Code Playgroud)

javascript onbeforeunload frameset frame

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

什么是将routes.rb文件分成多个文件以便更好地管理的好方法?

我正在使用相当大的路径文件的rails 3项目.它利用了一些嵌套,我遇到了一个问题,主要是因为路由文件很难管理.

有没有办法将其分解为多个文件?

就像是:

My::Application.routes.draw do
  constraints(:subdomain => 'admin') do
    include My::Application::Routes::AdminRoutes
  end

  include My::Application::Routes::MainRoutes
end
Run Code Online (Sandbox Code Playgroud)

要么...

My::Application.routes.draw do
  constraints(:subdomain => 'admin') do
    require 'routes/admin_routes.rb'
  end

  require 'routes/main_routes.rb'
end
Run Code Online (Sandbox Code Playgroud)

或类似的规定.

谢谢!

ruby partitioning routes ruby-on-rails

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

Sencha Touch:选项卡面板内的嵌套列表

我还是Sencha Touch/ExtJS的新手,我正在探索演示和入门样本.但我偶然发现了这个问题,当我在选项卡面板项目上插入嵌套列表时,我无法再导航列表项.

这是我的代码:

Ext.setup({
tabletStartupScreen: 'tablet_startup.png',
phoneStartupScreen: 'phone_startup.png',
icon: 'icon.png',
glossOnIcon: false,        

onReady: function(){ 

    // store with data
    var data = {
        text: 'Groceries',
        items: [{
            text: 'Drinks',
            items: [{
                text: 'Water',
                items: [{
                    text: 'Sparkling',
                    leaf: true
                },{
                    text: 'Still',
                    leaf: true
                }]
            },{
                text: 'Coffee',
                leaf: true
            },{
                text: 'Espresso',
                leaf: true
            },{
                text: 'Redbull',
                leaf: true
            },{
                text: 'Coke',
                leaf: true
            },{
                text: 'Diet Coke',
                leaf: true
            }]
        },{
            text: 'Fruit',
            items: [{
                text: 'Bananas',
                leaf: true …
Run Code Online (Sandbox Code Playgroud)

extjs sencha-touch

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

如果在视图上使用JSTL,Spring MVC会给你什么?

刚开始学习Java方面的事情,对不起,如果这是显而易见的.但是,我正在阅读有关Java 6中Spring的教程,并看到他们在视图中使用了常规的旧JSTL.

如果我在视图中使用JSTL,Spring会给我什么?如果我使用"只是java",我会用什么(我知道它只是Java,但我的意思是除了像Spring或Struts这样的框架)?

谢谢.

编辑:

我猜测JSTL是V.这是我的观点.如果我已经拥有没有Spring的V,那么我还没有获得Java所拥有的内容?没有Spring我必须提供什么(请不要说MC!)

编辑:也许我在问.如果我不使用Spring,Struts或类似的东西,我将在Java中使用什么样的MVC.对于MVC,使用JSTL开箱即用,对于Java 6.我还有什么其他组件(我保留JSTL是有原因的).谢谢.

java spring spring-mvc

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

iPhone OTA发行版

我尝试使用以下链接为我的示例应用创建OTA:

http://developer.apple.com/library/ios/#featuredarticles/FA_Wireless_Enterprise_App_Distribution/Introduction/Introduction.html

我用我的网址创建了一个标签:安装应用程序,但它出错:Safari无法打开"itms-services://?action = download-manifest&url = http://XXXX-XX/MobileApps/otatest.plist"因为Microsoft Windows无法识别以"itms-services:"开头的Internet地址.

与Internet Explorer几乎相同.

我是否需要在服务器中添加任何东西来重新组合itms-services?

提前致谢

此致,Malleswar

iphone distribution

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

代码是"while(条件);" 有效,这是什么意思?

我们可以像while(condition);C编程一样放分号吗?如果while(condition);有效,这是什么意思?

c while-loop

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

使用.NET的XSLT小写

我使用XMLSpy使用以下XSLT:

<?xml version="1.0" encoding="UTF-16"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions">
    <xsl:output method="xml" version="1.0" encoding="UTF-16" indent="yes"/>
        <xsl:template match="*">
        <xsl:element name="{lower-case(local-name())}">
            <xsl:apply-templates select="@*"/>
            <xsl:apply-templates select="* | text()"/>
        </xsl:element>
    </xsl:template>
    <xsl:template match="@*">
        <xsl:attribute name="{lower-case(local-name())}"><xsl:value-of select="."/></xsl:attribute>
    </xsl:template>
</xsl:stylesheet>
Run Code Online (Sandbox Code Playgroud)

如果我尝试在我的源代码中使用它(XslCompiledTransform),我会得到一个异常,告诉我函数'lower-case()'不是XSLT synthax的一部分.

所以我改变了一点转变:

fn:lower-case
Run Code Online (Sandbox Code Playgroud)

现在我的例外是找不到以'http://www.w3.org/2005/xpath-functions'为前缀的脚本或外部对象.这件事怎么回事?我该如何解决?

问候

c# xslt

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

ScrollView中的选择器不会滚动

我有一个UIScrollView,里面有一个包含UIPickerView的小UIView.我可以上下滚动视图,但每当我尝试滚动选择器时,它都会滚动视图.我可以通过单击而不是滚动来更改选择器的值.

有任何想法吗?

编辑:我刚试过scrollView.canCancelContentTouches = NO;但它只在我第一次触摸然后拖动时才有效,就像在TouchesBegan事件中一样.如果我像在TouchesMoved事件中那样触摸Picker,则scrollView仍会滚动.

如何在ScrollView中为Picker提供自然行为?

iphone objective-c uiscrollview uipickerview

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