Tricky table formatting in css
Date : March 29 2020, 07:55 AM
it helps some times jsFiddle: http://jsfiddle.net/fQvLv/1/CSS .level-one-left{
border:2px solid #000;
border-right:1px solid #000;
}
.level-one-right{
border:2px solid #000;
border-left:1px solid #000;
}
.level-two-left{
border:2px solid #000;
border-right:1px solid #000;
border-top:0px;
}
.level-two-right{
border:2px solid #000;
border-left:1px solid #000;
border-top:0px;
}
.left-side{
border-left:2px solid #000;
}
.right{
border-right:2px solid #000;
}
.top{
border-top:2px solid #000;
}
.bottom{
border-bottom:2px solid #000;
}
<table cellspacing="0">
<tr>
<td style="border:0"></td>
<th class="level-one-left" colspan="5">Level One</th>
<th class="level-one-right" colspan="3">Level One</th>
</tr>
<tr>
<td></td>
<th class="level-two-left" colspan="5">
<table>
<tr>
<th>Level Two</th>
<th>Level Two</th>
<th>Level Two</th>
<th>Level Two</th>
<th>Level Two</th>
</tr>
</table>
</th>
<th class="level-two-right" colspan="3">
<table>
<tr>
<th>Level Two</th>
<th>Level Two</th>
<th>Level Two</th>
</tr>
</table>
</th>
</tr>
<tr>
<th class="left-side top right">Test One</th>
<td>Content</td>
<td>Content</td>
<td>Content</td>
<td>Content</td>
<td class="right">Content</td>
<td>Content</td>
<td>Content</td>
<td class="right">Content</td>
</tr>
<tr>
<th class="left-side right">Test Two</th>
<td>Content</td>
<td>Content</td>
<td>Content</td>
<td>Content</td>
<td class="right">Content</td>
<td>Content</td>
<td>Content</td>
<td class="right">Content</td>
</tr>
<tr>
<th class="left-side right">Test Three</th>
<td>Content</td>
<td>Content</td>
<td>Content</td>
<td>Content</td>
<td class="right">Content</td>
<td>Content</td>
<td>Content</td>
<td class="right">Content</td>
</tr>
<tr>
<th class="left-side right">Test Four</th>
<td>Content</td>
<td>Content</td>
<td>Content</td>
<td>Content</td>
<td class="right">Content</td>
<td>Content</td>
<td>Content</td>
<td class="right">Content</td>
</tr>
<tr>
<th class="left-side right bottom">Test Five</th>
<td class="bottom">Content</td>
<td class="bottom">Content</td>
<td class="bottom">Content</td>
<td class="bottom">Content</td>
<td class="bottom right">Content</td>
<td class="bottom">Content</td>
<td class="bottom">Content</td>
<td class="bottom right">Content</td>
</tr>
</table>
|
Problems aligning text in a table using string formatting
Tag : python , By : user109285
Date : March 29 2020, 07:55 AM
wish helps you Your code doesn't make much sense - you're calculating Fahrenheit over a different range to Celsius. Try: for c in range(40, -41, -1): # iterate over Celsius
f = (c * (9 / 5)) + 32 # calculate Fahrenheit from Celsius
print("{0:d}\t{1:.1f}".format(c, f)) # print both in one line, tab-separated
|
C# formatting sql table date column output when writing to text file
Tag : chash , By : UpperLuck
Date : March 29 2020, 07:55 AM
This might help you You could try this - I've also added an additional case to format any decimal values to currency format. foreach (DataRow row in data.Rows)
{
for (i = 0; i < row.ItemArray.Length; i++)
{
if ( row.Table.Columns[i].DataType == typeof(System.DateTime))
sw.Write( ((DateTime)(row.ItemArray[i])).ToString("dd/MM/yyyy") + "\t | ");
else if ( row.Table.Columns[i].DataType == typeof(System.Decimal))
sw.Write( ((decimal)(row.ItemArray[i])).ToString("C") + "\t | ");
else
sw.Write(row.ItemArray[i] + "\t | ");
}
sw.WriteLine();
}
|
String types and text output formatting
Date : March 29 2020, 07:55 AM
Does that help Keeping Line-Breaks For preserving line-breaks, the issue is text based line breaks (carriage return, \r, or newline, \n) are ignored in HTML. The best ways to create spacing between lines is to either use the dedicated "line break" element, or separate text into individual elements and add spacing with CSS. function SendEmail() {
var formResponseSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Form Response");
// fetch entry
var messageRange = formResponseSheet.getRange("D" + formResponseSheet.getLastRow());
// build message
var message = {
to: "destination@email.net",
subject: "New Entry Posted",
htmlBody: 'Hello, a new entry was posted.<p>' + messageRange.getValue().replace(/[\r\n]{1,2}/g,"<br>") + "</p><a href=\"www.some_link.com\">Link here</a>."
};
// send
MailApp.sendEmail(message);
}
|
Converting Python complex string output like (-0-0j) into an equivalent complex string
Date : March 29 2020, 07:55 AM
I wish this helpful for you As @wim has noted in the comments, this is probably not the right solution to the real problem; it would be better to not have converted those complex numbers to strings via str in the first place. It's also quite unusual to care about the difference between positive and negative zero. But I can imagine rare situations where you do care about that difference, and getting access to the complex numbers before they get str()'d isn't an option; so here's a direct answer. We can match the parts with a regex; [+-]?(?:(?:[0-9.]|[eE][+-]?)+|nan|inf) is a bit loose for matching floating point numbers, but it will do. We need to use str(float(...)) on the matched parts to make sure they are safe as floating point strings; so e.g. '-0' gets mapped to '-0.0'. We also need special cases for infinity and NaN, so they are mapped to the executable Python code "float('...')" which will produce the right values. import re
FLOAT_REGEX = r'[+-]?(?:(?:[0-9.]|[eE][+-]?)+|nan|inf)'
COMPLEX_PATTERN = re.compile(r'^\(?(' + FLOAT_REGEX + r'\b)?(?:(' + FLOAT_REGEX + r')j)?\)?$')
def complexStr2str(s):
m = COMPLEX_PATTERN.match(s)
if not m:
raise ValueError('Invalid complex literal: ' + s)
def safe_float(t):
t = str(float(0 if t is None else t))
if t in ('inf', '-inf', 'nan'):
t = "float('" + t + "')"
return t
real, imag = m.group(1), m.group(2)
return 'complex({0}, {1})'.format(safe_float(real), safe_float(imag))
>>> complexStr2str(str(complex(0.0, 0.0)))
'complex(0.0, 0.0)'
>>> complexStr2str(str(complex(-0.0, 0.0)))
'complex(-0.0, 0.0)'
>>> complexStr2str(str(complex(0.0, -0.0)))
'complex(0.0, -0.0)'
>>> complexStr2str(str(complex(-0.0, -0.0)))
'complex(-0.0, -0.0)'
>>> complexStr2str(str(complex(float('inf'), float('-inf'))))
"complex(float('inf'), float('-inf'))"
>>> complexStr2str(str(complex(float('nan'), float('nan'))))
"complex(float('nan'), float('nan'))"
>>> complexStr2str(str(complex(1e100, 1e-200)))
'complex(1e+100, 1e-200)'
>>> complexStr2str(str(complex(1e-100, 1e200)))
'complex(1e-100, 1e+200)'
>>> complexStr2str('100')
'complex(100.0, 0.0)'
>>> complexStr2str('100j')
'complex(0.0, 100.0)'
>>> complexStr2str('-0')
'complex(-0.0, 0.0)'
>>> complexStr2str('-0j')
'complex(0.0, -0.0)'
|