FAQ Database Discussion Community


Format internet time string (Swift 1.2)

ios,swift,date,time,format
I'm trying to format a string from internet time to something more readable. The input I have is something like: Mon, 27 Apr 2015 20:00:00 +0000 And I'd like to format it into just: Mon, 27 Apr I'm fairly new to Swift so I don't know the best way to...

Formatting a MicroSD card within OSX

osx,format,osx-mavericks,intel
I am trying to format a 32GB MicroSD card using the Disk Utilities app in OSX however I am receiving this error: I need that for processing with this manual....

How to convert Int to Time(MM:SS.mm) swift

ios,swift,time,format
I have an Int, say 15344 and I'm sending it to a label as a string, but I want it to be formatted as 01:53.44 var split = data.valueForKeyPath("time") as! Int cell.textLabel?.text = split.description but this only gives me the 15344 without format. I tried .stringbyAppendingformat but couldn't get it...

Formatting a Pivot Table in Python

python,sorting,pandas,format,dataframes
I am trying to reformat a table based on counts in different columns. df = pd.DataFrame({'Number': [1, 2, 3, 4, 5], 'X' : ['X1', 'X2', 'X3', 'X3', 'X3'], 'Y' : ['Y2','Y1','Y1','Y1', 'Y2'], 'Z' : ['Z3','Z1','Z1','Z2','Z1']}) Number X Y Z 0 1 X1 Y2 Z3 1 2 X2 Y1 Z1 2...

Format method of Decimalformat returns numeric instead zero

java,format,decimalformat
I am using DecimalFormat's format method to format float value with 6 decimal points. So I am using, Float f = new Float("52.2815"); DecimalFormat decfo = new DecimalFormat("#0.000000"); String k = decfo.format(f); I want to print 52.281500. But it prints 52.281502. How to get 52.281500?...

Python u-law issues: unknown format: 7

python,numpy,format,fft,wav
I'm trying to compare two large sets of wav files to remove duplicates. The issue is that one set is PCM, the other has been u-law'd. When I try to read in PCM wav, no problem, but the u-law files give the following error: >>> wav = wave.open("C:\\soundfiles\\Olympus Recordings\\1019.wav") Traceback...

How can i make python take a data time in format hh:mm:ss and store it in an array? [closed]

python,time,format
I have a list of csv file which contains several columns. There's one that contains the lenght of my test in this format hh:mm:ss I need to divide this data in two database based on lenght: <00:16:00 or >00:16:00 How can I do that? Thanks for helping and sorry for...

How config url in Kaminari pagination? '.json' appended automatically

ruby-on-rails-3,url,pagination,format,kaminari
Load table with Kaminari pagination using AJAX. The pagination itself is using AJAX as well. In my controller: def update_user_list modal = render_to_string('tables/_user_table', :layout => false, :formats=>[:html]).html_safe data = { :table => modal } respond_to do |format| format.json { render :json => data } end end In tables/_user_table # Table...

Json Formatted with Square Brackets

ruby-on-rails,ruby,json,format
I tried to render json where the root directory is enclosed in square brackets. My required format is: [{"status":"Failure","message":"Invalid Credentials"}] My code is: render :json=> [{:status=>'Failure',:message=>'Invalid Credentials'}], :status=>422 I can't get the square brackets in the response. My current response is: {"status":"Failure","message":"Invalid Credentials"} How can I obtain the required format?...

String format with 3 conditions: is it possible? [closed]

java,string,format,output,inline-if
I want to format my output text so it's corresponding with my counter values. For an instance, I have 3 counters and would like to output different words when it is 1, 2 and more than 2. I tried with String format, but it's only good for 2 different counters....

Bootstrap DateTimePicker format

c#,asp.net-mvc-5,format,cultureinfo,bootstrap-datetimepicker
I am coding a MVC 5 internet application and am using the bootstrap-datetimepicker in a view. My application is being used internationally and I would like to format the datetimepicker to have the correct format for each user. I have the culture and the timezone for each user, how is...

How can I format a number for multiple prints in python3.x?

python,variables,python-3.x,printing,format
I want to be able to format a number a certain way and have it turn out this way for each print function I call rather than reformat it within each print function. I just see it as a way to clean up for code a little. Here's an example:...

How can I get git log to print the full hash and short stats of each commit on one line?

