Search Results

Search found 6478 results on 260 pages for 'hippy head'.

Page 69/260 | < Previous Page | 65 66 67 68 69 70 71 72 73 74 75 76  | Next Page >

  • How to sort array with undefined elements in IE7 JavaScript

    - by Gene Goykhman
    I am having trouble sorting an array that includes undefined elements (a sparse array) in IE7. This works great in Safari and Firefox of course, and I haven't tried other versions of IE, but here is a simple example. <html> <head> <script type="text/javascript"> function runscript() { var myArray = [{id: 2}, undefined, {id: 0}, {id: 1}, {id: 3}, {id: 4}, {id: 5}]; myArray.sort(function compare(a, b) { return a.id - b.id; }); var output = ''; for (loop in myArray) { output += myArray[loop].id + ' '; } alert(output); } </script> </head> <body onLoad="runscript();"> </body> The alert() at the end inexplicably shows 0 2 3 4 5 1. Removing the undefined element from the array correctly sorts it and the alert shows 0 1 2 3 4 5. Is there a way to work around this in IE7 so that I can reliably sort arrays that include undefined elements? I don't care where the undefined elements end up as long as the defined elements are sorted correctly.

    Read the article

  • Firefox and Chrome do not support cross-domian ajax by default?

    - by Ethan
    The following code works as expected in IE8 and Safari4, but not work in Firefox3.6 and Chrome. All browsers are on Windows. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/smoothness/jquery-ui.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js"></script> <script type="text/javascript"> $(function() { $('#tabs').tabs(); }); </script> </head> <body> <div id="tabs"> <ul> <li><a href="http://www.google.com/">Google</a></li> <li><a href="http://www.msn.com/">MSN</a></li> </ul> </div> </body> </html> Seems that Firefox and Chrome do not support cross-domian ajax by default, right? Is there any easy way to turn on cross-domian ajax in Firefox and Chrome?

    Read the article

  • Attribute Address getting displayed instead of Attribute Value

    - by Manish
    I am try to create the following. I want to have one drop down menu. Depending on the option selected in the first drop down menu, options in second drop down menu will be displayed. The options in 2nd drop down menu is supposed by dynamic, i.e., options change with the change of values in first menu. Here, instead of getting the drop down menus, I am getting the following Choose your Option1: Choose your Option2: Note: I strictly don't want to use javascript. home_form.py class HomeForm(forms.Form): def __init__(self, *args, **kwargs): var_filter_con = kwargs.pop('filter_con', None) super(HomeForm, self).__init__(*args, **kwargs) if var_filter_con == '***': var_empty_label = None else: var_empty_label = ' ' self.option2 = forms.ModelChoiceField(queryset = db_option2.objects.filter(option1_id = var_filter_con).order_by("name"), empty_label = var_empty_label, widget = forms.Select(attrs={"onChange":'this.form.submit();'}) ) self.option1 = forms.ModelChoiceField(queryset = db_option1.objects.all().order_by("name"), empty_label=None, widget=forms.Select(attrs={"onChange":'this.form.submit();'}) ) view.py def option_view(request): if request.method == 'POST': form = HomeForm(request.POST) if form.is_valid(): cd = form.cleaned_data if cd.has_key('option1'): f = HomeForm(filter_con = cd.get('option1')) return render_to_response('homepage.html', {'home_form':f,}, context_instance=RequestContext(request)) return render_to_response('invalid_data.html', {'form':form,}, context_instance=RequestContext(request)) else: f = HomeForm(filter_con = '***') return render_to_response('homepage.html', {'home_form':f,}, context_instance=RequestContext(request)) homepage.html <!DOCTYPE HTML> <head> <title>Nivaaran</title> </head> <body> <form method="post" name = 'choose_opt' action=""> {% csrf_token %} Choose your Option1: {{ home_form.option1 }} <br/> Choose your Option2: {{ home_form.option2 }} </form> </body>

    Read the article

  • Problem with width in percentage in mozilla

    - by lam3r4370
    I have problem with width in percentage in mozilla. Firefox:http://img155.imageshack.us/i/prolemwidthper.png/ Opera:http://img209.imageshack.us/i/logowpopera.png/ Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <meta name="author" content="adminite"> <title>Untitled 2</title> <style> #cont { width:99.8%; height:125px; border:1px solid red; background-color:#1ea1de; margin: 0px 0px 0px 0px; }</style> </head> <body> <div id="cont"> </div> </body> </html>

    Read the article

  • Facebook dialog appears but always says "An error has occurred"

    - by Conor James
    <!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" xmlns:fb="http://www.facebook.com/2008/fbml"> ... <head> ... <script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script> </head> <body> <div id="fb-root"></div> <fb:like id="fb-like" href="http://www.example.com" layout="button_count" show_faces="false" width="100"></fb:like> ... myscript.js: FB.ui( { method: 'stream.publish', message: 'getting educated about Facebook Connect', attachment: { name: 'Connect', caption: 'The Facebook Connect JavaScript SDK', description: ( 'A small JavaScript library that allows you to harness ' + 'the power of Facebook, bringing the user\'s identity, ' + 'social graph and distribution power to your site.' ), href: 'http://github.com/facebook/connect-js' }, action_links: [ { text: 'Code', href: 'http://github.com/facebook/connect-js' } ], user_message_prompt: 'Share your thoughts about Connect' }, function(response) { if (response && response.post_id) { alert('Post was published.'); } else { alert('Post was not published.'); } } ); I have Facebook like button on my page which works fine. But when I call the FB.ui method above from my JavaScript source, the Facebook dialog pops up but displays this error message: **An error occurred. Please try again later.** This has happened repeatedly for two days since I started trying to implement it. Not a very helpful error message. Any idea what might cause it or how to narrow down the problem?

    Read the article

  • $ is not defined

    - by coffeeaddict
    I cannot figure out why it's still not recognizing jQuery syntax when I clearly have included the jQuery library right before my $(document).ready <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head id="Head1"><title> </title></head> <body> <form name="form1" method="post" action="jQueryDialogTest.aspx" id="form1"> <div> <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE2MTY2ODcyMjlkZA==" /> </div> <script src="content/js/jquery-1.3.2.min.js" type="text/javascript"></script> <script src="content/js/popup.js" type="text/javascript"></script> <div id="testDialog" winWidth="400" winHeight="500" winResizable="true"> Some test mark-up, should show inside the dialog </div> <div><input type="button" id="invokeDialog" value="Click Me!" /></div> </form> <script type="text/javascript"> $(document).ready(function() { $("input.invokeDialog").click.showDialog("#testDialog"); }); </script> </body> </html>

    Read the article

  • CSS 100 percent height body and element

    - by Tim
    I am having an issue making one of my elements 100% within an overall layout that is 100%. I have tried different positioning solutions and I either end up with hidden content the floats behind the footer at the bottom, or the content ends up going behind the footer, and carrys on after the footer. Here is what I have for the page layout. <!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" lang="en-US"> <head> <style> *{margin:0} html,body{margin:0; padding:0; height:100%} .wrapper{position:relative; margin:0 auto -200px; height:auto !important; height:100%; min-height:100%} .container{width:930px; margin:0 auto; text-align:left} .right{float:right; width:680px; background:#FFF; margin:60px 10px 0 0; padding:0} .left{float:left; width:240px} .content{padding:10px} .footer{position:absolute; width:100%} .footer,.push{height:200px} </style> </head> <body> <div class="wrapper"> left content footer </div> </body> </html> The layout for the page being 100% height and footer at the bottom works it just the div with the class name content that I would like to be 100% as well and push the footer further down if the content reaches the footer and not disappear. Any help most appreciated. http://img686.imageshack.us/img686/7725/screenshotbj.png

    Read the article

  • History.js not working in Internet Explorer

    - by Wilcoholic
    I am trying to get history.js to work in Internet Explorer because I need history.pushState() to work. I have read over the instructions on GitHub (https://github.com/balupton/History.js/) and have tried implementing it, but havent had any success. Here's what I have <!DOCTYPE html> <html> <head> <!-- jQuery --> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> <!-- History.js --> <script defer src="http://balupton.github.com/history.js/scripts/bundled/html4+html5/jquery.history.js"></script> <script type="text/javascript"> function addHistory(){ // Prepare var History = window.History; // Note: We are using a capital H instead of a lower h // Change our States History.pushState(null, null, "?mylink.html"); } </script> </head> <body> <a href="mylink.html">My Link</a> <a href="otherlink.html">Other Link</a> <button onclick="addHistory()" type="button">Add History</button> </body> Not sure what I'm doing wrong, but it's definitely not working in IE. Any help is appreciated

    Read the article

  • return specific values from youtube

    - by user1631487
    I am trying to write a small function that will allow a user to submit a specific youtube channel url, and then return the number of views on the channel. Anyobne have any ideas? <!DOCTYPE html> <html> <head> </head> <body> <p id="demo">Click the button to get the value of the attribute with the specified namespaceURI and name</p> <button onclick="myFunction()">Try it</button> <script> function myFunction() { var http; if (window.XMLHttpRequest) {xhttp=new XMLHttpRequest();} else {xhttp=new ActiveXObject("Microsoft.XMLHTTP");} xhttp.open("GET","booksns.xml",false); xhttp.send(); var xmlDoc=xhttp.responseXML; var price=xmlDoc.getElementsByTagName("price")[0]; var x=document.getElementById("demo"); x.innerHTML=price.getAttributeNS("http://www.w3schools.com/NS","currency"); }; </script> </body> </html>

    Read the article

  • Javascript style variables with "-" in their name aren't able to be changed?

    - by William
    Okay, so this bug has cost me quite a bit of time and embarrassment. It seems that any style variable with a - in it's name can't be modified by javascript. As seen here: <!DOCTYPE html> <html lang="en"> <head> <title>Class Test</title> <meta charset="utf-8" /> <style> body { text-align: center; background-color: #ffffff;} #box { position: absolute; left: 610px; top: 80px; height: 50px; width: 50px; background-color: #ff0000; color: #000000;} </style> <script type="text/javascript"> var box = 0; </script> </head> <body> <div id="box" ></div> <script type="text/javascript"> box = document.getElementById('box'); box.style.background-color = "#0000ff"; </script> </body> </html> The box in said example will just remain red. So how do I change a style variable with a - in it's name?

    Read the article

  • CSS class not working as expected [closed]

    - by user1050619
    My HTML codes not implement the CSS styling..The border in the CSS file is not being implemented. I tried both in Firefox & IE. Please provide your inputs. Please find the code below: HTML <html> <head> <link href="file://c:/jquery/chapter-1/begin/styles/my_style.css" rel="stylesheet"> </head> <body> <div id="header" class="no_hover"><h1>Header</h1></div> <button type="button" id="btn1">Click to Add</button> <button type="button" id="btn2">Click to Remove</button> <script src="file://c:/jquery/chapter-1/begin/scripts/jquery.js" type="text/javascript"></script> <script src="file://c:/jquery/chapter-1/begin/scripts/test4.js" type="text/javascript"></script> </body> </html> jS FILE $(document).ready(function() { $("#btn1").click( function(){ $("#header").addClass("hover"); $("#header").removeClass("no_hover"); }); $("#btn2").click( function(){ $("#header").removeClass("hover"); $("#header").addClass("no_hover"); }); }); CSS FILE .hover{ border: solid #f00 3px; } .no_hover{ border: solid #000 3px; }

    Read the article

  • Heroku "We're sorry, but something went wrong." due to javascript_include_tag

    - by Newton
    Uploading my ruby on rails app to heroku causes the following error: We're sorry, but something went wrong. This does not occur on my local machine. After some debugging, I think I may have spotted the error, but do not know how to fix it. In my file application.html.erb, removing the following line solves the problem, but then my app loses its jquery mobile theme. Any ideas what I could do to fix the problem? Line causing the problem: <%= javascript_include_tag "application" %> application.html.erb file: <!DOCTYPE html> <html> <head> <title>Washapp</title> <meta name="viewport" content="width=device-width"> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" /> <%= javascript_include_tag "application" %> <script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script> <%= csrf_meta_tags %> <script> if (window.location.hash == "#_=_") window.location.hash = ""; </script> </head> <body> <div data-role="page"> <%= yield %> </div> </body> </html>

    Read the article

  • CSS3 Border Radius property doesn't work in localhost?

    - by user547969
    I'm having a very strange problem with css3 border radius property. My following CSS and html works fine with IE9 if i double click the file and open with the IE9 , however if the border property does not work in IE if i open the file through LOCALHOST (xampp insatlled on windows 7). The same file works fine on localhost with other browsers. How can i fix it? <!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" xml:lang="en" lang="en"> <head> <style media="all" type="text/css">@import "circle.css";</style> </head> <body> <div class="exampleborderradiusf">F</div> </body> </html> and the CSS is: .exampleborderradiusf { float:left; background-color: #464646; margin-top: 20px; margin-right: 40px; width: 70px; height: 70px; text-align: center; -moz-border-radius: 35px; border-radius: 35px; color: white; font-size: 20px; position: relative; top: 20px; } Thanks for the help.

    Read the article

  • SimpleTest assertTags - loose matching? (for CakePHP)

    - by Arkaaito
    I'd like to use SimpleTest to set up some functionality tests for our project - in particular, we have a very busy page which has some random components and some static components, and I'd like to be able to write a simple test which only confirms the static bits (preferably only the one or two most important ones). In other words, I want to be able to leave out any tags on the page I don't care about, and write something like: $result = "<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><title>...</title><meta .../></head><body><script type="text/javascript">...</script><div class="center-splash"><span>Welcome JohnDoe</span><p>Your progress:</p>...</div><div class="left-column">...</div><div class="right-column">...</div>...</body></html>"; $expects = array('html'=>true,'body'=>true,'div'=>array('class'=>'center_splash'),'span'=>true,'Welcome JohnDoe','/span','/div','/body','/html'); $this->assertTagsButIgnoreExtras($result, $expects); When I try this with assertTags it fails. Is there a version of assertTags which allows this - something either officially part of the SimpleTest or CakePHP project or unofficially put out under the MIT license or similar?

    Read the article

  • Strange numbers in java socket output

    - by user293163
    I have small test app: Socket socket = new Socket("jeck.ru", 80); PrintWriter pw = new PrintWriter(socket.getOutputStream(), false); pw.println("GET /ip/ HTTP/1.1"); pw.println("Host: jeck.ru"); pw.println(); pw.flush(); BufferedReader rd = new BufferedReader(new InputStreamReader(socket.getInputStream())); String str; while ((str = rd.readLine()) != null) { System.out.println(str); } It`s output: HTTP/1.1 200 OK Date: Sat, 13 Mar 2010 22:06:51 GMT Content-Type: text/html;charset=utf-8 Transfer-Encoding: chunked Connection: keep-alive Keep-Alive: timeout=5 Server HTTP/1.1 200 OK Date: Sat, 13 Mar 2010 22:06:51 GMT Content-Type: text/html;charset=utf-8 Transfer-Encoding: chunked Connection: keep-alive Keep-Alive: timeout=5 Server: Apache Cache-Control: max-age=0 Expires: Sat, 13 Mar 2010 22:06:51 GMT 123 <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>??? IP</title> </head> <body> <div style='text-align: center; font: 32pt Verdana;margin-top: 300px'> ??? IP &#151; 94.103.87.153 </div> </body> </html> 0 Whence these numbers (123 an 0) takes?

    Read the article

  • Is NFS capable of preserving order of operations?

    - by JustJeff
    I have a diskless host 'A', that has a directory NFS mounted on server 'B'. A process on A writes to two files F1 and F2 in that directory, and a process on B monitors these files for changes. Assume that B polls for changes faster than A is expected to make them. Process A seeks the head of the files, writes data, and flushes. Process B seeks the head of the files and does reads. Are there any guarantees about how the order of the changes performed by A will be detected at B? Specifically, if A alternately writes to one file, and then the other, is it reasonable to expect that B will notice alternating changes to F1 and F2? Or could B conceivably detect a series of changes on F1 and then a series on F2? I know there are a lot of assumptions embedded in the question. For instance, I am virtually certain that, even operating on just one file, if A performs 100 operations on the file, B may see a smaller number of changes that give the same result, due to NFS caching some of the actions on A before they are communicated to B. And of course there would be issues with concurrent file access even if NFS weren't involved and both the reading and the writing process were running on the same real file system. The reason I'm even putting the question up here is that it seems like most of the time, the setup described above does detect the changes at B in the same order they are made at A, but that occasionally some events come through in transposed order. So, is it worth trying to make this work? Is there some way to tune NFS to make it work, perhaps cache settings or something? Or is fine-grained behavior like this just too much expect from NFS?

    Read the article

  • CSS Border spanning across another div

    - by Tux
    The problem is that the border of div#content also appears in div#navigation? <html> <head> <title>WUI</title> <style type="text/css"> div#header { } div#navigation { float: left; padding-right: 20pt; } div#content { border: 5px groove; } </style> </head> <body> <div id="header"> <h1>WUI</h1> </div> <br /> <div id="navigation"> <ul> <li>Home</li> <li>Login</li> </ul> </div> <div id="content"> <p>I like when you ride with that booty on me!</p> </div> </body> </html> EDIT: I want the left side (navigation) to appear as a sidebar to the left and the content after that (to the right). I'm applying the border to the content but that border also appears in div of navigation. I hope it is clear now.

    Read the article

  • Why doesn't line-height work on FF/3.5.8(Mac)?

    - by Znarkus
    I can't get line-height on a text input to work on Firefox 3.5.8/(Mac). Works flawlessly on: IE6 IE7 IE8 FF3.6/PC FF3.6/Mac Safari Test code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>asd</title> <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.8.0r4/build/reset/reset-min.css" /> </head> <body> <input type="text" value="Hello" style="line-height:50px;height:50px;font-size:16px;" /> <input type="text" value="Hello" style="padding:17px 0;font-size:16px;" /> </body> </html> Is there an alternate solution or any idea how to fix this? Edit: Updated the test code, to compare line-height vs. padding technique. Padding works on all above browsers except IE8. Whaat? I can't test on FF/3.5.8 anymore, could someone please report the result from this browser on any plattform? I'm now thinking this is a Firefox 3.5.8 issue, plattform independent.

    Read the article

  • HTML5 on iPhone Safari - data stored by localStorage does not always persist. Why?

    - by Aerodyne
    Hi, I write a simple iPhone web app using HTML5's localStorage. Tests on a 2G device show that data stored using localStorage does not persist after the Safari process is killed although the opened Safari windows are remembered. The data is also lost in a case where I am on a different site on a different Safari window, then I change the window to where the web app in subject is shown. When Safari loads the page it automatically refreshes the page. Then the data is lost. This is a simple test code: <html> <head> <meta name="viewport" content="height=device-height, width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> </head> <body> <script> alert("1:" + localStorage.getItem("test")); localStorage.setItem("test", "123"); alert("2:" + localStorage.getItem("test")); </script> </body> As far as I understand the data should persist! Can anyone shed some light on this behavior? What should I do to get the persistence to work? Thanks! Tom.

    Read the article

  • Dynamically Changing an img tag's onemouseover attribute with Javascript nulls it instead

    - by ?s?zs?
    I want to create an img that has four different states: State 1 over State 1 out State 2 over State 2 out Each state is a different image, and the user can toggle between states 1 and 2 by clicking on the image. To do this I change the src when the image is clicked and the onmouseover and onmouseout attributes of the img element. However when the attributes have been changed they become nulled and do nothing. How can I dynamically change these properties? Here is the code I am using: <!DOCTYPE html> <html> <head> <script> function change() { document.getElementById('image').src="http://youtube.thegoblin.net/layoutFix/hideplaylist.png"; document.getElementById('image').onmouseover="this.src='http://youtube.thegoblin.net/layoutFix/hideplaylistDark.png'"; document.getElementById('image').onmouseout="this.src='http://youtube.thegoblin.net/layoutFix/hideplaylist.png'"; } </script> </head> <body> <img id="image" src="http://youtube.thegoblin.net/layoutFix/showplaylist.png" onmouseover="this.src='http://youtube.thegoblin.net/layoutFix/showplaylistDark.png'" onmouseout="this.src='http://youtube.thegoblin.net/layoutFix/showplaylist.png'" onClick="change()"> </body> </html>

    Read the article

  • Detect mouseover and show tooltip text for dots on an HTML Canvas

    - by carl asquith
    Ive recently created a "map" although not very sophisticated (im working on it) it has the basic function and is generally heading in the right direction. If you look at it you can see a tiny red dots and on those tiny red dots i want to mouseover it and see text basically but ive had a bit of trouble getting the code right. http://hummingbird2.x10.mx/website%20creation/mainpage.htm This is all the code so far. <!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> <title>Oynx Warrior</title> <link rel="stylesheet" type="text/css" href="mystyle.css" /> </head> <body> <h1>Oynx Warrior</h1> <canvas id="myCanvas" width="500" height="500" style="border:1px solid #c3c3c3;"> Your browser does not support the canvas element. </canvas> <script type="text/javascript"> var c=document.getElementById("myCanvas"); var cxt=c.getContext("2d"); cxt.fillStyle="#red"; cxt.beginPath(); cxt.arc(50,50,1,0,Math.PI*2,true); cxt.closePath(); cxt.fill(); </script> </body> </html>

    Read the article

  • Django: Create custom template tag -> ImportError

    - by Alexander Scholz
    I'm sorry to ask this again, but I tried several solutions from stack overflow and some tutorials and I couldn't create a custom template tag yet. All I get is ImportError: No module named test_tag when I try to start the server via python manage.py runserver. I created a very basic template tag (found here: django templatetag?) like so: My folder structure: demo manage.py test __init__.py settings.py urls.py ... templatetags __init__.py test_tag.py test_tag.py: from django import template register = template.Library() @register.simple_tag def test_tag(input): if "foo" == input: return "foo" if "bar" == input: return "bar" if "baz" == input: return "baz" return "" index.html: {% load test_tag %} <html> <head> ... </head> <body> {% cms_toolbar %} {% foobarbaz "bar" %} {% foobarbaz "elephant" %} {% foobarbaz "foo" %} </body> </html> and my settings.py: INSTALLED_APPS = ( ... 'test_tag', ... ) Please let me know if you need further information from my settings.py and what I did wrong so I can't even start my server. (If I delete 'test_tag' from installed apps I can start the server but I get the error that test_tag is not known, of course). Thanks

    Read the article

  • Scala always returning true....WHY?

    - by jhamm
    I am trying to learn Scala and am a newbie. I know that this is not optimal functional code and welcome any advice that anyone can give me, but I want to understand why I keep getting true for this function. def balance(chars: List[Char]): Boolean = { val newList = chars.filter(x => x.equals('(') || x.equals(')')); return countParams(newList, 0) } def countParams(xs: List[Char], y: Int): Boolean = { println(y + " right Here") if (y < 0) { println(y + " Here") return false } else { println(y + " Greater than 0") if (xs.size > 0) { println(xs.size + " this is the size") xs match { case xs if (xs.head.equals('(')) => countParams(xs.tail, y + 1) case xs if (xs.head.equals(')')) => countParams(xs.tail, y - 1) case xs => 0 } } } return true; } balance("()())))".toList) I know that I am hitting the false branch of my if statement, but it still returns true at the end of my function. Please help me understand. Thanks.

    Read the article

  • In Firefox, how to bring an existing popup window with multiple tabs to the front using javascript f

    - by brahn
    I would like to have a button on a web page with the following behavior: On the first click, open a pop-up. On later clicks, if the pop-up is still open, just bring it to the front. If not, re-open. The below code generally works in Firefox, Safari, and IE8 (see here for Chrome woes). However, I have found a failure mode in Firefox that I don't know how to deal with: If for some reason the user has opened a second tab in the pop-up window and that second tab has focus within that window, the popupWindow.focus() command fails to have any effect. (If the first tab has focus within that window, everything works just great.) So, how can I focus the popup and the desired tab in Firefox? <head> <script type="text/javascript"> var popupWindow = null; var doPopup = function () { if (popupWindow && !popupWindow.closed) { popupWindow.focus(); } else { popupWindow = window.open("http://google.com", "_blank", "width=200,height=200"); } }; </script> </head> <body> <button onclick="doPopup(); return false"> create a pop-up </button> </body> Background: I am re-asking this question specifically for Google Chrome, as I think I my code solves the problem at least for other modern browsers and IE8. If there is a preferred etiquette for doing so, please let me know.

    Read the article

  • Font for tabs looks a little too big

    - by cf_PhillipSenn
    I'm using the default for jQueryUI, but it looks like the font is a little big. I know that one solution would be "WELL! JUST MAKE IT SMALLER!", but I'm just wondering if I've messed something up or I don't have a value set correctly before I charge in and start changing things. <!DOCTYPE HTML> <html> <head> <script src="http://www.google.com/jsapi"></script> <script type="text/javascript"> google.load("jquery", "1"); </script> <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/smoothness/jquery-ui.css" type="text/css" media="all" /> <script type="text/javascript"> google.load("jqueryui", "1"); function OnLoadCallbackUI(){ $('#tabs').tabs(); } google.setOnLoadCallback(OnLoadCallbackUI); </script> </head> <body> <div id="tabs"> <ul> <li><a href="#tabs-1">tab1</a></li> <li><a href="#tabs-2">tab2</a></li> </ul> <div id="tabs-1"> tabs-1 </div> <div id="tabs-2"> tabs-2 </div> </div> </body> </html>

    Read the article

< Previous Page | 65 66 67 68 69 70 71 72 73 74 75 76  | Next Page >