prefix

Check if NSString hasPrefix that is contained in NSArray

不想你离开。 提交于 2019-12-14 02:05:16
问题 I have this if statement to check if a URL starts with a prefix: NSString *baseUrl = @"http://example.com/"; NSString *currentURL = @"http://example.com/confirm"; if( [currentURL hasPrefix:[baseUrl stringByAppendingString:@"confirm"]] ){ // True, so do something... } I would like to modify the hasPrefix part of my if statement so that it returns true if currentUrl is appended by ANY of the values in my NSArray shown here: NSArray *pages = [NSArray arrayWithObjects:@"confirm",@"products",nil];

Could Not Find Path Specified: CreateDirectoryW

天大地大妈咪最大 提交于 2019-12-13 22:06:12
问题 VS2015, Unicode: Getting the "Could Not Find the Path Specified" error running the following code in a listbox: wchar_t *currPath, *cumPath; int listTotal = 5; int pathLength = 32760; listTotal = SendMessageW(hList, LB_GETCOUNT, 0, 0); wcscpy_s(cumPath, pathLength, L"\\\\?\\C:\\"); //wcscpy_s(cumPath, pathLength, L"C:\\"); //Tried this, no difference wcscpy_s(currPath, MAX_PATH - 3, L""); for (int i = 0; i < listTotal; i++) { SendMessageW(hList, LB_GETTEXT, i, (LPARAM) currPath); //"My Nested

How do I match SQL table rows with XML namespace elements?

☆樱花仙子☆ 提交于 2019-12-13 20:08:08
问题 I've successfully saved down this XML file to my server using the following PHP: file_put_contents("test.xml", fopen("http://www.treasury.gov/resource-center/data-chart-center/interest-rates/pages/XmlView.aspx?data=yieldyear&year=2015", 'r')); Now i'm trying to get it into my DB. Just trying to get it to work by executing SQL in the phpMyAdmin GUI. I successfully setup the following table: CREATE TABLE `test` ( `NEW_DATE` varchar(40) NOT NULL, `BC_1MONTH` int(11) NULL, `BC_3MONTH` int(11)

Extract XML using OPENXML()

微笑、不失礼 提交于 2019-12-13 11:07:58
问题 My problem is that I do not know how to extract the XML tag element using OpenXML. Any clarification would be great. I have using xml.node before but now I am transitioning to OpenXML My XML document can be found here My Stored procedure: ALTER procedure [dbo].[WEEKXml] (@xmlstr ntext) as begin declare @hDoc int exec sp_xml_preparedocument @hDoc OUTPUT,@xmlstr insert into tbl_weekquake select xml.time,xml.longitude,xml.latitude,xml.depth,xml.mag,xml.type,xml.description,xml.text from OPENXML(

Address book Phone number (+45) prefix causing crash!

做~自己de王妃 提交于 2019-12-13 05:02:19
问题 I am having trouble getting phone numbers from the iPhone Addressbook. There is no problem when the number do not contain a country code prefix like +45, but if it does, my app crashes... Is this a known issue? I haven't been able to find anything about it... Thanks EDIT: I get phonenumber like this: -(void)getContact { ABPeoplePickerNavigationController *pp = [[ABPeoplePickerNavigationController alloc] init]; pp.displayedProperties = [NSArray arrayWithObject:[NSNumber numberWithInt

Nginx的基本使用

不打扰是莪最后的温柔 提交于 2019-12-13 04:45:11
一。什么是Nginx 是一款高性能的 http 服务器/反向代理服务器 及 电子邮件( IMAP/POP3)代理服务器, 官方数据支持5万并发,占用资源少,C语言开发。 二。有什么用 个人经历:在公司项目上线本人负责部署项目生产环境的部署,稍微正规点局方都会要求对生产环境管控,不允许我们平时的办公环境直连,但是如果通过linux操作生产环境进行项目调试是很不方便,比如你想测试web前端界面,你还需要登入局方的权限管理平台验证后登入,因为测试环境可以连接生产环境,办公环境又可以连接测试环境,所以我在测试环境搭建了nginx服务器,对生产上部署的web工程和http接口进行反向代理,方便生产的项目调试。 (1)作为普通的http服务器,像tomcat一样 (2)虚拟主机:开启多个端口提供访问服务 (3)反向代理:区别反向和正向代理 (4)负载均衡:多集群进行负载均衡,一般公司的软件负载均衡都是使用的这个。 三。安装部署 (1)注意事项 前面说了nginx是C语言开发的,linux肯定需要gcc编译的,在有些现场环境局方是不会提供root用户,如果服务器维护人员没有安装这些基本的工具那将是一件非常头疼的事,我就遇到那种什么都不给你装的主机。最后你装一个软件就报一个缺少依赖的错,一般主机还不允许连外网,所以你也没办法下,只能本地下好再上传服务器

C# textBox Hex only with 0x/h/$ prefix using TextChanged property

南笙酒味 提交于 2019-12-13 04:42:26
问题 I am testing the following code in TextChanged property to allow only HEX values in the textBox and it works just fine, it also deletes pasted string which doesn't match the HEX pattern and converts the lower to upper case, this is just what I needed: Regex nonhex = new Regex("[^0-9,a-f,A-F]"); int caret = textBox1.SelectionStart - textBox1.Text.Length; textBox1.Text = nonhex.Replace(textBox1.Text, "").ToUpper(); textBox1.SelectionStart = caret + textBox1.Text.Length; If I try to add a prefix

How does extglob work with shell parameter expansion?

放肆的年华 提交于 2019-12-12 17:26:20
问题 I thought I understood the use of the optional ?(pattern-list) in bash (when extglob shell option is on) and by default in ksh. For example in bash : $ shopt -s extglob $ V=35xAB $ echo "${V#?(35|88)x}" "${V#35}" AB xAB But when the matching prefix pattern is just one ?() or one *() , which introduce what I call optional patterns , the 35 is not omitted unless ## is used: $ echo "${V#?(35|88)}" "${V#*(35|88)}" # Why 35 is not left out? 35xA 35xA $ echo "${V##?(35|88)}" "${V##*(35|88)}" # Why

? LIKE (column || '%')

余生颓废 提交于 2019-12-12 17:15:25
问题 Can I have a condition of something like this: SELECT * FROM table WHERE ? LIKE (column || '%') Where the ? is a string parameter value. For example, these parameter value ? should return true when column is equal to /admin/products /admin/products/1 /admin/products/new /admin/products/1/edit Is this possible? Update: Added test case. Basically, the where clause would render like this: 1. ? LIKE (column || '%') 2. '/admin/products/1' like ('/admin/products' || %) 3. '/admin/products/1' like (

Easy_install's --prefix option doesn't change where it tries to install my package

别来无恙 提交于 2019-12-12 12:05:28
问题 I want to install Sphinx 1.1.3 for python 2.6. However, I don't have sudo rights. So instead of installing it in the default place, I want to set a different location, using --prefix. Doing the following: -bash-3.2$ easy_install Sphinx-1.1.3-py2.6.egg --prefix=/homes/ndeklein/python2.6/site-packages/ gives me: error: can't create or remove files in install directory The following error occurred while trying to add or remove files in the installation directory: [Errno 13] Permission denied: '