小编Joe*_*e C的帖子

301重定向的cflocation vs cfheader

我正在"重命名"我正在处理的项目的现有文件.为了保持向后兼容性,我将保留cfm文件以将用户重定向到新用户.

  • buy.cfm:老了
  • shop.cfm:new

为了尽可能保持一切清洁,我想在用户试图去buy.cfm时发送301状态码响应.

我知道我可以使用cflocationstatuscode属性

<cflocation url="shop.cfm" statuscode="301" addtoken="false">
Run Code Online (Sandbox Code Playgroud)

或者我可以使用cfheader标签.

<cfheader statuscode="301" statustext="Moved permanently">
<cfheader name="Location" value="http://www.mysite.com/shop.cfm">
Run Code Online (Sandbox Code Playgroud)

是否有任何理由使用一种方法而不是另一种方法?

coldfusion redirect cflocation

8
推荐指数
2
解决办法
7692
查看次数

使用Python从Twitter获取带有hashtag的推文

我们如何根据哈希标记查找或获取推文.即我想找到关于某一主题的推文?是否可以在Python中使用Twython?

谢谢

python twitter twython

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

从IOS应用程序注销的完美方式是什么?

以下代码正在运行,但有一个错误.场景是,我首先登录进入应用系统.登录成功后,应用程序将设置UserDefaults(UserId).之后,我可以使用存储的UserId导航应用程序视图.一旦我进入设置和选项卡注销,这将清理UserId并转到登录视图.

BUG:当我再次登录应用程序并单击主页按钮转到iPhone桌面并关闭应用程序,然后返回再次打开它仍然存储UserId.所以,如果我去设置并注销,将清理UserId,不会进入登录视图.我不知道为什么.

代码:

- (IBAction)resetKeychain:(id)sender {

    UIActionSheet *actionSheet = [[UIActionSheet alloc] 
                 initWithTitle:@"Are you sure you want to logout?" 
                 delegate:self 
                 cancelButtonTitle:@"Cancel" 
                 destructiveButtonTitle:@"Logout"
                 otherButtonTitles:nil];
    actionSheet.actionSheetStyle = UIActionSheetStyleDefault;
    [actionSheet showFromTabBar:self.tabBarController.tabBar];
    [actionSheet release];

}

- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
    if (buttonIndex ==0) {
        //logout
        NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults];
        //delete user ID fro user Defaults
        [defaults setObject:nil forKey:@"UserId"];
        //redirect to login view

        NewClassMoonAppDelegate * appsDelegate =[[UIApplication sharedApplication] delegate];
        [appsDelegate.window addSubview:[appsDelegate.login view]];

    }
}
Run Code Online (Sandbox Code Playgroud)

iphone logout ios

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

PL/SQL过程 - 值太多

我确信这很简单,但我是PL/SQL的新手,这让我感到困惑.

我写了一个简单的存储过程来返回一些关于客户的值.蝙蝠,%rowtype它们不会作为保留关键字出现,但编译器没有将这些标记为错误.

它,但是,忽略了整个SQL语句标记线FROM demo_customers作为too many values.即使我尝试将其缩小为仅选择一列,它仍然会给我相同的错误.

create or replace
PROCEDURE GETCUSTOMER 
(
  arg_customerID demo_customers.customer_id%type,
  returnRec OUT demo_customers%rowtype
) 
AS
BEGIN
  SELECT  customer_id, cust_first_name, cust_last_name, cust_email
  INTO    returnRec
  FROM    demo_customers
  WHERE   customer_id = arg_customerID ;

END GETCUSTOMER;
Run Code Online (Sandbox Code Playgroud)

oracle plsql stored-procedures

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

为什么值列表将整数转换为浮点数?

ColdFusion的valuelist函数文档说它不会评估这些值,而这就是它过去一直对我的表现.我以前valuelist多次使用过该功能,以前从未遇到过这个问题.我们正在使用CF9.0.1,但这最初出现在CF9.0的一个实例上.

当我们number从Oracle数据库中提取值时,情况出现了,该数据库支持浮点值.存储的值都是整数,而不是浮点数.下面的代码复制了我们看到的行为.数据是通过我们可以更改(使用CAST)的存储过程检索的,但是如果可能的话我们希望避免.

<cfscript>
    qryVLTest = queryNew('member_id') ;
    for ( i = 1; i LTE 10; i=i+1) {
      queryAddRow(qryVLTest,1) ;
      querySetCell(qryVLTest,'member_id',i) ;   
    }
    writedump(qryVLTest) ;
    writeoutput(valuelist(qryVLTest.member_id)) ;
</cfscript>
Run Code Online (Sandbox Code Playgroud)

转储显示我期望的值:整数1-10.

但是,该valuelist函数的输出返回以下内容:

1,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0

评估第一个之后的所有值并将其转换为浮点数.为什么会这样,以后如何防止这种情况发生?

coldfusion

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

linkedin访问令牌oauth_expires_in VS 60天到期

http://developer.linkedin.com/documents/authentication(部分:刷新访问令牌)

该段说

LinkedIn访问令牌可以在60天内刷新

另一方面,它还说客户端应用程序可以跟踪令牌创建日期并将其与oauth_expires_in value(以秒为单位)进行比较,并在需要时刷新令牌.

但是,oauth_expires_in=599当我调用请求令牌端点时,我只得到(秒).

当我检索请求令牌时 oauth_token=xxxxx&oauth_token_secret=xxxxx&oauth_callback_confirmed=true&xoauth_request_auth_url=https://api.linkedin.com/uas/oauth/authorize&,这是我得到的响应:oauth_expires_in=599

我没有收到这样的参数来响应访问令牌请求: https[://]www[.]linkedin[.]com/uas/oauth/authorize/submit?oauth_token=xxx&oauth_verifier=xxx

有人可以解释一下吗?

PS:用[]更改了网址,因为由于缺乏声誉,它不允许我发布超过2个网址.

TIA.

oauth linkedin access-token

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