小编dev*_*sri的帖子

通过iPhone连接到服务器的SSL错误

我正在尝试使用我的应用程序建立到服务器的HTTPS连接.但由于跟随错误,连接失败

错误域= NSURLErrorDomain代码= -1200"发生SSL错误,无法与服务器建立安全连接." UserInfo = 0x612eb30 {NSErrorFailingURLStringKey = https:myURL.com/signup,NSLocalizedRecoverySuggestion =您是否还要连接到服务器?,NSErrorFailingURLKey = https:myURL.com/signup,NSLocalizedDescription =发生了SSL错误并且安全连接到服务器无法生成.,NSUnderlyingError = 0x612eb70"发生SSL错误,无法建立与服务器的安全连接."}

连接到服务器的代码是

-(IBAction) handleEvents:(id)sender
 {
    if ((UIButton*)sender == submit) {

    [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;


    NSLog(@"Begin");
    NSData *urlData;
    NSURLResponse *response;
    NSError *error;

    NSString *url =[[NSString alloc]initWithFormat:@"%@signup",baseURL];
    NSURL *theURL =[NSURL URLWithString:url];
    NSMutableURLRequest *theRequest =[NSMutableURLRequest requestWithURL:theURL cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:0.0f];
    [theRequest setHTTPMethod:@"POST"];
    NSString *theBodyString = [NSString stringWithFormat:@"emailId=%@&mobileNumber=%@&appId=%@&password=%@&firstName=%@&lastName=%@"
                               ,@"abc@example.com",@"919879876780",@"bf1c7a6b3d266a7fe350fcfc4dda275211c13c23" ,@"qwerty" , @"Dev" , @"Sri"];
    NSData *theBodyData = [theBodyString dataUsingEncoding:NSUTF8StringEncoding];

    [theRequest setHTTPBody:theBodyData];
    urlData = [NSURLConnection sendSynchronousRequest:theRequest returningResponse:&response error:&error];
    }
}
Run Code Online (Sandbox Code Playgroud)

我的委托方法是

- …
Run Code Online (Sandbox Code Playgroud)

ssl https nsurlconnection nsurlrequest

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

URLConnection错误 - java.io.IOException:服务器返回HTTP响应代码:URL为400

我试图从桌面应用程序连接到一个URL,我得到我的问题的标题中指示的错误,但当我尝试从servlet连接到相同的URL时,一切正常.当我从浏览器加载URL时,一切正常.我在servlet中使用相同的代码.代码在库中,当它不起作用时,我将代码拉出到当前项目中的一个类,但它没有用.

网址https://graph.facebook.com/me.

代码片段.

public static String post(String urlSpec, String data) throws Exception {
    URL url = new URL(urlSpec);
    URLConnection connection = url.openConnection();
    connection.setDoOutput(true);
    OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream());
    writer.write(data);
    writer.flush();

    BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
    String line = "";
    StringBuilder builder = new StringBuilder();
    while((line = reader.readLine()) != null) {
        builder.append(line);
    }
    return builder.toString();
}   
Run Code Online (Sandbox Code Playgroud)

我在这里有点困惑,是否存在一些不是普通桌面应用程序的servlet?

谢谢.

完全堆积的痕迹

Feb 8, 2011 9:54:14 AM com.trinisoftinc.jiraffe.objects.FacebookAlbum create
SEVERE: null
java.io.IOException: Server returned HTTP response code: 400 for URL: https://graph.facebook.com/me …
Run Code Online (Sandbox Code Playgroud)

java url https

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

如何在iOS 4.0+中以字节为单位获取UIImage的大小?

我试图从照片库或相机中选择一张图像.
委托方法:

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo
Run Code Online (Sandbox Code Playgroud)

给我一个UIImage对象.我需要bytes为我的应用程序找到图像的大小.

有什么办法可以获得图像的文件类型以及字节大小吗?

任何形式的帮助将受到高度赞赏.

提前致谢

iphone objective-c uiimageview uiimage ios

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

按编号搜索并使用ABAddressBook获取图像

