我想知道为什么我的php程序在其他地方包含类时没有返回正确的TRUE FALSE值
它就是这样的
source: signup.php
class signup
{
function buildProfile()
{
if($logic){
$this->success = TRUE;
}else{
$this->success = FALSE;
}
}
function __construct()
{
$this->success = NULL;
$this->buildProfile
return $this->success;
}
}
Run Code Online (Sandbox Code Playgroud)
我在其他地方
include('signup.php');
$signup = new signup();
if($signup){
successFunction();
}else....
Run Code Online (Sandbox Code Playgroud)
但它并没有得到$ signup == true,它每次都变得虚假
我有一个Delphi 7应用程序,在WinXP开发机器上,表单大小与它的设计相同.
但是,在Vista计算机上运行应用程序时,某些表单已经放大了20-30%,在表单的右边缘和底边留下了大的空白区域.
在我们客户端的一台WinXP机器上,表单已缩小,导致滚动条显示在表单上.
在大多数其他机器上,它显示OK.
该应用程序确实记住了上次在某些表单上使用的表单大小,并在下次打开表单时使用它,但即使删除这些设置,默认表单大小仍然与其设计方式不同.
有任何想法吗?
我正在寻找最真实的播放滚球声的方法.目前我正在使用Wav样本,只要球正在移动,我就会一遍又一遍地玩 - 这感觉不对.
我一直在考虑完全合成声音,我对此几乎一无所知(几乎没有),我很感激任何关于合成由特定材料制成的球的声音的教程/研究材料/样品制成的表面制作另一种材料.如果这个想法完全错误,请提出另一种方法.
谢谢!
以下行:
$select = $table->select();
$select->where('approved = 1');
$result = $table->fetchRow($select);
Run Code Online (Sandbox Code Playgroud)
返回一个对象.我想要的是获得一个关联数组.
我知道,Zend_Db的具有fetchAssoc()方法为,但类似的事情还有在Zend_Db_Table类(我试过fetchAssoc(),但它不工作,我还没有发现的文档中的任何东西)?
在我的应用程序中,我想从另一个线程向对话框发送消息.我想将std :: exception派生类引用传递给对话框.
像这样的东西:
try {
//do stuff
}
catch (MyException& the_exception) {
PostMessage(MyhWnd, CWM_SOME_ERROR, 0, 0); //send the_exception or the_exception.error_string() here
}
Run Code Online (Sandbox Code Playgroud)
我想在对话框中收到消息并显示错误 the_exception.error_string()
LPARAM CMyDlg::SomeError(WPARAM, LPARAM)
{
show_error( ?????
return 0;
}
Run Code Online (Sandbox Code Playgroud)
std::string the_exception.error_string()
我猜,传递使用PostMessage也没关系.
在C#中,当我反映派生类型时,为什么我看不到基类的静态字段?
我都试过type.GetFields(BindingFlags.Static)
和type.GetFields()
.
我有一个UITabBarController,它添加了一个viewController,但定位是关闭的.屏幕顶部有大约20px的间隙,加载的viewController的底部是隐藏的.如何调整加载的viewController的大小?
viewController = [[FlashCardViewController alloc] initWithNibName:@"FlashCardViewController" bundle:[NSBundle mainBundle]];
viewController.view.bounds = [[UIScreen mainScreen]bounds];
//viewController.view.alpha = 0.0;
//[self.view addSubview:viewController.view];
tabBarController = [[UITabBarController alloc] initWithNibName:nil bundle:nil];
tabBarController.viewControllers = [NSArray arrayWithObject:viewController];
tabBarController.view.alpha = 0.0;
[self.view addSubview:tabBarController.view];
Run Code Online (Sandbox Code Playgroud)
我试过这两个但没有运气.
tabBarController.view.bounds = [[UIScreen mainScreen] bounds];
tabBarController.view.frame = [[UIScreen mainScreen] bounds];
Run Code Online (Sandbox Code Playgroud)
这不是我想要做的事情.我想将它们设置为tabBarController查看窗口的大小和位置.
iphone cocoa-touch uitabbarcontroller uiviewcontroller bounds
我正在尝试使用ANTLR解析CSS,或者至少是基础知识.我的lexer规则遇到了一些问题.问题在于ID选择器和十六进制颜色值之间的模糊性.为清晰起见,使用简化的语法,请考虑以下输入:
#bbb {
color: #fff;
}
Run Code Online (Sandbox Code Playgroud)
以及以下解析器规则:
ruleset : selector '{' property* '}';
selector: '#' ALPHANUM;
property: ALPHANUM ':' value ';' ;
value: COLOR;
Run Code Online (Sandbox Code Playgroud)
和这些词法分析器:
ALPHANUM : ('a'..'z' | '0'..'9')+;
COLOR : '#' ('0'..'9' | 'a'..'f')+;
Run Code Online (Sandbox Code Playgroud)
这不起作用,因为#bbb被标记为COLOR标记,即使它应该是一个选择器.如果我将选择器更改为不以十六进制字符开头,则它可以正常工作.我不知道如何解决这个问题.有没有办法让ANTLR将特定令牌仅作为COLOR令牌处理,如果它在某个位置?比方说,如果它属于属性规则,我可以放心地认为它是一个颜色标记.如果不是,请将其视为选择器.
任何帮助,将不胜感激!
解决方案:原来我试图在语法中做太多,我应该在使用AST的代码中处理.CSS有太多不明确的令牌可靠地分成不同的令牌,所以我现在使用的方法基本上是对'#','.',':'和花括号等特殊字符进行标记,并在消费者代码.工作得更好,处理边缘情况更容易.
如果为true,它将向用户发送错误消息.如果错误的传递错误不会被注意到.
推荐的方法是什么?
实际上我之前的问题让我思考,我意识到逆转一个Dictionary
并不是微不足道的.什么是最优雅和可读的方式呢?
同样的情景学生多对多与班级
Dicitonary<int, List<int>>
key是studentId的原始值,Value是List<int>
包含classId并想要恢复的值Dictionary<classId, List<studentId>>
谢谢
更新:实际上我只是测试了Luke和Bruno的解决方案,并且他们返回了适当数量的分类,无论他们都拥有相同的学生,我会随着时间的推移进行更新.
c# ×2
php ×2
actionmailer ×1
antlr ×1
bounds ×1
c ×1
c++ ×1
cdialog ×1
class ×1
cocoa-touch ×1
conditional ×1
css ×1
css-parsing ×1
delphi ×1
dictionary ×1
field ×1
forms ×1
inheritance ×1
iphone ×1
mfc ×1
mysql ×1
postmessage ×1
reflection ×1
return ×1
ruby ×1
size ×1
static ×1