Search Results

Search found 6496 results on 260 pages for 'head of catering'.

Page 16/260 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • Writing an unthemed view while still using Orchard shapes and helpers

    - by Bertrand Le Roy
    This quick tip will show how you can write a custom view for a custom controller action in Orchard that does not use the current theme, but that still retains the ability to use shapes, as well as zones, Script and Style helpers. The controller action, first, needs to opt out of theming: [Themed(false)] public ActionResult Index() {} .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } Then, we still want to use a shape as the view model, because Clay is so awesome: private readonly dynamic _shapeFactory; public MyController(IShapeFactory shapeFactory) { _shapeFactory = shapeFactory; } [Themed(false)] public ActionResult Index() { return View(_shapeFactory.MyShapeName( Foo: 42, Bar: "baz" )); } As you can see, we injected a shape factory, and that enables us to build our shape from our action and inject that into the view as the model. Finally, in the view (that would in Views/MyController/Index.cshtml here), just use helpers as usual. The only gotcha is that you need to use “Layout” in order to declare zones, and that two of those zones, Head and Tail, are mandatory for the top and bottom scripts and stylesheets to be injected properly. Names are important here. @{ Style.Include("somestylesheet.css"); Script.Require("jQuery"); Script.Include("somescript.js"); using(Script.Foot()) { <script type="text/javascript"> $(function () { // Do stuff }) </script> } } <!DOCTYPE html> <html> <head> <title>My unthemed page</title> @Display(Layout.Head) </head> <body> <h1>My unthemed page</h1> <div>@Model.Foo is the answer.</div> </body> @Display(Layout.Tail) </html> Note that if you define your own zones using @Display(Layout.SomeZone) in your view, you can perfectly well send additional shapes to them from your controller action, if you injected an instance of IWorkContextAccessor: _workContextAccessor.GetContext().Layout .SomeZone.Add(_shapeFactory.SomeOtherShape()); Of course, you’ll need to write a SomeOtherShape.cshtml template for that shape but I think this is pretty neat.

    Read the article

  • Social Search: Looking for Love

    - by Mike Stiles
    For marketers and enterprise executives who have placed a higher priority on and allocated bigger budgets to search over social, it might be time to notice yet another shift that’s well underway. Social is search. Search marketing was always more of an internal slam-dunk than other digital initiatives. Even a C-suite that understood little about the new technology world knew it’s a good thing when people are able to find you. Google was the new Yellow Pages. Only with Google, you could get your listing first without naming yourself “AAAA Plumbing.” There were wizards out there who could give your business prominence in front of people who were specifically looking for what you offered. Other search giants like Bing also came along to offer such ideal matchmaking possibilities. But what if the consumer isn’t using a search engine to find what they’re looking for? And what if the search engines started altering their algorithms so that search placement manipulation was more difficult? Both of those things have started to happen. Experian Hitwise’s numbers show that visits to the major search engines in the UK dropped 100 million through August. Search engines are far from dead, or even challenged. But more and more, the public is discovering the sites and brands they need through advice they get via social, not search. You’ll find the worlds of social and search increasingly co-mingling as well. Search behemoths Google and Bing are including Facebook and Google+ into their engines. Meanwhile, Facebook and Twitter have done some integration of global web search into their platforms. So what makes social such a worthwhile search entity for brands? First and foremost, the consumer has demonstrated a behavior of acting on recommendations from social connections. A cry in the wilderness like, “Anybody know any good catering companies?” will usually yield a link (and an endorsement) from a friend such as “Yeah, check out Just-Cheese-Balls Catering.” There’s no such human-driven force/influence behind the big search engines. Facebook’s Mark Zuckerberg and others call it “Friend Mining.” It is, in essence, searching for answers from friends’ experiences as opposed to faceless code. And Facebook has all of those friends’ experiences already stored as data. eMarketer says search in an $18 billion business, and investors are really into it. So no shock Facebook’s ready to leverage their social graph into relevant search. What do you do about all this as a brand? For one thing, it’s going to lead to some interesting paid marketing opportunities around the corner, including Sponsored Stories bought against certain queries, inserting deals into search results, capitalizing on social search results on mobile, etc. Apart from that, it might be time to stop mentally separating social and search in your strategic planning and budgeting. Courting your fans on social will cumulatively add up to more valuable, personally endorsed recommendations for your company when a consumer conducts a search on social. Fail to foster those relationships, fail to engage, fail to provide knock-em-dead customer service, fail to wow them with your actual products and services…and you’ll wind up with the visibility you deserve in social search results.

    Read the article

  • Single use download script - Modification [on hold]

    - by Iulius
    I have this Single use download script! This contain 3 php files: page.php , generate.php and variables.php. Page.php Code: <?php include("variables.php"); $key = trim($_SERVER['QUERY_STRING']); $keys = file('keys/keys'); $match = false; foreach($keys as &$one) { if(rtrim($one)==$key) { $match = true; $one = ''; } } file_put_contents('keys/keys',$keys); if($match !== false) { $contenttype = CONTENT_TYPE; $filename = SUGGESTED_FILENAME; readfile(PROTECTED_DOWNLOAD); exit; } else { ?> <html> <head> <meta http-equiv="refresh" content="1; url=http://docs.google.com/"> <title>Loading, please wait ...</title> </head> <body> Loading, please wait ... </body> </html> <?php } ?> Generate.php Code: <?php include("variables.php"); $password = trim($_SERVER['QUERY_STRING']); if($password == ADMIN_PASSWORD) { $new = uniqid('key',TRUE); if(!is_dir('keys')) { mkdir('keys'); $file = fopen('keys/.htaccess','w'); fwrite($file,"Order allow,deny\nDeny from all"); fclose($file); } $file = fopen('keys/keys','a'); fwrite($file,"{$new}\n"); fclose($file); ?> <html> <head> <title>Page created</title> <style> nl { font-family: monospace } </style> </head> <body> <h1>Page key created</h1> Your new single-use page link:<br> <nl> <?php echo "http://" . $_SERVER['HTTP_HOST'] . DOWNLOAD_PATH . "?" . $new; ?></nl> </body> </html> <?php } else { header("HTTP/1.0 404 Not Found"); } ?> And the last one Variables.php Code: <? define('PROTECTED_DOWNLOAD','download.php'); define('DOWNLOAD_PATH','/.work/page.php'); define('SUGGESTED_FILENAME','download-doc.php'); define('ADMIN_PASSWORD','1234'); define('EXPIRATION_DATE', '+36 hours'); header("Cache-Control: no-cache, must-revalidate"); header("Expires: ".date('U', strtotime(EXPIRATION_DATE))); ?> The http://www.site.com/generate.php?1234 will generate a unique link like page.php?key1234567890. This link page.php?key1234567890 will be sent by email to my user. Now how can I generate a link like this page.php?key1234567890&[email protected] ? So I think I must access the generator page like this generate.php?1234&[email protected] . P.S. This variable will be posted on the download page by "Hello, " I tried everthing to complete this, and no luck. Thanks in advance for help.

    Read the article

  • ObjectiveC builtin template system ?

    - by Aurélien Vallée
    I am developing an iPhone application and I use HTML to display formatted text. I often display the same webpage, but with a different content. I would like to use a template HTML file, and then fill it with my diffent values. I wonder if ObjectiveC has a template system similar to ERB in Ruby. That would allow to do things like Template: <HTML> <HEAD> </HEAD> <BODY> <H1>{{{title}}}</H1> <P>{{{content}}}</P> </BODY> </HTML> ObjectiveC (or what it may be in an ideal world) Template* template = [[Template alloc] initWithFile:@"my_template.tpl"]; [template fillMarker:@"title" withContent:@"My Title"]; [template fillMarker:@"content" withContent:@"My text here"]; [template process]; NSString* result = [template result]; [template release]; And the result string would contain: <HTML> <HEAD> </HEAD> <BODY> <H1>My Title</H1> <P>My text here</P> </BODY> </HTML> The above example could be achieved with some text replacement, but that would be a pain to maintain. I would also need something like loops inside templates. For instance if I have multiple items to display, i would like to generate multiple divs. Thanks for reading :)

    Read the article

  • Can XHTML nest more XHTML?

    - by zneak
    It's legal to nest SVG documents inside XHTML documents; but is it legal to nest XHTML documents inside other XHTML documents in the same fashion? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Sup</title> </head> <body> <h1>Hello World!</h1> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Nested document</title> </head> <body> <p>This is a sample</p> </body> </html> </body> </html>

    Read the article

  • Please help with my JSP Internationalization problem

    - by wokena
    I have problem with I18N in JSP, specifically, with forms. When I enter some Czech characters (e.g., "ešcržýá...") into my page one form, into the field "fieldOne", and then show text from that field on page two, instead of Czech characters I see this as "čč". (Note, the second page gets the Czech characters with "request.getProperty("fieldOne")") Here is the source code: Page one: <%@page contentType="text/html"%> <%@page pageEncoding="UTF-8"%> <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %> <%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %> <%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %> <html> <head></head> <body> <form action="druha.jsp" method="post"> <input type="textarea" name="fieldOne"> <input type="submit"> </form> </body> </html> Page two: <%@page contentType="text/html" pageEncoding="UTF-8"%> <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %> <%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %> <%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %> <html> <head></head> <body> <h1>The text: </h1> <%=request.getProperty("fieldOne")%> </body> </html> Thanks for help...

    Read the article

  • How and when do browsers implement real-time changes to a document's DOM?

    - by Mark
    My website dynamically embeds an external Javascript file into the head tag. The external Javascript defines a global variable myString = "data". At what point does myString become accessible to Javascript within the website? <html> <head> <script type="text/javascript"> myString = null; external = document.createElement("script"); //externalScript.js is one line, containing the following: //myString = "data"; external.setAttribute("src", "externalScript.js"); external.setAttribute("type", "text/javascript"); document.getElementsByTagName("head")[0].append(external); alert(myString); <script> </head> <body> </body> </html> This code alerts null (when I thought it would alert "data") in Chrome and IE, even though the DOM has loaded in externalScript.js at this point. When is externalScript.js actually evaluated by the browser and at what point do I have access to the new value of myString?

    Read the article

  • why my print doesn't work?

    - by udaya
    hi In this below program i am printing the contents of the div when i click the print button i am receiving an alert message printer error not available why it is so <html> <head> <script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.1.min.js" > </script> <script type="text/javascript"> function PrintElem(elem) { Popup($(elem).text()); } function Popup(data) { var mywindow = window.open('', 'my div', 'height=400,width=600'); mywindow.document.write('<html><head><title>my div</title>'); /*optional stylesheet*/ //mywindow.document.write('<link rel="stylesheet" href="main.css" type="text/css" />'); mywindow.document.write('</head><body >'); mywindow.document.write(data); mywindow.document.write('</body></html>'); mywindow.document.close(); mywindow.print(); return true; } </script> </head> <body> <div id="mydiv"> This will be printed. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque a quam at nibh adipiscing interdum. Nulla vitae accumsan ante. </div> <input type="button" value="Print Div" onclick="PrintElem('#mydiv')" /> </body> </html>

    Read the article

  • drupal_add_css not working

    - by hfidgen
    Hiya, I need to use drupal_add_css to call stylesheets onto single D6 pages. I don't want to edit the main theme stylesheet as there will be a set of individual pages which all need completely new styles - the main sheet would be massive if i put it all in there. My solution was to edit the page in PHP editor mode and do this: <?php drupal_add_css("/styles/file1.css", "theme"); ?> <div id="newPageContent">stuff here in html</div> But when i view source, there is nothing there! Not even a broken css link or anything, it's just refusing to add the css sheet to the css package put into the page head. Variations don't seem to work either: drupal_add_css($path = '/styles/file1.css', $type = 'module', $media = 'all', $preprocess = TRUE) My template header looks like this, i've not changed anything from the default other than adding a custom JS. <head> <?php print $head ?> <title><?php print $head_title ?></title> <?php print $styles ?> <?php print $scripts ?> <script type="text/javascript" src="<?php print base_path() ?>misc/askme.js"></script> <!--[if lt IE 7]> <?php print phptemplate_get_ie_styles(); ?> <![endif]--> </head> Can anyone think of a reason why this function is not working? Thanks!

    Read the article

  • twitter bootstrap typeahead 2.0.4 ajax error

    - by Adam Levitt
    I have the following code which definitely returns a proper data result if I use the 2.0.0 version, but for some reason bootstrap's typeahead plugin is giving me an error. I pasted it below the code sample: <input id="test" type="text" /> $('#test').typeahead({ source: function(typeahead, query) { return $.post('/Profile/searchFor', { query: query }, function(data) { return typeahead.process(data); }); } }); When I run this example I'm getting a jQuery bug that says the following: ** item is undefined matcher(item=undefined)bootst...head.js (line 104) <br/>(?)(item=undefined)bootst...head.js (line 91) <br/>f(a=function(), b=function(), c=false)jquery....min.js (line 2) <br/>lookup(event=undefined)bootst...head.js (line 90) <br/>keyup(e=Object { originalEvent=Event keyup, type="keyup", timeStamp=145718131, more...})bootst...head.js (line 198) <br/>f()jquery....min.js (line 2) <br/>add(c=Object { originalEvent=Event keyup, type="keyup", timeStamp=145718131, <br/>more...})jquery....min.js (line 3) <br/>add(a=keyup charCode=0, keyCode=70)jquery....min.js (line 3) <br/>[Break On This Error] <br/>return item.toLowerCase().indexOf(this.query.toLowerCase())** Any thoughts? ... The same code works in the 2.0.0 version of the plugin, but fails to write to my knockout object model.

    Read the article

  • Java, LinkedList of Strings. Insert in alphabetical order

    - by user69514
    I have a simple linked list. The node contains a string (value) and an int (count). In the linkedlist when I insert I need to insert the new Node in alphabetical order. If there is a node with the same value in the list, then I simply increment the count of the node. I think I got my method really screwed up. public void addToList(Node node){ //check if list is empty, if so insert at head if(count == 0 ){ head = node; head.setNext(null); count++; } else{ Node temp = head; for(int i=0; i<count; i++){ //if value is greater, insert after if(node.getItem().getValue().compareTo(temp.getItem().getValue()) > 0){ node.setNext(temp.getNext()); temp.setNext(node); } //if value is equal just increment the counter else if(node.getItem().getValue().compareTo(temp.getItem().getValue()) == 0){ temp.getItem().setCount(temp.getItem().getCount() + 1); } //else insert before else{ node.setNext(temp); } } } }

    Read the article

  • How to set a define inside other define

    - by João Madureira Pires
    Hi all! I'm developing a web application in jboss, seam, richfaces. I'm using a template(xhtml) as master page of all others and there i set two insert tags. <ui:insert name="head"/> <ui:insert name="body"/> The problem is that in pages that use this master page as template, the <ui:define name="head">...</ui:define> must be defined inside the <ui:define name="body">...</ui:define>. How can i do this? Basically, what i want is to do the following: <ui:define name="body">... <ui:define name="head"> <meta name="title" content="#{something.title}" /> </ui:define> ...</ui:define> the master page must return : <meta name="title" content="#{something.title}" /> on the <ui:insert name="head"/> Thanks in advance

    Read the article

  • why cookie.getMaxAge() = -1?

    - by wavelet
    i have a test like this : cookie.jsp: <html> <head> </head> <body> <% String cookieName="SNS"; Cookie cookie=new Cookie(cookieName, "maxAgeTest"); cookie.setMaxAge(60*60); response.addCookie(cookie); %> </body> </html> and read.jsp is : <html> <head> </head> <body> <table border=1> <tr><td>Name</td><td>value</td></tr> <% Cookie cookies[]=request.getCookies(); Cookie sCookie=null; String svalue=null; String sname=null; int sage ; for(int i=0;i<cookies.length;i++) { sCookie=cookies[i]; svalue=sCookie.getValue(); sname=sCookie.getName(); sage=sCookie.getMaxAge(); %> <tr><td><%=sname%></td><td><%=svalue%></td><td><%=sage%></td></tr> <% } %> </table> </body> </html> but the result is : Name value maxAge JSESSIONID DB3561A47B37FCA8CA25EA04B80A26C7 -1 SNS maxAgeTest -1 why the maxAge is -1 ? and t test IE8,Chrome5,Safari ,the result same

    Read the article

  • using JQuery and Prototype in the same page

    - by Don
    Hi, Several of my pages use both JQuery and Protoype. Since I upgraded to version 1.3 of JQuery this appears to be causing problems, because both libraries define a function named '$'. JQuery provides a function noConflict() which relinquishes control of $ to other libraries that may be using it. So it seems like I need to go through all my pages that look like this: <head> <script type="text/javascript" src="/obp/js/prototype.js"></script> <script type="text/javascript" src="/obp/js/jquery.js"></script> </head> and change them to look like this: <head> <script type="text/javascript" src="/obp/js/prototype.js"></script> <script type="text/javascript" src="/obp/js/jquery.js"></script> <script type="text/javascript"> jQuery.noConflict(); var $j = jQuery; </script> </head> I should then be able to use '$' for Prototype and '$j' (or 'jQuery') for JQuery. I'm not entirely happy about duplicating these 2 lines of code in every relevant page, and expect that at some point somebody is likely to forget to add them to a new page. I'd prefer to be able to do the following Create a file jquery-noconflict.js which "includes" jquery.js and the 2 lines of code shown above Import jquery-noconflict.js (instead of jquery.js) in all my JSP/HTML pages However, I'm not sure if it's possible to include one JS file in another, in the manner I've described? Of course an alternate solution is simply to add the 2 lines of code above to jquery.js directly, but if I do that I'll need to remember to do it every time I upgrade JQuery. Thanks in advance, Don

    Read the article

  • Firefox reloading parent page in iframe when clicking named anchor

    - by masty
    My site has an iframe which is dynamically populated with html content. The html often contains named anchors, which work fine in IE/Chrome but in Firefox it reopens the entire page within the iframe. Here's an example: load the page in firefox, scroll to the bottom of the iframe, click the "back to top" link, and you will see what I am talking about. <html><head></head><body onload="setFrameContent();"><script> var htmlBody = '<html> <head></head> <body>' + '<a name="top"><h1>top</h1></a>' + '<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>' + '<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>' + '<a href="#top">back to top</a></body> </html> '; function setFrameContent(){ if (frames.length > 0) { var d = frames[0].document; d.open(); d.write(htmlBody); d.close(); } } </script> <h1>Here's an iframe:</h1> <iframe id="htmlIframe" style="height: 400px; width: 100%"><p>Your browser does not support iframes.</p></iframe> </body></html> Any ideas?

    Read the article

  • How to pull one commit at a time from a remote git repository?

    - by Norman Ramsey
    I'm trying to set up a darcs mirror of a git repository. I have something that works OK, but there's a significant problem: if I push a whole bunch of commits to the git repo, those commits get merged into a single darcs patchset. I really want to make sure each git commit gets set up as a single darcs patchset. I bet this is possible by doing some kind of git fetch followed by interrogation of the local copy of the remote branch, but my git fu is not up to the job. Here's the (ksh) code I'm using now, more or less: git pull -v # pulls all the commits from remote --- bad! # gets information about only the last commit pulled -- bad! author="$(git log HEAD^..HEAD --pretty=format:"%an <%ae>")" logfile=$(mktemp) git log HEAD^..HEAD --pretty=format:"%s%n%b%n" > $logfile # add all new files to darcs and record a patchset. this part is OK darcs add -q --umask=0002 -r . darcs record -a -A "$author" --logfile="$logfile" darcs push -a rm -f $logfile My idea is Try git fetch to get local copy of the remote branch (not sure exactly what arguments are needed) Somehow interrogate the local copy to get a hash for every commit since the last mirroring operation (I have no idea how to do this) Loop through all the hashes, pulling just that commit and recording the associated patchset (I'm pretty sure I know how to do this if I get my hands on the hash) I'd welcome either help fleshing out the scenario above or suggestions about something else I should try. Ideas?

    Read the article

  • Java remove HTML from String without regular expressions

    - by behrk2
    Hello, I am trying to remove all HTML elements from a String. Unfortunately, I cannot use regular expressions because I am developing on the Blackberry platform and regular expressions are not yet supported. Is there any other way that I can remove HTML from a string? I read somewhere that you can use a DOM Parser, but I couldn't find much on it. Text with HTML: <![CDATA[As a massive asteroid hurtles toward Earth, NASA head honcho Dan Truman (<a href="http://www.netflix.com/RoleDisplay/Billy_Bob_Thornton/20000303">Billy Bob Thornton</a>) hatches a plan to split the deadly rock in two before it annihilates the entire planet, calling on Harry Stamper (<a href="http://www.netflix.com/RoleDisplay/Bruce_Willis/99786">Bruce Willis</a>) -- the world's finest oil driller -- to head up the mission. With time rapidly running out, Stamper assembles a crack team and blasts off into space to attempt the treacherous task. <a href="http://www.netflix.com/RoleDisplay/Ben_Affleck/20000016">Ben Affleck</a> and <a href="http://www.netflix.com/RoleDisplay/Liv_Tyler/162745">Liv Tyler</a> co-star.]]> Text without HTML: As a massive asteroid hurtles toward Earth, NASA head honcho Dan Truman (Billy Bob Thornton) hatches a plan to split the deadly rock in two before it annihilates the entire planet, calling on Harry Stamper (Bruce Willis) -- the world's finest oil driller -- to head up the mission. With time rapidly running out, Stamper assembles a crack team and blasts off into space to attempt the treacherous task.Ben Affleck and Liv Tyler co-star. Thanks!

    Read the article

  • I need to get form data from multiple forms on one page using $_POST

    - by CDeanMartin
    My project is a menu that displays daily specials at a cafe. The Pointy Haired Boss(PHB) needs to add/remove items from the menu on a daily basis, so I stored all dishes with MySQL, and created a page which will load all menu items as buttons. When clicked, the button will UPDATE the item, turning it on or off. I need form data to detect which button was pressed, so my query knows which $menuItem to UPDATE. That is the purpose of the hidden fields. <html><head></head> <body> <html><head></head> <body> <?php include("getElement.php"); $keys = array_keys($_POST); echo $keys[0]; echo $keys[1]; //if(isset($_POST["menuItem"])){ //toggleItem($_POST["menuItem"]); //echo print_r(array_keys($_POST));} ?> <form name="b" action="scratchpad.php" method="post" > <input type="hidden" name="b" value="Cajun Gumbo"/> <input type="submit" style="color:blue" value="Cajun Gumbo" /> </form> <form name="a" action="scratchpad.php" method="post" > <input type="hidden" name="a" value="Guacomole Burger"/> <input type="submit" style="color:blue" value="Guacomole Burger" /> </form> </body> </html> Can I get $_POST to identify which button was pressed?

    Read the article

  • How to find nth element from the end of a singly linked list?

    - by Codenotguru
    The following function is trying to find the nth to last element of a singly linked list. For example: If the elements are 8->10->5->7->2->1->5->4->10->10 then the result is 7th to last node is 7. Can anybody help me on how this code is working or is there a better and simpler approach? LinkedListNode nthToLast(LinkedListNode head, int n) { if (head == null || n < 1) { return null; } LinkedListNode p1 = head; LinkedListNode p2 = head; for (int j = 0; j < n - 1; ++j) { // skip n-1 steps ahead if (p2 == null) { return null; // not found since list size < n } p2 = p2.next; } while (p2.next != null) { p1 = p1.next; p2 = p2.next; } return p1; }

    Read the article

  • Problem with using malloc in link lists (urgent ! help please)

    - by Abhinav
    I've been working on this program for five months now. Its a real time application of a sensor network. I create several link lists during the life of the program and Im using malloc for creating a new node in the link. What happens is that the program suddenly stops or goes crazy and restarts. Im using AVR and the microcontroller is ATMEGA 1281. After a lot of debugging I figured out that that the malloc is causing the problem. I do not free the memory after exiting the function that creates a new link so Im guessing that this is eventually causing the heap memory to overflow or something like that. Now if I use the free() function to deallocate the memory at the end of the function using malloc, the program just gets stuck when the control reaches free(). Is this because the memory becomes too clustered after calling free() ? I also create reference tables for example if 'head' is a new link list and I create another list called current and make it equal to head. table *head; table *current = head; After the end of the function if I use free free(current); current = NULL: Then the program gets stuck here. I dont know what to do. What am I doing wrong? Is there a way to increase the size of the heap memory Please help...

    Read the article

  • asp.net: saving js file with c# commands...

    - by ile
    <head runat="server"> <title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /></title> <link href="../../Content/css/layout.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="/Areas/CMS/Content/js/jquery-1.3.2.min.js"></script> <script type="text/javascript" src="/Areas/CMS/Content/js/jquery.jeditable.js"></script> <script type="text/javascript" src="/Areas/CMS/Content/js/jeditable.js"></script> <script type="text/javascript"> $(document).ready(function() { $(".naslov_vijesti").editable('<%=Url.Action("UpdateSettings","Article") %>', { submit: 'ok', submitdata: {field: "Title"}, cancel: 'cancel', cssclass: 'editable', width: '99%', placeholder: 'emtpy', indicator: "<img src='../../Content/img/indicator.gif'/>" }); }); </script> </head> This is head tag of site.master file. I would like to remove this multiline part from head and place it in jeditable.js file, which is now empty. If I do copy/paste, then <% %> part won't be executed. In PHP I would save js file as jeditable.js.php and server would compile code that is in <?php ?> tag. Any ideas how to solve this problem? Thanks in advance, Ile

    Read the article

  • Saving js file with c# commands...

    - by ile
    <head runat="server"> <title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /></title> <link href="../../Content/css/layout.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="/Areas/CMS/Content/js/jquery-1.3.2.min.js"></script> <script type="text/javascript" src="/Areas/CMS/Content/js/jquery.jeditable.js"></script> <script type="text/javascript" src="/Areas/CMS/Content/js/jeditable.js"></script> <script type="text/javascript"> $(document).ready(function() { $(".naslov_vijesti").editable('<%=Url.Action("UpdateSettings","Article") %>', { submit: 'ok', submitdata: {field: "Title"}, cancel: 'cancel', cssclass: 'editable', width: '99%', placeholder: 'emtpy', indicator: "<img src='../../Content/img/indicator.gif'/>" }); }); </script> </head> This is head tag of site.master file. I would like to remove this multiline part from head and place it in jeditable.js file, which is now empty. If I do copy/paste, then <% %> part won't be executed. In PHP I would save js file as jeditable.js.php and server would compile code that is in <?php ?> tag. Any ideas how to solve this problem? Thanks in advance, Ile

    Read the article

  • HTML file: add annotations through IHTMLDocument

    - by peterchen
    I need to add "annotations" to existing HTML documents - best in the form of string property values I can read & write by name. Apparently (to me), meta elements in the header seem to be the common way - i.e. adding/modifying elements like <head> <meta name="unique-id_property-name" content="property-value"/> ... </head> Question 1: Ist that "acceptable" / ok, or is there a better way to add meta data? I have a little previous experience with getting/mut(il)ating HTML contents through the document in an web browser control. For this task, I've already loaded the HTML document into a HTMLDocument object, but I'm not sure how to go on: // what I have IHTMLDocument2Ptr doc; doc.CreateInstance(__uuidof(HTMLDocument)); IPersistFile pf = doc; pf->Load(fileName, STGM_READ); // everything ok until here Questions 2: Should I be using anything else than HTMLDocument? Questions 3..N: How do I get the head element? How do I get the value of a meta element with a given name? How do I set the value of a meta element (adding the item if and only if it doesn't exist yet)? doc->all returns a collection of all tags, which I can enumerate even though count returns 0. I could scan that for head, then scan that for all meta where the name starts with a certain string, etc. - but this feels very clumsy.

    Read the article

  • set border for table with overflow is auto

    - by lucky
    Hi All, I would like to have a border for the table with class name as "wanttosetborder". Without the div it is setting border for this table. With the div tag, it is setting border till the last row before div tag,(i.e a line after H2 is displayed) after that no border is displayed. Please find the code below. <html> <head> <head> <style type="text/css"> #user{width: 50px;height:150px;overflow:auto;position:absolute} </style> </head> </head> <body> <TABLE class="wanttosetborder" CELLPADDING=1 cellspacing="1" border="1"> <tr><td>ABC</td></tr> <tr><td>H2</td></tr> <tr> <td> <div id="user"> <table> <?php for($i=1; $i<=10;$i++) { ?> <tr><td>123</td> </tr> <?php }?> </table> </div> </td> </tr> </TABLE> </body> </html>

    Read the article

  • Linked list example using threads

    - by Carl_1789
    I have read the following code of using CRITICAL_SECTION when working with multiple threads to grow a linked list. what would be the main() part which uses two threads to add to linked list? #include <windows.h> typedef struct _Node { struct _Node *next; int data; } Node; typedef struct _List { Node *head; CRITICAL_SECTION critical_sec; } List; List *CreateList() { List *pList = (List*)malloc(sizeof(pList)); pList->head = NULL; InitializeCriticalSection(&pList->critical_sec); return pList; } void AddHead(List *pList, Node *node) { EnterCriticalSection(&pList->critical_sec); node->next = pList->head; pList->head = node; LeaveCriticalSection(&pList->critical_sec); } void Insert(List *pList, Node *afterNode, Node *newNode) { EnterCriticalSection(&pList->critical_sec); if (afterNode == NULL) { AddHead(pList, newNode); } else { newNode->next = afterNode->next; afterNode->next = newNode; } LeaveCriticalSection(&pList->critical_sec); } Node *Next(List *pList, Node *node) { Node* next; EnterCriticalSection(&pList->critical_sec); next = node->next; LeaveCriticalSection(&pList->critical_sec); return next; }

    Read the article

< Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >