问题列表 - 第35248页

在Android中将警报设置为特定日期和时间

请好好看看这个.我正在尝试为特定时间和日期设置闹钟.它似乎没有工作,我真的不知道为什么.

             Calendar cal = Calendar.getInstance();

         cal.setTimeInMillis(System.currentTimeMillis());
         cal.set(Calendar.YEAR, mYear);
         cal.set(Calendar.MONTH,mMonth);
         cal.set(Calendar.DAY_OF_MONTH,mDay);
         cal.set(Calendar.HOUR,mHour);
         cal.set(Calendar.MINUTE,mMinutes);

// where mYear, mMonths, mDay, mHour and mMinutes are int values from the Date and Time picker dialogs respectively

     Intent activate = new Intent(this, Alarm.class);
     PendingIntent alarmIntent = PendingIntent.getBroadcast(this, 0, activate, 0);
     alarms = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
     alarms.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), alarmIntent);
Run Code Online (Sandbox Code Playgroud)

只是为了让你知道,如果我用alerts.set()方法中的System.CurrentTimeInMillis()替换cal.getTimeInMillis(),它就有效.但那显然是我不想要的.谢谢

android

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

Mysqltuner对my.cnf的建议和修改

在Serverfault上有这个问题几天没有运气.

我在VPS上运行了mysqltuner.pl,对于要更改的变量的建议有很多问题.我确信这些都是复杂答案的一般性问题.

我不知道如何编写查询并对服务器进行测试,但我只是试图从服务器中获得更多性能,该服务器运行五个WordPress站点,每月页面查看次数超过200,000次.

我已经通过phpmyadmin优化了数据库(并定期这样做),但调谐器仍然说有碎片表.因为这是WordPress,我无法在核心代码中更改查询.

但是我应该增加多少变量,如query_cache_size和innodb_buffer_pool_size?其他innodb变量怎么样?

my.cnf中不存在一些建议的变量,如table_cache,并在调谐器报告等中标记.我可以将它们添加到my.cnf吗?

(为什么这个块在my.cnf中重复?我可以删除副本吗?)

set-variable = innodb_buffer_pool_size=2M
set-variable = innodb_additional_mem_pool_size=500K
set-variable = innodb_log_buffer_size=500K
set-variable = innodb_thread_concurrency=2
Run Code Online (Sandbox Code Playgroud)

下面是my.cnf和mysqltuner的输出:

my.cnf的内容:

query-cache-type = 1
query-cache-size = 8M

set-variable=local-infile=0
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql

old_passwords=1

skip-bdb

set-variable = innodb_buffer_pool_size=2M
set-variable = innodb_additional_mem_pool_size=500K
set-variable = innodb_log_buffer_size=500K
set-variable = innodb_thread_concurrency=2

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
skip-bdb

set-variable = innodb_buffer_pool_size=2M
set-variable = innodb_additional_mem_pool_size=500K
set-variable = innodb_log_buffer_size=500K
set-variable = innodb_thread_concurrency=2
Run Code Online (Sandbox Code Playgroud)

mysqltuner的输出:

------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.0.45 …
Run Code Online (Sandbox Code Playgroud)

mysql wordpress performance

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

将字符串作为参数传递给函数时使用双引号与单引号

我有一个非常奇怪的问题,这不是一个真正的问题,因为我已经修复它但仍然,当我尝试连接到mysql数据库时:

mysql_connect("server", "user", "pass") or die(mysql_error());
Run Code Online (Sandbox Code Playgroud)

我越来越:

用户'用户'@'服务器'拒绝访问(使用密码:是)

但是当我将密码周围的引号更改为单引号时:

mysql_connect("server", "user", 'pass') or die(mysql_error());
Run Code Online (Sandbox Code Playgroud)

它工作得很好.我在另一台服务器上没有这个问题.所以也许它是在mysql设置或php.ini中的东西?

谢谢.

php mysql quotes

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

jQuery检查当前的url

我们在页面上 'http://site.com/movies/moviename/'

