Search Results

Search found 9 results on 1 pages for 'user74283'.

Page 1/1 | 1 

  • Function within echo problem

    - by user74283
    Hi, I have a slight problem with the echo statement outputting wrongly. Forexample when i do echo "<div id=\"twitarea\">" . fetchtwitter($rss) . "</div>"; it displays function output but OUTSIDE of twitarea div. What is the cause of this behavior perhaps syntax? thanks in advance

    Read the article

  • Python doctest error

    - by user74283
    Hi I recently started experimenting with python currently reading "Think like a computer scientist: Learning python v2nd edition" I have been having some trouble with doctest. I use a windows 7 machine and Eclipse IDE with pydev. My question is when i run the script below i get the error below. Said script is below the the error message Traceback (most recent call last): File "C:\Users\shaytac\PythonProjects\test.py", line 21, in doctest.testmod() File "C:\Python26\lib\doctest.py", line 1829, in testmod for test in finder.find(m, name, globs=globs, extraglobs=extraglobs): File "C:\Python26\lib\doctest.py", line 852, in find self._find(tests, obj, name, module, source_lines, globs, {}) File "C:\Python26\lib\doctest.py", line 906, in _find globs, seen) File "C:\Python26\lib\doctest.py", line 894, in _find test = self._get_test(obj, name, module, globs, source_lines) File "C:\Python26\lib\doctest.py", line 978, in _get_test filename, lineno) File "C:\Python26\lib\doctest.py", line 597, in get_doctest return DocTest(self.get_examples(string, name), globs, File "C:\Python26\lib\doctest.py", line 611, in get_examples return [x for x in self.parse(string, name) File "C:\Python26\lib\doctest.py", line 573, in parse self._parse_example(m, name, lineno) File "C:\Python26\lib\doctest.py", line 631, in _parse_example self._check_prompt_blank(source_lines, indent, name, lineno) File "C:\Python26\lib\doctest.py", line 718, in _check_prompt_blank line[indent:indent+3], line)) ValueError: line 2 of the docstring for main.compare lacks blank after : 'compare(5, 4) ' def compare(a, b): """ >>>compare(5, 4) 1 >>>compare(7, 7) 0 >>>compare(2, 3) -1 >>>compare(42, 1) 1 """ if a > b : return 1 if a == b : return 0 if a < b : return -1 if __name__ == '__main__': import doctest doctest.testmod()

    Read the article

  • Python character count

    - by user74283
    I have been going over python tutorials in this resource. Everything is pretty clear in the below code which counts number of characters. Only section that i dont understand is the section where count assigned to a list and multiplied by 120. Can anyone explain what is the purpose of this in plain english please. def display(i): if i == 10: return 'LF' if i == 13: return 'CR' if i == 32: return 'SPACE' return chr(i) infile = open('alice_in_wonderland.txt', 'r') text = infile.read() infile.close() counts = 128 * [0] for letter in text: counts[ord(letter)] += 1 outfile = open('alice_counts.dat', 'w') outfile.write("%-12s%s\n" % ("Character", "Count")) outfile.write("=================\n") for i in range(len(counts)): if counts[i]: outfile.write("%-12s%d\n" % (display(i), counts[i])) outfile.close()

    Read the article

  • Counting vowels

    - by user74283
    Can anyone please tell me what is wrong with this script. I am a python newb but i cant seem to figure out what might be causing it not to function. def find_vowels(sentence): """ >>> find_vowels(test) e """ count = 0 vowels = "aeiuoAEIOU" for letter in sentence: if letter in vowels: count += 1 print count if __name__ == '__main__': import doctest doctest.testmod()

    Read the article

  • Letter Count on a string

    - by user74283
    Python newb here. I m trying to count the number of letter "a"s in a given string. Code is below. It keeps returning 1 instead 3 in string "banana". Any input appreciated. def count_letters(word, char): count = 0 while count <= len(word): for char in word: if char == word[count]: count += 1 return count print count_letters('banana','a')

    Read the article

  • Undefined javascript function?

    - by user74283
    Working on a google maps project and stuck on what seems to be a minor issue. When i call displayMarkers function firebug returns: ReferenceError: displayMarkers is not defined [Break On This Error] displayMarkers(1); <script type="text/javascript"> function initialize() { var center = new google.maps.LatLng(25.7889689, -80.2264393); var map = new google.maps.Map(document.getElementById('map'), { zoom: 10, center: center, mapTypeId: google.maps.MapTypeId.ROADMAP }); //var data = [[25.924292, -80.124314], [26.140795, -80.3204049], [25.7662857, -80.194692]] var data = {"crs": {"type": "link", "properties": {"href": "http://spatialreference.org/ref/epsg/4326/", "type": "proj4"}}, "type": "FeatureCollection", "features": [{"geometry": {"type": "Point", "coordinates": [25.924292, -80.124314]}, "type": "Feature", "properties": {"industry": [2], "description": "hosp", "title": "shaytac hosp2"}, "id": 35}, {"geometry": {"type": "Point", "coordinates": [26.140795, -80.3204049]}, "type": "Feature", "properties": {"industry": [1, 2], "description": "retail", "title": "shaytac retail"}, "id": 48}, {"geometry": {"type": "Point", "coordinates": [25.7662857, -80.194692]}, "type": "Feature", "properties": {"industry": [2], "description": "hosp2", "title": "shaytac hosp3"}, "id": 36}]} var markers = []; for (var i = 0; i < data.features.length; i++) { var latLng = new google.maps.LatLng(data.features[i].geometry.coordinates[0], data.features[i].geometry.coordinates[1]); var marker = new google.maps.Marker({ position: latLng, title: console.log(data.features[i].properties.industry[0]), map: map }); marker.category = data.features[i].properties.industry[0]; marker.setVisible(true); markers.push(marker); } function displayMarkers(category) { var i; for (i = 0; i < markers.length; i++) { if (markers[i].category === category) { markers[i].setVisible(true); } else { markers[i].setVisible(false); } } } } google.maps.event.addDomListener(window, 'load', initialize); </script> <div id="map-container"> <div id="map"></div> </div> <input type="button" value="Retail" onclick="displayMarkers(1);">

    Read the article

  • Django template Path

    - by user74283
    Hi I m following the tutorial on http://docs.djangoproject.com/en/dev/intro/tutorial02/#intro-tutorial02 in windows 7 envoirement. my settings file is TEMPLATE_DIRS = ( 'C:/django-project/myapp/mytemplates/admin' ) i got the base_template from the template admin/base_site.html from within the default Django admin template directory in the source code of Django itself (django/contrib/admin/templates) into an admin subdirectory of myapp directory as the tutorial instructed. It doesn't seem to take affect for some reason. Any clue of what might be the problem? Do i have to do a sync db ?

    Read the article

1