git,format
I would like to get this kind of output with git command line: bcfd649de8850e3bfc9584eb12be8fe136ca6985 3 files changed, 8 insertions(+), 1 deletion(-) I'm currently using git log --shortstat --reverse --pretty=oneline, but it's actually not a single line and the comment is useless to me: bcfd649de8850e3bfc9584eb12be8fe136ca6985 Added ActionController#cookies[] as a reader for...

How to convert variable to time format when values have different formatting

r,format,strptime,chron
I am trying to convert a variable that contains that length of time of a phone call from a factor into a chronological format using the chron function. However, the values for calls that were less then 1 hour are reported as m:s, while calls that were longer then an...

format convert date variable using SAS

date,format,sas
I want to convert a character date variable (categorical) in the format 9/12/1990, 10/1/1990, etc. into this format: 09/12/1990, 10/01/1990, etc. (mmddyy10.) using SAS. format date_new mmddyy10.; date_new =input(trim(VAR1),mmddyy10.); The code is not working....

Python: Fixed length string multiple variables left/right aligned

python,string,format
I am fairly new to Python and try to format a string for ouput on a LCD-display. I would like to output a formatted table of train departures the display has a fixed length of 20 characters (20x4) I have 3 string-variables with variable length (line, station, eta) 2 of...

Website Formatting Troubles

html,css,format
So I've been trying to work on my website creation skills and was reading various tutorials concerning html/css developing. The problem I now have run into is that when I alter the size of my page the view gets incredibly altered. I was under the assumption that when the view...

Currency check whether € or $

excel,vba,excel-vba,format
I want to program a sub that checks whether a value in a cell is formatted as currency and then checks whether this currency is € or anything else. Based on the result the user should be prompted an InputBox to enter the actual exchange rate between currency given and...

Django change local datetime format

django,datetime,format,local
I have a Django app in which I use the translation system. I want Django to print datetime objects in local format, but not in the default format in currently print for me. Example, for english translation, I get the datetime objects in this format: May 14, 2015, 1:26 p.m....

What is the SAS format and informat for “mm/dd/yyyy hh:mm:ss”?

