问题列表 - 第35640页

PHP对象中的递归$ Price-> setProduct($ Product); $产品展示 - > setPrice($价格);

所以..我想知道这有什么影响

$Price->setProduct($Product); 
$Product->setPrice($Price);

echo $Product->getPrice()->getTotal();
Run Code Online (Sandbox Code Playgroud)

如果我,它显示RECURSIONprint_r($Product)

php recursion

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

如何在NSString中使用printf

我需要使用类似NSLog但没有时间戳和换行符的东西,所以我正在使用printf.我怎么用这个NSString

printf cocoa-touch objective-c nslog nsstring

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

Ruby on Rails Net :: HTTP use_ssl抛出'undefined method'

这是我的代码:

sock = Net::HTTP.new(url.host, url.port)
sock.use_ssl = true
response = sock.start {|http| http.request(req)}
Run Code Online (Sandbox Code Playgroud)

这是错误:

undefined method `use_ssl=' for #<Net::HTTP www.paypal.com:443 open=false>
Run Code Online (Sandbox Code Playgroud)

谷歌让我什么都没有!

谢谢.

ruby-on-rails

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

如何从字符串中修剪空格?

我正在为J2ME应用程序编写这个函数,所以我没有一些更高级/现代的Java类可供我使用.我正在接受java.lang.ArrayIndexOutOfBoundsException这个.所以,显然要么它不喜欢我初始化newChars数组的方式,要么我在调用时没有正确地做某事System.arraycopy.

/*
 * remove any leading and trailing spaces
 */
public static String trim(String str) {
    char[] chars = str.toCharArray();
    int len = chars.length;
    // leading
    while ( (len > 0 ) && ( chars[0] == ' ' ) ) {
        char[] newChars = new char[] {}; // initialize empty array
        System.arraycopy(chars, 1, newChars, 0, len - 1);
        chars = newChars;
        len = chars.length;
    }
    // TODO: trailing
    return chars.toString();
}
Run Code Online (Sandbox Code Playgroud)

java java-me

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

让Ant <modified>选择器正常工作

我在ANT中有一个目标需要在给定的文件集上运行两次编译器:一次用于调试,一次用于生产.我只想在源文件发生变化时运行编译器,所以我设置了一个<modified>选择器.但是,由于我需要为给定的修改文件运行debug和prod任务,所以我update在第一次运行时将该属性设置为false.我有类似的东西:

<!-- Do the debug build -->
<apply executable="compiler">
    <fileset dir="${js.src.dir}" includes="*.js">
        <!-- don't update the cache so the prod build below works -->
        <modified update="false" 
            seldirs="true"
            cache="propertyfile"
            algorithm="digest"
            comparator="equal">
          <param name="cache.cachefile" value="cache.properties"/>
          <param name="algorithm.algorithm" value="md5"/>
        </modified>
    </fileset>
    <args for debug build/>
</apply>
<!-- Do the production build -->
<apply executable="compiler">
    <fileset dir="${js.src.dir}" includes="*.js">
        <modified update="true" 
            seldirs="true"
            cache="propertyfile"
            algorithm="digest"
            comparator="equal">
          <param name="cache.cachefile" value="cache.properties"/>
          <param name="algorithm.algorithm" value="md5"/>
        </modified>
    </fileset>
    <args for prod build/>
</apply>
Run Code Online (Sandbox Code Playgroud)

但这不起作用.我对编译器的第一次调用最终会更新缓存,第二次调用将被跳过.我在这里错过了什么?

更新:我通过使用 …

ant

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

在Weblogic(10)中,如何从Java访问节点名称?

我想在weblogic集群中设置一些每节点配置,并且需要从Java访问节点名称.

java configuration weblogic cluster-computing

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

C++:使用String作为函数参数的麻烦

好的,我在使用以下代码时遇到问题(在头文件中):

#ifndef XML_H_INCLUDED
#define XML_H_INCLUDED
#include "libxml/parser.h"
#include "libxml/xmlwriter.h"
#include <string>


class XmlFile{
public:
    XmlFile(string filename){
        file = xmlParseFile(filename);


    }
    xmlDocPtr file; //Pointer to xml file


};



#endif // XML_H_INCLUDED
Run Code Online (Sandbox Code Playgroud)

该文件包含在主源文件中(但不被访问,因此其内容并不重要).

我一直收到以下错误(在Codeblocks中):

error: cannot convert 'std::string' to 'const char*' 
for argument '1' to 'xmlDoc* xmlParseFile(const char*)'|
Run Code Online (Sandbox Code Playgroud)

我遇到过这么多次,这让我发疯了.

如果可能的话,我宁愿不使用向量(在初始化函数时增加了另一个步骤.

我究竟做错了什么?我试过这个,但没有找到任何满意的答案.

提前致谢.

c++ arguments const function char

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

iPhone CoreText:查找子字符串的像素坐标

这是Twitter应用程序的屏幕截图供参考:http://screencast.com/t/YmFmYmI4M

我想要做的是在NSAttributedString中的子字符串顶部放置一个浮动弹出窗口,该字符串可以跨越多行.NSAttributedString是项目的要求.

在提供的屏幕截图中,您可以看到链接是背景突出显示的,因此它让我相信他们正在使用CoreText和NSAttributedStrings.我还找到了一个名为CTRunRef(http://developer.apple.com/library/ios/#documentation/Carbon/Reference/CTRunRef/Reference/reference.html)的东西看起来很有前景,但我很难将它们整合在一起概念.

简而言之,如果我在核心文本中有一个段落,当我点击一个单词时,如何找到该单词的边界框?

iphone substring nsattributedstring core-text ios4

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

WPF:我可以按百分比设置元素的宽度吗?

假设我在一个元素中有2个按钮,我想将2个元素设置为总是填充其包含元素的1/2宽度,我可以这样做吗?

UPDATE

为什么我不能做类似的事情

<StackPanel Orientation="Horizontal" Grid.Row="0">
    <Button Content="Click me" Command="{Binding ClickCommand}" Width="1*" />
    <Button Content="Exit" Command="{Binding CloseCommand}" Width="1*" />
</StackPanel>
Run Code Online (Sandbox Code Playgroud)

为什么1*在这种情况下不起作用?我收到了错误

无法转换"1*"

wpf

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

使用Kohana v3 Query Builder的"WHERE列IS NOT NULL"

Kohana v3 Query Builder是否可以使用IS NOT NULL运算符?

where($ column,$ op,$ value)方法需要所有三个参数,即使我指定了

->where('col', 'IS NOT NULL', '')
Run Code Online (Sandbox Code Playgroud)

它构建和无效的查询,例如.

SELECT * FROM table WHERE col IS NOT NULL '';
Run Code Online (Sandbox Code Playgroud)

php mysql database kohana kohana-3

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