问题列表 - 第42334页

PHP Request.QueryString-$ _GET,但条件不确定如何

我不熟悉php,并且想使用php编写重定向脚本(我正在使用的服务器不支持asp)

我认为应该是这样的

<?php if ($_GET[id]; == 'test') {echo '<meta http-equiv="refresh" content="0;URL=http://www.test.com" />'} ?>
Run Code Online (Sandbox Code Playgroud)

我想发送一个查询字符串,如http://www.domain.com?id=test页面应重定向到http://www.test.com或查询http://www.domain.com?id=example,它应该重定向到http://www.theexamplesite.com

使用javascript和经典的asp,我会这样做的:

<% if (Request.QueryString("id") == 'test') { %><meta http-equiv="refresh" content="0;URL=http://www.test.com" /><% } %>
<% if (Request.QueryString("id") == 'example') { %><meta http-equiv="refresh" content="0;URL=http://www.theexamplesite.com" /><% } %>
Run Code Online (Sandbox Code Playgroud)

希望你能帮我!

谢谢

php

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

枚举并将属性从一个对象复制到另一个相同类型的对象

我使用第三方控件将一些数据导出为不同的格式.该控件有一个属性ExportSettings.但它是只读的.

我要手动设置它的属性,如

ctrl.ExportSettings.Paging = false;
ctr.ExportSettings.Background = Color.Red;
Run Code Online (Sandbox Code Playgroud)

所以我从用户那里得到了ExportSettings对象,我想把它设置为控件.

如何将其所有成员值复制到用户控件?

.net c# copy object

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

仅在用户的ip是唯一的时才执行查询

我想基于他/她的IP地址,每个用户只将数据保存到数据库一次.我有一个包含url,日期,时间和ip列表的数据库.如何检查ip是否已存在,如果不存在 - 将数据插入数据库,否则什么都不做?到目前为止,这是我的代码:

<Check if IP already exists in the database - if no - insert:>


$query = "INSERT INTO link (url, date, time, ip) VALUES ('$ref','$date','$time', '$someip')";
mysql_query($query) or die('Error, insert query failed');

}
else {

echo 'This ip already exists';

}
Run Code Online (Sandbox Code Playgroud)

php mysql sql

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

Bloom过滤器实现

使用Bloom过滤器,我们将获得空间优化.cassandra框架还具有Bloom Filter的实现.但详细地说,这个空间优化是如何实现的?

java algorithm bloom-filter space-complexity data-structures

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

CoreData问题: - [NSManagedObject setValue:]:发送到实例的无法识别的选择器

