Search Results

Search found 40 results on 2 pages for 'conrad albrecht'.

Page 2/2 | < Previous Page | 1 2 

  • C++ 2d Array Class Function Call Help

    - by johnny-conrad
    I hope this question takes a simple fix, and I am just missing something very small. I am in my second semester of C++ in college, and we are just getting into OOP. This is my first OOP program, and it is causing me a little problem. Here are the errors I am getting: Member function must be called or its address taken in function displayGrid(int,Cell ( *)[20]) Member function must be called or its address taken in function Turn(int,int,Cell ( *)[20]) Member function must be called or its address taken in function Turn(int,int,Cell ( *)[20]) Warning: Parameter 'grid' is never used in function displayGrid(int,Cell ( *)[20]) Here is all of my code. I am aware It is much more code than necessary, sorry if it makes it more difficult. I was worried that I might accidentally delete something. const int MAX=20; //Struct Cell holds player and their symbol. class Cell { private: int Player; char Symbol; public: Cell(void); void setPlayer(int); void setSymbol(char); int getPlayer(void); char getSymbol(void); }; Cell::Cell(void) { Symbol ='-'; } void Cell::setPlayer(int player_num) { Player = player_num; } void Cell::setSymbol(char rps) { Symbol = rps; } int Cell::getPlayer(void) { return Player; } char Cell::getSymbol(void) { return Symbol; } void Turn(int, int, Cell[MAX][MAX]); void displayGrid(int, Cell[MAX][MAX]); void main(void) { int size; cout << "How big would you like the grid to be: "; cin >> size; //Checks to see valid grid size while(size>MAX || size<3) { cout << "Grid size must between 20 and 3." << endl; cout << "Please re-enter the grid size: "; cin >> size; } int cnt=1; int full; Cell grid[MAX][MAX]; //I use full to detect when the game is over by squaring size. full = size*size; cout << "Starting a new game." << endl; //Exits loop when cnt reaches full. while(cnt<full+1) { displayGrid(size, grid); //calls function to display grid if(cnt%2==0) //if cnt is even then it's 2nd players turn cout << "Player 2's turn." << endl; else cout << "Player 1's turn" << endl; Turn(size, cnt, grid); //calls Turn do each players turn cnt++; } cout << endl; cout << "Board is full... Game Over" << endl; } void displayGrid(int size, Cell grid[MAX][MAX]) { cout << endl; cout << " "; for(int x=1; x<size+1; x++) // prints first row cout << setw(3) << x; // of numbers. cout << endl; //Nested-For prints the grid. for(int i=1; i<size+1; i++) { cout << setw(2) << i; for(int c=1; c<size+1; c++) { cout << setw(3) << grid[i][c].getSymbol; } cout << endl; } cout << endl; } void Turn(int size, int cnt, Cell grid[MAX][MAX]) { char temp; char choice; int row=0; int column=0; cout << "Enter the Row: "; cin >> row; cout << "Enter the Column: "; cin >> column; //puts what is in the current cell in "temp" temp = grid[row][column].getSymbol; //Checks to see if temp is occupied or not while(temp!='-') { cout << "Cell space is Occupied..." << endl; cout << "Enter the Row: "; cin >> row; cout << "Enter the Column: "; cin >> column; temp = grid[row][column].getSymbol; //exits loop when finally correct } if(cnt%2==0) //if cnt is even then its player 2's turn { cout << "Enter your Symbol R, P, or S (Capitals): "; cin >> choice; grid[row][column].setPlayer(1); in >> choice; } //officially sets choice to grid cell grid[row][column].setSymbol(choice); } else //if cnt is odd then its player 1's turn { cout << "Enter your Symbol r, p, or s (Lower-Case): "; cin >> choice; grid[row][column].setPlayer(2); //checks for valid input by user1 while(choice!= 'r' && choice!='p' && choice!='s') { cout << "Invalid Symbol... Please Re-Enter: "; cin >> choice; } //officially sets choice to grid cell. grid[row][column].setSymbol(choice); } cout << endl; } Thanks alot for your help!

    Read the article

  • XmlAttribute/XmlText cannot be used to encode complex type

    - by Conrad C
    I want to serialize a class Ticket into xml. I get the error :"XmlAttribute/XmlText cannot be used to encode complex type" because of my customfield class. This is how the xml for customfields should look like ( the attribute array is nesseray but I don't understand how to create it): <custom_fields type="array"> <custom_field name="Standby Reason" id="6"> <value/> </custom_field> <custom_field name="Close Date" id="84"> Class Ticket public class Ticket { [XmlElement("custom_fields")] public CustomFields Custom_fields { get; set; } Class CustomFields [Serializable] public class CustomFields { [XmlAttribute("array")] public List<CustomField> custom_field { get; set; } Class CustomField [Serializable] public class CustomField { [XmlIgnore] public string Name { get; set; } [XmlElement] public int Id { get; set; } [XmlElement] public string Value { get; set; }

    Read the article

  • How am I able to create A List<T> containing a generic Interface?

    - by Conrad Clark
    I have a List which must contain IInteract Objects. But IInteract is a generic interface which requires 2 type arguments. My main idea is iterate through a list of Objects and "Interact" one with another if they didn't interact yet. So i have this object List<IObject> WorldObjects = new List<IObject>(); and this one: private List<IInteract> = new List<IInteract>(); Except I can't compile the last line because IInteract requires 2 type arguments. But I don't know what the arguments are until I add them. I could add interactions between Objects of Type A and A... or Objects of Type B and C. I want to create "Interaction" classes which do something with the "acting" object and the "target" object, but I want them to be independent from the objects... so I could add an Interaction between for instance... "SuperUltraClass" and... an "integer". Am I using the wrong approach?

    Read the article

  • Is my program taking too much time to execute?

    - by Conrad C
    I wanted to solve a question from project euleur about finding the largest prime number of a big number. I run my code on a virtual machine on Visual studio 2012, and the code seems froze. When I step into the loop, the code works well, but when I execute it, the console is always there. It is as if the program is still running. Could it be that the program takes time to execute? My Code static void Main(string[] args) { long number = 5; for (long i = 1; i < 600851475143; i++) { if (i % 2 != 0 && i % 1 == 0 && i % i == 0) number = i; } }

    Read the article

  • La qualité de la recherche en ligne est-elle subjective ? Bing serait meilleur que Google d'après Search Engine Land

    La qualité de la recherche en ligne est-elle subjective ? Bing serait meilleur que Google d'après Search Engine Land Un manager marketing travaillant pour Search Engine Land, Conrad Saam, a lancé vingt recherches sur Bing et sur Google. A chaque fois, il envoyait des requêtes évitant les demandes les plus simples (comme trouver le site Internet d'une grosse société par exemple) et mélangeant plusieurs mots. Il a ainsi demandé aux deux moteurs de recherche de lui trouver des occurrences pour "l'avocat Tom Brady". Google s'est trompé sur l'un des résultats en proposant une page sur un célèbre quarterback du même nom. Suite à cela, l'homme a personnellement jugé de la qualité des réponses obtenues. Pour lui, Bing était meill...

    Read the article

  • MPMediaPickerController, MPMediaItems, and NSData

    - by ckrames1234
    I was wondering if Apple allowed you to access the MPMediaItem's raw data as an NSData object. If you can, thats great and I would like to know how. If you cannot, then Apple is way too over-protective, and my app that i started is utterly useless. Also if you cannot, Is there any hacky workarounds? I don't care if Apple doesn't accept my app as it would still be cool if me and my friends all had it. Thanks, Conrad

    Read the article

  • Forbes Announcing The World’s Top 20 Billionaires

    - by Suganya
    Forbes company recently conducted a survey to figure out the world’s Billionaires list and has released it listing the top 20 names of the Billionaires. The company says that for the third time in the last three years the world has a new richest man for this year. So it means that Bill Gates was beaten up by someone else in world. Who is the new richest man in the world?   Forbes.Com announced the richest man in world and this time it is not Bill Gates. But it is Carlos Slim Helu who is into Telecom industry. Carlos lives in Mexico and he had the third richest man’s place last year. Having shown a Net worth of $ 53.5 Billion, Carlos has increased $18.5 Billion in a year. Carlos swooped on the privatization of Mexico’s national telephone service during the last decade and now has achieved the world’s first richest man. Following Carlos, in the second position is Bill Gates with the Nett worth of $53 Billion. As Bill Gates requires no great introduction, lets move on to the next place. The third place is occupied by Warren Buffett followed by Mukesh Ambani and Lakshmi Mittal in fourth and fifth places respectively. The top 20 names of world’s richest people, their occupation and the Nett worth that they hold are S.No Name Nett Worth (in $ Billion) Source of Income 1 Carlos Slim Helu 53.5 Telecom 2 Bill Gates 53 Microsoft 3 Warren Buffett 47 Investments 4 Mukesh Ambani 29 Petrochemical, Oil and Gas 5 Lakshmi Mittal 28.7 Steel 6 Lawrence Ellison 28 Oracle 7 Bernard Arnault 27.5 Luxury Goods 8 Eike Batista 27 Mining, Oil 9 Amancio Ortega 25 Fashion, Retail 10 Karl Albrecht 23.5 Supermarkets 11 Ingvar Kamprad and Family 23 IKEA 12 Christy Walton and Family 22.5 Wal-Mart 13 Stefan Persson 22.4 H & M 14 Li Ka-shing 21 Diversified 15 Jim C. Walton 20.7 Wal-Mart 16 Alice Walton 20.6 Wal-Mart 17 Liliane Bettencourt 20 L’Oreal 18 S. Robson Walton 19.8 Wal-Mart 19 Prince Alwaleed bin Talal Alsaud 19.4 Diversified 20 David Thomson and Family 19 Thomson Reuters   Source: Forbes and Image Credit : kevindooley Join us on Facebook to read all our stories right inside your Facebook news feed.

    Read the article

  • Best Geocoding Service for iPhone Developers

    - by ckrames1234
    I have made an app that gets an array of addresses from a web service and I want to map them. I know Apple left this out in MapKit, including only a reverse GeoCoder. I was wondering what the best way to approach this problem was. Web Service? Google Maps API (How do API keys work?)? CloudMade? What is your opinions on which service is fastest, easiest to use, and cheapest (hopefully free)? Thanks, Conrad Kramer

    Read the article

  • Turning Separate iPad/iPhone Targets into Universal App

    - by ckrames1234
    I, when I got my hands on the iPad SDK Beta, thought the universal binary would be to much work, so i opted for the separate targets. I realized halfway through making the iPad portion of my app, that making a universal application would be easy as pie. The issue is, I can't use Apple's option to convert my iPhone Target to Universal. The only thing that I would need to do in the Info.plist of the universal application would be to set a different MainWindow. How could I approach the problem? Is there a workaround to get Apple's way to work (maybe by deleting the existing iPad Target)? Is there a good way to do it manually? If any of you have experience on this subject, help would be much appreciated Thanks, Conrad Kramer

    Read the article

  • Determining the magnitude of a certain frequency on the iPhone

    - by eagle
    I'm wondering what's the easiest/best way to determine the magnitude of a given frequency in a sound. It's my understanding that a FFT function will return the magnitudes of all frequencies in a signal. I'm wondering if there is any shortcut I could use if I'm only concerned about a specific frequency. I'll be using the iPhone mic to record the audio. My guess is that I'll be using the Audio Queue Services for recording since I don't need to record the audio to a file. I'm using SDK 4.0, so I can use any of the functions defined in the Accelerate framework (e.g. FFT functions) if needed. Update: I updated the question to be more clear as per Conrad's suggestion.

    Read the article

  • Python: How do I pass a variable by reference?

    - by David Sykes
    The Python documentation seems unclear about whether parameters are passed by reference or value, and the following code produces the unchanged value 'Original' class PassByReference: def __init__(self): self.variable = 'Original' self.Change(self.variable) print self.variable def Change(self, var): var = 'Changed' Is there something I can do to pass the variable by actual reference? Update: I am coming to the conclusion that while Andrea answered my actual question (Can you... No but you can...), on the subject of pass by reference Blair Conrad is more technically correct. As I understand it the crux is that a copy of a reference is being passed. If you assign that copy, as in my example, then you lose the reference to the original and it remains unchanged. If, however, you 'use' that reference, for example append on a passed list, then the original is changed. I will see how the comments and votes go before choosing the answer people think is the best

    Read the article

  • scraping website with javascript cookie with c#

    - by erwin
    Hi all, I want to scrap some things from the following site: http://www.conrad.nl/modelspoor This is my function: public string SreenScrape(string urlBase, string urlPath) { CookieContainer cookieContainer = new CookieContainer(); HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(urlBase + urlPath); httpWebRequest.CookieContainer = cookieContainer; httpWebRequest.UserAgent = "Mozilla/6.0 (Windows; U; Windows NT 7.0; en-US; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.9 (.NET CLR 3.5.30729)"; WebResponse webResponse = httpWebRequest.GetResponse(); string result = new System.IO.StreamReader(webResponse.GetResponseStream(), Encoding.Default).ReadToEnd(); webResponse.Close(); if (result.Contains("<frame src=")) { Regex metaregex = new Regex("http:[a-z:/._0-9!?=A-Z&]*",RegexOptions.Multiline); result = result.Replace("\r\n", ""); Match m = metaregex.Match(result); string key = m.Groups[0].Value; foreach (Match match in metaregex.Matches(result)) { HttpWebRequest redirectHttpWebRequest = (HttpWebRequest)WebRequest.Create(key); redirectHttpWebRequest.CookieContainer = cookieContainer; webResponse = redirectHttpWebRequest.GetResponse(); string redirectResponse = new System.IO.StreamReader(webResponse.GetResponseStream(), Encoding.Default).ReadToEnd(); webResponse.Close(); return redirectResponse; } } return result; } But when i do this i get a string with an error from the website that it use javascript. Does anybody know how to fix this? Kind regards Erwin

    Read the article

  • Packing an exe + dll into one executable (not .NET)

    - by Bluebird75
    Hi, Is anybody aware of a program that can pack several DLL and a .EXE into one executable. I am not talking about .NET case here, I am talking about general DLLs, some of which I generate in C++, some of others are external DLL I have no control over. My specific case is a python program packaged with py2exe, where I would like to "hide" the other DLL by packing them. The question is general enough though. The things that had a look at: ILMerge: specific to .NET NETZ: specific to .NET UPX: does DLL compression but not multiple DLL + EXE packing FileJoiner: Almost got it. It can pack executable + anything into one exe but when opened, it will launch the default opener for every file that was packed. So, if the user user dlldepend installed, it will launch it (becaues that's the default dll opener). Maybe that's not possible ? Summary of the answers: DLL opening is managed by the OS, so packing DLL into executable means that at some point, they need to be extracted to a place where the OS can find them. No magic bullet. So, what I want is not possible. Unless... We change something in the OS. Thanks Conrad for pointing me to ThinInstall, which virtualise the application and the OS loading mechanism. With ThinInstall, it is possible to pack everything in one exe (DLL, registry settings, ...).

    Read the article

  • How to count each digit in a range of integers?

    - by Carlos Gutiérrez
    Imagine you sell those metallic digits used to number houses, locker doors, hotel rooms, etc. You need to find how many of each digit to ship when your customer needs to number doors/houses: 1 to 100 51 to 300 1 to 2,000 with zeros to the left The obvious solution is to do a loop from the first to the last number, convert the counter to a string with or without zeros to the left, extract each digit and use it as an index to increment an array of 10 integers. I wonder if there is a better way to solve this, without having to loop through the entire integers range. Solutions in any language or pseudocode are welcome. Edit: Answers review John at CashCommons and Wayne Conrad comment that my current approach is good and fast enough. Let me use a silly analogy: If you were given the task of counting the squares in a chess board in less than 1 minute, you could finish the task by counting the squares one by one, but a better solution is to count the sides and do a multiplication, because you later may be asked to count the tiles in a building. Alex Reisner points to a very interesting mathematical law that, unfortunately, doesn’t seem to be relevant to this problem. Andres suggests the same algorithm I’m using, but extracting digits with %10 operations instead of substrings. John at CashCommons and phord propose pre-calculating the digits required and storing them in a lookup table or, for raw speed, an array. This could be a good solution if we had an absolute, unmovable, set in stone, maximum integer value. I’ve never seen one of those. High-Performance Mark and strainer computed the needed digits for various ranges. The result for one millon seems to indicate there is a proportion, but the results for other number show different proportions. strainer found some formulas that may be used to count digit for number which are a power of ten. Robert Harvey had a very interesting experience posting the question at MathOverflow. One of the math guys wrote a solution using mathematical notation. Aaronaught developed and tested a solution using mathematics. After posting it he reviewed the formulas originated from Math Overflow and found a flaw in it (point to Stackoverflow :). noahlavine developed an algorithm and presented it in pseudocode. A new solution After reading all the answers, and doing some experiments, I found that for a range of integer from 1 to 10n-1: For digits 1 to 9, n*10(n-1) pieces are needed For digit 0, if not using leading zeros, n*10n-1 - ((10n-1) / 9) are needed For digit 0, if using leading zeros, n*10n-1 - n are needed The first formula was found by strainer (and probably by others), and I found the other two by trial and error (but they may be included in other answers). For example, if n = 6, range is 1 to 999,999: For digits 1 to 9 we need 6*105 = 600,000 of each one For digit 0, without leading zeros, we need 6*105 – (106-1)/9 = 600,000 - 111,111 = 488,889 For digit 0, with leading zeros, we need 6*105 – 6 = 599,994 These numbers can be checked using High-Performance Mark results. Using these formulas, I improved the original algorithm. It still loops from the first to the last number in the range of integers, but, if it finds a number which is a power of ten, it uses the formulas to add to the digits count the quantity for a full range of 1 to 9 or 1 to 99 or 1 to 999 etc. Here's the algorithm in pseudocode: integer First,Last //First and last number in the range integer Number //Current number in the loop integer Power //Power is the n in 10^n in the formulas integer Nines //Nines is the resut of 10^n - 1, 10^5 - 1 = 99999 integer Prefix //First digits in a number. For 14,200, prefix is 142 array 0..9 Digits //Will hold the count for all the digits FOR Number = First TO Last CALL TallyDigitsForOneNumber WITH Number,1 //Tally the count of each digit //in the number, increment by 1 //Start of optimization. Comments are for Number = 1,000 and Last = 8,000. Power = Zeros at the end of number //For 1,000, Power = 3 IF Power 0 //The number ends in 0 00 000 etc Nines = 10^Power-1 //Nines = 10^3 - 1 = 1000 - 1 = 999 IF Number+Nines <= Last //If 1,000+999 < 8,000, add a full set Digits[0-9] += Power*10^(Power-1) //Add 3*10^(3-1) = 300 to digits 0 to 9 Digits[0] -= -Power //Adjust digit 0 (leading zeros formula) Prefix = First digits of Number //For 1000, prefix is 1 CALL TallyDigitsForOneNumber WITH Prefix,Nines //Tally the count of each //digit in prefix, //increment by 999 Number += Nines //Increment the loop counter 999 cycles ENDIF ENDIF //End of optimization ENDFOR SUBROUTINE TallyDigitsForOneNumber PARAMS Number,Count REPEAT Digits [ Number % 10 ] += Count Number = Number / 10 UNTIL Number = 0 For example, for range 786 to 3,021, the counter will be incremented: By 1 from 786 to 790 (5 cycles) By 9 from 790 to 799 (1 cycle) By 1 from 799 to 800 By 99 from 800 to 899 By 1 from 899 to 900 By 99 from 900 to 999 By 1 from 999 to 1000 By 999 from 1000 to 1999 By 1 from 1999 to 2000 By 999 from 2000 to 2999 By 1 from 2999 to 3000 By 1 from 3000 to 3010 (10 cycles) By 9 from 3010 to 3019 (1 cycle) By 1 from 3019 to 3021 (2 cycles) Total: 28 cycles Without optimization: 2,235 cycles Note that this algorithm solves the problem without leading zeros. To use it with leading zeros, I used a hack: If range 700 to 1,000 with leading zeros is needed, use the algorithm for 10,700 to 11,000 and then substract 1,000 - 700 = 300 from the count of digit 1. Benchmark and Source code I tested the original approach, the same approach using %10 and the new solution for some large ranges, with these results: Original 104.78 seconds With %10 83.66 With Powers of Ten 0.07 A screenshot of the benchmark application: If you would like to see the full source code or run the benchmark, use these links: Complete Source code (in Clarion): http://sca.mx/ftp/countdigits.txt Compilable project and win32 exe: http://sca.mx/ftp/countdigits.zip Accepted answer noahlavine solution may be correct, but l just couldn’t follow the pseudo code, I think there are some details missing or not completely explained. Aaronaught solution seems to be correct, but the code is just too complex for my taste. I accepted strainer’s answer, because his line of thought guided me to develop this new solution.

    Read the article

< Previous Page | 1 2