Search Results

Search found 4252 results on 171 pages for 'david 85'.

Page 116/171 | < Previous Page | 112 113 114 115 116 117 118 119 120 121 122 123  | Next Page >

  • C++ online RPG game

    - by David
    So I've been learning C++ and SDL to make some basic 2d games. I want to create a game sort of like World of Warcraft but a 2D version. I want it to be online and use a database or something to start data like amount of Gold, HP, etc. I was wondering though, if I do this in SDL, would it still work online or would the user have to download SDL themselves to play? I just want a game like this but be able to play it with some friends, just for learning purposes you know. I was also looking at DirectX because everyone has that on windows pretty much. Anyways much help is appreciated, thanks!

    Read the article

  • .NET 2.0: Invoking Methods Using Reflection And Generics Causes Exception

    - by David Derringer
    Hi all, I'm new to Stack Overflow, so forgive me. I've just started transititoning over to C# and I am stuck on a problem. I am wanting to pass a generic class in and call a method from that class. So, my code looks as such: public void UpdateRecords<T>(T sender) where T : new() //where T: new() came from Resharper { Type foo = Type.GetType(sender.GetType().ToString()); object[] userParameters = new object[2]; userParameters[0] = x; userParameters[1] = y; sender = new T(); //This was to see if I could solve my exception problem MethodInfo populateRecord = foo.GetMethod("MethodInOtherClass"); populateMethod.Invoke(sender, userParameters); } Exception thrown: "Object reference not set to an instance of an object." Again, I really apologize, as I am nearly brand new to C# and this is the first time I've ever handled reflection and generics. Thank you!

    Read the article

  • How do I switch out Views in a Cocoa application?

    - by David Garcia
    So I'm beginning to learn how to use Cocoa. I think I've pretty much got it but I'm hung up on creating and switching views. I'm rewriting a game I made a little bit ago for practice. All I want is one window (preferably not resizable) and I want to be able to switch out views for different screens in the game. First, I have the main menu (Start Game, High Scores, Exit). Then I need a window for each screen (Gameplay screen, Highscore screen). What I'm getting confused with is how to design this. I looked up NSViewController thinking it manages views but it doesn't. It only manages one view by loading it really. I don't understand why I'd need to use NSViewController then. Couldn't I just have a window class that contains multiple subclasses of NSView and load them like that? I'm not sure I understand the purpose of the ViewController. Does my Window Class really need to subclass NSWindowController? I was trying to follow the example of Apple's ViewController example and it has a window controller class that's a subclass of NSWindowController. I don't see what the purpose was of subclassing that. All NSWindowController seems to add is - initWithPath:(NSString *)newPath but I fail to see the use in that either when I can just edit the plist file to open the window on start up. Apple's example also has an NSView variable and an NSViewController variable. Don't you only need one variable to store the current view? Thanks in advance guys, I'm really confused as to how this works.

    Read the article

  • How to redirect a user to a new webpage after a Javascript Alert/confrim box

    - by David Maldonado
    I have a client who wishes to have an alert/confirm box pop up when a user leaves the site, then based on what they choose, they will either stay on the page or go to a new page (would love if it would work in all browsers). I have been twiddling all day and have got this piece of code, but doesn't work too well. <script> window.onbeforeonload = function exitLeave(){var answer = confirm("You have not filled out your questionnaire yet") if (answer){ window.location = "http://www.google.com/"; } else{ alert("Cancel it !") } } </script> Any help would be greatly appreciated.

    Read the article

  • Has jQuery core development been slowing down?

    - by David Murdoch
    So, I regularly head over to jQuery's Commit History on GitHub just to read through the new code committed to jQuery core. But there hasn't been anything new committed since April 24th. I've already read through jQuery core a few times and I'm pretty familiar with it which is why I like reading the commits. I just like to see what changed, why it was changed, etc. Why has there been a slow down in jQuery commits on GitHub? Anyone else have some recommendations for where I can go to view good javascript code being developed? My motive for reading jQuery's commit history is similar to the reasons I browse through accepted answers here on stackoverflow - to learn from people smarter than me. With that said, I am interested in the answer to this questions title, but I am more interested in finding a substitute to reading the jQuery commits.

    Read the article

  • Refresh index of full text search

    - by David
    Hi, in SQL Server 2008, when setting up a full text search, it gives me an option to choose a time/day for it to re-populate the index, can I do this from code instead like C# code? if so how would I do it? Would I need to execute SQL code from C# to refresh the index? Also, say if I DONT re-populate the index and add some new records, by using the FTS query will the new records still come up? But slower? Or will they not come up at all unless i reindex?

    Read the article

  • Google Charts - Adding Tooltip to Colorized Column Chart

    - by David K
    I created a column chart with google charts that has a different color assigned to each column using the following posting: Assign different color to each bar in a google chart But now I'm trying to figure out how to customize the tooltips for each column to also include the number of users in addition to the percent, so "raw_data[i][1]" I would like it to look like "70% (80 Users)" I understand that there is "data.addColumn({type:'number',role:'tooltip'});" but I'm having trouble understanding how to implement it for this use-case. function drawAccountsChart() { var data = new google.visualization.DataTable(); var raw_data = [ ['Parents', 80, 160], ['Students', 94, 128], ['Teachers', 78, 90], ['Admins', 68, 120], ['Staff', 97, 111] ]; data.addColumn('string', 'Columns'); for (var i = 0; i < raw_data.length; ++i) { data.addColumn('number', raw_data[i][0]); } data.addRows(1); for (var i = 0; i < raw_data.length; ++i) { data.setValue(0, i+1, raw_data[i][1]/raw_data[i][2]*100); } var options = { height:220, chartArea: { left:30, width: "70%", height: "70%" }, backgroundColor: { fill:"transparent" }, tooltop:{ textStyle: {fontSize: "12px",}}, vAxis: {minValue: 0} }; var formatter = new google.visualization.NumberFormat({ suffix: '%', fractionDigits: 1 }); formatter.format(data, 1); formatter.format(data, 2); formatter.format(data, 3); formatter.format(data, 4); formatter.format(data, 5); var chart = new google.visualization.ColumnChart(document.getElementById('emailAccountsChart')); chart.draw(data, options); }

    Read the article

  • How to permanently leave a CALayer rotated at its final location?

    - by David
    Hello, I am trying to rotate a CALayer to a specific angle however, once the animation is done, the layer jumps back to its original position. How would I rotate the layer properly so that it stays at its final destination? Here is the code that I am using CABasicAnimation *rotationAnimation =[CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; //Rotate about z-axis [rotationAnimation setFromValue:[NSNumber numberWithFloat:fromDegree]]; [rotationAnimation setToValue:[NSNumber numberWithFloat:toDegree]]; [rotationAnimation setDuration:0.2]; [rotationAnimation setRemovedOnCompletion:YES]; [rotationAnimation setFillMode:kCAFillModeForwards]; Any suggestions? Thank you.

    Read the article

  • Storing a jpa entity where only the timestamp changes results in updates rather than inserts (desire

    - by David Schlenk
    I have a JPA entity that stores a fk id, a boolean and a timestamp: @Entity public class ChannelInUse implements Serializable { @Id @GeneratedValue private Long id; @ManyToOne @JoinColumn(nullable = false) private Channel channel; private boolean inUse = false; @Temporal(TemporalType.TIMESTAMP) private Date inUseAt = new Date(); ... } I want every new instance of this entity to result in a new row in the table. For whatever reason no matter what I do it always results in the row getting updated with a new timestamp value rather than creating a new row. Even tried to just use a native query to run an insert but channel's ID wasn't populated yet so I gave up on that. I've tried using an embedded id class consisting of channel.getId and inUseAt. My equals and hashcode for are: public boolean equals(Object obj){ if(this == obj) return true; if(!(obj instanceof ChannelInUse)) return false; ChannelInUse ciu = (ChannelInUse) obj; return ( (this.inUseAt == null ? ciu.inUseAt == null : this.inUseAt.equals(ciu.inUseAt)) && (this.inUse == ciu.inUse) && (this.channel == null ? ciu.channel == null : this.channel.equals(ciu.channel)) ); } /** * hashcode generated from at, channel and inUse properties. */ public int hashCode(){ int hash = 1; hash = hash * 31 + (this.inUseAt == null ? 0 : this.inUseAt.hashCode()); hash = hash * 31 + (this.channel == null ? 0 : this.channel.hashCode()); if(inUse) hash = hash * 31 + 1; else hash = hash * 31 + 0; return hash; } } I've tried using hibernate's Entity annotation with mutable=false. I'm probably just not understanding what makes an entity unique or something. Hit the google pretty hard but can't figure this one out.

    Read the article

  • What is this: main:for(...){...} doing?

    - by David Murdoch
    I pulled up the NWmatcher source code for some light morning reading and noticed this odd bit of code I'd never seen in javascript before: main:for(/*irrelevant loop stuff*/){/*...*/} This snippet can be found in the compileGroup method on line 441 (nwmatcher-1.1.1) return new Function('c,s,d,h', 'var k,e,r,n,C,N,T,X=0,x=0;main:for(k=0,r=[];e=N=c[k];k++){' + SKIP_COMMENTS + source + '}return r;' ); Now I figured out what main: is doing on my own. If you have a loop within a loop and want to skip to the next iteration of the outer loop (without completing the inner OR the outer loop) you can execute continue main. Example: // This is obviously not the optimal way to find primes... function getPrimes(max) { var primes = [2], //seed sqrt = Math.sqrt, i = 3, j, s; outer: for (; i <= max; s = sqrt(i += 2)) { j = 3; while (j <= s) { if (i % j === 0) { // if we get here j += 2 and primes.push(i) are // not executed for the current iteration of i continue outer; } j += 2; } primes.push(i); } return primes; } What is this called? Are there any browsers that don't support it? Are there other uses for it other than continue?

    Read the article

  • How do I add a fullscreen view in Cocoa touch?

    - by David
    Hello :) Inside the titleView of a UINavigationBar, there is a button. Clicking it should slide in a view from the top of the screen. Where do I have to place the view so it's displayed fullscreen and not only inside the current UIViewController's contentView? Is there a function for adding fullscreen views?

    Read the article

  • GUID or int entity key with SQL Compact/EF4?

    - by David Veeneman
    This is a follow-up to an earlier question I posted on EF4 entity keys with SQL Compact. SQL Compact doesn't allow server-generated identity keys, so I am left with creating my own keys as objects are added to the ObjectContext. My first choice would be an integer key, and the previous answer linked to a blog post that shows an extension method that uses the Max operator with a selector expression to find the next available key: public static TResult NextId<TSource, TResult>(this ObjectSet<TSource> table, Expression<Func<TSource, TResult>> selector) where TSource : class { TResult lastId = table.Any() ? table.Max(selector) : default(TResult); if (lastId is int) { lastId = (TResult)(object)(((int)(object)lastId) + 1); } return lastId; } Here's my take on the extension method: It will work fine if the ObjectContext that I am working with has an unfiltered entity set. In that case, the ObjectContext will contain all rows from the data table, and I will get an accurate result. But if the entity set is the result of a query filter, the method will return the last entity key in the filtered entity set, which will not necessarily be the last key in the data table. So I think the extension method won't really work. At this point, the obvious solution seems to be to simply use a GUID as the entity key. That way, I only need to call Guid.NewGuid() method to set the ID property before I add a new entity to my ObjectContext. Here is my question: Is there a simple way of getting the last primary key in the data store from EF4 (without having to create a second ObjectContext for that purpose)? Any other reason not to take the easy way out and simply use a GUID? Thanks for your help.

    Read the article

  • Create event for another owner using Facebook Graph API

    - by David
    Hi, I'm at the moment working on a web page where the users who visit it should have the possibility to create an event in my web page's name. There is a Page on Facebook for the web page which should be the owner of the user created event. Is this possible? All users are authenticated using Facebook Connect, but since the event won't be created in their name I don't know if that's so much of help. The Python SDK will be used since the event shall be implemented server side. / D

    Read the article

  • PHP / javascript live chat using too much bandwidth

    - by David
    So I am learning about javascript, so I am making a live chat system with PHP and javascript. I have it so the javascript refreshes the log (each message gets logged in a file on the server), and it refreshes every second. Im using firebug to monitor the resource usage, and I see under the net tab each times its updated, and the bytes add up really fast. I know I can change it to update less, but is there a way that when a user on the other end I'm talking to, when the send a message, it gets sent to the server, then an alert gets sent to me saying that the chatlog needs to update somehow. That way it only updates when the log is updated. let me know, thanks

    Read the article

  • [Symfony] Admin generator and i18n

    - by David
    I have read lots of questions about i18n, but I haven't found any about performance. I have a simple backend app listing the contents of an ads table. These ads have a category, that is translated in some languages (it's defined as i18n in the Doctrine schema). So, when I add a "table_method" in my generator.yml to include de Category table, it reduces the number of queries, but there are yet some of them referencing i18n translation tables. So, if I add the category Translation table to the query, it reduces even more the queries BUT it increases the processing time considerably. Why this time penalty? Just because of the translation table? And why isn't the filter using this method to avoid so many translation queries as well? I mean, if I want to filter by category, it is making one query per category to include the translation table. Why??

    Read the article

  • parsing/matching string occurrence in C

    - by David
    I have the following string: const char *str = "\"This is just some random text\" 130 28194 \"Some other string\" \"String 3\"" I would like to get the the integer 28194 of course the integer varies, so I can't do strstr("20194"). So I was wondering what would be a good way to get that part of the string? I was thinking to use #include <regex.h> which I already have a procedure to match regexp's but not sure how the regexp in C will look like using the POSIX style notation. [:alpha:]+[:digit:] and if performance will be an issue. Or will it be better using strchr,strstr? Any ideas will be appreciate it

    Read the article

  • database row/ record pointers

    - by David
    Hi I don't know the correct words for what I'm trying to find out about and as such having a hard time googling. I want to know whether its possible with databases (technology independent but would be interested to hear whether its possible with Oracle, MySQL and Postgres) to point to specific rows instead of executing my query again. So I might initially execute a query find some rows of interest and then wish to avoid searching for them again by having a list of pointers or some other metadata which indicates the location on a database which I can go to straight away the next time I want those results. I realise there is caching on databases, but I want to keep these "pointers" else where and as such caching doesn't ultimately solve this problem. Is this just an index and I store the index and look up by this? most of my current tables don't have indexes and I don't want the speed decrease that sometimes comes with indexes. So whats the magic term I've been trying to put into google? Cheers

    Read the article

  • Visual C++ 2008 doesn't recognize Windows declared types

    - by David Thornley
    I have a program that doesn't seem to recognize declared types in the latest U3D software. There's a line typedef BOOL (WINAPI* GMI)(HMON, LPMONITORINFOEX); which gets the error: Error 1 error C2061: syntax error : identifier 'LPMONITORINFOEX' c:\Projects\U3D\Source\RTL\Platform\Common\Win32\IFXOSRender.cpp 28 and a line MONITORINFOEX miMon; which gets Error 5 error C2065: 'miMon' : undeclared identifier c:\Projects\U3D\Source\RTL\Platform\Common\Win32\IFXOSRender.cpp 49 Error 3 error C2065: 'MONITORINFOEX' : undeclared identifier c:\Projects\U3D\Source\RTL\Platform\Common\Win32\IFXOSRender.cpp 49 The program's first non-comment statement is #include <windows.h>, which includes winuser.h, which defines these identifiers. In Visual Studio, I can right-click on them and go to the definition (a typedef) and from the typedef to the struct. WINAPI is defined in WinDef.h, so that seems to be working. There are no redefinitions of LPMONITORINFOEX or MONITORINFOEX in any other file. So, how can this be happening, and what can I do about it?

    Read the article

< Previous Page | 112 113 114 115 116 117 118 119 120 121 122 123  | Next Page >