Search Results

Search found 3479 results on 140 pages for 'chris condy'.

Page 102/140 | < Previous Page | 98 99 100 101 102 103 104 105 106 107 108 109  | Next Page >

  • How do I return the ancestors of an object with LINQ?

    - by Chris
    I have a District class that looks like this: public class District { public int Id { get; set; } public string Name { get; set; } public District Parent { get; set; } public IEnumerable<District> Ancestors { get { /* what goes here? */ } } } I would like to be able to get a list of each District's ancestors. So if District "1.1.1" is a child of District "1.1", which is a child of District "1", getting Ancestors on District "1.1.1" would return a list that contains the District objects whose names are "1.1" and "1". Does this involve the yield return statement (I never totally understood that)? Can it be done in one line?

    Read the article

  • infix operation to postfix using stacks

    - by Chris De La O
    We are writing a program that needs to convert an infix operation (4 5/3) to postfix (4 5 3 / ) using stacks. however my convert to postfix does not work as it doesnt not output the postFix array that is supposed to store the conversion from infix notation to postfix notation. here is the code for the convertToPostix fuction. //converts infix expression to postfix expression void ArithmeticExpression::convertToPostfix(char *const inFix, char *const postFix) { //create a stack2 object named cow Stack2<char> cow; cout<<postFix; char thing = '('; //push a left parenthesis onto the stack cow.push(thing); //append a right parenthesis to the end of inFix array strcat(inFix, ")"); int i = 0;//declare an int that will control posFix position //if the stack is not empty if (!cow.isEmpty()) { //loop to run until the last character in inFix array for (int x = 0; inFix[x]!= '\0'; x++ ) { //if the inFix element is a digit if (isdigit(inFix[x])) { postFix[i]=inFix[x];//it is assigned to the next element in postFix array i++;//move on to next element in postFix } //if the inFix element is a left parenthesis else if (inFix[x]=='(') { cow.push(inFix[x]);//push it unto the stack } //if the inFix element is an operator else if (isOperator(inFix[x])) { char oper2 = inFix[x];//char variable holds inFix operator if (isOperator(cow.stackTop()))//if the top node in the stack is an operator { while (isOperator(cow.stackTop()))//and while the top node in the stack is an operator { char oper1 = cow.stackTop();//char variable holds node operator if(precedence( oper1, oper2))//if the node operator has higher presedence than node operator { postFix[i] = cow.pop();//we pop such operator and insert it in postFix array's next element cow.push(inFix[x]);//and push inFix operator unto the stack i++;//move to the next element in posFix } } } //if the top node is not an operator //we push the current inFix operator unto the top of the stack else cow.push(inFix[x]); } //if the inFix element is a right parenthesis else if (inFix[x]==')') { //we pop everything in the stack and insert it in postFix //until we arrive at a left paranthesis while (cow.stackTop()!='(') { postFix[i] = cow.pop(); i++; } //we then pop and discard left parenthesis cow.pop(); } } postFix[i]='\0'; //print !!postFix array!! (not stack) print();//code for this is just cout<<postFix; }

    Read the article

  • Disable buttons on post back using jquery in .net app

    - by Chris Lively
    I have a asp.net app that I want to disable the buttons as soon as they are clicked in order to prevent multiple submissions. I'd like to use jquery for this as the site already liberally uses it anyway. What I've tried is: $(document).ready(function () { $("#aspnetForm").submit(function () { $('input[type=submit]', $(this)).attr("disabled", "disabled"); }) }); The above will disable the button, and the page submits, but the asp.net button on click handler is never called. Simply removing the above and the buttons work as normal. Is there a better way?

    Read the article

  • Downloading a webpage in C# example

    - by Chris
    I am trying to understand some example code on this web page: (http://www.csharp-station.com/HowTo/HttpWebFetch.aspx) that downloads a file from the internet. The piece of code quoted below goes through a loop getting chunks of data and saving them to a string until all the data has been downloaded. As I understand it, "count" contains the size of the downloaded chunk and the loop runs until count is 0 (an empty chunk of data is downloaded). My question is, isn't it possible that count could be 0 without the file being completely downloaded? Say if the network connection is interrupted, the stream may not have any data to read on a pass of the loop and count should be 0, ending the download prematurely. Or does ResStream.Read stop the program until it gets data? Is this the correct way to save a stream? int count = 0; do { // fill the buffer with data count = resStream.Read(buf, 0, buf.Length); // make sure we read some data if (count != 0) { // translate from bytes to ASCII text tempString = Encoding.ASCII.GetString(buf, 0, count); // continue building the string sb.Append(tempString); } } while (count 0); // any more data to read?

    Read the article

  • compare function for dates

    - by Chris
    I have struct as: struct stored { char *dates; // 12/May/2010, 10/Jun/2010 etc.. int ctr; }; // const struct stored structs[] = {{"12/May/2010", 1}, {"12/May/2011", 1}, {"21/May/2009", 4}, {"12/May/2011", 3}, {"10/May/2011", 8}, {"12/May/2011", 4 }}; What I want to do is to sort struct 'stored' by stored.dates. qsort(structs, 9, sizeof(struct stored*), sortdates); // sortdates function I'm not quite sure what would be a good way to sort those days? Compare them as c-strings?

    Read the article

  • LinkedList Wrong Display(string builder)

    - by Chris
    Hello, The following program is a basic linked list divided in 3 classes. In the tester class (main) i add several numbers to the list (sorted). But insteed of getting the numbers as a result i get the result: LinkedList.LinkedList Is something wrong with the stringbuilder (the program was first in java where a string buffer was used, but that should be the same i think?) LinkedListTester.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace LinkedList { public class LinkedListTester { static void Main(string[] args) { LinkedList ll = new LinkedList(); ll.addDataSorted(5); ll.addDataSorted(7); ll.addDataSorted(13); ll.addDataSorted(1); ll.addDataSorted(17); ll.addDataSorted(8); Console.WriteLine(ll); } } }/LinkedList/ LinkedList.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace LinkedList { public class LinkedList { //toestand private LinkedListNode first; private LinkedListNode last; //gedrag public LinkedList() { first = null; last = null; } public void addDataInFront(int data) { first = new LinkedListNode(data, first); if (last == null){ last = first; } }/*addDataInFront*/ public void addDataToBack(int data) { if (first == null) { addDataInFront(data); } else { last.setNext(new LinkedListNode(data, null)); last = last.getNext(); } }/*addDataToBack*/ public void addDataSorted(int data) { if (first == null || first.getData() > data) { addDataInFront(data); } else { LinkedListNode currentNode = first; while (currentNode.getNext() != null && currentNode.getNext().getData() < data) { currentNode = currentNode.getNext(); } currentNode.setNext(new LinkedListNode(data, currentNode.getNext())); currentNode = currentNode.getNext(); if (currentNode.getNext() == null) { last = currentNode; } } }/*addDataSorted*/ public String toString() { StringBuilder Buf = new StringBuilder(); LinkedListNode currentNode = first; while (currentNode != null) { Buf.Append(currentNode.getData()); Buf.Append(' '); currentNode = currentNode.getNext(); } return Buf.ToString(); }/*toString*/ }/*LinkedList*/ }/LinkedList/ LinkedListNode: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace LinkedList { public class LinkedListNode { //toestand private int data; private LinkedListNode next; private LinkedListNode previous; //gedrag public LinkedListNode(int data, LinkedListNode next) { this.data = data; this.next = next; this.previous = null; } public LinkedListNode(int data, LinkedListNode next, LinkedListNode previous) { this.data = data; this.next = next; this.previous = previous; } public LinkedListNode getNext() { return next; } public LinkedListNode getPrevious() { return previous; } public void setNext(LinkedListNode next) { this.next = next; } public void setPrevious(LinkedListNode previous) { this.previous = previous; } public int getData() { return data; } }/*LinkedListNode*/ }/LinkedList/

    Read the article

  • Set Page Output Cache VaryByCustom value programmatically

    - by Chris Marisic
    I want to use an Enum value for the types of VaryByCustom parameters I will support, is it possible to do this? I tried setting it in the page itself <%@ OutputCache Duration="600" VaryByParam="none" VaryByCustom='<%=VaryByCustomType.IsAuthenticated.ToString(); %>' %> But this returned the entire literal string "<%=VaryByCustomType.IsAuthenticated.ToString(); %>" inside my global.asax is there any way to do this either on the page itself or from the codebehind? Or is this just something I have to accept is purely magic strings and nothing I can do to add type safety to it?

    Read the article

  • larger file upload problem with php

    - by chris
    I need to upload a csv file to a server. works fine for smaller files but when the file is 3-6 meg its not working. $allowedExtensions = array("csv"); foreach ($_FILES as $file) { if ($file['tmp_name'] > '') { if (!in_array(end(explode(".", strtolower($file['name']))), $allowedExtensions)) { die($file['name'].' is an invalid file type!<br/>'. '<a href="javascript:history.go(-1);">'. '&lt;&lt Go Back</a>'); } if (move_uploaded_file($file['tmp_name'], $uploadfile)) { echo "File is valid, and was successfully uploaded.\n"; } else { echo "Possible file upload attack!\n"; } echo "File has been uploaded"; } //upload form <form name="upload" enctype="multipart/form-data" action="<? echo $_SERVER['php_self'];?>?action=upload_process" method="POST"> <!-- MAX_FILE_SIZE must precede the file input field --> <input type="hidden" name="MAX_FILE_SIZE" value="31457280" /> <!-- Name of input element determines name in $_FILES array --> Send this file: <input name="userfile" type="file" /> <input type="submit" value="Send File" /> </form> I have also added this to htaccess php_value upload_max_filesize 20M php_value post_max_size 20M php_value max_execution_time 200 php_value max_input_time 200 Where am i going wrong?

    Read the article

  • If free() knows the length of my array, why can't I ask for it in my own code?

    - by Chris Cooper
    I know that it's a common convention to pass the length of dynamically allocated arrays to functions that manipulate them: void initializeAndFree(int* anArray, int length); int main(){ int arrayLength = 0; scanf("%d", &arrayLength); int* myArray = (int*)malloc(sizeof(int)*arrayLength); initializeAndFree(myArray, arrayLength); } void initializeAndFree(int* anArray, int length){ int i = 0; for (i = 0; i < length; i++) { anArray[i] = 0; } free(anArray); } but if there's no way for me to get the length of the allocated memory from a pointer, how does free() "automagically" know what to deallocate? Why can't I get in on the magic, as a C programmer? Where does free() get its free (har-har) knowledge from?

    Read the article

  • Is there a limit to the number of DataContracts that can be used by a WCF Service?

    - by Chris
    Using WCF3.5SP1, VS2008. Building a WCF service that exposes about 10 service methods. We have defined about 40 [DataContract] types that are used by the service. We now experience that adding an additional [DataContract] type to the project (in the same namespace as the other existing types) does not get properly exposed. The new type is not in the XSD schemas generated with the WSDL. We have gone so far as to copy and rename an existing (and working) type, but it too is not present in the generated WSDL/XSD. We've tried this on two different developer machines, same problem. Is there a limit to the number of types that can exposed as [DataContract] for a Service? per Namespace?

    Read the article

  • Executing an exe with arguments using Powershell

    - by Chris Charge
    This is what I want to execute: c:\Program Files (x86)\SEQUEL ViewPoint\viewpoint.exe /Setvar((POSTSTR $POSTSTR)(POSTEND $POSTEND)) /G:C:\viewpointfile.vpt /D:C:($BEGDATE to $TODDATE).xls This is what I have tried: $a = "/Setvar((POSTSTR $POSTSTR)(POSTEND $POSTEND))" $b = "/G:C:\viewpointfile.vpt" $c = "/D:C:($BEGDATE to $TODDATE).xls" $Viewpoint = "c:\Program Files (x86)\SEQUEL ViewPoint\viewpoint.exe" &$Viewpoint $a $b $c When I execute this I receive an error stating: File C:\viewpointfile.vpt "/D:C:($BEGDATE to $TODDATE).xls" not found! I'm not sure where it gets the extra quotes from. If I run the command with just $a and $b it runs fine. Any help would be greatly appreciated. Thanks! :) Update manojlds suggested echoargs so here it the output from it: &./echoargs.exe $viewpoint $a $b $c Arg 0 is C:\Program Files (x86)\SEQUEL ViewPoint\viewpoint.exe Arg 1 is /Setvar((POSTSTR 20101123)(POSTEND 20111123)) Arg 2 is /G:C:\viewpointfile.vpt Arg 3 is /D:C:(2010-11-23 to 2011-11-23 PM).xls It appears that all the arguments are being passed properly. When I run this as a command in cmd.exe it executes perfectly. So something on Powershells end must be messing up the output. Is there any other way to go about executing this command using Powershell?

    Read the article

  • CoreData is saving model without the save: method being called

    - by chris
    I have a list of items with a plus button in the navigation bar that opens up a modal window containing a table of the models attributes, that displays a form when the table items are clicked (pretty standard form style). For some reason if I click the plus button to open the form to create a new model, then immediately click the done button, the person model is saved. The action linked to the done button does nothing but call on a delegate method notifying the personListViewController to close the window. The apple docs do state that the model is not saved after calling the insertNewObjectForEntityName: ... Simply creating a managed object does not cause it to be saved to a persistent store. The managed object context acts as a scratchpad. I am at a lost to why this is happening, but every time I click the done button I have a new blank item in the original tableView. I am using SDK v3.1.3 // PersonListViewController - open modal window - (void)addPerson { // Load the new form PersonNewViewController *newController = [[PersonNewViewController alloc] init]; newController.modalFormDelegate = self; [self presentModalViewController:newController animated:YES]; [newController release]; } // PersonFormViewController - (void)viewDidLoad { [super viewDidLoad]; if ( person == nil ) { MyAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate]; self.person = [NSEntityDescription insertNewObjectForEntityForName:@"Person" inManagedObjectContext:appDelegate.managedObjectContext]; } ... UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(done)]; self.navigationItem.rightBarButtonItem = doneButton; [doneButton release]; } - (IBAction) done { [self.modalFormDelegate didCancel]; } // delegate method in the original listViewController - (void) didCancel { [self dismissModalViewControllerAnimated:YES]; }

    Read the article

  • Enterprise integration of disparate systems

    - by Chris Latta
    We're about to embark on a fairly large integration effort to kill off a bunch of Access and Sql Server databases and get everything into one coherent enterprise system. There are also a number of other systems (accounting, CRM, payroll, MS Exchange) that hold critical data that we need to integrate (use for data validation in other systems), report on and otherwise expose. It is likely that some of these systems will change in the next few years, so we need to isolate our systems to be ready for change. Ideally we would be able to expose our forms in a consistent manner across as many of our our systems as possible without having to re-develop them for each system. We are currently targeting SharePoint (2007 and soon 2010), Office (2007 and soon 2010 - Word, Excel, PowerPoint and Outlook), Reporting Services, .Net console applications, .Net Windows applications, shell extensions, and with the possibility of exposing some functionality on mobile devices (BlackBerries currently, maybe iPhones later) and via our website. We're moving development to Visual Studio 2010 (from 2005) ahead of migrating to SharePoint 2010 and Office 2010. Given that most of our development is presently targeted to the .Net framework (mostly in C#) it seems logical to stick with this unless there is some compelling reason to switch frameworks/platform for some aspects. We're thinking of your standard Database-Data Integration layer-Business Objects Layer-Web Services (or REST) layer-Client Application plus doing our own client application with WPF (or something else?) forms that can also be exposed in the MS systems (SharePoint, Office, Windows). So, we don't want much, just everything :) Basically we need to isolate ourselves from database and systems changes, create an API that can be used throughout our systems and then make this functionality available in our client applications. I'm very keen to get pointers from anyone who has tips on how to pull this off. Should we look at the Enterprise Library as a place to start? Is REST with ASP.Net MVC2 a better solution than Web Services for a system like this? Will WPF deliver forms re-use or is there something better?

    Read the article

  • where can I find a good ruby excel parser that also had good documentation?

    - by Chris Drappier
    Hi All, I've spent some time today looking for a pure ruby library that will parse an excel workbook. I could find the parseexcel gem in the repos, but the problem is that I can't find any documentation on it. and the rdoc is pitiful. so, my question is 1) is there good documentation out there for this gem? 2) if not, is there another gem that does the same thing that has good documentation? thx :) -C

    Read the article

  • How can I copy an XmlNode from one XmlDocument to another?

    - by Chris Wenham
    I'm building a tool that authors/edits XML files, and I want to be able to populate it with template fragments defined in another XML file. For example, the tool has an "Add FooBarBaz Element" button that adds a element to the new document being created, and I want to add FooBarBaz by copying it from a template. Or let's say this is my template file: <Templates> <FooBarBaz Attribute="Value"> <ChildElement/> </FooBarBaz> </Templates> I can then grab a template fragment with .GetElementsByTagName("FooBarBaz"), and I'd like to be able to inject it into the new document with something like .AppendChild(templateNode). But the problem is that an XmlNode cannot be copied from one XmlDocument to another, even if you use .Clone() or .CloneNode(), because AppendChild() throws an exception saying that the template element belongs to another context. Is there an easy way to copy a System.Xml.XmlNode between System.Xml.XmlDocuments?

    Read the article

  • App store for the PC?

    - by Chris
    So I've spent a lot of time making an iPhone game and have recently realized that I don't have to limit myself to just Apple - I know there are app stores for Palm and Android, but does anybody know of a good "app store" for the plain old PC? I would like to have one where individual developers can publish an app and not have to worry about all the billing and piracy issues!

    Read the article

  • jQuery - Multiple setInterval Conflict

    - by Chris Bowyer
    I am a jQuery novice and each of the following work fine on their own, but get out of time when working together. What am I doing wrong? Any improvement on the code would be appreciated too... It is to be used to rotate advertising. <!--- Header Rotator ---> <script type="text/javascript"> $(document).ready(function() { $("#header").load("header.cfm"); var refreshHeader = setInterval(function() { $("#header").load("header.cfm"); }, 10000); }); </script> <!--- Main Rotator ---> <script type="text/javascript"> $(document).ready(function() { $("#main").load("main.cfm"); var refreshMain = setInterval(function() { $("#main").load("main.cfm"); }, 5000); }); </script> <!--- Footer Rotator ---> <script type="text/javascript"> $(document).ready(function() { $("#footer").load("footer.cfm"); var refreshFooter = setInterval(function() { $("#footer").load("footer.cfm"); }, 2000); }); </script>

    Read the article

  • Modify onclick function with jQuery

    - by Chris Barr
    I've got a button that has an onclick event in it, which was set on the back end from .NET. Beside it is a checkbox <button class="img_button" onclick="if(buttonLoader(this)){WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions('uxBtnRelease', '', true, '', 'somepage.aspx?oupid=5&fp=true', false, true))} return false;" type="button">Release</button> <input type="checkbox" checked="checked" id="myCheckbox"> When the checkbox is clicked, needs to change the value of the query string in the URL inside the onclick function of the button. So far I have this, and the idea is right, but I keep getting errors when it's run: "Uncaught SyntaxError: Unexpected token ILLEGAL" var defaultReleaseOnClick=null; $("#myCheckbox").click(function(){ var $releaseBtn = $(".img_button"); if(defaultReleaseOnClick==null) defaultReleaseOnClick=$releaseBtn.attr("onclick"); var newOnClickString = defaultReleaseOnClick.toString().replace(/&fp=[a-z]+'/i,"&fp="+this.checked); $releaseBtn.removeAttr("onclick").click(eval(newOnClickString)); }); I know it seems kinda hacky to convert the function to a string, do a replacement, and then try to convert it back to a function, but I don't know any other way to do it. Any ideas? I've set up a demo here: http://jsbin.com/asiwu4/edit

    Read the article

  • How do you override an existing html form to use jquery to post the form?

    - by Chris
    I have a simple form that I am currently posting back to the server to update a nickname. What jquery code do I add (without changing the form) so that the page will not refresh, but instead jquery will post the form in the background and then pop up an alert message containing the reply back from the server? <form method="post" action="http://www.myserver.com/update_nickname" name="input"> Quick form to test update_nickname:<br> New nickname:<input type="text" value="BigJoe" name="newNickname"><br> <input type="submit" value="Submit"> </form> <script src="jquery-1.4.2.min.js" type="text/javascript"> </script>

    Read the article

  • Using UNC path as paths location in Mecurial IIS6 Server2003

    - by Chris M
    I'm running the latest Mercurial and Python 2.6; IIS6 is using the wildcard ISAPI method to attach the site to the Mecurial hgwebdir_wsgi [paths] \ = \\COMP3254\TestRepo\* [web] baseurl = / allow_push = * push_ssl = false style = monoblue The setup works perfectly if I reference the local drive E:\repo* but doesnt work if I specify the network as above; I've given the server (MERCDEV01$) full permissions on the shared folder on COMP3254, I can't think of any other reason it wouldn't work. Any ideas?

    Read the article

< Previous Page | 98 99 100 101 102 103 104 105 106 107 108 109  | Next Page >