Daily Archives

Articles indexed Friday June 11 2010

Page 14/114 | < Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >

  • C++ Stack Overflow

    - by PhilMAN
    Here is some code: void main() { GameEngine ge("phil", "anotherguy"); string response; do { ge.playGame(); cout << endl << "Do you want to (r)eplay the same battle, (s)tart a new battle, or (q)uit? "; cin >> response; } while(response == "r" || response == "R" || response == "s" || response == "S" ); } GameEngine::GameEngine(string name1, string name2) { p1Name = name1; p2Name = name2; } void GameEngine::playGame() { cout << "PLAY GAME" << endl; Army p1, p2; Battlefield testField; RuleSet rs; int xSize = 13; // Number of rows int ySize = 13; // Number of columns loadData(p1, p2, testField, rs, xSize, ySize); ... } void GameEngine::loadData(Army& p1, Army& p2, Battlefield& testField, RuleSet& rs, int& xSize, int& ySize) { string terrain = BattlefieldUtils::pickTerrain(); string armySplit[14];//id index 1 string ruleSplit[19];//in index 7 string armyP1, armyP2, ruleSet; Skill p1Skills[8]; Skill p2Skills[8]; CreatureStack p1Stacks[20]; CreatureStack p2Stacks[20]; ... } CreatureStack(){quantity = 0; isLive = false; id = -1;}; Army(){}; Battlefield(){}; RuleSet(){}; I have posted every line of code that executes until the program crashes. This code ran fine for a long time, I added some stuff that does not even execute until way after the code I have posted here, and bam stack overflow that occurs at GameEngine::loadData() line: CreatureStack p2Stacks[20]; will not go away. What am I doing wrong here? Is that all the stack can handle? I increased the stack size in Visual Studio and got the error to go away, but that slowed things down considerably, so I would rather just get to the source of the issue and fix that.

    Read the article

  • jquery noob problem with variables (scope?)

    - by aharon
    I'm trying to retrieve data from a php file named return that just contains <?php echo 'here is a string'; ?> I'm doing this through an html file containing <!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery-latest.min.js"></script> <script> var x; $.get("return.php", function(data){ x = data; }) function showAlert() {alert(x);} $(document).ready(function(){ alert(x); }); </script> </head> <body> <input type = "button" value = "Click here" onClick="showAlert();"> </body> </html> When the button is clicked it retrieves and displays the code fine, but on the $(document).ready thing, it displays "undefined" instead of the data in return.php. Any solutions? Thanks.

    Read the article

  • Database web application

    - by Watergaite
    How would i go about creating a php application for my web page that can extract data from my database (i currently get the data in a CSV file). id also like the user to be able to filter the data by certain parameters. can u help

    Read the article

  • how to set default focus?

    - by Elaine
    Now one Submit button is the default focused control. but I need to set the default focus to another imagebutton. Can only use $(document).ready(function(){ctrl.focus();} ? or has another property to fulfill it?

    Read the article

  • What languages, frameworks, and technologies have you used to implement document searching?

    - by Bill Brasky
    I am at a new company and one of our goals is to implement a document search portal for our team and our clients. I am a bit worried that if we use an external service provider like Salesforce or some other ECM in the cloud there will be a lot of integration work in the future. From a client perspective, these documents will also exist in the same bucket as our structured content (stored in the DB, not a MS Word doc). If you have implemented document searching, what languages, frameworks, and technologies have you used? Do you have any failure stories? I don't have a problem using something out of the box, but I think it is important that we have control over the documents and the API to access them. I would like to use Rails if we go fully custom.

    Read the article

  • Efficient way to store order in mySQL for list of items

    - by ninumedia
    I want to code cleaner and more efficiently and I wanted to know any other suggestions for the following problem: I have a mySQL database that holds data about a set of photograph names. Oh, say 100 photograph names Table 1: (photos) has the following fields: photo_id, photo_name Ex data: 1 | sunshine.jpg 2 | cloudy.jpg 3 | rainy.jpg 4 | hazy.jpg ... Table 2: (categories) has the following fields: category_id, category_name, category_order Ex data: 1 | Summer Shots | 1,2,4 2 | Winter Shots | 2,3 3 | All Seasons | 1,2,3,4 ... Is it efficient to store the order of the photos in this manner per entry via comma delimited values? It's one approach I have seen used before but I wanted to know if something else is faster in run time. Using this way I don't think it is possible to do a direct INNER JOIN on the category table and photo table to get a single matched list of all the photographs per category. Ex: Summer shots - sunshine.jpg, cloudy.jpg, hazy.jpg because it was matched against 1,2,4 The iteration through all the categories and then the photos will have a O(n^2) and there has to be a better/faster way. Please educate me :)

    Read the article

  • Microsoft sublanguage string to locale identifier

    - by Jacob
    I can't seem to find a way to convert, or find, a local identifier from a sublanguage string. This site shows the mappings: http://msdn.microsoft.com/en-us/library/dd318693(v=VS.85).aspx I want the user to enter a sublanguage string, such as "France (FR)" and to get the local identifier from this, which in this case would be 0x0484. Or the other way around, if a user enters 0x0480 then to return French (FR). Has anyone encountered this problem before and can point me in the right direction? Otherwise I'm going to be writing a few mapping statements to hard code it and maintain future releases if anything changes. BTW, I'm coding in C++ for Windows platform. Cheers

    Read the article

  • Convert wchar_t to char

    - by Yan Cheng CHEOK
    I was wondering is it safe to do so? wchar_t wide = /* something */; assert(wide >= 0 && wide < 256 &&); char myChar = static_cast<char>(wide); If I am pretty sure the wide char will fall within ASCII range.

    Read the article

  • How can I exceed the 60% Memory Limit of IIS7 in ASP.NET Caching application

    - by evilknot
    Pardon if this is more serverfault vs. stackoverflow. It seems to be on the border. We have an application that caches a large amount of product data for an e-commerce application using ASP.NET caching. This is a dictionary object with 65K elements, and our calculations put the object's size at ~10GB. Problem: The amount of memory the object consumes seems to be far in excess of our 10GB calculation. BIGGEST CONCERN: We can't seem to use over 60% of the 32GB in the server. What we've tried so far: In machine.config/system.web (sf doesn't allow the tags, pardon the formatting): processModel autoConfig="true" memoryLimit="80" In web.config/system.web/caching/cache (sf doesn't allow the tags, pardon the formatting): privateBytesLimit = "20000000000" (and 0, the default of course) percentagePhysicalMemoryUsedLimit = "90" Environment: Windows 2008R2 x64 32GB RAM IIS7 Nothing seems to allow us to exceed the 60% value. See screenshot of taskman. http://www.freeimagehosting.net/image.php?7a42144e03.jpg

    Read the article

  • how to make condition to update table ?

    - by newBie
    hi..i want to make condition to update my table if there's already same data (in the same column) inserted in the table. im using If String.ReferenceEquals(hotel, hotel) = False Then insertDatabase() Else updateDatabase() End If this is the updateDatabase() code Dim sql2 As String = "update infoHotel set nameHotel = N" & FormatSqlParam(hotel) & _ ", knownAs1 = N" & FormatSqlParam(KnownAs(0)) & _ ", knownAs2 = N" & FormatSqlParam(KnownAs(1)) & _ ", knownAs3 = N" & FormatSqlParam(KnownAs(2)) & _ ", knownAs4 = N" & FormatSqlParam(KnownAs(3)) & _ " where hotel = " & hotel & ")" the function manage to go into updateDatabase() but has some error saying "Incorrect syntax near 'Oriental'." Oriental is the data inserted in the table. is it suitable to use ReferenceEquals? im using vb.net and sql database..tq

    Read the article

  • How to run multiple Linux installations on a single VirtualBox?

    - by NoCatharsis
    I just started playing with VirtualBox to check out different versions of Linux. I was wondering if it would be possible (and recommended) to set up a single virtual machine with multiple partitions - one for each separate version of Linux, one for swap memory, and one fully shared /home partition? Still new to Linux, but I've read this is a good way to partition so you can share common applications between Linux installations, however I think everything I've read is pertaining to literal partitions and not virtual machines.

    Read the article

  • Advantages of Search Engine-Friendly Websites

    For every webmaster, System Engine Optimization or SEO only means one thing - tailoring web content to attract more search engine-driven traffic to his website. The higher the rank of a website in the search engine results, the more traffic it gets. Improving the rank of a website means it will have more chances of being visited by more readers and people who may become potential clients or sources of revenue. Regardless of what services or products may be offered, it is essential for for the site to be search engine-friendly as statistics show over 95% of traffic are driven by search engines.

    Read the article

  • How to color HTML elements based on parsing a user command string

    - by Anonymous the Great
    I'm working on a little parsing thing to color objects. For an example, you could type red:Hi!: and "Hi!" would be red. This is my not working code: <script type="text/javascript"> function post() { var preview = document.getElementById("preview"); var submit = document.getElementById("post"); var text = submit.value; <?php str_replace("red:*:",'<i class="red">*</i>',text); ?> preview.value = text; } </script>

    Read the article

  • InvalidCastException when getting Text from a Label referenced by dynamicaly built String, Fix?

    - by Chris
    NET Version: 3.5 Ok, I recieve an error (System.InvalidCastException was unhandled. Message="Unable to cast object of type 'System.Windows.Forms.Control[]' to type 'System.Windows.Forms.Label'.") when trying to get Text from a Label referenced by a dynamicly built string. Here's my situation; I have an array of 250 labels named l1 - l250. What I want to do is loop through them using this while statement: int c = 1; while (c < 251) { string k = "l" + c.ToString(); //dynamic name of Control(Label) object ka = Controls.Find(k, true); string ct = ((Label)ka).Text; //<<Error Occurs Here build = build + ct; c++; } and get the text value of each to build a string named build. I don't get any build errors, just this while debuging. While debuging I can go down to view my local variables. When looking through these, I can view the contents of object ka; it does contain the correct Text value of the correct Label I want to "access". I just don't understand how to get there. The text value is listed under "[0]" which is the only subcatagory for "ka".

    Read the article

  • Custom RIA Authentication

    - by cmaduro
    Following the steps in this post: http://forums.silverlight.net/forums/t/177042.aspx Where/How do I add the [Key] attribute on the Name property of the IAuthentication where User is one of my ADO.Net Entity objects? My options so far seem to be: In the designer codebehind of me ADO.Net Entity Model. Create a partial User class and add it there In the AuthenticationService.metadata.cs partial User class. It just does not seem to work no matter where I place the [Key] attribute.

    Read the article

  • Lucene setboost doesn't work

    - by Keven
    Hi all, OUr team just upgrade lucene from 2.3 to 3.0 and we are confused about the setboost and getboost of document. What we want is just set a boost for each document when add them into index, then when search it the documents in the response should have different order according to the boost I set. But it seems the order is not changed at all, even the boost of each document in the search response is still 1.0. Could some one give me some hit? Following is our code: String[] a = new String[] { "schindler", "spielberg", "shawshank", "solace", "sorcerer", "stone", "soap", "salesman", "save" }; List strings = Arrays.asList(a); AutoCompleteIndex index = new Index(); IndexWriter writer = new IndexWriter(index.getDirectory(), AnalyzerFactory.createAnalyzer("en_US"), true, MaxFieldLength.LIMITED); float i = 1f; for (String string : strings) { Document doc = new Document(); Field f = new Field(AutoCompleteIndexFactory.QUERYTEXTFIELD, string, Field.Store.YES, Field.Index.NOT_ANALYZED); doc.setBoost(i); doc.add(f); writer.addDocument(doc); i += 2f; } writer.close(); IndexReader reader2 = IndexReader.open(index.getDirectory()); for (int j = 0; j < reader2.maxDoc(); j++) { if (reader2.isDeleted(j)) { continue; } Document doc = reader2.document(j); Field f = doc.getField(AutoCompleteIndexFactory.QUERYTEXTFIELD); System.out.println(f.stringValue() + ":" + f.getBoost() + ", docBoost:" + doc.getBoost()); doc.setBoost(j); }

    Read the article

  • using Eclipse to develop for embedded Linux on a Windows host

    - by Travis
    I got a question of using Eclipse to develop for embedded Linux on a Windows host Here are now I have and where I am. 1. a Windows host that have the latest Eclipse + CDT (c/c++ development tools) installed 2. a Ubuntu host (ssh + samba installed) that contains sources and toolschain to build the project. (the windows and ubuntu hosts are sitting within one network segment (In LAN).) 3. I can use the following commands to build this project under Ubuntu. # chroot dummyroot # cd /home/project/Build # sh Build date +%Y%m%d%H%M%S 4. I am now trying to create an eclipse C++ project to achieve the goad of the step 3, but I have been stuck here for a while. any ideas of how it can be done?

    Read the article

  • who convert flat file xml in biztalk server?

    - by Anish
    Hi, I am new to BizTalk server. So if this question is so obvious, plz forgive :( I have a flat file from one application, which i have to send to a biztalk server. In that case which component in my biztalk server converts my flat file to xml. Also I heard that I have to create an input schema(.xsd file), why i need an input message schema? Thanks in advance!

    Read the article

  • can't create socket using IO::Socket

    - by Haiyuan Zhang
    when I run the following code, the execution is just hanging there, No response at all. does any of you can tell me what's wrong with the sample code? use strict; use warnings; use IO::Select; use IO::Socket; my $s = new IO::Socket ( LocalPort => 8889, Proto => 'tcp', Listen => 16, Reuse => 1 ); die "could not create socket $!\n" unless $s;

    Read the article

  • how to adjust sliding of scroll according to the value calculated by me?

    - by cng
    I am working on scroll. I have made a program wherein if the scroll box is in particular range of the panel then it automatically moves to a particular position in the slider. For eg, I have a panel of size 500. the scroll has height of 100. Now the total intervals are 5. Now if i slide the scroll box at a position 225 then i want that it automatically slides to the start of that interval that is at position 200. or if i slide to position 450 then instead of staying there it goes to position 400. Is it possible?

    Read the article

  • Tech Ed/BI Conference 2010: A Recovering Industry in a Recovering City

    - by andrewbrust
    I tried writing a post for this blog last night, while at the this year’s Microsoft Tech Ed and Business Intelligence conferences, in New Orleans. But I literally fell asleep while writing it.  That’s probably a sign that my readers might have done the same while reading it. Why the writer’s block? This was a very good show for me, but I think I was having trouble figuring out exactly why.  Now that I’m on the flight home, I’m starting to piece it together. One reason, for sure, was that I’ve spent years in both the developer and the BI worlds, and a show that combined the two was really enjoyable for me.  Typically, the subject matter, the attendees, the Microsoft execs and managers, and even the social circles have been separate.  This year’s Tech Ed facilitated a fusion of each of these previously segregated groups.  That was good for me as a speaker; for example, I facilitated a Birds of a Feather session on PowerPivot (Microsoft’s new self-service BI offering) which was well-attended, and by a large number of non-BI pros.  The fusion was good for me as an attendee too, as Microsoft BI, in the form of a new Pivot Viewer control, made it into the Day 1 keynote, demoed by Microsoft’s key BI champion, Amir Netz.  And it was good for me socially, as I was able to meet with peers in both camps, and at one location. Speaking of meeting with industry colleagues, I did a lot of that at this show.  Probably for the first time ever, I carefully scheduled and conducted a series of meetings with friends and business acquaintances in the developer tools, data visualization, utilities, publishing and training areas of the Microsoft ecosystem.  Beside the time efficiencies in conducting so many meetings, I discovered another benefit. I got a real handle on the tech industry’s economic health. The news here is good.  First of all, 2010 has been a great year for just about everyone I spoke to.  The mood is positive, energy is high, and people are working really hard.  This is, of course, refreshing to see, and it’s a huge relief.  Add to that the fact that this year’s Tech Ed was about 2.5 times larger in headcount than last year’s (based on numbers from unofficial, but reliable, sources), and the economic prognosis seems excellent.  But there’s more to it than that. Here’s the thing: everyone I talked to seems to be working, and succeeding, at changing their business models to adapt to changes in the industry.  Whether it’s the Internet’s impact on publishing and training, the increased importance of the developer audience in South Asia, the shift of affordable developer and business talent to unfamiliar locales abroad, or even lapses in Microsoft’s performance in the market, partner companies aren’t just rolling with the punches; they’re welcoming the changes and working them to their advantage.  No one seemed downtrodden, or even fatigued.  Even for businesses who have seen core revenue streams become commoditized, everyone seems to be changing their market strategy and winning.  Even Microsoft, of whom I have been critical recently, showed signs of successful hard work and playbook change, in the maturing of their cloud strategy, their commitment to it and their excitement around it.  And the embedded, managed, self-service BI strategy that Microsoft has been touting looks like it’s already being embraced by customers, even though PowerPivot, and other new Microsoft BI products, were released only recently. The collective optimism I have witnessed, and that I have felt, tells me good things about this industry and the economy.  The stock market had huge mood swings during my stay, and that may yet subdue the industry recovery I have seen this week.  Nonetheless, I am convinced that a strong foundation of hard work, innovative thinking and, if I may,  true renaissance is underlying this industry’s success. That kind of strength will generate a strong recovery, I am certain, whether now or once we’re past another round of choppy weather in the broader economy.  The fundamentals are good.

    Read the article

  • Managing .NET Deployment Configuration With Rake

    - by Liam McLennan
    Rake is a ruby internal DSL for build scripting. With (or without) the help of albacore rake makes an excellent build scripting tool for .NET projects. The albacore documentation does a good job of explaining how to build solutions with rake but there is nothing to assist with another common build task – updating configuration files. The following ruby script provides some helper methods for performing common configuration changes that are required as part of a build process.  class ConfigTasks def self.set_app_setting(config_file, key, value) ovsd_element = config_file.root.elements['appSettings'].get_elements("add[@key='#{key}']")[0] ovsd_element.attributes['value'] = value end def self.set_connection_string(config_file, name, connection_string) conn_string_element = config_file.root.elements['connectionStrings'].get_elements("add[@name='#{name}']")[0] conn_string_element.attributes['connectionString'] = connection_string end def self.set_debug_compilation(config_file, debug_compilation) compilation_element = config_file.root.elements['system.web'].get_elements("compilation")[0] compilation_element.attributes['debug'] = false end private def self.write_xml_to_file(xml_document, file) File.open(file, 'w') do |config_file| formatter = REXML::Formatters::Default.new formatter.write(xml_document, config_file) end end end To use, require the file and call the class methods, passing the configuration file name and any other parameters. require 'config_tasks' ConfigTasks.set_app_setting 'web.config', 'enableCache', 'false'

    Read the article

< Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >