Daily Archives

Articles indexed Saturday May 1 2010

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

  • [C++]Advantage of using a static member function instead of an equivalent non-static member function

    - by jonathanasdf
    I was wondering whether there's any advantages to using a static member function when there is a non-static equivalent. Will it result in faster execution (because of not having to care about all of the member variables), or maybe less use of memory (because of not being included in all instances)? Basically, the function I'm looking at is an utility function to rotate an integer array representing pixel colours an arbitrary number of degrees around an arbitrary centre point. It is placed in my abstract Bullet base class, since only the bullets will be using it and I didn't want the overhead of calling it in some utility class. It's a bit too long and used in every single derived bullet class, making it probably not a good idea to inline. How would you suggest I define this function? As a static member function of Bullet, of a non-static member function of Bullet, or maybe not as a member of Bullet but defined outside of the class in Bullet.h? What are the advantages and disadvantages of each?

    Read the article

  • Vector insert() causes program to crash

    - by wrongusername
    This is the first part of a function I have that's causing my program to crash: vector<Student> sortGPA(vector<Student> student) { vector<Student> sorted; Student test = student[0]; cout << "here\n"; sorted.insert(student.begin(), student[0]); cout << "it failed.\n"; ... It crashes right at the sorted part because I can see "here" on the screen but not "it failed." The following error message comes up: Debug Assertion Failed! (a long path here...) Expression: vector emplace iterator outside range For more information on how your program can cause an assertion failure, see the Visual C++ documentation on asserts. I'm not sure what's causing the problem now, since I have a similar line of code elsewhere student.insert(student.begin() + position(temp, student), temp); that does not crash (where position returns an int and temp is another declaration of a struct Student). What can I do to resolve the problem, and how is the first insert different from the second one?

    Read the article

  • Err Web Service?

    - by j-t-s
    Hi All I am trying to implement a feature. But I've never had anything to do with "Web Services" before, other than using them. I have a desktop application, and I want that application to be able to sort of "post" some information (i.e. email address, username, user-selected options (just plain text) etc) to an application or "web service" on my ASP.NET web server. Can somebody please guide me in the right direction? How would I accomplish this? Thank you :) Jason

    Read the article

  • How do you reenable a validation control w/o it simultaneously perform an immediate validation?

    - by Velika2
    When I called this function to enable a validator from client javascript: `ValidatorEnable(document.getElementById('<%=valPassportOtherText.ClientID%>'), true); //enable` validation control the required validation control immediately performed it validation, found the value in the associated text box blank and set focus to the textbox (because SetFocusOnError was set to true). As a result, the side effect was that focus was shifted to the control that was associated with the Validation control, i teh example, txtSpecifyOccupation. <asp:TextBox ID="txtSpecifyOccupation" runat="server" AutoCompleteType="Disabled" CssClass="DefaultTextBox DefaultWidth" MaxLength="24" Rows="2"></asp:TextBox> <asp:RequiredFieldValidator ID="valSpecifyOccupation" runat="server" ControlToValidate="txtSpecifyOccupation" ErrorMessage="1.14b Please specify your &lt;b&gt;Occupation&lt;/b&gt;" SetFocusOnError="True">&nbsp;Required</asp:RequiredFieldValidator> Perhaps there is a way to enable the (required) validator without having it simultaneously perform the validation (at least until the user has tabbed off of it?) I'd like validation of the txtSpecifyOccupation textbox to occur only on a Page submit or when the user has tabbed of the required txtSpecifyoccupation textbox. How can I achieve this?

    Read the article

  • Sanitizing user input that will later be e-mailed - what should I be worried about?

    - by Kevin Burke
    I'm interning for an NGO in India (Seva Mandir, http://sevamandir.org) and trying to fix their broken "subscribe to newsletter" box. Because the staff isn't very sophisticated and our web host isn't great, I decided to send the relevant data to the publications person via mail() instead of storing it in a MySQL database. I know that it's best to treat user input as malicious, and I've searched the SO forums for posts relevant to escaping user data for sending in a mail message. I know the data should be escaped; what should I be worried about and what's the best way to sanitize the input before emailing it? Form flow: 1. User enters email on homepage and clicks Submit 2. User enters name, address, more information on second page (bad usability, I know, but my boss asked me to) and clicks "Submit" 3. Collect the data via $_POST and email it to the publications editor (and possibly send a confirmation to the subscriber). I am going to sanitize the email in step 2 and the other data in step 3. I appreciate your help, Kevin

    Read the article

  • How would you create a string of all UTF-8 characters? [PHP]

    - by Xeoncross
    There are many ways to represent the +1 million UTF-8 characters. Take the latin capital "A" with macron (A). This is unicode code point U+0100, hex number 0xc4 0x80, decimal number 196 128, and binary 11000100 10000000. I would like to create a collection of the first 65,535 UTF-8 characters for use in testing applications. These are all unicode characters up to code point U+FFFF (byte3). Is it possible to do something like a for($x=0) loop and then convert the resulting decimal to another base (like hex) which would allow the creation of the matching unicode character? I can create the value A using something like this: $char = "\xc4\x80"; // or $char = chr(196).chr(128); However, I am not sure how to turn this into an automated process. // fail! $char = "\x". dechex($a). "\x". dexhex($$b);

    Read the article

  • Control an embedded flash movie's playback in HTML/php

    - by lostInTransit
    Hi I am using an embedded flash movie in my web page. I would like to show some alerts on the page when the movie has played for x seconds, pause the movie while the user views and dismisses the alert and start playing the movie again after that (or the user can press the play button, not important) The important parts being - the app being able to find out if x secs worth of movie has played, pausing the movie then and showing an alert. Is this possible using a php/javascript code within the web page? Or will I have to do this within the flash movie itself? Thanks.

    Read the article

  • Does the Frontier Kernel have a future?

    - by pbreitenbach
    Whatever you think about Dave Winer, Frontier is an incredible piece of software. It includes quite a few advances that have yet to be surpassed: the object database, the database viewer, the scripting environment, the hierarchical-including website generation scheme, the elegant scripting language, the mixing of scripts and compilation, rapid prototyping, built in web server, simple debugger, cross-platform, simple UI, etc. My question: Dave turned Frontier over to open source and there is a Frontier Kernel project. However it is fairly quiet. Does Frontier have a future from here?

    Read the article

  • starting with flex - please let me know if the direction is right (ActionScript vs MXML separation)

    - by Piotr
    Hi, I've just started learning flex using OReilly "Programming Flex 3.0". After completing three chapters and starting fourth (ActionScript), and not having enough patience to wait till completing chapter 22 I started to practice :) One bit that I have most worries about right now is the the dual coding mode (MXML vs ActionScript) Please have a look at my code below (it compiles via mxmlc design.mxml, second file 'code.as' should be in same directory) and advise if the separation I used between visual design and code is appropriate. Also - if some smart guy could show me how to recode same example with *.as being a class file [package?] it would be highly appreciated. I got lost with creating directory structure for package - and did not find it most intuitive, especially for small project that has two files like my example. Code: design.mxml <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:Script source="code.as"/> <mx:VBox> <mx:TextInput creationComplete="initializeCalculator()" id="txtScreen"/> <mx:HBox> <mx:Button click="click('7')" id="btn7" label="7"/> <mx:Button click="click('8')" id="btn8" label="8"/> <mx:Button click="click('9')" id="btn9" label="9"/> <mx:Button click="click('C')" id="btnClear" label="C"/> </mx:HBox> <mx:HBox> <mx:Button click="click('4')" id="btn4" label="4"/> <mx:Button click="click('5')" id="btn5" label="5"/> <mx:Button click="click('6')" id="btn6" label="6"/> <mx:Button click="click('/')" id="btnDivide" label="/"/> </mx:HBox> <mx:HBox> <mx:Button click="click('1')" id="btn1" label="1"/> <mx:Button click="click('2')" id="btn2" label="2"/> <mx:Button click="click('3')" id="btn3" label="3"/> <mx:Button click="click('*')" id="btnMultiply" label="*"/> </mx:HBox> <mx:HBox> <mx:Button click="click('0')" id="btn0" label="0"/> <mx:Button click="click('=')" id="btnEqual" label="="/> <mx:Button click="click('-')" id="btnMinus" label="-"/> <mx:Button click="click('+')" id="btnPlus" label="+"/> </mx:HBox> </mx:VBox> </mx:Application> code: code.as public var res:int = 0; public var previousOperator:String = ""; public var previousRes:int=0; public function initializeCalculator():void{ txtScreen.text = res.toString(); } public function click(code:String):void{ if (code=="1" || code=="2" || code=="3" || code=="4" || code=="5" || code=="6" || code=="7" || code=="8" || code=="9" || code=="0"){ res = res*10 + int(code); txtScreen.text = res.toString(); } else if (code=="C"){ res = 0; previousOperator =""; previousRes = 0; txtScreen.text = res.toString(); } else{ calculate(code); } } public function calculate(operator:String):void{ var tmpRes:int; if (previousOperator=="+"){ tmpRes = previousRes + res; } else if (previousOperator=="-"){ tmpRes = previousRes - res; } else if (previousOperator=="/"){ tmpRes = previousRes / res; } else if (previousOperator=="*"){ tmpRes = previousRes * res; } else{ tmpRes = res; } previousOperator = operator; previousRes = tmpRes; txtScreen.text = previousRes.toString(); res = 0; if (previousOperator=="=") { res = tmpRes; txtScreen.text=res.toString(); } } PS. If you have comments that this calculator does not calculate properly, they are also appreciated, yet most important are comments on best practices in Flex.

    Read the article

  • Explaining makefile

    - by Michael
    xpi_built := $(build_dir)/$(install_rdf) \ $(build_dir)/$(chrome_manifest) \ $(chrome_jar_file) \ $(default_prefs) xpi_built_no_dir := $(subst $(build_dir)/,,$(xpi_built)) $(xpi_file): $(build_dir) $(xpi_built) @echo "Creating XPI file." cd $(build_dir); $(ZIP) ../$(xpi_file) $(xpi_built_no_dir) @echo "Creating XPI file. Done!" $(build_dir)/%: % cp -f $< $@ $(build_dir): @if [ ! -x $(build_dir) ]; \ then \ mkdir $(build_dir); \ fi can anyone explain me this makefile part? particularly interested in $(build_dir)/%: % as well as $< and $@ directives two labels $(build_dir) exists, I guess both are executed, but in which order?

    Read the article

  • Expand in linq not loading inner data collections from service.

    - by Kit
    I am seeing odd behavior with service queries! I am using MVVM pattern for a silverlight 3 app on 3.5 framework and Dataservices 1.5. The following code eager loads correctly the parent object and the child heirarchy perfectly IF and ONLY IF I am preloading the data. But I would like to fetch a different set of the parent object (and its child heirarchy) on different button clicks. What I am seeing is that on button click, only the parent object is retrieved, and the child heirarchy contains nothing. Any suggestions? Any ideas how to tackle this? Thanks all. The method: DataServiceQuery serviceQuery = (DataServiceQuery)(from m1 in dbEntities.gis_Region.Expand("gis_RegionValue/gis_Measure") where m1.RegionGuid == new Guid(regionGuid) select m1); serviceQuery.BeginExecute(GetRegionDetailAsyncResult, serviceQuery); The wired Async Result: DataServiceQuery query = (DataServiceQuery)result.AsyncState; gis_Region region = query.EndExecute(result).First();

    Read the article

  • What are some strategies for maintaining a common database schema with a team of developers and no D

    - by Mahmoud Abdelkader
    I'm curious about how others have approached the problem of maintaining and synchronizing database changes across many (10+) developers without a DBA? What I mean, basically, is that if someone wants to make a change to the database, what are some strategies to doing that? (i.e. I've created a 'Car' model and now I want to apply the appropriate DDL to the database, etc..) We're primarily a Python shop and our ORM is SQLAlchemy. Previously, we had written our models in such a way to create the models using our ORM, but we recently ditched this because: We couldn't track changes using the ORM The state of the ORM wasn't in sync with the database (e.g. lots of differences primarily related to indexes and unique constraints) There was no way to audit database changes unless the developer documented the database change via email to the team. Our solution to this problem was to basically have a "gatekeeper" individual who checks every change into the database and applies all accepted database changes to an accepted_db_changes.sql file, whereby the developers who need to make any database changes put their requests into a proposed_db_changes.sql file. We check this file in, and, when it's updated, we all apply the change to our personal database on our development machine. We don't create indexes or constraints on the models, they are applied explicitly on the database. I would like to know what are some strategies to maintain database schemas and if ours is seems reasonable. Thanks!

    Read the article

  • Warning: Why your Internet might fail on May 5

    <b>IT News:</b> "On May 5, the world's top domain authorities (led by ICANN, the US Government and Verisign) will complete the first phase of the roll-out of DNSSEC (Domain Name System Security Extensions) across the 13 root servers that direct user requests to the relevant websites on the internet."

    Read the article

  • Silverlight Cream for April 30, 2010 -- #852

    - by Dave Campbell
    In this Issue: Michael Washington, Tim Greenfield, Jaime Rodriguez, and The WP7 Team. Shoutouts: Mike Taulty has a pretty complete set of links up for information about VS2010, Silverlight, Blend, Phone 7 Upgrade Christian Schormann announced Blend for Windows Phone: Update Available, and has other links up as well. From SilverlightCream.com: Silverlight Simplified MVVM Modal Popup Michael Washington is demonstrating a modal popup in MVVM and also shows the implementation of a value converter XPath support in Silverlight 4 + XPathPad Tim Greenfield blogged about XPath support in Silverlight 4 and his XPathPad tool... check out what all you can do with it... then go grab it, or the source too! Windows phone capabilities security model Jaime Rodriguez is discussing the WP7 capabilities exposed with the latest refresh such as location services, microphone, media library, gamer services, phone dialoer, push notification... how to code for them and other tips. Windows Phone 7 Series Developer Training Kit The WP7 Team is discussing the WP7 capabilities exposed with the latest refresh such as location services, microphone, media library, gamer services, phone dialoer, push notification... how to code for them and other tips. Stay in the 'Light! Twitter SilverlightNews | Twitter WynApse | WynApse.com | Tagged Posts | SilverlightCream Join me @ SilverlightCream | Phoenix Silverlight User Group Technorati Tags: Silverlight    Silverlight 3    Silverlight 4    Windows Phone MIX10

    Read the article

  • Changing terminal colors in Ubuntu Server

    - by Josh K
    I'd like to change the colors. The lime green hilighting on pale blue colored file names is killing my eyes. I'm not sure if I'm using xterm or gnome or whatever, but I would like to change the default color scheme (preferable to something less offensive to my corneas) and have it stay changed (update my user profile). Colors are nice, but sometimes it makes the text unreadable. I would settle for having no colors, standard B&W, if I can't have nice colors.

    Read the article

  • iTunes not recognizing music from NAS

    - by Gareth
    At the current moment I have a SONOS system running through my house. The SONOS takes music directly from a NAS. I want to be able to get iTunes to be able to play music from the NAS without copying them to my local drive. At the moment, the iTunes has been able to recognise the NAS, but it is reading the music from a file within the NAS called Qmultimedia. All of my music is inside a "music" folder that SONOS is using.

    Read the article

  • Microsoft est pour "adapter" la neutralité du Net, en réponse aux questions lancées par la FCC

    Microsoft est pour "adapter" la neutralité du Net, en réponse aux questions lancées par la FCC La Federal Communications Commission (FCC) a lancé une grande consultation auprès des parties concernées à propos de son élaboration de futures lois concernant l'Internet. Microsoft a participé à ce brainstorming de grande ampleur en donnant son avis sur la neutralité du net. Bien que le géant ai un certain intérêt à s'assurer que ses applications et services web soient délivrés aux consommateurs sans l'interférence d'un FAI dans l'affaire ; il s'est opposé à l'adoption de "régulations inutiles ou inefficaces" comme "l'interdiction de tous les types de discriminations" dont il estime qu'elles...

    Read the article

  • Alternative pygame resources

    - by Devo
    Hi, I have been trying to access the pygame website for a few weeks now, and I can't get to it. I doubt it's down, so I have to conclude that it's blocked because I am in China. I have no idea why. Anyways, I want the pygame documentation, but all the download links I fond lead back to pygame.org (which I does not even begin loading, it's such a politically subversive website you know!). Can anyone tell me where I can get documentation and other pygame resources without going through pygame.org? I would really appreciate it, thanks. PS I am on windows XP, if it matters.

    Read the article

  • How to disable a checkbox based on date using php?

    - by udaya
    I have iterated a table based on my query result... I have a column lastDate it contains a date value like 01/24/2010... Now i have to check the date value with the current date if currentdate is less than or equal to lastDate i have to enable the checkbox else disable it..... Any suggestion how it can be done in php... Here is my code <? if(isset($comment)) { echo '<tr><td class=table_label colspan=5>'.$comment.'</td></tr>'; } ?> <td align="center" class="table_label" id="txtsubdat"> <? $dd=$row['dDate']; if($dd=='') { } else { $str = $dd; $dd = strtotime ( $str ); echo date ( 'm/d/Y' , $dd ); } ?> </td> <td align="center"> <input type="checkbox" name="group" id="group" value="<?=$row['dAssignment_id']?>" onclick="checkdisplay(this);"> </td> <? } ?>

    Read the article

  • "Inherited" types in C++

    - by Ken Moynihan
    The following code does not compile. I get an error message: error C2039: 'Asub' : is not a member of 'C' Can someone help me to understand this? Tried VS2008 & 2010 compiler. template <class T> class B { typedef int Asub; public: void DoSomething(typename T::Asub it) { } }; class C : public B<C> { public: typedef int Asub; }; class A { public: typedef int Asub; }; int _tmain(int argc, _TCHAR* argv[]) { C theThing; theThing.DoSomething(C::Asub()); return 0; }

    Read the article

  • double border with no space in between

    - by user330239
    Hi guys, i wanted to make a double border but with no space in between and the double border should be of different color. I tried using image instead but i thought css could probably perform this job for me, i searched the net but hardly find anything close. What i wanted is total of 2px dotted border with top color of #a4a4a4 and bottom color of #474747. Any idea how i can do this instead of creating 2 divs?

    Read the article

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