Search Results

Search found 2068 results on 83 pages for 'thomas stock'.

Page 39/83 | < Previous Page | 35 36 37 38 39 40 41 42 43 44 45 46  | Next Page >

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • Validation - Data Integrity

    - by Thomas
    A table can only store 10 records in a particular state, 10 users over 30 years for example, the others must be less than 30 years. It is a business rule and as such should be respected. How to ensure that state? Think: multiple users accessing this table.

    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

  • c++ Array passing dilemma

    - by Thomas
    Hi, I am writing a function that takes a string, string pointer and an int. The function splits the string based on a set of rules and puts each token into an array. I need to return the array out of the function with the number of elements in the int variable etc. I am stuck as to how I return the array as I can not use auto other wise it is destroyed and I am reluctant to use new as I feel this is patchy. I have other ideas on how to go about this but would like to see how other people go about this first. I could also be wrong and it could be possible to pass an auto out of an array. I can also not use vectors so there goes a copy constructor.

    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

  • 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

  • how to optimize sql server table for faster response?

    - by Thomas
    i found a in a table there are 50 thousands records and it takes one minute when we fetch data from sql server table just by issuing a sql. there are one primary key that means a already a cluster index is there. i just do not understand why it takes one minute. beside index what are the ways out there to optimize a table to get the data faster. in this situation what i need to do for faster response. also tell me how we can write always a optimize sql. please tell me all the steps in detail for optimization. thanks.

    Read the article

  • Jquery infinite scroll - with div not scrollbar of body

    - by Thomas
    suppose i have div and i want to fetch data and push data into that div. when user will drag scroll bar of div then next set of data will be fetch and pushed into div. how to detect when scroll bar of div drag to end by jquery. i don't want to use any plugin rather i need jquery code. here is the sample link i like it http://www.stevefenton.co.uk/cmsfiles/assets/File/infinitescroller.html but it used plugin. please help me with sample code for detecting scroll bar drag to end of div. thanks

    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

  • jtable update data not visible

    - by Thomas n
    I am running into a problem similar to what I have read here about inserted data and added data not showing up on jtable. I have tried repaint() and revalidate(), but to no avail. Basically, I have two classes say A and B. A calls a function in class B to add a row of data to the table. Here is the code.(By the way I am using Netbeans 7.1.2 to add a table and then add some code to handle the update.) public void callUpdateTable(){ DefaultTableModel myModel = (DefaultTableModel)jTable1.getModel(); DateFormat dateFormate = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); Object[] str = new Object[3]; Date date = new Date(); str[0] = dateFormate.format(date); str[1] = "Robot"; str[2] = "hello"; // myModel.addRow(str); myModel.insertRow(1, str); myModel.setValueAt("Hello", 1, 2); System.out.println("count = " + myModel.getValueAt(1, 2)); jTable1.repaint(); } The funny thing is on system print it prints out the value at the cell(1,2) I set the value, but doesn't show up on the table. Thank you for your help.

    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 can I make list or set translatable using gettext?

    - by Thomas
    I have some structure in Python: gender=( ('0','woman'), ('1','man') ) I want translate it before I will display it in Django template. Unfortunatelly below sollution don't work: from django.utils.translation import ugettext_lazy as _ gender=( ('0',('woman')), ('1',('man')) ) What I must do to translate this. I readed something in: link text but I can't understand what I should do.

    Read the article

  • Dropdown not working in some IE 6 browsers

    - by James Thomas
    We unfortunately find ourselves having to support our product in IE 6 because some of our largest users use it. One of them called today and told me that one of the dropdowns doesn't work when he clicks on it - it simply selects the first item. I checked the markup and the entire contents of the select control are being sent: <select onchange="SDateFilter_S('#ctlDateRange')" size="1" name="ctlDateRange" style="width:100px;"> <option selected="selected" value="0"> All Dates </option><option value="1"> Within </option><option value="2"> Before </option><option value="3"> After </option><option value="4"> Between </option><option value="5"> Last </option><option value="6"> Since </option> </select> This is done in ASP .NET but I am fairly certain the issue isn't with ASP .NET as when I try it in my copy of IE 6, it works correctly. Do you have any idea what would cause a dropdown list in some copies of IE 6 to effectively not work?

    Read the article

< Previous Page | 35 36 37 38 39 40 41 42 43 44 45 46  | Next Page >