Search Results

Search found 246 results on 10 pages for 'todd brooks'.

Page 4/10 | < Previous Page | 1 2 3 4 5 6 7 8 9 10  | Next Page >

  • Recursive String Function (Java)

    - by Jake Brooks
    Hi, I am trying to design a function that essentially does as follows: String s = "BLAH"; store the following to an array: blah lah bah blh bla bl ba bh ah al So basically what I did there was subtract each letter from it one at a time. Then subtract a combination of two letters at a time, until there's 2 characters remaining. Store each of these generations in an array. Hopefully this makes sense, Jake

    Read the article

  • How does .NET determine the week in a TimeZoneInfo.TransitionTime ?

    - by Travis Brooks
    Greetings I'm trying to do some DateTime math for various time zones and I wanted to take daylight savings into account. Lets say I have a TimeZoneInfo and i've determined the appropriate AdjustmentRule for a given DateTime. Lets also say the particular TimeZoneInfo i'm dealing with is specified as rule.DaylightTransitionStart.IsFixedDateRule == false, so I need to figure out if the given DateTime falls within the start/end TransitionTime.Week values. This is where I'm getting confused, what is .NET considering as a "week"? My first thought was it probably used something like DayOfWeek thisMarksWeekBoundaries = Thread.CurrentThread.CurrentUICulture.DateTimeFormat.FirstDayOfWeek; and went through the calendar assigning days to week, incrementing week every time it crossed a boundary. But, if I do this for May 2010 there are 6 week boundary buckets, and the max valid value for TransitionTime.Week is 5 so this can't be right. Whats the right way to slice up May 2010?

    Read the article

  • Accessing UI thread of a form?

    - by Nick Brooks
    I'm using C# and I'm making an application where a lot of UI loading must be done in background. Is it possible to do it unsafely and ignore InvalidOperationExceptions? The only way I found it to put try...catch statements around every single line of code but this will take ages as there is too much code.

    Read the article

  • OpenGL - Frustum not culling polygons beyond far plane

    - by Pladnius Brooks
    I have implemented frustum culling and am checking the bounding box for its intersection with the frustum planes. I added the ability to pause frustum updates which lets me see if the frustum culling has been working correctly. When I turn around after I have paused it, nothing renders behind me and to the left and right side, they taper off as well just as you would expect. Beyond the clip distance (far plane), they still render and I am not sure whether it is a problem with my frustum updating or bounding box checking code or I am using the wrong matrix or what. As I put the distance in the projection matrix at 3000.0f, it still says that bounding boxes well past that are still in the frustum, which isn't the case. Here is where I create my modelview matrix: projectionMatrix = glm::perspective(newFOV, 4.0f / 3.0f, 0.1f, 3000.0f); viewMatrix = glm::mat4(1.0); viewMatrix = glm::scale(viewMatrix, glm::vec3(1.0, 1.0, -1.0)); viewMatrix = glm::rotate(viewMatrix, anglePitch, glm::vec3(1.0, 0.0, 0.0)); viewMatrix = glm::rotate(viewMatrix, angleYaw, glm::vec3(0.0, 1.0, 0.0)); viewMatrix = glm::translate(viewMatrix, glm::vec3(-x, -y, -z)); modelViewProjectiomMatrix = projectionMatrix * viewMatrix; The reason I scale it by -1 in the Z direction is because the levels were designed to be rendered with DirectX so I reverse the Z direction. Here is where I update my frustum: void CFrustum::calculateFrustum() { glm::mat4 mat = camera.getModelViewProjectionMatrix(); // Calculate the LEFT side m_Frustum[LEFT][A] = (mat[0][3]) + (mat[0][0]); m_Frustum[LEFT][B] = (mat[1][3]) + (mat[1][0]); m_Frustum[LEFT][C] = (mat[2][3]) + (mat[2][0]); m_Frustum[LEFT][D] = (mat[3][3]) + (mat[3][0]); // Calculate the RIGHT side m_Frustum[RIGHT][A] = (mat[0][3]) - (mat[0][0]); m_Frustum[RIGHT][B] = (mat[1][3]) - (mat[1][0]); m_Frustum[RIGHT][C] = (mat[2][3]) - (mat[2][0]); m_Frustum[RIGHT][D] = (mat[3][3]) - (mat[3][0]); // Calculate the TOP side m_Frustum[TOP][A] = (mat[0][3]) - (mat[0][1]); m_Frustum[TOP][B] = (mat[1][3]) - (mat[1][1]); m_Frustum[TOP][C] = (mat[2][3]) - (mat[2][1]); m_Frustum[TOP][D] = (mat[3][3]) - (mat[3][1]); // Calculate the BOTTOM side m_Frustum[BOTTOM][A] = (mat[0][3]) + (mat[0][1]); m_Frustum[BOTTOM][B] = (mat[1][3]) + (mat[1][1]); m_Frustum[BOTTOM][C] = (mat[2][3]) + (mat[2][1]); m_Frustum[BOTTOM][D] = (mat[3][3]) + (mat[3][1]); // Calculate the FRONT side m_Frustum[FRONT][A] = (mat[0][3]) + (mat[0][2]); m_Frustum[FRONT][B] = (mat[1][3]) + (mat[1][2]); m_Frustum[FRONT][C] = (mat[2][3]) + (mat[2][2]); m_Frustum[FRONT][D] = (mat[3][3]) + (mat[3][2]); // Calculate the BACK side m_Frustum[BACK][A] = (mat[0][3]) - (mat[0][2]); m_Frustum[BACK][B] = (mat[1][3]) - (mat[1][2]); m_Frustum[BACK][C] = (mat[2][3]) - (mat[2][2]); m_Frustum[BACK][D] = (mat[3][3]) - (mat[3][2]); // Normalize all the sides NormalizePlane(m_Frustum, LEFT); NormalizePlane(m_Frustum, RIGHT); NormalizePlane(m_Frustum, TOP); NormalizePlane(m_Frustum, BOTTOM); NormalizePlane(m_Frustum, FRONT); NormalizePlane(m_Frustum, BACK); } And finally, where I check the bounding box: bool CFrustum::BoxInFrustum( float x, float y, float z, float x2, float y2, float z2) { // Go through all of the corners of the box and check then again each plane // in the frustum. If all of them are behind one of the planes, then it most // like is not in the frustum. for(int i = 0; i < 6; i++ ) { if(m_Frustum[i][A] * x + m_Frustum[i][B] * y + m_Frustum[i][C] * z + m_Frustum[i][D] > 0) continue; if(m_Frustum[i][A] * x2 + m_Frustum[i][B] * y + m_Frustum[i][C] * z + m_Frustum[i][D] > 0) continue; if(m_Frustum[i][A] * x + m_Frustum[i][B] * y2 + m_Frustum[i][C] * z + m_Frustum[i][D] > 0) continue; if(m_Frustum[i][A] * x2 + m_Frustum[i][B] * y2 + m_Frustum[i][C] * z + m_Frustum[i][D] > 0) continue; if(m_Frustum[i][A] * x + m_Frustum[i][B] * y + m_Frustum[i][C] * z2 + m_Frustum[i][D] > 0) continue; if(m_Frustum[i][A] * x2 + m_Frustum[i][B] * y + m_Frustum[i][C] * z2 + m_Frustum[i][D] > 0) continue; if(m_Frustum[i][A] * x + m_Frustum[i][B] * y2 + m_Frustum[i][C] * z2 + m_Frustum[i][D] > 0) continue; if(m_Frustum[i][A] * x2 + m_Frustum[i][B] * y2 + m_Frustum[i][C] * z2 + m_Frustum[i][D] > 0) continue; // If we get here, it isn't in the frustum return false; } // Return a true for the box being inside of the frustum return true; }

    Read the article

  • Resolution Problem with HttpRequestScoped in Autofac

    - by Page Brooks
    I'm trying to resolve the AccountController in my application, but it seems that I have a lifetime scoping issue. builder.Register(c => new MyDataContext(connectionString)).As<IDatabase>().HttpRequestScoped(); builder.Register(c => new UnitOfWork(c.Resolve<IDatabase>())).As<IUnitOfWork>().HttpRequestScoped(); builder.Register(c => new AccountService(c.Resolve<IDatabase>())).As<IAccountService>().InstancePerLifetimeScope(); builder.Register(c => new AccountController(c.Resolve<IAccountService>())).InstancePerDependency(); I need MyDataContext and UnitOfWork to be scoped at the HttpRequestLevel. When I try to resolve the AccountController, I get the following error: No scope matching the expression 'value(Autofac.Builder.RegistrationBuilder`3+<c__DisplayClass0[...]).lifetimeScopeTag.Equals(scope.Tag)' is visible from the scope in which the instance was requested. Do I have my dependency lifetimes set up incorrectly?

    Read the article

  • Can someone suggest a way to learn regex?

    - by Nick Brooks
    In my situation knowing Regex would be very useful but I can't seem to be able to learn it. I completely don't understand it and I find it quite strange. To me Regex is just a set of jumbled up symbols which 'somehow' does the job. I looked at many tutorials and still haven't figured how to use it. The other thing I find weird that whenever I search for a way to implement something with regex I find lots of different solutions. For example these are for 'matching text between the brackets' 1: \((.*?)\) 2: ((.+?)) That confuses me even more ... Can someone suggest a good way of learning it? Personally I find it even more difficult than assembly language. For now I'm avoiding Regex and using things such as "substr" to get the bits I need.

    Read the article

  • Resolving HttpRequestScoped Instances outside of a HttpRequest in Autofac

    - by Page Brooks
    Suppose I have a dependency that is registered as HttpRequestScoped so there is only one instance per request. How could I resolve a dependency of the same type outside of an HttpRequest? For example: // Global.asax.cs Registration builder.Register(c => new MyDataContext(connString)).As<IDatabase>().HttpRequestScoped(); _containerProvider = new ContainerProvider(builder.Build()); // This event handler gets fired outside of a request // when a cached item is removed from the cache. public void CacheItemRemoved(string k, object v, CacheItemRemovedReason r) { // I'm trying to resolve like so, but this doesn't work... var dataContext = _containerProvider.ApplicationContainer.Resolve<IDatabase>(); // Do stuff with data context. } The above code throws a DependencyResolutionException when it executes the CacheItemRemoved handler: No scope matching the expression 'value(Autofac.Builder.RegistrationBuilder`3+<c__DisplayClass0[MyApp.Core.Data.MyDataContext,Autofac.Builder.SimpleActivatorData,Autofac.Builder.SingleRegistrationStyle]).lifetimeScopeTag.Equals(scope.Tag)' is visible from the scope in which the instance was requested.

    Read the article

  • Avoiding Service Locator with AutoFac 2

    - by Page Brooks
    I'm building an application which uses AutoFac 2 for DI. I've been reading that using a static IoCHelper (Service Locator) should be avoided. IoCHelper.cs public static class IoCHelper { private static AutofacDependencyResolver _resolver; public static void InitializeWith(AutofacDependencyResolver resolver) { _resolver = resolver; } public static T Resolve<T>() { return _resolver.Resolve<T>(); } } From answers to a previous question, I found a way to help reduce the need for using my IoCHelper in my UnitOfWork through the use of Auto-generated Factories. Continuing down this path, I'm curious if I can completely eliminate my IoCHelper. Here is the scenario: I have a static Settings class that serves as a wrapper around my configuration implementation. Since the Settings class is a dependency to a majority of my other classes, the wrapper keeps me from having to inject the settings class all over my application. Settings.cs public static class Settings { public static IAppSettings AppSettings { get { return IoCHelper.Resolve<IAppSettings>(); } } } public interface IAppSettings { string Setting1 { get; } string Setting2 { get; } } public class AppSettings : IAppSettings { public string Setting1 { get { return GetSettings().AppSettings["setting1"]; } } public string Setting2 { get { return GetSettings().AppSettings["setting2"]; } } protected static IConfigurationSettings GetSettings() { return IoCHelper.Resolve<IConfigurationSettings>(); } } Is there a way to handle this without using a service locator and without having to resort to injecting AppSettings into each and every class? Listed below are the 3 areas in which I keep leaning on ServiceLocator instead of constructor injection: AppSettings Logging Caching

    Read the article

  • C# Drag and Drop - e.Data.GetData using a base class

    - by Dustin Brooks
    C# Winforms 3.5 I have a list of user controls all derived from one base class. These controls can be added to various panels and I'm trying to implement the drag-drop functionality, the problem I'm running in to is on the DragDrop event. The DragEventArgs: e.Data.GetData(typeof(baseClass)) doesn't work. It wants: e.Data.GetData(typeof(derivedClass1)) e.Data.GetData(typeof(derivedClass2)) etc... Is there a way I can get around this, or a better way to architect it?

    Read the article

  • Reporting Services keeps erasing my dataset parameters

    - by Dustin Brooks
    I'm using a web service and every time I change something on the dataset, it erases all my parameters. The weird thing is, I can execute the web service call from the data tab and it prompts for all my parameters, but if I click to edit the data the list is empty or if I try to preview the report it blows up because parameters are missing. Just wondering if anyone else has experienced this and if there is a way to prevent this behavior. Here is a copy of the dataset, not that I think it matters. This has to be the most annoying bug (if its a bug) ever. I can't even execute the dataset from the designer without it erasing my parameter list. When you have about 10 parameters and you are making all kinds of changes to a new report, it becomes very tedious to be constantly re-typing the same list over and over. If anything, studio should at least be able to pre-populate with the parameters the service is asking for. sigh Wheres my stress ball... <Query> <Method Namespace="http://www.abc.com/" Name="TWRPerformanceSummary"/> <SoapAction>http://www.abc.com/TWRPerformanceSummary</SoapAction> <ElementPath IgnoreNamespaces="true"> TWRPerformanceSummaryResponse/TWRPerformanceSummaryResult/diffgram/NewDataSet/table{StockPerc,RiskBudget,Custodian,ProductName,StartValue(decimal),EndValue(decimal),CostBasis(decimal)} </ElementPath> </Query>

    Read the article

  • Requirements of an issue/bug tracker

    - by James Brooks
    I've been looking at various issue/bug trackers available on the net. There are some very good ones, but I'm unable to use them as my server does not support Perl/Ruby (for example), I'm not too bothered however because I am able to write code in PHP and as such would prefer something in that language. So I've taken it upon myself to write a custom issue tracker system. As of now it's in early planning stages, and before I continue, I'd like to find out what people need from such an application. My current list of things to add include: Creating/Editing/Deleting issues - both on user and admin level Related issues (similar to that of STO) Admins will be able to create builds/milestones and version control of projects Admins will be able to assign users/groups to a project Roadmap of projects Possible SVN integration with Git? What do you think? There are a couple more things I'd like to add, but I'm sure you'll think of a better way of adding such feature. What would you like to see from an issue tracker?

    Read the article

  • Simplest way to use NSTableView?

    - by Nick Brooks
    Can I use NSTableView like I've used ListView in Windows? By that I mean JUST adding rows to the view. I need to display a very simple two columned table and I don't want to write all this data related crap. Can I just 'add' stuff to a table view? If not what is the simplest way to do what I'm trying to do (preferably without data sources)?

    Read the article

  • Optional attribute values in MappedField

    - by David Brooks
    I'm new to Scala and Lift, coming from a slightly odd background in PLT Scheme. I've done a quick search on this topic and found lots of questions but no answers. I'm probably looking in the wrong place. I've been working my way through tutorials on using Mapper to create database-backed objects, and I've hit a stumbling block: what types should be used to stored optional attribute values. For example, a simple ToDo object might comprise a title and an optional deadline (e.g. http://rememberthemilk.com). The former would be a MappedString, but the latter could not be a MappedDateTime since the type constraints on the field require, say, defaultValue to return a Date (rather than a Date or null/false/???). Is an underlying NULL handled by the MappedField subclasses? Or are there optional equivalents to things like MappedInt, MappedString, MappedDateTime that allow the value to be NULL in the database? Or am I approaching this in the wrong way?

    Read the article

  • How to have an iCalendar (RFC 2445) repeat YEARLY with duration

    - by Todd Brooks
    I have been unsuccessful in formulating a RRULE that would allow an event as shown below: Repeats YEARLY, from first Sunday of April to last day of May, occuring on Monday, Wednesday and Friday, until forever. FREQ=YEARLY;BYMONTH=4;BYDAY=SU (gives me the first Sunday of April repeating yearly) and FREQ=YEARLY;BYMONTH=5;BYMONTHDAY=-1 (gives me the last day of May repeating yearly) But I can't figure out how to have the event repeat yearly between those dates for Monday, Wednesday and Friday. Suggestions? Update: Comments don't have enough space to respond to Chris' answer, so I am editing the question with further information. Unfortunately, no. I don't know if it is the DDay.iCal library I'm using, or what, but that doesn't work either. I've found that the date start can't be an ordinal date (first Sunday, etc.)..it has to be a specific date, which makes it difficult for my requirements. Even using multiple RRULE's it doesn't seem to work: BEGIN:VCALENDAR VERSION:2.0 PRODID:-//DDay.iCal//NONSGML ddaysoftware.com//EN BEGIN:VEVENT CREATED:20090717T033307Z DTSTAMP:20090717T033307Z DTSTART:20090101T000000 RRULE:FREQ=YEARLY;WKST=SU;BYDAY=MO,WE,FR;BYMONTH=4,5 RRULE:FREQ=YEARLY;WKST=SU;BYDAY=1SU;BYMONTH=4 RRULE:FREQ=YEARLY;WKST=SU;BYMONTH=5;BYMONTHDAY=-1 SEQUENCE:0 UID:352ed9d4-04d0-4f06-a094-fab7165e5c74 END:VEVENT END:VCALENDAR That looks right on the face (I'm even starting the event on 1/1/2009), but when I start testing whether certain days are valid, I get incorrect results. For example, 4/1/2009 12:00:00 AM = True // Should be False 4/6/2009 12:00:00 AM = True 4/7/2009 12:00:00 AM = False 4/8/2009 12:00:00 AM = True 5/1/2009 12:00:00 AM = True 5/2/2009 12:00:00 AM = False 5/29/2009 12:00:00 AM = True 5/31/2009 12:00:00 AM = True // Should be False 6/1/2009 12:00:00 AM = False I'm using Douglas Day's DDay.iCal software, but I don't think it is a bug in that library. I think this might be a limitation in iCalendar (RFC 2445). Thoughts?

    Read the article

  • Parsing a simple XML from string in Cocoa?

    - by Nick Brooks
    I have a simple XML and I need to get the first 'id' from puid-list. I found lots of examples but none of them quite do that because of the namespace. How do get the id out as an NSString? <genpuid songs="1" xmlns:mip="http://musicip.com/ns/mip-1.0#"> <track file="/htdocs/test.mp3" puid="0c9f2f0e-e72a-c461-9b9a-e18e8964ca20"> <puid-list> <puid id="0c9f2f0e-e72a-c461-9b9a-e18e8964ca20"/> </puid-list> </track> </genpuid>

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10  | Next Page >