Search Results

Search found 34830 results on 1394 pages for 'text'.

Page 153/1394 | < Previous Page | 149 150 151 152 153 154 155 156 157 158 159 160  | Next Page >

  • Getting dialogue snippets from text using regular expressions

    - by sheldon
    I'm trying to extract snippets of dialogue from a book text. For example, if I have the string "What's the matter with the flag?" inquired Captain MacWhirr. "Seems all right to me." Then I want to extract "What's the matter with the flag?" and "Seem's all right to me.". I found a regular expression to use here, which is "[^"\\]*(\\.[^"\\]*)*". This works great in Eclipse when I'm doing a Ctrl+F find regex on my book .txt file, but when I run the following code: String regex = "\"[^\"\\\\]*(\\\\.[^\"\\\\]*)*\""; String bookText = "\"What's the matter with the flag?\" inquired Captain MacWhirr. \"Seems all right to me.\""; Pattern p = Pattern.compile(regex); Matcher m = p.matcher(bookText); if(m.find()) System.out.println(m.group(1)); The only thing that prints is null. So am I not converting the regex into a Java string properly? Do I need to take into account the fact that Java Strings have a \" for the double quotes?

    Read the article

  • Smart way to execute function in flash from an imported html (or XML) plain text

    - by DomingoSL
    Ok, here is the think. I have a very simple flash program code in AS3, inside this program there is a dynamic textfield html capable. Also i have a database were i will put some information. Each element in the database can be linked to other. For example, this database will contain tourist spots, and they can be related with others in the same database. Ramdom place 1 This interesting spot is near <link to="ramdo2">ramdom place2</link>. And so, so so... The information in the database is retrived by the flash application and it shows the text on the dynamic textfield. I need somehow to tell my flash application that have to be a link to other part of the database, so when the user click the link a function in flash call this new data. The database is a simple Mysql server, and the data is not yet in there, waiting for your suggestions of how to format it and develop the solution. Im a php developer too, so i can make a gateway in PHP to read the MySQL and then retrive some format to flash, an XML for example.

    Read the article

  • Failed to create a 'System.Windows.RoutedEventHandler' from the text 'Button_Click'

    - by ay89
    In my windows phone 8 application, while trying to create a dependency property I am always getting this exception. what I am doing wrong, plz guide me. {System.Windows.Markup.XamlParseException: Failed to create a 'System.Windows.RoutedEventHandler' from the text 'Button_Click'. [Line: 108 Position: 66] at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator) at com.sap.View.HomePage.InitializeComponent() at com.sap.View.HomePage..ctor()} this is code-behind of Header public static readonly DependencyProperty MenuClickProperty = DependencyProperty.Register("MenuClick", typeof(RoutedEventHandler), typeof(Header), new PropertyMetadata(OnMenuClickHandlerChanged)); public RoutedEventHandler MenuClick { get { return (RoutedEventHandler)GetValue(MenuClickProperty); } set { SetValue(MenuClickProperty, new RoutedEventHandler(value)); } } private static void OnMenuClickHandlerChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { Header header = d as Header; header.OnMenuClickHandlerPropertyChanged(e); } private void OnMenuClickHandlerPropertyChanged(DependencyPropertyChangedEventArgs e) { MenuButton.Click += MenuClick; } this is in my user control (Header) <Button Click="{Binding Path=MenuClick, Source={RelativeSource Mode=Self}}" /> this is how i am including control on my Page: <myControls:Header Title="{Binding Title}" MenuClick="Button_Click" /> this is in code-behind: public void Button_Click(object sender, RoutedEventArgs e) { OpenSettings(); }

    Read the article

  • append text to lines in a CSV file

    - by MichaelMcCabe
    This question seems to have been asked a million times around the web, but I cannot find an answer which will work for me. Basically, I have a CSV file which has a number of columns (say two). The program goes through each row in the CSV file, taking the first column value, then asks the user for the value to be placed in the second column. This is done on a handheld running Windows 6. I am developing using C#. It seems a simple thing to do. But I cant seem to add text to a line. I cant use OleDb, as System.Data.Oledb isnt in the .Net version I am using. I could use another CSV file, and when they complete each line, it writes it to another CSV file. But the problems with that are - The file thats produced at the end needs to contain EVERY line (so what if they pull the batterys out half way). And what if they go back, to continue doing this another time, how will the program know where to start back from.

    Read the article

  • XSLT: change node inner text.

    - by nabo
    I need to transform the following xml doc: <a> <b/> <c/> myText </a> into this: <a> <b/> <c/> differentText </a> So, i wrote this XSLT document <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml" version="1.0" omit-xml-declaration="no" /> <xsl:template match="/a/text()"> <a> <b/> <c/> differentText </a> </xsl:template> </xsl:stylesheet> This way, i get the following result: <?xml version="1.0" encoding="utf-8"?> <a> <b /><c /> differentText </a> <a> <b /><c /> differentText </a> <a> <b /><c /> differentText </a> The result appears repeated 3 times because 3 matches are being done.. Why? I could i fix it? Thanks

    Read the article

  • Mono Text Based Web Browser

    - by powerbox
    Hi guys, is there any public text based web browser implementation for C# or on mono base api that I can use to fill up web forms automatically? I'll be using it to automate some web task that does not require any image authentication. I'm currently using a web browser control available on .Net Framework and waits for the event WebBrowserDocumentCompletedEventHandler to fire after a page is successfully loaded and invoke some actions like Submit or simulating a mouse click on some links. It actually does the job but I can't process bulk transactions since I needed to wait for the whole page to be loaded together with the images and other stuff. It is easy to use HttpWebRequest to fill up some forms , provide some data and then submit. But on some occasions I only need to simulate a mouse click to a certain link which I don't know how to do with HttpWebRequest. By the way using HttpWebRequest will still download all the images of a web page that I see pointless since I only need to provide correct data back to the server. I hope someone can pinpoint me the correct way of doing this kind of automation and thanks in advance!

    Read the article

  • Changing colour of text in a textblock via a trigger

    - by Sike12
    Here is my Xaml <Window.Resources> <sampleData:MainWindow x:Key="DataSource"/> <DataTemplate x:Key="bobReferencer"> <TextBlock Text="{Binding Name}" > <TextBlock.Style> <Style TargetType="TextBlock"> <Style.Triggers> <DataTrigger Binding="{Binding HasErrors}" Value="true"> //what goes in here? </DataTrigger> </Style.Triggers> </Style> </TextBlock.Style> </TextBlock> </DataTemplate> </Window.Resources> Codebehind (the one xaml references) public class bob { public string Name { get; set; } public bool HasErrors { get; set; } Basically what i want to do is if the HasErrors is true then i want the Name to appear in Red via the trigger. But my xaml is not properly formed. Any suggestions on this? I also looked into this link but didn't help much. How can I change the Foreground color of a TextBlock with a Trigger?

    Read the article

  • ListView exception for Images + Text

    - by drozzy
    I am trying to create a simple Icon+Text ListView but it does not work. I am using 2.1 Android SDK. My main class is very small slightly modified from the tutorial: public class Stuffs extends ListActivity { static final String[] COUNTRIES = new String[] {"A", "B","C"}; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, R.id.title, COUNTRIES)); } } and my list_item.xml file is this: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation = "horizontal"> <ImageView android:id = "@+id/icon" android:src="@drawable/icon" /> <TextView android:id = "@+id/title" android:padding="10dp" android:textSize="16sp" > </TextView> </LinearLayout> I have also created a "drawable" directory in my res directory and copied a "icon.png" into it. But any time I try to run this the application hangs up unexpected in my android emulator. Am I missing something?

    Read the article

  • Android - update widget text

    - by david
    Hi, i have 2 questions about widgets update I have 2 buttons and i need to change one button text when i press the other one, how can i do this? The first time i open the widget it calls the onUpdate method, but it never calls it again. I need to update the widget every 2 seconds and i have this line in the xml. android:updatePeriodMillis="2000" Do i need a service or should it works just with the updatePeriodMillis tag? onUpdate method RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.newswidget); Intent intent = new Intent(context, DetalleConsulta.class); intent.putExtra(DetalleConsulta.CONSULTA_ID_NAME, "3"); PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0); views.setOnClickPendingIntent(R.id.btNews, pendingIntent); /* Inicializa variables para llamar el controlador */ this.imei = ((TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId(); this.controlador = new Controlador(this.imei); try { this.respuestas = this.controlador.recuperarNuevasRespuestas(); if(this.respuestas != null &amp;&amp; this.respuestas.size() &gt; 0){ Iterator&lt;Consulta&gt; iterRespuestas = this.respuestas.iterator(); views.setTextViewText(R.id.btNews, ((Consulta)iterRespuestas.next()).getRespuesta()); } } catch (PersistenciaException e) { //TODO manejar error } appWidgetManager.updateAppWidget(appWidgetIds, views); thx a lot!!!

    Read the article

  • Convert plain text list to html

    - by morbusg
    So I have a plain text list like this: I am the first top-level list item I am his son Me too Second one here His son His daughter I am the son of the one above Me too because of the indentation Another one And I would like to turn that into: <ul> <li>I am the first top-level list-item <ul> <li>I am his son</li> <li>Me too</li> </ul> </li> <li>Second one here <ul> <li>His son</li> <li>His daughter <ul> <li>I am the son of the one above</li> <li>Me too because of the indentation</li> </ul> </li> <li>Another one</li> </ul> </li> </ul> How would one go about doing that?

    Read the article

  • Handling text menu in Python

    - by PulpFiction
    Hi all. I am trying to create a text based menu in Python. Here is the code: #!/usr/bin/env python def testcaseOutput(): print '1. Add. 2. Subtract. 3. Divide. 4. Multiply' try: answer = int(raw_input('Enter a value (1 - 4) >. ')) except ValueError: print 'Invalid input. Enter a value between 1 -4 .' testcaseOutput() if answer in range(1, 5): return answer else: print 'Invalid input. Enter a value between 1 - 4.' testcaseOutput() My question: When the user enters an invalid input, i.e. not a number, I want this function to get called again. So I used the recursive approach which I think is bad design. I use that approach again in the if answer in range(1, 5). Is there any other way to handle this? I need the prompt called again when there is an invalid input. Also, is there any way I can club the two constraints: check whether input is a number and check whether the number is in the range(1,5) together? As you can see, I am checking that individually.

    Read the article

  • Parse particular text from an XML string

    - by Dan Sewell
    Hi all, Im writing an app which reads an RSS feed and places items on a map. I need to read the lat and long numbers only from this string: http://www.xxxxxxxxxxxxxx.co.uk/map.aspx?isTrafficAlert=true&lat=53.647351&lon=-1.933506 .This is contained in link tags Im a bit of a programming noob but im writing this in C#/Silverlight using Linq to XML. Shold this text be extrated when parsing or after parsing and sent to a class to do this? Many thanks for your assistance. EDIT. Im going to try and do a regex on this this is where I need to integrate the regex somewhere in this code. I need to take the lat and long from the Link element and seperate it into two variables I can use (the results are part of a foreach loop that creates a list.) var events = from ev in document.Descendants("item") select new { Title = (ev.Element("title").Value), Description = (ev.Element("description").Value), Link = (ev.Element("link").Value), }; Question is im not quite ure where to put the regex (once I work out how to use the regex properly! :-) )

    Read the article

  • CSS Heart with Text within

    - by user3696456
    I would like to put a name into a heart made with CSS. And I can't seem to figure out how to do it. I have this code already: #heart { position:relative; width:100px; height:100px; } #heart:before,#heart:after { position:absolute; content:""; left:50px; top:0; width:50px; height:80px; background:#F00000; -moz-border-radius:50px 50px 0 0; border-radius:50px 50px 0 0; -webkit-transform:rotate(-45deg); -moz-transform:rotate(-45deg); -ms-transform:rotate(-45deg); -o-transform:rotate(-45deg); transform:rotate(-45deg); -webkit-transform-origin:0 100%; -moz-transform-origin:0 100%; -ms-transform-origin:0 100%; -o-transform-origin:0 100%; transform-origin:0 100%; } #heart:after { left: 0; -webkit-transform:rotate(45deg); -moz-transform:rotate(45deg); -ms-transform:rotate(45deg); -o-transform:rotate(45deg); transform:rotate(45deg); -webkit-transform-origin:100% 100%; -moz-transform-origin:100% 100%; -ms-transform-origin:100% 100%; -o-transform-origin:100% 100%; transform-origin:100% 100%; } When I try to write the name directly into the div: "#heart", it just puts the text behind. Thanks in advance for any help!

    Read the article

  • read line by line the text file for make map in xna

    - by Mohammadali Najjar khodabakhsh
    i want to read a text file for build map; for example I have this map 0@0000000 0@0000000 0@0000000 000000000 000000000 000000000 000000000 I know I should use this : StreamReader reader = new StreamReader(Application.StartupPath+@"/TestMap.MMAP"); string line = reader.ReadToEnd(); reader.Close(); now for example I want read line 2 char "@". how can i do this? please help me. solve : Thank you (L.B AND user861114) at last my problem solve like this : string[,] item = new string[9, 7]; string[] line = File.ReadAllLines(Application.StartupPath + @"/TestMap.MMAP"); for (int j = 0; j < 7; j++) { for (int i = 0; i < 9; i++) { item[i, j] = line[j].Substring(i, 1); Console.WriteLine(i + " " + j + "=" + item[i, j]); } } thanks alot.

    Read the article

  • How to add root node in the output method = text

    - by Akhil
    My sample input is <?xml version="1.0" encoding="UTF-8"?> <ns0:JDBC_RECEIVERDATA_MT_response xmlns:ns0="urn:parmalat.com.au:TESTSQL_REPLICATION"> <Statement_response> <response_1> <row> <XML_F52E2B61-18A1-11d1-B105-00805F49916B><![CDATA[<TransactionLog TID="1400" SeqNo="3337446" SQLTransaction="Insert into TankerLoads Values(141221,53,299,18,1,426148,6,&apos;Nov 19 2007 12:00AM&apos;,&apos;Dec 30 1899 12:59PM&apos;,3.00,20682,0,&apos;Zevo&apos;,&apos;Nov 19 2007 12:00AM&apos;,0)"/></row> <row> <XML_F52E2B61-18A1-11d1-B105-00805F49916B>um = 141221"/&gt;&lt;TransactionLog TID="1400" SeqNo="3337452" SQLTransaction="Insert into MilkPickups Values(790195,141221,0,&amp;apos;Nov 19 2007 12:00AM&amp;apos;,2433,&amp;apos;Nov 19 2007 12:00AM&amp;apos;,&amp;apos;Dec 30 1899 11:26AM&amp;apos;,3131,2.90)"/&gt; Like this I have mutiple records and my output should be like <root> <TransactionLog TID="1400" SeqNo="3337446" SQLTransaction="Insert into TankerLoads Values(141221,53,299,18,1,426148,6,'Nov 19 2007 12:00AM','Dec 30 1899 12:59PM',3.00,20682,0,'Zevo','Nov 19 2007 12:00AM',0)" /> <TransactionLog TID="1400" SeqNo="3337447" SQLTransaction="Update TankerLoads Set TankerNum = 53,DriverNum = 299,CarterNum = 18,MilkTypeNum = 1,SampleNum = 426148,ReceivalBayNum = 6,UnloadDate = 'Nov 19 2007 12:00AM',UnloadTime = 'Dec 30 1899 12:59PM',Temperature = 3.00,Volume = 20682,NetWeight = 0,WeighbridgeDocket = 'Zevo',LoadPickupDate = 'Nov 19 2007 12:00AM',IsValidated = 0 Where TankerLoadNum = 141221" /></root> AND I AM USING OUTPUT METHOD AS TEXT BECAUSE IF I USE XML THE TAG ARE REPLACED WITH &LT &GT WHICH I DONT MOREOVER IF YOU SEE THE ABOVE TWO ROWS THE LAST LINE IS HALF THE RECORD IS IN THE FIRST ROW AND CONTINUING THE OTHER HALF IN THE SECOND ROW SO i USED WHICH LEAVES SINGLE SPACE SO EVEN I DONT WANT THAT SINGLE SPACE..I HOPE I AM CLEAR IF NOT PLEASE LET ME KNOW I WILL ADD MORE COMMENTS..TPLEASE HELP ME OUT..THNKYOU

    Read the article

  • c# counting identical strings from text file

    - by Winkz
    I have a foreach statement where I go through several lines from a text file, where I have trimmed down and sorted out the lines I need. What I want to do is count up on how many times an identical string is present. How do I do this? Here is my code. It's the second if statement where I am stuck: foreach (string line in lines.Where(l => l.Length >= 5)) { string a = line.Remove(0, 11); if ((a.Contains(mobName) && a.Contains("dies"))) { mobDeathCount++; } if (a.Contains(mobName) && a.Contains("drops")) { string lastpart = a.Substring(a.LastIndexOf("drops")); string modifiedLastpart = lastpart.Remove(0, 6); } Heres what some of the lines look like: a bag of coins a siog brandy a bag of coins a bag of coins the Cath Shield a tattered scroll So what im trying to do is counting up there are 3 lines with bag of coins. But i need to make it so that it can be everything, theres a drop lists thats huge. So cant add all of em, would take too long

    Read the article

  • Using CSS to create three boxes with dividers and text centered within each box

    - by linnse
    I'm trying to figure out the best way to create a row of three boxes (columns), with dividers between boxes 1 and 2, and boxes 2 and 3. The text would need to be centered within each box. h2 { color: #00ADEF; margin-top:0; margin-bottom:0; font-family:Arial, Helvetica, sans-serif; font-size:20px; font-weight:bold; line-height:23px; } p { margin-top:0; } .3colwrapper { width: 930px; margin: 0 auto; } .colbox { float:left; margin: 10px; width: 210px; background:#DDD; padding:10px 40px; } <div class="3colwrapper"> <div class="colbox"><h2>Step One</h2> <p>Sign up</p> </div> <div class="colbox"><h2>Step Two</h2> <p>Verify</p> </div> <div class="colbox"><h2>Step Three</h2> <p>Participate</p> </div> </div> Here's what I've worked up so far: http://cssdesk.com/YyjAr

    Read the article

  • HTML + Button with text and image on it.

    - by lucky
    Hello, I have a problem in creating a Button with text and image on it. <td> <button type="submit" name="report" value="Report" <?php if($tab == 'Excel') echo "id=\"tab_inactive\""; else echo "id=\"tab_active\"" ; ?>> <img src="images/report.gif" alt="Report"/>Report </button> <button type="submit" name="excel" value="Excel" <?php if($tab == 'Excel' ) echo "id=\"tab_active\""; else echo "id=\"tab_inactive\"" ; ?>> <img src="images/Excel.gif" alt="Excel" width="16" height="16" /> Excel </button> </td> Here $tab is $tab = strlen(trim($_POST[excel]))>0 ? $_POST[excel] : $_POST[report]; I tried this way, but this is behaving so strangely. On click the button:- The submit function is working properly in firefox, but not in IE. Instead of submitting the value(in this example values are 'Report' and 'Excel'), indeed it is submitting the label of the button. That is if i am checking the value of array PRINT_R($_POST). The value of it is Array ( [report] =>(Icon that i used) Report [excel] => (Icon that i used) Excel [frm_analysis] => [to_analysis] => ) Here i have more than 1 button, then all the labels are submitted eventhough one of them is pressed. i dont how to capture which button is pressed. I even tried changing button type=button and onclick="document.formname.submit()" Even this is resulting in the same. Can you please help me to solve this.

    Read the article

  • navigation li to create <span></span> around text via jquery

    - by MikesEpitaphSays
    I've been trying all day and reading a few things, but for some reason my code isn't working right What i'm trying to achieve is this: When i create an un ordered list in my index page - I want my jquery to automatically add around the text in the anchor. So i want it to look like this <li><a href="index.htm"><span>Home</span></a></li> while I am only adding: <li><a href="index.htm">Home</a></li> I want to do this because i have a LOT of list items and instead of writing when i'm adding pages it makes the most sense to save some time in the long run and create a loop that will handle that anytime i add one. This is What i have so far (sorry if it looks ugly): $('document').ready(function () { var begSpan = "<span>"; var endSpan = "</span>"; $('p').each(function () { $(this) prepend(begSpan); }).append(endSpan); }); How can i get that to auto create span tags for me

    Read the article

  • Identify words with ascending characters from text file

    - by user2914000
    I am having a fair amount of trouble trying to write a program that counts the amount of ascending words (words in which each character is larger than the previous character) in a text file. I have tried a few different methods to solve this but cannot seem to get it working. If anyone could help me revise the code to work properly it would be appreciated. The code will print about 5 of the words from the list of nearly 20000, but none considered are ascending (the file does have many ascending words) and it sometimes prints the same word twice. I am printing theWord to the console simply to see if the code works. import java.util.Scanner; import java.io.*; public class { public static void main (String [] args) throws FileNotFoundException{ String theWord; Scanner inputFile = new Scanner(new File("file.txt")); boolean ascending = true; int i = 1; while(inputFile.hasNextLine()){ theWord = inputFile.nextLine(); if(theWord.length() >= 2){ while(i < theWord.length() - 1){ if(theWord.charAt(i) <= theWord.charAt(i + 1)){ ascending = true; System.out.println("+ " + theWord); totalNum = totalNum + 1; } else{ ascending = false; System.out.println("= " + theWord); } i++; } } }

    Read the article

  • Reading a text file, and performing actions based on strings read

    - by user1691766
    Let me start off by saying that I really am quite new to C. So basically I have a text file (contains around 30 assembly instructions, separated by new lines), and I am successfully reading them into my program. From here I need to perform certain actions based off each instruction. I would assume the best way to do this would be via a switch-case statement. However I am encountering a lot of problems due to me trying to compare strings that are 33 characters long. Can anyone please offer me advice on what I am doing wrong, or offer an alternative? Thanks in advance. Here is what I have so far: char instruction[29][ 33 ]; int i,run; i = 0; run = 1; FILE *instPtr; /* LOADING INSTRUCTIONS FROM FILE INTO "instruction" ARRAY*/ if ( ( instPtr = fopen("MIPSinstructions.txt", "r") ) == NULL ) { printf("File could not be opened\n"); } // end if else { fscanf( instPtr, "%s", instruction[0]); printf("%s\n", instruction[0]); while (!feof( instPtr ) ){ i++; fscanf( instPtr, "%s", instruction[i]); printf("%s\n", instruction[i]); } fclose( instPtr ); i = 0; // Reset the counter } //end else return 0; }

    Read the article

  • Save gcc compile status to a text file for Java

    - by JohnBore
    I'm making a C Assessment Program through Java, which has a bunch of programming questions for C, and it lets the user input an answer in the form of C code, and then press a "Compile" button, which is linked to a bat file that runs the user input code through gcc. I've got the input and compiling working, but I need to get the output from the compiler and get that to print textarea within the program. I can get a simple "Hello, world" compiling, but I'm having trouble getting programs that require a user input with scanf, for example, to be printed. else if(e.getSource().equals(compile)){ if(questionNumber<1){ JOptionPane.showMessageDialog(programFrame, "Please start the assessment", "Compile Error", JOptionPane.ERROR_MESSAGE); } else{ FileOutputStream fileWrite; try { fileWrite = new FileOutputStream("demo/demo.c"); new PrintStream(fileWrite).println(input.getText());//saves what the user has entered in to a C source file fileWrite.close(); @SuppressWarnings("unused") Process process = Runtime.getRuntime().exec("cmd /c compile.bat");//runs the batch file to compile the source file compileCode(); try{ fileStream = new FileInputStream("demo/output.txt"); inputStream = new DataInputStream(fileStream); bufferRead = new BufferedReader(new InputStreamReader(inputStream)); while((stringLine = bufferRead.readLine())!=null){ compiled.append(stringLine); compiled.append("\n"); } inputStream.close(); } catch(IOException exc){ System.err.println("Unable to read file"); System.exit(-1); } } catch (IOException exc) { JOptionPane.showMessageDialog(programFrame, "Demo file not found", "File Error", JOptionPane.ERROR_MESSAGE); } } This is the actionPerformed method for the "Compile" button, the compileCode() is the JFrame that displays the output and "compiled" is the textArea for the output. My batch file is: C: cd dev-cpp\bin gcc.exe H:\workspace\QuestionProgram\demo\demo.c -o demo > H:\workspace\QuestionProgram\demo\compilestatus.txt demo > H:\workspace\QuestionProgram\demo\output.txt I'm not sure how I can do it, so the frame is created for the output of the code if the code requires a user input as the command prompt doesn't open without adding "START" to .exec(), but then the frame appears before the program has finished running. Also, how would I get the output of the compiler if the compile fails because of an error? The way I've got it in my batch file at the moment doesn't put anything in a text file if it fails.

    Read the article

  • Java Nimbus LAF with transparent text fields

    - by Software Monkey
    I have an application that uses disabled JTextFields in several places which are intended to be transparent - allowing the background to show through instead of the text field's normal background. When running the new Nimbus LAF these fields are opaque (despite setting setOpaque(false)), and my UI is broken. It's as if the LAF is ignoring the opaque property. Setting a background color explicitly is both difficult in several places, and less than optimal due to background images actually doesn't work - it still paints it's LAF default background over the top, leaving a border-like appearance (the splash screen below has the background explicitly set to match the image). Any ideas on how I can get Nimbus to not paint the background for a JTextField? Note: I need a JTextField, rather than a JLabel, because I need the thread-safe setText(), and wrapping capability. Note: My fallback position is to continue using the system LAF, but Nimbus does look substantially better. See example images below. Conclusions The surprise at this behavior is due to a misinterpretation of what setOpaque() is meant to do - from the Nimbus bug report: This is a problem the the orginal design of Swing and how it has been confusing for years. The issue is setOpaque(false) has had a side effect in exiting LAFs which is that of hiding the background which is not really what it is ment for. It is ment to say that the component my have transparent parts and swing should paint the parent component behind it. It's unfortunate that the Nimbus components also appear not to honor setBackground(null) which would otherwise be the recommended way to stop the background painting. Setting a fully transparent background seems unintuitive to me. In my opinion, setOpaque()/isOpaque() is a faulty public API choice which should have been only: public boolean isFullyOpaque(); I say this, because isOpaque()==true is a contract with Swing that the component subclass will take responsibility for painting it's entire background - which means the parent can skip painting that region if it wants (which is an important performance enhancement). Something external cannot directly change this contract (legitimately), whose fulfillment may be coded into the component. So the opacity of the component should not have been settable using setOpaque(). Instead something like setBackground(null) should cause many components to "no long have a background" and therefore become not fully opaque. By way of example, in an ideal world most components should have an isOpaque() that looks like this: public boolean isOpaque() { return (background!=null); }

    Read the article

  • Stuck with Regular Expression code to apply HTML tag to text but exclude if inside <?> tag

    - by James Buckingham
    Hi there. I'm trying to write a bit of regex which would go through some text, written by our Editors, and apply an <acronym> tag to the first instance it finds of an abbreviation set we hold in our "Glossary of Terms". So for this example I've used the abbreviation ITS. 1st thing I thought I'd do is setup an example with a mix of scenerios I could test against, i.e. ITS sitting with punctuation, in HTML tags & ones that we've applied this to already (in other words the script has run through this before, so no need to do again). I'm almost there but just got stuck at the last point :-(. Here's the regex I've got so far - <[^<|]+?>?>ITS<[^<]+?>|ITS The Example - FROM ( EVERY ITS IN BOLD TO BE WRAPPED WITH ACRONYM ): I want you to tag thisITS, but not this wrapped one - <acronym title="ITS" id="thisIsATest">ITS</acronym> This is another test as I still want to update <p>ITS</p> that have other HTML tags wrapped around them.` ITS want ones that start sentences and ones that finish ITS. ITS, and ones which are wrapped in punctuation.` Test link: <a href="index.cfm>ITS</a> AND I WANT THIS CHANGE TO : I want you to tag this <acronym title="ITS">ITS</acronym>, but not this wrapped one - <acronym title="ITS">ITS</acronym> This is another test as I still want to update <acronym title="ITS">ITS</acronym> that have other HTML tags wrapped around them.` <acronym title="ITS">ITS</acronym> want ones that start sentences and ones that finish <acronym title="ITS">ITS</acronym>. <acronym title="ITS">ITS</acronym>, and ones which are wrapped in punctuation. Test link: <acronym title="ITS"><a href="index.cfm>ITS</a></acronym> Are there any Reg Ex experts out there that could help me finish this off? Any other hints tips would also be appreciated. Thanks a lot, James P.S. This is going to be placed in a ColdFusion application if that helps anyone in specific syntax.

    Read the article

  • Show/Hide button (text) for Accordion

    - by Kevin
    Have an accordion with a "view" button to open close the accordion panel (using jQuery Tools), but I would like to have dynamic text that says "show/hide" depending on the state... Here is the code for the accordion in asp.NET <div id="accordion"> <% foreach (var eventModel in ViewModel) { %> <% var isNewMonth = eventModel.Date.Month != previousMonth; %> <% if (isNewMonth && previousMonth > 0) { %></table></div><% } %> <% previousMonth = eventModel.Date.Month; %> <% if (isNewMonth) { %> <h2><%= string.Concat(eventModel.Date.ToString("MMMM"), " ", eventModel.Date.Year) %> <span style="float:right;"><a href="#" class="button blue small">View</a></span></h2> <div class="pane" style="display:block"> <table id="listTable" width="100%" cellpadding="3" cellspacing="0" border="0"> <tr align="left" valign="top"><th align="left" valign="top">Date</th><th align="left" valign="top">Event</th><th align="left" valign="top">Event Type</th></tr> <% } %> <tr align="left" valign="top"><td align="left" valign="top"><b><span id="date" style="float:left;"> <%= string.Concat(eventModel.Date.ToString("MMMM"), " ", eventModel.Date.Day, " </span><span id='day' style='float:left'>" + eventModel.Date.DayOfWeek + "</span> ")%></b></td><td align="left" valign="top" ><%= Html.ActionLink(eventModel.Name.Truncate(40), "event", "register", new { id = eventModel.Id }, null)%></td><td align="left" valign="top"><%= string.Concat(" ", eventModel.Sport)%></td></tr> <% } %> <% if (ViewModel.Count > 0) { %></table></div><% } %> </div> Here is the initialization script using jQuery: $(function() { $("#accordion").tabs("#accordion div.pane", {tabs: 'h2', effect: 'slide', initialIndex: 0}); $(".small").click(function() { moveToTop(); }); });

    Read the article

< Previous Page | 149 150 151 152 153 154 155 156 157 158 159 160  | Next Page >