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...
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...
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...
c++,windows,string,unicode,formatting
Here are two methods I can think of: The easy one: convert each of your bytes in a UTF-16 wchar_t by summing 0x8000 to its value (i.e. you append a 0x80 byte). The efficiency is only 50% but at least you spare the base64 conversion, which would lower the efficiency...
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...
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...
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...
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'); }; ...
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) ...
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: ...
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...
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...
I think the problem is caused by mixing styles for different UI elements. You should define separate Styles for TextBoxes, StackPanels etc by using the TargetType= attribute in your style. Moreover, setting a style for a Window (no experience with Page) often does not work in my experience. I revert...
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,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...
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. ...
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]...
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...
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; }...
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....
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...
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...
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()...
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...
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" ...
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...
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...
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}")...
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') ) ...
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)...
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));...
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 ...
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> ...
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...
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...
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...
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))...
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...
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...
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...
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...
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"; } };...
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...
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,...
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,...
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...
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." ...
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....
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...
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...
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 ...
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).
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],...
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,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...
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...
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....
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...
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...
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/* ...
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;...
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...
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...
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...
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...
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...
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...
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...
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....
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)...
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' ...
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...
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'),...
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...
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...
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...
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>"); ...
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,...
html,formatting,script-tag,hacking
My best guess is that the script code was originally put in a CDATA section like this: <script type="text/javascript" //<![CDATA[ //]]> </script> When deleting //<![CDATA[ (which wasn't needed since it's referring to an external source file), they simply neglected to remove the final //]]....
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 } ...
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...
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...
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...
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...
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()); ...
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!
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...
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()] ...
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>...