Search Results

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

Page 106/260 | < Previous Page | 102 103 104 105 106 107 108 109 110 111 112 113  | Next Page >

  • Problem Fetching JSON Result with jQuery in Firefox and Chrome (IE8 Works)

    - by senfo
    I'm attempting to parse JSON using jQuery and I'm running into issues. Using the code below, the data keeps coming back null: <!DOCTYPE html> <html> <head> <title>JSON Test</title> </head> <body> <div id="msg"></div> <script src="http://code.jquery.com/jquery-latest.js"></script> <script> $.ajax({ url: 'http://datawarehouse.hrsa.gov/ReleaseTest/HGDWDataWebService/HGDWDataService.aspx?service=HC&zip=20002&radius=10&filter=8357&format=JSON', type: 'GET', dataType: 'json', success: function(data) { $('#msg').html(data[0].title); // Always null in Firefox/Chrome. Works in IE8. }, error: function(data) { alert(data); } }); </script> </body> </html> The JSON results look like the following: {"title":"HEALTHPOINT TYEE CAMPUS","link":"http://www.healthpointchc.org","id":"tag:datawarehouse.hrsa.gov,2010-04-29:/8357","org":"HEALTHPOINT TYEE CAMPUS","address":{"street-address":"4424 S. 188TH St.","locality":"Seatac","region":"Washington","postal-code":"98188-5028"},"tel":"206-444-7746","category":"Service Delivery Site","location":"47.4344818181818 -122.277672727273","update":"2010-04-28T00:00:00-05:00"} If I replace my URL with the Flickr API URL (http://api.flickr.com/services/feeds/photos_public.gne?tags=cat&tagmode=any&format=json&jsoncallback=?), I get back a valid JSON result that I am able to make use of. I have successfully validated my JSON at JSONLint, so I've run out of ideas as to what I might be doing wrong. Any thoughts? Update: I had the client switch the content type to application/json. Unfortunately, I'm still experiencing the exact same problem. I also updated my HTML and included the live URL I've been working with. Update 2: I just gave this a try in IE8 and it works fine. For some reason, it doesn't work in either Firefox 3.6.3 or Chrome 4.1.249.1064 (45376). I did notice a mistake with the data being returned (the developer is returning a collection of data, even for queries that will always return a single record), but it still baffles me why it doesn't work in other browsers. It might be important to note that I am working from an HTML file on my local file system. I thought it might be a XSS issue, but that doesn't explain why Flickr works.

    Read the article

  • How do I get the current time in a Windows 7 gadget?

    - by norlando02
    For my first windows gadget I'm trying to make one that displays the current time and date. The code below is what I have, but I can't figure out why the javascript is not running. Any ideas? <html> <head> http-equiv="Content-Type" content="text/html; charset=Unicode" /> <title>Clock</title> <style type="text/css"> body { width: 130px; height: 60px; margin: 1 1 1 2; } body { font-family: Segoe UI, Arial; font-size: 11px; font-weight: bold; white-space: nowrap; } </style> <script type="text/javascript"> var background; var interval; var connection_id; var timeZone; var now; function load() { try { interval = 1000; connection_id = 0; timeZone = System.Time.currentTimeZone; update(); } catch(e){} } function update() { try { now = new Date(Date.parse(System.Time.getLocalTime(timeZone))); curDate.innerHTML = now.format('M jS, Y'); curTime.innerHTML = now.format('h:i:s A'); clearTimeout(connection_id); connection_id = setTimeout("update()", interval); } catch(e) {} </script> </head> <body onload="load()"> <div id="curDate"> </div> <div id="curTime"> </div> </body> </html>

    Read the article

  • get element position

    - by hopes
    how can i know that a specific is on another specific after dragging the first and drop it I am using this code in the head of my document to enable drag and drop of my divs var dragapproved=false var z,x,y function move(){ if (event.button==1&&dragapproved){ z.style.pixelLeft=temp1+event.clientX-x z.style.pixelTop=temp2+event.clientY-y return false } } function drags() { if (!document.all) return if (event.srcElement.className=="drag") { dragapproved=true z=event.srcElement temp1=z.style.pixelLeft temp2=z.style.pixelTop x=event.clientX y=event.clientY document.onmousemove=move } } document.onmousedown=drags document.onmouseup=new Function('dragapproved=false')

    Read the article

  • Rails Tutorial Chapter 4 2nd Ed. Title Helper not being called with out argument.

    - by SuddenlyAwakened
    I am running through the Rails Tutorial by Michael Hartl (Screen Cast). Ran into the and issue in chapter 4 on the title helper. I have been putting my own twist on the code as I go to make sure I understand it all. However on this one I it is very similar and I am not quite sure why it is acting the way it is. Here is the code: Application.html.erb <!DOCTYPE html> <html> <head> <%- Rails.logger.info("Testing: #{yield(:title)}") %> <title><%= full_title(yield(:title)) %></title> <%= stylesheet_link_tag "application", :media => "all" %> <%= javascript_include_tag "application" %> <%= csrf_meta_tags %> </head> <body> <%= yield %> </body> </html> Application_helper.rb module ApplicationHelper def full_title(page_title) full_title = "Ruby on Rails Tutorial App" full_title += " | #{page_title}" unless page_title.blank? end end Home.html.erb <h1><%= t(:sample_app) %></h1> <p> This is the home page for the <a href="http://railstutorial.org/">Ruby on Rails Tutorial</a> sample application </p> about.html.erb <% provide(:title, t(:about_us)) %> <h1><%= t(:about_us) %></h1> <p> The <a href="http://railstutorial.org/">Ruby on Rails Tutorial</a> is a project to make a book and screencast to teach web development with <a href="http://railstutorial.org/">Ruby on Rails</a>. This is the sample application for the tutorial. </p> What Happens: The code works fine when I set the provide method like on the about page. However when I do not it does not seem to even call the helper. I am assuming that because no title is passed back. Any ideas on what I am doing wrong? Thank you all for your help.

    Read the article

  • How to create programming flowchart/documentation from VB.NET source code?

    - by Greg
    Hi, what tools do you use to create programming flowchart/documentation from VB.NET source code? There are absolutely no comments/documentation at present. I am a beginner, i.e. I tried Sandcastle but it is way over my head and could not get it going, not even with GUI. Fatesoft's CodeVisual To Flowchart is OK but it is almost the same as the code and I still don't understand the code.

    Read the article

  • chrome renders js different depending on the extension of the file to render [testcase included]

    - by pakore
    I was trying to implement an image panner I found here Chrome renders the same document differently depending on the extension of the file requested. I have created a test case, where it works when the file it's not named as test.xhtml You can download the test case from here Does anybody know why or how to solve it? I want my files to be .xhtml In IE and FF it works fine. Code: test.html / test.xhtml (change the name to see that works with one but not with the other). <!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" lang="en" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> <style type="text/css"> /*Default CSS for pan containers*/ .pancontainer { position: relative; /*keep this intact*/ overflow: hidden; /*keep this intact*/ width: 300px; height: 300px; border: 1px solid black; } </style> <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://www.dynamicdrive.com/dynamicindex4/imagepanner.js"></script> </head> <body> <div class="pancontainer" data-orient="center" data-canzoom="yes" style="width: 350px; height: 200px; float: left; position: relative; overflow-x: hidden; overflow-y: hidden; cursor: move; "><img src="./test_files/image.jpg" style="position: absolute; width: 700px; height: 525px; left: -175px; top: -163px; display: block;" /> </div> </body> </html>

    Read the article

  • Cloning a selector + all its children in jQuery?

    - by HipHop-opatamus
    I'm having trouble getting the following JQuery script to function properly - its functionality is as follows: 1) Hide the content below each headline 2) Upon clicking a headline, substitute the "#first-post" with the headline + the hidden content below the headline. I can only seem to get the script to clone the headline itself to #first-post, not the headline + the content beneath it. Any idea why? <HTML> <HEAD> <script src="http://code.jquery.com/jquery-latest.js"></script> </HEAD> <script> $(document).ready( function(){ $('.title').siblings().hide(); $('.title').click( function() { $('#first-post').replaceWith($(this).closest(".comment").clone().attr('id','first-post')); $('html, body').animate({scrollTop:0}, 'fast'); return false; }); }); </script> <BODY> <div id="first-post"> <div class="content"><p>This is a test discussion topic</p> </div> </div> <div class="comment"> <h2 class="title"><a href="#1">1st Post</a></h2> <div class="content"> <p>this is 1st reply to the original post</p> </div> <div class="test">1st post second line</div> </div> <div class="comment"> <h2 class="title"><a href="#2">2nd Post</a></h2> <div class="content"> <p>this is 2nd reply to the original post</p> </div> <div class="test">2nd post second line</div> </div> </div> <div class="comment"> <h2 class="title"><a href="#3">3rd Post</a></h2> <div class="content"> <p>this is 3rd reply to the original post</p> </div> <div class="test">3rd post second line</div> </div> </div> </BODY> </HTML>

    Read the article

  • jquery use of :last and val()

    - by dole doug
    I'm trying to run the code from http://jsfiddle.net/ddole/AC5mP/13/ on my machine and the approach I've use is below or here. Do you know why that code doesn't work on my machine. Firebug doesn't help me and I can't solve the problem. I think that I need another pair of eyes :((( <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery UI Dialog - Modal form</title> <link type="text/css" href="css/ui-lightness/jquery-ui-1.8.21.custom.css" rel="stylesheet" /> <script type="text/javascript" src="js/jquery-1.7.2.min.js"></script> <script type="text/javascript" src="js/jquery-ui-1.8.21.custom.min.js"></script> <script type="text/javascript" > jQuery(function($) { $('.helpDialog').hide(); $('.helpButton').each(function() { $.data(this, 'dialog', $(this).next('.helpDialog').dialog({ autoOpen: false, modal: true, width: 300, height: 250, buttons: { "Save": function() { alert($('.helpText:last').val()); $(this).dialog( "close" ); }, Cancel: function() { $(this).dialog( "close" ); } } }) ); }).click(function() { $.data(this, 'dialog').dialog('open'); return false; }); }); </script> </head> <body> <span class="helpButton">Button</span> <div class="helpDialog"> <input type="text" class="helpText" /> </div> <span class="helpButton">Button 2</span> <div class="helpDialog"> <input type="text" class="helpText" /> </div> <span class="helpButton">Button 3</span> <div class="helpDialog"> <input type="text" class="helpText" /> </div> <span class="helpButton">Button 4</span> <div class="helpDialog"> <input type="text" class="helpText" /> </div> <span class="helpButton">Button 5</span> <div class="helpDialog"> <input type="text" class="helpText" /> </div> </body>

    Read the article

  • jquery show hidden div

    - by Fahad
    Firstly, I'm sort of embarrassed asking about this, so many people have already asked this question but even after having gone through so many posts, I'm unable to achieve what I want. Basically, a div, initially hidden, has to be displayed on a button click. I tried hiding the div using display:none and hide() and then displaying it using show(), toggle(), and css("display","block"). Using all sorts of combinations of the above, I was still unable to get the result. Code: <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <link href="css/smoothness/jquery-ui-1.9.2.custom.min.css" rel="stylesheet" type="text/css" /> <script src="jQuery/jquery-1.8.3.min.js" type="text/javascript"></script> <script src="jQuery/jquery-ui-1.9.2.custom.min.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function () { $('#one').hide(); $('#Button1').click(function () { $('#one').toggle(500); }); }); </script> </head> <body> <form id="form1" runat="server"> <div id="one" style="height: 20px;width:200px; background-color: Red; "> </div> <asp:Button ID="Button1" runat="server" Text="Show" /> </form> </body> </html> On button click, the div is shown for a brief second before it disappears again. The same thing happens if I use show() instead of toggle() in the above code. Again the same thing if I set style="display:none" to the div instead of using hide() and then use show() or toggle(). I also tried using $('#one').css("display","block"); but again, the same result. Can anyone please tell me where I'm going wrong. Just started learning jQuery and it is really frustrating when something apparently so simple will not work. Thanks in advance. :)

    Read the article

  • [CakePHP] I am so confused. What should I write in the default.ctp

    - by kwokwai
    Hi all, I am learning cakePHP, everything seems alright except that I am very confused of how to make use of the default.ctp and what should be put inside the Elements folder. Here is the default.ctp file that I have been using since my very first lesson on learning cakePHP: (I copied from this URL http://book.cakephp.org/view/96/Layouts) <!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> <title><?php echo $title_for_layout?></title> <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"> <!-- Include external files and scripts here (See HTML helper for more info.) --> <?php echo $scripts_for_layout ?> </head> <body> <!-- If you'd like some sort of menu to show up on all of your views, include it here --> <div id="header"> <div id="menu">...</div> </div> <!-- Here's where I want my views to be displayed --> <?php echo $content_for_layout ?> <!-- Add a footer to each displayed page --> <div id="footer">...</div> </body> </html> But the problem is that the layout will take effect to all web pages that I have created. Let's see the case that I have recently encountered. In one of the .ctp files, I need to use JQuery function and I need to ass some and tags in the .ctp file. Here are the and tags I used: <Script language="javascript"> $(document).ready(function() { // some functions here }); </Script> <style type="text/css"> { #toppage{ width:800px; } But when I followed the default.ctp file, I noticed that these tags (i.e. and ) happened to appear below the tag. As far as I know, the and self-defined Javascript functions should be put inside the tag of the HTML instead. I have considered to add the and in the default.ctp file, but then these codes would appear in every web pages instead of just a particular web page. Please help.

    Read the article

  • jQuery Form plugin - no data from file upload?

    - by pojo
    I've been struggling a bit with the jQuery Form plugin. I want to create a file upload form that posts the data (JSON, from the chosen file) into a REST service exposed by a servlet. The URL for the POST is calculated from what the user chooses in a SELECT dropdown. When the upload is complete, I want to notify the user immediately, AJAX-style. The problem is that the POST header has a Content-Length of 0 and contains no data. I would appreciate any help! <html> <head> <script type="text/javascript" src="js/jquery-1.4.2.min.js">/* ppp */</script> <script type="text/javascript" src="js/jquery.form.js">/* ppp */</script> <script type="text/javascript"> function cb_beforesubmit (arr, $form, options) { // This should override the form's action attribute options.url = "/rest/services/" + $('#selectedaction')[0].value; return true; } function cb_success (rt, st, xhr, wf) { $('#response').html(rt + '<br>' + st + '<br>' + xhr); } $(document).ready(function () { var options = { beforeSubmit: cb_beforesubmit, success: cb_success, dataType: 'json', contentType: 'application/json', method: 'POST', }; $('#myform').ajaxForm(options); $.getJSON('/rest/services', function (data, ts) { for (var property in data) { if (typeof property == 'string') { $('#selectedaction').append('<option>' + property + '</option>'); } } }); }); </script> </head> <body> <form id="myform" action="/rest/services/foo1" method="POST" enctype="multipart/form-data"> <!-- The form does not seem to submit at all if I don't set action to a default value? !--> <select id="selectedaction"> <script type="text/javascript"> </script> </select> <input type="file" value="Choose"/> <input type="submit" value="Submit" /> </form> <div id="response"> </div> </body> </html>

    Read the article

  • embed a jquery script after jquery is loaded by widget

    - by matthew k
    http://stackoverflow.com/a/6065421 was helpful to see how to confirm jquery has been loaded. my widget will need a class that was written using jquery. may i have some assistance on embedding this other class built using jquery? thank you, below is the snippet from the above link with my code added in the final portion as noted in the code comments: (function(window, document, version, callback) { var j, d; var loaded = false; if (!(j = window.jQuery) || version > j.fn.jquery || callback(j, loaded)) { var script = document.createElement("script"); script.type = "text/javascript"; script.src = "/media/jquery.js"; script.onload = script.onreadystatechange = function() { if (!loaded && (!(d = this.readyState) || d == "loaded" || d == "complete")) { callback((j = window.jQuery).noConflict(1), loaded = true); j(script).remove(); } }; document.documentElement.childNodes[0].appendChild(script) } })(window, document, "1.3", function($, jquery_loaded) { //my code added below var script_tag = document.createElement('script'); script_tag.setAttribute("type","text/javascript"); script_tag.setAttribute("src", "http://mysite.com/widget/slides.jquery.js"); (document.getElementsByTagName("head")[0] || document.documentElement).appendChild(script_tag); $('#slides').slides({}); //this line gives an error. }); right now, i am trying the following based on the response(s) provided to this question (line that throws error is noted with a comment): //this function is called after jquery being embedded has been confirmed. {mysite} placeholder is nonexistent in actual code. function main() { jQuery(document).ready(function($) { var css_link = $("<link>", { rel: "stylesheet", type: "text/css", href: "http://mysite/widget/widget.css" }); css_link.appendTo('head'); $('#crf_widget').after('<div id="crf_widget_container"></div>'); /******* Load HTML *******/ var jsonp_url = "http://mysite/widget.php?callback=?"; $.getJSON(jsonp_url, function(data) { $('#crf_widget_container').html(data); $('#category_sel').change(function(){ alert(this.value); }); $.getScript("http://mysite/widget/slides.jquery.js", function(data, textStatus, jqxhr) { alert(1); //fires ok $('#slides').slides({}); //errors }); }); }); }

    Read the article

  • GAE HTTP method support

    - by areich
    I get an "unrecognized HTTP method" when trying to do a REPORT request using httplib and gae. Is there a workaround available? An httplib patch for gae? Do you I have to find another host in order to do this natively? According to the docs, only certain fetch actions are valid: GET, POST, HEAD, PUT, and DELETE: http://code.google.com/appengine/docs/python/urlfetch/ fetchfunction.html

    Read the article

  • Best C# Tutorials for a newbie?

    - by N00b
    Were there any awesome C# tutorials you found that helped you learn it? Or any books that you thought were particularly successful? Any that should be avoided? UPDATE: Tons of good answers, thank you all! To clarify the earlier question, hobbyist with only light programming experience previous. Working through online tutorials currently, probably going to pick up Head First C#.

    Read the article

  • Memory Leak with jQuery UI inside UpdatePanel in ie7

    - by Ryan
    I have a fairly complex asp.net page based on UpdatePanels and jQuery UI. Unfortunately, when the panels update, the jQuery UI widgets leak memory like crazy in ie7, even if I manually 'destroy' them. Does anyone know a technique/patch to prevent these leaks? I've created a simple example page with a slider inside an UpdatePanel. Just click the 'Leak' button and refresh the page to see the leak in sieve. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Leak2.aspx.cs" Inherits="Leak2" %> <%@ Register Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI" TagPrefix="asp" %> <!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 runat="server"> <title>Leak</title> <link type="text/css" href="/jquery/css/custom-theme/jquery-ui-1.7.2.custom.css" rel="Stylesheet" /> <script type="text/javascript" src="/jquery/js/jquery-1.3.2.min.js"></script> <script type="text/javascript" src="/jquery/js/jquery-ui-1.7.2.custom.min.js"></script> </head> <body> <form id="form1" runat="server"> <div> <script type="text/javascript"> function initializeSlider() { $(".slider").slider({ min: 0, max: 100, value: 100, step: 5 }); } $(document).ready(function() { initializeSlider(); Sys.WebForms.PageRequestManager.getInstance().add_endRequest(function() { initializeSlider(); }); }); </script> <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <div style="width: 300px;"> <div class="slider"></div> <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Leak" /> </div> </ContentTemplate> </asp:UpdatePanel> </div> </form> </body> </html>

    Read the article

  • Why bubling not working

    - by slier
    I just want to understand how capturing and bubbling work. Unfortunately this code just work in IE, and not working in firefox. When i click on div3, it just stop there.it not bubling up toward body element. Can somebody enlighten me. <!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 content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>Untitled 1</title> <script type="text/javascript"> var addEvent = function(elem, event, func, capture){ if(typeof(window.event) != 'undefined'){ elem.attachEvent('on' + event, func); } else{ elem.addEventListener(event, func, capture); } } var bodyFunc = function(){ alert('In element body') } var div1Func = function(){ alert('In element div1') } var div2Func = function(){ alert('In element div2') } var div3Func = function(){ alert('In element div3') } var init = function(){ addEvent(document.getElementsByTagName('body')[0], 'click', bodyFunc, true); addEvent(document.getElementById('div1'), 'click', div1Func, true); addEvent(document.getElementById('div2'), 'click', div2Func, true); addEvent(document.getElementById('div3'), 'click', div3Func, true); } addEvent(window, 'load', init, false) </script> </head> <body> <h1>Using the Modern Event Model</h1> <div id="div1" style="border:1px solid #000000;padding:10pt;background:cornsilk"> <p>This is div 1</p> <div id="div2" style="border:1px solid #000000;padding:10pt;background:gray"> <p>This is div 2</p> <div id="div3" style="border:1px solid #000000;padding:10pt; background:lightBlue"> <p>This is div 3</p> </div> </div> </div> </body> </html>

    Read the article

  • MooTools event listener disappears after element.innerHTML is changed

    - by acoder
    Hi everyone, I am trying to achieve this task using MooTools. Description: I attached an event listener to "myButton" link. A click on this link initiates an AJAX request and updates "myDiv" content based on the response text. During this request a POST variable is being sent to "button.php", but it's not used at the moment.. (i wish to use it later) OK, as a result, "myDiv" gets exactly the same link with the same ID (myButton) + a random number, so that we could see that each click generates a new number. The problem: After the first click on "myButton", "myDiv" updates correctly, showing a random number. When I click "myButton" for the second time (this time in newly updated div), the div does not refresh anymore. Please note that I need "myButton" to be inside "myDiv", and "myDiv" must be updated (refreshed) after each click without having to refresh the entire page. Can somebody show me how to achieve this task based on this simplified code example? index.html <html> <head> <script type="text/javascript" src="mootools-1.2.4-core-nc.js"></script> <script> window.addEvent('domready', function() { $('myButton').addEvent('click', function(e) { e.stop(); var myRequest = new Request({ method: 'post', url: 'button.php', data: { action : 'test' }, onRequest: function() { $('myDiv').innerHTML = '<img src="images/loading.gif" />'; }, onComplete: function(response) { $('myDiv').innerHTML = response; } }); myRequest.send(); $('myButton').removeEvent('click'); }); }); </script> </head> <body> <div id="myDiv"> <a id="myButton" href="#">Button</a> </div> </body> </html> button.php <a id="myButton" href="#">Button</a> clicked <?php echo rand(1,100); ?>

    Read the article

  • Convert MSAccess Project Management Application to PHP/MySQL: Which Methodology?

    - by zzapper
    I've got to convert a not terribly complicated bespoke project management system from MsAccess Application to PHP/MySQL. I've been programming for donkey's years but embarrassingly know practically nothing about modern methodologies. So the old 'learning curve' versus 'improved efficiency' conundrum rears its ugly head once again. Although I've Googled up some stuff I don't want to prejudice your suggestions, where would you start, I'm at your mercy?

    Read the article

  • What's the C strategy to "imitate" a C++ template ?

    - by Andrei Ciobanu
    After reading some examples on stackoverflow, and following some of the answers for my previous questions (1), I've eventually come with a "strategy" for this. I've come to this: 1) Have a declare section in the .h file. Here I will define the data-structure, and the accesing interface. Eg.: /** * LIST DECLARATION. (DOUBLE LINKED LIST) */ #define NM_TEMPLATE_DECLARE_LIST(type) \ typedef struct nm_list_elem_##type##_s { \ type data; \ struct nm_list_elem_##type##_s *next; \ struct nm_list_elem_##type##_s *prev; \ } nm_list_elem_##type ; \ typedef struct nm_list_##type##_s { \ unsigned int size; \ nm_list_elem_##type *head; \ nm_list_elem_##type *tail; \ int (*cmp)(const type e1, const type e2); \ } nm_list_##type ; \ \ nm_list_##type *nm_list_new_##type##_(int (*cmp)(const type e1, \ const type e2)); \ \ (...other functions ...) 2) Wrap the functions in the interface inside MACROS: /** * LIST INTERFACE */ #define nm_list(type) \ nm_list_##type #define nm_list_elem(type) \ nm_list_elem_##type #define nm_list_new(type,cmp) \ nm_list_new_##type##_(cmp) #define nm_list_delete(type, list, dst) \ nm_list_delete_##type##_(list, dst) #define nm_list_ins_next(type,list, elem, data) \ nm_list_ins_next_##type##_(list, elem, data) (...others...) 3) Implement the functions: /** * LIST FUNCTION DEFINITIONS */ #define NM_TEMPLATE_DEFINE_LIST(type) \ nm_list_##type *nm_list_new_##type##_(int (*cmp)(const type e1, \ const type e2)) \ {\ nm_list_##type *list = NULL; \ list = nm_alloc(sizeof(*list)); \ list->size = 0; \ list->head = NULL; \ list->tail = NULL; \ list->cmp = cmp; \ }\ void nm_list_delete_##type##_(nm_list_##type *list, \ void (*destructor)(nm_list_elem_##type elem)) \ { \ type data; \ while(nm_list_size(list)){ \ data = nm_list_rem_##type(list, tail); \ if(destructor){ \ destructor(data); \ } \ } \ nm_free(list); \ } \ (...others...) In order to use those constructs, I have to create two files (let's call them templates.c and templates.h) . In templates.h I will have to NM_TEMPLATE_DECLARE_LIST(int), NM_TEMPLATE_DECLARE_LIST(double) , while in templates.c I will need to NM_TEMPLATE_DEFINE_LIST(int) , NM_TEMPLATE_DEFINE_LIST(double) , in order to have the code behind a list of ints, doubles and so on, generated. By following this strategy I will have to keep all my "template" declarations in two files, and in the same time, I will need to include templates.h whenever I need the data structures. It's a very "centralized" solution. Do you know other strategy in order to "imitate" (at some point) templates in C++ ? Do you know a way to improve this strategy, in order to keep things in more decentralized manner, so that I won't need the two files: templates.c and templates.h ?

    Read the article

  • How do I debug a ASP.NET application

    - by Jim McKintosh
    I have a ASP.NET application I've inherited from the person who did my job previously, when I try to debug the program I get the error below. "A project with an output type of class librart cannot be started directly" I'm familiar with desktop programs but I'm new to working with ASP.NET, the code is easy enough to understand but I can't get my head around how to successfully debug it. PS VS 2008 if that helps. Thanks Jim

    Read the article

  • Why i get everytime the error-message that i've already sent the headers

    - by mikep
    Hey, i've another question about web-programming. I programmed a login script, but everytime when i try to login it says that i've send the header informations already. Here are the 2 files: <?php if($_GET['logout'] == 1) { setcookie('authorized', 1, time()-3600); } ?> <!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> <title>Login - photoAdminSite</title> </head> <style type="text/css"> body { text-align: center; font-family: helvetica; } #loginForm { padding: 1em; background: #e3e3e3; width: 260px; margin: 3em auto 0; text-align: left; } </style> <body> <div id="loginForm"> <form method="post" action="confirm_login_credentials.php"> <h2>LOGIN</h2> <p>Username: <input type="text" name="username" /></p> <p>Password: <input type="password" name="password" /></p> <p><input type="submit" value="Login" name="submit" /></p> </form> </div> </body> </html> <?php $username = $_POST['username']; $password = $_POST['password']; require 'database.php'; $q = "SELECT id FROM users_photoadminsite WHERE user_name = '$username' AND password = '$password'"; $result = $mysqli->query($q) or die(mysqli_error()); if (mysqli_num_rows($result) == 1) { setcookie('authorized', 1, 0); header("Location: index.php"); } else { header("Location: login.php"); } ?> i would be really happy about some helpful answers.

    Read the article

  • text in textbox shows up as circles instead of regular characters?

    - by BlueMonster
    When i type in either of the textboxes i get little circles appearing instead of text. Why is this happening and how do i stop it? Code is as follows: HTML: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MainPage.aspx.cs" Inherits="Foods.MainPage" %> <!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 runat="server"> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link id="Link1" rel="stylesheet" type="text/css" href="Styles/mainStyle.css"/> </head> <body> <form id="form1" runat="server"> <div class = "userIDTboxDiv"> <div class = "userIDTboxText"> &nbsp;&nbsp;&nbsp; Enter User ID: </div> <asp:TextBox id="userIDBox" TextMode="password" runat="server" Height="52px" Width="200px" /> </div> <div class = "passwordTboxDiv"> <div class = "passwordTboxText"> &nbsp;&nbsp;&nbsp; Enter User Password: </div> <asp:TextBox id="TextBox1" TextMode="password" runat="server" Height="52px" Width="200px" /> </div> </form> </body> CSS: body { text-decoration:none; background: white; } input { margin-left: 0px; margin-top: 7px; } .userIDTboxDiv { padding-top: 20%; padding-left: 45%; width: 15%; height: 30%; } .userIDTboxText { padding-left: 17%; height: auto; width:203px; } .passwordTboxDiv { padding-top: 2%; padding-left: 45%; width: 15%; height: 111px; } .passwordTboxText { padding-left: 10%; height: auto; width:203px; }

    Read the article

  • Populate text box with JavaScript on PageLoad

    - by Etienne
    I have a text box called txtName on my form. In my page I know I need to place the code in my HEAD tag like so...... <script type='text/javascript' language="javascript"> document.forms['FormName'].elements['txtName'].value = "Robert" </script> But I cant seem to set a value inside my text box.

    Read the article

  • how to use window.onload?

    - by Patrick
    I'm refactoring a website using MVC. What was a set of huge pages with javascript, php, html etc etc is becoming a series of controllers and views. I'm trying to do it in a modular way so views are split in 'modules' that I can reuse in other pages when needed eg. "view/searchform displays only one div with the searchform "view/display_events displays a list of events and so on. One of the old pages was supposed to load a google map with a marker on it. Amongst the rest of the code, I can identify the relevant bits as follows <head> <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=blablabla" type="text/javascript"></script> <script type="text/javascript"> //<![CDATA[ function load() { if (GBrowserIsCompatible()) { var map = new GMap2(document.getElementById("map")); var point = new GLatLng(<?php echo ($info->lat && $info->lng) ? $info->lat .",". $info->lng : "51.502759,-0.126171"; ?>); map.setCenter(new GLatLng(<?php echo ($info->lat && $info->lng) ? $info->lat .",". $info->lng : "51.502759,-0.126171"; ?>), 15); map.addControl(new GLargeMapControl()); map.addControl(new GScaleControl()); map.addOverlay(new GMarker(point)); var marker = createMarker(point,GIcon(),"CIAO"); map.addOverlay(marker); } } //]]> </script> </head> ...then <body onload="load()" onunload="GUnload()"> ...and finally this div where the map should be displayed <div id="map" style="width: 440px; height: 300px"> </div> Don't know much about js, but my understanding is that a) I have to include the scripts in the view module I'm writing (directly in the HTML? I would prefer to load a separate script) b) I have to trigger that function using the equivalent of body onload... (obviously there's no body tag in my view. In my ignorance I've tried div onload=.... but didn't seem to be working :) What do you suggest I do? I've read about window.onload but don't know what's the correct syntax for that. please keep in mind that other parts of the page include other js functions (eg, google adsense) that are called after the footer.

    Read the article

< Previous Page | 102 103 104 105 106 107 108 109 110 111 112 113  | Next Page >