format

Formatting Date String abbreviating month

佐手、 提交于 2019-12-06 02:34:08
问题 I would like to format a standard .NET DateTime string as follows 2014-01-01 => Jan 2014 I can get the date form "January 2014" by using ToString("y") but how can I abbreviate the month? Is this even possible? C# Visual Studio 2012 .NET 4.5 回答1: You can use the MMM format as in: DateTime.Now.ToString("yyyy-MM-dd => MMM yyyy") Which produces: 2014-08-06 => Aug 2014 回答2: You can use "MMM", take a look at this example: http://msdn.microsoft.com/library/zdtaw1bw%28v=vs.110%29.aspx 来源: https:/

How do I avoid URL globbing with PHP cURL?

[亡魂溺海] 提交于 2019-12-06 02:28:08
I have a url (slightly modified) like so: https://ssl.site.com/certificate/123/moo.shoo?type=456&domain=$GH$%2fdodo%20[10%3a47%3a11%3a3316] It doesn't work the way I intend it to when passed straight through to PHP cURL because of the brackets. I managed to run the same URL successfully in the command line like so: curl -g "https://ssl.site.com/certificate/123/moo.shoo?type=456&domain=$GH$%2fdodo%20[10%3a47%3a11%3a3316]" Is there an option (similar to -g, for disabling globbing) that I can use in PHP cURL? If not, how should I encode or format my URL before passing it to PHP cURL? Currently I

Force exponential format of ticks LIKE MATLAB does it automatically

◇◆丶佛笑我妖孽 提交于 2019-12-06 01:45:28
问题 I have two plots. In the first plot the values for the y-axis go up to 30000. Therefor, Matlab is labeling the axis instead of '30000' with '3' and the 'x10^4' ABOVE the plot. In the second plot the y-values just go til 10000. Due to the fact that this value is too low to automatically switch to exponential format it really prints '10000'. I would like to know if there is a way to force the exponential formatting. This will result in THE SAME FORMAT as Matlab does it automatically. I am

Using replace with regular expressions - VBA

流过昼夜 提交于 2019-12-05 22:05:30
I would like to format a text. I mean something like this: I'd like to transform this: "something'text between apostrophes'text" into "something 'text between apostrophes' text" I want to add spaces from both sides, but keep te string in '' the same. I tried to do it like this: Arkusz1.Cells(1, 1).Replace What:="'*'" Replacement:=" '*' " But its result is: "something '*' text" Arkusz1.Cells(1,1) contains the string I want to replace. Is it possible to do this? Thanks You can try this regex: ('[^']+') and replace by this: " $1 " Sample Source Dim Regex As System.Text.RegularExpressions.Regex

Formatting output of CSV file in Python

烈酒焚心 提交于 2019-12-05 21:54:46
问题 I am creating a very rudimentary "Address Book" program in Python. I am grabbing contact data from a CSV file, the contents of which looks like the following example: Name,Phone,Company,Email Elon Musk,454-6723,SpaceX,emusk@spacex.com Larry Page,853-0653,Google,lpage@gmail.com Tim Cook,133-0419,Apple,tcook@apple.com Steve Ballmer,456-7893,Developers!,sballmer@bluescreen.com I am trying to format the output so that it looks cleaner and more readable, i.e. everything lined up in rows and

Formatting XmlGregorianCalendar timezone issue

走远了吗. 提交于 2019-12-05 21:39:57
I need to format java XmlGregorianCalendar to "yyMMdd" string. My implementation: XMLGregorianCalendar date = getDate(); //getting the date if (date != null) { SimpleDateFormat sdf = new SimpleDateFormat("yyMMdd"); LOG.debug("Parsing date..."); LOG.debug("XML Date: " + date); LOG.debug("XML Date timezone: " + date.getTimezone()); GregorianCalendar gc = date.toGregorianCalendar(); LOG.debug("Gregorian calendar: " + gc.toString()); LOG.debug("Gregorian calendar timezone id: " + gc.getTimeZone().getID()); Date d = gc.getTime(); LOG.debug("Date: " + d.toString()); String formatted = sdf.format(d);

suppress Name dtype from python pandas describe

落花浮王杯 提交于 2019-12-05 21:02:38
问题 Lets say I have r = pd.DataFrame({'A':1 , 'B':pd.Series(1,index=list(range(4)),dtype='float32')}) And r['B'].describe()[['mean','std','min','max']] gives an output : mean 1.0 std 0.0 min 1.0 max 1.0 Name: B, dtype: float64 But from the above output , how should I get rid or suppress the last line " Name:B, dtype: float64 " I figured out one way to achieve this x=r['B'].describe()[['mean','std','min','max']] print "mean ",x['mean'],"\nstd ",x['std'],"\nmin ",x['min'],"\nmax ",x['max'] which

How do I format x-axis label in highcharts

我怕爱的太早我们不能终老 提交于 2019-12-05 20:45:57
问题 I have the following highchart output: I just want to see the Feb-10 instead of Feb-10 18:00 in x-axis label. So all the xaxis label will be like Feb-10, Feb-12, and so on. But The tooltip will be the same as the output screen. How can I format the xaxis so that I will get Feb-10, Feb-12, and so on instead of Feb-10 18:00, Feb-12 20:00, and so on. $(function () { $('#container').highcharts({ chart: { zoomType: 'xy', spacingRight: 20 }, credits: { enabled: false }, title: { text: '' }, xAxis:

How to find the position of Central Directory in a Zip file?

此生再无相见时 提交于 2019-12-05 20:07:56
问题 I am trying to find the position of the first Central Directory file header in a Zip file. I'm reading these: http://en.wikipedia.org/wiki/Zip_(file_format) http://www.pkware.com/documents/casestudies/APPNOTE.TXT As I see it, I can only scan through the Zip data, identify by the header what kind of section I am at, and then do that until I hit the Central Directory header. I would obviously read the File Headers before that and use the "compressed size" to skip the actual data, and not for

Date from String using NSDateFormatter regardless 12h-24h setting

回眸只為那壹抹淺笑 提交于 2019-12-05 19:47:43
Today my question is about date formats and strings. My application downloads some strings representing dates from the internet. The date format is always like this: "2010-05-24 at 20:45" I need to convert this string into an NSDate object in order to perform some date manipulations. I tried this code: NSString * dateString = @"2010-05-24 at 20:45" // actually downloaded from the internet NSDateFormatter * myDateFormatter = [[NSDateFormatter alloc] init]; [myDateFormatter setDateFormat:@"yyyy-MM-dd 'at' HH:mm"]; NSDate * dateFromString = [myDateFormatter dateFromString:dateString]; This seems