Search Results

Search found 11178 results on 448 pages for 'syntax checking'.

Page 51/448 | < Previous Page | 47 48 49 50 51 52 53 54 55 56 57 58  | Next Page >

  • is this valid json array using php

    - by Rich
    Hello, I need to convert some code done by someone else, to work in my mvc model It is using some functions like EOD that I don't understand. Does that still work in a class? Primarely, my question focusus on the json output. The old code does not use the php json_encode function, but outputs it directly like this ?> { "username": "<?php echo $_SESSION['username'];?>", "items": [ <?php echo $items;?> ] } <?php I would do it like this, but I need to be sure it's right for the items part header('Content-type: application/json'); $output = array("username"=> isset( $_SESSION['username'] ) ? $_SESSION['username'] : "?", "items"=>$items ); $this->content = json_encode($output); This is some background on how the $items is made. An item is stored like this: $_SESSION['chatHistory'][$_POST['to']] .= <<<EOD { "s": "1", "f": "{$to}", "m": "{$messagesan}" }, EOD; and it is put in the $items variable like this $items = ''; if ( !empty($_SESSION['openChatBoxes'] ) ) { foreach ( $_SESSION['openChatBoxes'] as $chatbox => $void ) { $items .= $this->chatBoxSession($chatbox); } } //The chatBoxSession() function takes an item from the $_SESSION['chatHistory'] array and returns it. I hope this was somewhat clear enough? The php manual warns that in some cases you don't get an array output, instead you get an object. So, with the EOD syntax, I am not really sure. It could save me some time if I know some things are doing what they supposed too, and giving the right output. thanks, Richard

    Read the article

  • SyntaxHighlighter and Line Break Tags

    - by azamsharp
    I am using the following syntax highligher: http://alexgorbatchev.com/wiki/SyntaxHighlighter For some reason when it encounter <br> it simply prints out <br> tags. I cannot replace the whole thing with System.Environment.NewLine since it will mess up the complete description. Here is my code: public static string GetDescription(string description) { string codeStartPattern = "&lt;code&gt;"; string codeEndPattern = "&lt;/code&gt;"; Regex reg = new Regex(codeStartPattern); description = reg.Replace(description, ReplaceWithStartDiv); reg = new Regex(codeEndPattern); description = reg.Replace(description, ReplaceWithEndDiv); return description; } private static string ReplaceWithStartDiv(Match m) { return "<script type='syntaxhighlighter' class='brush: csharp'><![CDATA["; } private static string ReplaceWithEndDiv(Match m) { return "]]></script>"; } I guess I only need to replace <br> with System.Environment.Newline with the code that is between the <code> snippet here </code> Thanks!

    Read the article

  • Issue using GAE appcfg.py

    - by JustSmith
    I get nothing out of appcfg.py besides the default output. I'm trying to upload some data to my development project with no luck at at all. From the instructions on the Google App Engine page the steps are as follows: Edit app.yaml update with appcfg.py make upload script upload with appcfg.py After step one I try to run the update and it never shows any success. The following commands product the same output: appcfg.py appcfg.py update appDir appcfg.py update appDir/ appcfg.py update /appDir If i try to follow the instructions from the appcfg.py output and type help upload and get: "help <action>" I get a response from the system, This command is not supported by the help utility. Try "update /?". cause I'm calling the system help command. If I use the command appcfg.py help upload I get the same result as just typing appcfg.py Can someone show me examples of the syntax to update the dev site, upload data to it and get appcfg.py to actually give help on its commands? Also I'm just assuming that the upload script and the .csv file that are being uploaded are in they myApp directory. Appreciate any help,

    Read the article

  • Workaround for basic syntax not being parsed.

    - by Mark Tomlin
    I want to have a class property that allow for an expression to take place on the right side of the equals sign. All versions of PHP choke on the following code, but it is written in this way to allow for easier extendibility in the future. /* Example SDK Class */ class SDK { /* Runtime Option Flags */ // Strings # 0: Makes no change to the strings. var $STRING_NONE = (1 << 0); # 1: Removes color codes from the string. var $STRING_STRIP_COLOR = (1 << 1); # 2: Removes language codes from the string. var $STRING_STRIP_LANG = (1 << 2); # 3: Removes all formatting from the string. var $STRING_STRIP = SELF::STRING_STRIP_COLOR & SELF::STRING_STRIP_LANG; # 4: Converts color codes to HTML & UTF-8. var $STRING_HTML = (1 << 3); # 8: Converts color codes to ECMA-48 escape color codes & UTF-8. var $STRING_CONSOLE = (1 << 4); # 16: Changes player names only. var $STRING_NAMES = (1 << 5); # 32: Changes host names only. var $STRING_HOSTS = (1 << 6); function SDK($fString = SELF::STRING_HTML & SELF::STRING_NAMES & SELF_HOST) { // constructor code. } } $SDK &= new SDK(SDK::STRING_NONE); (1 << 0) seems like very basic syntax to me, and is not fathomable why PHP would not allow for such a thing. Can anyone think of a work around that would maintain readability and future expandability of the following code?

    Read the article

  • Why avoid increment ("++") and decrement ("--") operators in JavaScript?

    - by artlung
    I'm a big fan of Douglas Crockford's writing on JavaScript, particularly his book JavaScript: The Good Parts. It's made me a better JavaScript programmer and a better programmer in general. One of his tips for his jslint tool is this : ++ and -- The ++ (increment) and -- (decrement) operators have been known to contribute to bad code by encouraging excessive trickiness. They are second only to faulty architecture in enabling to viruses and other security menaces. There is a plusplus option that prohibits the use of these operators. This has always struck my gut as "yes, that makes sense," but has annoyed me when I've needed a looping condition and can't figure out a better way to control the loop than a while( a < 10 )do { a++ } or for (var i=0;i<10;i++) { } and use jslint. It's challenged me to write it differently. I also know in the distant past using things, in say PHP like $foo[$bar++] has gotten me in trouble with off-by-one errors. Are there C-like languages or other languages with similarities that that lack the "++" and "--" syntax or handle it differently? Are there other rationales for avoiding "++" and "--" that I might be missing? UPDATE -- April 9, 2010: In the video Crockford on JavaScript -- Part 5: The End of All Things, Douglas Crockford addresses the ++ issue more directly and with more detail. It appears at 1:09:00 in the timeline. Worth a watch.

    Read the article

  • strange syntax error in python, version 2.6 and 3.1

    - by flow
    this may not be an earth-shattering deficiency of python, but i still wonder about the rationale behind the following behavior: when i run source = """ print( 'helo' ) if __name__ == '__main__': print( 'yeah!' ) #""" print( compile( source, '<whatever>', 'exec' ) ) i get :: File "<whatever>", line 6 # ^ SyntaxError: invalid syntax i can avoid this exception by (1) deleting the trailing #; (2) deleting or outcommenting the if __name__ == '__main__':\n print( 'yeah!' ) lines; (3) add a newline to very end of the source. moreover, if i have the source end without a trailing newline right behind the print( 'yeah!' ), the source will also compile without error. i could also reproduce this behavior with python 2.6, so it’s not new to the 3k series. i find this error to be highly irritating, all the more since when i put above source inside a file and execute it directly or have it imported, no error will occur—which is the expected behavior. a # (hash) outside a string literal should always represent the start of a (possibly empty) comment in a python source; moreover, the presence or absence of a if __name__ == '__main__' clause should not change the interpretation of a soure on a syntactical level. can anyone reproduce the above problem, and/or comment on the phenomenon? cheers

    Read the article

  • Strange constructor

    - by Bilthon
    Well, I'm gonna be pretty straightforward here, I just have a piece of code in c++ which I'm not sure I really understand and need some help with. Ok, to simplify lets just say I have a class that is defined like this: (the real class is a little bit more complicated, but this is what matters) class myClass : public Runnable { Semaphore *m_pMySemaphore; __Queue<Requests> *m_pQueue; Request m_Request; VetorSlotBuffer *m_vetorSlotBuffer; } Up to here nothing is wrong, myClass is just a regular class which has 3 members that actually are pointers to other classes and an object of the class Request, the implementation of those classes not being important for my point here. Then when this person implemented the constructor for myClass he or she did this: myClass::myClass() : m_pMySemaphore(0), m_pQueue(0), m_vetorSlotBuffer(0) { } It's pretty evident that those three variables are treated like that by the constructor because they are pointers, am I right? but what kind of syntax is that? am I setting the pointers to null by doing that? I've seen a little bit of c++ already but never found something like that. And secondly, what's the deal with the ":" after the constructor declaration? that I've seen but never took the time to investigate. Is this like an inner class or something? Thank you very much in advance. Nelson R. Perez

    Read the article

  • Basic syntax for an animation loop?

    - by Moshe
    I know that jQuery, for example, can do animation of sorts. I also know that at the very core of the animation, there must me some sort of loop doing the animation. What is an example of such a loop? A complete answer should ideally answer the following questions: What is a basic syntax for an effective animation recursion that can animate a single property of a particular object at a time? The function should be able to vary its target object and property of the object. What arguments/parameters should it take? What is a good range of reiterating the loop? In milliseconds? (Should this be a parameter/argument to the function?) REMEMBER: The answer is NOT necessarily language specific, but if you are writing in a specific language, please specify which one. Error handling is a plus. {Nothing is more irritating (for our purposes) than an animation that does something strange, like stopping halfway through.} Thanks!

    Read the article

  • Ldap_add() : Invalid Syntax

    - by Suezy
    I have a program here that uses the ldap_add, when i try to run the program, it displays an error: Warning: ldap_add() [function.ldap-add]: Add: Invalid syntax in /var/www/suey/costcenter.20090617.php on line 780 My lil' code here is: $ldapservers='ourServer'; $ds = ldap_connect($ldapservers); if ($ds){ $r = ldap_bind($ds, $ldaprootun, $ldaprootpw); $add = ldap_add($ds, "uid=$fuid, $ldapbasedn", $infonew); } ldapbasedn is set to o=ourGroup; infonew is an array of entries (person information) and am so sure that the array is not empty because i already tested it. the uid is not empty too. What could be wrong? Is it the entries(array)? or the server am trying to connect to? I tried testing the ldap_bind, and it also works well too..hmmm.. Pls help.. thanks! I found the problem.. it's in the index infonew["createdBy"] = getenv("REMOTE_USER"); it returns NULL! now, is that right?

    Read the article

  • Simple jQuery code contains a syntax error that I can't find

    - by inkedmn
    I've got this (remarkably) simple JavaScript function that is called when a user clicks a "Cancel" link: function hideNewUserPanel(){ $('#create_user_panel').slideUp('slow'); $('.right_interior_panel').slideDown('slow'); } And the code to add the handler: $(function(){ $('#cancel_create_user_btn').live('click', function(){ hideNewUserPanel(); } }); Functionally, everything works as expected. Trouble is, when I click the "Cancel" link, Firebug shows an error in the console: uncaught exception: Syntax error, unrecognized expression: # I've stepped through the code several times and the error appears at some point before the call to hideNewUserPanel(). At the risk of sounding like one of "those programmers" (the kind that claim to have found a bug in GCC and assume their own code is perfect), the exception is being thrown from somewhere within jQuery proper, so I assume the issue is in there. I'm using jQuery 1.3.2 (this is a legacy project using many jQuery plugins that will break if we update to 1.4.x). Is there anything obviously wrong with my code that I'm simply not seeing? This code is, frankly, very simple and I don't really see what the issue could be. Thanks!

    Read the article

  • Troubleshooting "Parse error: syntax error, unexpected T_STRING" in echo statement

    - by dramaticlook
    I am back to php after like 5 years and I need help with the following please:) It keeps telling me the error: Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in header.php (in the first echo invoke) <?php $result = mysql_query("SELECT * FROM menu WHERE disabled=0 ORDER BY orderx ASC") or die(mysql_error()); $i=1; while($row = mysql_fetch_array($result)) { echo "<li class='sddm'.$i.' '.$row[extra].'"><a href="'.link_text($row[link]).'" onmouseover=\"mopen('m2')\" onmouseout=\"mclosetime()\">'.link_text($row[link]).'</a>"; echo "<div id='m2' onmouseover='mcancelclosetime()' onmouseout='mclosetime()'>"; echo "<a href='#'>ASP Dropdown</a>"; echo "<a href='#'>Pulldown menu</a>"; echo "<a href='#'>AJAX dropdown</a>"; echo "<a href='#'>DIV dropdown</a>"; echo "</div>"; echo "</li>"; <!--echo '<li class="sddm'.$i.' '.$row[extra].'"><a href="'.link_text($row[link]).'">'.$row[title.langfix()].'</a>';--> echo'</li>'; $i++; } ?>

    Read the article

  • Generate syntax tree for simple math operations

    - by M28
    I am trying to generate a syntax tree, for a given string with simple math operators (+, -, *, /, and parenthesis). Given the string "1 + 2 * 3": It should return an array like this: ["+", [1, ["*", [2,3] ] ] ] I made a function to transform "1 + 2 * 3" in [1,"+",2,"*",3]. The problem is: I have no idea to give priority to certain operations. My code is: function isNumber(ch){ switch (ch) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case '.': return true; break; default: return false; break; } } function generateSyntaxTree(text){ if (typeof text != 'string') return []; var code = text.replace(new RegExp("[ \t\r\n\v\f]", "gm"), ""); var codeArray = []; var syntaxTree = []; // Put it in its on scope (function(){ var lastPos = 0; var wasNum = false; for (var i = 0; i < code.length; i++) { var cChar = code[i]; if (isNumber(cChar)) { if (!wasNum) { if (i != 0) { codeArray.push(code.slice(lastPos, i)); } lastPos = i; wasNum = true; } } else { if (wasNum) { var n = Number(code.slice(lastPos, i)); if (isNaN(n)) { throw new Error("Invalid Number"); return []; } else { codeArray.push(n); } wasNum = false; lastPos = i; } } } if (wasNum) { var n = Number(code.slice(lastPos, code.length)); if (isNaN(n)) { throw new Error("Invalid Number"); return []; } else { codeArray.push(n); } } })(); // At this moment, codeArray = [1,"+",2,"*",3] return syntaxTree; } alert('Returned: ' + generateSyntaxTree("1 + 2 * 3"));

    Read the article

  • Lucene Query Syntax

    - by Don
    Hi, I'm trying to use Lucene to query a domain that has the following structure Student 1-------* Attendance *---------1 Course The data in the domain is summarised below Course.name Attendance.mandatory Student.name ------------------------------------------------- cooking N Bob art Y Bob If I execute the query "courseName:cooking AND mandatory:Y" it returns Bob, because Bob is attending the cooking course, and Bob is also attending a mandatory course. However, what I really want to query for is "students attending a mandatory cooking course", which in this case would return nobody. Is it possible to formulate this as a Lucene query? I'm actually using Compass, rather than Lucene directly, so I can use either CompassQueryBuilder or Lucene's query language. For the sake of completeness, the domain classes themselves are shown below. These classes are Grails domain classes, but I'm using the standard Compass annotations and Lucene query syntax. @Searchable class Student { @SearchableProperty(accessor = 'property') String name static hasMany = [attendances: Attendance] @SearchableId(accessor = 'property') Long id @SearchableComponent Set<Attendance> getAttendances() { return attendances } } @Searchable(root = false) class Attendance { static belongsTo = [student: Student, course: Course] @SearchableProperty(accessor = 'property') String mandatory = "Y" @SearchableId(accessor = 'property') Long id @SearchableComponent Course getCourse() { return course } } @Searchable(root = false) class Course { @SearchableProperty(accessor = 'property', name = "courseName") String name @SearchableId(accessor = 'property') Long id }

    Read the article

  • How to create an AST with ANTLR from a hierarchical key-value syntax

    - by Brabster
    I've been looking at parsing a key-value data format with ANTLR. Pretty straightforward, but the keys represent a hierarchy. A simplified example of my input syntax: /a/b/c=2 /a/b/d/e=3 /a/b/d/f=4 In my mind, this represents a tree structured as follows: (a (b (= c 2) (d (= e 3) (= f 4)))) The nearest I can get is to use the following grammar: /* Parser Rules */ start: (component NEWLINE?)* EOF -> (component)*; component: FORWARD_SLASH ALPHA_STRING component -> ^(ALPHA_STRING component) | FORWARD_SLASH ALPHA_STRING EQUALS value -> ^(EQUALS ALPHA_STRING value); value: ALPHA_STRING; /* Lexer Rules */ NEWLINE : '\r'? '\n'; ALPHA_STRING : ('a'..'z'|'A'..'Z'|'0'..'9')+; EQUALS : '='; FORWARD_SLASH : '/'; Which produces: (a (b (= c 2))) (a (b (d (= e 3)))) (a (b (d (= f 4)))) I'm not sure whether I'm asking too much from a generic tool such as ANTLR here, and this is as close I can get with this approach. That is, from here I consume the parts of the tree and create the data structure I want by hand. So - can I produce the tree structure I want directly from a grammar? If so, how? If not, why not - is it a technical limitation in ANTLR or is it something more CS-y to do with the type of language involved?

    Read the article

  • Interchange structured data between Haskell and C

    - by Eonil
    First, I'm a Haskell beginner. I'm planning integrating Haskell into C for realtime game. Haskell does logic, C does rendering. To do this, I have to pass huge complexly structured data (game state) from/to each other for each tick (at least 30 times per second). So the passing data should be lightweight. This state data may laid on sequential space on memory. Both of Haskell and C parts should access every area of the states freely. In best case, the cost of passing data can be copying a pointer to a memory. In worst case, copying whole data with conversion. I'm reading Haskell's FFI(http://www.haskell.org/haskellwiki/FFICookBook#Working_with_structs) The Haskell code look specifying memory layout explicitly. I have a few questions. Can Haskell specify memory layout explicitly? (to be matched exactly with C struct) Is this real memory layout? Or any kind of conversion required? (performance penalty) If Q#2 is true, Any performance penalty when the memory layout specified explicitly? What's the syntax #{alignment foo}? Where can I find the document about this? If I want to pass huge data with best performance, how should I do that? *PS Explicit memory layout feature which I said is just C#'s [StructLayout] attribute. Which is specifying in-memory position and size explicitly. http://www.developerfusion.com/article/84519/mastering-structs-in-c/ I'm not sure Haskell has matching linguistic construct matching with fields of C struct.

    Read the article

  • Parse error: syntax error, unexpected ';'

    - by sufoid
    Hallo I have this script: <? require("lib2/config.inc.php"); require("lib2/tpl.class.php"); require("lib2/db.class.php"); require("lib2/um.class.php"); $tpl = new template("templates", "tpl"); $db = new db($db['location'], $db['username'], $db['passwort'], $db['database']); $um = new usermanagment(); /** User login **/ $checklogin = $um->check_login(); $userdata = $um->getuserdata(); if(!$checklogin && !$guest) { header("LOCATION: ./index2.php"); } eval("\$header .= \" ".$tpl->get("header")."\";"); eval("\$footer .= \" ".$tpl->get("footer")."\";"); $time = time(); $db->Query("UPDATE userdaten SET lastaction = '$time' WHERE userid = '".$userdata['userid']."'"); ?> And get this error: Parse error: syntax error, unexpected ';' in /home/httpd/html/login/global.php(22) : eval()'d code on line 96 Any ideas?

    Read the article

  • How are property assignment expressions handled in C#?

    - by Serious
    In C# you can use a property as both an lrvalue and rvalue at the same time like this : int n = N = 1; Here is a complete C# sample : class Test { static int n; static int N { get { System.Console.WriteLine("get"); return n; } set { System.Console.WriteLine("set"); n = value; } } static void Main() { int n = N = 1; System.Console.WriteLine("{0}/{1}", n, N); } } You can't do that in C++/CLI as the resulting type of the assignment expression "N = 1" is void. EDIT: here is a C++/CLI sample that shows this : ref class A { public: static property int N; }; int main() { int n = A::N = 1; System::Console::WriteLine("{0}/{1}", n, A::N); } So what's the magic behind C# syntax allowing a void-expression to be used as a rvalue ? Is this special treatment only available for properties or do you know other C# tricks like 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

  • Within an aray of objects can one create a new instance of an object at an index?

    - by David
    Here's the sample code: class TestAO { int[] x; public TestAO () { this.x = new int[5] ; for (int i = 0; i<x.length; i++) x[i] = i; } public static void main (String[]arg) { TestAO a = new TestAO (); System.out.println (a) ; TestAO c = new TestAO () ; c.x[3] = 35 ; TestAO[] Z = new TestAO[3] ; Z[0] = a ; Z[1] = (TestAO b = new TestAO()) ; Z[2] = c ; } } When i try to compile this i get an error message at the line Z[1] which reads as follows: TestAO.java:22: ')' expected Z[1] = (TestAO b = new TestAO()) ; ^ What i'm trying to do here is create an instance of the object TestAO that i want to be in that index within the assignment of the value at that index instead of creating the instance of the object outside of the array like i did with a. Is this legal and i'm just making some syntax error that i can't see (thus causing the error message) or can what i'm trying to do just not be done?

    Read the article

  • Ruby syntax error: unexpected $end, expecting keyword_end

    - by user2839246
    I am supposed to: Capitalize the first letter of string. Capitalize every word except articles (the, a, an), conjunctions (and), and prepositions (in). Capitalize i (as in "I am male."). Specify the first word of a string (I actually have no idea what this means. I'm trying to run the spec file to test other functions). Here's my code: class Book def initialize(string) title(string) end def title(string) arts_conjs_preps = %w{ a an the and but or nor for yet so although because since unless despite in to } array = string.downcase.split array.each do |word| if (word == array[0] || word == "i") then word = word.capitalize if arts_conjs_preps !include?(word) then word = word.capitalize end puts array.join(' ') end end puts Book.new("inferno") Ruby says I'm messing up at: puts Book.new("inferno") <--(right after the last line of code) I get exactly the same error message with this test code: def title(string) array = string.downcase.split array.each do |word| if word == array[0] then word = word.capitalize end array.join(' ') end puts title("dante's inferno") The only other Stack Overflow thread regarding this particular syntax error that did not suggest trailing or missing ends or .s as the root of the problem is here. The last comment recommends deleting and recreating the gemset, Which sounds scary. And I'm not sure how to do. Any thoughts? Simple solution? Resources to help? Solution class Book def initialize(string) title(string) end def title(string) arts_conjs_preps = %w{ a an the and but or nor for yet so although because since unless despite of in to } array = string.downcase.split title = array.map do |word| if (word == array[0] || word == "i") || !arts_conjs_preps.include?(word) word = word.capitalize else word end end puts title.join(' ') end end Book.new("dante's the inferno")

    Read the article

  • Syntax Error? When parsing XML value

    - by Ace Munim
    I don't know if I'm having a syntax error but the compiler is giving me TypeError: 'undefined' is not an object (evaluating 'xmlDoc.getElementsByTagName("icon")[i].childNodes') Its me giving me this problem when im parsing the XML from my server, my actual javascript code is like this var xmlDoc = Obj.responseXML; var count = 0; if(xmlDoc){ while(count <= xmlDoc.getElementsByTagName("item").length){ document.getElementById("flow").innerHTML += "<div class='item'><img class='content' src='" + xmlDoc.getElementsByTagName("icon")[i].childNodes[0].nodeValue.replace(/\s+$/g,' ') +"' /></div>"; count++; } }else{ alert("Unable to parse!"); } and my XML goes like this. <feed> <item> <title>Given Title</title> <icon> http://i178.photobucket.com/albums/w255/ace003_album/Logo-ETC-RGB-e1353503652739.jpg </icon> </item> <item>...</item> <item>...</item> <item>...</item> <item>...</item> <item>...</item> <item>...</item> </feed> i just want to parse the image link and to show it.

    Read the article

  • jQuery Syntax Error - Trying to detect viewport size and select background image to use w/CSS

    - by CuppyCakes
    Hi all. Please be gentle, I'm still learning. I imagine that the solution to my problem is simple and that perhaps I have just been in front of the computer too long. I am trying to detect the size of the viewport, and then use a different sized image for a background on an element depending on the size of the viewport. Here is what I have so far: $(document).ready(function(){ var pageWidth = $(window).width(); if ( pageWidth <= 1280 ) { $('#contact').css('background-image', 'url(../images/contact_us_low.jpg)'); } elseif ( pageWidth > 1280 ) { $('#contact').css('background-image', 'url(../images/contact_us_high.jpg)'); } }); Error: missing ; before statement [Break on this error] elseif ( pageWidth 1280 ) {\n (Line 7) To me it seems like all of my semi-colons are in the right place. Two questions: Am I going about solving the problem in a sensible way? To me a simple conditional should solve this background problem, as the code is merely selecting between two images based on what size it detects the viewport to be. Can you please help point out my n00b syntax error? Sometimes it really does help to have an extra pair of eyes look at something like this, even if small. Thank you kindly for your advice, I will continue poking and perusing the docs I have available to me.

    Read the article

  • JQuery Load() syntax - Changing data source on mouseenter

    - by Andrew Parisi
    Hey everyone. I've written this simple function that is supposed to load a portion of an XML file on mouseenter. It works fine when I specify the data source explicitly, shown below. I have a number of '.invest-port-thumb' divs, each with a unique link. The following code works fine—but it loads the whole XML file—and I only want a portion: $(document).ready(function() { $('.invest-port-thumb a').mouseenter(function() { $('#slider-name').load(this.href); }); }); This code also works fine—loading only the 'cName' portion that I want it to load...Except that this code refers to one of the files, instead of the value of this.href. $(document).ready(function() { $('.invest-port-thumb a').mouseenter(function() { $('#slider-name').load('port/atd.xml cName'); }); }); I guess what I'm saying, syntax wise—How can I combine this.href and the data matching cName? Thanks for the help!

    Read the article

  • Python for statement giving an Invalid Syntax error with list

    - by Cold Diamondz
    I have some code in which is throwing an error (I'm using repl.it) import random students = ['s1:0','s2:0','s3:0'] while True: print'\n'*50 print'Ticket Machine'.center(80) print'-'*80 print'1. Clear Student Ticket Values'.center(80) print'2. Draw Tickets'.center(80) menu = raw_input('-'*80+'\nChoose an Option: ') if menu == '1': print'\n'*50 print'CLEARED!' students = ['s1:0','s2:0','s3:0'] raw_input('Press enter to return to the main menu!') elif menu == '2': tickets = [] print'\n'*50 times = int(raw_input('How many tickets to draw? ') for a in students: for i in range(a.split(':')[1]): tickets.append(a.split(':')[0]) for b in range(1,times+1): print str(b) + '. ' + random.choice(tickets) else: print'\n'*50 print'That was not an option!' raw_input('Press enter to return to the main menu!') But it is throwing this error: File "<stdin>", line 19 for a in students: ^ SyntaxError: invalid syntax I am planning on using this in a class, but I can't use it until the bug is fixed, also, student names have been removed for privacy reasons.

    Read the article

  • jQuery, selecting form elements by name, getting: Error: uncaught exception: Syntax error, unrecogni

    - by Mark Steudel
    I'm trying to select an select element by name I found this thread showing how to do it, and I followed it but I'm getting Syntax error. I'm using jquery 1.4.1, here's my code. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <title>TODO supply a title</title> <script type="text/javascript" src="/js/jquery-1.4.1.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ alert( $('select[@name="country[0]"]').val() ); }) </script> </head> <body> <form> <select name="country[0]"> <option value="23">test</option> </select> </form> </body> </html> Thanks in advance for any insight. MS

    Read the article

< Previous Page | 47 48 49 50 51 52 53 54 55 56 57 58  | Next Page >