Consider the following snippet:
>>> def foo(port, out, udp=False, ipv6=False, data=''):
... if not data:
... data = 'foo {family} {:port} {direction}'.format(
... family=('ipv6' if ipv6 else 'ipv4'),
... port=port,
... direction=('out' if...
Is there ready Emacs code/package to automatically set indent-tabs-mode according to the file being visited? That is, if the currently visited file uses tabs for indentation, indent-tabs-mode should be set buffer-locally to true. Correspondingly if spaces are used, indent-tabs-mode should be set to false. The purpose of this is to automa...
I wonder if there is an easy way to format Strings of dict-outputs such as this:
{
'planet' : {
'name' : 'Earth',
'has' : {
'plants' : 'yes',
'animals' : 'yes',
'cryptonite' : 'no'
}
}
}
..., where a simple str(dict) just would give you a quite unreadable ...
{'planet' : {'has': {'plants': 'yes', 'an...
Any script available for converting Wikitext to Plain text? I prefer it implemented in Java.
Thanks!
...
Hi, I'm using infragistic grid, and setting DisplayFormat of each column.
DisplayFormat is type of string, and uses it`s value to show value of cellValue.ToString(DisplayFormat), when showing values to user in a grid (as Infra docs saying)
In grid I have doubles, that have many numbers after point, and I don`t know how many.
And I need ...
Hi,
I want to hide/unhide a group of HTML Table rows using javascript. To do so, I define each such row, whose visibility is to be toggled, as follows:
When an appropriate event is fired, I toggle its state as follows:
document.getElementById('rowId1').style.display = 'none';//or 'block'
The above code works in both firefox and IE. B...
Greetings StackOverflow,
Is it possible to call a function without first fully defining it? When attempting, i get the error: "*function_name* is not defined". I am coming from a c++ background so this issue stumps me.
Declaring the function before works:
def Kerma():
return "energy / mass"
print Kerma()
However, atte...
The default eclipse formatter formats my java code really funny.
For example: hello.show().x().y() would be formatted oddly. .x() and .y() would be placed on a seperate line.
Are there any other basic formatters that can do a better job?
Examples and links welcome.
...
I'm modifying the Coldfusion-based interface for a listserv admin application to show snippits of recently-posted messages on a page. The messages are all stored in a SQL Server 2005 database on the listserv's mail server, and in theory it should be easy enough to query the recent ones and display them. However, the "message" column of t...
How to convert byte size into human-readable format in Java? Like 1024 should become "1 Kb" and 1024*1024 should become "1 Mb".
I am kind of sick of writing this utility method for each project. Are there any static methods in Apache Commons for this?
...
Hi All,
I'm using the DataContractSerializer to convert and object returned from a WCF call to xml. The client would like to see that xml string in a webpage. If I output the string directly to a label, the browser strips out the angle brackets obviously. My question is how can I do something similar to StackOverflow? Are they doing a ...
The FastFormat library works like this:
string example;
fastformat::fmt(example, "I am asking {0} question on {1}", 1, "stackoverflow");
It also claims "100% type-safety". I can understand how other libraries such as boost::format achieve that by overloading operator%, something I do fairly often with my code too.
But if I was able t...
For example, my docx file contains the following sentences:
This is a Perl example
This is a Python example
This is another Perl example
I want to apply bold style to all the occurrences of the word "Perl" like so:
This is a Perl example
This is a Python example
This is another Perl example
I've so far come up with the following scri...
Who could tell me why this formatting doesn't work in case of Ajax Binding?
.RowAction(row =>
{
if (row.DataItem.Probability == 100)
row.HtmlAttributes["style"] = "color:green;";
})
...
Hi i am trying to parse a string into a java.sql.date
Here is what i am doing
private static SimpleDateFormat sdfout = new SimpleDateFormat("yyyy.MM.dd.HH.mm");
try{
String date = "2010.09.30.13.18";
task.setDueDate(new java.sql.Date(sdfout.parse(date).getTime()));
}
The problem is that i only get th...
Say, I have a variable rv which has some numerical value. Now, I want to plot the value of this variable on a base plot but preceded by a nicely formatted symbol e.g., r subscript m, using expression. To write on the plot I use mtext.
However, what I get is either the value of the variable, but no nicely formatted symbol (left annotation...
Hi,
I've got a bunch of dates in this String format:
String date = "Wed Sep 15 16:31:05 BST 2010";
and I'd like to convert it back to a date or calendar object. Before I go and reinvent the wheel, are there any easy ways of doing this, preferably present in the JDK?
...
When you have line of code with a parenthetical statement, do you include a space before the parenthetical?
For example, should it be
if()
or
if ()
Thanks in advance!
...
I have an easy one for you guys. In my view I have a textbox, like so:
<%= Html.TextBoxFor(x => x.Price, new { @class = "text tiny" })%>
Price is a decimal. When the form loads up. the textbox displays "0". I would like it to display "0.00".
I tried <%= Html.TextBoxFor(x => String.Format("{0:0.00}", x.Price), new { @class = "text ...
How to start with creating a program to format C and their derived code into .net style formatted code so that if I input any program. This program can recognize and reformat by properly adding indentation and other things.
...