How do you resize a JButton at runtime so it adapts to the text given by setSize? I've done some searching and this is the code I've come up with so far. Could this be turned into a utility method?
FontMetrics metrics = getFontMetrics( font );
int width = metrics.stringWidth( string );
P.S: No layout manager is being used.
...
Hi
Is there any simple way to center a text in textbox?? I was looking for some build in functions but I found nothing.
...
I have a large csv. I want to delete the first line of the file. How is this done? I don't want to copy every line into an array and rewrite them for the previous index and delete the first. There must be a better way.
thank you
...
From the Apple docs:
In iOS, you must apply a flip transform to the current graphics context in order for the text to be oriented as shown in Figure 17-1. A flip transform involves inverting the y-axis and translating the origin point to the bottom of the screen. Listing 17-2 shows you how to apply such transformations in the drawRect: ...
I'm creating an application overlay via Direct3D hooking, however I can't draw any text. I've started with this sample. The library itself seems to replace all D3D calls with own functions (and in the end it calls the original ones). I've tried all variations of DrawText without any result visible result. On the other hand, I can draw pr...
Hi,
I'm having a text scaled and moved via JavaScript / jQuery. I can't use jQuerys animate() because it has to fade in and out and has to be repeated and with more elements (end result: "flying" from the background, moving in different directions and fading out).
My problem: It's not running smoothly and causes quite the cpu-usage. He...
How do you programmatically add a new entry to the Hosts file in Mac?
For example on Windows, you just open up a StreamWriter and output to the Hosts file. How do you do this on a Mac?
...
Hi, I know I'v done stuff like this before, but I'm trying to find the most efficient way of doing this.
Basically, I want to store some addresses in a text file and then read specific portions of the file, based on group membership. I've done all of the group membership stuff so I don't need any help for that.
But I'm not sure if I ...
Hello all.
I have to set the label text of a load of differnet labels on a web page based upon user preferences.
I have the following code that is place upon the label load event (probably wrong!)
string memberid = Session["MemberID"].ToString();
string locationid = Session["LocationID"].ToString();
string user...
Given a tabbed delimited text file with two columns "name" and "date":
Sam 20100101
Sam 20100101
Sam 20100102
George 20100101
George 20100101
George 20100102
Can I use awk to add third column with a partitioned running total, such as starting a counter at 0 for each distinct pattern of column one and two then increment...
Why this does not work?
$stringhaha =" 1 => General,
2 => Business,
3 => Entertainment,
4 => Health,
5 => Politics,
6 => Sci/Tech,
7 => Sports,
8 => News";
$all_categories = array($stringhaha);
print_r($all_categories);
(will give an array with 1 item.)
While this works:
If I include ...
So, I want to bind self events after Text widget bind it and change text in widget. Usual 'bind' is called before the content in Text widget changes.
Sorry for my poor English
...
I have following confusions -
1. Which datatype is used for bigger amount of data store
2. When we specify varcha(100) so this 100 represent 100 characters or 100 bits or bytes
...
Hey there, I'm having difficulties with adopting the UIKeyInput Protocol with Core Text. I currently have most of it done as posted in the source code, however for some reason it glitches as it types, with incorrect font height for the first letter of each new line, which doesn't really make much sense since it's just drawing whatever is...
I am creating a PDF Context and changing it to a UIImage to swipe through quickly.
Currently some of the text is rendered strangely, seems to be all squashed together and ontop of each other line. The code I use is as follows:
- (UIImage*)loadImageFromBundle:(NSString*)URL {
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(...
Is there any fast (regex-based?) method to replace all smileys in a text, each by an unique corresponding identifier? For example, the first occurrence of :) should be replaced by smiley1, the :)) by smiley2 and another occurrence of :) by smiley1 again? Furthermore, the identifyier should be the same using different text for input
Any ...
Hi guys,
I was wondering if there was a way to display all text in a toast to be centered. For instance, I have a toast that has 2 lines of text in it. For purely aesthetic reasons, I would like the text to center-aligned instead of left-aligned. I've looked through the documentation and can't find anything about it. Is there a simple w...
Hi,
I have an xml that looks something like this
<para>
text text text
<b>text</b> text text <i>text</i>
</para>
the objective is to convert this to mediaWiki formatting with ''' for a bold font and so on.
when I write a transformation for this the template match ignores all the text inside the <para> tag and only the the <b>s ...
Hi everyone,
I would like to have a text in a text... I mean like in the newspaper: when there is a picture, the text fits and follow the border of the picture.
For example: http://en.wikipedia.org/wiki/Iphone
look at the pictures... the text follows them!
Is it possible to do that on the iPhone?
Thanks in advance
...
Hi,
I am using buffered reader to grab a line at a time from a text file. I am trying to also get the line number from the text file using a tracking integer. Unfortunately BufferedReader is skipping empty lines (ones with just /n or the carriage return).
Is there a better way to solve this? Would using scanner work?
Example code:
i...