我似乎无法找到一个关于一个简单问题的答案:如何将任何数字四舍五入到最近int?
例如,每当数字为0.2,0.7,0.2222,0.4324,0.9999时,我希望结果为1.
到目前为止我有
int b = (int) Math.ceil(a / 100);
Run Code Online (Sandbox Code Playgroud)
但它似乎并没有完成这项工作.
通常的CSS中心问题,只是不适合我,问题是我不知道完成宽度px
我有一个div为整个导航,然后内部的每个按钮,当有多个按钮时,它们不再中心.:(
CSS
.nav{
margin-top:167px;
width:1024px;
height:34px;
}
.nav_button{
height:34px;
margin:0 auto;
margin-right:10px;
float:left;
}
Run Code Online (Sandbox Code Playgroud)
HTML
<div class="nav">
<div class="nav_button">
<div class="b_left"></div>
<div class="b_middle">Home</div>
<div class="b_right"></div>
</div>
<div class="nav_button">
<div class="b_left"></div>
<div class="b_middle">Contact Us</div>
<div class="b_right"></div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激.谢谢
结果
如果宽度未知,我确实找到了一个按钮中心的方式,不是很开心但不重要,它的工作原理:D
最好的方法是把它放在一张桌子里
<table class="nav" align="center">
<tr>
<td>
<div class="nav_button">
<div class="b_left"></div>
<div class="b_middle">Home</div>
<div class="b_right"></div>
</div>
<div class="nav_button">
<div class="b_left"></div>
<div class="b_middle">Contact Us</div>
<div class="b_right"></div>
</div>
</td>
</tr>
</table>
Run Code Online (Sandbox Code Playgroud) 我无法在任何地方找到答案,但我看不到它的子类别成员在根类别页面上显示任何产品.当我从顶部导航中单击类别时,我会在左侧和右侧获得子类别(主要内容)"没有与选择匹配的产品".每个子猫.尽管展示了它的产品.
在管理员 - >目录 - >管理类别中,每个类别显示产品数量,即(4)但其根类别显示(0).
有任何想法吗?
提前致谢
解
转到管理员 - >目录 - >管理类别 - >"选择类别" - >显示设置 - >是锚点="是"
然后:
管理员 - >系统 - >索引管理 - >"全选" - >"重新索引数据" - >"提交"
感谢大家的评论
可能重复:
有人可以在php中建议最好的图像大小调整脚本吗?
在PHP中,我仍然是关于图像处理或文件处理的新手.
非常感谢有关以下内容的任何意见
我使用简单的html表单发布图像文件并通过php上传.当我尝试更改我的代码以容纳更大的文件(即调整大小)时,我收到一个错误.一直在网上搜索,但无法找到任何非常简单的东西.
$size = getimagesize($_FILES['image']['tmp_name']);
//compare the size with the maxim size we defined and print error if bigger
if ($size == FALSE)
{
$errors=1;
}else if($size[0] > 300){ //if width greater than 300px
$aspectRatio = 300 / $size[0];
$newWidth = round($aspectRatio * $size[0]);
$newHeight = round($aspectRatio * $size[1]);
$imgHolder = imagecreatetruecolor($newWidth,$newHeight);
}
$newname= ROOTPATH.LOCALDIR."/images/".$image_name; //image_name is generated
$copy = imagecopyresized($imgHolder, $_FILES['image']['tmp_name'], 0, 0, 0, 0, $newWidth, $newHeight, $size[0], $size[1]);
move_uploaded_file($copy, $newname); //where I want to move …Run Code Online (Sandbox Code Playgroud) 反正有没有改变静态布局的字体大小?这就是我到目前为止在正确的位置显示文本.
int question_text_width = game_question_bg.getWidth();
int question_text_xPos = 100;
int question_text_yPos = 100;
StaticLayout question_text = new StaticLayout(text, text_paint, question_text_width, Layout.Alignment.ALIGN_CENTER, 1.2f, 1.0f, false);
//Position Text
canvas.translate(question_text_xPos, question_text_yPos);
//As a form of setMaxLine
canvas.clipRect(new Rect(0, 0, game_question_bg.getWidth(), game_question_bg.getHeight()));
question_text.draw(canvas);
//Reset canvas back to normal
canvas.restore();
Run Code Online (Sandbox Code Playgroud) 我正在使用symfony 2.1与作曲家,我正在尝试运行作曲家更新
但是,我不断得到"有未提交的更改",我不记得更改供应商目录中的任何文件,它几乎每个包都会出现!
我尝试使用composer install来恢复任何更改,但它似乎没有效果.如果我删除锁文件并尝试安装,我会收到错误消息,如"symfony 2.1要求symfony 2.1 - > symfony 2.1 satisfiable".它没有意义.
如果我删除供应商中的内容,我会得到相同的错误消息,没有安装.
我所做的一切似乎都没有用.有没有"强制"更新的方法,无论"未提交的更改"
任何人都知道如何为ExtJS中的任何字段的子字段建模?例如
Ext.data.Model:
fields:[
{name: 'id', type: 'int'},
{name: 'title', type: 'string'},
{name: 'description', type: 'string'},
{name: 'priority', type: 'auto', fields:[
{name: 'code', type: 'string'}
]},
{name: 'createdBy', type: 'auto'},
]
Run Code Online (Sandbox Code Playgroud)
然后在我的网格面板中
Ext.grid.Panel
columns:[
{header:'Title', dataIndex:'title', flex:1},
{header:'Priority', dataIndex:'code'}
],
Run Code Online (Sandbox Code Playgroud)
知道如何在'优先级'下访问dataIndex'代码'吗?提前致谢!
任何想法为什么我得到....
Run Code Online (Sandbox Code Playgroud)Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to在第77行的/home/frich/public_html/creation/systemc/sMain/upload_image.php中分配9792个字节)
在以下行
$oldImage = imagecreatefromjpeg($img);
Run Code Online (Sandbox Code Playgroud)
php从HTML表单中获取图像并调整其大小.
如果它是一个小文件,工作完全正常.就是几百KB
尝试使用更大的文件,因为我想要最多4mb.我得到错误的图像是ca. 2MB
提前致谢
Hithere,我有一个奇怪的问题,当我从一个json文件加载一个树时,它进入一个循环并显示如下的树(在一个连续的循环中)
-A
-A
-A
-A
Run Code Online (Sandbox Code Playgroud)
我的json
{
"success": true,
"results": [
{ "text": "number 1", "leaf": true },
{ "text": "number 2", "leaf": true },
{ "text": "number 3", "leaf": true },
{ "text": "number 4", "expanded": true, "children":[
{ "text": "number 4.1", "leaf": true },
{ "text": "number 4.2", "leaf": true },
{ "text": "number 4.3", "leaf": true }
]},
{ "text": "number 5", "leaf": true }
]
}
Run Code Online (Sandbox Code Playgroud)
我的模特
Ext.define('App.model.TreeModel', {
extend:'Ext.data.Model',
fields: [
{ name: 'text', type: …Run Code Online (Sandbox Code Playgroud) 我在获取以下记录时遇到问题
TABLE
id | holiday_From | holiday_To
1 | 2012-01-02 | 2012-01-03
1 | 2012-01-11 | 2012-01-16
1 | 2012-01-08 | 2012-01-22
1 | 2012-01-29 | 2012-01-30
1 | 2012-01-08 | 2012-01-11
Run Code Online (Sandbox Code Playgroud)
我正在尝试获取给定月份的假期 - 即
BETWEEN "2012-01-01" AND "2012-01-31"
Run Code Online (Sandbox Code Playgroud)
有一个类似的帖子,但我无法根据我的需要调整它
RESULT
day (within range) | count() //number of ppl on holiday
DATE | 3
Run Code Online (Sandbox Code Playgroud)
例如
SAMPLE OUTPUT
2012-01-02 | 1
2012-01-03 | 1
2012-01-08 | 2
2012-01-09 | 2
2012-01-10 | 2
2012-01-11 | 3
2012-01-12 | 2 …Run Code Online (Sandbox Code Playgroud) 是否可以覆盖外部角度组件正在使用的组件的模板?
即组件库导出A要由其他人使用的组件。组件A但是使用组件B内部。是否可以覆盖组件模板B?
php ×3
extjs ×2
file-upload ×2
android ×1
angular ×1
button ×1
canvas ×1
categories ×1
center ×1
composer-php ×1
css ×1
date ×1
field ×1
font-size ×1
fonts ×1
grid ×1
image ×1
int ×1
java ×1
json ×1
magento ×1
math ×1
memory ×1
model ×1
mysql ×1
overriding ×1
resize ×1
rounding ×1
store ×1
symfony ×1
symfony-2.1 ×1
templates ×1
tree ×1