Search Results

Search found 1668 results on 67 pages for 'ben ward'.

Page 10/67 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • Action Filter Dependency Injection in ASP.NET MVC 3 RC2 with StructureMap

    - by Ben
    Hi, I've been playing with the DI support in ASP.NET MVC RC2. I have implemented session per request for NHibernate and need to inject ISession into my "Unit of work" action filter. If I reference the StructureMap container directly (ObjectFactory.GetInstance) or use DependencyResolver to get my session instance, everything works fine: ISession Session { get { return DependencyResolver.Current.GetService<ISession>(); } } However if I attempt to use my StructureMap filter provider (inherits FilterAttributeFilterProvider) I have problems with committing the NHibernate transaction at the end of the request. It is as if ISession objects are being shared between requests. I am seeing this frequently as all my images are loaded via an MVC controller so I get 20 or so NHibernate sessions created on a normal page load. I added the following to my action filter: ISession Session { get { return DependencyResolver.Current.GetService<ISession>(); } } public ISession SessionTest { get; set; } public override void OnResultExecuted(System.Web.Mvc.ResultExecutedContext filterContext) { bool sessionsMatch = (this.Session == this.SessionTest); SessionTest is injected using the StructureMap Filter provider. I found that on a page with 20 images, "sessionsMatch" was false for 2-3 of the requests. My StructureMap configuration for session management is as follows: For<ISessionFactory>().Singleton().Use(new NHibernateSessionFactory().GetSessionFactory()); For<ISession>().HttpContextScoped().Use(ctx => ctx.GetInstance<ISessionFactory>().OpenSession()); In global.asax I call the following at the end of each request: public Global() { EndRequest += (sender, e) => { ObjectFactory.ReleaseAndDisposeAllHttpScopedObjects(); }; } Is this configuration thread safe? Previously I was injecting dependencies into the same filter using a custom IActionInvoker. This worked fine until MVC 3 RC2 when I started experiencing the problem above, which is why I thought I would try using a filter provider instead. Any help would be appreciated Ben P.S. I'm using NHibernate 3 RC and the latest version of StructureMap

    Read the article

  • Convert a nested array into a flat array with PHP

    - by Ben Fransen
    Hello all, I'm trying to create a generic database mapping class with PHP. Collecting the data through my functions is going well, but as expected I'm retrieving a nested set. A print_r of my received array looks like: Array ( [table] => Session [columns] => Array ( [0] => `Session`.`ID` AS `Session_ID` [1] => `Session`.`User` AS `Session_User` [2] => `Session`.`SessionID` AS `Session_SessionID` [3] => `Session`.`ExpiresAt` AS `Session_ExpiresAt` [4] => `Session`.`CreatedAt` AS `Session_CreatedAt` [5] => `Session`.`LastActivity` AS `Session_LastActivity` [6] => `Session`.`ClientIP` AS `Session_ClientIP` ) [0] => Array ( [table] => User [columns] => Array ( [0] => `User`.`ID` AS `User_ID` [1] => `User`.`UserName` AS `User_UserName` [2] => `User`.`Password` AS `User_Password` [3] => `User`.`FullName` AS `User_FullName` [4] => `User`.`Address` AS `User_Address` ) [0] => Array ( [table] => Address [columns] => Array ( [0] => `Address`.`ID` AS `Address_ID` [1] => `Address`.`UserID` AS `Address_UserID` [2] => `Address`.`Street` AS `Address_Street` [3] => `Address`.`City` AS `Address_City` ) ) ) ) To simplify things I want to recreate this nested array to a flat array so I can easily loop through it and use the 'columns' key to create my SELECT query. I'm kinda struggling with this for a while now and figures, maybe some users at SO can help me out here. I've tried multiple things with recursion, all without luck so far... Any help is much appriciated! Thanks in advance, Ben Fransen

    Read the article

  • Get instance of type inheriting from base class, implementing interface, using StructureMap

    - by Ben
    Continuing on my quest for a good plugin implementation I have been testing the StructureMap assembly scanning features. All plugins will inherit from abstract class PluginBase. This will provide access to common application services such as logging. Depending on it's function, each plugin may then implement additional interfaces, for example, IStartUpTask. I am initializing my plugins like so: Scan(x => { x.AssembliesFromPath(HttpContext.Current.Server.MapPath("~/Plugins"), assembly => assembly.GetName().Name.Contains("Extension")); x.AddAllTypesOf<PluginBase>(); }); The difficulty I am then having is how to work against the interface (not the PluginBase) in code. It's easy enough to work with PluginBase: var plugins = ObjectFactory.GetAllInstances<PluginBase>(); foreach (var plugin in plugins) { } But specific functionality (e.g. IStartUpTask.RunTask) is tied to the interface, not the base class. I appreciate this may not be specific to structuremap (perhaps more a question of reflection). Thanks, Ben

    Read the article

  • SQL Comparison Tools

    - by David Ward
    Which SQL comparison tool would you recommend for SQL server database comparisons. I've been looking at SQL Compare and SQL Delta. I'd like the ability to compare and sync database schema and data.

    Read the article

  • Is it possible to use 2 versions of jQuery on the same page?

    - by Ben McCormack
    NOTE: I know similar questions have already been asked here and here, but I'm looking for additional clarification as to how to make this work. I'm adding functionality to an existing web site that is already using an older version of the jQuery library (1.1.3.1). I've been writing my added functionality against the newest version of the jQuery library (1.4.2). I've tested the website using only the newer version of jQuery and it breaks functionality, so now I'm looking at using both versions on the same page. How is this possible? What do I need to do in my code to specify that I'm using one version of jQuery instead of another? For example, I'll put <script> tags for both versions of jQuery in the header of my page, but what do I need to do so that I know for sure in my calling code that I'm calling one version of the library or another? Maybe something like this: //Put some code here to specify a variable that will be using the newer //version of jquery: var $NEW = jQuery.theNewestVersion(); //Now when I use $NEW, I'll know it's the newest version and won't //conflict with the older version. $NEW('#personName').text('Ben'); //And when I use the original $ in code, or simply 'jquery', I'll know //it's the older version. $('#personName').doSomethingWithTheOlderVersion();

    Read the article

  • Flash CS4 [AS3]: Playing Card Deck Array

    - by Ben
    I am looking to make a card game in Flash CS4 using AS3 and I am stuck on the very first step. I have created graphics for a standard 52 card deck of playing cards and imported them into the library in Flash and then proceeded to convert them all to Movie Clips. I have also used the linkage to make them available in the code. The movie clips and the linkage are named in sequence, as in the Ace of Clubs would be C1, two of Diamonds is called D2, Jack of Spades is S11. (C = Clubs, D = Diamonds, S = Spades, H = Hearts and numbers 1 through 13 are the card values. 1 being Ace, 11 being Jack, 12 being Queen, 13 being King). As far as I know my next step would be to arrange the cards into an array. This is the part that I am having problems with. Can someone please point me in the right direction, what would be the best way to do this. Could you provide me with a bit of sample code as well? I have had a look at few tutorials online but they are all telling me different things, some are incomplete and the rest...well...they're just cr*ppy. Thanks in advance! Ben

    Read the article

  • Three20 TTSectionedDataSource row height

    - by Ward
    Hey there, I'm using Three20 to create a table with several textfields for user registration. I've found two possible methods using Three20. The first uses the TTSectionedDataSource's tableDidLoadModel method to manually add UI components and the second adds custom items that contains pre formatted UI components. The second option seems way more complex and I'm having a difficult time accessing the individual fields. So if one field is a textfield for the username, I need to access the field to submit the username and it doesn't seem like there's an easy answer. The first option gives me a lot of flexibility, but I can't figure out how to set the individual row heights. One row may have a label above a text field, another may have an image, etc. Is there a method that can be used in TTSectionedDataSource that will allow me to set the height for each row? Thus far, I'm using method one and creating UIViews to hold a label field and a text field. I've tried changing the frame of the uiview before it is added to the items array, but it has no affect. Any ideas?

    Read the article

  • Visual Studio 2010 Professional - Problem Unit-Testing Web Services

    - by Ben
    Have created a very simple Web Service (asmx) in Visual Studio 2010 Professional, and am trying to use the auto-generated unit test cases. I get something that seems quite familiar on this site: The web site could not be configured correctly; getting ASP.NET process information failed. Requesting http://localhost:81/zfp/VSEnterpriseHelper.axd return an error: The remote server returned an error: (500) Internal Server Error. http://stackoverflow.com/questions/260432/500-error-running-visual-studio-asp-net-unit-test I have tried: 1. Running the tests on IIS rather than ASP.NET Development Server 2. Adding and then removing the XML fragment to my Web Service's .config file 3. Giving the MACHINE\ASPNET account Full control to the local folder My current questions: 1. Why am I being bothered with this instrumentation / code coverage DLL, when this doesn't seem to be something that ships with Visual Studio 2010 Professional? Is there any way I can turn it off? 2. I'm placing the node under in Web.config - is that the correct node? 3. Is it possible to bind to a web service without using the webby test attributes? I've seen other people advising making the Web Service as light-weight as possible. I'm trying to call it with jQuery / AJAX / JSON, so being able to debug the actual web service would be really helpful. Best wishes, Ben

    Read the article

  • EF4 Import/Lookup thousands of records - my performance stinks!

    - by Dennis Ward
    I'm trying to setup something for a movie store website (using ASP.NET, EF4, SQL Server 2008), and in my scenario, I want to allow a "Member" store to import their catalog of movies stored in a text file containing ActorName, MovieTitle, and CatalogNumber as follows: Actor, Movie, CatalogNumber John Wayne, True Grit, 4577-12 (repeated for each record) This data will be used to lookup an actor and movie, and create a "MemberMovie" record, and my import speed is terrible if I import more than 100 or so records using these tables: Actor Table: Fields = {ID, Name, etc.} Movie Table: Fields = {ID, Title, ActorID, etc.} MemberMovie Table: Fields = {ID, CatalogNumber, MovieID, etc.} My methodology to import data into the MemberMovie table from a text file is as follows (after the file has been uploaded successfully): Create a context. For each line in the file, lookup the artist in the Actor table. For each Movie in the Artist table, lookup the matching title. If a matching Movie is found, add a new MemberMovie record to the context and call ctx.SaveChanges(). The performance of my implementation is terrible. My expectation is that this can be done with thousands of records in a few seconds (after the file has been uploaded), and I've got something that times out the browser. My question is this: What is the best approach for performing bulk lookups/inserts like this? Should I call SaveChanges only once rather than for each newly created MemberMovie? Would it be better to implement this using something like a stored procedure? A snippet of my loop is roughly this (edited for brevity): while ((fline = file.ReadLine()) != null) { string [] token = fline.Split(separator); string Actor = token[0]; string Movie = token[1]; string CatNumber = token[2]; Actor found_actor = ctx.Actors.Where(a => a.Name.Equals(actor)).FirstOrDefault(); if (found_actor == null) continue; Movie found_movie = found_actor.Movies.Where( s => s.Title.Equals(title, StringComparison.CurrentCultureIgnoreCase)).FirstOrDefault(); if (found_movie == null) continue; ctx.MemberMovies.AddObject(new MemberMovie() { MemberProfileID = profile_id, CatalogNumber = CatNumber, Movie = found_movie }); try { ctx.SaveChanges(); } catch { } } Any help is appreciated! Thanks, Dennis

    Read the article

  • Condensing repeating JQuery code

    - by Craig Ward
    I have a page that has a large image on it with a number of thumbnails. When you mouse over a thumbnail the main image changes to the image you have just rolled your mouse over. The problem is the more thumbnails I have, the more repeated code I have. How could I reduce it? The Jquery code is as follows. <script type="text/javascript"> $('#thumb1') .mouseover(function(){ $('#big_img').fadeOut('slow', function(){ $('#big_img').attr('src', '0001.jpg'); $('#big_img').fadeIn('slow'); }); }); $('#thumb2') .mouseover(function(){ $('#big_img').fadeOut('slow', function(){ $('#big_img').attr('src', 'p_0002.jpg'); $('#big_img').fadeIn('slow'); }); }); $('#thumb3') .mouseover(function(){ $('#big_img').fadeOut('slow', function(){ $('#big_img').attr('src', '_img/p_0003.jpg'); $('#big_img').fadeIn('slow'); }); }); $('#thumb4') .mouseover(function(){ $('#big_img').fadeOut('slow', function(){ $('#big_img').attr('src', '0004.jpg'); $('#big_img').fadeIn('slow'); }); }); </script> #big_img = the ID of the full size image #thumb1, #thumb2, #thumb3, #thumb4 = The ID's of the thumbnails The main code for the page is PHP if that helps.

    Read the article

  • WPF Binding Between Controls

    - by David Ward
    I have a control on a page that contains a listbox. I also have another control which is a detail view. Both of the controls have their own ViewModel which their child controls bind to. Image Outlook. It has a list of folders and when you select a folder the detail control displays the contents of the folder. How can I bind the detail control to the selected item in the list control?

    Read the article

  • How to manage sessions in NHibernate unit tests?

    - by Ben
    I am a little unsure as to how to manage sessions within my nunit test fixtures. In the following test fixture, I am testing a repository. My repository constructor takes in an ISession (since I will be using session per request in my web application). In my test fixture setup I configure NHibernate and build the session factory. In my test setup I create a clean SQLite database for each test executed. [TestFixture] public class SimpleRepository_Fixture { private static ISessionFactory _sessionFactory; private static Configuration _configuration; [TestFixtureSetUp] // called before any tests in fixture are executed public void TestFixtureSetUp() { _configuration = new Configuration(); _configuration.Configure(); _configuration.AddAssembly(typeof(SimpleObject).Assembly); _sessionFactory = _configuration.BuildSessionFactory(); } [SetUp] // called before each test method is called public void SetupContext() { new SchemaExport(_configuration).Execute(true, true, false); } [Test] public void Can_add_new_simpleobject() { var simpleObject = new SimpleObject() { Name = "Object 1" }; using (var session = _sessionFactory.OpenSession()) { var repo = new SimpleObjectRepository(session); repo.Save(simpleObject); } using (var session =_sessionFactory.OpenSession()) { var repo = new SimpleObjectRepository(session); var fromDb = repo.GetById(simpleObject.Id); Assert.IsNotNull(fromDb); Assert.AreNotSame(simpleObject, fromDb); Assert.AreEqual(simpleObject.Name, fromDb.Name); } } } Is this a good approach or should I be handling the sessions differently? Thanks Ben

    Read the article

  • iPhone Circular Progress Indicator

    - by Ward
    I'm trying to create a circular progress indicator like Shazam. It will represent progress during recording. There will be a finite amount of time and I want it to react to the sound level like Shazam's does. Any clues where to begin? Thanks

    Read the article

  • WPF Application - Role Management Recommendations

    - by David Ward
    I have a WPF application with a WCF service layer and a SQL database. I now want to restrict elements of the application so that certain functions are only available to those users with a particular role. For example, you will only be able to navigate to the settings screen if you are an administrator. I would like a user to be a member of 1 or more authorisation groups and each authorisation group to have 1 or more roles associated. A long time ago I used AzMan (Authorisation Manager) to do a similar thing. Does anyone think that there are better approaches? Is AzMan "old news"? Alternatives? Thanks.

    Read the article

  • How to deal with routing when developing a custom CMS in Codeigniter

    - by Ashley Ward
    Hi All - I’m a recent user of Codeigniter and am developing a simple backend CMS to manage pages. Based on a URL (in this example I have hidden “index.php”) : mysite.com/pagename I would like the system to detect if there is a value of “pagename” in my database, if there is, I need the system to re-route to a custom controller (eg: Pagemaker) and if there is no record called pagename, just do it’s normal thing (i.e. find a controller called pagename) Currently I have: $route['(:any)'] = "pagemaker/create/$1"; whereby all requests are forwarded to my custom function. However I want to change this structure so that if the page does NOT exist in the db, the traditional codeigniter request process is followed. Can anyone offer any advice about how to complete this? Or any advice about routing custom CMS’s in codeigniter in general?

    Read the article

  • Reliability of UDP on localhost

    - by Bryan Ward
    I know that UDP is inherently unreliable, but when connecting to localhost I would expect the kernel handles the connection differently since everything can be handled internally. So in this special case, is UDP considered a reliable protocol, or will the kernel still potentially junk some packets if buffers are overrun?

    Read the article

  • Form (or Formset?) to handle multiple table rows in Django

    - by Ben
    Hi, I'm working on my first Django application. In short, what it needs to do is to display a list of film titles, and allow users to give a rating (out of 10) to each film. I've been able to use the {{ form }} and {{ formset }} syntax in a template to produce a form which lets you rate one film at a time, which corresponds to one row in a MySQL table, but how do I produce a form that iterates over all the movie titles in the database and produces a form that lets you rate lots of them at once? At first, I thought this was what formsets were for, but I can't see any way to automatically iterate over the contents of a database table to produce items to go in the form, if you see what I mean. Currently, my views.py has this code: def survey(request): ScoreFormSet = formset_factory(ScoreForm) if request.method == 'POST': formset = ScoreFormSet(request.POST, request.FILES) if formset.is_valid(): return HttpResponseRedirect('/') else: formset = ScoreFormSet() return render_to_response('cf/survey.html', { 'formset':formset, }) And my survey.html has this: <form action="/survey/" method="POST"> <table> {{ formset }} </table> <input type = "submit" value = "Submit"> </form> Oh, and the definition of ScoreForm and Score from models.py are: class Score(models.Model): movie = models.ForeignKey(Movie) score = models.IntegerField() user = models.ForeignKey(User) class ScoreForm(ModelForm): class Meta: model = Score So, in case the above is not clear, what I'm aiming to produce is a form which has one row per movie, and each row shows a title, and has a box to allow the user to enter their score. If anyone can point me at the right sort of approach to this, I'd be most grateful. Thanks, Ben

    Read the article

  • StrcutureMap Wiring - Sanity Check Please

    - by Steve Ward
    Hi - Im new to IOC and StructureMap and have an n-level application and am looking at how to setup the wirings (ForRequestedType ...) and just want to check with people with more experience that this is the best way of doing it! I dont want my UI application object to reference my persistence layer directly so am not able to wire everything up in this UI project. I now have it working by defining a Registry class in each project which wires up the types in the project as needed. The layer above registers its types and also calls the assembly below and looks for registries so that all types are registered throught the hierrachy. E.g. I have UI, Service, Domain, and Persistence libraries. In my service layer the registry looks like Scan(x => { x.Assembly("MyPersistenceProject"); x.LookForRegistries(); }); ForRequestedType<IService>().TheDefault.Is.OfConcreteType<MyService>(); Is this a recommended way of doing this in a setup such as this? Are there better ways and what are the advantages / disadvantages of these approaches in this case?

    Read the article

  • Web App fails when moved to production environment. Which server permissions do I need?

    - by Ashley Ward
    I have developed a small web app. This app allows users to upload images. It also produces text files with the names of those images (the names are stored and retrieved to/from an MySQL Database.) I have developed this app using MAMP. To create the uploaded image files I use the PHP function imagejpeg('my/path/name.jpg') and to delete the files I use the PHP function unlink('folder1/folder2/name.jpg') to write to the text document I am using the function fopen('folder1/folder2/name.txt', 'w') all three of these functions produce errors related to permissions - now the site has been moved to a live hosting environment. Why is this? and what permissions do I need to set the folder's folder1 and folder2 to? I know that permission 777 is generally bad because it opens up your server to the public. However what I have found is that the functions fail to work unless I use 777 on the folders. Can anyone shed any light on my dilemma?

    Read the article

  • Negative zero using Crystal Report ToText()

    - by Dan Ward
    Using Crystal Reports 8.5 on Windows Vista or 7, I'm using the ToText function to report a value: totext(Sum ({ap121w7.yrentamt}, {@type1099})*100,"000000000000000000") The result (if yrentamt is 0) is -000000000000000000 The dash (I assume it's a negative sign) is unneccessary and unwanted in my report. Is this a bug, or is there an easy solution? --Note-- I would very much like to avoid the following: if {ap121w7.yrentamt}=0.00 then yrentamt := "000000000000" else yrentamt := totext({ap121w7.yrentamt}*100,"000000000000"); I have about 100 files to fix with multiple formulas per file, and the above solution doesn't seem to work consistently either.

    Read the article

  • Counting divs for pagination in Jquery

    - by Craig Ward
    I want to create a nice pagination in Jquery for a number of divs I have. EG: <div class="container"> <div id="one">content</div> <div id="two">content</div> <div id="three">content</div> <div id="four">content</div> </div> The number will not always be the same so I need to count the divs, and display a pagination like the one below. 1|2|3|4 Clicking on the page number would display the relevant div. I know how to show and hide elements using Jquery and css and have figured out I can count the divs using var numPages = $('.container').size(); but I can't work out how I can display the pagination. Any pointers?

    Read the article

  • how to convert all characters to their html entity equivalent using PHP

    - by Ashley Ward
    I want to convert this [email protected] to &#104;&#101;&#108;&#108;&#111;&#064;&#100;&#111;&#109;&#097;&#105;&#110;&#046;&#099;&#111;&#109; I have tried: url_encode($string) this provides the same string I entered, returned with the @ symbol converted to %40 also tried: htmlentities($string) this provides the same string right back. I am using a UTF8 charset. not sure if this makes a difference....

    Read the article

  • Jquery selectors question

    - by Ben
    Hi all, I am not an expert at jquery but trying to get a menu to work. Basically, I have a menu made of up to 3 levels of nested lists. The first level has a little arrow has a background image that opens or close when opening the first level list. Any other nested lists don't need to have the background image. My script opens the menu when you click on it and is also supposed to switch the first level list from a class "inactive" to a class "active". Here is the script: $(document).ready(function(){ $("#left-navigation-holder ul.level1 li.inactive").toggle(function(){ $(this).addClass("active"); }, function () { $(this).removeClass("active"); }); $("#left-navigation-holder li a").click(function(){ menu = $(this).parent('li').children('ul'); menu.toggle(); }); }); The problem is that the toggle function also happens when clicking on second and third level lists causing the arrows to toggle even if the first level list isn't clicked on. I thought using $("#left-navigation-holder ul.level1 li.inactive").toggle would limit the function to the first level list with a class "inactive". Any help would be really appreciated. Ben

    Read the article

  • Wordpress/CSS: List Style Problem.

    - by Ben
    Hi all! I am reasonably new to Wordpress custom themes but I do have some knowlege of CSS, although I am terrible at customising other peoples code which is why I have the problem I am about to explain. I have started a website that my girlfriend and I are doing together. It uses the Simplo Wordpress theme which is pretty cool but when you add a post that has a list in it. It doesn't show the bullets on each of the items. I have tried adding 'list-style:circle;' to a the.postItem class and a couple of other divs and classes that I thought were relevant but it doesn't work. You can take a look for yourself, it may be easier to understand my problem that way. If you go to: http://brokeandstarving.com/234/bennos-shepherds-pie/ there is a list of ingredients and also the steps under the method is a list as well. My question is, where do I edit the CSS to make the bullets appear next to the list items? I hope that makes sense. Thanks in advance, - Ben

    Read the article

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