Let's expand out the Format types from list :: ([Builder] -> Builder) -> Format r (a -> r) -> Format r ([a] -> r) Format r (a -> r) -> Format r ([a] -> r) Holey Builder r (a -> r) -> Holey Builder r ([a] -> r) ( (Builder...
python,formatting,raspberry-pi
The os.system() call returns an integer (the process exit code). You want to apply the % operator to the string argument, not the return value of the function. You are doing this: os.system(string) % tuple instead of os.system(string % tuple) Move those parentheses: os.system("pigs m %d w wvclr wvag 16...
First of all ListBox arn't meant to be easily customizable. To answer your question I want to add dollar signs to my numbers, and left align them, you need to use String.PadLeft function. customerListBox.Items.Add((CStr(record.Item("CustomerName"))) & " : $" & (CStr(record.Item("YTDSales"))).PadLeft(8)) Note : I added 8 spaces in this exemple. It...
You can get an approximate format of that in an email body by piping it through Out-String $body = C:\Users\abc\Desktop\xyz\file.bat -Name powershell | Format-Wide | Out-String Note that your column alignment will not be exactly as you see it in the console, because the email client will use proportional fonts,...
You can run javadoc with the -link or -linkoffline parameter and point it to Oracle's javadoc: > javadoc -link https://docs.oracle.com/javase/8/docs/api/ src/* ...
c,formatting,output,multiplication,spaces
Here is a simple example of how to make constant length printouts using printf: int main(void) { char a[6][7]={"1","22","333","4444","55555","666666"}; int i; int value; for(i=0;i<sizeof(a)/sizeof(a[0]);i++) { value = atoi(a[i]); printf("%07d\n", value); //with leading zeros printf("% 7d\n", value); //with spaces } getchar(); return 0; } Here is the output: ...
r,table,formatting,reshape,long-form
You can use reshape from base-r: reshape(q, v.names="response", idvar="person", timevar="qstn", direction="wide") person response.A response.B response.C 1 101 0 0 NA 3 102 1 0 NA 5 103 0 1 1 ...
What is plt_Dy5? I have the nagging feeling that it is an array with dimension(200), as your other plt_* vars seem to be. If that is the case, then for every write() statement, it would write out the whole 200 values of plt_Dy5 in addition to the current index values...
haskell,floating-point,formatting,floating-point-precision,scientific-notation
After some research, I manage to get what I want. The function to get the engineering format work in a few steps : 1. Dissociate the exponent from the mantissa It's necessary to get the exponent apart of the mantissa. The function decodeFloat (provided by base) decode a floating point...
I am using this method in my project, you can use too. Maybe there is better way, I dont know. public void KMBMaker( Text txt, double num ) { if( num < 1000 ) { double numStr = num; txt.text = numStr.ToString() + ""; } else if( num < 1000000...
android,parsing,formatting,retrofit
Use Gson builder for json conversion in retrofit. Gson gson = new GsonBuilder() .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES) .create(); RestAdapter restAdapter = RestAdapter.Builder() .setEndpoint(Config.BASE_URL) .setConverter(new GsonConverter(gson)) .build; In the other way, You can simply set @SerializedName("") annotation in your POJO....
datetime,matplotlib,formatting,decimal,ticker
Without a MWE its hard to know exactly, but I think you need to set the major_formatter. Assuming you have an axis object ax, you can use: from matplotlib.dates import DateFormatter, MinuteLocator ax.xaxis.set_major_locator( MinuteLocator(byminute=range(0,60,10)) ) ax.xaxis.set_major_formatter( DateFormatter('%H:%M') ) ...
python,regex,string,pandas,formatting
It would be possible through two re.sub functions. >>> import re >>> s = '''SAMPLE0001 SAMPL1-0002 SAMPL3003 SAMPLE-004''' >>> print(re.sub(r'(?m)(?<=-)(?=\d{3}$)', '0', re.sub(r'(?m)(?<=^[A-Z\d]{6})(?!-)', '-', s))) SAMPLE-0001 SAMPL1-0002 SAMPL3-0003 SAMPLE-0004 Explanation: re.sub(r'(?m)(?<=^[A-Z\d]{6})(?!-)', '-', s) would be processed at first. It just places a hyphen after the 6th character from the beginning only...
I believe using http_build_query will solve this for you. Given the example, here's sample of how to use it: $args = array(array(0,1,2), array(3,4,5), array(1,2,3), array(6,6,5)); $kwargs = array( 'filename' => 'plot from api', 'fileopt' => 'overwrite' 'style' => array('type' => 'bar'), 'traces' => array(1), 'layout' => array('title' => 'experimental data'),...
jsp,formatting,velocity,template-engine
You can use $numberTool.format("#0.00", $val) You should see 'org.apache.velocity.tools.generic.NumberTool' for more details. To make it working you also should add the following maven dependency: <dependency> <groupId>org.apache.velocity</groupId> <artifactId>velocity-tools</artifactId> <version>2.0</version> </dependency> and write following code: context.put("numberTool", new NumberTool()); ...
javascript,html,xml,formatting,codemirror
Your HTML string dosnt contain any line breaks or tabs/spaces. What you will need to do is parse your string through a HTML formatter. CodeMirror has a formatting util by including formatting.js Here is a working demo: http://codemirror.net/2/demo/formatting.html You will want to execute something similar to the following code after...
Passing the code to Google returns this page that explains qrpff is a Perl script created by Keith Winstein and Marc Horowitz of the MIT SIPB. It performs DeCSS in six or seven lines. The name itself is an encoding of "decss" in rot-13. See also qrpff explained....
Just split the lines and concat: lines = """Hello how are you! Python is cool!""" for line in lines.splitlines(): if line: print(">" + line) else: print(line) >Hello how are you! > Python is cool! To get a new string and keep the newlines set keepends=True: new_s = "".join([">{}".format(line) if line.strip()...
echo("<div id="image_catalog">") line needs semicolon and escape, like this. echo("<div id=\"image_catalog\">"); also add semicolon to last line like so. echo ("</div>"); ...
formatting,duplicates,conditional,highlight,partial
Thanks to a genius over at the Google Product Support Forums named Isai Alvarado I finally have the solution... =if(C2<>"",ArrayFormula(countif(left($C$2:$Z$18,4),left(C2,4)))>1) I hope this helps anyone else trying to highlight partial duplicates across multiple columns. ...
You need to use the CopyOrigin parameter as well. sheet.Range[string.Format("{0}:{0}", row)] .EntireRow .Insert( Excel.XlInsertShiftDirection.xlShiftDown, Excel.XlInsertFormatOrigin.xlFormatFromRightOrBelow ) See here for details on Insert and that enum. It is possible to get this parameter by recording a macro. There is a small box that pops up when you insert the row to...
mysql,linux,view,formatting,mariadb
Finally solved. HeidiSQL try to load view query from .frm file by LOAD_FILE function, which need file with read for all flag. Default creation mode db files are 0660 (and 0700 for directories). We can change it by include to start script (i.e. /etc/init.d/mysql) i.e. export UMASK=064 (which is OR...
You should not modify the data type storing these values, because you really dealing with a matter only of display logic. Internally, as long as some of them have a decimal part, all should be stored with a decimal part as a numeric type, rather than as a VARCHAR type....
asp.net,textbox,formatting,currency
You can wrap TextBox in an <asp:UpdatePanel> and add AsyncPostBackTrigger of TextChanged event. You can verify, validate and change the string from the server side using that.
python,python-3.x,formatting,format
Try gen = ('%+5s\n' % x if i%10==0 else '%+5s' %x for i,x in enumerate(prime_list,1)), instead of gen = ('%-5s\n' % x if i%10==0 else '%-5s' %x for i,x in enumerate(prime_list,1)) >>> nums = [2,32,34,3,54,5,436,45,6,45,674,57,56,87,567,2] >>> gen = ('%+5s\n' % x if i%10==0 else '%+5s' %x for i,x in enumerate(nums,1))...
python,formatting,multiplication,presentation
You can add a dictionary with the operator descriptions: op_symbols = { add: '+', mul: '*', sub: '-', } and instead of str(op), use op_symbols[op]...
Use method parameter of write method. Value on parameter if html or xml E.g. tree.write("output.xsd", method="html") Also have pretty print parameter which have value True or False e.g. tree.write("output.xsd", method="html", pretty_print=True) Have may parameters: write(self, file, encoding=None, method="xml", pretty_print=False, xml_declaration=None, with_tail=True, standalone=None, compression=0, exclusive=False, with_comments=True, inclusive_ns_prefixes=None) ...
your content type is Content-Type: text/html; charset=us-ascii this means that \n or %n will not work as during HTML rendering spaces and new lines are ignored (at least most of them), replace new line character with <br> - this is new line in html another solution is to include your...
xml,go,formatting,date-formatting
Just as you'd implement json.Marshaler and json.Unmarshaler for doing this with JSON (there are many posts about that on StackOverflow and the internet); one way is to implement a custom time type that implements encoding.TextMarshaler and encoding.TextUnmarshaler. Those interfaces are used by encoding/xml when encoding items (after first checking for...
You shall use xsl:copy-of as the input format is the one expected for example: <xsl:template match="/"> <html> <head> <title>Title</title> </head> <body> <xsl:copy-of select="examples/example"/> </body> </html> </xsl:template> ...
The problem is that Substring(maxCharacters/2, textLength-maxCharacters) into which you insert the ... already has the characters that you don't want to see - 456789. There's no way to fix it after that. What you should do instead is to pick the prefix and the suffix, and join them together, like...
formatting,openoffice-calc,formulas,libreoffice-calc
You can increase shown numbers after the decimal point by this: Tools -> Options -> OpenOffice.org Calc -> Calculate Set flag "Limit decimals for general number format" and set maximum number in input box (for me it's 20).
xml,file,formatting,erlang,output
That's because the runtime is unsure whether your terminal can display non-ASCII unicode. All strings are just lists of integers, and all binaries are just long strings of bits split into bytes of 8-bits. So the numbers you are seeing is the data you want to see, just the raw...
python,dictionary,file-io,printing,formatting
The \n is a newline character. Written to a file it shows as a line break. You should remove it before printing out: print >> j, user[0].strip(), user[1].strip() Or even better, do it while turning to a list: z = [item.strip() for item in z.items()] ...
javascript,html,string,formatting,markup
function format(data) { var returnStr = ""; var lines = data.split("\n"); var block = []; for (var i = 0; i < lines.length; i++) { block = lines[i].split('\t'); for (var j = 0; j < block.length; j++) { returnStr += block[j]; if (block.length>1) { returnStr += "\\t"; } };...
sql,sql-server,formatting,result
If you don't have something like pivot available (though you should, since it looks like you're using T-SQL), you can create columns for each value, like so: select date ,sum(case pTypeCode when 'C' then 1 else null end) count_c ,sum(case pTypeCode when 'P' then 1 else null end) count_p ,sum(case...
Try (replacing CellRow and CellColumn with the desired row and column for the cell): If Cells(CellRow,CellColumn).Value >= -1 and Cells(CellRow,CellColumn).Value <= 1 then Cells(CellRow,CellColumn).NumberFormat = "[$€-2] #,##0.000" Else Cells(CellRow,CellColumn).NumberFormat = "[$€-2] #,##0.0" End If ...
java,parsing,date,formatting,java-time
You can use a STRICT resolver style: import static java.time.format.ResolverStyle.STRICT; DateTimeFormatter dtf = DateTimeFormatter.ofPattern("M/d/uuuu").withResolverStyle(STRICT); By default, ofPattern uses a SMART resolver style which will use reasonable defaults. Note that I have used uuuu instead of yyyy, i.e. YEAR instead of YEAR_OF_ERA. Assuming you are in a Gregorian calendar system, the...
The “cheap” method would be including the file wp-includes/formatting.php (and maybe others) and running your code through the desired filter functions, such as wpautop(). However, this does not guarantee that the content is formatted like your WordPress blog – especially because it won't apply the modifications made by plugins. Also,...
From your screenshots, your configuration actually looks correct, i.e. you have ${filecomment} at the top of your pattern for "Code > New Java files" under "Preferences > Java > Code Style > Code Templates", and editing the pattern under "Comments > Files" to suit your liking. If your settings are...
datetime,highcharts,formatting,axis-labels
You can use the xAxis.labels.formatter function to specify exactly what you want to show as xAxis labels: labels: { formatter: function() { var date = new Date(this.value); var month = date.toDateString().substring(4,7); var day = date.getDate(); if(this.isFirst || day == 1) return day + '. ' + month; return day; }...
In XSLT 2.0, you can use the format-date(), format-time() and format-dateTime() functions to format dates and time in a variety of ways, for example: XML <input>2014-04-30T15:45:12</input> XSLT 2.0 <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:template match="/"> <output> <xsl:value-of select="format-dateTime(input, 'The [DWwo] Day of [MNn] in the Year [YWw],...
excel,excel-vba,table,formatting,page-break
Just change the page margins and the top few rows get excluded, but the manual page break is still required though!
In the Eclipse Preferences go to Java -> Code Style -> Clean Up. Create or edit an (active) profile. In the Profile Edit dialog go to the Member Accesses. Configure the settings in the Non static accesses-group as wished. In your case enable Use 'this' qualifier for field accesses and...
linux,bash,grep,formatting,line
Run it through nl, the dedicated "number lines" tool: grep foo * | nl This obviously works for all commands, and not just grep....
google-apps-script,formatting,google-spreadsheet,rows,propagation
Create a function that will run when the form is submitted: Managing Triggers Manually - Google Documenation Code.gs function respondToFormSubmit() { //Format entire columns var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; var range = sheet.getRange("M:Y"); range.setNumberFormat('dd.mm'); }; ...
I think you just have to transpose them. clc clear angle = (0:1:85)'; polyvals = ((1:86).^2)'; T = table(angle, polyvals) gives T = angle polyvals _____ ________ 0 1 1 4 2 9 3 16 4 25 5 36 6 49 7 64 ...
javascript,formatting,locale,culture
When you use Number.toFixed() you obtain a string (not a number any more). For that reason, subsequent calls to .toLocaleString() launch the generic Object.toLocaleString() method that knows nothing about numbers, instead of the Number.toLocaleString() you want. Having a look at the documentation we can compose something like this (tested in...
Simply use String.format format specifier for floating point numbers: String.format("%.2f", yourNumber) Tutorial at: Formatting tutorial. Or use a DecimalFormat object. e.g., String s = String.format("%.2f", 0.2); System.out.println(s); Don't convert double to String pre-formatting as that's what the formatting is for. You're doing this double convPrice = callMethod.totalPriceMethod(); totalPrice = Double.toString(convPrice);...
That's not very easy. Here is a link to some code that I once wrote to do the same thing for RTF output. You can probably adapt it to produce HTML output. If you manage to do so, I'd possibly integrate it into that library's successor. Alternatively, if you prefer...
java,string,formatting,string-formatting
Try increasing the length of header as well as each row for the first field. Reason if you see for e.g. [0.2,0.4) seconds is more than 15 characters long. Try to increase it say to 20 characters and that would resolve the issue....
Use a named style. They're on the Home tab, hiding under the colourful section where "Normal", "Bad", "Neutral" and so on can be seen. Click the drop-down belonging to this section of the ribbon. I'll assume that in this case we'll change the format named Currency down at the bottom,...
java,string,floating-point,formatting,type-conversion
System.out.println(String.format("%.1g%n", 0.9425)); System.out.println(String.format("%.1g%n", 0.9525)); System.out.println(String.format( "%.1f", 10.9125)); returns: 0.9 1 10.9 Use the third example for your case...
excel,date,formatting,formula,conditional-statements
Place the cell cursor to the first date in your list (here A1 for example) Select "Manage Rules"from the "Conditional Rules" dropdown icon in the dialog box select "New rule", then "Use a formula to determine which cells to format" enter formula as =A1<TODAY()-365 ... and give it a...
python,csv,formatting,ordereddictionary
This will format it the way you described: First it writes a header row using the first entry in the list to figure out the names for the columns and then it writes the rest of the rows. writer = csv.writer(open('sortedcounts.csv', 'wb')) header = ['Top Calling Customers'] + list(list(sorted_counts.values())[0].keys()) writer.writerow(header)...
It sounds like your XML is coming straight from your database, which means you need to transform it into something else based on the structure you have presently. While you could learn XSLT, you could also do this using LINQ to XML, querying the document you have parsed in order...
php,mysql,casting,formatting,decimal
This should work : SELECT team , COUNT(*) as played , REPLACE(SUM(win), '0.', '.') as wins , SUM(loss) as lost , SUM(draw) as draws , SUM(SelfScore) as ptsfor , SUM(OpponentScore) as ptsagainst , SUM((win*2 + draw)- loss) as score , CAST(SUM(win + (draw/2))/SUM(win + loss + draw) as decimal(4,3)) as...
java,excel,formatting,apache-poi
I used Guava's Table as a data structure to save reinventing the wheel A few caveats; There may well be some mathematical trick with matrices or pivot tables or functional programming that may do the same job with much less code. I'm not sure if I'm using the latest and...
xcode,formatting,keyboard-shortcuts
Is there a short cut or some quick way for Xcode to format this code Yes. Use the Editor->Structure->Re-indent command (the default keyboard equivalent is control-I). If you don't have anything selected, I think it just indents the line with the insertion point. If you select multiple lines and...
vb.net,sorting,datagridview,formatting
You are converting your values to string by using the legacy VB Format function: Function Format(Expression As Object, Optional Style As String = "") As String When it is converted, the other decimals are lost. Use the Format Property of the DefaultCellStyle for that column to specify the number of...
The issue lies in the fact that you're printing a list. You want to be printing elements of the list. So instead of print(s[2:16]) you can do: for i in range(2:17): print(s[i]) Because the sonnets seem to be evenly spaced I would also recommend removing the ifs and making a...
If you're limiting you're exponential component to E0 to E99 (for positive exponential) and E0 to E-9 (for negative exponential), you could use a combination of DecimalFormat and Regex to format your results to be 6 characters in length. Something like: public static void main(String[] args) throws Exception { System.out.println(toSciNotation(1000123.456));...
view,formatting,typescript,rendering,marionette
By checking this link: http://derickbailey.github.io/backbone.marionette/docs/backbone.marionette.html You will find that serializeData is being used just before rendering the template So by overriding it, like below you can format the object values any way you want before rendering serializeData():any { var obj = super.serializeData(); obj.totalEnergy = Math.round(obj.totalEnergy).toFixed(0) return obj } ...
You can pass multiple key/value pairs to Python's str.format() format(format_string, *args, **kwargs) format() is the primary API method. It takes a format string and an arbitrary set of positional and keyword arguments. format() is just a wrapper that calls vformat(). Example: >>> print "Hello {foo:s} and {bar:s}".format(foo="World", bar="Foobar!") Hello World...
Check the printf manual page Look for the padding with 0: 0 The value should be zero padded. For d, i, o, u, x, X, a, A, e, E, f, F, g, and G conversions, the converted value is padded on the left with zeros rather than blanks. If the...
Here's one that I wrote a few weeks ago. You can specify the number of decimals you want (correctly rounded), or just pass Nothing in which case it will print the full precision, including marking the repeated decimals. module ShowRational where import Data.List(findIndex, splitAt) -- | Convert a 'Rational' to...
c++,terminal,console,formatting,output
You can either print the "="s without a line break or you can use ncurses which I think also wget uses. But in my opinion ncurses is much work to do. For small Projects I recommend the simpler way....
This is a possible way: get all your files in an array $files = @(Get-ChildItem -Path $path -Recurse | Where-Object { !$_.PSIsContainer -and $_.CreationTime -lt $limit }) Then create the body of your email cycling through the array of files and writing a line for each one with the details...
android,formatting,textfield,titanium-mobile,titanium-android
Finally, I solved it using custom theme named mytheme.xml added under platform folder--> android folder --> res folder--> values folder --> mytheme.xml In mytheme.xml : <?xml version="1.0" encoding="utf-8"?> <resources> <!-- Define a theme using the AppCompat.Light theme as a base theme --> <style name="Theme.MyTheme" parent="@style/Theme.Titanium"> <!-- For Titanium SDK 3.2.x...
c#,.net,vb.net,formatting,string-formatting
Can this be done with formatting strings alone? No. https://msdn.microsoft.com/en-us/library/0c899ak8%28v=vs.110%29.aspx#SectionSeparator Three sections The first section applies to positive values, the second section applies to negative values, and the third section applies to zeros. If the number to be formatted is nonzero, but becomes zero after rounding according to the format...
In order to change the color of an entire row, you would just select the entire row and choose expression under colors in the property menu, just as the article you linked described. If you want the color to change when that row has a particular value for a particular...
Yes. You can define the argument's index, see the Argument Index section of the API. For instance: // ┌ argument 3 (1-indexed) // | ┌ type of String // | | ┌ argument 2 // | | | ┌ type of decimal integer // | | | | ┌ argument...
There is no need to use ActiveCell in your Worksheet_SelectionChange event macro. That is what Target is/does. Modify your Worksheet_SelectionChange to be closer to the following. Private Sub Worksheet_SelectionChange(ByVal Target As Range) Target.Name = "mySelection" Cells.Interior.Pattern = xlNone Target.EntireRow.Interior.ColorIndex = 19 End Sub Now you will be constantly redefining a...
git,bash,shell,ubuntu,formatting
There's no need to cd around for this. Just use something like this reset=$(tput sgr0) blue=$(tput setaf 4) for dir in directory_name_1 directory_name_2 ...; do branch=$(GIT_DIR="$dir/.git" git symbolic-ref --short HEAD) color= if [ master = "$branch" ]; then color=$blue fi printf '%s: %s%s%s\n' "${dir##/*}" "$color" "$branch" "$reset" done Use tput...
excel,excel-vba,formatting,copy-paste
The direct problem lies within the order of execution. Currently you are: Opening the workbook with the macro Opening the workbook with the data Copying the data Closing the workbook with the data Pasting the data into the workbook with the macro Saving the workbook with the macro (and now...
c#,parsing,datetime,formatting
DateTime d = new DateTime(2015, 6, 9); Console.WriteLine(d.ToString("dd MM yy")); // dd 06 15 Console.WriteLine(d.ToString("dd MMM yyyy HH mm tt")); // dd Jun 2015 HH mm tt var regex = new Regex("[yY]+|[M]+"); Console.WriteLine(regex.Replace("dd MM yy", m => d.ToString(m.Value))); Console.WriteLine(regex.Replace("dd MMM yyyy HH mm tt", m => d.ToString(m.Value))); output 09 06...
Yes, but you have to pass them in as arguments to format, and then refer to them wrapped in {} like you would the argument name itself: print('\n{:^{display_width}}'.format('some text here', display_width=display_width)) Or shorter but a little less explicit: print('\n{:^{}}'.format('some text here', display_width)) ...
Remove the intervening margin_bottom div as it breaks the relationship between table-row and table-cell. And as you can't add margin to a table-row, to add spacing between rows, add the padding to the cells instead: .full_width{width: 100%} .table{ display: table;} .table_row{display: table-row;} .table_cell{display:table-cell;padding-bottom: 18px;} .wrapper_cont{width: 48%} #cell2{padding-left: 4%} .label{display:block} <div...
I changed a little bit your code, but I think you should use linked list as a data structure here, it's more simple and consume less memory. I made some tries and all went ok. :) Hope that help you!! #include <stdio.h> #include <stdlib.h> #include <ctype.h> typedef struct Record Record;...
c,while-loop,formatting,boolean-logic
If scanf fails when reading an integer, the input buffer needs to be cleared of the character causing the failure. The scanset "%*[^\n]" scans and discards characters that are not newline. A newline is left in the input buffer but the %d format specifier will skip leading whitespace. #include <stdio.h>...
sql,stored-procedures,reporting-services,formatting
You could add your own formatting function to the Report Code section: Public Function MinsToHHMM (ByVal Minutes As Decimal) Dim HourString = Floor(Minutes/60).ToString() Dim MinString = Floor(Minutes Mod 60).ToString() Return HourString.PadLeft(2, "0") & ":" & MinString.PadLeft(2, "0") End Function and then call it in the cell expression like this: =Code.MinsToHHMM(Avg(Fields!test.Duration.Value))...
javascript,sorting,formatting,filtering,tablesorter
You are seeing two things happen here: When entering a number in the filter that is not a valid date, a string comparison is done. So that is why the first row matches. Because the filter_defaultFilter for column 1 is set to use a fuzzy search filter_defaultFilter: {1: '~{query}'} a...
javascript,formatting,rivets.js
I think the solution to your problem is using formatters Rivets. They are like filters in AngularJS and support piping. You can define a formatter as follows: rivets.formatters.imgPath = function(value){ return '/img/uploads/' + value + '.jpeg' } Then you can use it in your markup like: rv-src="user.photo | imgPath" ...
telerik,formatting,conditional,client-templates
I modified my code to the following with help from the post: Telerik MVC Grid making a Column Red Color based on Other Column Value .Columns(columns => {columns.Bound(d => d.IsTrue).Width(0); columns.Bound(d => d.Name).Title("Name).Width(200).HtmlAttributes(new { style = "font-weight:normal;" }); }).CellAction(cell => { if (cell.Column.Title == "Name"){ var item = cell.DataItem; if(item.IsTrue)...
r,formatting,plyr,percentage,crosstab
pt <- percent(c(round(prop.table(tab), 3))) dim(pt) <- dim(tab) dimnames(pt) <- dimnames(tab) This should work. c being used here for its property of turning a table or matrix into a vector. Alternative using sprintf: pt <- sprintf("%0.1f%%", prop.table(tab) * 100) dim(pt) <- dim(tab) dimnames(pt) <- dimnames(tab) If you want the table written...
scala,formatting,messageformat
Since we don't like nulls I wrapped your possibly-null value into an Option. If the option have a value I create the array from it and then pass it into the formatter. If it didn't have a value I give it the value "". val szPhoneFrmt = new MessageFormat("1 {0}{1}-{2}")...
java,floating-point,formatting
Either I misread the question or it changed while I was typing, my original answer suggesting DecimalFormat won't do what you're looking for. Regular expressions will: final String unformatted = Double.toString(6381.407812500002); final String formatted = unformatted.replaceAll("00+\\d*$", ""); System.out.println(formatted); Yields: 6381.4078125 You asked for any more than two zeroes and all...
I have adapted the code found at: enter link description here which can easily be extended to include a line when parsing the data to write the .csv file. // Iinitialise FileWriter object. fileWriter = new FileWriter(fileName); // Iinitialise CSVPrinter object/ t. csvFilePrinter = new CSVPrinter(fileWriter, csvFileFormat); // Create .csv...
delphi,formatting,string-formatting,richedit
You extract the entire text, using the Text property, modify that string, and then replace the entire text. When you do that all the new text is given the selected formatting attributes. You need to select just the text that you wish to delete, and then delete it, all within...
excel,formatting,excel-formula,worksheet-function,conditional-formatting
Assuming integers only, please try a Custom Format of: 0"+";0"-";"-"; Re Edit: Select the range to be formatted (I chose N for illustration), HOME > Styles – Conditional Formatting, New Rule…, Use a formula to determine which cells to format, Format values where this formula is true: =N1=1 Format…, Number,...
EDIT#1: If the value '42248' has somehow gotten into A1, then in another cell enter: =--TEXT(A1,"d.m") to retrieve the 1.9...
python,csv,formatting,conditional-statements,writing
Use str.format: hrOut.write('0{}'.format(i)) Or remove the if/else and pad: for i in hrIn: hrOut.write("{}\n".format(i.rstrip().zfill(5))) zfill will only add a zero for your times with four characters: In [21]: "12:33".zfill(5) Out[21]: '12:33' In [22]: "2:33".zfill(5) Out[22]: '02:33' ...
python,string,python-3.x,dictionary,formatting
You need to put ** in front of the dictionary argument. So, your last line would be: report.append(TEMPLATE.format(**stock)) and it should work. So your code should be: TEMPLATE = "{ticker:6s}:{shares:3d} x {price:8.2f} = {value:8.2f}" report = [] stock = {'ticker': 'AAPL', 'price': 128.75, 'value': 2575.0, 'shares': 20} report.append(TEMPLATE.format(**stock)) Related: Python...
mysql> select sc.name, COALESCE(SUM(case when `exchangeid` = 'AMS' then o.filledqty end),0) as AMS, COALESCE(SUM(case when `exchangeid` = 'BRU' then o.filledqty end),0) as BRU, COALESCE(SUM(case when `exchangeid` = 'BTE' then o.filledqty end),0) as BTE, COALESCE(SUM(case when `exchangeid` = 'CHI' then o.filledqty end),0) as CHI, COALESCE(SUM(case when `exchangeid` = 'CPH' then...
I would do it this way: $paragraph = "This is a test to create a single-lined string, " + "but it doesn't seem to work. I would prefer " + "to make source code easier to read." ...
Strange how you want to save space in the enumeration yet add space between equations. I enjoy the current display. However, you can use a custom mylist which looks like an enumerate without alignment: \documentclass{article} \usepackage{showframe}% Just for this example \usepackage{amsfonts} \newenvironment{mylist} {\setlength{\parindent}{0pt}% No paragraph indent \setcounter{enumi}{0}% Restart enumeration at...