Search Results

Search found 1862 results on 75 pages for 'stuart brand'.

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

  • How to iterate over an array of objects without foreach and ArrayAccess

    - by kenny99
    Hi, I'm having to develop a site on PHP 5.1.6 and I've just come across a bug in my site which isn't happening on 5.2+. When using foreach() to iterate over an object, I get the following error: "Fatal error: Objects used as arrays in post/pre increment/decrement must return values by reference..." Does anyone know how to convert the following foreach loop to a construct which will work with 5.1.6? Thanks in advance! foreach ($post['commercial_brands'] as $brand) { $comm_food = new Commercial_food_Model; $comm_food->brand = $brand; $comm_food->feeding_type_id = $f_type->id; $comm_food->save(); }

    Read the article

  • Is my slide-to-anchor jQuery routine a correct use of JavaScript, or is there a better way?

    - by Stuart Robson
    I'm currently working on a project with a one page design that'll slide up and down between sections on an <a href> link... Currently, i have it written as follows: <ul> <li><a href="javascript:void(0)" onClick="goToByScroll('top')">home</a></li> <li><a href="javascript:void(0)" onClick="goToByScroll('artistsmaterials')">artist's materials</a></li> <li><a href="javascript:void(0)" onClick="goToByScroll('pictureframing')">picture framing</a></li> <li><a href="javascript:void(0)" onClick="goToByScroll('gallery')">gallery</a></li> <li><a href="javascript:void(0)" onClick="goToByScroll('contactus')">contact us</a></li> </ul> ...with the most relevant portion being the links: <a href="javascript:void(0)" onClick="goToByScroll('contactus')"> Then in a .js file I have: function goToByScroll(id){ $('html,body').animate({scrollTop: $("#"+id).offset().top},'slow'); } Is this ok? Or should this be done a different way?

    Read the article

  • Problem with debug watch in Visual Studio with yield return enumerator methods

    - by Stuart
    I have a method which returns an IEnumerable<> which it builds up using the yield return syntax: public IEnumerable<ValidationError> Validate(User user) { if (String.IsNullOrEmpty(user.Name)) { yield return new ValidationError("Name", ValidationErrorType.Required); } [...] yield break; } If I put a breakpoint in the method, I can step over each line, but if I try to use the Watch or Immediate windows to view the value of a variable I get this error: Cannot access a non-static member of outer type '[class name].Validate' via nested type '[class name]' Does anyone know why this is and how I can get around it?

    Read the article

  • asp.net ajax collapsible panel in ie8 problem

    - by stuart
    Anyone try this simple bit of code in an ie8 browswer and try refreshing the page, in ie8 you will get an error around getelementbyid on refresh. When i run it it complains of not being able to find control with id of 'ctl00_main_dd' <cc1:CollapsiblePanelExtender ID="CollapsiblePanelExtender2" runat="server" ImageControlID="Image2" CollapsedImage="~/App_Themes/IMStandard/icons/uparrow.png" ExpandedImage="~/App_Themes/IMStandard/icons/downarrow.png" CollapseControlID="dd" ExpandControlID="dd" TargetControlID="pnlQuickKeywordSearch" SuppressPostBack="true"> </cc1:CollapsiblePanelExtender> <asp:Panel ID="dd" runat="server"> <h3 class="loginHeader"> <asp:Image ID="Image2" runat="server" /> &nbsp;&nbsp;Quick Keyword search&nbsp;<asp:Image ID="HelpIconImage" runat="server" Width="16px" Height="16px" ImageUrl="~/App_Themes/IMStandard/icons/help.png" /></h3> </asp:Panel> <asp:Panel ID="pnlQuickKeywordSearch" Style="float: left; border: double 3px #C9DF86;" runat="server" > <div style="clear: both; padding: 5px;"> </div></asp:Panel> Anybody know why this is happening? is it a bug in ie8 or am i missing something? By the way, i am using masterpages, but i dont think that has anything to do with it. Thanks

    Read the article

  • How to handle environment-specific application configuration organization-wide?

    - by Stuart Lange
    Problem Your organization has many separate applications, some of which interact with each other (to form "systems"). You need to deploy these applications to separate environments to facilitate staged testing (for example, DEV, QA, UAT, PROD). A given application needs to be configured slightly differently in each environment (each environment has a separate database, for example). You want this re-configuration to be handled by some sort of automated mechanism so that your release managers don't have to manually configure each application every time it is deployed to a different environment. Desired Features I would like to design an organization-wide configuration solution with the following properties (ideally): Supports "one click" deployments (only the environment needs to be specified, and no manual re-configuration during/after deployment should be necessary). There should be a single "system of record" where a shared environment-dependent property is specified (such as a database connection string that is shared by many applications). Supports re-configuration of deployed applications (in the event that an environment-specific property needs to change), ideally without requiring a re-deployment of the application. Allows an application to be run on the same machine, but in different environments (run a PROD instance and a DEV instance simultaneously). Possible Solutions I see two basic directions in which a solution could go: Make all applications "environment aware". You would pass the environment name (DEV, QA, etc) at the command line to the app, and then the app is "smart" enough to figure out the environment-specific configuration values at run-time. The app could fetch the values from flat files deployed along with the app, or from a central configuration service. Applications are not "smart" as they are in #1, and simply fetch configuration by property name from config files deployed with the app. The values of these properties are injected into the config files at deploy-time by the install program/script. That install script takes the environment name and fetches all relevant configuration values from a central configuration service. Question How would/have you achieved a configuration solution that solves these problems and supports these desired features? Am I on target with the two possible solutions? Do you have a preference between those solutions? Also, please feel free to tell me that I'm thinking about the problem all wrong. Any feedback would be greatly appreciated.

    Read the article

  • How do you deserialize a collection with child collections?

    - by Stuart Helwig
    I have a collection of custom entity objects one property of which is an ArrayList of byte arrays. The custom entity is serializable and the collection property is marked with the following attributes: [XmlArray("Images"), XmlArrayItem("Image",typeof(byte[]))] So I serialize a collection of these custom entities and pass them to a web service, as a string. The web service receives the string and byte array in tact, The following code then attempts to deserialize the collection - back into custom entities for processing... XmlSerializer ser = new XmlSerializer(typeof(List<myCustomEntity>)); StringReader reader = new StringReader(xmlStringPassedToWS); List<myCustomEntity> entities = (List<myCustomEntity>)ser.Deserialize(reader); foreach (myCustomEntity e in entities) { // ...do some stuff... foreach (myChildCollection c in entities.ChildCollection { // .. do some more stuff.... } } I've checked the XML resulting from the initial serialization and it does contain byte array - the child collection, as does the StringReader built above. After the deserialization process, the resulting collection of custom entites is fine, except that each object in the collection does not contain any items in its child collection. (i.e. it doesn't get to "...do some more stuff..." above. Can someone please explain what I am doing wrong? Is it possible to serialize ArrayLists within a generic collection of custom entities?

    Read the article

  • UITableViewCell with 'ball' like calendar App

    - by Stuart Tevendale
    in the iPhone Calendar app, the view to select the calendar for a particular event has a coloured circle next to the calendar name, drawn with a graduated/3D effect of a ball. Does anyone have any sample code for how this is drawn - I can draw a solid circle in the UITableViewCell, but I'm not sure how to get the 3D effect. Thanks.

    Read the article

  • Communication via internet in Java

    - by Stuart
    What I mean is like servers on video games. You can run an application and it will set up a server on your computer with an IP and a port. For example, how would you make an application where one host application sets up a thing where it has an IP and a port, and another computer that has access to the internet as well can type in the IP and port and it would be able to communicate with the host? I mean simple communication, like sending a boolean or String. And would there be any security problems that would be needed to fix?

    Read the article

  • Handling user input in C

    - by Stuart
    In C, I am writing a program which is taking in user input than comparing it to see which output it should use. I am finding it problomatic and was wondering if someone could give me a hand. So far I have: while(cmd[0] != EOF){ fgets(cmd, sizeof(cmd), stdin); /** Takes in user input and stores it in cmd **/ if(cmd[0] == '\n') printf("%s> ", cwd); else if(strcmp(cmd, "ls") == 0) printf("I will list everything"); } Any ideas? Basically it is just ignoring any user input when there is some. P.S. The variable cwd is just a string.

    Read the article

  • Outlook AppointmentItem - How do I programmatically add RTF to its Body?

    - by Stuart Harris
    I would like to set the Body of an AppointmentItem to a string of RTF that contains an embedded image. Setting Microsoft.Office.Interop.Outlook.AppointmentItem.Body results in the RTF appearing as-is in the appointment. I have tried using Redemption which wraps the appointment and exposes an RTFBody property, but the RTF formatting (including the image) is lost. In this example (which doesn't have an embedded image) the RTF appears in the document as-is. Has anyone managed to do this? var appointment = (AppointmentItem)app.CreateItem(OlItemType.olAppointmentItem); appointment.Subject = "test subject"; appointment.Start = DateTime.Now; appointment.End = DateTime.Now.AddHours(1); appointment.Body = @"{\rtf1\ansi\deff0{\fonttbl{\f0 Arial;}}{\colortbl ;\red0\green0\blue255;}\pard\cf1\f0\fs24 Test}"; appointment.Save();

    Read the article

  • Querystring formatting in asp.net MVC 2

    - by Stuart
    Seems like a straitforward question but I can't quite figure it out myself... I have an actionlink like so Html.ActionLink( "Test", "test", new { q = "search+twitter" } ) This produces a url string as follows http://myserver/test?q=search%2Btwitter But i would like to preserve the plus sign (which i assume is being UrlPathEncoded) so that I get the following url http://myserver/test?q=search+twitter Is there an easy way to do this whilst still using Html.ActionLink ?

    Read the article

  • C++ vector of char array

    - by Stuart
    I am trying to write a program that has a vector of char arrays and am have some problems. char test [] = { 'a', 'b', 'c', 'd', 'e' }; vector<char[]> v; v.push_back(test); Sorry this has to be a char array because I need to be able to generate lists of chars as I am trying to get an output something like. a a a b a c a d a e b a b c Can anyone point me in the right direction? Thanks

    Read the article

  • xmldocument and nested schemas

    - by Stuart
    Using c# and .net 3.5 I'm trying to validate an xml document against a schema that has includes. The schemas and there includes are as below Schema1.xsd - include another.xsd another.xsd - include base.xsd When i try to add the Schema1.xsd to the XmlDocument i get the following error. Type 'YesNoType' is not declared or is not a simple type. I believe i'm getting this error because the base.xsd file is not being included when i load the Schema1.xsd schema. I'm trying to use the XmlSchemaSet class and I'm setting the XmlResolver uri to the location of the schemas. NOTE : All schemas live under the same directory E:\Dev\Main\XmlSchemas Here is the code string schemaPath = "E:\\Dev\\Main\\XmlSchemas"; XmlDocument xmlDocSchema = new XmlDocument(); XmlSchemaSet s = new XmlSchemaSet(); XmlUrlResolver resolver = new XmlUrlResolver(); Uri baseUri = new Uri(schemaPath); resolver.ResolveUri(null, schemaPath); s.XmlResolver = resolver; s.Add(null, XmlReader.Create(new System.IO.StreamReader(schemaPath + "\\Schema1.xsd"), new XmlReaderSettings { ValidationType = ValidationType.Schema, XmlResolver = resolver }, new Uri(schemaPath).ToString())); xmlDocSchema.Schemas.Add(s); ValidationEventHandler valEventHandler = new ValidationEventHandler (ValidateNinoDobEvent); try { xmlDocSchema.LoadXml(xml); xmlDocSchema.Validate(valEventHandler); } catch (XmlSchemaValidationException xmlValidationError) { // need to interogate the Validation Exception, for possible further // processing. string message = xmlValidationError.Message; return false; } Can anyone point me in the right direction regarding validating an xmldocument against a schema with nested includes.

    Read the article

  • How can I get the edit control in a cell of a DataGridView to validate itself?

    - by Stuart Helwig
    It appears that the only way to capture the keypress events within a cell of a DataGridView control, in order to validate user input as they type, is to us the DataGridView controls OnEditControlShowing event, hook up a method to the edit control's (e.Control) keypress event and do some validation. My problem is that I've built a heap of custom DataGridView column classes, with their own custom cell types. These cells have their own custom edit controls (things like DateTimePickers, and Numeric or Currency textboxes.) I want to do some numeric validation for those cells that have Numeric of Currency Textboxes as their edit controls but not all the other cell types. How can I determine, within the DataGridView's "OnEditControlShowing" override, whether or not a particular edit control needs some numeric validation? (In the meantime I've restorted to setting the Tag property of my custom edit controls to a known value and any Edit Controls I find in the OnEditControlShowing override, I hook to my validation routine - I don't like that much!)

    Read the article

  • Windows Mobile 6.x How to explicitly lock the app in one orientation?

    - by Stuart
    I'm trying to get an app on the WinMo App Store. As part of this, Microsoft App's Store has asked that I need to support landscape as well as portrait. What they've said is OK is: If dynamic switching is implicitly allowed, the app will be tested just as if it supports both portrait and landscape even if only a portrait or landscape resolution is checked. You may explicitly lock the app in one orientation (which means portrait mode if the app does not handle landscape mode functions), provided the default OS orientation is preserved once the app exits. I'd love to do answer 2 - but I can't find any way of doing it - and they won't provide me any other clues - they suggested I ask on the forums... so here I am on Stack Overflow - far better than on the forums :) Anyone got any suggestions?

    Read the article

  • 1-st level routes for multiple resources in Rails

    - by Leonid Shevtsov
    I have a simple SEO task. There's a City model and a Brand model, and I have to create 1st-level URLs for both (e.g. site.com/honda and site.com/boston). What's the preferred routing/controller combination to do this in Rails? I can only think of map.connect '/:id', :controller => 'catchall', :action => 'index' class CatchallController < ApplicationController def index if City.exists?(:slug => params[:id]) @city = City.find_by_slug!(params[:id]) render 'cities/show' else @brand = Brand.find_by_slug!(params[:id]) render 'brands/show' end end end but it seems to be very un-Rails to put such logic into the controller. (Obviously I need to make sure that the slugs don't overlap in the models, that's done).

    Read the article

  • MySQL function to compare values in a db table against the previous

    - by Stuart
    Iam quite new to functions in SQL and I would like to create a function to compare values in a MySQL table against previous and I am not sure how to do this. For example (iId is the input value) DECLARE pVal INT(20); DECLARE val INT(20); SELECT price INTO pVal FROM products WHERE Id=iId; SELECT price FROM products; IF price == pVal THEN SET val = price; END IF; Thanks

    Read the article

  • Best way to format a query string in an asp.net mvc url?

    - by Stuart
    I've noticed that if you sent a query string routevalue through asp.net mvc you end up with all whitespaces urlencoded into "%20". What is the best way of overriding this formatting as I would like whitespace to be converted into the "+" sign? I was thinking of perhaps using a custom Route object or a class that derives from IRouteHandler but would appreciate any advice you might have.

    Read the article

  • PHP 5.1.6 ArrayAccess error when iterating over object

    - by kenny99
    Hi, I'm having to develop a site on PHP 5.1.6 and I've just come across a bug in my site which isn't happening on 5.2+. When using foreach() to iterate over an object, I get the following error: "Fatal error: Objects used as arrays in post/pre increment/decrement must return values by reference..." Does anyone know how to get around this issue? if (strpos($post['feeding_type'], 'comm')) { foreach ($post['commercial_brands'] as $brand) { $comm_food = new Commercial_food_Model; $comm_food->brand = $brand; $comm_food->feeding_type_id = $f_type->id; $comm_food->save(); } }

    Read the article

  • Using map() on a _set in a template?

    - by Stuart Grimshaw
    I have two models like this: class KPI(models.Model): """KPI model to hold the basic info on a Key Performance Indicator""" title = models.CharField(blank=False, max_length=100) description = models.TextField(blank=True) target = models.FloatField(blank=False, null=False) group = models.ForeignKey(KpiGroup) subGroup = models.ForeignKey(KpiSubGroup, null=True) unit = models.TextField(blank=True) owner = models.ForeignKey(User) bt_measure = models.BooleanField(default=False) class KpiHistory(models.Model): """A historical log of previous KPI values.""" kpi = models.ForeignKey(KPI) measure = models.FloatField(blank=False, null=False) kpi_date = models.DateField() and I'm using RGraph to display the stats on internal wallboards, the handy thing is Python lists get output in a format that Javascript sees as an array, so by mapping all the values into a list like this: def f(x): return float(x.measure) stats = map(f, KpiHistory.objects.filter(kpi=1) then in the template I can simply use {{ stats }} and the RGraph code sees it as an array which is exactly what I want. [87.0, 87.5, 88.5, 90] So my question is this, is there any way I can achieve the same effect using Django's _set functionality to keep the amount of data I'm passing into the template, up until now I've been passing in a single KPI object to be graphed but now I want to pass in a whole bunch so is there anything I can do with _set {{ kpi.kpihistory_set }} dumps the whole model out, but I just want the measure field. I can't see any of the built in template methods that will let me pull out just the single field I want. How have other people handled this situation?

    Read the article

  • Checking if an element is visible in Chrome using Selenium Remote WebDriver

    - by Stuart
    Is there a cross browser solution to check if an element is visible using WebDriver? The solution for IE and firefox is to cast the object to a RenderedRemoteWebElement and then call the property Displayed. I'm using the following methods to return if a element is visible: /// <summary> /// Check if the control is visible. /// </summary> public bool IsVisible() { IWebElement control = mSelenium.FindElement(mFindBy); return ((RenderedRemoteWebElement)control).Displayed; } The problem is when I run this using Chrome, I get an exception when casting to type RenderedRemoteWebElement, this is not really the problem as I can catch this, but I need to a solution to check if an element is visible in chrome. Thanks

    Read the article

  • How can I validate input to the edit control of a cell in a DataGridView?

    - by Stuart Helwig
    It appears that the only way to capture the keypress events within a cell of a DataGridView control, in order to validate user input as they type, is to us the DataGridView controls OnEditControlShowing event, hook up a method to the edit control's (e.Control) keypress event and do some validation. My problem is that I've built a heap of custom DataGridView column classes, with their own custom cell types. These cells have their own custom edit controls (things like DateTimePickers, and Numeric or Currency textboxes.) I want to do some numeric validation for those cells that have Numeric of Currency Textboxes as their edit controls but not all the other cell types. How can I determine, within the DataGridView's "OnEditControlShowing" override, whether or not a particular edit control needs some numeric validation?

    Read the article

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