format

Applescript Syntax (Multiple Args) Inside Objective-C File

谁说我不能喝 提交于 2019-12-25 05:31:39
问题 I have been working on trying to run an Applescript from within Objective-C that queries out to the terminal to run some shell commands. I am running into an issue with how to format the command within Objective-C, so that the script object gets referenced properly. This is what the script looks like as an applescript set thisFile to "Dev1.4" set testTarget to "/Users/lab/Desktop/untitled" do shell script "/Users/lab/Desktop/TempRoot/myCommand.command " & thisFile & space & testTarget with

PHP format string to numbers seperated by two decimal points

僤鯓⒐⒋嵵緔 提交于 2019-12-25 05:05:56
问题 User can input values in following format: 1.00 1 1,00 Now I need to return this values formated by using two decimal points (,). When I use: number_format($request->amount, 2, ',','') And use "1,00" as input I get this error: Notice: A non well formed numeric value encountered What's the best way to solve this and still be able to handle all three types of input? Here's a short example: input of user:|output: 1.00 1,00 1 1,00 1,51 1,51 回答1: The following should work: $request->amount = str

Parsing out First and Last name from Excel field

烂漫一生 提交于 2019-12-25 04:47:11
问题 I have a field (column) in excel in the format of "LastName, FirstName MiddleInitial" with a space between the comma after the last name and the first name and a second space between the middle initial and the first name (no comma after the first name). Is there a way to identify which cells have a middle initial on the right hand side and then eliminate the middle initial for all cells such that the output will look like "LastName, FirstName"? Thanks! 回答1: What you want to do is to be able

Parsing using Regex with 2 following format (CSV File)

淺唱寂寞╮ 提交于 2019-12-25 04:08:38
问题 I have a flat file (CSV) with values separated by "|" , and i would like to convert all numbers with specific format " 1 234 567,89 " or " 1.123.456,89 " into " 1234567,89 " In order to do that i created this regex rule: (\|\ *)([0-9]{0,3})(\.|\ )?([0-9]{3})?(\.|\ )?([0-9]{3})?(,)?([0-9]{0,3})(-| )?(\|) this works fine, except when 2 numbers are continus, for example: | 9 450,000 |**9 809 100,000** | 1 890,000 |UN | How can I correct that? 回答1: If the regex flavor you're using allow both

How to format Date in ASP.NET

拜拜、爱过 提交于 2019-12-25 03:51:14
问题 I am running my Facebook status feed through Yahoo pipes and outputting/embedding it on to a page my own hosted website. The XML feed contains a date. I want to format the date but don't know how to. The XML part is date output is... <pubDate>Thu, 14 Jul 2011 20:38:07 +0100</pubDate> and I would like it to render something like 14/07/2011. Any help much appreciated. I have c# code... protected void Page_Load(object sender, EventArgs e) { WebRequest MyRssRequest = WebRequest.Create("http:/

Formatting date 2/24 as “February, 24”

放肆的年华 提交于 2019-12-25 03:44:41
问题 I am trying t make a date that comes in like this mm/dd turn into the name of the month and day like it comes in 8/15 i want it to say August, 15 public void printAlphabetical() { int month,day;// i got the month and day from a user previously in my program String s = String.format("%B, %02d%n",month,day); Date date = new Date(); date.parse(s);// this does not work System.out.printf(s); } 回答1: String[] months = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec

Python struct.error: bad char in struct format

自古美人都是妖i 提交于 2019-12-25 03:17:09
问题 first of all I would like to know what this python sentence does: struct.unpack("!%sH" % (len(data) / 2), data)) And secondly, I have to make an ICMP request message using python, and the thing is that I already got some code the teacher gave me to help: def step4(code, server, port): s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.getprotobyname('icmp')) CHARMAP = nonprintable_to_dots() packet = create_packet(int(code)) s.sendto(packet, (server, port)) while True: msg = s.recv(1600

Excel parsing (xls) date error

别等时光非礼了梦想. 提交于 2019-12-25 03:09:13
问题 I'm working on a project where I have to parse excel files for a client to extract data. An odd thing is popping up here: when I parse a date in the format of 5/9 (may 9th) in the excel sheet, I get 39577 in my program. I'm not sure if the year is encoded here (it is 2008 for these sheets). Are these dates the number of days since some sort of epoch? Does anyone know how to convert these numbers to something meaningful? I'm not looking for a solution that would convert these properly at time

How to use string formatting to dynamically assign variables

浪尽此生 提交于 2019-12-25 02:33:21
问题 In Python, I am populating an object to model the configuration, environment and other aspects related to rsyslog on the local machine (RHEL 6.4 Python 2.6.4) I loop through many instances of the rsyslog daemon (this_instance_number), and many attributes (attribute) defined in a configuration file. With those value I populate the object. Given the following variables: this_instance_number=5 attribute="startupscript" The following line of code, print ('rsyslog.instance%(instance_number)s.%

Using .format to use variable in regex findall object. Python

守給你的承諾、 提交于 2019-12-25 02:03:19
问题 I saw some examples of this here but it did not answer my question: Python Regular Expression findall with variable i'm trying to use a variable instead of the 9 but i can't seem to figure it out value = 9 ORF = re.findall(r'ATG(?:(?!TAA|TAG|TGA)…){ value ,}?(?:TAA|TAG|TGA)',seq) #obviously doesn't work or i wouldn't have made this post I tried: value = 9 ORF = re.findall(r'ATG(?:(?!TAA|TAG|TGA)…){ {} ,}?(?:TAA|TAG|TGA)'.format(value),seq) but got the error: ValueError: Single '}' encountered