Search Results

Search found 35146 results on 1406 pages for 'normalize text'.

Page 42/1406 | < Previous Page | 38 39 40 41 42 43 44 45 46 47 48 49  | Next Page >

  • Sql serve Full Text Search with Containstable is very slow when Used in JOIN!

    - by Bob
    Hello, I am using sql 2008 full text search and I am having serious issues with performance depending on how I use Contains or ContainsTable. Here are sample: (table one has about 5000 records and there is a covered index on table1 which has all the fields in the where clause. I tried to simplify the statements so forgive me if there is syntax issues.) Scenario 1: select * from table1 as t1 where t1.field1=90 and t1.field2='something' and Exists(select top 1 * from containstable(table1,*, 'something') as t2 where t2.[key]=t1.id) results: 10 second (very slow) Scenario 2: select * from table1 as t1 join containstable(table1,*, 'something') as t2 on t2.[key] = t1.id where t1.field1=90 and t1.field2='something' results: 10 second (very slow) Scenario 3: Declare @tbl Table(id uniqueidentifier primary key) insert into @tbl select {key] from containstable(table1,*, 'something') select * from table1 as t1 where t1.field1=90 and t1.field2='something' and Exists(select id from @tbl as tbl where id=req1.id) results: fraction of a second (super fast) Bottom line, it seems if I use Containstable in any kind of join or where clause condition of a select statement that also has other conditions, the performance is really bad. In addition if you look at profiler, the number of reads from the database goes to the roof. But if I first do the full text search and put results in a table variable and use that variable everything goes super fast. The number of reads are also much lower. It seems in "bad" scenarios, somehow it gets stuck in a loop which causes it to read many times from teh database but of course I don't understant why. Now the question is first of all whyis that happening? and question two is that how scalable table variables are? what if it results to 10s of thousands of records? is it still going to be fast. Any ideas? Thanks

    Read the article

  • Image File In Text Editor - What Are The Characters? What's the Process?

    - by TheDarkIn1978
    i'm currently in the process of conceptualizing an art piece for a gallery show next year, so this bizarre question of mine is more than just simple curiosity. if i open up an image file (a .PNG) with Text Edit or Note Pad, the file is presented in textual characters. something like this except: æº"í=™?0Ù:Ã,ÏI8^?K¯pmDHƒÃ?;wÔlD DDF›ä™èÜE[E˜ƒê?¯ƒºäeèçã?'ów+æ1ï‡ê0òHõñ?ò$úîù¥{WÎn}2*Ÿ!y(Ö!%2e9U2µ i4Õ(?=ù(›7}:É?##„G¶VfcVñ[÷D6gvrˆvéZN›=Ù=ó{púp…p?Ók‹oÃvŒÛ»{ùœóüôøW†W–VH\P?P$VTPt^lQ‹_B_S=Q™\Z[Ü)s/{]Œ_û]~¯¿¯Awu˜ùä’JÖ Í*tï[’ÎáÔ=<Æ6?~ZCWSÛpVµ?±ØŒ?nÆ^¨æ??™¡?a¥ë£1µÒÁ#?Gè)G<^mRl™m?jˆj~€"“R–Úª’?u?çO-•m˜â?ìéväˆàˆOä5ùXùûù”]¬]?]›V›œ{X{Óˆ|Ô’Èm{J?4‰Èáæõ}??~Á?óºYáœåüuRFÆ>W|^3Ñ5‰94=,<ú?|1b=2< >ö:?sÃ`¨{úf<f|ÛÖ?ãÊ íâ–âè/_÷O¬}Â?Í›§Ãd’kÃkØ?sSíS? ??øy;-6]ˆ?÷ÌÌÙåËLÈ,l÷uvzNtÆt6Ô6?O ?P?_t_|°N¸]Ÿ{ƒ{è˜3KK> ?x~ò[ñ\ÆXA?x?Ãî?X? ?…°”¸™‘jÂzÕkm~]jObµ·p1°Y‚s?&b”}s?ãËóí-»ñ”÷‰?‡v?ˆ˜WõØ£??æe~;¸n?Ooáa'aÁÎÌ-ª$ª!ª~ ?¨‹CÏpÏO/Á›œ/?80<Ë<§8 can anyone explain what is happening here? are the characters some form translation of pixel data by the text editor? maybe it is completely meaningless / an error? if not, is there a name for this type of data conversion or process?

    Read the article

  • How to remove cursor from text field on click of button?

    - by Miraaj
    Hi all, I am trying to do a simple task: I have an editable text field, two buttons (titles: make editable/ make un-editable) over a window. Idea is: when user clicks "make editable" button, text field should become editable and when he/she clicks "make un-editable", it should become un-editable. In action of "make un-editable" I am doing this: [myTextField setSelectable:NO]; [myTextField setEditable:NO]; and in action of "make editable" I am doing this: [myTextField setSelectable:YES]; [myTextField setEditable:YES]; Problem is: It works fine when myTextField does not have cursor within it and user clicks - "make un-editable", ie. myTextField becomes un-editable but when it has cursor and user clicks "make un-editable" he/she can still edit myTextField. For its solution I tried to remove cursor from myTextField as soon as user clicks "make un-editable" button, by adding these lines before selectable and editable statements: [someOtherTextField selectText:self]; [[NSRunLoop currentRunLoop] performSelector:@selector(selectText:) someOtherTextField argument:self order:9999 modes:[NSArray arrayWithObject:NSDefaultRunLoopMode]]; [someOtherTextField becomeFirstResponder]; but none is working for me :( Can anyone suggest some solution for it? Thanks, Miraaj

    Read the article

  • Fast, Unicode-capable, cross-platform programmer's text editor that shows invisibles like ZWSP?

    - by Roger_S
    Our publishing workflow includes Windows and Linux machines (there are some Macs too, but not in the critical-path workflow). Many texts include both English and Khmer and are marked-up in XML. XML Copy Editor is the best cross-platform open-source XML editor I've discovered. It utilizes the Scintilla editing component, which is generally good with Unicode but which does not enable non-printing or invisible characters like U+200B (zero-width space) and U+200C (zero-width non-joiner) to be displayed. Khmer does not separate words with a space character as Western languages do, so ZWSP is used in electronic texts to enable applications to break lines easily. Ideally I'd edit the markup and the content in a single editor, but XML awareness is less important at times than being able to display invisibles. (OpenOffice.org Writer and Microsoft Word are the only two apps I know that will display ZWSP. They are not suitable for the markup and text manipulations that need to be done to prepare manuscripts for publication, unfortunately, although I guess they're fine for authoring.) I tried out a promising editor last week, but a search-and-replace regex operation that took under a second in TextPad 4.7.3 lasted over twenty seconds. So I want to mention that speed and the ability to handle large (up to 150mb) files is also a concern. Is there a good, fast, free or not too expensive text editor, with versions on Windows and Linux and maybe mac too, Unicode-aware and capable of displaying invisibles like ZWSP? That has syntax highlighting, can handle large files and is customizable enough that I won't tear my hair out in frustration? Thanks, Roger_S

    Read the article

  • How to write to a text file in pipe delimited format from SQL Server / ASP.Net?

    - by NJTechGuy
    I have a text file which needs to be constantly updated (regular intervals). All I want is the syntax and possibly some code that outputs data from a SQL Server database using ASP.Net. The code I have so far is : <%@ Import Namespace="System.IO" %> <script language="vb" runat="server"> sub Page_Load(sender as Object, e as EventArgs) Dim FILENAME as String = Server.MapPath("Output.txt") Dim objStreamWriter as StreamWriter ' If Len(Dir$(FILENAME)) > 0 Then Kill(FILENAME) objStreamWriter = File.AppendText(FILENAME) objStreamWriter.WriteLine("A user viewed this demo at: " & DateTime.Now.ToString()) objStreamWriter.Close() Dim objStreamReader as StreamReader objStreamReader = File.OpenText(FILENAME) Dim contents as String = objStreamReader.ReadToEnd() lblNicerOutput.Text = contents.Replace(vbCrLf, "<br>") objStreamReader.Close() end sub </script> <asp:label runat="server" id="lblNicerOutput" Font-Name="Verdana" /> With PHP, it is a breeze, but with .Net I have no clue. If you could help me with the database connectivity and how to write the data in pipe delimited format to an Output.txt file, that had be awesome. Thanks guys!

    Read the article

  • How to write to a Text File in Pipe delimited format from MS Sql Server / ASP.Net?

    - by NJTechGuy
    I have a text file which needs to be constantly updated (regular intervals). All I want is the syntax and possibly some code that outputs data from a MS Sql Database using ASP.Net. The code I have so far is : <%@ Import Namespace="System.IO" %> <script language="vb" runat="server"> sub Page_Load(sender as Object, e as EventArgs) Dim FILENAME as String = Server.MapPath("Output.txt") Dim objStreamWriter as StreamWriter ' If Len(Dir$(FILENAME)) > 0 Then Kill(FILENAME) objStreamWriter = File.AppendText(FILENAME) objStreamWriter.WriteLine("A user viewed this demo at: " & DateTime.Now.ToString()) objStreamWriter.Close() Dim objStreamReader as StreamReader objStreamReader = File.OpenText(FILENAME) Dim contents as String = objStreamReader.ReadToEnd() lblNicerOutput.Text = contents.Replace(vbCrLf, "<br>") objStreamReader.Close() end sub </script> <asp:label runat="server" id="lblNicerOutput" Font-Name="Verdana" /> With PHP, it is a breeze, but with .Net I have no clue. If you could help me with the database connectivity and how to write the data in pipe delimited format to an Output.txt file, that had be awesome. Thanks guys!

    Read the article

  • [PHP, CSS, & ?] fixed width div, resizing text on the fly based on length

    - by Andrew Heath
    Let's say you've got a simple fixed-width layout that pulls a title from a MySQL database. CSS: #wrapper { width: 800px; } h1 { width: 100%; } HTML: <html> <body> <div id="wrapper"> <h1> $titleString </h1> </div> </body> </html> But the catch is, the length of the title string pulled from your MySQL database varies wildly. Sometimes it might be 10 characters, sometimes it might be 80. It's possible to establish a min & max character count. How, if at all possible, do I get the text-size of my <h1>$titleString</h1> to enlarge/decrease on-the-fly such that the string is only ever on one line and best fit to that line length? I've seen a lot of questions about resizing the div - but in my case the div must always be 100% (800px) and I want to best-fit the title. Obviously a maximum text-size value would have to be set so 5 character strings don't become gargantuan. Does anyone have a suggestion? I'm only using PHP/MySQL/CSS on this page at the moment, but incorporation of another language is fine if it means I can solve the problem. The only thing I can think of is a bruteforce approach whereby through trial and error I establish acceptable string character count ranges matched with CSS em sizes, but that'd be a pretty ugly implementation from the code side.

    Read the article

  • Android text layout question: two textviews, side-by-side, with different layout alignments and weights

    - by thx1200
    I'm still a bit of an Android noob, forgive me if this is simple and I'm just not seeing it. There are two portions of text in a view that spans the entire width horizontally, but is only as high as one line of text. The left side must always be displayed in full, but should take no more horizontal space than it needs. The right side should be pushed over by the left side and fill up the remainder of the screen width. If the right side text is smaller than this width, the text should be right-aligned horizontally. If the text is greater than the width, it should scroll horizontally. The text on the right side will be updated frequently and should slide up with new text when the app tells it (explaining the TextSwitcher in the layout). I have tried two different layout styles. In both situations, I can get the left side to "push" the layout, the right side to scroll, but I can't figure out how to get the right side to right align. It is always left aligned. Here is a picture showing what is happening... http://img10.imageshack.us/img10/5599/androidlayout.png In addition (but less important), in my layout code I have android:fadingEdge="none" on the TextViews, but it still has a faded edge on the left and right side when it scrolls. Why is that? Here are the two layouts I created, which yield the results shown, but not the results I want. Using a horizontal LinearLayout... <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/LinearLayoutStatusBar" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_margin="2px" android:background="#555555" > <TextView android:id="@+id/TextViewTimer" android:textSize="18px" android:textColor="#FFFFFF" android:layout_gravity="left" android:layout_weight="0" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="0px" android:layout_marginRight="3px" android:text="Left Side" > </TextView> <TextSwitcher android:id="@+id/TextSwitcherDetails" android:inAnimation="@anim/push_up_in" android:outAnimation="@anim/push_up_out" android:layout_weight="1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="right" android:layout_marginLeft="3px" android:layout_marginRight="0px" > <TextView android:id="@+id/TextViewDetails1" android:textSize="18px" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="right" android:singleLine="true" android:ellipsize="marquee" android:marqueeRepeatLimit="marquee_forever" android:scrollHorizontally="true" android:focusable="true" android:focusableInTouchMode="true" android:fadingEdge="none" android:text="Right Side 1" > </TextView> <TextView android:id="@+id/TextViewDetails2" android:textSize="18px" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="right" android:singleLine="true" android:ellipsize="marquee" android:marqueeRepeatLimit="marquee_forever" android:scrollHorizontally="true" android:focusable="true" android:focusableInTouchMode="true" android:fadingEdge="none" android:text="Right Side 2 - This is a really long text this is long and fun and fun and long" > </TextView> </TextSwitcher> </LinearLayout> And the RelativeLayout style... <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/LinearLayoutStatusBar" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_margin="2px" android:background="#555555" > <TextView android:id="@+id/TextViewTimer" android:textSize="18px" android:textColor="#FFFFFF" android:layout_gravity="left" android:layout_weight="0" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="0px" android:layout_marginRight="3px" android:layout_alignParentLeft="true" android:text="Left Side" > </TextView> <TextSwitcher android:id="@+id/TextSwitcherDetails" android:inAnimation="@anim/push_up_in" android:outAnimation="@anim/push_up_out" android:layout_weight="1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="3px" android:layout_marginRight="0px" android:layout_toRightOf="@+id/TextViewTimer" android:layout_alignParentRight="true" android:fadingEdge="none" android:fadingEdgeLength="0px" > <TextView android:id="@+id/TextViewDetails1" android:textSize="18px" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="right" android:singleLine="true" android:ellipsize="marquee" android:marqueeRepeatLimit="marquee_forever" android:scrollHorizontally="true" android:focusable="true" android:focusableInTouchMode="true" android:fadingEdge="none" android:fadingEdgeLength="0px" android:text="Right Side 1" > </TextView> <TextView android:id="@+id/TextViewDetails2" android:textSize="18px" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="right" android:singleLine="true" android:ellipsize="marquee" android:marqueeRepeatLimit="marquee_forever" android:scrollHorizontally="true" android:focusable="true" android:focusableInTouchMode="true" android:fadingEdge="none" android:fadingEdgeLength="0px" android:text="Right Side 2 - This is a really long text this is long and fun and fun and long" > </TextView> </TextSwitcher> </RelativeLayout> So how do I get that text on the right side to right-align. Thanks!

    Read the article

  • How to add Editext and Button to Efficent Adapter which has a Icon and text

    - by jayanthgande
    Hi, I want to create a layout in such a way that on top edittext and button should be there in one row. The search text I enter in editext and click on search button. Then I want to display a custom list view where each row contains image and text.(As per the API demos example list14 I have tried). But when I run the application, button and edittext are being added to each row (i.e., Each row contains a image, text, editext, button. Can Any one guide how to resolve this issue. Below is my xml file: <!-- <FrameLayout android:layout_width="wrap_content" android:layout_height="0dip" android:layout_weight="1"></FrameLayout> --> <ImageView android:id="@+id/icon" android:layout_width="48dip" android:layout_height="48dip" /> <TextView android:id="@+id/text" android:layout_gravity="center_vertical" android:layout_width="0dip" android:layout_weight="1.0" android:layout_height="wrap_content" /> <!-- <EditText android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/prdsearchtb" android:text="@string/tb_prd_search_lbl"></EditText> --> <!-- <TableLayout android:id="@+id/TableLayout01" android:layout_width="fill_parent" android:layout_height="wrap_content"> <TableRow> --> <Button android:id="@+id/prdsrcbutton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/btn_lbl_prd_search" android:layout_x="2px" android:layout_y="410px"></Button> <!-- </TableRow> </TableLayout> -- and Java File: /** * */ package org.techdata.activity; import android.app.AlertDialog; import android.app.ListActivity; import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; /** * @author jayanthg * */ public class ProductSearch extends ListActivity { private static class ProductSearchAdapter extends BaseAdapter { private LayoutInflater mInflater; private Bitmap mIcon1; private Bitmap mIcon2; public ProductSearchAdapter(Context context) { mInflater = LayoutInflater.from(context); // Icons bound to the rows. mIcon1 = BitmapFactory.decodeResource(context.getResources(), R.drawable.icon48x48_1); mIcon2 = BitmapFactory.decodeResource(context.getResources(), R.drawable.icon48x48_2); } @Override public int getCount() { return DATA.length; } @Override public Object getItem(int position) { return position; } @Override public long getItemId(int position) { return position; } @Override public View getView(final int position, View convertView, ViewGroup parent) { ViewHolder holder; Button btn=null; if (convertView == null) { convertView = mInflater.inflate(R.layout.productsearch, null); // Creates a ViewHolder and store references to the two children // views // we want to bind data to. holder = new ViewHolder(); holder.text = (TextView) convertView.findViewById(R.id.text); holder.icon = (ImageView) convertView.findViewById(R.id.icon); btn=(Button)convertView.findViewById(R.id.prdsrcbutton); convertView.setTag(holder); } else { // Get the ViewHolder back to get fast access to the TextView // and the ImageView. holder = (ViewHolder) convertView.getTag(); } // Bind the data efficiently with the holder. holder.text.setText(DATA[position]); holder.icon.setImageBitmap((position & 1) == 1 ? mIcon1 : mIcon2); holder.icon.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log.i("image", " u clicked on icon Position" + position); } }); holder.text.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log.i("Text", " u clicked on text Position" + position); } }); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log.i("Button","U clicked on button"); } }); return convertView; } static class ViewHolder { TextView text; ImageView icon; } private static final String[] DATA = { "Abbaye de Belloc", "Abbaye du Mont des Cats" }; } ListView product_search_list; Button srch_btn; EditText srch_text; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setListAdapter(new ProductSearchAdapter(this)); // setContentView(R.layout.productsearch); // getListView().setEmptyView(findViewById(R.id.text)); // srch_text = (EditText)findViewById(R.id.prdsearchtb); // srch_btn = (Button) findViewById(R.id.prdsearchtb); // srch_btn.setOnClickListener(new View.OnClickListener() { // // @Override // public void onClick(View v) { // callProductSearchAdapter(); // // } // }); } void callProductSearchAdapter() { setListAdapter(new ProductSearchAdapter(this)); } private void createDialog(String title, String text, final Intent i) { if (i == null) { AlertDialog ad = new AlertDialog.Builder(this).setIcon( R.drawable.alert_dialog_icon).setPositiveButton("Ok", null) .setTitle(title).setMessage(text).create(); ad.show(); } } } Regards: Jayanth

    Read the article

  • Stop UITextView from jumping when programatically setting text

    - by Michael Waterfall
    Hi there, I have to update a small amount of text in a scrolling UITextView. I'll only be inserting a character where the cursor currently is, and I'll be doing this on a press of a button on my navigation bar. My problem is that whenever I call the setText method of the text view, it jumps to the bottom of the text. I've tried using contentOffset and resetting the selectedRange but it doesn't work! Here's my example: // Remember offset and selection CGPoint contentOffset = [entryTextView contentOffset]; NSRange selectedRange = [entryTextView selectedRange]; // Update text entryTextView.text = entryTextView.text; // Try and reset offset and selection [entryTextView setContentOffset:contentOffset animated:NO]; [entryTextView setSelectedRange: selectedRange]; Is there any way you can update the text without any scroll movement at all... as if they'd just typed something on the keyboard? Many thanks, Michael Edit: I've tried using the textViewDidChange: delegate method but it's still not scrolling up to the original location. - (void)textViewDidChange:(UITextView *)textView { if (self.programChanged) { [textView setSelectedRange:self.selectedRange]; [textView setContentOffset:self.contentOffset animated:NO]; self.programChanged = NO; } } - (void)changeButtonPressed:(id)sender { // Remember position self.programChanged = YES; self.contentOffset = [entryTextView contentOffset]; self.selectedRange = [entryTextView selectedRange]; // Update text entryTextView.text = entryTextView.text; }

    Read the article

  • Word VBA - Find text between delimiters and convert to lower case

    - by jJack
    I would like to find text which is between the < and characters, and then turn any found text into "normal" case, where first letter of word is capitalized. Here is what I have thus far: Function findTextBetweenCarots() As String Dim strText As String With Selection .Find.Text = "<" ' what about <[^0-9]+> ? .Find.Forward = True .Find.Wrap = wdFindContinue End With Selection.Find.Execute ' Application.Selection. ' how do I get the text between the other ">"? findCarotSymb = Application.Selection.Text End Function Or, is there a better way of doing this? I also approached the problem using the VBScript Regex 5.5 library, which worked on simple documents, but not on certain documents with complex tables. For example, trying to just bold the text (for simplicity): Sub BoldUpperCaseWords() Dim regEx, Match, Matches Dim rngRange As Range Set regEx = New RegExp regEx.Pattern = "<[^0-9]+>" regEx.IgnoreCase = False regEx.Global = True Set Matches = regEx.Execute(ActiveDocument.Range.Text) For Each Match In Matches ActiveDocument.Range(Match.FirstIndex, Match.FirstIndex + Len(Match.Value)).Bold = True Next End Sub would not work in a document with tables. In fact, it would not even bold the correct text (the text between the <. This leads me to believe I have a broader issue here that I am missing. Here is what a sample doc looks like. Notice the wrong text is bold:

    Read the article

  • Text message intent - catch and send

    - by Espen
    Hi! I want to be able to control incoming text messages. My application is still on a "proof of concept" version and I'm trying to learn Android programming as I go. First my application need to catch incomming text messages. And if the message is from a known number then deal with it. If not, then send the message as nothing has happened to the default text message application. I have no doubt it can be done, but I still have some concern and I see some pitfalls at how things are done on Android. So getting the incomming text message could be fairly easy - except when there are other messaging applications installed and maybe the user wants to have normal text messages to pop up on one of them - and it will, after my application has had a look at it first. How to be sure my application get first pick of incomming text messages? And after that I need to send most text messages through to any other text message application the user has chosen so the user can actually read the message my application didn't need. Since Android uses intents that are relative at best, I don't see how I can enforce my application to get a peek at all incomming text messages, and then stop it or send it through to the default text messaging application...

    Read the article

  • How to extract the word and line wrapping information from JTextArea for text with given font

    - by Gábor Lipták
    I have to convert styled text to wrapped simple text (for SVG word wrapping). I cannot beleive that the word wrapping information (how many lines are there, where are the line breaks) cannot be extracted from the JTextArea. So I created a small frame program: package bla; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Font; import java.awt.Frame; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.util.ArrayList; import java.util.List; import javax.swing.JTextArea; public class Example1 extends WindowAdapter { private static String content = "01234567890123456789\n" + "0123456 0123456 01234567 01234567"; JTextArea text; public Example1() { Frame f = new Frame("TextArea Example"); f.setLayout(new BorderLayout()); Font font = new Font("Serif", Font.ITALIC, 20); text = new JTextArea(); text.setFont(font); text.setForeground(Color.blue); text.setLineWrap(true); text.setWrapStyleWord(true); f.add(text, BorderLayout.CENTER); text.setText(content); // Listen for the user to click the frame's close box f.addWindowListener(this); f.setSize(100, 511); f.show(); } public static List<String> getLines( JTextArea text ) { //WHAT SHOULD I WRITE HERE return new ArrayList<String>(); } public void windowClosing(WindowEvent evt) { List<String> lines = getLines(text); System.out.println( "Number of lines:" + lines.size()); for (String line : lines) { System.out.println( line ); } System.exit(0); } public static void main(String[] args) { Example1 instance = new Example1(); } } If you run it you will see this: And what I expect as output: Number of lines:6 0123456789 0123456789 0123456 0123456 01234567 01234567 What should I write in place of the comment?

    Read the article

  • best way to add and delete text lines with jquery product configurator

    - by Daniel White
    I am creating a product configurator with Jquery. My users can add custom text lines to their product. So you could create say... 4 text lines with custom text. I need to know what the best way to add and delete these lines would be. Currently I have the following code for adding lines... //Add Text Button $('a#addText').live('click', function(event) { event.preventDefault(); //Scroll up the text editor $('.textOptions').slideUp(); $('#customText').val(''); //count how many items are in the ul textList var textItems = $('ul#textList li').size(); var nextNumber = textItems + 1; if(textItems <= 5) { //Change input to reflect current text being changed $('input#currentTextNumber').val(nextNumber); //Append a UL Item to the textList $('ul#textList').append('<li id="textItem'+nextNumber+'">Text Line. +$5.00 <a class="deleteTextItem" href="'+nextNumber+'">Delete</a></li>'); //Scroll down the text editor $('.textOptions').slideDown(); }else { alert('you can have a maximum of 6 textual inputs!'); } }); I'm probably not doing this the best way, but basically i have an empty UL list to start with. So when they click "Add Text Line" it finds out how many list elements are in the unordered list, adds a value of 1 to that and places a new list element with the id TextItem1 or TextItem2 or whatever number we're on. The problem i'm running into is that when you click delete item, it screws everything up because when you add an item again all the numbers aren't correct. I thought about writing some kind of logic that says all the numbers above the one you want deleted get 1 subtracted from their value and all the numbers below stay the same. But I think i'm just going about this the wrong way. Any suggestions on the easiest way to add and delete these text lines is appreciated.

    Read the article

  • Which text margin does SWT Table use when drawing text?

    - by Zordid
    I got a relatively easy question - but I cannot find anything anywhere to answer it. I use a simple SWT table widget in my application that displays only text in the cells. I got an incremental search feature and want to highlight text snippets in all cells if they match. So when typing "a", all "a"s should be highlighted. To get this, I add an SWT.EraseItem listener to interfere with the background drawing. If the current cell's text contains the search string, I find the positions and calculate relative x-coordinates within the text using event.gc.stringExtent - easy. With that I just draw rectangles "behind" the occurrences. Now, there's a flaw in this. The table does not draw the text without a margin, so my x coordinate does not really match - it is slightly off by a few pixels! But how many?? Where do I retrieve the cell's text margins that table's own drawing will use? No clue. Cannot find anything. :-( Bonus question: the table's draw method also shortens text and adds "..." if it does not fit into the cell. Hmm. My occurrence finder takes the TableItem's text and thus also tries to mark occurrences that are actually not visible because they are consumed by the "...". How do I get the shortened text and not the "real" text within the EraseItem draw handler? Thanks!

    Read the article

  • How to catch an incomming text message

    - by Espen
    Hi! I want to be able to control incoming text messages. My application is still on a "proof of concept" version and I'm trying to learn Android programming as I go. First my application need to catch incomming text messages. And if the message is from a known number then deal with it. If not, then send the message as nothing has happened to the default text message application. I have no doubt it can be done, but I still have some concern and I see some pitfalls at how things are done on Android. So getting the incomming text message could be fairly easy - except when there are other messaging applications installed and maybe the user wants to have normal text messages to pop up on one of them - and it will, after my application has had a look at it first. How to be sure my application get first pick of incomming text messages? And after that I need to send most text messages through to any other text message application the user has chosen so the user can actually read the message my application didn't need. Since Android uses intents that are relative at best, I don't see how I can enforce my application to get a peek at all incomming text messages, and then stop it or send it through to the default text messaging application...

    Read the article

  • Auto save changed text in richtextbox to database

    - by user2519407
    I have created one simple note taking application in jquery & php. Current functionality is like when user clicks save button it sends a ajax request with complete data to update it in db(mysql). All works well. But now I want to auto save only changed text while user typing. I don't want to send entire text to server again and again in text change event. It should send only text which has changed. For Ex: This is saved text. When user continues typing. This is saved text. Unsaved text.. It should be able to send only "Unsaved text.." to server to update in db. How can i implement this in jquery & server side script.? Any Idea..?

    Read the article

  • Cut a file based on a text marker

    - by Mustafa
    I have a text file that has the following layout: text text .. CUT HERE text text .. The literal CUT HERE appears only once. What I want to do using shell scripting, is to produce another file containing all the text below CUT HERE, i.e. ignore whatever above CUT HERE. Thanks.

    Read the article

  • Highlight search text in textarea

    - by Muneeswaran Balasubramanian
    Hi to all, I have to highlight the search terms in the text area. I have one text Filed,search Button and text area. Quote ... After i have enter the search string in the text field whenever i click the search button it highlight the search terms which is available in the text area and focus the search term in text area. I have try to do this by using jquery. But in mozilla,I can't get the focus to the search term at the time of search. I have to scroll down the text area for find the focused search term. In I.E. also it doesn't work properly. Otherwise if any post related to highlight search term in text area is also appreciable. Please guide me to achieve this.

    Read the article

  • jQuery text attribute selector

    - by Shagglez
    I am trying to use the text attribute as a selector, but I can't quite grasp the behaviour, would really appreciate if someone could explain. For example given <span class="span_class"><a class="a_class">text</a></span>, $('a.a_class').text() gives "text" as expected. However $('a.a_class[text]') wouldn't match any elements, and neither would $('span.span_class > a.a_class[text]'), but $('span.span_class* > a.a_class[text]') would (although not in IE). The only workaround I can think of for IE, is loop through all anchors contained in a span, use .text() on each and match it against a certain criteria, but it seems slower than using in-built selectors. Anyone have better ideas?

    Read the article

  • HTML Aligning Text

    - by nevillejones
    I want to display text on a page like in the following way: My Text: Text Here My Text: More Text Here......................................................... Text from line above continued here. I have the following markup just to test: <html> <head> <style type="text/css"> body { font-family: arial; } form div { padding: 3px; } form .label { float: left; text-align: right; width: 150px; margin-right: 8px; } </style> </head> <body> <form> <div class="label">My Text:</div> <div>Aenean tellus diam, pharetra sed posuere sed, ullamcorper eget enim. Suspendisse quis posuere nisi. Integer sodales neque id erat luctus suscipit. Curabitur in nisi arcu. Curabitur suscipit tellus non lectus blandit non mollis risus aliquet. Proin et felis nulla. Integer ut felis nibh, eu condimentum elit. Sed tincidunt fermentum lorem, convallis ornare ipsum mattis sed. Vestibulum vel quam sed velit condimentum volutpat eu sed enim. Duis tincidunt, turpis id suscipit molestie, erat tortor tincidunt augue, eu venenatis erat neque nec nisi. Nunc malesuada bibendum elit eu bibendum.</div> <div class="label">My Text 2:</div> <div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla suscipit arcu ut risus dapibus tincidunt et ut orci. Vestibulum vitae urna in ligula fringilla facilisis aliquet vel nisl. Quisque placerat risus eget arcu fermentum at consectetur arcu lobortis. In hac habitasse platea dictumst. In in libero non justo pellentesque cursus quis non nisi. Donec sit amet pharetra ipsum. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nulla enim enim, fringilla vitae sodales id, ultrices non lacus. Etiam id augue ut dui convallis hendrerit. Vivamus urna justo, dignissim in suscipit eu, facilisis a libero. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. .</div> </form> </body> When this is rendered about half the text is displayed underneath the corresponding "label" class div. I would like all the text to be appear to the right of the "label" div.

    Read the article

  • Find all html characters in drop-down option text and replace them via jQuery

    - by Jon Harding
    I have a dropdown menu that pulls in text from a database column. The database column can include HTML mark-up. In the drop-down I obviously don't need that in the text. I am working on some jquery and it partially accomplished what I'm looking for. However, it seems to only be replacing the first instance of each character $('select option').each(function() { this.text = this.text.replace('&nbsp;', ' '); this.text = this.text.replace('<div>', '' ); this.text = this.text.replace('</div>', '' ); }); Here is the HTML for the drop-down: <select name="ctl00$SubPageBody$ClassList" id="ctl00_SubPageBody_ClassList"> <option value="196">Four Week Series: July 19, 2012, 11:00am-12:00pm&<div>July 26, 2012, 11:00am-12:00pm&nbsp;</div><div>August 2, 2012, 11:00am-12:00pm</div><div>August 9, 2012, 11:00am-12:00pm</div></option> </select>

    Read the article

< Previous Page | 38 39 40 41 42 43 44 45 46 47 48 49  | Next Page >