Search Results

Search found 1558 results on 63 pages for 'ben collins'.

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

  • zend_captcha always fails isValid()

    - by Grant Collins
    Hi, I've got an issue with Zend_Captcha always returning false when the page is submitted and the captcha's isValid() method is being called. It's driving my nuts because this as far as I am concerned should work. I start by declaring this at the top of the action function of the controller $captcha = new Zend_Captcha_Image('captcha', array( 'captcha' => array( 'name' => 'graduatesignupcaptcha', 'wordlen' => 6, 'font' => $this->config->captcha->font, 'imgDir' => $baseUrl.'/images/captcha/', 'imgUrl' => $this->config->webserver->name.'/images/captcha/', ) ) ); $captcha->setHeight(80) ->setTimeout(300); I do usual form validation and that all works, however it is when I come to validate that the value entered into form for the captcha it always returns false. //next we check the captcha text to ensure that the form is a person not a script $captchaText = $form->getElement('captchainput')->getValue(); $captchaId = $form->getElement('captchaid')->getValue(); //$captchaSession = new Zend_Session_Namespace('Zend_Form_Captcha_'.$captchaId); $captchaArray = array( 'id' => $captchaId, 'input' => $captchaText ); if(!$captcha->isValid($captchaArray)){ $log->log(implode(",",$captcha->getErrors()), Zend_Log::DEBUG); $form->getElement('captchainput')->setErrors(array('messages' => 'Bad security code')); $formFailed = true; } I've check to ensure that the id that I am getting and storing as a hidden element in my form match the image that is being generated but no matter what I do this always fails. Am I missing something simple here?? Or is there a better way of dealing with this?? Thanks,

    Read the article

  • Zend_Navigation failing to load

    - by Grant Collins
    Hi, Following on from my earlier question, I am still having issues with loading the xml file into Zend_Navigation. I am now getting the following error message: <b>Fatal error</b>: Uncaught exception 'Zend_Navigation_Exception' with message 'Invalid argument: Unable to determine class to instantiate' in C:\www\mysite\development\website\library\Zend\Navigation\Page.php:223 I've tried to make my navigation.xml file look similar to the example on the Zend Documentation, However I just can't seem to get it to work. My XML file looks like this: <?xml version="1.0" encoding="UTF-8"?> <configdata> <navigation> <default> <label>Home</label> <controller>index</controller> <action>index</action> <module>default</module> <pages> <tour> <label>Tour</label> <controller>tour</controller> <action>index</action> <module>default</module> </tour> <blog> <label></label> <uri>http://blog.mysite.com</uri> </blog> <support> <label>Support</label> <controller>support</controller> <action>index</action> <module>default</module> </support> </pages> </default> <users> <label>Home</label> <controller>index</controller> <action>index</action> <module>users</module> <role>guser</role> <resource>owner</resource> <pages> <jobmanger> <label>Job Manager</label> <controller>jobmanager</controller> <action>index</action> <module>users</module> <role>guser</role> <resource>owner</resource> </jobmanger> <myaccount> <label>My Account</label> <controller>profile</controller> <action>index</action> <role>guser</role> <resource>owner</resource> <module>users</module> <pages> <detail> <label>Account Details</label> <controller>profile</controller> <action>detail</action> <module>users</module> <role>guser</role> <resource>owner</resource> <pages> <history> <label>Account History</label> <controller>profile</controller> <action>history</action> <module>users</module> <role>guser</role> <resource>owner</resource> </history> <password> <label>Change Password</label> <controller>profile</controller> <action>changepwd</action> <module>users</module> <role>employer</role> <resource>employers</resource> </password> </pages> </detail> ... </navigation> </configdata> Now I confess that I've totally got the wrong end of the stick with this, but rapidly running out of ideas, and it's been a long week. Thanks, Grant

    Read the article

  • "Could not load file or assembly 'XXX.YYY' or one of its dependencies. The system cannot find the file specified."

    - by Niall Collins
    I have a .net visual studio solution with a number of projects (class libraries and a web application). I did some refractoring which moved files between projects, created new projects, deleted ones not being used and renamed some existing projects. The solution builds without an issue but when I run the web application, the following exception occurs: "Could not load file or assembly 'XXX.YYY' or one of its dependencies. The system cannot find the file specified." The project called XXX.YYY which was deleted in the refractoring outputed a dll called XXX.YYY. But this isnt used anywhere in the application. I deleted the web applications obj directory and bin folder and rebuild but it still occurs. Anyone have any ideas when this might be occurring, any tips??

    Read the article

  • Rhino Mocks - Fluent Mocking - Expect.Call question

    - by Ben Cawley
    Hi, I'm trying to use the fluent mocking style of Rhino.Mocks and have the following code that works on a mock IDictionary object called 'factories': With.Mocks(_Repository).Expecting(() => { Expect.Call(() => factories.ContainsKey(Arg<String>.Is.Anything)); LastCall.Return(false); Expect.Call(() => factories.Add(Arg<String>.Is.Anything, Arg<Object>.Is.Anything)); }).Verify(() => { _Service = new ObjectRequestService(factories); _Service.RegisterObjectFactory(Valid_Factory_Key, factory); }); Now, the only way I have been able to set the return value of the ContainsKey call is to use LastCall.Return(true) on the following line. I'm sure I'm mixing styles here as Expect.Call() has a .Return(Expect.Action) method but I can't figure out how I am suppose to use it correctly to return a boolean value? Can anyone help out? Hope the question is clear enough - let me know if anyone needs more info! Cheers, Ben

    Read the article

  • zend_navigation and modules

    - by Grant Collins
    Hi, I am developing an application at the moment with zend and I have seperated the app into modules. The default module is the main site where unlogged in users access and have free reign to look around. When you log in, depending on the user type you either go to module A or module B, which is controlled by simple ACLs. If you have access to Module A you can not access Module B and visa versa. Both user types can see the default module. Now I want to use Zend_Navigation to manage the entire applications navigation in all modules. I am not sure how to go about this, as all the examples that I have seen work within a module or very simple application. I've tried to have my navigation.xml file look like this: <configdata> <navigation> <label>Home</label> <controller>index</controller> <action>index</action> <module>default</module> <pages> <tour> <label>tour</label> <controller>tour</controller> <action>index</action> <module>default</module> </tour> <blog> <label>blog</label> <url>http://blog.mysite.com</url> </blog> <support> <label>Support</label> <controller>support</controller> <action>index</action> <module>default</module> </support> </pages> </navigation> </configdata> This if fine for the default module, but how would I go about the other modules to this navigation page? Each module has it's own home page, and others etc. Would I be better off adding a unique navigation.xml file for each module that is loaded in the preDispatch plugin that I have written to handle my ACLs?? Or keep them in one massive navigation file? Any tips would be fantastic. Thanks, Grant

    Read the article

  • detail disclosure indicator on UIButton

    - by Ben Collins
    Is there a simple way to place a detail disclosure icon on a UIButton? I'm using a navigation controller and I want a button press to push a new view on the stack, so I thought a detail disclosure icon would be appropriate, but I haven't found a straightforward way to do that yet.

    Read the article

  • Adding Parameters to Zend_Navigation

    - by Grant Collins
    I have a problem with Zend_Navigation that I am hoping for a little guidance on. I'm in the process of adding a Zend_Navigation to a legacy app as described [here on SO].1 The thing that I am not sure of is how to add parameters to the navigation menu after the data is loaded from the xml file. What I want to do is get 2 identifying parameters from the url and add them to the Zend_Navigation so that they are included in things such as the breadcrumb bar, so that if a user selects the previous item in the breadcrumb they are returned with the correct params in the url. The parameters, I believe need to be set at the Action level rather than the controller. Any help would be appreciated. Many thanks.

    Read the article

  • I deleted a full set of columns in a save, but have the original larger sheet, Can I get that back?

    - by Ben Henley
    I have an original sheet that has over 39000 lines in it. I knocked it down to 1800 lines that I want to improt into my database, however. The Dumb#$$ that I am, I selected only the visible cells and killed like 10 columns that I need. Is there a way to compare to the original sheet using a specific column... i.e. SKU and pull the data from the origianal to put back in the missing columns or do I have to just re-edit the whole thing down again. Please help as this takes a good day or two to minimize. Any and all help is much appreciated. Below is the column list on the edited sheet vs. the original sheet. SKU DESCRIPTION VENDOR PART # RETAIL UNIT CONVERSION RETAIL U/M RETAIL DEPARTMENT VENDOR NAME SELL PACK QUANTITY BREAK SELL PACK FLAG BLISH VENDOR # FINE LINE CLASS ITEM ACTION FLAG PRIMARY UPC STOCK U/M WEIGHT LENGTH WIDTH HEIGHT SHIP-VIA EXCLUSION HAZARDOUS CODE PRICE SUGGESTED RETAIL SKU DESCRIPTION RETAIL UNIT CONVERSION RETAIL U/M RETAIL DEPARTMENT VENDOR NAME SELL PACK QUANTITY BREAK SELL PACK FLAG FINE LINE CLASS HAZARDOUS CODE PRICE SUGGESTED RETAIL RETAIL SENSITIVITY CODE 2ND UPC CODE 3RD UPC CODE 4TH UPC CODE HEADLINE BULLET #1 BULLET #2 BULLET #3 BULLET #4 BULLET #5 BULLET #6 BULLET #7 BULLET #8 BULLET #9 SIZE COLOR CASE QUANTITY PRODUCT LINE Thanks, Ben

    Read the article

  • Javascript : Submitting a form outside the actual form doesn't work

    - by Ben Fransen
    Hello all, I'm trying to achieve a fairly easy triggering mechanism for deleting multiple items from a tablegrid. If a user has enough access he/she is able to delete multiple users from a table. In the table I have set up checkboxes, one per row/user. The name of the checkboxes is UsersToDeletep[], and the value per row is the unique UserID. When a user clicks the button 'Delete selected users' a simple validation takes place to make sure at least one checkbox is selected. After that I call my simple function Submit(form). The function works perfectly when called within the form-tags, where I also use it to delete a single user. The function: function Submit(form) { document.forms[form].submit(); } I've also alerted document.forms[form]. The result is, as expected [object HTMLFormElement]. But for some reason the form just won't submit and a pagereload takes place. I'm a bit confused and can't seem to figure out what I'm doing wrong. Can anyone point me in the right direction? Thanks in advance! Ben

    Read the article

  • Need some help to determine the amount of recursive calls in PHP

    - by Ben Fransen
    Hi all, I've got a, I think fairly easy question, but this is bugging me for a while now. So I figured, maybe I can get some help here. Since recursive functions are always a bit tricky, and sometimes a bit unclear to me, I keep struggling to create a nice working solution to get my menudata. In one of my classes I have this function, which gives me all menu-items recursivly. The thing I want is to determine at which recursionlevel a certain object was retrieved so I can create a nicely looking HTML output with indents for the levels of nesting. public function GetObjectList($parentID = 0, $objectlist = null) { if(is_null($objectlist)) { $objectlist = new ObjectList("Model_Navigation"); } $query = MySQL::Query("SELECT * FROM `Navigation` WHERE `WebsiteID` = ".SITE_ID. " AND `LanguageID` = ".LANG_ID." AND `ParentID` = ".$parentID); while($result = MySQL::FetchAssoc($query)) { $object = new Model_Navigation(); $object->ID = $result["ID"]; $object->WebsiteID = $result["WebsiteID"]; $object->LanguageID = $result["LanguageID"]; $object->ParentID = $result["ParentID"]; $object->Name = $result["Name"]; $object->Page = Model_Page::GetObjectByID($result["PageID"]); $object->ExternalURL = $result["ExternalURL"]; $object->Index = $result["Index"]; $object->Level = [here lies my problem]; $objectlist->Add($object); self::GetObjectList($object->ID, $objectlist); } return $objectlist; } Hope to hear from you! Greetings from Holland, Ben Fransen

    Read the article

  • Git pack file entry format

    - by Ben Collins
    My understanding of the Git pack file format is something like: Where the table is 32-bits wide, and the first three 32-bit words are the pack file header. The last row of 32 bits are the first 4 bytes of an entry. As I understand it, the size of the entry is specified by consecutive bytes with the MSB set, followed by compressed data. In the first byte whose MSB is not set, is the MSB part of the compressed data, or is it a gap? If it's part of the compressed data, how can you guarantee that when the data is compressed that bit won't be set?

    Read the article

  • 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

  • Combine static files or load in parallel

    - by Niall Collins
    I am at present introducing code to my site to combine css and javascript files. Is there a way without having to include an external library to load javascript asynchronously or in parallel? I have read on some blogs that combining of files can be counter productive as the load of the http request can be large and its better to load multiple files in parallel. Opinions on this? I am caching my javascript/css. And would have thought it was better to combine rather than have multiple http requests.

    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

  • Default content editor in list form doesn't allow image alignment

    - by Ben Collins
    I need to be able to adjust the alignment of an image in an "Enhanced Rich Text Field" in an announcements list in MOSS 2007. However, the default content editor in the edit form for the list doesn't provide a way to do that. What's the fastest way for me to make sure users can align images? My first thought was to customize the DispForm.aspx and EditForm.aspx pages, but they just have the ListForm web part in the content region and as far as I know, you can't customize the ListForm web part from the designer.

    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

  • 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

  • Need to hide displayed div when I show others

    - by adrian collins
    I am stuck. I have a page with 3 buttons, the 3 buttons do a couple things - they change the style of a div, and they also show/hide a content div. The changing of the div style works fine, but I am having issues with the content div. If you land on the page and click the "Our Brands" tab, then click the other 2 tabs, it works fine. If you land on the page, and click "What's New" or "About Us" first, then the show/hide does not work correctly - it does not until you actually click on "Our Brands." http://www.adriancollins.net/clients/kennys/ Any help would be appreciated, I am a designer first, a developer about 9000th. Show/Hide Code <script type="text/javascript"> var _hidediv = null; function showdiv(id) { if(_hidediv) _hidediv(); var div = document.getElementById(id); div.style.display = 'block'; _hidediv = function () { div.style.display = 'none'; }; } </script> Tab Divs <div id="brand_button"><a href="#" onClick="showdiv('brands_content'); lower.className='blue';angle.className='blue_angle';return false"><img src="wp-content/uploads/2012/10/brands_button.png"></a></div> <div id="whatsnew_button"><a href="#" onClick="showdiv('new_content');lower.className='black';angle.className='black_angle';return false"><img src="wp-content/uploads/2012/10/whatsnew_button.png"></a></div> <div id="about_button"><a href="#" onClick="showdiv('about_content');lower.className='green';angle.className='green_angle';return false"><img src="wp-content/uploads/2012/10/about_button.png"></a></div> Content Divs <div id="brands_content">Content...</div> <div id="whats_content">Content...</div> <div id="about_content">Content...</div> CSS #brands_content { position: relative; display: block; width: 990px; top: 10px; height: auto; min-height: 800px; margin-left: auto; margin-top: 0px; margin-right: auto; border: 0px; padding: 0px 0px 0px 0px; z-index: 12; } #new_content { position: relative; display: none; width: 990px; top: 10px; height: auto; min-height: 800px; margin-left: auto; margin-top: 0px; margin-right: auto; border: 0px; padding: 0px 0px 0px 0px; z-index: 999; color: #fff; } #about_content { position: relative; display: none; width: 990px; top: 10px; height: auto; min-height: 800px; margin-left: auto; margin-top: 0px; margin-right: auto; border: 0px; padding: 0px 0px 0px 0px; z-index: 999; } Thanks

    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

  • zend session exception on zend_session::start with forms

    - by Grant Collins
    Hi I'm having issues with trying to use Zend_Form_SubForm and sessions. My controller is in essance acting a wizard showing different subforms depending on the stage of the wizard. Using the example I am planning on storing the forms in a session namespace. My controller looks like this. include 'mylib/Form/addTaskWizardForm.php'; class AddtaskController extends Zend_Controller_Action{ private $config = null; private $log = null; private $subFormSession = null; /** * This function is called and initialises the global variables to this object * which is the configuration details and the logger to write to the log file. */ public function init(){ $this->config = Zend_Registry::getInstance()->get('config'); $this->log = Zend_Registry::getInstance()->get('log'); //set layout $this->_helper->layout->setLayout('no-sidemenus'); //we need to get the subforms and $wizardForms = new addTaskWizardForm(); $this->subFormSession = new Zend_Session_Namespace('addTaskWizardForms'); if(!isset($this->subFormSession->subforms)){ $this->subFormSession->subforms = $wizardForms; } } /** * The Landing page controller for the site. */ public function indexAction(){ $form = $this->subFormSession->subforms->getSubForm('start'); $this->view->form = $form; } However this is causing the application session to crash out with Uncaught exception 'Zend_Session_Exception' with message 'Zend_Session::start() Any idea why this is having issues with the Zend Session?? thanks.

    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

  • IP address numbers in MySQL subquery

    - by Iain Collins
    I have a problem with a subquery involving IPV4 addresses stored in MySQL (MySQL 5.0). The IP addresses are stored in two tables, both in network number format - e.g. the format output by MySQL's INET_ATON(). The first table ('events') contains lots of rows with IP addresses associated with them, the second table ('network_providers') contains a list of provider information for given netblocks. events table (~4,000,000 rows): event_id (int) event_name (varchar) ip_address (unsigned 4 byte int) network_providers table (~60,000 rows): ip_start (unsigned 4 byte int) ip_end (unsigned 4 byte int) provider_name (varchar) Simplified for the purposes of the problem I'm having, the goal is to create an export along the lines of: event_id,event_name,ip_address,provider_name If do a query along the lines of either of the following, I get the result I expect: SELECT provider_name FROM network_providers WHERE INET_ATON('192.168.0.1') >= network_providers.ip_start ORDER BY network_providers.ip_start DESC LIMIT 1 SELECT provider_name FROM network_providers WHERE 3232235521 >= network_providers.ip_start ORDER BY network_providers.ip_start DESC LIMIT 1 That is to say, it returns the correct provider_name for whatever IP I look up (of course I'm not really using 192.168.0.1 in my queries). However, when performing this same query as a subquery, in the following manner, it doesn't yield the result I would expect: SELECT event.id, event.event_name, (SELECT provider_name FROM network_providers WHERE event.ip_address >= network_providers.ip_start ORDER BY network_providers.ip_start DESC LIMIT 1) as provider FROM events Instead the a different (incorrect) value for network_provider is returned - over 90% (but curiously not all) values returned in the provider column contain the wrong provider information for that IP. Using event.ip_address in a subquery just to echo out the value confirms it contains the value I'd expect and that the subquery can parse it. Replacing event.ip_address with an actual network number also works, just using it dynamically in the subquery in this manner that doesn't work for me. I suspect the problem is there is something fundamental and important about subqueries in MySQL that I don't get. I've worked with IP addresses like this in MySQL quite a bit before, but haven't previously done lookups for them using a subquery. The question: I'd really appreciate an example of how I could get the output I want, and if someone here knows, some enlightenment as to why what I'm doing doesn't work so I can avoid making this mistake again. Notes: The actual real-world usage I'm trying to do is considerably more complicated (involving joining two or three tables). This is a simplified version, to avoid overly complicating the question. Additionally, I know I'm not using a between on ip_start & ip_end - that's intentional (the DB's can be out of date, and such cases the owner in the DB is almost always in the next specified range and 'best guess' is fine in this context) however I'm grateful for any suggestions for improvement that relate to the question. Efficiency is always nice, but in this case absolutely not essential - any help appreciated.

    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

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