嗨,我有设置cookie的问题.我有这样的网址
http://www.myweb.com/series/Setayesh/Part-1在这个网址,我检查cookie是否被设置
if(isset($_COOKIE['cookiename']))
{
//Perform some operations
}
else
{
setcookie('cookiename',$value,time()+36000)
}
Run Code Online (Sandbox Code Playgroud)
它适用于所有网址
http://www.myweb.com/series/Setayesh/Part-1 http://www.myweb.com/series/Setayesh/Part-1 http://www.myweb.com/series/Setayesh/Part-1 and so on
但是当网址成为时
http://www.myweb.com/series/Pezeshkan/Part-1if条件不执行它总是在同一浏览器中的其他条件.这是什么问题?当我设置cookie时,我没有设置任何url然后为什么它对这种情况表现不同.
我一直在开发一个查询来使用DMV获取索引碎片信息.
但是,查询提供的结果比预期的要多.我相信问题在于加入.
有什么想法吗?
select distinct '['+DB_NAME(database_id)+']' as DatabaseName,
'['+DB_NAME(database_id)+'].['+sch.name+'].['
+ OBJECT_NAME(ips.object_id)+']' as TableName,
i.name as IndexName,
ips.index_type_desc as IndexType,
avg_fragmentation_in_percent as avg_fragmentation,
SUM(row_count) as Rows
FROM
sys.indexes i INNER JOIN
sys.dm_db_index_physical_stats(NULL,NULL,NULL,NULL,'LIMITED') ips ON
i.object_id = ips.object_id INNER JOIN
sys.tables tbl ON tbl.object_id = ips.object_id INNER JOIN
sys.schemas sch ON sch.schema_id = tbl.schema_id INNER JOIN
sys.dm_db_partition_stats ps ON ps.object_id = ips.object_id
WHERE
avg_fragmentation_in_percent <> 0.0 AND ips.database_id = 6
AND OBJECT_NAME(ips.object_id) not like '%sys%'
GROUP BY database_id, sch.name, ips.object_id, avg_fragmentation_in_percent,
i.name, …Run Code Online (Sandbox Code Playgroud) 我想开始在我的项目网站上使用GitHub Pages.这只需要gh-pages在repo中命名的分支(子树),并提供其内容.问题是网站的一部分(手动,更改日志,下载页面......)是由构建系统自动生成的,所以我想找到gh-pages在主要仓库保持打开时将这些更改提交到分支的最佳方法master(或任何地方).
为了提交gh-pages分支,我可以编写一个脚本,将repo克隆到一个临时目录中,进行修改,提交它们,然后将它们推回到主repo.但这听起来像一个容易出错的过程,所以我希望有一个更简单的方法.
一位朋友建议我可以将gh-pages分支作为子模块添加到主存储库中.我做了一个小实验,但它不太有效:
$ git init main
Initialized empty Git repository in /tmp/main/.git/
$ cd main
$ touch main.txt
$ git add .
$ git commit -m'Initial commit in main branch.'
[master (root-commit) 1c52a4e] Initial commit in main branch.
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 main.txt
$ git symbolic-ref HEAD refs/heads/gh-pages
$ rm .git/index
$ git clean -fdx
Removing main.txt
$ touch index.html …Run Code Online (Sandbox Code Playgroud) 我想抛出一个运行时异常,以防我的类不变式无效。由于这是编程错误(类似于NullPointerException),因此客户端不应捕获该异常。
应该将异常类声明为私有还是公共(或其他)?
class Foo
{
// ...
private static class InvariantsViolated
{
// ...
}
}
Run Code Online (Sandbox Code Playgroud)
是否有关于自定义运行时异常和可见性的准则?
我有一个表,我们的服务提供商插入UNICODE数据,但我的oracle characterset是WE8ISO8859P1.
现在我得到的数据我使用oracle的功能,但它显示???????
从client_campaigns中选择CONVERT(消息,'AL32UTF8','WE8ISO8859P1')
更多消息库存是CLOB类型.
由于dataloss,我无法更改数据库的字符集,其次是生产和字符集的更改可能会导致错误.
现在请指导我如何将这些数据作为UNICODE获取?
问候,imran
我正在处理JavaScript上的性能问题.所以我只想问:检查字符串是否包含另一个子字符串的最快方法是什么(我只需要布尔值)?您能否提出您的想法和示例代码段?
我是Objective C和IPhone开发的新手.
我在我的IPhone应用程序中使用UIDatePicker,我的要求是允许用户仅从DatePicker中选择将来的日期.
为此,我想仅在DatePicker中禁用过去的日期和时间,而不是在代码中进行比较验证.
这是可能的还是有一个选项可以在DatePicker控件本身中禁用过去的日期.
使用Trac时,它总是突出显示类名作为对wiki页面的引用,如下所示:
MyClass?
Run Code Online (Sandbox Code Playgroud)
我怎么能禁用它?它使票证文本不可读.
当我在postgresql上的Rails应用程序中运行我的迁移时,我得到了以下通知
NOTICE: CREATE TABLE will create implicit sequence "notification_settings_id_seq" for serial column "notification_settings.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "notification_settings_pkey" for table "notification_settings"
Run Code Online (Sandbox Code Playgroud)
我的迁移文件包含088_create_notification_settings.rb
class CreateNotificationSettings < ActiveRecord::Migration
def self.up
create_table :notification_settings do |t|
t.integer :user_id
t.integer :notification_id
t.boolean :notification_on
t.boolean :outbound
end
end
def self.down
drop_table :notification_settings
end
end
Run Code Online (Sandbox Code Playgroud)
我想知道
这个通知意味着什么?
如何避免这种通知?
如果不避免,此类通知对应用程序的影响是什么?
问候,
萨里尔
如何在facecolor条形图中添加渐变?我想知道如何使用简单的单色渐变来复杂多色渐变.这是一些示例代码:
import numpy as np
import matplotlib.pyplot as plt
plt.figure(figsize=(1,5))
plt.axis([0,1,-50,200])
plt.xticks([])
plt.yticks([-40,180])
plt.bar(left=0, width=1, bottom=-40, height=220, color='r')
plt.subplots_adjust(left=0.4, right=0.8)
plt.savefig("test.png")
Run Code Online (Sandbox Code Playgroud) java ×2
colors ×1
exception ×1
git ×1
github ×1
gradient ×1
indexing ×1
invariants ×1
iphone ×1
javascript ×1
jdbc ×1
matplotlib ×1
objective-c ×1
oracle ×1
php ×1
postgresql ×1
python ×1
regex ×1
ruby ×1
setcookie ×1
sql-server ×1
substring ×1
t-sql ×1
trac ×1
uidatepicker ×1
visibility ×1