I'm writing an XML file with the following code:
Source source = new DOMSource(rootElement);
Result result = new StreamResult(xmlFile);
Transformer transformer = TransformerFactory.newInstance().newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.transform(source, result);
and this is the output file...
I need to make custom text field which will format numeric values according to local way of formatting. So I've made a clas:
public class NumberTextField extends JFormattedTextField
{...
constructor looks this like:
public NumberTextField()
{
formater=new NumberFormatter();
formater.setAllowsInvalid( false );
nf=Nu...
Im trying to make a html form processed in php that outputs to pdf and is print ready.
This is what I have:
A page requesting the categories to include
A page which presents text areas for that categories
A page which displays the final result with an option to print and or make a pdf.
I can make all the information pass along the p...
Hi,
I'm sure this is an easy one for you geeks:
Say I have a String "ThisIsMyString" and I want to format it like "this_is_my_string" using Ruby.
How do I do that?
Matt
...
I'm writing a web interface to MySQL that executes a couple queries and returns some XML data with the results of the queries. Right now, the table the query is running on has three LONGBLOB columns (for storing image data and the like).
However, when I try to parse the XML, I run into trouble with certain characters in the BLOB columns...
How can I display a newline in JLabel?
For example, if I wanted:
Hello World!
blahblahblah
This is what I have right now:
JLabel l = new JLabel("Hello World!\nblahblahblah", SwingConstants.CENTER);
This is what is displayed:
Hello World!blahblahblah
Forgive me if this is a dumb question, I'm just learning some Swing b...
There are various snippets on the web that would give you a function to return human readable size from bytes size:
>>> human_readable(2048)
'2 bytes'
>>>
But is there a Python library that provides this?
...
How do I achieve the following conversion from double to a string:
1.4324 => "1.43"
9.4000 => "9.4"
43.000 => "43"
ie I want to round to to decimal places but dont want any trailing zeros, ie i dont want
9.4 => "9.40" (wrong)
43.000 => "43.00" (wrong)
So this code which I have now doesn't work as it displays excess twos:
[NSString...
I have a problem sending plain text emails using PHPMailer.
I have text that I read from a text file and mail it to mail recipient via PHPMailer
When the recipient gets the actual email, the formatting of the mail is not like in the text file, everything is in one line, no new lines and tabs are included in the email that I send. Tex...
I occasionally want to change an NSView's dimensions programmaticaly. To do this, it is helpful to get the dimensions of various views, adjust them relative to each other, and then use setFrame: to reposition.
The problem is that the frame method usually returns NSRects that are clearly wrong, from my perspective.
I have a program wit...
I have a number in Javascript, that I know is less than 10000. I want to display it as a four-digit number, with leading zeroes. Is there anything more elegant than the following?
if(num<10) num="000"+num;
else if(num<100) num="00"+num;
else if(num<1000) num="0"+num;
I want something that is built into Javascript, but I can't seem t...
By default, the hour in a format string for a DateTime transforms 0 into 12.
For example, if you have
DateTime dt = new DateTime(1999, 1, 1, 0, 0, 0);
string s = dt.ToString("h:mm:ss");
the value of s will be "12:0:0", not "0:0:0". Is there a way to get "0:00:00" instead?
...
I have an NSString (phone number) with some parenthesis and hyphens as some phone numbers are formatted. How would I remove all characters except numbers from the string?
...
Hi,
I need to have a 1.5 line spacing within my document but without some parts like the TOC, title page etc.
When I use this command to set the line spacing to 1.5:
\renewcommand{\baselinestretch}{1.50}\normalsize
the documents line spacing is set to 1.5.
How can I exclude some parts of the document from that setting?
Thanks for ...
When declaring an associative array, how do you handle the indentation of the elements of the array? I've seen a number of different styles (PHP syntax, since that's what I've been in lately). This is a pretty picky and trivial thing, so move along if you're interested in more serious pursuits.
1) Indent elements one more level:
$arr...
Hello, I want to show a List using ICEFaces, and I want to output it like:
TAG1, TAG2, TAG3.
But without using , or <% for (...) { ... } %>, is there a way to do this?
Thanks!
...
How do I formate a java.sql Timestamp to my liking ? ( to a string, for display purposes)
...
What is difference between %d and %u when printing pointer addresses?
For example:
int a=5;
// check the memory address
printf("memory add=%d\n", &a); // prints "memory add=-12"
printf("memory add=%u\n", &a); // prints "memory add=65456"
Please define.
...
I'm using TextWriterTraceListener to log diagnostics messages to a text file. However I wan't also to log a timestamp of every trace message added. Is it possible to define a kind of formatter for the listener that would automatically add timestamps?
Currently I'm adding timestamps manually on every Trace.WriteLine() call but this isn't...
In my binary to text decoding application (.NET 2.0) I found that the line:
logEntryTime.ToString("dd.MM.yy HH:mm:ss:fff")
takes 33% of total processing time. Does anyone have any ideas on how to make it faster?
EDIT: This app is used to process some binary logs and it currently takes 15 hours to run. So 1/3 of this will be 5 hours. ...