我昨天刚开始使用CoreData,我疯了:(我创建了一个使用CoreData的项目(勾选方框 - 使用CoreData).创建实体,然后为所有实体创建NSManagedObject类(我猜他们创建实体的'setter'和'getter'方法).

现在,我在AppDeletegate中#imported所有这些类,并在我的applicationDidFinishLaunching方法中写了这个:

(订阅是申请中的实体之一)

NSManagedObjectContext *context = [self managedObjectContext];
 Subscriptions *sbs = (Subscriptions *)[NSEntityDescription insertNewObjectForEntityForName:@"Subscriptions" inManagedObjectContext:context];
 [sbs setTitle:@"OK"];
 [sbs setType:@"Tag"];
 [sbs setCode:@"cars"];

 NSError *error = nil;
 if (![context save:&error]) {
  NSLog(@"Couldn't create the subscription");
 }
Run Code Online (Sandbox Code Playgroud)

当我运行它时,我收到此错误

[NSManagedObject setTitle:]:无法识别的选择器发送到实例0x6160550

我不知道为什么会这样.请帮忙!!!在此先感谢大家!

添加Subscriptions
Subscriptions.h 的标题

@interface订阅:NSManagedObject {
}
@property(nonatomic,retain)NSString*Type;
@property(nonatomic,retain)NSDecimalNumber*Read;
@property(nonatomic,retain)NSString*Title;
@property(nonatomic,retain)NSString*Code;
@property(nonatomic,retain)NSDecimalNumber*New;
@结束

我什么都没改变.就像Xcode创建它一样.

iphone core-data objective-c nsmanagedobject ios

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

17
推荐指数
3
解决办法
6万
查看次数

帮助Linq和Generics.在Query中使用GetValue

我正在试图创建一个函数,在基于属性和值的查询中添加'where'子句.这是我的函数的一个非常简单的版本.

Private Function simplified(ByVal query As IQueryable(Of T), ByVal PValue As Long, ByVal p As PropertyInfo) As ObjectQuery(Of T)

    query = query.Where(Function(c) DirectCast(p.GetValue(c, Nothing), Long) = PValue)
    Dim t = query.ToList 'this line is only for testing, and here is the error raise
    Return query

End Function
Run Code Online (Sandbox Code Playgroud)

错误消息是:LINQ to Entities无法识别方法'System.Object CompareObjectEqual(System.Object,System.Object,Boolean)'方法,并且此方法无法转换为商店表达式.

看起来像是不能在linq查询中使用GetValue.我能以其他方式实现这一目标吗?

在C#/ VB中发布您的答案.选择让你感觉更舒适的那个.

谢谢

编辑:我也尝试了相同的结果

Private Function simplified2(ByVal query As IQueryable(Of T))

    query = From q In query
            Where q.GetType.GetProperty("Id").GetValue(q, Nothing).Equals(1)
            Select q
    Dim t = query.ToList
    Return …
Run Code Online (Sandbox Code Playgroud)

linq vb.net generics linq-to-entities

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

构建镀铬扩展程序以上传图像(从剪贴板)

我想编写一个简单的chrome扩展来替换以下一系列步骤,我必须经常为大学做这些步骤:

  1. 制作一些东西的截图
  2. 编辑Paint中的截图
  3. 将unnamend.png保存到硬盘
  4. 将unnamed.png上传到ima​​geshack.us/pic-upload.de或任何其他网站
  5. 与他人分享图像链接.

我不关心使用哪个图片上传服务,我只想自动化这个用例以节省时间(我已经红色并且已经开始使用chrome扩展并检查了他们的API,但就是这样,这个页面:http://farter.users.sourceforge.net/blog/2010/11/20/accessing-operating-system-clipboard-in-chromium-chrome-extensions/似乎很有用,但我不能让它覆盖我的系统剪贴板 - 而且我找不到可以帮助我的教程.

javascript clipboard google-chrome

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

问题与$(this).val().长度的铬 - 错误的值

我在chrome中使用以下JQuery:$(this).val().length 这表示一个输入字段.现在在其他所有浏览器中都可以正常使用,但在Chrome中它有时会返回错误的值.假设我在输入字段中有3个字符,但alert($(this).val().length);会说4.

有谁知道为什么会发生这种情况并可能解决问题?

编辑:一些代码

$("#fieldset1 input[type=text]").keyup(function(e){
    if($(this).val().length == $(this).attr('maxlength')){
                if($(this).parent().children().last().attr('id') == $(this).attr("id")){
                    $(this).parent().next().find(':input').focus();
                }else{
                    $(this).next("input").focus();
                }
            }
});
Run Code Online (Sandbox Code Playgroud)

如果我注意到这种行为,我在第一次之后添加了警报.

edit2:把它放在JSFiddle:http://jsfiddle.net/QyyBV/

HTML:

<fieldset id ="test">
  <input type="text" id="1" maxlength="5" size="5"/>
  <input type="text" id="2" maxlength="5" size="5"/>
  <input type="text" id="3" maxlength="5" size="5"/>
  <input type="text" id="4" maxlength="5" size="5"/>
  <input type="text" id="5" maxlength="5" size="5"/>
</fieldset>
Run Code Online (Sandbox Code Playgroud)

JavaScript的:

      $(document).ready(function() {

          $("#test input[type=text]").keydown(function(e){
            if(e.which == 8){
              if($(this).val().length == 0){
                $(this).prev().focus().val($(this).prev().val());
              }
            }
          });

          $("#test input[type=text]").keyup(function(e){


if($(this).val().length == $(this).attr('maxlength') ){
          if($(this).parent().children().last().attr('id') == $(this).attr("id")){ …
Run Code Online (Sandbox Code Playgroud)

jquery google-chrome

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

如何在不关闭套接字的情况下取消异步读/写?

如何在不关闭套接字的情况下取消异步读/写?我使用boost.asio.谢谢.

c++ boost-asio

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