我希望通过我的应用程序使用数字作为键在iphone地址簿中搜索,然后检索与该联系人关联的图像并将其显示在UIImageView上.

我尝试使用ABAddressBook框架,但无法继续.

任何人都可以建议我解决方案或我可以遵循的任何替代路径.任何代码片段也会有很大的帮助!!

任何形式的帮助都会非常值得注意.

提前致谢

xcode uiimageview abaddressbook

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

didSelectRowAtIndexPath一次选择多行

我有一个UITableView27行的人口.我正在尝试更改accessoryType所选单元格.我在didSelectRowAtIndexPath:委托方法中这样做.

我面临的问题是,当选择一行并更改accessoryType单元格时,该行的第十一行也会被修改.

我已经尝试打印该[indexPath row]值,但它只显示选中的行而不是另一行.

我对这些东西感到很困惑; 请帮帮我.

添加代码 cellForRowAtIndexPath方法

UITableViewCell *cell;
if ([indexPath row] == 0) {
    cell = [tableView dequeueReusableCellWithIdentifier:@"acell"];
}
else {
    cell = [tableView dequeueReusableCellWithIdentifier:@"bcell"];
}

cell.selectionStyle = UITableViewCellSelectionStyleNone;

if (cell == nil && [indexPath row] != 0) {
    cell = [[[UITableViewCell alloc] initWithStyle:
             UITableViewCellStyleSubtitle reuseIdentifier:@"bcell"] autorelease];
}
else if(cell == nil && [indexPath row] == 0){
    cell = [[[UITableViewCell alloc] initWithStyle:
             UITableViewCellStyleSubtitle reuseIdentifier:@"acell"] autorelease];
}

if …
Run Code Online (Sandbox Code Playgroud)

cocoa-touch objective-c uitableview ios

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

不推荐使用setLineBreakMode警告

我在使用时收到了弃用方法的警告

[buttonLeft setLineBreakMode:UILineBreakModeWordWrap];
Run Code Online (Sandbox Code Playgroud)

这种方法还有其他替代品吗?

xcode uibutton

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

错误HBASE-ZOOKEEPER:连接太多

我正在使用Hbase-Hadoop组合作为我的应用程序以及Data Nucleus作为ORM.

当我试图一次通过几个线程访问hbase时.它会抛出异常:

Exception in thread "Thread-26" javax.jdo.JDODataStoreException

org.apache.hadoop.hbase.ZooKeeperConnectionException: HBase is able to connect to ZooKeeper but the connection closes immediately. This could be a sign that the server has too many connections (30 is the default). Consider inspecting your ZK server logs for that error and then make sure you are reusing HBaseConfiguration as often as you can. See HTable's javadoc for more information.

Caused by: org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /hbase
Run Code Online (Sandbox Code Playgroud)

如果需要,我可以提供完整的堆栈跟踪.(因为完整的堆栈跟踪会使事情变得混乱).

请帮我解决一下如何处理这种情况.是否需要进行任何配置来增加连接池?

hbase jdo datanucleus apache-zookeeper

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

HBASE错误:设置代理接口org.apache.hadoop.hbase.ipc.HRegionInterface失败

我目前正在尝试使用HDFS和HBASE.Hadoop和HBASE已正确安装在计算机上,并且我的应用程序在托管在同一台计算机上时可以正常运行.

但是在另一台机器上托管时.首次点击HBASE我得到一个错误说:

org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [sitepulsewebsite] in context with path [/SitePulseWeb] threw exception [Request processing failed; nested exception is javax.jdo.JDODataStoreException
NestedThrowables:org.apache.hadoop.hbase.MasterNotRunningException: localhost:60000] with root cause
org.apache.hadoop.hbase.MasterNotRunningException: localhost:60000
Run Code Online (Sandbox Code Playgroud)

在第二次打击我得到例外:

org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [sitepulsewebsite] in context with path [/SitePulseWeb] threw exception [Request processing failed; nested exception is javax.jdo.JDODataStoreException: Failed setting up proxy interface org.apache.hadoop.hbase.ipc.HRegionInterface to localhost/127.0.0.1:60020 after attempts=1
NestedThrowables: org.apache.hadoop.hbase.client.RetriesExhaustedException: Failed setting up proxy interface org.apache.hadoop.hbase.ipc.HRegionInterface to localhost/127.0.0.1:60020 after attempts=1] with root cause
java.net.ConnectException: Connection refused …
Run Code Online (Sandbox Code Playgroud)

