Search Results

Search found 1809 results on 73 pages for 'steve dalton'.

Page 8/73 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Arithmetic operators and function calling in C

    - by Robert Dalton
    I'm not quite sure why I can't do double a = (float) my_Function(45) / 2048 / 2340 / 90; printf("%.4",a); // prints out 0.00 But instead I have to use one more variable as: double a = (float) my_Function(45); double b = (float) a / 2048 / 2340 / 90; printf("%.4",b); // prints out the correct value

    Read the article

  • c++ queue template

    - by Dalton Conley
    ALright, pardon my messy code please. Below is my queue class. #include <iostream> using namespace std; #ifndef QUEUE #define QUEUE /*---------------------------------------------------------------------------- Student Class # Methods # Student() // default constructor Student(string, int) // constructor display() // out puts a student # Data Members # Name // string name Id // int id ----------------------------------------------------------------------------*/ class Student { public: Student() { } Student(string iname, int iid) { name = iname; id = iid; } void display(ostream &out) const { out << "Student Name: " << name << "\tStudent Id: " << id << "\tAddress: " << this << endl; } private: string name; int id; }; // define a typedef of a pointer to a student. typedef Student * StudentPointer; template <typename T> class Queue { public: /*------------------------------------------------------------------------ Queue Default Constructor Preconditions: none Postconditions: assigns default values for front and back to 0 description: constructs a default empty Queue. ------------------------------------------------------------------------*/ Queue() : myFront(0), myBack(0) {} /*------------------------------------------------------------------------ Copy Constructor Preconditions: requres a reference to a value for which you are copying Postconditions: assigns a copy to the parent Queue. description: Copys a queue and assigns it to the parent Queue. ------------------------------------------------------------------------*/ Queue(const T & q) { myFront = myBack = 0; if(!q.empty()) { // copy the first node myFront = myBack = new Node(q.front()); NodePointer qPtr = q.myFront->next; while(qPtr != NULL) { myBack->next = new Node(qPtr->data); myBack = myBack->next; qPtr = qPtr->next; } } } /*------------------------------------------------------------------------ Destructor Preconditions: none Postconditions: deallocates the dynamic memory for the Queue description: deletes the memory stored for a Queue. ------------------------------------------------------------------------*/ ~Queue() { NodePointer prev = myFront, ptr; while(prev != NULL) { ptr = prev->next; delete prev; prev = ptr; } } /*------------------------------------------------------------------------ Empty() Preconditions: none Postconditions: returns a boolean value. description: returns true/false based on if the queue is empty or full. ------------------------------------------------------------------------*/ bool empty() const { return (myFront == NULL); } /*------------------------------------------------------------------------ Enqueue Preconditions: requires a constant reference Postconditions: allocates memory and appends a value at the end of a queue description: ------------------------------------------------------------------------*/ void enqueue(const T & value) { NodePointer newNodePtr = new Node(value); if(empty()) { myFront = myBack = newNodePtr; newNodePtr->next = NULL; } else { myBack->next = newNodePtr; myBack = newNodePtr; newNodePtr->next = NULL; } } /*------------------------------------------------------------------------ Display Preconditions: requires a reference of type ostream Postconditions: returns the ostream value (for chaining) description: outputs the contents of a queue. ------------------------------------------------------------------------*/ void display(ostream & out) const { NodePointer ptr; ptr = myFront; while(ptr != NULL) { out << ptr->data << " "; ptr = ptr->next; } out << endl; } /*------------------------------------------------------------------------ Front Preconditions: none Postconditions: returns a value of type T description: returns the first value in the parent Queue. ------------------------------------------------------------------------*/ T front() const { if ( !empty() ) return (myFront->data); else { cerr << "*** Queue is empty -- returning garbage value ***\n"; T * temp = new(T); T garbage = * temp; delete temp; return garbage; } } /*------------------------------------------------------------------------ Dequeue Preconditions: none Postconditions: removes the first value in a queue ------------------------------------------------------------------------*/ void dequeue() { if ( !empty() ) { NodePointer ptr = myFront; myFront = myFront->next; delete ptr; if(myFront == NULL) myBack = NULL; } else { cerr << "*** Queue is empty -- " "can't remove a value ***\n"; exit(1); } } /*------------------------------------------------------------------------ pverloaded = operator Preconditions: requires a constant reference Postconditions: returns a const type T description: this allows assigning of queues to queues ------------------------------------------------------------------------*/ Queue<T> & operator=(const T &q) { // make sure we arent reassigning ourself // e.g. thisQueue = thisQueue. if(this != &q) { this->~Queue(); if(q.empty()) { myFront = myBack = NULL; } else { myFront = myBack = new Node(q.front()); NodePointer qPtr = q.myFront->next; while(qPtr != NULL) { myBack->next = new Node(qPtr->data); myBack = myBack->next; qPtr = qPtr->next; } } } return *this; } private: class Node { public: T data; Node * next; Node(T value, Node * first = 0) : data(value), next(first) {} }; typedef Node * NodePointer; NodePointer myFront, myBack, queueSize; }; /*------------------------------------------------------------------------ join Preconditions: requires 2 queue values Postconditions: appends queue2 to the end of queue1 description: this function joins 2 queues into 1. ------------------------------------------------------------------------*/ template <typename T> Queue<T> join(Queue<T> q1, Queue<T> q2) { Queue<T> q1Copy(q1), q2Copy(q2); Queue<T> jQueue; while(!q1Copy.empty()) { jQueue.enqueue(q1Copy.front()); q1Copy.dequeue(); } while(!q2Copy.empty()) { jQueue.enqueue(q2Copy.front()); q2Copy.dequeue(); } cout << jQueue << endl; return jQueue; } /*---------------------------------------------------------------------------- Overloaded << operator Preconditions: requires a constant reference and a Queue of type T Postconditions: returns the ostream (for chaining) description: this function is overloaded for outputing a queue with << ----------------------------------------------------------------------------*/ template <typename T> ostream & operator<<(ostream &out, Queue<T> &s) { s.display(out); return out; } /*---------------------------------------------------------------------------- Overloaded << operator Preconditions: requires a constant reference and a reference of type Student Postconditions: none description: this function is overloaded for outputing an object of type Student. ----------------------------------------------------------------------------*/ ostream & operator<<(ostream &out, Student &s) { s.display(out); } /*---------------------------------------------------------------------------- Overloaded << operator Preconditions: requires a constant reference and a reference of a pointer to a Student object. Postconditions: none description: this function is overloaded for outputing pointers to Students ----------------------------------------------------------------------------*/ ostream & operator<<(ostream &out, StudentPointer &s) { s->display(out); } #endif Now I'm having some issues with it. For one, when I add 0 to a queue and then I output the queue like so.. Queue<double> qdub; qdub.enqueue(0); cout << qdub << endl; That works, it will output 0. But for example, if I modify that queue in any way.. like.. assign it to a different queue.. Queue<double> qdub1; Queue<double> qdub2; qdub1.enqueue(0; qdub2 = qdub1; cout << qdub2 << endl; It will give me weird values for 0 like.. 7.86914e-316. Help on this would be much appreciated!

    Read the article

  • C++ Class Templates (Queue of a class)

    - by Dalton Conley
    Ok, so I have my basic linked Queue class with basic functions such as front(), empty() etc.. and I have transformed it into a template. Now, I also have a class called Student. Which holds 2 values: Student name and Student Id. I can print out a student with the following code.. Student me("My Name", 2); cout << me << endl; Here is my display function for student: void display(ostream &out) const { out << "Student Name: " << name << "\tStudent Id: " << id << "\tAddress: " << this << endl; } Now it works fine, you can see the basic output. Now I'm declaring a queue like so.. Queue<Student> qstu; Storing data in this queue is fine, I can add new values and such.. now what I'm trying to do is print out my whole queue of students with: cout << qstu << endl; But its simply returning an address.. here is my display function for queues. void display(ostream & out) const { NodePointer ptr; ptr = myFront; while(ptr != NULL) { out << ptr->data << " "; ptr = ptr->next; } out << endl; } Now, based on this, I assume ptr-data is a Student type and I would assume this would work, but it doesn't. Is there something I'm missing? Also, when I Try: ptr->data.display(out); (Making the assumtion ptr-data is of type student, it does not work which tells me I am doing something wrong. Help on this would be much appreciated!

    Read the article

  • Java method help

    - by dalton conley
    Ok, so I'm working on a project for a class I'm taking.. simple music library. Now I'm having some issues, the main issue is I'm getting "non-static method cannot be referenced from a static context" Here is a function I have public void addSong() { Scanner scan = new Scanner(System.in); Song temp = new Song(); int index = countFileLines(Main.databaseFile); index = index + 2; temp.index = index; System.out.print("Enter the artist name: "); temp.artist.append(scan.next()); } Now thats in a class file called LibraryFunctions. So I can access it with LibraryFunctions.addSong(); Now I'm trying to run this in my main java file and its giving me the error, I know why the error is happening, but what do I do about it? If I make addSong() a static function then it throws errors at me with the Song temp = new Song() being static. Kind of ironic. Much help is appreciated on this!

    Read the article

  • Cannot install windows service

    - by Matthew Dalton
    I have created a very simple window service using visual studio 2010 and .Net 4.0. This service has no functionality added from the default windows service project, other than an installer has been added. If i run installutil.exe appName.exe on my dev box or other windows 2008 R2 machines in our domain the windows service installs without issue. When i try to do this same thing on our customer site, it fails to install with the following error. Microsoft (R) .NET Framework Installation utility Version 4.0.30319.1 Copyright (c) Microsoft Corporation. All rights reserved. Exception occurred while initializing the installation: System.IO.FileLoadException: Could not load file or assembly 'file:///C:\TestService\WindowsService1.exe' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515). This solution has only 1 project and no dependencies added. I have tried it on multiple machines in our environment and two in our customers. The machines are all windows 2008 R2, both fresh installs. One machine has just .net 2.0 and .net 4.0. The other .net 2, 3, 3.5 and 4. I am a local admin on each of the machines. I have also tried the 64bit installer but get the following error, so i think the 32 bit one is the one to use. System.BadImageFormatException Any guidance would be appreciated. Thanks.

    Read the article

  • Initial Modelling/Design Activities on Agile Projects

    - by dalton
    When developing an application using agile techniques, what if any initial modelling/architecture activities do you do, and how do you capture that knowledge?? The closest thing I've seen so far is Scott Ambler's Initial Architecture Modelling, but was wondering what alternatives are used out there?

    Read the article

  • c++ strings and file input

    - by Dalton Conley
    Ok, its been a while since I've done any file input or string manipulation but what I'm attempting to do is as follows while(infile >> word) { for(int i = 0; i < word.length(); i++) { if(word[i] == '\n') { cout << "Found a new line" << endl; lineNumber++; } if(!isalpha(word[i])) { word.erase(i); } if(islower(word[i])) word[i] = toupper(word[i]); } } Now I assume this is not working because skips the new line character?? If so, whats a better way to do this.

    Read the article

  • BST Level Traversal

    - by Dalton Conley
    Ok, so I'm trying to do a level order traversal of a binary search tree and its not working. The code below makes sense to me, but that is probably because I've been looking at it forever and I've convinced myself that it should work. void BST<T>::levelByLevel(ostream &out) { Queue<BinNodePointer> q; BinNodePointer subtreeRoot; if(myRoot == NULL) return; q.enqueue(myRoot); while(!q.empty()) { subtreeRoot = q.front(); out << subtreeRoot->data << " "; q.dequeue(); if(subtreeRoot->left != NULL) q.enqueue(subtreeRoot->left); if(subtreeRoot->right != NULL) q.enqueue(subtreeRoot->right); } } Maybe you guys could point out what I'm doing wrong because, although I understand the concept of a binary search tree, I'm not 100% on all the ins and outs.

    Read the article

  • Jquery Mobile is adding text above my "<input type=submit"> automatically, how do i prevent this?

    - by Jack Dalton
    I've just begin work on a mobile version for one of my sites. I've set up my sign up form for my users. It worked fine and the CSS styled it correctly. @using (Html.BeginForm("XXX", "Registration", FormMethod.Post, new { @class = "twitter-sign-in-container" })) { <input type="submit" name="twitter-button" value="Sign in with Twitter" id="twitter-button" /> } Once I added Jquery mobile to the project if found that random unstyled text started to show up. On inspection I found that all input submits where being wrapped in new tags and adding un tagged text == to the inputs "Value": <form action="/registration/xxx" class="twitter-sign-in-container" method="post"> <div class="ui-btn ui-input-btn ui-corner-all ui-shadow"> "Sign in with Twitter" <input type="submit" name="twitter-button" value="Sign in with Twitter" id="twitter-button"> </div> </form> Does anyone have any clue as to why the "sign up with twitter" text is being added, and how i stop it? P.S Less important but I'd also like to know why Jquery wraps form contents in the bellow div.

    Read the article

  • Ubuntu Newbie Needs Assistance!!

    - by Steve Greene
    New Ubuntu User Needs Help!- version 9.10 does not communicate with laptop Hello folks, Several days ago, I installed Ubuntu 9.10 onto my Acer Aspire 3100 laptop, running it alongside Widows Vista as a dual-bootable system. Creation of the Ubuntu boot CD went fine, and the installation onto my hard drive was flawless. Ubuntu opens and behaves as I would expect, except for one little problem. For reasons unknown to me, Ubuntu is not communicating with my laptop's networking hardware, and I have no internet connectivity, even when sitting directly under the wireless router at the local library (literally), which puts out a wickedly-fast signal that my Windows Vista OS auto-detects and immediately connects to. Up in the right side of the Ubuntu desktop, I click on the network icon and it does not show a wireless connection at all, even though I am only a few feet from the router. At home, where I use a dialup modem, I also see no means of getting online. My modem is an HDAUDIO Soft Data Fax Modem with Smart CP,manufactured by CXT (Conexant Systems Inc., file version 4.0.13.0, and the driver version is 7.58.0.0). I desparately wish to convert to Ubuntu. I used Mac for ten years, and then Windows for ten years. Now, after 20 years, I want to live out my days as an open-source Ubuntu fanatic. I am ready to give the old status quo the boot! I am an advanced computer user, but I am not a programmer. I seek a solution that is user-friendly for normal people, something equivalent to a driver that I can easily install or activate that will allow Ubuntu to see my hardware and get me connected. Can anyone help me over this hopefully-little glitch so that I can move on in total Ubuntu bliss? My processor is a Mobile AMD Sempron Processor 3500+ at 1.80 GHz, 1.50 GB RAM, and a 32-bit Operating System. I am running Windows Vista Home Basic, Service Pack 2. My current email is [email protected] if you have a workable solution that does not require programmer status to implement. Surely this must be a simple fix that I simply am overlooking, but being the new guy on the block, I have yet to be enlightened. Thanks for your help in coming up to speed!! Steve Wanna' be Ubuntu Fanatic "If you're not living on the edge, you're taking up too much space."

    Read the article

  • UISplitViewController programmtically without nib/xib, thank you.

    - by Steve
    Hi, I usually create my projects without IB-stuff. The first thing I do is to strip off all references to xibs, outlets updated plist, etc and so forth. No problems, works great (in my world)! Now, I just installed 3.2 and tried to develop my first iPad app. Following same procedure as before, I created a UISplitView-based application project and stripped off all IB-stuff. Also, I followed the section in Apple's reference docs: "Creating a Split View Controller Programmatically", http://bit.ly/axgYAs, but nevertheless, the Master-view is never shown, only the Detail-view is (no matter what the orientation is). I really have tried to carefully look this through but I cannot understand what I have missed. Is there a working example of a UISplitViewController without the nibs floating around somewhere? I have googled but could not find any. Or do you know what I probably have missed? Regards, /Steve PS. Spare me the lesson why I should use the IB ;-) DS.

    Read the article

  • ASP.NET Membership - Retrieve Password and PasswordSalt from Membership Table - Hash UserID

    - by Steve
    Hello, I am so close to get this project done. I need to retrieve the password and passwordSalt from my Membership table to compare it to my 'OldPasswords' table. The problem is the Membership provider does not let me use the GetPassword method because the password is hashed. And I can not retrieve it in a normal sqlConnection because the UserID is hashed also. Does anyone know how to hash the UserID so I can put it in my where clause? Or maybe there is a different way to get to that data? Any help is appreciated. Thank you, Steve

    Read the article

  • Grails GIS Application

    - by Steve Wall
    Hello, I'm working on an internal IT application monitoring outages for a network with a national footprint in the US. I'm considering overlaying outages by region on a map. Showing outage areas in red for example. The user clicks on the outage area displaying drill down information. The technology stack includes Grails/JBoss/Linux. Are there frameworks that provide the mapping/GIS layer of the display on which I could overly my domain specific information? I've looked into the Google Map API, but am unable to leverage it as this operates behind a firewall. Any ideas? Thanks in advance, Steve

    Read the article

  • Embedded views and resources (mvc)

    - by Steve Ward
    Hi I've embedded several views in a library so that I can re-use across projects using this method which works OK: http://www.wynia.org/wordpress/2008/12/aspnet-mvc-plugins/ But one view usings a Javascript file. I've tried marking this as an embedded resource and adding it AssemblyInfo.cs and then referencing this resource using <%= ClientScript.GetWebResourceUrl(this.GetType(), "FullPath.FileName.js")%> This is literally displaying this output in the view WebResource.axd?d=nUxqfqAUQLabLU54W I think this is because Im trying to refer to an embedded resource from an embedded resource. Help appreciated as Im going round in circles.. Steve

    Read the article

  • how to parse jquery ajax xhtml response?

    - by steve
    Sorry if this has been posted many times. But I've tried many variations and it still doesn't work. The HTML comes back from the jquery AJAX call fine and I am trying to remove the header and footers from the response using: // none of these work for me $("#content", data); $("#content", $(data)); $(data).find("#content").html() I've breakpoint the response to verify the #content exists by inspected $(data) and using alert to print out the data's text. I've also try using "body" or "a" as selectors, but it always come back as undefined. I've read in this post that you can't pull in the full XHTML document: http://stackoverflow.com/questions/1050333/jquery-ajax-parse-response-text. But I can't find the answer's quote anymore, maybe it's outdated? Has anyone ran into this problem? Many thanks, Steve

    Read the article

  • Problem Installing Application on iPhone: Resource has been modified

    - by Steve
    Hi, I am working on a simple iPhone application and when I run my app on my machine it installs on the device, but when I try it on a Windows machine using an ad-hoc distribution profile, it shows an error: "Application couldn't be installed because a resource has been modified." I have 2 iPhones and have tested the same app; on iPhone 2G it works fine, but on the 3G it shows the error I have written above. I tried to change the certificate and provisioning profiles, but no luck. Please let me know where I am mistaken. Thanks. Steve

    Read the article

  • Apache: Redirect blog.foobar.com to www.foobar.com

    - by Steve Griff
    Hello, I have a site at blog.foobar.com that I have closed down, and I want any page requested there to be forwarded to www.foobar.com I want my VirtualHost config to do this for me. I currently have the following lines that does nearly what I want but not exactly: redirect permanent / http://www.foobar.com Unfortunately what happens is that if I ask for blog.foobar.com instead of forwarding to www.foobar.com it serves the pages on blog.foobar.com instead. Is there a way doing this in the VirtualHost config or should I use a .htaccess file instead? Regards Steve

    Read the article

  • Is there a JS diff library against htmlstring just like google-diff-match-patch on plain text?

    - by Steve
    Currently I am using google-diff-match-patch to implement a real-time editing tool, which can synchronize texts between multiple users. Everything works great when operations are only plain texts, each user's operation(add/delete texts) could be diff-ed out by comparing to old text snapshot with the helper of google-diff. But when rich format texts(like bold/italic) are involved, google-diff not working well when comparing the htmlstring. The occurrence of character of < and > messed up the diff results, especially when bold/italic format are embedded within each other. Could anyone suggest a similar library like google-diff to diff htmlstrings? Or any suggestions can get my problem fixed with google-diff? I understood google-diff is designed for plain text, but really didn't find a better library than it so far, so it also works if a doable enhancement to google-diff can help. Thanks for any comments. Regards, Steve

    Read the article

  • silverlight 3 navigation page not availble in VS as item to add

    - by Steve Brownell
    I've recently upgraded my computer from Vista Home Premium 64-bit to Windows 7 Home Premium 64-bit. I've re-installed VS 2008 web express, and re-installed all the silver light sdk's, tools, etc. But now when I want to add a Silverlight Navigation Page, it is not avialble to me in the list of items that can be added. The navigation dll is installed, as my project existed before the OS upgrade. The program still runs just fine as is, but I want to add another navigation page item to the project, and I'm stumped for how to do it. Any ideas? Thanks, Steve

    Read the article

  • Safari Back button not honouring PHP logout session

    - by Steve Kemp
    I've got a logout.php page which ends a user's session and works well and does the following: session_start(); session_unset(); session_destroy(); I've just noticed when testing with Safari that when you logout you can click the back button to return to the previous page which requires authentication but are not prompted. You cannot navigate away from this page without entering the navigation but it should not be displaying the previous page in the first place. So far in my testing this is only an issue with Safari on Mac OS X and there are a number of other reports about this but with no resolution that I could find: http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_23702691.html I would love to be able to disable this behaviour with Safari's back button - surprised that this is happening in the first place. Thanks, Steve

    Read the article

  • PHP 2D Array output all combinations

    - by stukerr
    Hi there, I've had this problem bending my mind for a while now (head cold doesn't help either!), basically I have a PHP array which looks like this example: $array[0][0] = 'apples'; $array[0][1] = 'pears'; $array[0][2] = 'oranges'; $array[1][0] = 'steve'; $array[1][1] = 'bob'; And I would like to be able to produce from this a table with every possible combination of these, but without repeating any combinations (regardless of their position), so for example this would output Array 0 Array 1 apples steve apples bob pears steve pears bob But I would like for this to be able to work with as many different arrays as possible. Many thanks!

    Read the article

  • Git clone using ssh - can't find repository

    - by Steve
    I'm trying to setup a Git server on Windows 7, using CopSsh, PuTTY and msysgit. I'm having problems cloning a repository using ssh. If I use a regular directory path, it works: $ git clone ~/vc/git/depot/test.git/ /c/dev/es/app Initialized empty Git repository in c:/dev/es/app/.git/ warning: You appear to have cloned an empty repository. Ssh, doesn't work. I've tried an different paths without success. $ git clone ssh://steve@test:4837/~/vc/git/depot/test.git/ /c/dev/es/app Initialized empty Git repository in c:/dev/es/app/.git/ fatal: '~/vc/git/depot/eastApp.git' does not appear to be a git repository fatal: The remote end hung up unexpectedly I followed the instructions from here: http://www.timdavis.com.au/git/setting-up-a-msysgit-server-with-copssh-on-windows/ Any clues?

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >