小编Art*_*lma的帖子

需要帮助来优化MySQL查询

我有6张桌子:

CREATE TABLE IF NOT EXISTS `sbpr_groups` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) DEFAULT NULL,
  `active` tinyint(1) DEFAULT '0',
  `dnd` tinyint(1) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=32 ;

CREATE TABLE IF NOT EXISTS `sbpr_newsletter` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `created_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `from` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `mail` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `subject` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `body` text COLLATE utf8_unicode_ci,
  `attach1` varchar(255) COLLATE utf8_unicode_ci NOT NULL, …
Run Code Online (Sandbox Code Playgroud)

mysql sql optimization query-optimization

19
推荐指数
1
解决办法
1504
查看次数

使用"sed"从文件中获取子字符串

谁能帮助我使用sed程序获取子串?

我有一个这行文件:

....
define("BASE", "empty"); # there can be any string (not only "empty").
....
Run Code Online (Sandbox Code Playgroud)

我需要将"空"作为字符串变量添加到我的bash脚本中.

这时我有:

sed -n '/define(\"BASE\"/p' path/to/file.ext
# returns this line:
# define("BASE", "empty");
# but I need 'empty'
Run Code Online (Sandbox Code Playgroud)

UPD:感谢@Jaypal

现在我有bash脚本:

DBNAME=`sed -n '/define(\"BASE\"/p' path/to/file.ext`
echo $DBNAME | sed -r 's/.*"([a-zA-Z]+)".*/\1/'
Run Code Online (Sandbox Code Playgroud)

它工作正常,但如果有任何方法使用一行代码进行相同的操作?

bash substring sed

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

PHP COUNT_RECURSIVE和SplFixedArray

当与SplFixedArray一起使用时,我看到了一些奇怪的行为($ arr,COUNT_RECURSIVE).以这段代码为例,......

$structure = new SplFixedArray( 10 );

for( $r = 0; $r < 10; $r++ )
{
    $structure[ $r ] = new SplFixedArray( 10 );
    for( $c = 0; $c < 10; $c++ )
    {
        $structure[ $r ][ $c ] = true;
    }
}

echo count( $structure, COUNT_RECURSIVE );
Run Code Online (Sandbox Code Playgroud)

结果...

> 10
Run Code Online (Sandbox Code Playgroud)

你会期望110的结果.这是正常的行为,因为我正在嵌套SplFixedArray对象吗?

php spl

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

CSS:提交按钮的背景图片

我已经设置了自定义背景图片的提交按钮.但它在不同的浏览器上显示不同.

几乎所有浏览器都显示正确:

在此输入图像描述

但在2它有额外的高度:

在此输入图像描述

任何人都可以指出我的标记有什么问题吗?

CSS:

input[type="submit"]{
    background: url(http://dl.dropbox.com/u/17055243/icons.png) -99px 0px  no-repeat;
    width:30px;
    height:30px;
    border:none;
    float:left;
    margin:30px 0 0;
    cursor:pointer;
}
Run Code Online (Sandbox Code Playgroud)

HTML:

<form>
    <input type="text" class="placeholder" value="Search" />
    <input type="submit" value="" />
</form>
Run Code Online (Sandbox Code Playgroud)

测试:

  • IE 8.0 不错
  • IE 7.0 不错
  • iPhone
  • Chrome 24.0 不错
  • Firefox 18.0.2 不错
  • Safari 5.1(Mac OS X 10.7.1)不错
  • Opera 12.14(Windows 7 32位)不错
  • Safari 5.1.7(Windows 7 32位)额外高度
  • Opera 11.51(Mac OS X 10.7.1)额外高度

现场演示jsfiddle.

html css cross-browser

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

带有CSS背景的样式<li>元素,仅显示部分图像

任何人都可以帮我列表.

我有一张图片: 在此输入图像描述

现在我需要构建列表,默认公牛用左侧箭头替换(但不是整个图像):

在此输入图像描述

我如何使用跨浏览器css实现它?

我的HTML标记是:

<ul>
    <li><a href="#">Conveniently located on Adelaide St. W, one block east of the Bathurst   and Adelaide intersection, just north of the Gardiner Expressway, downtown Toronto.</a></li>
    <li>All units are located indoors, which means they are all climate controlled.</li>
    <li>There is an indoor loading dock with four bays, two of which are large enough to accommodate up to 50' trailers.</li>
    <li>Complimentary use of on-site dollies and pallet truck.</li>
</ul>
Run Code Online (Sandbox Code Playgroud)

html css html-lists

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

为什么,当我添加两个整数时,PHP会返回错误的结果(6 + 7 = 1)?

我有两个变量:

$qty = 7;
$_POST['qty'] = 6;

var_dump($qty, $_POST['qty']); // both vars are integers
$_SESSION['qty'] = $qty + $_POST['qty'];
echo '='.$_SESSION['qty'];
Run Code Online (Sandbox Code Playgroud)

返回:

int(7) int(6) =1 
Run Code Online (Sandbox Code Playgroud)

(int)$qty, (int)$_POST['qty'] 没有解决问题.

我究竟做错了什么?

更新:

... intval($qty) + intval($_POST['qty']);
Run Code Online (Sandbox Code Playgroud)

没有帮助.

我还注意到一个细节.问题只有在$ _SESSION ['qty']> = 10时才会出现问题:

$_SESSION['qty'] = $qty + $_POST['qty']; // $qty = 3, $_POST['qty'] = 6
Run Code Online (Sandbox Code Playgroud)

返回好结果($ _SESSION ['qty'] = 9).

解决了

谢谢你的帮助.但问题更多不实际(这是一个服务器问题).无论如何+1全部.

php math

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