Search Results

Search found 80 results on 4 pages for 'dalton hamilton'.

Page 3/4 | < Previous Page | 1 2 3 4  | 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

  • Google I/O 2012 - Up Close and Personal: NFC and Android Beam

    Google I/O 2012 - Up Close and Personal: NFC and Android Beam Martijn Coenen, Robert Hamilton A session covering the developer-oriented NFC features we've been adding to the Android platform. Learn how to use Android Beam to add magic sharing abilities to your application, and see what other new and exciting NFC features we're working on. For all I/O 2012 sessions, go to developers.google.com From: GoogleDevelopers Views: 251 4 ratings Time: 01:03:13 More in Science & Technology

    Read the article

  • The Benefits of Oracle's Compliance Architecture

    Fred chats with Deborah Hamilton, Senior Compliance Product Marketing Director at Oracle about what the Oracle Compliance Architecture is, how customers are benefiting from its integrated approach to compliance - of technology, people and processes - and how it helps with organizations meet multiple compliance mandates.

    Read the article

  • How can I line up columns with Perl's printf when the value might be a number or a string?

    - by user317203
    I am trying to output a document that looks like this (more at http://pastebin.com/dpBAY8Sb): 10.1.1.1 100 <unknown> <unknown> <unknown> <unknown> <unknown> 72.12.148.186 94 Canada Hamilton ON 43.250000 -79.833300 0.00 72.68.209.149 24 United States Richmond Hill NY 40.700500 -73.834500 611.32 72.192.33.34 4 United States Rocky Hill CT 41.657800 -72.662700 657.48 I cannot find how to format the output I have to have a floating poing and format the distance between columns. My current code looks something like this. if (defined $longitude){ printf FILE ("%-8s %.6f","",$longitude); }else{ $longitude = "<unknown>"; printf FILE ("%-20s ",$longitude); } The extra "" throws off the whole column and it looks like this (more at http://pastebin.com/kcwHyNwb). 10.1.1.1 100 <unknown> <unknown> <unknown> <unknown> <unknown> 72.12.148.186 94 Canada Hamilton ON 43.250000 -79.833300 0.00 72.68.209.149 24 United States Richmond Hill NY 40.700500 -73.834500 571.06

    Read the article

  • Why SEO is the Best Job Ever

    Have you learned about the best job in the world that will only requires you to wander around the tropical island of Hamilton on the Great Barrier Reef? The said job lasted for six months and they paid the winner for like $105000. Several jobs tell that they are the best job in the town. I actually know one: SEO practitioner. Even in the times of recession, SEO jobs are safe. Aside from that, here are the 5 things why SEO is the best job ever even in the time of recession.

    Read the article

  • Exadata X3 Sales/Pre-Sales/Support Resell Rights Enablement Day

    - by mseika
    Dear Partner, Avnet and Oracle would like to invite you to a FREE Exadata X3 Sales/Pre-Sales/Support Resell Rights Enablement Day which is taking place on Wednesday 16th January 2013 at the Oracle London City offices in Moorgate. We will give you the opportunity to get an in depth understanding of how hardware and software is engineered to work together to create the power and scalability of Exadata. The session will focus on Oracle Exadata fundamentals, features, components and capabilities. The event will be a day long and will give you the opportunity to put any questions to the presenters that will help you understand how to spot an Exadata opportunity and position Exadata in an opportunity.   Register Now Register now or call our Hotline on 01925 856999. When Wednesday 16th January 2013 Duration: 9.30am to 17.00pm Where Oracle Corporation UK Ltd. One South PlaceLondon EC2M 2RB. For directionsplease see thelocation map.   Cost No charge Contact Us Avnet Technology Solutions LimitedClarity House103 Dalton AvenueBirchwood ParkWarringtonWA3 6YBUKT: 01925 856900 F: 01925 856901 E: [email protected] Or find us online:Avnet websiteLinkedInTwitterFacebook

    Read the article

  • Is there any working implementation of reverse mode automatic differentiation for Haskell?

    - by Ian Fiske
    The closest-related implementation in Haskell I have seen is the forward mode at http://hackage.haskell.org/packages/archive/fad/1.0/doc/html/Numeric-FAD.html. The closest related related research appears to be reverse mode for another functional language related to Scheme at http://www.bcl.hamilton.ie/~qobi/stalingrad/. I see reverse mode in Haskell as kind of a holy grail for a lot of tasks, with the hopes that it could use Haskell's nested data parallelism to gain a nice speedup in heavy numerical optimization.

    Read the article

  • What are the most relevant OSS projects for .NET?

    - by Scott Hanselman
    Not a popularity contest, but if you were to elect some in some categories, what would be the names? Here are a few suggested categories. The only criteria I’d insist on would be: needs to be fully OSS, not a one-man show, have some people involved, have source available and with a well-know open source license (hopefully with no distinction between commercial and other uses) Blog engines Wikis Web frameworks WPF frameworks Silverlight frameworks Unit test frameworks (including spec?) ASP.Net tools more specialized frameworks Scott Hanselman and Hamilton Verissimo de Oliveira

    Read the article

  • SQL..Sum two rows

    - by Cha
    Sample data: LOCATION NAME LABEL1 LABEL2 SERVICE TIME NY Andrew A B HOUSE 2555 NY Andrew A B CAR 35 NJ Copley C A HOUSE 1025 NY Copley A B HOUSE 650 VA Dalton D C PET 25 What I want to do ias add another column where in it shows sum(Time) of rows with same data except for the Service.Also, the services that I need are only the sum of car and house.Is this possible? If not can you help me with the right query Sample output I need: LOCATION NAME LABEL1 LABEL2 SERVICE TIME SUM NY Andrew A B HOUSE 2555 **2590** NY Andrew A B CAR 35 NJ Copley C A HOUSE 1025 1025 NY Copley A B HOUSE 650 650

    Read the article

  • Professionalism of online username / handle

    - by Thanatos
    I have in the past, and continue currently, used the handle "thanatos" on a lot of Internet sites, and if that isn't available (which happens ~50% of the time), "deathanatos". "Thanatos" is the name of the Greek god or personification of death (not to be confused with Hades, the Greek god of the underworld). "Dea" is a natural play-on-words to make the handle work in situations where the preferred handle has already been taken, without having to resort to numbers and remaining pronounceable. I adopted the handle many years ago — at the time, I was reading Edith Hamilton's Mythology, and Piers Anthony's On a Pale Horse, both still favorites of mine, and the name was born out of that. When I created the handle, I was fairly young, and valued privacy while online, not giving out my name. As I've become a more competent programmer, I'm starting to want to release some of my private works under FOSS licenses and such, and sometimes under my own name. This has started to tie this handle with my real name. I've become increasingly aware of my "web image" in the last few years, as I've been job hunting. As a programmer, I have a larger-than-average web presence, and I've started to wonder: Is this handle name professional? Does a handle name matter in a professional sense? Should I "rebrand"? (While one obviously wants to avoid hateful or otherwise distasteful names, is a topic such as "death" (to which my name is tied) proper? What could be frowned upon?) To try to make this a bit more programmer specific: Programmers are online — a lot — and some of us (and some who are not us) tend to put emphasis on a "web presence". I would argue that a prudent programmer (or anyone in an occupation that interacts online a lot) would be aware of their web presence. While not strictly limited to just programmers, for better or worse, it is a part of our world.

    Read the article

  • Upcoming SOA BPM PS6 Workshops

    - by BPMWarrior
    Are you interested in learning about all of the new great features in SOA BPM PS6? There is a lot of excitement around the new WebForms, Process Player, Simulation and the new features in the BPM Composer.  During FY14 Q1 and Q2 there will be a number of SOA BPM Workshops available. Space is limited. Upcoming SOA BPM Workshop Schedule:   Ø July 15th – PS6 Roadshow w/Mythics in Sacramento Ø July 18th – PS6 Workshop for Sandia Labs Ø July 23rd - PS6 Workshop in Reston Ø Aug 5th & 6th – PS6 Workshop for Deloitte in Reston Ø Aug 13th – PS6 Workshop in Reston for PS SC’s & Specialists Ø Aug 20th - 21st – PS6 Roadshow in NYC and Albany, NY        August – PS6 Workshop for Booz Allen Hamilton – date to be confirmed     August – PS6 Workshop in Dallas/Austin – dates to be confirmed      Sept 17th - SOA BPM Overview Workshop for Executives in Ottawa     Sept 18th – PS6 Workshop in Ottawa     Oct 23rd – PS6 Workshop in Denver         For more information contact:               [email protected] or [email protected]  g  

    Read the article

  • How to throw a SqlException(need for mocking)

    - by chobo2
    Hi I am trying to test some exceptions in my project and one of the Exceptions I catch is SQlException. Now It seems that you can't go new SqlException() so I am not sure how I can throw a exception especially without somehow calling the database(and since it is unit tests it is usually advised not to call the database since it is slow). So I am using nunit and moq so I am not sure how to fake this. Edit Based on the answers they seem to all be based on ado.net I am using linq to sql. So that stuff is like behind the scenes. Edit @ Matt Hamilton System.ArgumentException : Type to mock must be an interface or an abstract or non-sealed class. at Moq.Mock`1.CheckParameters() at Moq.Mock`1..ctor(MockBehavior behavior, Object[] args) at Moq.Mock`1..ctor(MockBehavior behavior) at Moq.Mock`1..ctor() Posts to the first line when it tries to mockup var ex = new Mock<System.Data.SqlClient.SqlException>(); ex.SetupGet(e => e.Message).Returns("Exception message");

    Read the article

< Previous Page | 1 2 3 4  | Next Page >