最初发布在cakephp Q&A上,但我会把它放在这里,希望得到一些答案.
我有一些公司,其默认状态为0,但有时会获得更高的地位.现在我想使用高状态,如果存在,但如果没有,则恢复为0.我尝试了一堆不同的方法,但我总是得到状态为0的那些或者我想要的状态,如果存在则永远不给我状态,如果不存在则给0.
只给我指定的状态,而不是给我状态为0的状态:
'Company' => array (
'conditions' => array (
'OR' => array(
'Company.status' => 0,
'Company.status' => $status,
)
)
)
Run Code Online (Sandbox Code Playgroud)
只给我0的状态:
'Company' => array (
'conditions' => array (
'OR' => array(
'Company.status' => $status,
'Company.status' => 0
)
)
)
Run Code Online (Sandbox Code Playgroud)
状态定义和代码中的数据检索:
function getCountry($id = null, $status = null) {
// Bunch of code for retrieving country with $id and all it's companies etc, all with status 0.
$status_less_companies = $this->Country->find...
if ($status) { …
Run Code Online (Sandbox Code Playgroud) 我知道Flash的FlashDevelop,但是如何在mac上开发actionscript或haxe?除了用于eclipse的flex插件,flex builder和FDT还有一个很好的IDE用于mac上的actionscript开发吗?我真的想为netbeans提供一个好的插件,但看起来像制作这样的东西的所有项目都停止了.
我已经尝试过使用MacVim和各种插件,但我从来没有让它工作,看起来是一个艰难的学习曲线,开始使用vim.
人们用什么来开发mac上的actionscript/haxe?
我在弹性计算方面遇到了麻烦,我试图将像素值转换为mm并将其反转.
从69.8开始:
Calculating MM to pixel from: 69.8 mm
69.8*300 = 20940
20940 / 2.54 = 8244.094488188975
8244.094488188975 / 10 = 824.4094488188975
Run Code Online (Sandbox Code Playgroud)
并计算回来:
Calculating pixel to MM from: 824.4094488188975
824.4094488188975/300 = 2.7480314960629917
2.7480314960629917 * 2.54 = 6.979999999999999
6.979999999999999 * 10 = 69.79999999999998
Run Code Online (Sandbox Code Playgroud)
我们想要69.8,但结果是69.79999999999998.我使用简单的窗口计算跟踪过程,第一个错误的位置是20940/2.54 = 8244.094488188975,应该是8244,094488188976.
Anny对此的帮助会很棒.