我们怎么知道,是否有/movies/当前网址(直接在网站的根目录之后)?


代码应该给:

真的 'http://site.com/movies/moviename/'

而且是假的 'http://site.com/person/brad-pitt/movies/'


谢谢.

url jquery

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

目前有关Perl统计模块的评论吗?

我想知道CPAN中统计模块的当前状态是什么,是否有人知道最近的任何评论或者可以评论它对这些模块的喜欢/不喜欢?

我使用了clasical:Statistics :: Descriptive,Statistics :: Distributions,以及Bundle :: Math :: Statistics中包含的其他一些内容

有些模块很长时间没有更新.我不知道这是因为它们坚如磐石还是被更好的模块所取代.

有人知道任何类似于旧版本的当前评论:

使用Perl进行统计:数据处理和统计计算

NB(对于那些建议使用R的人;-)):我的所有代码主要是在perl中,但我使用R进行统计和绘图.我通常使用perl准备数据帧并将per脚本中的R脚本作为模板编写并保存到文件中并从perl执行它们.但有时你有小数据集,其中效率不是问题(我使用perl而不是它;-))并且你想在你的perl生成的报告中添加一些统计数据和直方图.

statistics perl

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

为什么Int32是值类型?

为什么System.Int32派生自System.Object(通过System.ValueType)值类型而System.Object是引用类型?

.net

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

在侧边栏中添加页面

所以我有一个名为"最新消息"的页面并使用自定义模板t_latest_news.php

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="latest-news" id="post-<?php the_ID(); ?>">
<?php the_content(); ?>
<?php edit_post_link('Edit this page','<p class="edit-link">','</p>'); ?>
</div><!-- /.latest-news -->
<?php endwhile; endif; ?>

我创建了一个页面项目并将一些内容放入该页面.现在,我想在侧边栏上显示内容.我该怎么办?

我尝试过类似的东西:

<?php include(get_query_template('t_latest_news.php')); ?>
<?php include(TEMPLATEPATH . 't_latest_news.php'); ?>
<?php get_query_template('t_latest_news.php') ?>
<?php get_template_part( 't_latest_news.php' ); ?>

但它们都不起作用.救命!


<?php query_posts('page_id=76'); ?>
<?php while (have_posts()) { the_post(); ?>
    <h2><?php the_title(); ?></h2>
    <?php the_content(); ?>
<?php } ?>
<?php wp_reset_query(); ?>

它适用于"page_id"但不适用于pagename.任何的想法?

wordpress

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

Nullable DateTime参数在调用操作时永远不会绑定

我有以下功能signuture:

public JsonResult PopulateGrid(int page, Guid? accountId, Guid? systemUserId, Guid? branchId, DateTime? fromDate, DateTime? toDate, HomeVisitType? homeVisitType)
Run Code Online (Sandbox Code Playgroud)

每个参数都绑定得很好,除非toDate结果总是为null.
检查时,Request.QueryString["toDate"]它会检索正确的值,即30/09/2010.
似乎DateTime在绑定时需要另一种格式.
什么是正确的格式?

asp.net-mvc datetime

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

How to explicitly fail a task in ruby rake?

Let's say I have a rakefile like this:

file 'file1' => some_dependencies do
  sh 'external tool I do not have control over, which sometimes fail to create the file'
  ???
end

task :default => 'file1' do
  puts "everything's OK"
end
Run Code Online (Sandbox Code Playgroud)

Now if I put nothing in place of ???, I get the OK message, even if the external tool fails to generate file. What is the proper way to informing rake, that 'file1' task has failed and it should abort …

ruby rake

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

packing and unpacking variable length array/string using the struct module in python

I am trying to get a grip around the packing and unpacking of binary data in Python 3. Its actually not that hard to understand, except one problem:

what if I have a variable length textstring and want to pack and unpack this in the most elegant manner?

As far as I can tell from the manual I can only unpack fixed size strings directly? In that case, are there any elegant way of getting around this limitation without padding …

python binary struct python-3.x

30
推荐指数
4
解决办法
7万
查看次数