vpn无法正常访问https网站的解决办法1+

51,732 views / 2013.06.07 / 12:12 上午

前阵子忽然发现在国外假设的vpn在家无法访问https网站了,检查了路由什么的都正常,遂怀疑是小区宽带的防火墙作祟,不了了之。

今儿晚上又仔细分析了下,会不会是前阵子换了无线路由器的原因呢?以前也遇到过nat功能没打开导致vpn无法连接的问题,于是登陆到路由器管理平台,发现有个转发规则栏目,进入后,打开“特殊应用程序”,有如下文字提示:

某些程序需要多条连接,如Internet游戏,视频会议,网络电话等。由于防火墙的存在,这些程序无法在简单的NAT 路由下工作。特殊应用程序使得某些这样的应用程序能够在NAT路由下工作。

看来很大可能就是它的问题了,添加一个条目:

ID 触发端口 触发协议 开放端口 开放协议 状态 编辑
1 1723 ALL 1723 ALL 生效

其中1723是pptp协议要使用的端口。

断开电脑网络,重新连接,发现问题得到解决。

后来重启了电脑,发现又不行了,捯饬了半天,原来是路由器MTU数的问题,改成1490,重启路由,搞定。

Categories: 分享 Tags:

Cisco AnyConnect VPN 在linux系统下连接方法[通用]0+

122,080 views / 2013.05.30 / 4:04 下午

前文介绍了针对Cisco AnyConnect VPN在win8和mac系统下的连接方法,但有朋友反馈说在mac系统下的软件安装后无法使用。遂奉上@virtman 大师的linux通用方法。

首先安装openconnect

$ sudo yum install openconnect   (在Fedora上,会顺带安装:vpnc-script.noarch,这个包会被openconnect用到)

$ sudo openconnect –script /etc/vpnc/vpnc-script https://your-vpn-server.com

Attempting to connect to 121.0.29.22:443
SSL negotiation with vpn.taobao.org
Server certificate verify failed: signer not found
Certificate from VPN server “your-vpn-server.com” failed verification.
Reason: signer not found
Enter ‘yes’ to accept, ‘no’ to abort; anything else to view: yes
Connected to HTTPS on your-vpn-server.com
GET https://your-vpn-server.com/
Got HTTP response: HTTP/1.0 302 Object Moved
SSL negotiation with your-vpn-server.com
Server certificate verify failed: signer not found
Connected to HTTPS on your-vpn-server.com
GET https://your-vpn-server.com/+webvpn+/index.html
Please enter your username and password.
Username: your-name
PASSCODE: ********
POST https://your-vpn-server.com/+webvpn+/index.html
Got CONNECT response: HTTP/1.1 200 OK
CSTP connected. DPD 30, Keepalive 20
Connected tun0 as 10.1.25.155, using SSL

 

至此,连接成功。ctrl+z然后bg置入后台运行即可。

Categories: 分享 Tags:

PPT工具包分享–天天写PPT的XDJM们有福了0+

44,269 views / 2011.11.29 / 6:06 下午

该工具包包含上百个优美鲜明的表现形式,各类人群都能从中找到所需的工具。

下载地址 ppt

Categories: 分享 Tags:

为iphone数字键盘添加完成按钮0+

56,750 views / 2011.06.25 / 9:09 下午

If you have ever written an iPhone app that requires numeric input, then you surely know about the UIKeyboardTypeNumberPad. And if you have ever used that flavor of the iPhone’s keyboard, then you surely know that it lacks one very important feature: The UIKeyboardTypeNumberPad does not have a “return” key.

In fact every other keyboard type (except for the pretty similar UIKeyboardTypePhonePad) does offer the possibility to be dismissed by setting the returnKeyType property of the corresponding UITextInputTraits implementor. So how does one achieve the same effect with the number pad? We have found a workround!

When looking at the number pad, you’ll notice that there is an unused space on its bottom left. That’s where we are going to plug in our custom “return” key.

To make it short: take a screenshot, cut out the whole backspace key, flip it horizotally, clear its backspace symbol in Photoshop and overlay it with the text that we want on our “return” key. We’ve chosen to label it “DONE”. Now we have the image for our custom button’s UIControlStateNormal. Repeat the whole procedure (with a touched backspace key when taking the screenshot) to get a second image for our button’s UIControlStateHighlighted. Here’s the result:

Now back to coding. First we need to know when the number pad is going to be slided up on the screen so we can plug in our custom button before that happens. Luckily there’s a notification for exactly that purpose, and registering for it is as easy as:

 
[[NSNotificationCenter defaultCenter] addObserver:self 
                                         selector:@selector(keyboardWillShow:) 
                                             name:UIKeyboardWillShowNotification 
                                           object:nil];

Don’t forget to remove the observer from the notification center in the appropriate place once you’re done with the whole thing:

 
[[NSNotificationCenter defaultCenter] removeObserver:self];

Now we’re getting to the heart of it. All we have to do in the keyboardWillShow method is to locate the keyboard view and add our button to it. The keyboard view is part of a second UIWindow of our application as others have already figured out (see this thread). So we take a reference to that window (it will be the second window in most cases, so objectAtIndex:1 in the code below is fine), traverse its view hierarchy until we find the keyboard and add the button to its lower left:

 
- (void)keyboardWillShow:(NSNotification *)note {  
    // create custom button
    UIButton *doneButton = [UIButton buttonWithType:UIButtonTypeCustom];
    doneButton.frame = CGRectMake(0, 163, 106, 53);
    doneButton.adjustsImageWhenHighlighted = NO;
    [doneButton setImage:[UIImage imageNamed:@"DoneUp.png"] forState:UIControlStateNormal];
    [doneButton setImage:[UIImage imageNamed:@"DoneDown.png"] forState:UIControlStateHighlighted];
    [doneButton addTarget:self action:@selector(doneButton:) forControlEvents:UIControlEventTouchUpInside];

    // locate keyboard view
    UIWindow* tempWindow = [[[UIApplication sharedApplication] windows] objectAtIndex:1];
    UIView* keyboard;
    for(int i=0; i<[tempWindow.subviews count]; i++) {
        keyboard = [tempWindow.subviews objectAtIndex:i];
        // keyboard view found; add the custom button to it
        if([[keyboard description] hasPrefix:@"<UIKeyboard"] == YES)
            [keyboard addSubview:doneButton];
    }
}

Voilà, that’s it! The empty space for our button starts at coordinate (0, 163) and has the dimensions (106, 53). The doneButton method has to be written now of course, but that’s not hard any more. Just make sure that you call resignFirstResponder on the text field that is being edited to have the keyboard slide down.

We’re “DONE”.

 

本文例子 downloaded as Xcode project
更新: download 3.0 compatible Xcode project.
最新的: download the newest version (可运行 2.0 – 4.0所有版本)

 

来源:http://www.neoos.ch/news/46-development/54-uikeyboardtypenumberpad-and-the-missing-return-key

Categories: 分享 Tags:

问:ios开发下使用什么命令能退出iphone应用?0+

86,039 views / 2011.05.29 / 11:11 下午

There is no API provided for gracefully terminating an iPhone application. Under the iPhone OS, the user presses the Home button to close applications. Should your application have conditions in which it cannot provide its intended function, the recommended approach is to display an alert for the user that indicates the nature of the problem and possible actions the user could take – turning on WiFi, enabling Location Services, etc. Allow the user to terminate the application at their own discretion.

WARNING: It is possible to quit the application by calling exit. Applications calling exit will appear to the user to have crashed, rather than performing a graceful termination and animating back to the Home screen. Such usage provides a negative experience and is strongly discouraged.

Categories: 分享 Tags: