Search Results

Search found 1513 results on 61 pages for 'unexpected'.

Page 6/61 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • .before method adds unexpected close tags

    - by timkl
    I have a table in my markup on which I want to add some divs before and efter like this: <div class="widebox"> <div class="widebox-header">Opret/rediger bruger</div> <div class="widebox-middle"> <table id="Table3"></table> </div> <div class="widebox-bottom"></div> </div> I'm trying to do this with jQuery, like this: $('#Table3').before('<div class="widebox"><div class="widebox-header">Opret/rediger bruger</div><div class="widebox-middle">'); $('#Table3').after('</div><div class="widebox-bottom"></div></div>'); However this is what renders out, the method seems to close my opening divs: <div class="widebox"> <div class="widebox-header">Opret/rediger bruger</div> <div class="widebox-middle"></div></div><!-- unexpected close divs --> <table id="Table3"></table> <div class="widebox-bottom"></div> Anyone know what could be causing this?

    Read the article

  • Parse error: syntax error, unexpected T_STRING in...

    - by rabidmachine9
    I' making this class to catch twitter posts but I get the error : Parse error: syntax error, unexpected T_STRING in /Applications/XAMPP/xamppfiles/htdocs/classTest/Twitter.php on line 29 I cant find what's wrong...any ideas? class TwitterGrub{ function twitterCapture($user = 'myUsername',$password = 'myPass') { $ch = curl_init("https://twitter.com/statuses/user_timeline.xml"); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch,CURLOPT_TIMEOUT, 30); curl_setopt($ch,CURLOPT_USERPWD,$user . ":" . $password); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0); $result=curl_exec ($ch); $data = strstr($result, '<?'); $xml = new SimpleXMLElement($data); return $xml; } function twitterDisplay($twitNum){ $xml = this->twitterCapture(); for($i= 0; $i<$twitNum; $i++){ echo "<div class='curvebox'>".$xml->status[$i]->text."</div>"; } } }

    Read the article

  • WCF - "Encountered unexpected character 'c'."

    - by Villager
    Hello, I am trying to do something that I thought would be simple. I need to create a WCF service that I can post to via JQuery. I have an operation in my WCF service that is defined as follows: [OperationContract] [WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.WrappedRequest, RequestFormat=WebMessageFormat.Json, ResponseFormat=WebMessageFormat.Json)] public string SendMessage(string message, int urgency) { try { // Do stuff return "1"; // 1 represents success } catch (Exception) { return "0"; } } I then try to access this operation from an ASP.NET page via JQuery. My JQuery code to access this operation looks like the following: function sendMessage(message) { $.ajax({ url: "/resources/services/myService.svc/SendMessage", type: "POST", contentType: "application/json; charset=utf-8", data: ({ message: message, urgency: '1' }), dataType: "json", success: function (data) { alert("here!"); }, error: function (req, msg, obj) { alert("error: " + req.responseText); } }); } When I execute this script, the error handler is tripped. In it, I receive an error that says: "Encountered unexpected character 'c'." This message is included with a long stack trace. My question is, what am I doing wrong? I have received other posts such as this one (http://stackoverflow.com/questions/320291/how-to-post-an-array-of-complex-objects-with-json-jquery-to-asp-net-mvc-controll) without any luck. How do I get this basic interaction working? Thank you!

    Read the article

  • Unexpected crash while using looking phone numbers in iPhone address book

    - by FX
    I have a rather unexpected result with the following code: ABAddressBookRef addressBook = ABAddressBookCreate(); CFArrayRef people = ABAddressBookCopyArrayOfAllPeople(addressBook); CFIndex nPeople = ABAddressBookGetPersonCount(addressBook); NSLog (@"npeople = %d = %d", nPeople, CFArrayGetCount(people)); for (CFIndex i = 0; i < nPeople; i++) { ABRecordRef record = CFArrayGetValueAtIndex(people,i); ABMultiValueRef numbers = ABRecordCopyValue(record, kABPersonPhoneProperty); CFIndex count = ABMultiValueGetCount(numbers); NSLog (@"%d %d", i, count); } I never reach the second NSLog, it crashes on the call to ABMultiValueGetCount with: : * -[NSCFString count]: unrecognized selector sent to instance 0x383e72f4 : Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '** -[NSCFString count]: unrecognized selector sent to instance 0x383e72f4' In short, it's behaving as if my "numbers" variable was an NSString. While I wrote the code above myself, the same can be found in many examples on the web. Does someone here spot anything wrong with it? Oh, and also: it only crashes in Release mode (in debug mode, all is fine).

    Read the article

  • goto was unexpected at this time

    - by SammytheNerd
    @echo off color 0a title Horror Game echo. echo. echo. echo. echo Welcome to the game echo If you get scared echo Feel free to leave echo. echo. echo You are in a dark room. echo It is cold. echo All you hear is a scratching sound echo near your feet. echo What do you do? echo. echo. echo 1.) Feel around you echo 2.) Listen for anything else set/p input = Command? if %input% == "1" goto Feel if %input% == "2" goto Listen echo. echo. :Feel echo You feel around and hear a growl. echo As you realize the scratching was echo on your leg. echo. echo You remember nothing else. pause end I am trying to make a text based game for cmd and whenever i try to enter a response is instantly closes and i can barely read out "goto was unexpected at this time"

    Read the article

  • Unexpected '{' with IF statement

    - by user1926208
    this is my code to move all the files in a directory to another directory which are 1 hour old or more. <?php $srcDir = 'code'; $destDir = 'code/old'; if (file_exists($destDir)) { if (is_dir($destDir)) { if (is_writable($destDir)) { if ($handle = opendir($srcDir)) { while (false !== ($file = readdir($handle))) { if (is_file($srcDir . '/' . $file)) { if(date("U",filectime($srcDir . '/' . $file) >= time() - 3600) { rename($srcDir . '/' . $file, $destDir . '/' . $file); } } } closedir($handle); } else { echo "$srcDir could not be opened.\n"; } } else { echo "$destDir is not writable!\n"; } } else { echo "$destDir is not a directory!\n"; } } else { echo "$destDir does not exist\n"; } ?> and I am getting this error: Parse error: syntax error, unexpected '{' in /home/tcity/public_html/myDir/movefiles.php on line 11

    Read the article

  • Unexpected output from Bubblesort program with MSVC vs TCC

    - by Sujith S Pillai
    One of my friends sent this code to me, saying it doesn't work as expected: #include<stdio.h> void main() { int a [10] ={23, 100, 20, 30, 25, 45, 40, 55, 43, 42}; int sizeOfInput = sizeof(a)/sizeof(int); int b, outer, inner, c; printf("Size is : %d \n", sizeOfInput); printf("Values before bubble sort are : \n"); for ( b = 0; b &lt; sizeOfInput; b++) printf("%d\n", a[b]); printf("End of values before bubble sort... \n"); for ( outer = sizeOfInput; outer &gt; 0; outer-- ) { for ( inner = 0 ; inner &lt; outer ; inner++) { printf ( "Comparing positions: %d and %d\n",inner,inner+1); if ( a[inner] &gt; a[inner + 1] ) { int tmp = a[inner]; a[inner] = a [inner+1]; a[inner+1] = tmp; } } printf ( "Bubble sort total array size after inner loop is %d :\n",sizeOfInput); printf ( "Bubble sort sizeOfInput after inner loop is %d :\n",sizeOfInput); } printf ( "Bubble sort total array size at the end is %d :\n",sizeOfInput); for ( c = 0 ; c &lt; sizeOfInput; c++) printf("Element: %d\n", a[c]); } I am using Micosoft Visual Studio Command Line Tool for compiling this on a Windows XP machine. cl /EHsc bubblesort01.c My friend gets the correct output on a dinosaur machine (code is compiled using TCC there). My output is unexpected. The array mysteriously grows in size, in between. If you change the code so that the variable sizeOfInput is changed to sizeOfInputt, it gives the expected results! A search done at Microsoft Visual C++ Developer Center doesn't give any results for "sizeOfInput". I am not a C/C++ expert, and am curious to find out why this happens - any C/C++ experts who can "shed some light" on this? Unrelated note: I seriously thought of rewriting the whole code to use quicksort or merge sort before posting it here. But, after all, it is not Stooge sort... Edit: I know the code is not correct (it reads beyond the last element), but I am curious why the variable name makes a difference.

    Read the article

  • PHP Parse Error unexpected '{'

    - by Laxmidi
    Hi, I'm getting a "Parse error: syntax error, unexpected '{' in line 2". And I don't see the problem. <?php class pointLocation {     var $pointOnVertex = true; // Check if the point sits exactly on one of the vertices     function pointLocation() {     }                   function pointInPolygon($point, $polygon, $pointOnVertex = true) {         $this->pointOnVertex = $pointOnVertex;                  // Transform string coordinates into arrays with x and y values         $point = $this->pointStringToCoordinates($point);         $vertices = array();          foreach ($polygon as $vertex) {             $vertices[] = $this->pointStringToCoordinates($vertex);          }                  // Check if the point sits exactly on a vertex         if ($this->pointOnVertex == true and $this->pointOnVertex($point, $vertices) == true) {             return "vertex";         }                  // Check if the point is inside the polygon or on the boundary         $intersections = 0;          $vertices_count = count($vertices);              for ($i=1; $i < $vertices_count; $i++) {             $vertex1 = $vertices[$i-1];              $vertex2 = $vertices[$i];             if ($vertex1['y'] == $vertex2['y'] and $vertex1['y'] == $point['y'] and $point['x'] > min($vertex1['x'], $vertex2['x']) and $point['x'] < max($vertex1['x'], $vertex2['x'])) { // Check if point is on an horizontal polygon boundary                 return "boundary";             }             if ($point['y'] > min($vertex1['y'], $vertex2['y']) and $point['y'] <= max($vertex1['y'], $vertex2['y']) and $point['x'] <= max($vertex1['x'], $vertex2['x']) and $vertex1['y'] != $vertex2['y']) {                  $xinters = ($point['y'] - $vertex1['y']) * ($vertex2['x'] - $vertex1['x']) / ($vertex2['y'] - $vertex1['y']) + $vertex1['x'];                  if ($xinters == $point['x']) { // Check if point is on the polygon boundary (other than horizontal)                     return "boundary";                 }                 if ($vertex1['x'] == $vertex2['x'] || $point['x'] <= $xinters) {                     $intersections++;                  }             }          }          // If the number of edges we passed through is even, then it's in the polygon.          if ($intersections % 2 != 0) {             return "inside";         } else {             return "outside";         }     }               function pointOnVertex($point, $vertices) {         foreach($vertices as $vertex) {             if ($point == $vertex) {                 return true;             }         }          }                   function pointStringToCoordinates($pointString) {         $coordinates = explode(" ", $pointString);         return array("x" => $coordinates[0], "y" => $coordinates[1]);     }           } $pointLocation = new pointLocation(); $points = array("30 19", "0 0", "10 0", "30 20", "11 0", "0 11", "0 10", "30 22", "20 20"); $polygon = array("10 0", "20 0", "30 10", "30 20", "20 30", "10 30", "0 20", "0 10", "10 0"); foreach($points as $key => $point) { echo "$key ($point) is " . $pointLocation->pointInPolygon($point, $polygon) . "<br>"; } ?> Does anyone see the problem? Thanks, -Laxmidi

    Read the article

  • Unexpected return value

    - by Nicholas Gibson
    Program stopped compiling at this point: What is causing this error? (Error is at the bottom of post) public class JFrameWithPanel extends JFrame implements ActionListener, ItemListener { int packageIndex; double price; double[] prices = {49.99, 39.99, 34.99, 99.99}; DecimalFormat money = new DecimalFormat("$0.00"); JLabel priceLabel = new JLabel("Total Price: "+price); JButton button = new JButton("Check Price"); JComboBox packageChoice = new JComboBox(); JPanel pane = new JPanel(); TextField text = new TextField(5); JButton accept = new JButton("Accept"); JButton decline = new JButton("Decline"); JCheckBox serviceTerms = new JCheckBox("I Agree to the Terms of Service.", false); JTextArea termsOfService = new JTextArea("This is a text area", 5, 10); public JFrameWithPanel() { super("JFrame with Panel"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); pane.add(packageChoice); setContentPane(pane); setSize(250,250); setVisible(true); packageChoice.addItem("A+ Certification"); packageChoice.addItem("Network+ Certification "); packageChoice.addItem("Security+ Certifictation"); packageChoice.addItem("CIT Full Test Package"); pane.add(button); button.addActionListener(this); pane.add(text); text.setEditable(false); text.setBackground(Color.WHITE); text.addActionListener(this); pane.add(termsOfService); termsOfService.setEditable(false); termsOfService.setBackground(Color.lightGray); pane.add(serviceTerms); serviceTerms.addItemListener(this); pane.add(accept); accept.addActionListener(this); pane.add(decline); decline.addActionListener(this); } public void actionPerformed(ActionEvent e) { packageIndex = packageChoice.getSelectedIndex(); price = prices[packageIndex]; text.setText("$"+price); Object source = e.getSource(); if(source == accept) { if(serviceTerms.isSelected() = false) // line 79 { JOptionPane.showMessageDialog(null,"Please accept the terms of service."); } else { JOptionPane.showMessageDialog(null,"Thanks."); } } } Error: \Desktop\Java Programming\JFrameWithPanel.java:79: unexpected type required: variable found : value if(serviceTerms.isSelected() = false) ^ 1 error

    Read the article

  • Unexpected output while using Microsoft Visual Studio 2008 (Express Edition) C++ Command Line Tool

    - by Sujith S Pillai
    One of my friends sent this code to me, saying it doesn't work as expected: #include<stdio.h> void main() { int a [10] ={23, 100, 20, 30, 25, 45, 40, 55, 43, 42}; int sizeOfInput = sizeof(a)/sizeof(int); int b, outer, inner, c; printf("Size is : %d \n", sizeOfInput); printf("Values before bubble sort are : \n"); for ( b = 0; b < sizeOfInput; b++) printf("%d\n", a[b]); printf("End of values before bubble sort... \n"); for ( outer = sizeOfInput; outer > 0; outer-- ) { for ( inner = 0 ; inner < outer ; inner++) { printf ( "Comparing positions: %d and %d\n",inner,inner+1); if ( a[inner] > a[inner + 1] ) { int tmp = a[inner]; a[inner] = a [inner+1]; a[inner+1] = tmp; } } printf ( "Bubble sort total array size after inner loop is %d :\n",sizeOfInput); printf ( "Bubble sort sizeOfInput after inner loop is %d :\n",sizeOfInput); } printf ( "Bubble sort total array size at the end is %d :\n",sizeOfInput); for ( c = 0 ; c < sizeOfInput; c++) printf("Element: %d\n", a[c]); } I am using Micosoft Visual Studio Command Line Tool for compiling this on a Windows XP machine. cl /EHsc bubblesort01.c My friend gets the correct output on a dinosaur machine (code is compiled using TCC there). My output is unexpected. The array mysteriously grows in size, in between. If you change the code so that the variable sizeOfInput is changed to sizeOfInputt, it gives the expected results! A search done at Microsoft Visual C++ Developer Center doesn't give any results for "sizeOfInput". I am not a C/C++ expert, and am curious to find out why this happens - any C/C++ experts who can "shed some light" on this? Unrelated note: I seriously thought of rewriting the whole code to use quicksort or merge sort before posting it here. But, after all, it is not Stooge sort...

    Read the article

  • UnmarshalException: unexpected element

    - by Tom Brito
    I'm working with JAXB, and I'm having trouble to unmarshall a file; The following lines, on the beginning of the file, are causing trouble: <!DOCTYPE package PUBLIC "+//ISBN 0-9673008-1-9//DTD OEB 1.2 Package//EN" "http://openebook.org/dtds/oeb-1.2/oebpkg12.dtd"> <package xmlns="http://openebook.org/namespaces/oeb-package/1.0/" unique-identifier="uid"> If I delete all the !DOCTYPE it gives no Exception, but it doesn't load any value either. The program (with the !DOCKTYPE) is throwing the exeption: javax.xml.bind.UnmarshalException: unexpected element (uri:"http://openebook.org/namespaces/oeb-package/1.0/", local:"package"). Expected elements are <{}dc-metadata>,<{}dc:Contributor>,<{}dc:Coverage>,<{}dc:Creator>,<{}dc:Date>,<{}dc:Description>,<{}dc:Format>,<{}dc:Identifier>,<{}dc:Language>,<{}dc:Publisher>,<{}dc:Relation>,<{}dc:Rights>,<{}dc:Source>,<{}dc:Subject>,<{}dc:Title>,<{}dc:Type>,<{}guide>,<{}item>,<{}itemref>,<{}manifest>,<{}meta>,<{}metadata>,<{}package>,<{}reference>,<{}site>,<{}spine>,<{}tour>,<{}tours>,<{}x-metadata> at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:631) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:236) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:231) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Loader.java:105) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext$DefaultRootLoader.childElement(UnmarshallingContext.java:1038) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:467) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:448) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:137) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501) at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator.java:767) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:400) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(XMLNSDocumentScannerImpl.java:626) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3103) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:922) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:200) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:173) at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:137) at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:142) at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:151) at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:169) at br.usp.lsi.pdtb.protector.view.ProtectorView.showBookData(ProtectorView.java:55) at br.usp.lsi.pdtb.protector.ProtectorImpl.openBook(ProtectorImpl.java:43) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at tomPack.swing.TomAction.actionPerformed(TomAction.java:115) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236) at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272) at java.awt.Component.processMouseEvent(Component.java:6263) at javax.swing.JComponent.processMouseEvent(JComponent.java:3267) at java.awt.Component.processEvent(Component.java:6028) at java.awt.Container.processEvent(Container.java:2041) at java.awt.Component.dispatchEventImpl(Component.java:4630) at java.awt.Container.dispatchEventImpl(Container.java:2099) at java.awt.Component.dispatchEvent(Component.java:4460) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168) at java.awt.Container.dispatchEventImpl(Container.java:2085) at java.awt.Window.dispatchEventImpl(Window.java:2478) at java.awt.Component.dispatchEvent(Component.java:4460) at java.awt.EventQueue.dispatchEvent(EventQueue.java:599) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161) at java.awt.EventDispatchThread.run(EventDispatchThread.java:122) Any idea how to solve this?

    Read the article

  • XmlException - inserting attribute gives "unexpected token" exception

    - by Anders Svensson
    Hi, I have an XmlDocument object in C# that I transform, using XslTransform, to html. In the stylesheet I insert an id attribute in a span tag, taking the id from an element in the XmlDocument. Here is the template for the element: <xsl:template match="word"> <span> <xsl:attribute name="id"><xsl:value-of select="@id"></xsl:value-of></xsl:attribute> <xsl:apply-templates/> </span> </xsl:template> But then I want to process the result document as an xhtml document (using the XmlDocument dom). So I'm taking a selected element in the html, creating a range out of it, and try to load the element using XmlLoad(): wordElem.LoadXml(range.htmlText); But this gives me the following exception: "'598' is an unexpected token. The expected token is '"' or '''. Line 1, position 10." And if I move the cursor over the range.htmlText, I see the tags for the element, and the "id" shows without quotes, which confuses me (i.e.SPAN id=598 instead of SPAN id="598"). To confuse the matter further, if I insert a blank space or something like that in the value of the id in the stylesheet, it works fine, i.e.: <span> <xsl:attribute name="id"><xsl:text> </xsl:text> <xsl:value-of select="@id"></xsl:value-of></xsl:attribute> <xsl:apply-templates/> </span> (Notice the whitespace in the xsl:text element). Now if I move the cursor over the range.htmlText, I see an id with quotes as usual in attributes (and as it shows if I open the html file in notepad or something). What is going on here? Why can't I insert an attribute this way and have a result that is acceptable as xhtml for XmlDocument to read? I feel I am missing something fundamental, but all this surprises me, since I do this sort of transformations using xsl:attribute to insert attributes all the time for other types of xsl transformations. Why doesn't XmlDocument accept this value? By the way, it doesn't matter if it is an id attribute. i have tried with the "class" attribute, "style" etc, and also using literal values such as "style" and setting the value to "color:red" and so on. The compiler always complains it is an unvalid token, and does not include quotes for the value unless there is a whitespace or something else in there (linebreaks etc.). I hope I have provided enough information. Any help will be greatly appreciated. Basically, what I want to accomplish is set an id in a span element in html, select a word in a webbrowser control with this document loaded, and get the id attribute out of the selected element. I've accomplished everything, and can actually do what I want, but only if I use regex e.g. to get the attribute value, and I want to be able to use XmlDocument instead to simply get the value out of the attribute directly. I'm sure I'm missing something simple, but if so please tell me. Regards, Anders

    Read the article

  • The remote server returned an unexpected response: (400) Bad Request while streaming

    - by phenevo
    Hi, I have problem with streaming. When I send small file like 1kb txt everything is ok, but when I send larger file like 100 kb jpg or 2gb psd I get: The remote server returned an unexpected response: (400) Bad Request. I'm using windows 7, VS 2010 and .net 3.5 and WCF Service library I lost all my weekend on this and I still see this error :/ Please help me Client: var client = new WpfApplication1.ServiceReference1.Service1Client("WSHttpBinding_IService1"); client.GetString("test"); string filename = @"d:\test.jpg"; FileStream fs = new FileStream(filename, FileMode.Open); try { client.ProcessStreamFromClient(fs); } catch (Exception exception) { Console.WriteLine(exception); } app.config: <?xml version="1.0" encoding="utf-8" ?> <configuration> <system.serviceModel> <bindings> <basicHttpBinding> <binding name="StreamedHttp" closeTimeout="10:01:00" openTimeout="10:01:00" receiveTimeout="10:10:00" sendTimeout="10:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536000" maxBufferPoolSize="524288000" maxReceivedMessageSize="65536000" messageEncoding="Text" textEncoding="utf-8" transferMode="Streamed" useDefaultWebProxy="true"> <readerQuotas maxDepth="0" maxStringContentLength="0" maxArrayLength="0" maxBytesPerRead="0" maxNameTableCharCount="0" /> <security mode="None"> <transport clientCredentialType="None" proxyCredentialType="None" realm="" /> <message clientCredentialType="UserName" algorithmSuite="Default" /> </security> </binding> </basicHttpBinding> </bindings> <client> <endpoint address="http://localhost:8732/Design_Time_Addresses/WcfServiceLibrary2/Service1/" binding="basicHttpBinding" bindingConfiguration="StreamedHttp" contract="ServiceReference1.IService1" name="WSHttpBinding_IService1" /> </client> </system.serviceModel> </configuration> And Wcf ServiceLibrary: public void ProcessStreamFromClient(Stream str) { using (var outStream = new FileStream(@"e:\test.jpg", FileMode.Create)) { var buffer = new byte[4096]; int count; while ((count = str.Read(buffer, 0, buffer.Length)) > 0) { outStream.Write(buffer, 0, count); } } } App.config <?xml version="1.0" encoding="utf-8" ?> <configuration> <system.web> <compilation debug="true" /> </system.web> <!-- When deploying the service library project, the content of the config file must be added to the host's app.config file. System.Configuration does not support config files for libraries. --> <system.serviceModel> <bindings> <basicHttpBinding> <binding name="Binding1" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536000" transferMode="Streamed" bypassProxyOnLocal="false" closeTimeout="10:01:00" openTimeout="10:01:00" receiveTimeout="10:10:00" sendTimeout="10:01:00" maxBufferPoolSize="524288000" maxReceivedMessageSize="65536000" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false"> <security mode="None" /> </binding> </basicHttpBinding> </bindings> <client /> <services> <service name="WcfServiceLibrary2.Service1"> <host> <baseAddresses> <add baseAddress="http://localhost:8732/Design_Time_Addresses/WcfServiceLibrary2/Service1/" /> </baseAddresses> </host> <!-- Service Endpoints --> <!-- Unless fully qualified, address is relative to base address supplied above --> <endpoint address="" binding="basicHttpBinding" contract="WcfServiceLibrary2.IService1"> <!-- Upon deployment, the following identity element should be removed or replaced to reflect the identity under which the deployed service runs. If removed, WCF will infer an appropriate identity automatically. --> <identity> <dns value="localhost"/> </identity> </endpoint> <!-- Metadata Endpoints --> <!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. --> <!-- This endpoint does not use a secure binding and should be secured or removed before deployment --> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> </service> </services> <behaviors> <serviceBehaviors> <behavior> <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> <serviceMetadata httpGetEnabled="True"/> <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> <dataContractSerializer maxItemsInObjectGraph="2147483647"/> <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> <serviceDebug includeExceptionDetailInFaults="false" /> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel> </configuration>

    Read the article

  • Code review - PHP syntax error unexpected $end

    - by dtufano
    Hey guys! I keep getting a syntax error (unexpected $end), and I've isolated it to this chunk of code. I can't for the life of me see any closure issues. It's probably something obvious but I'm going nutty trying to find it. Would appreciate an additional set of eyes. function generate_pagination( $base_url, $num_items, $per_page, $start_item, $add_prevnext_text = TRUE ) { global $lang; if ( $num_items == 0 ) { } else { $total_pages = ceil( $num_items / $per_page ); if ( $total_pages == 1 ) { return ""; } $on_page = floor( $start_item / $per_page ) + 1; $page_string = ""; if ( 8 < $total_pages ) { $init_page_max = 2 < $total_pages ? 2 : $total_pages; $i = 1; for ( ; $i < $init_page_max + 1; ++$i ) { $page_string .= $i == $on_page ? "<font face='verdana' size='2'><b>[{$i}]</b></font>" : "<a href=\"".$base_url."&amp;offset=".( $i - 1 ) * $per_page."\">{$i}</a>"; if ( $i < $init_page_max ) { $page_string .= ", "; } } if ( 2 < $total_pages ) { if ( 1 < $on_page && $on_page < $total_pages ) { $page_string .= 4 < $on_page ? " ... " : ", "; $init_page_min = 3 < $on_page ? $on_page : 4; $init_page_max = $on_page < $total_pages - 3 ? $on_page : $total_pages - 3; $i = $init_page_min - 1; for ( ; $i < $init_page_max + 2; ++$i ) { $page_string .= $i == $on_page ? "<font face='verdana' size='2'><b>[{$i}]</b></font>" : "<a href=\"".$base_url."&amp;offset=".( $i - 1 ) * $per_page."\">{$i}</a>"; if ( $i < $init_page_max + 1 ) { $page_string .= ", "; } } $page_string .= $on_page < $total_pages - 3 ? " ... " : ", "; } else { $page_string .= " ... "; } $i = $total_pages - 1; for ( ; $i < $total_pages + 1; ++$i ) { $page_string .= $i == $on_page ? "<font face='verdana' size='2'><b>[{$i}]</b></font>" : "<a href=\"".$base_url."&amp;offset=".( $i - 1 ) * $per_page."\">{$i}</a>"; if ( $i < $total_pages ) { $page_string .= ", "; } } continue; } } else { do { $i = 1; for ( ; $i < $total_pages + 1; ++$i) { $page_string .= $i == $on_page ? "<font face='verdana' size='2'><b>[{$i}]</b></font>" : "<a href=\"".$base_url."&amp;offset=".( $i - 1 ) * $per_page."\">{$i}</a>"; if ( $i < $total_pages ) { $page_string .= ", "; break; } } } while (0); if ( 1 < $on_page ) { $page_string = " <font size='2'><a href=\"".$base_url."&amp;offset=".( $on_page - 2 ) * $per_page."\">"."&laquo;"."</a></font>&nbsp;&nbsp;".$page_string; } if ( $on_page < $total_pages ) { $page_string .= "&nbsp;&nbsp;<font size='2'><a href=\"".$base_url."&amp;offset=".$on_page * $per_page."\">"."&raquo;"."</a></font>"; } $page_string = "Pages ({$total_pages}):"." ".$page_string; return $page_string; } }

    Read the article

  • Unexpected $end...

    - by Jason
    I keep getting a error - Parse error: syntax error, unexpected $end in ... on line 75, but everything looks fine to me. <?php get_header(); ?> <div id="content-top"> <div class="title"> <h2>Welcome!</h2> </div> </div> <div id="content"> <div class="contentbox"> <?php get_sidebar(); ?> <?php if (have_posts()) : ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2><a href="<?php echo get_permalink($post->post_parent); ?>" rev="attachment"><?php echo get_the_title($post->post_parent); ?></a> &raquo; <?php the_title(); ?></h2> <div class="entry"> <p class="attachment"><a href="<?php echo wp_get_attachment_url($post->ID); ?>"><?php echo wp_get_attachment_image( $post->ID, 'medium' ); ?></a></p> <div class="caption"><?php if ( !empty($post->post_excerpt) ) the_excerpt(); // this is the "caption" ?></div> <?php the_content('<p class="serif">Read the rest of this entry &raquo;</p>'); ?> <div class="navigation"> <div class="alignleft"><?php previous_image_link() ?></div> <div class="alignright"><?php next_image_link() ?></div> </div> <br class="clear" /> <p class="postmetadata alt"> <small> This entry was posted on <?php the_time('l, F jS, Y') ?> at <?php the_time() ?> and is filed under <?php the_category(', ') ?>. <?php the_taxonomies(); ?> You can follow any responses to this entry through the <?php post_comments_feed_link('RSS 2.0'); ?> feed. <?php if (('open' == $post-> comment_status) && ('open' == $post->ping_status)) { // Both Comments and Pings are open ?> You can <a href="#respond">leave a response</a>, or <a href="<?php trackback_url(); ?>" rel="trackback">trackback</a> from your own site. <?php } elseif (!('open' == $post-> comment_status) && ('open' == $post->ping_status)) { // Only Pings are Open ?> Responses are currently closed, but you can <a href="<?php trackback_url(); ?> " rel="trackback">trackback</a> from your own site. <?php } elseif (('open' == $post-> comment_status) && !('open' == $post->ping_status)) { // Comments are open, Pings are not ?> You can skip to the end and leave a response. Pinging is currently not allowed. <?php } elseif (!('open' == $post-> comment_status) && !('open' == $post->ping_status)) { // Neither Comments, nor Pings are open ?> Both comments and pings are currently closed. <?php } edit_post_link('Edit this entry.','',''); ?> </small> </p> </div> </div> <?php comments_template(); ?> <?php endwhile; else: ?> <p>Sorry, no attachments matched your criteria.</p> <?php endif; ?> <div class="clear"></div> </div> </div>

    Read the article

  • How to fix - Parse error: syntax error, unexpected T_CLASS

    - by user557015
    Hi, I'm new to PHP, and i'm making a forum. all the files work except one file, add_topic.php. It gives me an error saying: Parse error: syntax error, unexpected T_CLASS in /home/a3885465/public_html/add_topic.php on line 25 I know it is probably on the lines: </span>}<span class="s4"><br> </span>else{<span class="s4"><br> </span>echo "ERROR";<span class="s4"><br> </span>}<span class="s4"><br> </span>mysql_close();<span class="s4"><br> but the whole code is below just in case. If you have any idea, it would be really appreciated, thanks! The Code for add_topic.php <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Style-Type" content="text/css"> <title></title> <meta name="Generator" content="Cocoa HTML Writer"> <meta name="CocoaVersion" content="1038.32"> <style type="text/css"> p.p1 {margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana; color: #009901} p.p2 {margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Verdana; color: #3a00ff} span.s1 {color: #3a00ff} span.s2 {font: 12.0px 'Lucida Grande'; color: #3a00ff} span.s3 {font: 13.0px Courier; color: #404040} span.s4 {font: 12.0px 'Lucida Grande'} span.s5 {color: #009901} td.td1 {width: 566.0px; margin: 0.5px 0.5px 0.5px 0.5px} </style> </head> <body> <table cellspacing="0" cellpadding="0"> <tbody> <tr> <td valign="middle" class="td1"> <p class="p1"><span class="s1"></span><?php<span class="s2"><br> </span><span class="s1">$host="</span><span class="s3">"host"</span><span class="s1">";</span> // Host name <span class="s4"><br> </span><span class="s1">$username="</span><span class="s3">username</span><span class="s1">";</span> // Mysql username <span class="s4"><br> </span><span class="s1">$password="password";</span> // Mysql password <span class="s4"><br> </span><span class="s1">$db_name="</span><span class="s3">database_name</span><span class="s1">";</span> // Database name <span class="s4"><br> </span><span class="s1">$tbl_name="forum_question";</span> // Table name</p> <p class="p2"><span class="s5">// Connect to server and select database.</span><span class="s4"><br> </span>mysql_connect("$host", "$username", "$password")or die("cannot connect"); <span class="s4"><br> </span>mysql_select_db("$db_name")or die("cannot select DB");</p> <p class="p2"><span class="s5">// get data that sent from form </span><span class="s4"><br> </span>$topic=$_POST['topic'];<span class="s4"><br> </span>$detail=$_POST['detail'];<span class="s4"><br> </span>$name=$_POST['name'];<span class="s4"><br> </span>$email=$_POST['email'];<span class="s4"><br> <br> </span>$datetime=date("d/m/y h:i:s"); <span class="s5">//create date time</span><span class="s4"><br> <br> </span>$sql="INSERT INTO $tbl_name(topic, detail, name, email, datetime)VALUES('$topic', '$detail', '$name', '$email', '$datetime')";<span class="s4"><br> </span>$result=mysql_query($sql);<span class="s4"><br> <br> </span>if($result){<span class="s4"><br> </span>echo "Successful<BR>";<span class="s4"><br> </span>echo "<a href=main_forum.php>View your topic</a>";<span class="s4"><br> </span>}<span class="s4"><br> </span>else{<span class="s4"><br> </span>echo "ERROR";<span class="s4"><br> </span>}<span class="s4"><br> </span>mysql_close();<span class="s4"><br> </span>?></p> </td> </tr> </tbody> </table> </body> </html> Thanks again!

    Read the article

  • PHP syntax error “unexpected $end”

    - by Jacksta
    I have 3 files 1) show_createtable.html 2) do_showfielddef.php 3) do_showtble.php 1) First file is for creating a new table for a data base, it is a fom with 2 inputs, Table Name and Number of Fields. THIS WORKS FINE! <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <h1>Step 1: Name and Number</h1> <form method="post" action="do_showfielddef.php" /> <p><strong>Table Name:</strong><br /> <input type="text" name="table_name" size="30" /></p> <p><strong>Number of fields:</strong><br /> <input type="text" name="num_fields" size="30" /></p> <p><input type="submit" name="submit" value="go to step2" /></p> </form> </body> </html> 2) this script validates fields and createa another form to enter all the table rows. This for also WORKS FINE! <?php //validate important input if ((!$_POST[table_name]) || (!$_POST[num_fields])) { header( "location: show_createtable.html"); exit; } //begin creating form for display $form_block = " <form action=\"do_createtable.php\" method=\"post\"> <input name=\"table_name\" type=\"hidden\" value=\"$_POST[table_name]\"> <table cellspacing=\"5\" cellpadding=\"5\"> <tr> <th>Field Name</th><th>Field Type</th><th>Table Length</th> </tr>"; //count from 0 until you reach the number fo fields for ($i = 0; $i <$_POST[num_fields]; $i++) { $form_block .=" <tr> <td align=center><input type=\"texr\" name=\"field name[]\" size=\"30\"></td> <td align=center> <select name=\"field_type[]\"> <option value=\"char\">char</option> <option value=\"date\">date</option> <option value=\"float\">float</option> <option value=\"int\">int</option> <option value=\"text\">text</option> <option value=\"varchar\">varchar</option> </select> </td> <td align=center><input type=\"text\" name=\"field_length[]\" size=\"5\"> </td> </tr>"; } //finish up the form $form_block .= " <tr> <td align=center colspan=3><input type =\"submit\" value=\"create table\"> </td> </tr> </table> </form>"; ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Create a database table: Step 2</title> </head> <body> <h1>defnie fields for <? echo "$_POST[table_name]"; ?> </h1> <? echo "$form_block"; ?> </body> </html> Problem is here 3) this form creates the tables and enteres them into the database. I am getting an error on line 37 "Parse error: syntax error, unexpected $end in /home/admin/domains/domaina.com.au/public_html/do_createtable.php on line 37" <? $db_name = "testDB"; $connection = @mysql_connect("localhost", "admin_user", "pass") or die(mysql_error()); $db = @mysql_select_db($db_name, $connection) or die(mysql_error()); $sql = "CREATE TABLE $_POST[table_name]("; for ($i = 0; $i < count($_POST[field_name]); $i++) { $sql .= $_POST[field_name][$i]." ".$_POST[field_type][$i]; if ($_POST[field_length][$i] !="") { $sql .=" (".$_POST[field_length][$i]."),"; } else { $sql .=","; } $sql = substr($sql, 0, -1); $sql .= ")"; $result = mysql_query($sql, $connection) or die(mysql_error()); if ($result) { $msg = "<p>" .$_POST[table_name]." has been created!</p>"; ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Create A Database Table: Step 3</title> </head> <body> <h1>Adding table to <? echo "$db_name"; ?>...</h1> <? echo "$msg"; ?> </body> </html>

    Read the article

  • Unexpected ArrayIndexOutOfBoundsException in JavaFX application, refering to no array

    - by Eugene
    I have the following code: public void setContent(Importer3D importer) { if (DEBUG) { System.out.println("Initialization of Mesh's arrays"); } coords = importer.getCoords(); texCoords = importer.getTexCoords(); faces = importer.getFaces(); if (DEBUG) { System.out.println("Applying Mesh's arrays"); } mesh = new TriangleMesh(); mesh.getPoints().setAll(coords); mesh.getTexCoords().setAll(texCoords); mesh.getFaces().setAll(faces); if (DEBUG) { System.out.println("Initialization of the material"); } initMaterial(); if (DEBUG) { System.out.println("Setting the MeshView"); } meshView.setMesh(mesh); meshView.setMaterial(material); meshView.setDrawMode(DrawMode.FILL); if (DEBUG) { System.out.println("Adding to 3D scene"); } root3d.getChildren().clear(); root3d.getChildren().add(meshView); if (DEBUG) { System.out.println("3D model is ready!"); } } The Imporeter3D class part: private void load(File file) { stlLoader = new STLLoader(file); } public float[] getCoords() { return stlLoader.getCoords(); } public float[] getTexCoords() { return stlLoader.getTexCoords(); } public int[] getFaces() { return stlLoader.getFaces(); } The STLLoader: public class STLLoader{ public STLLoader(File file) { stlFile = new STLFile(file); loadManager = stlFile.loadManager; pointsArray = new PointsArray(stlFile); texCoordsArray = new TexCoordsArray(); } public float[] getCoords() { return pointsArray.getPoints(); } public float[] getTexCoords() { return texCoordsArray.getTexCoords(); } public int[] getFaces() { return pointsArray.getFaces(); } private STLFile stlFile; private PointsArray pointsArray; private TexCoordsArray texCoordsArray; private FacesArray facesArray; public SimpleBooleanProperty finished = new SimpleBooleanProperty(false); public LoadManager loadManager;} PointsArray file: public class PointsArray { public PointsArray(STLFile stlFile) { this.stlFile = stlFile; initPoints(); } private void initPoints() { ArrayList<Double> pointsList = stlFile.getPoints(); ArrayList<Double> uPointsList = new ArrayList<>(); faces = new int[pointsList.size()*2]; int n = 0; for (Double d : pointsList) { if (uPointsList.indexOf(d) == -1) { uPointsList.add(d); } faces[n] = uPointsList.indexOf(d); faces[++n] = 0; n++; } int i = 0; points = new float[uPointsList.size()]; for (Double d : uPointsList) { points[i] = d.floatValue(); i++; } } public float[] getPoints() { return points; } public int[] getFaces() { return faces; } private float[] points; private int[] faces; private STLFile stlFile; public static boolean DEBUG = true; } And STLFile: ArrayList<Double> coords = new ArrayList<>(); double temp; private void readV(STLParser parser) { for (int n = 0; n < 3; n++) { if(!(parser.ttype==STLParser.TT_WORD && parser.sval.equals("vertex"))) { System.err.println("Format Error:expecting 'vertex' on line " + parser.lineno()); } else { if (parser.getNumber()) { temp = parser.nval; coords.add(temp); if(DEBUG) { System.out.println("Vertex:"); System.out.print("X=" + temp + " "); } if (parser.getNumber()) { temp = parser.nval; coords.add(temp); if(DEBUG) { System.out.print("Y=" + temp + " "); } if (parser.getNumber()) { temp = parser.nval; coords.add(temp); if(DEBUG) { System.out.println("Z=" + temp + " "); } readEOL(parser); } else System.err.println("Format Error: expecting coordinate on line " + parser.lineno()); } else System.err.println("Format Error: expecting coordinate on line " + parser.lineno()); } else System.err.println("Format Error: expecting coordinate on line " + parser.lineno()); } if (n < 2) { try { parser.nextToken(); } catch (IOException e) { System.err.println("IO Error on line " + parser.lineno() + ": " + e.getMessage()); } } } } public ArrayList<Double> getPoints() { return coords; } As a result of all of this code, I expected to get 3d model in MeshView. But the present result is very strange: everything works and in DEBUG mode I get 3d model is ready! from setContent(), and then unexpected ArrayIndexOutOfBoundsException: File readed Initialization of Mesh's arrays Applying Mesh's arrays Initialization of the material Setting the MeshView Adding to 3D scene 3D model is ready! java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 32252 at com.sun.javafx.collections.ObservableFloatArrayImpl.rangeCheck(ObservableFloatArrayImpl.java:276) at com.sun.javafx.collections.ObservableFloatArrayImpl.get(ObservableFloatArrayImpl.java:184) at javafx.scene.shape.TriangleMesh.computeBounds(TriangleMesh.java:262) at javafx.scene.shape.MeshView.impl_computeGeomBounds(MeshView.java:151) at javafx.scene.Node.updateGeomBounds(Node.java:3497) at javafx.scene.Node.getGeomBounds(Node.java:3450) at javafx.scene.Node.getLocalBounds(Node.java:3432) at javafx.scene.Node.updateTxBounds(Node.java:3510) at javafx.scene.Node.getTransformedBounds(Node.java:3350) at javafx.scene.Node.updateBounds(Node.java:516) at javafx.scene.Parent.updateBounds(Parent.java:1668) at javafx.scene.SubScene.updateBounds(SubScene.java:556) at javafx.scene.Parent.updateBounds(Parent.java:1668) at javafx.scene.Parent.updateBounds(Parent.java:1668) at javafx.scene.Parent.updateBounds(Parent.java:1668) at javafx.scene.Parent.updateBounds(Parent.java:1668) at javafx.scene.Parent.updateBounds(Parent.java:1668) at javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2309) at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:329) at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:479) at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:459) at com.sun.javafx.tk.quantum.QuantumToolkit$13.run(QuantumToolkit.java:326) at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95) at com.sun.glass.ui.win.WinApplication._runLoop(Native Method) at com.sun.glass.ui.win.WinApplication.access$300(WinApplication.java:39) at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:101) at java.lang.Thread.run(Thread.java:724) Exception in thread "JavaFX Application Thread" java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 32252 at com.sun.javafx.collections.ObservableFloatArrayImpl.rangeCheck(ObservableFloatArrayImpl.java:276) at com.sun.javafx.collections.ObservableFloatArrayImpl.get(ObservableFloatArrayImpl.java:184) The stranger thing is that this stack doesn't stop until I close the program. And moreover it doesn't point to any my array. What is this? And why does it happen?

    Read the article

  • Syntax error, unexpected '}' wordpress error

    - by Zach Johnson
    Hello I am not a PHP programmer so I have no idea what the problem is here. Basiclly I am trying to use a wordpress theme but I get this error The Parse error: syntax error, unexpected '}' in / home/a5618915/public_html/photo/wp-content/themes/iphoto/functions.php on line 1 I have no Idea what exactly is wrong in the php file. The code for the functions.php is below. If someone could point out whats wrong I would be really grateful. <?php define('THEME_NAME','iphoto'); load_theme_textdomain( THEME_NAME,TEMPLATEPATH .'/languages'); add_custom_background(); add_theme_support( 'automatic-feed-links' ); add_theme_support( 'post-formats', array( 'video')); if ( function_exists('register_nav_menus') ) { register_nav_menus(array('primary' => 'header')); } add_action('wp_ajax_b_ajax_post_action', 'b_ajax_callback'); function b_ajax_callback() { global $wpdb; if(isset($_POST['type']) && $_POST['type'] == 'upload') { $clickedID = $_POST['data']; $filename = $_FILES[$clickedID]; $filename['name'] = preg_replace('/[^a-zA-Z0-9._-]/', '', $filename['name']); $override['test_form'] = false; $override['action'] = 'wp_handle_upload'; $uploaded_file = wp_handle_upload($filename,$override); $upload_tracking[] = $clickedID; update_option($clickedID, $uploaded_file['url'] ); if(!empty($uploaded_file['error'])) {echo 'Upload Error: ' . $uploaded_file['error']; } else { echo $uploaded_file['url']; } } die(); } function post_thumbnail($a){ global $post; $post_img = ''; ob_start(); ob_end_clean(); $output = preg_match_all('/\<img.+?src="(.+?)".*?\/>/is',$post->post_content,$matches ,PREG_SET_ORDER); $cnt = count( $matches ); if($a==1){ if($cnt>0){ if($cnt>1){ if($cnt>3) $cnt=3; for($i=0;$i<$cnt;$i++){ $post_current = $i+1; $post_img_src = $matches[$i][1]; if($i==0){$post_spans .= '<span class="current">'.$post_current.'</span>';}else{ $post_spans .= '<span>'.$post_current.'</span>'; } $post_imgs .='<img src="'.get_bloginfo('template_url').'/timthumb.php?src='.$post_img_src.'&amp;w=285&amp;zc=1" />'; } $post_img = $post_imgs.'<span class="imgNav">'.$post_spans.'</span>'; }else{ $post_img_src = $matches [0][1]; $post_img = '<img src="'.get_bloginfo('template_url').'/timthumb.php?src='.$post_img_src.'&amp;w=285&amp;zc=1" />'; } echo $post_img; } }else{ return $cnt; } } function post_content_thumbnail($c) { if(is_single()){ $c = preg_replace('/\width="*".+?height="*"/i', '', $c); $s = array('/src="(.+?.(jpg|bmp|png|jepg|gif))".+?/i' => 'src="'.get_bloginfo("template_url").'/timthumb.php?src=$1&amp;h=440&amp;zc=1"'); foreach($s as $p => $r){ $c = preg_replace($p,$r,$c); } return $c; } } add_filter( 'the_content', 'post_content_thumbnail' ); function ajax_post(){ if( isset($_GET['action'])&& $_GET['action'] == 'ajax_post'){ if(isset($_GET['cat'])){ $args = array( 'category_name' => $_GET['cat'], 'paged' => $_GET['pag'] ); }else if(isset($_GET['pag'])){ $args = array( 'paged' => $_GET['pag'] ); } query_posts($args); if(have_posts()){while (have_posts()):the_post();?> <?php get_template_part( 'content', get_post_format() ); ?> <?php endwhile;} die(); }else{return;} } add_action('init', 'ajax_post'); function pagenavi( $p = 2 ) { if ( is_singular() ) return; global $wp_query,$paged; $max_page = $wp_query->max_num_pages; if ( $max_page == 1 ){ echo '<span id="post-current">1</span> / <span id="post-count">1</span>'; return; } if ( empty( $paged ) ) $paged = 1; if ( $paged >1 ) echo "<a id='prev' title='Prev' href='",esc_html( get_pagenum_link( $paged -1 ) ),"'>&lt;&lt;</a> "; echo '<span id="post-current">'.$paged .'</span> / <span id="post-count">'.$max_page .'</span>'; if ( $paged <$max_page ) echo "<a id='next' title='Next' href='",esc_html( get_pagenum_link( $paged +1) ),"'>&gt;&gt;</a> "; } function iphoto_comment($comment,$args,$depth) { $GLOBALS['comment'] = $comment; ;echo ' <li ';comment_class();;echo ' id="li-comment-';comment_ID() ;echo '" > <div id="comment-';comment_ID();;echo '" class="comment-body"> <div class="commentmeta">';echo get_avatar( $comment->comment_author_email,$size = '48');;echo '</div> ';if ($comment->comment_approved == '0') : ;echo ' <em>';_e('Your comment is awaiting moderation.') ;echo '</em><br /> ';endif;;echo ' <div class="commentmetadata">&nbsp;-&nbsp;';printf(__('%1$s %2$s'),get_comment_date('Y.n.d'),get_comment_time('G:i'));;echo '</div> <div class="reply">';comment_reply_link(array_merge( $args,array('depth'=>$depth,'max_depth'=>$args['max_depth'],'reply_text'=>__('Reply')))) ;echo '</div> <div class="vcard">';printf(__('%s'),get_comment_author_link()) ;echo '</div> ';comment_text() ;echo ' </div> '; } add_action('admin_init', 'iphoto_init'); function iphoto_init() { if (isset($_GET['page']) && $_GET['page'] == 'functions.php') { $dir = get_bloginfo('template_directory'); wp_enqueue_script('adminjquery', $dir . '/includes/admin.js', false, '1.0.0', false); wp_enqueue_style('admincss', $dir . '/includes/admin.css', false, '1.0.0', 'screen'); } } add_action('admin_menu','iphoto_page'); function iphoto_page (){ if ( count($_POST) >0 &&isset($_POST['iphoto_settings']) ){ $options = array ('keywords','description','analytics','lib','views','noajax','animate','phzoom','copyright'); foreach ( $options as $opt ){ delete_option ( 'iphoto_'.$opt,$_POST[$opt] ); add_option ( 'iphoto_'.$opt,$_POST[$opt] ); } } add_theme_page('iPhoto '.__('Theme Options',THEME_NAME),__('Theme Options',THEME_NAME),'edit_themes',basename(__FILE__),'iphoto_settings'); } function iphoto_settings(){?> <div class="wrap"> <div> <h2><?php _e( 'iPhoto Theme Options<span>Version: ',THEME_NAME);?><?php $theme_data=get_theme_data(TEMPLATEPATH . '/style.css'); echo $theme_data['Version'];?></span></h2> </div> <div class="clear"></div> <form method="post" action=""> <div id="theme-Option"> <div id="theme-menu"> <span class="m1"><?php _e( 'jQuery Effect',THEME_NAME);?></span> <span class="m2"><?php _e( 'Relative Plugins',THEME_NAME);?></span> <span class="m3"><?php _e( 'Website Information',THEME_NAME);?></span> <span class="m4"><?php _e( 'Analytics Code',THEME_NAME);?></span> <span class="m5"><?php _e( 'Footer Copyright',THEME_NAME);?></span> <span class="m6"><?php _e( 'iPhoto Theme Declare',THEME_NAME);?></span> <div class="clear"></div> </div> <div id="theme-content"> <ul> <li> <tr><td> <em><?php _e( 'iPhoto use jquery 1.4.4 which contained in this theme, you can also use the Google one instead.',THEME_NAME);?></em><br/> <label><input name="lib" type="checkbox" id="lib" value="1" <?php if (get_option('iphoto_lib')!='') echo 'checked="checked"' ;?>/><?php _e( 'Load the jQuery Library supported by Google',THEME_NAME);?></label><br/><br/> </td></tr> <tr><td> <em><?php _e( 'Index page infinite loading posts.',THEME_NAME);?></em><br/> <label><input name="noajax" type="checkbox" id="noajax" value="1" <?php if (get_option('iphoto_noajax')!='') echo 'checked="checked"' ;?>/><?php _e( 'Deactivate the Infinite loading posts',THEME_NAME);?></label><br/><br/> </td></tr> <tr><td> <em><?php _e( '<strong>Animation of relayout elements</strong>',THEME_NAME);?></em><br /> <input name="animate" type="checkbox" id="animate" value="1" <?php if (get_option('iphoto_animate')!='') echo 'checked="checked"';?>/><?php _e( 'Deactivate animation effect on index page',THEME_NAME);?> </td></tr> </li> <li> <tr><td> <em><?php _e( 'WP-PostViews, Enables you to display how many times a post/page had been viewed.',THEME_NAME);?></em><br/> <label><input name="views" type="checkbox" id="views" value="1" <?php if (get_option('iphoto_views')!='') echo 'checked="checked"' ?>/><?php _e( 'Activate WP-PostViews',THEME_NAME);?></label><br/><br/> </td></tr> </li> <li> <tr><td> <?php _e( '<em>Keywords, separate by English commas. like MuFeng, Computer, Software</em>',THEME_NAME);?><br/> <textarea name="keywords" id="keywords" rows="1" cols="70" style="font-size:11px;width:100%;"><?php echo get_option('iphoto_keywords');?></textarea><br/> </td></tr> <tr><td> <?php _e( '<em>Description, explain what\'s this site about. like MuFeng, Breathing the wind</em>',THEME_NAME);?><br/> <textarea name="description" id="description" rows="3" cols="70" style="font-size:11px;width:100%;"><?php echo get_option('iphoto_description');?></textarea> </td></tr> </li> <li> <tr><td> <?php _e( 'You can get your Google Analytics code <a target="_blank" href="https://www.google.com/analytics/settings/check_status_profile_handler">here</a>.',THEME_NAME);?></label><br> <textarea name="analytics" id="analytics" rows="5" cols="70" style="font-size:11px;width:100%;"><?php echo stripslashes(get_option('iphoto_analytics'));?></textarea> </td></tr> </li> <li> <tr><td> <textarea name="copyright" id="copyright" rows="5" cols="70" style="font-size:11px;width:100%;"><?php if(stripslashes(get_option('iphoto_copyright'))!=''){echo stripslashes(get_option('iphoto_copyright'));}else{echo 'Copyright &copy; '.date('Y').' '.'<a href="'.home_url( '/').'" title="'.esc_attr( get_bloginfo( 'name') ).'">'.esc_attr( get_bloginfo( 'name') ).'</a> All rights reserved'; };?></textarea> <br/><em><?php _e( '<b>Preview</b>',THEME_NAME);?><span> : </span><span><?php if(stripslashes(get_option('iphoto_copyright'))!=''){echo stripslashes(get_option('iphoto_copyright'));}else{echo 'Copyright &copy; '.date('Y').' '.'<a href="'.home_url( '/').'" title="'.esc_attr( get_bloginfo( 'name') ).'">'.esc_attr( get_bloginfo( 'name') ).'</a> All rights reserved'; };?></span></em> </td></tr> </li> <li> <tr><td> <p><?php _e('iPhoto is created, developed and maintained by <a href="http://mufeng.me/">MuFeng</a>. If you like iPhoto, please donate. It will help in developing new features and versions.',THEME_NAME);?><?php _e('Alipay',THEME_NAME);?>:</strong> <a href="http://www.alipay.com" target="_blank" title="Alipay">[email protected]</a></p> <h3 style="color:#333" id="introduce"><?php _e( 'Introduction',THEME_NAME);?></h3> <p style="text-indent: 2em;margin:10px 0;"><?php _e( 'iPhoto is evolved from one theme of Tumblr and turned it into a photo theme which can be used at wordpress.',THEME_NAME);?></p> <h3 style="color:#333"><?php _e( 'Published Address',THEME_NAME);?></h3> <p id="release" style="text-indent: 2em;margin:10px 0;"><a href="http://mufeng.me/wordpress-theme-iphoto.html" target="_blank">http://mufeng.me/wordpress-theme-iphoto.html</a></p> <h3 style="color:#333"><?php _e( 'Preview Address',THEME_NAME);?></h3> <p id="preview" style="text-indent: 2em;margin:10px 0;"><a href="http://mufeng.me/photo/" target="_blank">http://mufeng.me/photo/</a></p> <h3 style="color:#333" id="bug"><?php _e( 'Report Bugs',THEME_NAME);?></h3> <p style="text-indent: 2em;margin:10px 0;"><?php _e( 'Weibo <a href="http://weibo.com/meapo" target="_blank">@mufeng.me</a> or leave a message at <a href="http://mufeng.me" target="_blank">http://mufeng.me</a>?',THEME_NAME);?></p> </td></tr> </li> </ul> </div> </div> <p class="submit"> <input type="submit" name="Submit" class="button-primary" value="<?php _e( 'Save Options',THEME_NAME);?>" /> <input type="hidden" name="iphoto_settings" value="save" style="display:none;" /> </p> </form> </div> <?php } ?>

    Read the article

  • jQuery show "loading" during slow operation

    - by The Disintegrator
    I'm trying to show a small loading image during a slow operation with jQuery and can't get it right. It's a BIG table with thousands of rows. When I check the "mostrarArticulosDeReferencia" checkbox it removes the "hidden" class from these rows. This operation takes a couple of seconds and I want to give some feedback. "loading" is a div with a small animated gif Here's the full code jQuery(document).ready(function() { jQuery("#mostrarArticulosDeReferencia").click(function(event){ if( jQuery("#mostrarArticulosDeReferencia").attr("checked") ) { jQuery("#loading").show(); //not showing jQuery("#listadoArticulos tr.r").removeClass("hidden"); //slow operation jQuery("#loading").hide(); } else { jQuery("#loading").show(); //not showing jQuery("#listadoArticulos tr.r").addClass("hidden"); //slow operation jQuery("#loading").hide(); } }); jQuery("#loading").hide(); }); It looks like jquery is "optimizing" those 3 lines jQuery("#loading").show(); //not showing jQuery("#listadoArticulos tr.r").removeClass("hidden"); jQuery("#loading").hide(); And never shows the loading div. Any Ideas? Bonus: There is a faster way of doing this show/hide thing? Found out that toggle is WAY slower. UPDATE: I tried this jQuery("#mostrarArticulosDeReferencia").click(function(event){ if( jQuery("#mostrarArticulosDeReferencia").attr("checked") ) { jQuery("#loading").show(); //not showing jQuery("#listadoArticulos tr.r").removeClass("hidden"); //slow operation setTimeout("jQuery('#loading').hide()", 1000); } else { jQuery("#loading").show(); //not showing jQuery("#listadoArticulos tr.r").addClass("hidden"); //slow operation setTimeout("jQuery('#loading').hide()", 1000); } }); That's what I get click on checkbox nothing happens during 2/3 secs (processing) page gets updated loading div shows up during a split second UPDATE 2: I've got a working solution. But WHY I have to use setTimeout to make it work is beyond me... jQuery("#mostrarArticulosDeReferencia").click(function(event){ if( jQuery("#mostrarArticulosDeReferencia").attr("checked") ) { jQuery("#loading").show(); setTimeout("jQuery('#listadoArticulos tr.r').removeClass('hidden');", 1); setTimeout("jQuery('#loading').hide()", 1); } else { jQuery("#loading").show(); setTimeout("jQuery('#listadoArticulos tr.r').addClass('hidden');", 1); setTimeout("jQuery('#loading').hide()", 1); } });

    Read the article

  • IF Statement has strange behavior

    - by BSchlinker
    I've developed a 'custom' cout, so that I can display text to console and also print it to a log file. This cout class is passed a different integer on initialization, with the integer representing the verbosity level of the message. If the current verbosity level is greater then or equal to the verbosity level of the message, the message should print. The problem is, I have messages printing even when the current verbosity level is too low. I went ahead and debugged it, expecting to find the problem. Instead, I found multiple scenarios where my if statements are not working as expected. The statement if(ilralevel_passed <= ilralevel_set) will sometimes proceed even if ilralevel_set is LESS then ilralevel_passed. You can see this behavior in the following picture (my apologizes for using Twitpic) http://twitpic.com/1xtx4g/full. Notice how ilralevel_set is equal to zero, and ilralevel_passed is equal to one. Yet, the if statement has returned true and is now moving forward to pass the line to cout. I've never seen this type of behavior before and I'm not exactly sure how to proceed debugging it. I'm not able to isolate the behavior either -- it only occurs in certain parts of my program. Any suggestions are appreciated as always. // Here is an example use of the function: // ilra_status << setfill('0') << setw(2) << dispatchtime.tm_sec << endl; // ilra_warning << "Dispatch time (seconds): " << mktime(&dispatchtime) << endl; // Here is the 'custom' cout function: #ifndef ILRA_H_ #define ILRA_H_ // System libraries #include <iostream> #include <ostream> #include <sstream> #include <iomanip> // Definitions #define ilra_talk ilra(__FUNCTION__,0) #define ilra_update ilra(__FUNCTION__,0) #define ilra_error ilra(__FUNCTION__,1) #define ilra_warning ilra(__FUNCTION__,2) #define ilra_status ilra(__FUNCTION__,3) // Statics static int ilralevel_set = 0; static int ilralevel_passed; // Classes class ilra { public: // constructor / destructor ilra(const std::string &funcName, int toset) { ilralevel_passed = toset; } ~ilra(){}; // enable / disable irla functions static void ilra_verbose_level(int toset){ ilralevel_set = toset; } // output template <class T> ilra &operator<<(const T &v) { if(ilralevel_passed <= ilralevel_set) std::cout << v; return *this; } ilra &operator<<(std::ostream&(*f)(std::ostream&)) { if(ilralevel_passed <= ilralevel_set) std::cout << *f; return *this; } }; // end of the class #endif /* ILRA_H_ */

    Read the article

  • volatile keyword seems to be useless?

    - by Finbarr
    import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicInteger; public class Main implements Runnable { private final CountDownLatch cdl1 = new CountDownLatch(NUM_THREADS); private volatile int bar = 0; private AtomicInteger count = new AtomicInteger(0); private static final int NUM_THREADS = 25; public static void main(String[] args) { Main main = new Main(); for(int i = 0; i < NUM_THREADS; i++) new Thread(main).start(); } public void run() { int i = count.incrementAndGet(); cdl1.countDown(); try { cdl1.await(); } catch (InterruptedException e1) { e1.printStackTrace(); } bar = i; if(bar != i) System.out.println("Bar not equal to i"); else System.out.println("Bar equal to i"); } } Each Thread enters the run method and acquires a unique, thread confined, int variable i by getting a value from the AtomicInteger called count. Each Thread then awaits the CountDownLatch called cdl1 (when the last Thread reaches the latch, all Threads are released). When the latch is released each thread attempts to assign their confined i value to the shared, volatile, int called bar. I would expect every Thread except one to print out "Bar not equal to i", but every Thread prints "Bar equal to i". Eh, wtf does volatile actually do if not this?

    Read the article

  • If unexpected database changes cause you problems – we can help!

    - by Chris Smith
    Have you ever been surprised by an unexpected difference between you database environments? Have you ever found that your Staging database is not the same as your Production database, even though it was the week before? Has an emergency hotfix suddenly appeared in Production over the weekend without your knowledge? Has your client secretly added a couple of indices to their local version of the database to aid performance? Worse still, has a developer ever accidently run a SQL script against the wrong database without noticing their mistake? If you’ve answered “Yes” to any of the above questions then you’ve suffered from ‘drift’. Database drift is where the state of a database (schema, particularly) has moved away from its expected or official state over time. The upshot is that the database is in an unknown or poorly-understood state. Even if these unexpected changes are not destructive, drift can be a big problem when it’s time to release a new version of the database. A deployment to a target database in an unexpected state can error and fail, potentially delaying a vital, time-sensitive update. A big issue with drift is that it can be hard to spot and it can be even harder to determine its provenance. So, before you can deal with an issue caused by drift, you’ll need to know exactly what change has been made, who made it, when they made it and why they made it. Those questions can take a lot of effort to answer. Then you actually need to decide what to do. Do you rollback the change because it was bad? Retrospectively apply it to the Staging environment because it is a required change? Or script the change into version control to get it back in line with your process? Red Gate’s Database Delivery Team have been talking to DBAs, database consultants and database developers to explore the problem of drift. We’ve started to get a really good idea of how big a problem it can be and what database professionals need to know and do, in order to deal with it.  It’s fair to say, we’re pretty excited at the prospect of creating a tool that will really help and we’ve got some great feedback on our initial ideas (see image below).   We’re now well underway with the development of our new drift-spotting product – SQL Lighthouse – and we hope to have a beta release out towards the end of July. What we really need is your help to shape the product into a great tool. So, if database drift is a problem that you’d like help solving and are interested in finding out more about our product, join our mailing list to register your interest in trying out the beta release. Subscribe to our mailing list

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >