Search Results

Search found 370 results on 15 pages for 'merlyn morgan graham'.

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

  • Making my XNA sprite jump properly

    - by Matthew Morgan
    I have been having great trouble getting my sprite to jump. So far I have a section of code which with a single tap of "W" will send the sprite in a constant velocity upwards. I need to be able to make my sprite come back down to the ground a certain time or height after begining the jump. There is also a constant pull of velocity 2 on the sprite to simulate some kind of gravity. // Walking = true when there is collision detected between the sprite and ground if (Walking == true) if (keystate.IsKeyDown(Keys.W)) { Jumping = true; } if (Jumping == true) { spritePosition.Y -= 10; } Any ideas and help would be appreciated but I'd prefer a modified version of my code posted if at all possible.

    Read the article

  • Why does Keychain Services return the wrong keychain content?

    - by Graham Lee
    I've been trying to use persistent keychain references in an iPhone application. I found that if I created two different keychain items, I would get a different persistent reference each time (they look like 'genp.......1', 'genp.......2', …). However, attempts to look up the items by persistent reference always returned the content of the first item. Why should this be? I confirmed that my keychain-saving code was definitely creating new items in each case (rather than updating existing items), and was not getting any errors. And as I say, Keychain Services is giving a different persistent reference for each item. I've managed to solve my immediate problem by searching for keychain items by attribute rather than persistent references, but it would be easier to use persistent references so I'd appreciate solving this problem. Here's my code: - (NSString *)keychainItemWithName: (NSString *)name { NSString *path = [GLApplicationSupportFolder() stringByAppendingPathComponent: name]; NSData *persistentRef = [NSData dataWithContentsOfFile: path]; if (!persistentRef) { NSLog(@"no persistent reference for name: %@", name); return nil; } NSArray *refs = [NSArray arrayWithObject: persistentRef]; //get the data CFMutableDictionaryRef params = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); CFDictionaryAddValue(params, kSecMatchItemList, refs); CFDictionaryAddValue(params, kSecClass, kSecClassGenericPassword); CFDictionaryAddValue(params, kSecReturnData, kCFBooleanTrue); CFDataRef item = NULL; OSStatus result = SecItemCopyMatching(params, (CFTypeRef *)&item); CFRelease(params); if (result != errSecSuccess) { NSLog(@"error %d retrieving keychain reference for name: %@", result, name); return nil; } NSString *token = [[NSString alloc] initWithData: (NSData *)item encoding: NSUTF8StringEncoding]; CFRelease(item); return [token autorelease]; } - (void)setKeychainItem: (NSString *)newToken forName: (NSString *)name { NSData *tokenData = [newToken dataUsingEncoding: NSUTF8StringEncoding]; //firstly, find out whether the item already exists NSDictionary *searchAttributes = [NSDictionary dictionaryWithObjectsAndKeys: name, kSecAttrAccount, kCFBooleanTrue, kSecReturnAttributes, nil]; NSDictionary *foundAttrs = nil; OSStatus searchResult = SecItemCopyMatching((CFDictionaryRef)searchAttributes, (CFTypeRef *)&foundAttrs); if (noErr == searchResult) { NSMutableDictionary *toStore = [foundAttrs mutableCopy]; [toStore setObject: tokenData forKey: (id)kSecValueData]; OSStatus result = SecItemUpdate((CFDictionaryRef)foundAttrs, (CFDictionaryRef)toStore); if (result != errSecSuccess) { NSLog(@"error %d updating keychain", result); } [toStore release]; return; } //need to create the item. CFMutableDictionaryRef params = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); CFDictionaryAddValue(params, kSecClass, kSecClassGenericPassword); CFDictionaryAddValue(params, kSecAttrAccount, name); CFDictionaryAddValue(params, kSecReturnPersistentRef, kCFBooleanTrue); CFDictionaryAddValue(params, kSecValueData, tokenData); NSData *persistentRef = nil; OSStatus result = SecItemAdd(params, (CFTypeRef *)&persistentRef); CFRelease(params); if (result != errSecSuccess) { NSLog(@"error %d from keychain services", result); return; } NSString *path = [GLApplicationSupportFolder() stringByAppendingPathComponent: name]; [persistentRef writeToFile: path atomically: NO]; [persistentRef release]; }

    Read the article

  • scala currying by nested functions or by multiple parameter lists

    - by Morgan Creighton
    In Scala, I can define a function with two parameter lists. def myAdd(x :Int)(y :Int) = x + y This makes it easy to define a partially applied function. val plusFive = myAdd(5) _ But, I can accomplish something similar by defining and returning a nested function. def myOtherAdd(x :Int) = { def f(y :Int) = x + y f _ } Cosmetically, I've moved the underscore, but this still feels like currying. val otherPlusFive = myOtherAdd(5) What criteria should I use to prefer one approach over the other?

    Read the article

  • How to troubleshoot PHP session file empty issue?

    - by Morgan Cheng
    I have a very simple test page for PHP session. <?php session_start(); if (isset($_SESSIONS['views'])) { $_SESSIONS['views'] = $_SESSIONS['pv'] + 1; } else { $_SESSIONS['views'] = 0; } var_dump($_SESSIONS); ?> After refreshing the page, it always show array 'views' => int 0 The environment is XAMPP 1.7.3. I checked phpInfo(). The session is enabled. Session Support enabled Registered save handlers files user sqlite Registered serializer handlers php php_binary wddx Directive Local Value Master Value session.auto_start Off Off session.bug_compat_42 On On When the page is accessed, there is session file sess_lnrk7ttpai8187v9q6iok74p20 created in my "D:\xampp\tmp" folder. But the content is empty. With Firebug, I can see cookies about the session. Cookie PHPSESSID=lnrk7ttpai8187v9q6iok74p20 It seems session data is not flushed to files. Is there any way or direction to trouble shoot this issue? Thanks.

    Read the article

  • Are Hibernate named HQL queries (in annotations) optimised?

    - by Graham Lea
    A new colleague has just suggested using named HQL queries in Hibernate with annotations (i.e. @NamedQuery) instead of embedding HQL in our XxxxRepository classes. What I'd like to know is whether using the annotation provides any advantage except for centralising quueries? In particular, is there some performances gain, for instance because the query is only parsed once when the class is loaded rather than every time the Repository method is executed?

    Read the article

  • Matlab - Propagate points orthogonally on to the edge of shape boundaries

    - by Graham
    Hi I have a set of points which I want to propagate on to the edge of shape boundary defined by a binary image. The shape boundary is defined by a 1px wide white edge. I also have the coordinates of these points stored in a 2 row by n column matrix. The shape forms a concave boundary with no holes within itself made of around 2500 points. I want to cast a ray from each point from the set of points in an orthogonal direction and detect at which point it intersects the shape boundary at. What would be the best method to do this? Are there some sort of ray tracing algorithms that could be used? Or would it be a case of taking orthogonal unit vector and multiplying it by a scalar and testing after multiplication if the end point of the vector is outside the shape boundary. When the end point of the unit vector is outside the shape, just find the point of intersection? Thank you very much in advance for any help!

    Read the article

  • Where's all the XPCOM user documentation?

    - by Graham Paulson
    Google can't find much user documentation for XPCOM. Sure, it can find endless references to making new XPCOM components in C++, but that's utterly useless to anyone who needs to know how to use the existing components from JavaScript. This is a huge gap, occasionally touched on by trivial examples of creating an instance and calling a method. Has nobody with a more in-depth knowledge of the componentry written anything about its use? Using components with multiple interfaces? Implementing listeners for handling asynchronous behaviour? "Rapid Application Development with Mozilla" is no help (great breadth but little depth). Spotty references that exist to the defunct XULPlanet redirect to Mozilla Development Center, but that's pretty useless. Mozilla Development Center articles point back to XULPlanet, which is a joke. Is this the best an army of open source advocates can muster to promote the extension of The Beast?

    Read the article

  • dotnetopenauth pending request lost

    - by Graham
    I have dotnetopenauth working fine as a provider except when a user clicks the submit button multible times. Then the following error occurs: Throw New InvalidOperationException("There's no pending authentication request!") What is the best way to prevent this happening?

    Read the article

  • LNK2001: What have I forgotton to set?

    - by graham.reeds
    Following on from my previous question regarding debugging of native code, I decided to create a simple test from a console app as I wasn't getting anywhere with debugging the service directly. So I created a vc6 console app, added the dll project to the workspace and ran it. Instead of executing as expected it spat out the following linker errors: main.obj : error LNK2001: unresolved external symbol "int __stdcall hmDocumentLAdd(char *,char *,long,char *,char *,long,long,long,long *)" (?hmDocumentLAdd@@YGHPAD0J00JJJPAJ@Z) main.obj : error LNK2001: unresolved external symbol "int __stdcall hmGetDocBasePath(char *,long)" (?hmGetDocBasePath@@YGHPADJ@Z) Debug/HazManTest.exe : fatal error LNK1120: 2 unresolved externals This seems to be a simple case of forgetting something in the linker options: However everything seems to be normal, and the lib file, dll and source is available. If I change the lib file to load to nonsense it kicks up the fatal error LNK1104: cannot open file "asdf.lib", so that isn't a problem. I have previously linked to dll and they have just worked, so what I have forgotton to do?

    Read the article

  • module "random" not found when building .exe from IronPython 2.6 script

    - by Graham
    I am using SharpDevelop to build an executable from my IronPython script. The only hitch is that my script has the line import random which works fine when I run the script through ipy.exe, but when I attempt to build and run an exe from the script in SharpDevelop, I always get the message: IronPython.Runtime.Exceptions.ImportException: No module named random Why isn't SharpDevelop 'seeing' random? How can I make it see it?

    Read the article

  • Setting ModerationInformation.Status from Approved back to pending removes

    - by Gavin Morgan
    Seeing if anyone else has had this problem and a resolution to it. I have a visual studio sequential workflow on a list (not a library) which does NOT use tasks, the approval process is done through the Approve/Reject OOTB buttons on the list item. The approval is a 2 stage approval, whereby if the 1st stage is completed (via clicking the Approve OOTB button), i reset the ModerationInformation.Status from Approved back to pending then send an email to the 2nd stage approver. My problem is, when i set the the ModerationInformation.Status back to Pending from Approved so there is never an approved version, the Creator loses permissions to view the item, and i get the "cannot find item" error from SharePoint for the person who created the item. The 1st and 2nd level approvers and anyone with approve rights CAN still see the item. Some more background information. the code i am using to update the moderationinformation is I get the properties from the workflow event and get a hook into the listitem properties.Item.ModerationInformation.Status = SPModerationStatusType.Pending; properties.Item.Update(); can anyone help.

    Read the article

  • Using TCP Acks to measure latency to a server?

    - by Ted Graham
    I am trying to measure latency to a server that I don't control. This is in a colocated environment, so the latency is on the order of 500 us (.5 ms). I understand that Cisco gear frequently deprioritizes ICMP traffic, making ping times unreliable. Is there a way for me to tell if this is the case on the gear I am traversing? Can I use TCP acknowledgements to determine the minimum latency to the remote server? To do this, I would somehow need to force the remote server to send a TCP ack immediately on receiving my data.

    Read the article

  • Code coverage in Win32 app

    - by graham.reeds
    We are just about to start a new project. The Proof of Concept (PoC) for this project was done simply using Win32. The plan is/was to flesh out the PoC, tidy the uglier parts and meet the requirements set by the project owners. One of the requirements for the actual project is 100% code coverage but I can see problems ahead: How can I acheive 100% code coverage with Win32 - the message pump will be exceptionally difficult to test effectively?! I could compile to a DLL but won't there be code in the main app that won't be under coverage? I am thinking of dropping the Win32 code and moving to MFC - at least then a lot of the boiler plate stuff will be hidden from view (and therefore coverage). Any thoughts on the problem?

    Read the article

  • Is it necessary to "escape" character "<" and ">" for javascript string?

    - by Morgan Cheng
    Sometimes, server side will generate strings to be embedded in inline JavaScript code. For example, if "UserName" should be generated by ASP.NET. Then it looks like. <script> var username = "<%UserName%>"; </script> This is not safe, because a user can have his/her name to be </script><script>alert('bug')</script></script> It is XSS vulnerability. So, basically, the code should be: <script> var username = "<% JavascriptEncode(UserName)%>"; </script> What JavascriptEncode does is to add charater "\" before "/" and "'" and """. So, the output html is like. var username = "<\/scriptalert(\'bug\')<\/script<\/script"; Browser will not interpret "<\/script" as end of script block. So, XSS in avoided. However, there are still "<" and "" there. It is suggested to escape these two characters as well. First of all, I don't believe it is a good idea to change "<" to "&lt;" and "" to "&gt;" here. And, I'm not sure changing "<" to "\<" and "" to "\" is recognizable to all browsers. It seems it is not necessary to do further encoding for "<" and "". Is there any suggestion on this? Thanks.

    Read the article

  • javascript literal initialisation loop

    - by graham.reeds
    I have an object which has several properties that are set when the object is created. This object recently changed to object literal notation, but I've hit a bit of a problem that searching on the net doesn't reveal. Simply stated I need to do this: Star = function(_id, _x, _y, _n, _o, _im, _c, _b, _links) { var self = { id: _id, // other properties links: [], for (var i=0,j=0;i<8;i++) { //<- doesn't like this line var k = parseInt(_links[i]); if (k > 0) { this.links[j++] = k; } }, // other methods }; return self; }; How do I initialise a property in the constructor in object literal notation?

    Read the article

  • c# .net change label text

    - by Morgan
    Hello for I trying to use this code but for some reason it doesn't work. Really need help with this. The problem is that the label doesn't change name from "label" when I enter the site. <asp:Label ID="Label1" runat="server" Text= label'></asp:Label> <% Label1.Text = "test"; if (Request.QueryString["ID"] != null) { string test = Request.QueryString["ID"]; Label1.Text = "Du har nu lånat filmen:" + test; } %>

    Read the article

  • How do I Moq It.IsAny for an array in the setup of a method?

    - by Graham
    I'm brand new to Moq (using v 4) and am struggling a little with the documentation. What I'm trying to do is to Moq a method that takes a byte array and returns an object. Something like: decoderMock.Setup(d => d.Decode(????).Returns(() => tagMock.Object); The ???? is where the byte[] should be, but I can't work out how to make it so that I don't care what's in the byte array, just return the mocked object I've already set up. Moq.It.IsAny expects a generic. Any help please?

    Read the article

  • Debugging of native code

    - by graham.reeds
    I have a C# Service that is calling a C DLL that was originally written in VC6. There is a bug in the DLL which I am trying to inspect. After having a nightmare trying to get debug to work I eventually added the dll to the VS2005 solution containing the C# Service and added the necessary _CRT_SECURE_NO_WARNINGS. The debug version of the service is registered using 'installutil.exe' tool. I can get the debugger to break just before the line where the dll is entered via a call to System.Diagnostics.Debugger.Break();. I found some instruction on the net regarding stepping into debugging unmanaged code, and enabled the 'Enable unmanaged code debugging' check box, I've also tried turning on the Options-Debugging-Native 'Load DLL exports' and 'Enable RPC Debugging' (even though it's not COM). I've also copied the debug dll and .pdb to the same bin directory as the However the unmanaged code is not being stepped into which is what I really need. UPDATE: I found the Debugging Type in the DLL properties and set it to 'Mixed' as per suggestion on several sites but to no avail.

    Read the article

  • Custom validation summary

    - by Robert Morgan
    I'm using the UpdateModel method for validation. How do I specify the text for the error messages as they appear in the validation summary? Sorry, I wasn't entirely clear. When I call UpdateModel(), if there is parsing error, for example if a string value is specified for a double field, a "SomeProperty is invalid" error message is automatically added to the ModelState. How do I specify the text for said automatically generated error message? If I implement IDataErrorInfo as suggested, it's error message property gets called for every column, regardless of whether the default binder deems it valid or not. I'd have to reimplement the parse error catching functionality that I get for free with the default binder. Incidentally, the default "SomeProperty is invalid" error messages seem to have mysteriously dissappeared in the RC. A validation summary appears and the relevant fields are highlighted but the text is missing! Any idea why this is? Thanks again and I hope all this waffle makes sense!

    Read the article

  • javax.naming.NameNotFoundException: Name [comp/env] is not bound in this Context. Unable to find [comp] error with java scheduler

    - by Morgan Azhari
    What I'm trying to do is to update my database after a period of time. So I'm using java scheduler and connection pooling. I don't know why but my code only working once. It will print: init success success javax.naming.NameNotFoundException: Name [comp/env] is not bound in this Context. Unable to find [comp]. at org.apache.naming.NamingContext.lookup(NamingContext.java:820) at org.apache.naming.NamingContext.lookup(NamingContext.java:168) at org.apache.naming.SelectorContext.lookup(SelectorContext.java:158) at javax.naming.InitialContext.lookup(InitialContext.java:411) at test.Pool.main(Pool.java:25) ---> line 25 is Context envContext = (Context)initialContext.lookup("java:/comp/env"); I don't know why it only works once. I already test it if I didn't running it without java scheduler and it works fine. No error whatsoerver. Don't know why i get this error if I running it using scheduler. Hope someone can help me. My connection pooling code: public class Pool { public DataSource main() { try { InitialContext initialContext = new InitialContext(); Context envContext = (Context)initialContext.lookup("java:/comp/env"); DataSource datasource = new DataSource(); datasource = (DataSource)envContext.lookup("jdbc/test"); return datasource; } catch (Exception ex) { ex.printStackTrace(); } return null; } } my web.xml: <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> <listener> <listener-class> package.test.Pool</listener-class> </listener> <resource-ref> <description>DB Connection Pooling</description> <res-ref-name>jdbc/test</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref> Context.xml: <?xml version="1.0" encoding="UTF-8"?> <Context path="/project" reloadable="true"> <Resource auth="Container" defaultReadOnly="false" driverClassName="com.mysql.jdbc.Driver" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" initialSize="0" jdbcInterceptors="org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer" jmxEnabled="true" logAbandoned="true" maxActive="300" maxIdle="50" maxWait="10000" minEvictableIdleTimeMillis="300000" minIdle="30" name="jdbc/test" password="test" removeAbandoned="true" removeAbandonedTimeout="60" testOnBorrow="true" testOnReturn="false" testWhileIdle="true" timeBetweenEvictionRunsMillis="30000" type="javax.sql.DataSource" url="jdbc:mysql://localhost:3306/database?noAccessToProcedureBodies=true" username="root" validationInterval="30000" validationQuery="SELECT 1"/> </Context> my java scheduler public class Scheduler extends HttpServlet{ public void init() throws ServletException { System.out.println("init success"); try{ Scheduling_test test = new Scheduling_test(); ScheduledExecutorService executor = Executors.newScheduledThreadPool(100); ScheduledFuture future = executor.scheduleWithFixedDelay(test, 1, 60 ,TimeUnit.SECONDS); }catch(Exception e){ e.printStackTrace(); } } } Schedule_test public class Scheduling_test extends Thread implements Runnable{ public void run(){ Updating updating = new Updating(); updating.run(); } } updating public class Updating{ public void run(){ ResultSet rs = null; PreparedStatement p = null; StringBuilder sb = new StringBuilder(); Pool pool = new Pool(); Connection con = null; DataSource datasource = null; try{ datasource = pool.main(); con=datasource.getConnection(); sb.append("SELECT * FROM database"); p = con.prepareStatement(sb.toString()); rs = p.executeQuery(); rs.close(); con.close(); p.close(); datasource.close(); System.out.println("success"); }catch (Exception e){ e.printStackTrace(); } }

    Read the article

  • ASP.MVC 1.0 complex ViewModel not populating on Action

    - by Graham
    Hi, I'm 3 days into learning MVC for a new project and i've managed to stumble my way over the multitude of issues I've come across - mainly about something as simple as moving data to a view and back into the controller in a type-safe (and manageable) manner. This is the latest. I've seen this reported before but nothing advised has seemed to work. I have a complex view model: public class IndexViewModel : ApplicationViewModel { public SearchFragment Search { get; private set; } public IndexViewModel() { this.Search = new SearchFragment(); } } public class SearchFragment { public string ItemId { get; set; } public string Identifier { get; set; } } This maps to (the main Index page): %@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IndexViewModel>" %> <asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server"> <% Html.BeginForm("Search", AvailableControllers.Search, FormMethod.Post); %> <div id="search"> <% Html.RenderPartial("SearchControl", Model.Search); %> </div> <% Html.EndForm(); %> </asp:Content> and a UserControl: <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<SearchFragment>" %> <p> <label for="itemId"> <%= Html.Resource("ItemId") %></label> <%= Html.TextBox("itemId", Model.ItemId)%> </p> <p> <label for="title"> <%= Html.Resource("Title") %></label> <%= Html.TextBox("identifier", Model.Identifier)%> </p> <p> <input type="submit" value="<%= Html.Resource("Search") %>" name="search" /> </p> This is returned to the following method: [AcceptVerbs(HttpVerbs.Post)] public ActionResult Search(IndexViewModel viewModel) { .... } My problem is that when the view model is rehydrated from the View into the ViewModel, the SearchFragment elements are null. I suspect this is because the default model binder doesn't realise the HTML ItemId and Identifier elements rendered inline in the View map to the SearchFragment class. When I have two extra properties (ItemId and Identifier) in the IndexViewModel, the values are bound correctly. Unfortunately, as far as I can tell, I must use the SearchFragment as I need this to strongly type the Search UserControl... as the control can be used anywhere it can operate under any parent view. I really don't want to make it use "magic strings". There's too much of that going on already IMO. I've tried prefixing the HTML with "Search." in the hope that the model binder would recognise "Search.ItemId" and match to the IndexViewModel "Search" property and the ItemId within it, but this doesn't work. I fear I'm going to have to write my own ModelBinder to do this, but surely this must be something you can do out-of-the-box?? Failing that is there any other suggestions (or link to someone who has already done this?) Here's hoping....

    Read the article

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