datetime,format,sas,informat
The Question Please is there a built-in SAS format and informat for datetime in mm/dd/yyyy hh:mm:ss? For example: 06/25/2015 03:02:01 (June 25th 2015, 3 o'clock 2 minute 1 second). The Background I am trying to parse a CSV flatfile to a SAS dataset in which a datetime column is currently...

Alter a file using information from another file

perl,file,format,alter,phylogeny
I want to alter the names in a phylip file using information from another file. The phylip is just one continuous string of information, and the names I want to alter (e.g. aaaaaaabyd) are embedded in it. Like so...

Format Exception in View MVC C#

c#,asp.net-mvc,exception,format
The following is a snippet taken from my View Model: [Display(Name = "Time")] [Required(ErrorMessage = "Is required field. Format hh:mm (24 hour time)")] [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:HH:mm}")] public Nullable<System.TimeSpan> EventPerformance_Time { get; set; } And this is from my View.cshtml: <div class="form-group"> @Html.LabelFor(model => model.EventPerformance_Time, htmlAttributes: new {...

Searching the proper format in php unpack function

php,format,unpack
The output is the result of the codes: $bytes= fread($handle,"32"); print_r(unpack("La/fb/fc/fd/fe/ff/fg/fh",$bytes)); Array ( [a] => 20150416 [b] => 1.0499999523163 [c] => 1.25 [d] => 1.0299999713898 [e] => 1.1900000572205 [f] => 509427008 [g] => 566125248 [h] => 509427008 ) How to write the proper format in unpack if the wanted output...

Color and Style Format Data.Frames in R

r,format,data.frame
I am trying to format a data.frame I have created in R and can not seem to find a solution. By format I mean that I would like to bold/italicize the headers(i.e. names) of the data.frame and also color/highlight certain rows within the data.frame. I tried researching on google/stackoverflow, but...

How can I add two date strings in the format HH:MM:SS together?

php,date,datetime,format,hour
I am saving the variables in the format of HH:MM:SS. I want to sum up several variables such as: TotalTime += var1+var2 It gives me the result of 0, whats the right format for getting the sum as HH:MM:SS?...

R - strtoi strange behavior to get week of year

r,date,format
I use strtoi to determine the week of year in the following function: to.week <- function(x) strtoi(format(x, "%W")) It works fine for most dates: > to.week(as.Date("2015-01-11")) [1] 1 However, when I'm trying dates between 2015-02-23 and 2015-03-08, I get NA as a result: > to.week(as.Date("2015-02-25")) [1] NA Could you please...

PHP Human date range/duration format

php,date,format
PHP is so well made that I am wondering if there is a function for what I need. For events that last more than one day, the human way to format it is complex. Exemples... Event one: from 2015-04-20 to 2015-04-22 could be formatted for humans like this: April 20-22...

Formatting Zipcode in R (removing - from zipcode)

r,format,zipcode
I have a dataset of the following: > head(data,3) city state zip_code overall_spend 1 MIDDLESBORO KY 40965 $252,168.12 2 PALM BEACH FL 33411-3518 $369,240.74 3 CORBIN KY 40701 $292,496.03 Now, I want to format the zip_code which has extra parts after -. For example, in the second row, I have...

Why should we use a List of a particular type in Java

java,methods,arraylist,static,format
I am currently going through a lesson in Java, and this lesson covers passing an ArrayList object through a static method. In the first static method, you see that ArrayList only had to be declared as ArrayList, and a name for it. The first static method displays all of the...

Format date shown on DatePicker

date,datepicker,windows-phone-8.1,format
I created a Pivot Project on Visual Studio 2013. I created the following control: <DatePicker Header="Data" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="10,10,0,0" Width="341"/> When I tap on it on my phone, it displays the date as M/D/Y. Is it possible to display it as D/M/Y? Also, don't know if I should create another...

add $ and round 2 decimal places SQL

sql,oracle11g,format
I am looking to format an ouput which is created by a sub-query, this sub-query produces a calculated field which i would like to format as $XX.XX. Sub query: (select avg(retail) from cars where brand = 'FORD' or brand = 'TOYOTA') as AVG_BRAND_PRICE_01 I basically just want to add a...

Getting Autolayout beneath the status bar

ios,cocoa,format,autolayout
I have read multiple previous posts on Autolayout and the status bar behavior in iOS 7 and still do not know how to get my Autolay-ed out objects to be beneath the status bar. I currently have self.automaticallyAdjustsScrollViewInsets = YES; self.edgesForExtendedLayout = UIRectEdgeNone; and a search bar has a visual...

Less beautifier - format code

sorting,format,less
Is there is code beautifier for less such as http://www.lonniebest.com/formatcss/ for css? I need sort properties in less code by alphabet.

How to properly align strings in C# using String.Format()?

c#,string,visual-studio-2010,format
guys, sorry to flood this website with such a boring question, but even after reading the documentation about C# and looking at their examples, I just can't seem to find an explanation for this. Namely, I have a code like this: String s = "Hello"; String n = "World"; String...

time formatting in matlab

matlab,time,format
I have time series per minute that look as shown below. The format is like '"hh:mm"' as seen below '"8:59"' '"9:00"' '"9:01"' '"9:02"' '"9:03"' '"9:04"' '"9:05"' '"9:06"' '"9:07"' Is it possible to change these to hhmm format in matlab like 859 900 901 902 t0 a double format. ...

Get value from number

php,numbers,format
I have a number in this format: 3 320,17 And I need to get it like: 3320,17 if I use: floatval($price) it only return the number 3 separated by the space. Any idea how to solve?...

Error comverting date using SimpleDateFormat

java,date,format,runtime-error,simpledateformat
I want to convert a date in format dd MMM yyyy (23 May 2015) to yyyy-MM-dd. The code I'm using: SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd MMM dd", Locale.ITALY); try { Date varDate = simpleDateFormat.parse(date); simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.ITALY); date = simpleDateFormat.format(varDate); } catch (ParseException e) { e.printStackTrace(); } The...

Generating file which can Excel easily open and save

excel,csv,xslt,format,export
i am exporting data from database to file, which can Excel read and save. (CSV) I generate csv, with default format (according to RFC 4180, comma delimeter). As expected, stupid excel read all data and place it to one cell. (CSV with semicolon delimeter), this one excel read fine, but...

Java Method for Formatting Text?

java,format
I'm currently taking Python, and I like the way one is able to insert variables into a string without doing "+ var +" or " ", var, " " Example: "We can just go out at {} pm and go to {}.".format(5, "Bob's Burgers"); Is there a way to do...

Date format changing according to browser

javascript,date,format
This is my JS function for displaying the date in the browser, but the format is changing according the browser. Means when i open my project on chrome then format is 4/30/2015, and when open on IE then 30 april, 2015. How can i fix this? document.getElementById(lblClock).innerHTML = nd.toLocaleString(); I...

R script to format datatable to exactly 2 decimal places

r,format,decimal
I have made a datatable "Event_Table" with 46 rows and 6 columns. At some point I export this to text file and would like the output of some fields to be truncated to exactly 2 decimal places. Event_Table[1:34,3:6]=round(Event_Table[1:34,3:6]) Event_Table[36:39,3:6]=format(round(Event_Table[36:39,3:6],2), nsmall=2) Event_Table[41:46,3:6]=format(round(Event_Table[41:46,3:6],2), nsmall=2) Line 1 and 2 produce the desired result,...

What do these bytes do?

format,png,file-format
This is the hexdump of a black 1x1 PNG made in Gimp and exported with minimal information: 89 50 4E 47 0D 0A 1A 0A 00 00 00 0D 49 48 44 52 00 00 00 01 00 00 00 01 08 02 00 00 00 90 77 53 DE...

What is a regular expression for a WPA-bssid

regex,networking,format,wpa,bssid
is this format ? wpa-bssid 00:1a:2b:3c:4d:5e or wpa-bssid 00:12:26:36:48:58 can I use this regex? ^([0-9A-F]{2}[:-]){5}([0-9A-F]{2})$ any help woulb be appreciated...

How to display percentage with one decimal and manage culture with string.Format in C#?

c#,.net,format,percentage,string.format
I would like to display a percentage and manage the culture. Like this : https://msdn.microsoft.com/fr-fr/library/system.globalization.numberformatinfo.percentnegativepattern%28v=vs.110%29.aspx I do that : double percentage = 0.239; NumberFormatInfo nfi = CultureInfo.CurrentCulture.NumberFormat; string percentageValue = string.Format(nfi, "{0:P1}", percentage); It works (for example result can be "%23,9" or "23,9 %") But I don't want to display...

PHP display text from MYSQL

php,mysql,text,numbers,format
I'm still vary new to PHP coding. I have the code to request and show numbers from my database but I cant seem to figure out how to show text. I've Googled it with different phrases but cant seam to figure it out. I have the following code: As you...

Formatting a drive in Visual Basic?

vb.net,format,drive
I have a ListBox that is being populated only with removable drives. The user selects the drives to be formatted and then the program should format those drives. However, I get the message that the specified file cannot be found. Here is my code. Public Class Form1 Private Sub Form1_Load(sender...

Date format with time range in javascript

javascript,jquery,date,datetime,format
I have a javascript date variable as 04/05/2015, 01:30 (dd/mm/yyyy, HH:mm) format. Now how can I change that format to 04/05/2015, 01:00-01:30 format. Ie, I want to change the time with time range where the first time value is always 30 minutes less than second time value. So If the...

Select multiple columns and Set the format as Date

excel,vba,excel-vba,format
I am trying to select Column I,K, Q,R and format the entire columns from row 2 as Date (mm/dd/yyyy) I know this code will select all of the columns which I don't need. Can anyone help me with this with VBA code? Thank you! I included a part of my...

Python format UnicodeDecodeError

python,django,unicode,format
Hello I want to save string into variable like this: msg=_(u'Uživatel <a href="{0}">{1} {3}</a>').format(request.user.get_absolute_url, request.user.first_name, request.user.last_name) But since the inserted variables contain characters with accents such as š I get UnicodeDecodeError even though I have set the encoding by# -*- coding: utf-8 -*- It is weird (IMHO) that it was...

DataGridTextColumn format depending on users current culture

c#,wpf,format
Im using DataGrid with columns: <DataGrid.Columns> ... <DataGridTextColumn Header="my value" Binding="{Binding Path=MyValue, ValidatesOnDataErrors=True, StringFormat=0.000000}"/> </DataGrid.Columns> How can I use output format depending on users current culture? For example 0,203 for german or 0.203 for us or something like this......

How to add dots and commas to number in MySQL query

php,mysql,format
I have a cell with a great number, like 650400300. I need to SELECT this number and separate to receive next format - 650,400.300. Would you mind to help me, please. Thanks in advance! I'm using PHP and MySQL. UPDATE: Now I think the correct way to do so is...

How to display json format in rails retrieving data from postgresql?

ruby-on-rails,json,postgresql,heroku,format
I'm new and I'm learning the basics but suddenly I have to display all the data from postgresql, using rails, in json format that is deployed to heroku. My goal is to connect vb.net to rails before connecting to the database. Please help me. I am new in this field....

How to read string until two consecutive spaces?

c,format,sscanf,c-strings
A well known function of the scanf() functions is that you can pass a format to scan input according to this format. For my case, I cannot seem to find a solution searching this and this documentation. I have a string (sInput) as the following: #something VAR1 this is a...

DateTime format string for invalid Format string

c#,datetime,format,data-type-conversion
I am trying to format Datetime string using date.ToString(format) If user feeds in wrong format, e.g. "YYYY MM DDr" I would like to know whether I can convert datetime using that format, rather than returning 2015 04 DDr since DateTime.ToString(format) always returns a valid String. For example, is there any...

Elastic(search): Query result date format differs from stored format

date,elasticsearch,format,elastic
got a problem with the elastic date format conversion when I parse the results from a query. So i have a default mapping on a date field as following: "timestamp" : { "type" : "date", "format" : "dateOptionalTime" } and it is stored as "timestamp":"2015-05-06T08:52:56.387Z" if I execute a max...

Minus sign removed using number formatting with jQuery

javascript,jquery,numbers,format
I am using the number format plugin for jQuery, specifically jQuery Number Format: Redux, and for some reason negative numbers are reformatted as positive. If I have <span format='float'>-50</span> and call $('span[format="float"]').number(true, 2); The negative is removed and returns 50.00 instead of -50.00 see this JSFiddle example...

Opening a Text File using PHP - Fixing the Format

php,format,wamp,fread
Basically, my text file contains this info: WITH PARALLEL AND SERIAL ----- [System Info] ----------------------------------------------------------- Property Value Machine Type AT/AT COMPATIBLE Infrared (IR) Supported No DMI System UUID 809EC223-DAD7DD11-A2F33085-A993FFAC UUID 23C29E80-D7DA-11DD-A2F3-3085A993FFAC Disk Space Disk C: 89 GB Available, 97 GB Total, 89 GB Free Disk Space Disk D: 355 GB...

Input String was not in Correct Format (C#: Radio buttons conversion)

c#,radio-button,format,converter
I am making a simple program where I/the user will select a number (the radio button) and when the "Click" is clicked, a message box will appear and show the result. i am almost there but everytime I click "Click", an error occurs and says: Input string is not in...

Formatting with \t with unknown string lengths in C#

c#,format
This might be a hard question, or a stupidly simple one. Either way, bear with me, as I'm quite new to C#. I've been building a Form with a ListBox inside, and a few other things, and all has been well. Where things get odd are in the filling of...

Adding a formatted date on to the end of a concat function

excel,vba,date,format,concat
I'm currently looking to add an updating date in a DD/MM format to the end of a string of text currently generated by an existing macro. Sub Nomediatidy() Dim w1 As Worksheet Dim w2 As Worksheet Dim result As Range Dim FirstRow As Integer Set w1 = Worksheets("Sheet1") Set w2...

How to make the time format from h:m tt to hh:mm tt in c#

c#,time,format
I am trying to show time(s) in a dropdown. I managed to do so using this code:- DateTime dtTime = new DateTime(2015,01,01,00,00,00); DataTable dt = new DataTable(); dt.Columns.Add("time"); for (int i = 0; i < 48; i++) { string tm = dtTime.ToShortTimeString(); DataRow dr = dt.NewRow(); dr["time"] = tm; dt.Rows.Add(dr);...

Printing dictornary with list order

python,list,dictionary,printing,format
I have the following code, it is an address book (a list of dictionaries) and a list. The idea is to print the items from the dictionary in the order of the list (since dicts mess up the order of everything). When I run this code, it throws an exception...

Foreach Loop Configuration for Displaying 2 Sets of Data

php,loops,foreach,format
I am using Simple HTML DOM to get data from a webpage that returns a page of results. I want to format it as title, then description. Right now I am using this code: <?php include('simple_html_dom.php'); $html = file_get_html('https://www.example.com?q=randomquery'); foreach($html->find('div#resultscontainer') as $data) //for each title foreach($data->find('h3') as $title) { //for...

python-making strings line up in a column exactly n spaces from left

python,string,format
In python, is there a way to print a string to a file so that it is exactly n spaces from the leftmost column? For example, I have the following lines in a file: fname1 lname1 ID1 num1 fname2 mname2 lname2 ID2 num2 fname3 mname3 lname3 ID3 num3 and I...

What does the value `/W` mean in PDF `/Tabs` key?

pdf,format,structure
According to the PDF 1.7 specifications, a PDF may only have the values /R, /C and /S on the /Tabs key of a page object (see PDF reference Page 145, Table 3.27). I have a PDF in front of me that fails in PDF structure preflight with a value /W...

strptime returning NA values [closed]

r,date,format,na,strptime
I'm trying to use strptime to format dates I'm reading in but only get NA values are returned in the output. My raw data is in the format of 1974-01-01, and the length of the dataset is 12049 so the last date is 2006-12-31. The code I use is: Data$date.yyyymmdd...

Check constraint for string with a format in SQL Server

sql-server,format,check-constraint
I have a table which is defined like: create table HLV ( id nvarchar(7) check (id LIKE 'HLV[0-9][0-9][0-9][0-9]') Primary key, birthday date, full_name nvarchar(20) NOT NULL, win int check (win > 0), lose int check (lose > 0), draw int check (draw > 0) ) I execute the code and...

Assigning a DataTable value to a Variable

c#,datatable,format
I just wrote a simple method to get some data from an SQL server and store it in a DataTable. Specifically the value is an integer : 666 It is an int datatype on the database and I made a variable called Credits in C# which is also an integer....

Date Formatting, SQL Server

sql,sql-server,date,casting,format
I have a problem with my ultimate formula of: ALTER TABLE tempTestProject ADD [T12 Backdated jnls] varchar(50) update tempTestProject set [T12 Backdated jnls] = 'X' where cast([Created Date] as date) > cast([Effective Date] as date) I get the error: Conversion failed when converting date and/or time from character string. Now...

Why does DateTime::createFromFormat() fails and returns a boolean in my second example?

php,string,datetime,format
When I run this the first one is correctly created into a date. The second one fails, returning a boolean and so I cannot format. Is the time out of range? //works correctly $startDate = "2015-05-06 10:49:20.637133"; $start = DateTime::createFromFormat('Y-m-d h:m:s.u',$startDate); echo $start->format('m/d/y'); //doesn't work correctly $startDate = "2015-05-12 15:49:06.821289";...

How to read files containing different formats/extensions?

c++,file,format
I am very new to c++ and I wanted to write a program that would read and extract data from files with/of different format (example: .dat). I just want to read and extract the data from it. Some people say something about file headers, structures and bodies, what are they...

How to dynamically set currency symbol in Excel custom format?

excel,formatting,format
The figures in my spreadsheet use the following custom formatting: €#,###.##,, "M" So figures are expressed in millions with 2 decimal places prefixed by the euro symbol and followed by M for millions. My workbook will need to be converted to other currencies and I don't want to have to...

Regular expression to split the string but capture sperator

javascript,regex,format
I have string say "dd month yyyy" and I want split to convert to array like ["dd", " ", "month", " ", "yyyy"]. What I have so far and this method works. But I'm looking for Reg expression to do if someone can help? function toArray(format) { var vDateStr =...

Returning a formatted string does not working properly

java,format,return,duplicates,string.format
I have created a dupe-check that makes sure that newly created usernames are unique. It looks like this: String p1 = <code>; //First 3 chars in first name String p2 = <code>; //First 3 chars in last name int p3 = 1; //Unique identifier. boolean dupeCheck; do { dupeCheck =...

Bug (??) in formatting long values with CString::Format

c++,format,long-integer,c-strings
I have issues with the following code: CString cstr; cstr.Format("SELECT foobar %ld, %ld ", " AND type = '%s' ", 1426233870,1426243870, "'OR'"); The resulting CString contains wrong numbers! The code is simplified, actually I am selecting datasets from a database between two timestamps in seconds. I was able to solve...

How to remove the [1]s, [[1]]s and double quotes from a csv data in R?

regex,r,csv,format,read.csv
I've a CSV file. It contains the output of some previous R operations, so it is filled with the index numbers (such as [1], [[1]]). When it is read into R, it looks like this, for example: V1 1 [1] 789 2 [[1]] 3 [1] "PNG" "D115" "DX06" "Slz" 4...

How to format a UK bank sort code?

php,format,bank
As part of a form I collect a users bank details which includes their sort code. The sort code is stored in the database as six numbers, for example 771731. I'd prefer to store the sort code in this format (without the hyphens) as it makes it easier for me...

How do you format the output of printing count

arrays,perl,printing,count,format
The following code gives the result of Female4946Male5054gender1 How do I add spaces between the element and its number and why is it printing the array with a 1 next to it? #!/usr/bin/perl use strict; use warnings; my @gender; my $female=0; while (<>) { chomp; my @fields = split /,/;...

Android Exception: UnknownFormatConversionException

android,exception,exception-handling,format
Hi I am setting some text inside a RobotoText that is positioned inside of a ViewHolder I am calling it like this: viewHolder.txtSimilarAds.setText((((Property) ads.get(position)).getSimilar_items_count() == 1 ? context.getString(R.string.ad_data_similar) : context.getString(R.string.ad_data_similar_plural, ads.get(position).getImagesCount()))); However (sometimes NOT always)for some reason I keep getting this error exception UnknownFormatConversionException and it points to this line...

How to extract just the audio from an MP4 file and convert it to FLAC file in C#?

c#,format,record,mp4,flac
My goal is to write c# that turns Microsoft LYNC meeting audio into text. Here is my project so far. Initially I was trying to record from microphone, save it to WAV then convert WAV to FLAC and using GoogleSpeechAPI, convert FLAC to text. But I got stuck recording microphone...

Python output format

python,format
When I am printing the following informatiom It looks really ugly. The text display is very long and you cannot really read it. Code: import psutil print("Disk: ", psutil.disk_partitions()) The output I get is: Disk: [sdiskpart(device='C:\\', mountpoint='C:\\', fstype='NTFS', opts='rw,fixed'), sdiskpart(device='D:\\', mountpoint='D:\\', fstype='', opts='cdrom'), sdiskpart(device='E:\\', mountpoint='E:\\', fstype='', opts='cdrom'), sdiskpart(device='F:\\', mountpoint='F:\\', fstype='NTFS',...

Converting String Data Value into date

mysql,string,date,format
Good Morning All; I currently have a MySQL table where there are 3 date fields (Columns) that were loaded as strings in this format 20140101 YYYYmmdd. I would like to convert this to a date format 2014/01/01 YYYY/mm/dd. Can someone please provide a simple sql syntax that would alter the...

how to check in javascript if is string in 100 000,00 format

javascript,string,numbers,format,match
let's say I have a string contained numbers, and I need to check if it's in specific format where would be every thousand separated by a space, followed by "," and 2 digits with decimals. So for example, 20125,33 would be like 20 125,33 122000111,15 would be like 122 000...

why is “+” added to all my coordinates in url builder?

java,string,url,format,coordinates
I have this code to build a string of coordinates: public String generateUrl(CompleteRoutingResponseShort completeRoutingResponse) { if (completeRoutingResponse == null) { return "CompleteRoutingResponse is null"; } UriBuilder builder = UriBuilder .fromPath(Constants.LIVEMAP_BASE_URL) .scheme("http"); builder.queryParam("lineGeom", getCoordsLists(completeRoutingResponse)); return builder.build().toString(); } private String getCoordsLists() { List<String> lists = new ArrayList<>(); for (AlternativeShort alternative :...

How can I set a DateField format in django from the model?

python,django,format,datefield
I am creating a django application and I have the next problem: this error is shown when I want to set a date: ValidationError [u"'12/06/2012' value has an invalid date format. It must be in YYYY-MM-DD format."] For this model: class ModelA(models.Model): date1 = models.DateField(null=True) date2 = models.DateField(null=True) How can...

What's the Pythonian way to append to a bytearray a list?

python,format,bytearray
I'm trying to append the contents of a list (which only contains hex numbers) to a bytearray. Right now I'm doing this and it works: payload = serial_packets.get() final_payload = bytearray(b"StrC") final_payload.append(len(payload)) for b in payload: final_payload.append(b) However, I believe it's not very Pythonian. Is there a better way to...

Get-PSDrive select formatting

powershell,select,format
I'm trying to do simple select formatting in powershell with gdr ( Get-PSDrive ), namely: When you exec gdr with no parameters, you receive statistics in GB PS > gdr Name Used (GB) Free (GB) C 187.31 278.10 How do I select the colums in GB -"Used (GB)", , without...

how to print a certain amount of results on a single line

arrays,perl,count,format,newline
I want to print up to 10 results per line and then after 10 force a new line. How would I do this? This is the code: my @email; my @gender; my @state; while ( <> ) { chomp; my @fields = split /,/; push @gender, $fields[5]; push @email, $fields[3];...

Date formatting - making dd/m/yyyy into dd/mm/yyyy

excel-vba,date,format
I got a pretty simple question (but yet I've been stuck at it for some time now). Does anyone know how to make the date value from dd/m/yyyy into dd/mm/yyyy in a variable? dim lastdaylastmonth as date lastdaylastmonth = DateSerial(Year(Date), Month(Date), 0) So this code, as of now, would return...

Formatting specific part of text string in VBA

excel,vba,excel-vba,outlook,format
I am in process of creating a macro that will save the current workbook, create a new outlook message and attach the file to the message. My macro does that but I can not format the text in the body of the email to my liking. Dim OutApp As Object...

C++ Reading tab-delimited input and skipping blank fields

c++,variables,input,format,tab-delimited
I am making a program that will take a long string of tab-delimited metadata pasted into the console by the user and split them into their correct variables. I have completed the code to split the line up by tab, but there are empty fields that should be skipped in...

need help on datetime function in java

java,datetime,format
I am trying to using the getHours() function in the Date class in Java, but it always shows "The method getHours() from the type Date is deprecated". How do I format the datetime to yyyy/mm/dd hh:mm and add 8 hours in the time display? After this I need to getHours()...

Selecting Data from Last Week in Python

python,datetime,pandas,format,dataframes
I have a large database and I am looking to read only the last week for my python code. My first problem is that the column with the received date and time is not in the format for datetime in pandas. My input (Column 15) looks like this: recvd_dttm 1/1/2015...

formatting path string in javascript

javascript,node.js,path,format
If you feel that you have to down-vote this question I would be grateful that would comment on it: any feedback is better that no feedback. I have been trying to format an array of mixed path (unix and windows format) and to remove the root directory in certain case....

Bulk Insert CSV File Using Format File

sql-server,file,csv,format,bulkinsert
I am trying to insert a CSV file into a SQL database using Bulk Insert and a Format File but I am having some trouble. I have been using the following tutorial. http://www.bidn.com/blogs/marcoadf/bidn-blog/2479/bulk-insert-format-file-skip-column When I run the script I get this error I think it has something to do with...

Copying lines from text file- remove formatting- Python

python,file,formatting,format
I am attempting to read text from a file, then print out the corresponding Shakespearean sonnet off of input from a user. [if the user enters 1, print sonnet 1, etc.]. The code I have below functions, however, I would like the answers to be without all the formatting 'def...

Format date (with different input) php

php,date,format,multilingual,jquery-validation-engine
I am working on a multilingual formular and have to solve a date formatting problem: In German the date format is: DD-MM-YYYY While in another country e.g. England the date format is: YYYY-MM-DD While this input validation is handled right, I need to get a easy solution for my php...

Formatting Integers in JTable Column Cells With Commas

java,swing,jtable,format,number-formatting
I have a Price column that displays integers in plain format like 1000000. I would like to know how can I format it with commas without affecting its value when retrieving with table.getValueAt()? Is there a method like table.setColumnCellFormat(decimalFormat)?...

Changing .NumberFormat based on .Value

excel,vba,formatting,format
I have to change the format of a cell to Euros based on its value. If it is between 1 and -1 then it will have three decimal places. else, it will have only one. Also the Euro symbol needs to come before the number. I'm having trouble getting the...

sas convert date format

date,format,sas
I have a var of birth date in this format: 15APR1954 I need to set a new var that will present the current age - as if today's date is 01.01.2011 in order to use the var, how do I convert the date? otherwise it gives me the following error...