java hadoop hbase jdo datanucleus

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

Django - 如何使用带有多个参数的templatetags过滤器

我有一些值,我想传递给过滤器,并从中获取一个URL.

在我的模板中,我有:

{% if names %}
  {% for name in names %}
    <a href='{{name|slugify|add_args:"custid=name.id, sortid=2"}}'>{{name}}</a>
    {%if not forloop.last %} | {% endif %}
  {% endfor %}
{% endif %}
Run Code Online (Sandbox Code Playgroud)

在我的模板标签中,我有:

@register.filter
def add_args(value, args):
    argz = value.strip() + '-' + 'ARGS'
    arglist = args.split(',')
    for arg in arglist:
        keyval = arg.split('=')
        argz.join(keyval[0] + 'ZZ' + keyval[1])
        argz.join('QQ')

    return argz  
Run Code Online (Sandbox Code Playgroud)

输出URL应如下所示:

http://foo.org/john-smith-ARGScustidZZ11QQsortidZZ2
Run Code Online (Sandbox Code Playgroud)

如果ARGS是参数的开头,则ZZ为'=',QQ为'&'等价物.

首先:这会有效,但我得到了add_args()中的custid = name.id,我希望custid = 11进来.如何将id作为id传入而不是文本.

另外,有没有办法像PHP一样发送key => value数组.在PHP中我会构建一个数组,让我们说:

arglist = array('custid' => $nameid, 'sortid' => $sortid ); 
Run Code Online (Sandbox Code Playgroud)

然后我会将arglist作为参数传递给我, …

python tags django filter django-templates

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

使用PHP SDK for Facebook在朋友的墙上发布

我正在尝试使用FB的PHP SDK发布在我朋友的墙上.该代码仅在我的墙上发布帖子,其他人也看不到.

这是代码

$ret_obj = $facebook->api('/me/feed', 'POST',array(
            'link' => 'www.google.com',
            'message' => 'message','description' => "I am bond",
            'to' => array('id' => 'friend_id','name' => 'friend_name'),
            'actions' => array('name' => 'Re-share',
            'link' =>'http://apps.facebook.com/my_app/'),
            'privacy' => array('value' => 'EVERYONE')));
Run Code Online (Sandbox Code Playgroud)

这段代码发布在我的墙上而不是朋友的墙上.此帖也仅对我而言,而不是对任何其他人可见.

任何形式的帮助都会非常值得注意.

提前致谢

facebook facebook-graph-api facebook-php-sdk

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

通过xcode进行多部分HTTP请求

我想将图像,视频和音频文件上传到服务器.我已经在类似的主题上阅读了这个帖子,但是无法完全理解代码的流程.如果你可以建议我一些示例代码或教程,那将是很棒的.我使用以下代码连接没有任何媒体到服务器

[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
NSString *url =[[NSString alloc]initWithFormat:@"%@",[NetworkConstants getURL]];
NSURL *theURL =[NSURL URLWithString:url];
[url release];
NSMutableURLRequest *theRequest =[NSMutableURLRequest requestWithURL:theURL cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:0.0f];
[theRequest setHTTPMethod:@"POST"];

NSString *theBodyString = [NSString stringWithFormat:@"json1=%@&userID=%@",jsonObject,[GlobalConstants getUID]];

NSData *theBodyData = [theBodyString dataUsingEncoding:NSUTF8StringEncoding];
[theRequest setHTTPBody:theBodyData];

NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];

if (conn) {
    NSLog(@"Successful in sending sync");
}
else {
    NSLog(@"Failed Connection in sending sync");
}
[conn release];
Run Code Online (Sandbox Code Playgroud)

如果可以编辑这部分代码,那对我来说真的很方便.

任何形式的帮助将受到高度赞赏.

提前致谢!!

iphone http multipartform-data

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