Search Results

Search found 1044 results on 42 pages for 'thomas l holaday'.

Page 31/42 | < Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >

  • using usort to re-arrange multi-dimension array

    - by Thomas Bennett
    I have a large array: [0] => stdClass Object ( [products] => Array ( [0] => stdClass Object ( [body_html] => bodyhtml [published_at] => 2012-12-16T23:59:18+00:00 [created_at] => 2012-12-16T11:30:24+00:00 [updated_at] => 2012-12-18T10:52:14+00:00 [vendor] => Name [product_type] => type ) [1] => stdClass Object ( [body_html] => bodyhtml [published_at] => 2012-12-16T23:59:18+00:00 [created_at] => 2012-12-16T10:30:24+00:00 [updated_at] => 2012-12-18T10:52:14+00:00 [vendor] => Name [product_type] => type ) ) ) and I need to arrange each of the products by the date they where created... I've tried and failed all kinds of usort, ksort, uksort techniques to try and get it to be in a specific order (chronological) but failed! any guidance would be most appreciated

    Read the article

  • How to check for undefined or null variable in javascript

    - by Thomas Wanner
    We are frequently using the following code pattern in our javascript code if(typeof(some_variable) != 'undefined' && some_variable != null) { // do something with some_variable } and I'm wondering whether there is a less verbose way of checking that has the same effect. According to some forums and literature saying simply if(some_variable) { // do something with some_variable } should have the same effect. Unfortunately, Firebug evaluates such a statement as error on runtime when some_variable is undefined, whereas the first one is just fine for him. Is this only an (unwanted) behavior of Firebug or is there really some difference between those two ways ?

    Read the article

  • Java - Calling all methods of a class

    - by Thomas Eschemann
    I'm currently working on an application that has to render several Freemarker templates. So far I have a Generator class that handles the rendering. The class looks more or less like this: public class Generator { public static void generate(…) { renderTemplate1(); renderTemplate2(); renderTemplate3(); } private static void render(…) { // renders the template } private static void renderTemplate1() { // Create config object for the rendering // and calls render(); }; private static void renderTemplate1() { // Create config object for the rendering // and calls render(); }; … } This works, but it doesn't really feel right. What I would like to do is create a class that holds all the renderTemplate...() methods and then call them dynamically from my Generator class. This would make it cleaner and easier to extend. I was thinking about using something like reflection, but it doesn't really feel like a good solution either. Any idea on how to implement this properly ?

    Read the article

  • Create a callback function within a custom jQuery function

    - by Thomas
    I'm not sure how to approach this as I am fairly new to jQuery. I'm wanting to create a callback function within a custom function. Here's my example: function doSomething() { var output = 'output here'; // Do something here // This is where I want to create the callback function and pass output as a parameter } I want the callback function to be accessible by any number of scripts (e.g. more than one script can access this callback). This function (doSomething) is not part of a plugin but rather part of another callback function itself. I've also created a var within the function and want to pass that through the callback function as well. How can I do this?

    Read the article

  • Sort List by occurrence of a word by LINQ C#

    - by Thomas
    i have stored data in list like List<SearchResult> list = new List<SearchResult>(); SearchResult sr = new SearchResult(); sr.Description = "sample description"; list.Add(sr); suppose my data is stored in description field like "JCB Excavator - ECU P/N: 728/35700" "Geo Prism 1995 - ABS #16213899" "Geo Prism 1995 - ABS #16213899" "Geo Prism 1995 - ABS #16213899" "Wie man BBA reman erreicht" "this test JCB" "Ersatz Airbags, Gurtstrammer und Auto Körper Teile" now i want to query the list with my search term like geo jcb if you look then the word geo has stored many times in the description field. so i want to sort my list in such way that the word in search term found maximum that data will come first. please help me to do so. thanks

    Read the article

  • ASP.Net Vertical Menu with Scroll functionality

    - by Thomas
    Referring to Menu / Scrolling Example I would like to create / find the same functionality for a vertical menu. I tried the following. <asp:Menu ID="menuAccountMembers" runat="server" StaticSubMenuIndent="16px" Visible="true" RenderingMode="Table" ScrollDownImageUrl="~/Resources/scrolldown.jpg" ScrollUpImageUrl="~/Resources/scrollup.jpg"> <Items> But it doesnt display any scrolling images. I am using .net 4.0 Tried setting menuAccountMembers.RenderingCompatibility = new Version(3, 5); as well. If there a property to only display the first 5 root menu items, then show scroll bars for the rest? It can be click-able, no need to hover over to show next item.

    Read the article

  • jQuery - search for previous selector relative to current

    - by Thomas Slater
    I have a form with 3 sections in it. Each section has a dedicated div for fairly long contextual help messages regarding the input that has focus. My question is, if I give each of these help divs a class of "form-tip" and each input that has a tip the class "has-tip", how can I get the tip to always show up in the previous "form-tip" div? Something like: $('.has-tip').each(focus(function() { var tip = $(this).attr('title'); // Find most recent $('.form-tip') in the DOM and populate it with tip })); I hope that makes sense... Thanks for any help.

    Read the article

  • Check if a variable is empty

    - by Thomas
    I have some user-submitted variables that I want to display in a different part of my site like this: <div class="pre_box">Term: </div> <div class="entry"><?php $key='term'; echo get_post_meta($post->ID, $key, true); ?></div> Occasionally, these variables might be empty in which case I don't want to display the label for the empty variable. In the example above I would want to hide the <div class="pre_box">Term: </div> part. Is there some simple way to check if a php variable like the one above is empty and prevent the label from being displayed?

    Read the article

  • Is there a way to do this with basic JS DOM?

    - by Thomas
    I need to apply/remove to an input field according to a user's selection in a separate drop down form - but I can't figure out how to target the input's class. I need to add/remove the 'pageRequired' class from this input: <input type="text" title="Company Required" name="customfields-tf-2-tf" class="inputclass pageRequired textInput" id="customfields-tf-2-tf" /> When the user selects one of two options from a drop down field. For example: <select class="dropdown" name="customfields-s-1-s" id="customfields-s-1-s" > <option value="Owner"<?php if(in_array("Owner",$temp_values)) { ?> selected='selected'<?php } ?>> Owner</option> <option value="Broker"<?php if(in_array("Broker",$temp_values)) { ?> selected='selected'<?php } ?>> Broker</option> </select> If the user selects broker than I want to add the pageRequired class to the first input field and remove it if the user selects Owner.

    Read the article

  • Casting class to interface and back

    - by Thomas
    I have the following: public interface ICartItem { string Name { get; set; } } public class CartItem : ICartItem { public string Name { get; set; } } I then create a List and cast it to an interface: IList<CartItem> items = new List<CartItem>() { new CartItem() { Name = "MyItem" } }; IList<ICartItem> cartItems = items.Cast<ICartItem>().ToList(); Is there a way to cast it back again like illustrated below? IList<CartItem> newList = cartItems as IList<CartItem>;

    Read the article

  • C++ integer floor function

    - by Thomas
    I want to implement greatest integer function. int x = 5/3; My question is with greater numbers could there be a loss of precision as 5/3 would produce a double? EDIT: Greatest integer function is integer less than or equal to X. Example: 4.5 = 4 4 = 4 3.2 = 3 3 = 3 What I want to know is 5/3 going to produce a double? Because if so I will have loss of precision when converting to int. Hope this makes sense. RE-EDIT: What OP calls 'greatest integer' most of us call 'floor'.

    Read the article

  • Problems with unique links in database: www.doamin/ or domain/

    - by Thomas
    In my website everybody can send some links to other nice websites. All links in my database must by unique, but some links are with 'www.' prefix, and some without. Some ends for '/', some not. For example: |http://www.domain.com |http://domain.com |http://domain.com |http://domain.com/ and other problems can be with https or http. I know that I should change address before saving to database, but what standard I should use?

    Read the article

  • Convert user title (text) to URL, what instead spaces, #, & and other characters?

    - by Thomas
    I have some form on the website where users can add new pages. I must generate SEO friendly URLs and make this urls unique. What characters can I display in url, I know that spaces I should convert to undescore: " "-"_" and before it - underscores to something else, for example: ""-"()" It is easy make title from url back. But what in my specific title can be all characters from keyboard, even : @#%:"{/\';. Are some contraindications to don't use this characters in URL? Important for me is: -easy generate url and title from url back (without queries to database) -each title are unique, so url must be too -SEO friendly URLs

    Read the article

  • Unit Test Event Handler

    - by Thomas Tran
    I got this event handle and how can I do unit test for this public class MyLearningEvent { private event EventHandler _Closed; public event EventHandler Closed { add { _Closed -= value; _Closed += value; } remove { _Closed -= value; } } public void OnClosed() { if (_Closed != null) _Closed(this, EventArgs.Empty); } } Just modified code so that much clear Thanks

    Read the article

  • How to track dealloc of an abstract object class (NSMutable...)

    - by Thomas Tempelmann
    I have a bug in my code caused by a premature freeing of a ObjC object. I seem not to be able to find it by just looking at my code. There's usually a simple trick to track the dealloc to any class: Implement dealloc, and set a breakpoint. This even usually works with standard objects, by subclassing them and making sure I instantiate the subclass instead of the standard class. However, this does not seem to work with NSMutableArray, and probably neither with similar NSMutable... classes. Some explanations for this can be found here: link text Any other ideas how to track the dealloc invocation of a particular class or object so that I can see the call stack? It's probably possible with DTrace. Any pointers without having to read the entire dtrace docs first?

    Read the article

  • Spring @Transactional Annotation Best Practice

    - by Thomas Einwaller
    We are currently discussing the Best Practice for placing the @Transactional annotations in our code. Do you place the @Transactional in the DAO classes and/or their methods or is it better to annotate the Service classed which are calling using the DAO objects? Or does it make sense to annotate both "layers"?

    Read the article

  • Mixing has_one and has_and_belongs_to_many associations

    - by Thomas
    I'm trying to build a database of urls(links). I have a Category model that has and belongs to many Links. Here's the migration I ran: class CreateLinksCategories < ActiveRecord::Migration def self.up create_table :links_categories, :id => false do |t| t.references :link t.references :category end end def self.down drop_table :links_categories end end Here's the Link model: class Link < ActiveRecord::Base validates :path, :presence => true, :format => { :with => /^(#{URI::regexp(%w(http https))})$|^$/ } validates :name, :presence => true has_one :category end Here's the category model: class Category < ActiveRecord::Base has_and_belongs_to_many :links end And here's the error the console kicked back when I tried to associate the first link with the first category: >>link = Link.first => #<Link id: 1, path: "http://www.yahoo.com", created_at: "2011-01-10... >>category = Category.first => #<category id : 1, name: "News Site", created_at: "2011-01-11... >>link.category << category => ActiveRecord::StatementInvalid: SQLite3::Exception: no such column : categories.link_id: Are my associations wrong or am I missing something in the database? I expected it to find the links_categories table. Any help is appreciated.

    Read the article

  • How to use cbreak mode in Ruby terminal application?

    - by Thomas
    In a small Ruby application, I'd like user input to be accepted without having to wait for a carriage return. My understanding is that cbreak mode needs to be enabled in order for the terminal to feed user input directly into the script. I tried simply running x%[cbreak()] at the top of my script but that didn't work. I've also seen that it's possible to use (n)curses to achieve the same results, although that seems like overkill. Does anybody have a suggestion on how to implement this? Thanks

    Read the article

  • Design advices for quick navigation between view

    - by Thomas Joulin
    Usually, when a View requires a lot of bindings, or some UI Elements like a Bing Map, it takes a "while" to load (like between half a second and a second). I don't want a delay between a "tap" action (like tapping an element on a ListBox) and the navigation action (displaying a new page). I don't mind displaying the page progressively. For example, for a Bing Map, I don't mind displaying a black page with only a title, and a second later, having the Map appear. What are the best practices ? It could post a sample if i'm not clear enough

    Read the article

  • Open source alternative to Sharepoint lists

    - by Thomas
    Sharepoint's lists functionality is powerful. Because I don't want all the other functionality of Sharepoint, I have been looking for an alternative (preferrable open source) without much success. Basically I want to have a platform or web application that: allows us to define custom datatypes (for different kinds of customer products) has the possibility to create views or forms to present to the user for reading, creating or updating the information of the items of a given datatype a ui to setup this configuration is not required but would be nice to have In an ideal scenario there is an API to get the data out afterwards for further processing.

    Read the article

< Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >