Search Results

Search found 988 results on 40 pages for 'josh pearce'.

Page 31/40 | < Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >

  • No Matching Function Error for inserting into a list in c++

    - by Josh Curren
    I am getting an error when I try to insert an item into a list (in C++). The error is that there is no matching function for call to the insert(). I also tried push_front() but got the same error. Here is the error message: main.cpp:38: error: no matching function for call to ‘std::list<Salesperson, std::allocator<Salesperson> >::insert(Salesperson&)’ /usr/lib/gcc/i686-pc-cygwin/4.3.4/include/c++/bits/list.tcc:99: note: candidates are: std::_List_iterator<_Tp> std::list<_Tp, _Alloc>::insert(std::_List_iterator<_Tp>, const _Tp&) [with _Tp = Salesperson, _Alloc = std::allocator<Salesperson>] /usr/lib/gcc/i686-pc-cygwin/4.3.4/include/c++/bits/stl_list.h:961: note: void std::list<_Tp, _Alloc>::insert(std::_List_iterator<_Tp>, size_t, const _Tp&) [with _Tp = Salesperson, _Alloc = std::allocator<Salesperson>] Here is the code: #include <stdlib.h> #include <iostream> #include <fstream> #include <string> #include <list> #include "Salesperson.h" #include "Salesperson.cpp" #include "OrderedList.h" #include "OrderedList.cpp" using namespace std; int main(int argc, char** argv) { cout << "\n------------ Asn 8 - Sales Report ------------" << endl; list<Salesperson> s; int id; string fName, lName; int numOfSales; string year; std::ifstream input("Sales.txt"); while( !std::getline(input, year, ',').eof() ) { input >> id; input >> lName; input >> fName; input >> numOfSales; Salesperson sp = Salesperson( id, fName, lName ); s.insert( sp ); //THIS IS LINE 38 ************************** for( int i = 0; i < numOfSales; i++ ) { double sale; input >> sale; sp.sales.insert( sale ); } } cout << endl; return (EXIT_SUCCESS); }

    Read the article

  • expected `;' before "pennies"? C++ Debugging (Code Completed)

    - by Josh Lake
    Can anyone tell me why I get an error on my last cout? #include <iostream> #include <cmath> #include <stdio.h> #include <cstring> #include <conio.h> using namespace std; inline void keep_window_open() { char ch; cin>>ch; } int main() { cout << "How many pennies do you have?\n"; int pennies; cin >> pennies; double total_pen; total_pen = (0.01 * pennies); if (pennies >= 1) { string penn = " pennies."; }else { string penn = " penny."; } cout << "How many nickles do you have?\n"; int nickles; cin >> nickles; double total_nic; total_nic = (0.05 * nickles); if (nickles >= 1) { string five = " nickels."; }else { string five = " nickel."; } cout << "How many dimes do you have?\n"; int dimes; cin >> dimes; double total_dim; total_dim = (0.10 * dimes); if (dimes >= 1) { string ten = " dimes."; }else { string ten = " dime."; } cout << "How many quarters do you have?\n"; int quarters; cin >> quarters; double total_qua; total_qua = (0.25 * quarters); if (quarters >= 1) { string twentyfive = " quarters."; }else { string twentyfive = " quarter."; } cout << "How many half-dollars do you have?\n"; int half_dollars; cin >> half_dollars; double total_dol; total_dol = (0.50 * half_dollars); if (half_dollars >= 1) { string fifty = " half dollars."; }else { string fifty = " half dollar."; } string saying = "You have "; cout << saying pennies penn << "\n" << saying nickles five << "\n" << saying dimes ten << "\n" << saying quarters twentyfive << "\n" << saying half_dollars fifty << "\n"; keep_window_open() return 0; }

    Read the article

  • Operator Overloading for Queue C++

    - by Josh
    I was trying to use the overload operator method to copy the entries of one queue into another, but I am going wrong with my function. I don't know how else to access the values of the queue "original" any other way than what I have below: struct Node { int item; Node* next; }; class Queue { public: [...] //Extra code here void operator = (const Queue &original); protected: Node *front, *end; } void Queue::operator=(const Queue &original) { //THIS IS WHERE IM GOING WRONG while(original.front->next != NULL) { front->item = original.front->item; front->next = new Node; front = front->next; original.front = original.front->next; } }

    Read the article

  • TFS: How do I view .cs files in the VS IDE when viewing details of a shelveset?

    - by Josh Leonard
    For our code review process we open the details of a shelveset to see all files that have been worked on. Right clicking and choosing "Compare" works great for existing ( modified ) files. But, when a file has been added I just want to view the file. Double clicking ( or right click - view ) opens .cs ( and .sql )files in notepad. When I try to open a .PRC file ( extension for our stored procedures ) I get a prompt that allows me to choose what program to use for viewing. Does anyone know how to get this prompt to show up for .cs files ( and all other files, for that matter ) Thanks! Configuration: Visual Studio 2008 SP1 Visual Studio 2008 Team Explorer .net 3.5 SP1 Team Foundation Server 2005

    Read the article

  • Return a result in the original page.

    - by Josh
    When the user submit his data, I take him to a different page where plenty of calculations are made, then I redirect him to the original page with a simple : <?php header("Location:http://mysite.com/index.php"); The problem is I need all the variables and results to be show in this page, but they are obviously stored in the other one, so I need your help please :) ! Thank you for reading this !

    Read the article

  • When using the Auth component with CakePHP, I keep ketting this error. Why?

    - by Josh Brown
    Warning (2): Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/iframeworking/iframe/app/models/frame.php:7) [COREcake/libs/controller/controller.php, line 647] here is the code from frame.php: <?php class Frame extends AppModel { var $name = 'Frame'; var $belongsTo = array('User' => array('className' => 'User', 'dependent' => true)); } ?>

    Read the article

  • How do I use Asp MVC Url Helpers to generate RESTful links?

    - by Josh
    I'm trying to use Html.ActionLink to generate a link with in this form: /Action/Model/Id/Parameter1/Parameter2 I've used: <%= Html.ActionLink("Link Text", "Action", "Model", new { id = var, parament1=var1 }, null) % but it always ends up looking like /Action/Model/Id?parameter1=variable I've seen similar questions on Stackoverflow and elsewhere, but I can't find a solution that works/makes sense. Any help would be appreciated.

    Read the article

  • UIView capturing all events

    - by Josh P.
    I have a UIView that uses several UIGestureRecognizers and this view again has at least one child view that contains a MPMoviePlayerController. When a touch event occurs over the movie player, the main view seems to 'eat' all the events, leaving the media player idle. How can I make sure that the events are delivered correctly to the player?

    Read the article

  • How is FileInfo Serialized?

    - by Josh G
    I want to save file metadata (mostly path/name) along with the contents of the file. I noticed that FileInfo is serializable. Does anyone know data is serialized when you save a FileInfo object? I would assume that only metadata is saved, not the contents of the file?

    Read the article

  • Move iFrame in the DOM using jQuery

    - by Josh
    My overall aim is to create an editor which I can skin using jQuery UI (by creating a custom toolbar which uses integration calls), using TinyMCE. Lets say I have a TinyMCE editor on a page. The actual editor is an iFrame contained inside a lot of horrible table code, which is also where the current (to be scrapped) toolbar is. I want just the iframe inside a div - ideally get rid of the table code. So...I want to transform: <table> <tr> <td><iframe id="xyz"></iframe></td> </tr> </table> into <div id="test"> <iframe id="xyz"></iframe> </div> So far, I've tried using: $('#xyz').clone(true).appendTo('#test'); Which clones the iframe, but no content inside it. Is there a way to make this work? If not, can I somehow strip the table code from around the iFrame away? If I cant do that, I'll think I'll have to keep the table code.

    Read the article

  • Clojure multimethod dispatching on functions and values

    - by Josh Glover
    I have a function that returns the indexes in seq s at which value v exists: (defn indexes-of [v s] (map first (filter #(= v (last %)) (zipmap (range) s)))) What I'd like to do is extend this to apply any arbitrary function for the existence test. My idea is to use a multimethod, but I'm not sure exactly how to detect a function. I want to do this: (defmulti indexes-of ???) (defmethod indexes-of ??? [v s] ;; v is a function (map first (filter v (zipmap (range) s)))) (defmethod indexes-of ??? [v s] ;; v is not a function (indexes-of #(= v %) s)) Is a multimethod the way to go here? If so, how can I accomplish what I'm trying to do?

    Read the article

  • Entity Framework one-to-one relationship mapping flattened in code

    - by Josh Close
    I have a table structure like so. Address: AddressId int not null primary key identity ...more columns AddressContinental: AddressId int not null primary key identity foreign key to pk of Address County State AddressInternational: AddressId int not null primary key identity foreign key to pk of Address ProvinceRegion I don't have control over schema, this is just the way it is. Now, what I want to do is have a single Address object. public class Address { public int AddressId { get; set; } public County County { get; set; } public State State { get; set } public ProvinceRegion { get; set; } } I want to have EF pull it out of the database as a single entity. When saving, I want to save the single entity and have EF know to split it into the three tables. How would I map this in EF 4.1 Code First? I've been searching around and haven't found anything that meets my case yet. UPDATE An address record will have a record in Address and one in either AddressContinental or AddressInternational, but not both.

    Read the article

  • How can I run an external program from C and parse its output?

    - by Josh Matthews
    I've got a utility that outputs a list of files required by a game. How can I run that utility within a C program and grab its output so I can act on it within the same program? UPDATE: Good call on the lack of information. The utility spits out a series of strings, and this is supposed to be complete portable across Mac/Windows/Linux. Please note, I'm looking for a programmatic way to execute the utility and retain its output (which goes to stdout).

    Read the article

  • Why does "non exists" SQL query work and "not in" doesn't

    - by Josh
    I spent some time trying to figure out why this query isn't pulling the results i expected: SELECT * FROM NGS WHERE ESPSSN NOT IN (SELECT SSN FROM CENSUS) finally i tried writing the query another way and this ended up getting the expected results: SELECT * FROM NGS n WHERE NOT EXISTS (SELECT * FROM CENSUS WHERE SSN = n.ESPSSN) The first query seems more appropriate and "correct". I use "in" and "not in" all the time for similar selects and have never had a problem that i know of.

    Read the article

  • Do I have to duplicate this function? - jQuery

    - by Josh
    I'm using this function to create an transparent overlay of information over the current div for a web-based mobile app. Background: using jQTouch, so I have separate divs, not individual pages loading new. $(document).ready(function() { $('.infoBtn').click(function() { $('#overlay').toggleFade(400); return false; }); }); Understanding that JS will run sequentially when i click the button on the first div the function works fine. When I go to the next div if I click the same button nothing "happens" when this div is displayed, but if i go back to the first div it has actually triggered it on this page. So I logically duplicated the function and changed the CSS selector names and it works for both. But do I have to do this for each use? Is there a way to use the same selectors, but load the different content in each variation?

    Read the article

  • JQuery\Javascript - Passing a function as a variable.

    - by Josh
    I was just curious if I could pass a function as a variable. For example: I have a function $('#validate').makeFloat({x:671,y:70,limitY:700}); I would like to do something like this: $('#validate').makeFloat({x:function(){ return $("#tabs").offset().left+$("#tabs").width();},y:70,limitY:700}); This does not work, but ideally every time the variable was accessed it would compute the new value. So if the window was resized it would automatically adjust as opposed to a variable passed in being static. I realize I can implement this directly inside the function\widget, but I was wondering if there was some way to do something like the above.

    Read the article

  • How to reduce the lag time when using jquery to modify css onload

    - by Josh
    I have a jquery function that is called on $(document).ready that modifies the css of a Business Intelligence dashboard. I had to use jquery to make the adjustments because I do not have access to the source code of the BI tool. What happens is when the page loads, I run through the tab navigation and change the colors of the tabs based on certain requirements (which is basically dependent on the text of the tab). The issue I am facing is that there is a small lag time from when the page initially loads to when the jquery updates have been made to the page. Is there a way to reduce this lag time?

    Read the article

  • Any way to add an observer to the head of the queue using Element#observe?

    - by Josh
    This might not be possible but before I rewrite part of my application I wanted to ask... I have a JavaScript app which creates a submit <input> and observes that input's click event using Prototype's Element#observe function. For a few particular pages on one particular site which uses this app, I need to apply some additional business logic before the code which executes normally when the button is clicked. Is there any way I can use Elemen#observe to add my new event handler before the existing event handler, so I can stop the event if these new conditions aren't met? If not I'll probably solve this the "proper" way by having the application fire a specific beforeTakingAction event and add a listener for that which prevents the application from taking it's action, but that's more complicated than this simple problem requires, and requires rewriting part of a shared application for just one user...

    Read the article

  • Sorting in Lua, counting number of items

    - by Josh
    Two quick questions (I hope...) with the following code. The script below checks if a number is prime, and if not, returns all the factors for that number, otherwise it just returns that the number prime. Pay no attention to the zs. stuff in the script, for that is client specific and has no bearing on script functionality. The script itself works almost wonderfully, except for two minor details - the first being the factor list doesn't return itself sorted... that is, for 24, it'd return 1, 2, 12, 3, 8, 4, 6, and 24 instead of 1, 2, 3, 4, 6, 8, 12, and 24. I can't print it as a table, so it does need to be returned as a list. If it has to be sorted as a table first THEN turned into a list, I can deal with that. All that matters is the end result being the list. The other detail is that I need to check if there are only two numbers in the list or more. If there are only two numbers, it's a prime (1 and the number). The current way I have it does not work. Is there a way to accomplish this? I appreciate all the help! function get_all_factors(number) local factors = 1 for possible_factor=2, math.sqrt(number), 1 do local remainder = number%possible_factor if remainder == 0 then local factor, factor_pair = possible_factor, number/possible_factor factors = factors .. ", " .. factor if factor ~= factor_pair then factors = factors .. ", " .. factor_pair end end end factors = factors .. ", and " .. number return factors end local allfactors = get_all_factors(zs.param(1)) if zs.func.numitems(allfactors)==2 then return zs.param(1) .. " is prime." else return zs.param(1) .. " is not prime, and its factors are: " .. allfactors end

    Read the article

  • R problems using rpart with 4000 records and 13 attributes

    - by josh
    I have attempted to email the author of this package without success, just wondering if anybody else has experienced this. I am having an using rpart on 4000 rows of data with 13 attributes. I can run the same test on 300 rows of the same data with no issue. When I run on 4000 rows, Rgui.exe runs consistently at 50% cpu and the UI hangs.... it will stay like this for at least 4-5hours if I let it run, and never exit or become responsive. here is the code I am using both on the 300 and 4000 size subset : train<-read.csv("input.csv",header=T) y<-train[,18] x<-train[,3:17] library(rpart) fit<-rpart(y~.,x) Is this a known limitation of rpart, am I doing something wrong? potential workarounds? any assistance appreciated

    Read the article

  • Beginning python for the web

    - by Josh K
    I'm looking for a nice tutorial or framework for developing Python written web applications. I've done lots in PHP, but very little in Python or Ruby and figured I'd start with the first one alphabetically.

    Read the article

< Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >