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

18,575 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+

6,788 views / 2011.11.29 / 6:06 下午

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

下载地址 ppt

Categories: 分享 Tags:

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

17,684 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+

11,643 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:

CyberGhost VPN 是一个快速、可信赖的 VPN(Virtual Private Network)代理伺服器服务,位于德国,提供 128-bit SSL 高加密性的安全连线环境。而 CyberGhost VPN 提供的软体相当简单易用,几乎不用额外的专业设定,只需要一次点击就可以透过 CyberGhost 提供的 IP 位址连线并提升你的隐私。

目前 CyberGhost VPN 正免费提供一年份的白金帐户(Premium Account),价值 €79.99 欧元(折合台币约 3200 元),透过白金帐户连线将有更快、更稳定的连线速度,保证速率至少为 2Mbps,且可以免费使用 2GB 的加密网路硬碟。

备注:透过 CyberGhost VPN 连线是为了确保资料传输的安全性,或是提高个人隐私。所有的动作都有记录,所以请不要使用 VPN 作为非法或是不当用途。

注册地址:http://cyberghostvpn.com/page/registration.php

注册完成需要下载软件登录:https://cyberghostvpn.com/en/product/download.html

Categories: 分享 Tags: