spaces

What to do about spaces on my connection string?

最后都变了- 提交于 2019-12-13 02:49:49
问题 For example: @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source="\\na1b\uj\UP647529\Year 2\Managing Data and Security\Employee.accdb"; Visual studio won't let me run my program until I remove the spaces but thats where the database is.. How can I sort out that connection string to make Visual studio happy? 回答1: It looks more like the problem is with the quotation marks in the string literal. Try replacing each quote with two sets: @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=""\\na1b\uj

Python split string by spaces except when in quotes, but keep the quotes

左心房为你撑大大i 提交于 2019-12-12 23:03:35
问题 Am wanting to split the following string: Quantity [*,'EXTRA 05',*] With the desired results being: ["Quantity", "[*,'EXTRA 05',*]"] The closest I have found is using shlex.split, however this removes the internal quotes giving the following result: ['Quantity', '[*,EXTRA 05,*]'] Any suggestions would be greatly appreciated. EDIT: Will also require multiple splits such as: "Quantity [*,'EXTRA 05',*] [*,'EXTRA 09',*]" To: ["Quantity", "[*,'EXTRA 05',*]", "[*,'EXTRA 09',*]"] 回答1: To treat

Spaces in directory path python

橙三吉。 提交于 2019-12-12 14:34:08
问题 I'm a noob at coding Python and I've run into something that no amount of Googling is helping me with. I'm trying to write a simple Directory listing tool and I cannot seem to deal with Spaces in the directory name in OSX. My code is as follows: def listdir_nohidden(path): import os for f in os.listdir(path): if not f.startswith('.'): yield f def MACListDirNoExt(): import os MACu = PCu = os.environ['USER'] MACDIR = '/Users/'+MACu+'/Desktop//' while True: PATH = raw_input("What is the PATH you

LINQ puts unwanted trailing spaces on strings

时光怂恿深爱的人放手 提交于 2019-12-12 13:07:55
问题 I have a very annoying problem with LINQ and MS SQL Server. Im currently making some software in WPF C# and use LINQ to generate classes from the data in the database. However, when i update a nvarchar or varchar field in the DB from my program, LINQ adds trailing spaces to the string! I have a field in a table defined like this: ProductName = NVARCHAR(10) So if i do this: Product.Name = "Bike"; Product.Name = Product.Name.Trim(); repository.Add(Product); // Runs an .InsertOnSubmit repository

php mcrypt: why to add spaces on string input?

旧街凉风 提交于 2019-12-12 04:44:11
问题 There's a mcrypt snippet on several webs: https://stackoverflow.com/a/11538728/408872 http://www.binrand.com/post/3810303-mcrypt-md5-how-to-create-an-online-encryption-decryption-web-page.html http://www.techbees.org/best-way-to-use-php-to-encrypt-and-decrypt/ $key = 'password to (en/de)crypt'; $string = ' string to be encrypted '; // note the spaces $encrypted = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $string, MCRYPT_MODE_CBC, md5(md5($key)))); $decrypted = rtrim(mcrypt

Disabling Mission Control, Spaces, Dashboard and any other external process

偶尔善良 提交于 2019-12-12 03:14:48
问题 I was wondering if it was possible to (for a short period of time) disable and re-enable external processes to an application like Mission Control, Spaces, Expose, Dashboard, etc... within an application, while still allowing the user to use my application? A way of accomplishing this I found was to use NSTask to disable the processes with the corresponding terminal command. For Example: - (NSString *)runCommandWithBase:(NSString *)base arguments:(NSArray *)arguments { //Create the task

unlink not working with space in foldername path

安稳与你 提交于 2019-12-12 03:13:31
问题 I read a few threats on escaping but doesn't work. it works with a path without spaces fine.... ($subfolder contains spaces) $subfolder = "this a subf"; $filepath = "/var/www/domain/$subfolder/$imagetodelete"; $filepath = str_replace(" ", "\ ", $filepath); unlink($filepath); // correct if $subfolder/path contains no spaces echo $filepath; 回答1: $filepath = str_replace(" ", "\ ", $filepath); The problem here is that you are escaping the space character in PHP, not actually inserting a backslash

SSMS 2008 converts control characters to spaces when using 'Results to Grid'

白昼怎懂夜的黑 提交于 2019-12-11 23:52:02
问题 I have a table in which one column (type ntext) has data that includes carriage return and linefeeds. (CHAR(13) and CHAR(10)). If I right click the table in SSMS 2008 and choose 'Select Top 1000 rows' and the display mode is set to "Result to Grid" it seems that control characters (like TAB and CRLF) are converted to spaces for display in the grid!! Yet if I right click the table and choose 'Edit Top 200 rows', the control character data is shown in the resulting grid (as two small squares).

Python - spaces

亡梦爱人 提交于 2019-12-11 19:57:52
问题 I can't get over this little problem. The second is right. How can i print without spaces? def square(n): for i in range(n): for j in range(n): if i==0 or j==0 or i==n-1 or j==n-1: print "*", else: print "+", print thanks for help! 回答1: By not using print plus a comma; the comma will insert a space instead of a newline in this case. Use sys.stdout.write() to get more control: import sys def square(n): for i in range(n): for j in range(n): if i==0 or j==0 or i==n-1 or j==n-1: sys.stdout.write(

PHP/regex : Script to create filenames with dashes instead of spaces

荒凉一梦 提交于 2019-12-11 18:50:06
问题 I want to amend a PHP script I'm using in wordPress (Auto Featured Image plugin). The problem is that this script creates filenames for thumbnails based on the URLs of the image. That sounds great until you get a filename with spaces and the thumbnail is something like this%20Thumbnail.jpg and when the browser goes to http://www.whatever.com/this%20Thumbnail.jpg it converts the %20 to a space and there is no filename on the server by that name (with spaces). To fix this, I think I need to