Daily Archives

Articles indexed Sunday November 4 2012

Page 9/13 | < Previous Page | 5 6 7 8 9 10 11 12 13  | Next Page >

  • Migration from XNA to SharpDX

    - by Wouter
    My fear is that XNA has reached the end of the road. To keep up with the latest technology a shift to another game framework might be needed. We have many games in a large codebase, all based on XNA. My question is, how much work would it be to migrate to SharpDX and are there other possibilities? Our code base mainly uses basic 3D rendering and the SpriteBatch, no fancy shader stuff. Update: I should have mentioned we only use 2.5D, we have a simple engine that builds textured quads to render text and animated sprites. Also for sound we use XACT (what else..) with some effects.

    Read the article

  • Farseer Physics Engine and the Ms-PL License

    - by Stephen Tierney
    Am I able to produce code for a game which uses the Farseer engine and release my code under an open source license other than the Ms-PL? My concern is with the following section from the license: If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license. If I do not include Farseer in my source code distribution does this give me an exemption from this clause as I am not distributing the software? My code merely uses its functions. No where in the license does it force you to provide source code for derivative works or linking works, it simply gives you the option of "if you distribute".

    Read the article

  • 2D pathfinding - finding smooth paths

    - by Kooi Nam Ng
    I was trying to implement a simple pathfinding, but the outcome is less satisfactory than what I intended to achieve. The thing is units in games like Starcraft 2 move in all directions whereas units in my case only move in at most 8 directions (Warcraft 1 style) as these 8 directions direct to next available nodes (they move from a tile to next neighboring tile). What should I do in order to achieve the result as in Starcraft 2? Shrink the tile size? On the picture you can see a horizontal line of rock tiles being obstacles, and the found path marked as green tiles. The red line is the path I want to achieve.

    Read the article

  • Good 2D Platformer Physics

    - by Joe Wreschnig
    I have a basic character controller set up for a 2D platformer with Box2D, and I'm starting to tweak it to try to make it feel good. Physics engines have a lot of knobs to tweak, and it's not clear to me, writing with a physics engine for the first time, which ones I should use. Should jumping apply a force for several ticks? An impulse? Directly set velocity? How do I stop the avatar from sticking to walls without taking away all its friction (or do I take away all the friction, but only in the air)? Should I model the character as a capsule? A box with rounded corners? A box with two wheels? Just one big wheel? I feel like someone must have done this before! There seem to be very few resources available on the web that are not "baby's first physics", which all cut off where I'm hoping someone has already solved the issues. Most examples of physics engines for platformers have floaty-feeling controls, or in-air jumps, or easily exploitable behavior when temporary penetration is too high, etc. Some examples of what I mean: A short tap of jump jumps a short distance; a long tap jumps higher. Short skidding when stopping or reversing directions at high velocity. Standing stably on inclines (but maybe sliding down them when ducking). Analog speed when using an analog controller. All the other things that separate good platformers from bad platformers. Dare I suggest, stable moving platforms? I'm not really looking for "hey, do this." Obviously, the right thing to do is dependent on what I want in the game. But I'm hoping someone somewhere has gone through the possibilities and said "well technique A does feature X well, technique B does Y well, but that doesn't work with C", or has some worked examples beyond "if (key == space) character.impulse(0, 1)"

    Read the article

  • "Instance variable 'xxx' accessed in class method....why?

    - by Michael Levy
    So please forgive me as I am very new to stackoverflow and to ios programming in general. I am attempting to change the text of a button i have, replacing current text with a date string (dateStringForInput) I am passing in from another class. The button is called myTodayButton and is declared in my .h file for my class inputMilesViewController... @property (strong, nonatomic) IBOutlet UIButton *myTodayButton; Below is the code from my .m. +(void) changeButtonText:(NSString*) dateStringForInput{ NSLog(@"we got to changebuttontext"); [_myTodayButton setTitle:dateStringForInput forState:UIControlStateNormal]; } I am getting the following error "Instance variable "_myTodayButton" accessed in class method. I understand that this is written in a class method rather than an instance method but i cant figure out how to get this change to happen. the button which prompts this call to changeButtonText is in the other class which is creating dateStringForInput. please help! thanks so much! be gentle with me....a bit overwhelmed . :-)

    Read the article

  • two line label with expression

    - by metasequoia
    I'd like to write an axis label over two lines with an expression() statement. However, plotmath and expression won't allow this (e.g. subscript appear on the far right). I found this discussion circa 2005 of a similar issue but the work around that they offer doesn't translate to my application in ggplot2. A recent question addressed a a different permutation of multi-line expression statements, but again the work around provided doesn't apply here. Example: p <- ggplot(mtcars,aes(x=wt,y=mpg))+ geom_point()+ xlab(expression(paste("A long string of text goes here just for the purpose \n of illustrating my point Weight "[reported]))) try(ggsave(plot=p,filename=<some file>,height=4,width=6)) yields an image where subscript "reported" is kicked out to the right when I'd like it to sit next to the previous word.

    Read the article

  • Dart js.interop callbacks

    - by basheps
    How can I translate the following jquery code to Dart? I'm having difficulty getting the alert callback to work using js.interop. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script> $(function () { $('p').hide('slow', function() { alert("The paragraph is now hidden"); }); }); </script> Any help is appreciated.

    Read the article

  • Remove all user's cookies/sessions when password is reset

    - by Juraj
    I'm interested in improving security of my TurboGears 2.2 application so that when user changes his password, it logs him out from all sessions and he must login again. When user changes password on browser 1, he must relogin on browser 2, too. Experiments show that this is not the case, especially if browser 2 had "remember me" enabled. It's standard quickstarted app using repoze.who. It seems maybe I need to change AuthTktCookiePlugin, but don't see a way to do it without much rewiring.

    Read the article

  • sencha dataitem datamap setItems

    - by user1795667
    I'm trying to follow the kitten example given here http://www.sencha.com/blog/dive-into-dataview-with-sencha-touch-2-beta-2#comment_form and I have complex components in which one of the property of my data is a list of objects. And I do find a method for setting a list of objects which is setItems however it does not seem to work. My object array is my model MyApp.Model.Sponsor. Could anyone suggest what I'm missing to get this working? Ext.define('MyListItem', { extend: 'Ext.dataview.component.DataItem', requires: ['Ext.Button','Ext.Img', 'MyApp.model.Sponsors', 'MyApp.model.Sponsor'], xtype: 'mylistitem', config: { sponsor: true, dataMap: { getSponsor: { setItems: 'sponsor' } } }, applySponsor: function(config) { // I put an alert here to see if I get getSponsor() but the object I get here is undefined alert(this.getSponsor()); return Ext.factory(config, MyApp.model.Sponsor, this.getSponsor()); }, updateSponsor: function(newNameButton, oldNameButton) { if (oldNameButton) { this.remove(oldNameButton); } if (newNameButton) { this.add(newNameButton); } }, onSponsorTap: function(button, e) { var sponsors = record.get('sponsor'); //my specific action } }); Ext.define('MyApp.model.Sponsors', { extend: 'Ext.data.Model', xtype:'Sponsors_m', config: { fields: [ {name: 'level', type: 'auto'}, {name: 'id', type: 'int'}, {name: 'sponsor', type: 'Sponsor'} ] } }); Ext.define('MyApp.model.Sponsor', { extend: 'Ext.data.Model', xtype:'Sponsor_m', config: { fields: [ {name: 'name', type: 'auto'}, {name: 'image', type: 'auto'}, {name: 'url', type: 'auto'}, {name: 'description', type: 'auto'} ] } });

    Read the article

  • C++, array declaration, templates, linker error

    - by justik
    There is a linker error in my SW. I am using the following structure based on h, hpp, cpp files. Some classes are templatized, some not, some have function templates. Declaration: test.h #ifndef TEST_H #define TEST_H class Test { public: template <typename T> void foo1(); void foo2 () }; #include "test.hpp" #endif Definition: test.hpp #ifndef TEST_HPP #define TEST_HPP template <typename T> void Test::foo1() {} inline void Test::foo2() {} //or in cpp file #endif CPP file: test.cpp #include "test.h" void Test::foo2() {} //or in hpp file as inline I have the following problem. The variable vars[] is declared in my h file test.h #ifndef TEST_H #define TEST_H char *vars[] = { "first", "second"...}; class Test { public: void foo(); }; #include "test.hpp" #endif and used as a local variable inside foo() method defined in hpp file as inline. test.hpp #ifndef TEST_HPP #define TEST_HPP inline void Test::foo() { char *var = vars[0]; //A Linker Error } #endif However, the following linker error occurs: Error 745 error LNK2005: "char * * vars" (?vars@@3PAPADA) already defined in test2.obj How and where to declare vars[] to avoid linker errors? After including #include "test.hpp" it is late to declare it...

    Read the article

  • XML parsing error: 'A string literal was expected' when inserting values into table

    - by Christian
    In Microsoft Sequel Server 2008 I am attempting to insert values into an sql table with the columns type_id of datatype int and xml_info of datatype XML. I am using the following query: INSERT INTO tbl_applied_devices ([type_id],[xml_info]) VALUES (1,'<Profile ID=99><Server><ID>BC4A18CA-AFB5-4268-BDA9-C990DAFE7783</ID> <Name>localhost</Name><Services></Services></Server></Profile>') But I keep getting this error: Msg 9413, Level 16, State 1, Line 4 XML parsing: line 1, character 13, A string literal was expected What am I doing incorrectly? Thank you for the help. EDIT: I found that the source of the error is the xml element's ID attribute, where seems to be what is causing the error. How can I correctly insert xml with an attribute ? Do I need to somehow escape one of the characters?

    Read the article

  • Doing a POST with cURL but server shows GET

    - by user1798818
    I am trying to do a simple POST. I am using the code below but when I look at the server log it shows it is doing a POST instead of a GET. Any idea why? Code below. THanks, Mark $url = 'http://www.mydomain.com/api.php'; $ch = curl_init(); $data = array('name' => 'Foo', 'file' => '@path\file.jpg'); $headers = array( 'Content-Type: image/jpeg' ); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, '3'); curl_setopt($ch, CURLOPT_HEADER ,1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); $result = curl_exec( $ch );

    Read the article

  • position of options in HTML select element

    - by frenchie
    I have a element that contains options. The element is 150px wide but some of the options are wider. So when rendering, the browser shows the overflow to the right. How can I make the options list overflow to the left? JSFiddle Thanks. <select id="MySelect"> <option value="60" selected="selected"></option><option value="-60">(UTC-01:00) Azores</option> <option value="-60">(UTC-01:00) Cape Verde Is.</option><option value="0">(UTC) Casablanca</option> <option value="0">(UTC) Dublin, Edinburgh, Lisbon, London</option><option value="0">(UTC) Monrovia, Reykjavik</option> <option value="60">(UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague</option> <option value="60">(UTC+01:00) Brussels, Copenhagen, Madrid, Paris</option> <option value="60">(UTC+01:00) Sarajevo, Skopje, Warsaw, Zagreb</option> <option value="60">(UTC+01:00) West Central Africa</option> <option value="120">(UTC+01:00) Windhoek</option> </select>?????????????????????????????????????????????? ?#MySelect{ margin-top:20px; margin-left:200px; width:150px;}

    Read the article

  • how to read a file in other directory in python

    - by mazen.r.f
    i have a file its name is 5_1.txt in a directory i named it direct , how can i read that file using the instruction read. i verified the path using : os.getcwd() os.path.exists(direct) the result was True x_file=open(direct,'r') and i got this error : Traceback (most recent call last): File "<pyshell#17>", line 1, in <module> x_file=open(direct,'r') IOError: [Errno 13] Permission denied i don't know why i can't read the file ? any suggestion ? thanks .

    Read the article

  • Scanner error that I can't figure out: NoSuchElementException

    - by iaacp
    It's crashing on the third line inside the do-while loop, and doesn't wait for my input: input = kb.nextInt(); Stack trace: Exception in thread "main" java.util.NoSuchElementException at java.util.Scanner.throwFor(Unknown Source) at java.util.Scanner.next(Unknown Source) at java.util.Scanner.nextInt(Unknown Source) at java.util.Scanner.nextInt(Unknown Source) at main.MainDriver.main(MainDriver.java:50) Relevant code: do { displayFullMenu(); System.out.print("Selection: "); input = kb.nextInt(); switch (input) { //Create new survey case 1: currentSurvey = new Survey(); break; //Display current survey case 2: currentSurvey.display(); break; //Save current survey case 3: saveSurvey(currentSurvey); break; //Load a survey case 4: currentSurvey = loadSurvey(); break; //Modify a survey case 5: currentSurvey.modify(); break; /*******************Test Functions*******************/ //Create new test case 6: currentSurvey = new Test(); break; //Display current test case 7: currentSurvey.display(); break; //Save current test case 8: saveSurvey(currentSurvey); break; //Load a test case 9: currentSurvey = loadTest(); break; //Modify a test case 10: currentSurvey.modify(); default: System.out.println("Invalid choice. Please make a valid choice: "); input = kb.nextInt(); System.out.println(); } } while (input != 99); kb.close(); It crashes after I choose option 9. It saves the file correctly, then goes back to the top of the loop, and crashes at the previously mentioned line. I want it to ask for more input. What gives?

    Read the article

  • C# program for finding how many numbers are devidable by 5 in give range

    - by user1639735
    My task is: Write a program that reads two positive integer numbers and prints how many numbers p exist between them such that the reminder of the division by 5 is 0 (inclusive). Example: p(17,25) = 2. Console.Write("Enter min: "); int min = int.Parse(Console.ReadLine()); Console.Write("Enter max: "); int max = int.Parse(Console.ReadLine()); Console.WriteLine("The numbers devidable by 5 without remainder from {0} to {1} are: ",min,max); for (int i = min; i <= max; i++) { if (i % 5 == 0) { Console.WriteLine(i); } } This prints out the numbers that are devidable by 5 in the range...How do I count how many are there and print the count in the console? Thanks.

    Read the article

  • Extraction Event

    - by Anicho
    So I have the following code: public override void Extract(object sender, ExtractionEventArgs e) { if (e.Response.HtmlDocument != null) { var myParam = e.Request.QueryStringParameters.Where(parameter => parameter.Name == QueryName).Select(parameter => parameter.Value).Distinct(); myParam. // add the extracted value to the web performance test context e.WebTest.Context.Add(this.ContextParameterName, myParam.ToString()); e.Success = true; return; } // If the extraction fails, set the error text that the user sees e.Success = false; e.Message = String.Format(CultureInfo.CurrentCulture, "Not Found: {0}", QueryName); } It's returning: System.Linq.Enumerable+<DistinctItem>d_81`1[system.string] I am expecting something along the lines of: 0152-1231-1231-123d My question is how do I extract the querystring's actual value from extractioneventargs. They say it's possible, but I have no idea.

    Read the article

  • Android lifecycle of thread-based game

    - by ehehhh
    I ran into a bit of trouble while trying to get my game to work correctly after being put to the background by the user or a phone call for example. My app has a SurfaceView class called GameView, which has the onDraw() method to do all the necessary drawing for my game and two threads - one for calling the onDraw() and one for doing the necessary calculations for the game's logic. I succesfully implemented onPause() and onResume(). (I paused both threads when back button was pressed and resumed them after user cancelled in the AlertDialog.) Now I would like to have the game paused the same way when onStop() gets called. I put both threads on pause and saved my characters location in the savedInstanceState, but when I start my app again, no method gets called (I checked with Logcat). I believe onRestart() should be called first, then onStart() and then onResume(), but none of that happens. What am I doing wrong? (Didn't include any code, because it seems to be a problem of me not understanding the lifecycle, not a problem in code. If it seems necessary, I'll post the parts you request.)

    Read the article

  • cycle through spans on jquery click, removing the first-child

    - by jacob
    Basically, this advances to the next hidden span when clicked. The markup: <div id="facts"> <span>click to cycle</span> <span>fact 1</span> <span>fact 2</span> <span>fact 3</span> <span>fact 4</span> </div> The js: $(document).ready(function() { var current = 1; $('#facts span').click(function() { // Hide all of them $('#facts span').hide(); // Unhide the current one: $('#facts span:eq(' + (current % $('#facts span').length) + ')').show(); // Increment the variable console.log(current % 4); current++; }); // Unhide the first one on load $('#facts span:first-child').show(); });? What I'm trying to do now is remove the first span after it's been clicked, because it is not necessary for the user to see the 'click to cycle' instruction again.

    Read the article

  • Android spinner inside a custom control - OnItemSelectedListener does not trigger

    - by Idan
    I am writing a custom control that extends LinearLayout. Inside that control I am using a spinner to let the user select an item from a list. The problem I have is that the OnItemSelectedListener event does not fire. When moving the same code to an Activity/Fragment all is working just fine. I have followed some answers that was given to others asking about the same issue, and nothing helped. still the event does not fire. This is my code after I followed the answers that suggested to put the spinner inside my layout XML instead of by code. I am getting the same result when I try to just "new Spinner(ctx)"... layout XML: <Spinner android:id="@+id/accSpinner" android:layout_width="0dip" android:layout_height="0dip" /> Initialization function of the control (called on the control constructor): private void init() { LayoutInflater layoutInflater = LayoutInflater.from(mContext); mAccountBoxView = layoutInflater.inflate(R.layout.control_accountselector, null); mTxtAccount = (TextView)mAccountBoxView.findViewById(R.id.txtAccount); mSpinner = (Spinner)mAccountBoxView.findViewById(R.id.accSpinner); mAccountBoxView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mSpinner.performClick(); } }); setSpinner(); addView(mAccountBoxView); } private void setSpinner() { ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(mContext, android.R.layout.simple_spinner_item, mItems); dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mSpinner.setAdapter(dataAdapter); mSpinner.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { String selectedItem = mItems.get(position); handleSelectedItem(selectedItem); } @Override public void onNothingSelected(AdapterView<?> parent) { } }); } The spinner raises just fine when i touch my control and the list of items is there as it should. When I click an item the spinner closes but I am never getting to onItemSelected nor onNothingSelected.. Any ideas?

    Read the article

  • How to provide a date variable an interval that consists of an integer variable in Postgresql

    - by Lucius Rutilius Lupus
    I am trying to extract an amount of years from a specific date for this the correct syntax is <date> - interval '5 years'; But I dont want to extract a specific amount of years but a variable, which user will provide as a parameter. I have tried the following the variable name is years : date+interval '% years',years; I am getting an error and it doesn't let me do it that way. What would be the right way to do it.

    Read the article

  • Facebook not recoginising open graph tags

    - by Pratik Poddar
    My object page looks like: <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US" xmlns:fb="https://www.facebook.com/2008/fbml"> <head prefix="og: http://ogp.me/ns# cliprin: http://ogp.me/ns/apps/cliprin#"> <meta property="fb:app_id" content="143944345745133" /> <meta property="og:type" content="cliprin:product" /> <meta property="og:url" content="https://itsourstudio.com/" /> <meta property="og:title" content="LED Ice Cubes (Set Of 4)" /> <meta property="og:sitename" content="Its Our Studio" /> <meta property="og:image" content="https://s-static.ak.fbcdn.net/images/devsite/attachment_blank.png" /> <meta property="og:description" content="Blah Blah Blah" /> </head> </html> The JSLink Debugger of the page as shown by the link shows that of:type is website and gives following warnings: Open Graph Warnings That Should Be Fixed Inferred Property: The 'og:url' property should be explicitly provided, even if a value can be inferred from other tags. Inferred Property: The 'og:title' property should be explicitly provided, even if a value can be inferred from other tags. Inferred Property: The 'og:description' property should be explicitly provided, even if a value can be inferred from other tags. Inferred Property: The 'og:image' property should be explicitly provided, even if a value can be inferred from other tags. Tiny og:image: All the images referenced by og:image must be at least 200px in both dimensions. Please check all the images with tag og:image in the given url and ensure that it meets the minimum specification.

    Read the article

  • Create a model that switches between two different states using Temporal Logic?

    - by NLed
    Im trying to design a model that can manage different requests for different water sources. Platform : MAC OSX, using latest Python with TuLip module installed. For example, Definitions : Two water sources : w1 and w2 3 different requests : r1,r2,and r3 - Specifications : Water 1 (w1) is preferred, but w2 will be used if w1 unavailable. Water 2 is only used if w1 is depleted. r1 has the maximum priority. If all entities request simultaneously, r1's supply must not fall below 50%. - The water sources are not discrete but rather continuous, this will increase the difficulty of creating the model. I can do a crude discretization for the water levels but I prefer finding a model for the continuous state first. So how do I start doing that ? Some of my thoughts : Create a matrix W where w1,w2 ? W Create a matrix R where r1,r2,r3 ? R or leave all variables singular without putting them in a matrix I'm not an expert in coding so that's why I need help. Not sure what is the best way to start tackling this problem. I am only interested in the model, or a code sample of how can this be put together. edit Now imagine I do a crude discretization of the water sources to have w1=[0...4] and w2=[0...4] for 0, 25, 50, 75,100 percent respectively. == means implies Usage of water sources : if w1[0]==w2[4] -- meaning if water source 1 has 0%, then use 100% of water source 2 etc if w1[1]==w2[3] if w1[2]==w2[2] if w1[3]==w2[1] if w1[4]==w2[0] r1=r2=r3=[0,1] -- 0 means request OFF and 1 means request ON Now what model can be designed that will give each request 100% water depending on the values of w1 and w2 (w1 and w2 values are uncontrollable so cannot define specific value, but 0...4 is used for simplicity )

    Read the article

  • How can I cover up a <div>'s border with another <div>?

    - by Leftium
    I am trying to move GCLI's input from the bottom of the page to the top. However, I can't get it to look quite right. Why can't I get the .gcli-panel-connector <div> to cover up the .gcli-tt <div>'s border? I think it has something to do with the z-index. Please compare these two live demos: Original code where the input is at the bottom and the border is properly covered Altered code where the input is at the top, but the border is not covered as desired

    Read the article

  • Trouble with go tour crawler exercise

    - by David Mason
    I'm going through the go tour and I feel like I have a pretty good understanding of the language except for concurrency. On slide 71 there is an exercise that asks the reader to parallelize a web crawler (and to make it not cover repeats but I haven't gotten there yet.) Here is what I have so far: func Crawl(url string, depth int, fetcher Fetcher, ch chan string) { if depth <= 0 { return } body, urls, err := fetcher.Fetch(url) if err != nil { ch <- fmt.Sprintln(err) return } ch <- fmt.Sprintf("found: %s %q\n", url, body) for _, u := range urls { go Crawl(u, depth-1, fetcher, ch) } } func main() { ch := make(chan string, 100) go Crawl("http://golang.org/", 4, fetcher, ch) for i := range ch { fmt.Println(i) } } The issue I have is where to put the close(ch) call. If I put a defer close(ch) somewhere in the Crawl method, then I end up writing to a closed channel in one of the spawned goroutines, since the method will finish execution before the spawned goroutines do. If I omit the call to close(ch), as is shown in my example code, the program deadlocks after all the goroutines finish executing but the main thread is still waiting on the channel in the for loop since the channel was never closed.

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13  | Next Page >