Search Results

Search found 8397 results on 336 pages for 'implementation'.

Page 130/336 | < Previous Page | 126 127 128 129 130 131 132 133 134 135 136 137  | Next Page >

  • Java equivalent of C++ std::map?

    - by Rudiger
    I'm looking for a Java class with the characteristics of C++ std::map's usual implementation (as I understand it, a self-balancing binary search tree): O(log n) performance for insertion/removal/search Each element is composed of a unique key and a mapped value Keys follow a strict weak ordering I'm looking for implementations with open source or design documents; I'll probably end up rolling my own support for primitive keys/values. This question's style is similar to: Java equivalent of std::deque, whose answer was "ArrayDeque from Primitive Collections for Java".

    Read the article

  • Slide in/out event in N97 using J2me

    - by rajiv
    I would like to listen the slide IN/OUT event of the NOKIA devices(Touch + QWERTY Keyboard) in J2ME App. I need your inputs for the same. Do i need to follow complex implementation or is there any other way around?Will midpjni help?

    Read the article

  • Java Interger: what is faster comparison or subtraction?

    - by Vladimir
    I've found that java.lang.Ingteger implementation of compareTo method looks as follows: public int compareTo(Integer anotherInteger) { int thisVal = this.value; int anotherVal = anotherInteger.value; return (thisVal<anotherVal ? -1 : (thisVal==anotherVal ? 0 : 1)); } The question is why use comparison instead of subtraction: return thisVal - anotherVal;

    Read the article

  • How to perform add/update of a model object that contains EntitySet

    - by David Liddle
    I have a similar concept to the SO questions/tags scenario however am trying to decide the best way of implementation. Tables Questions, QuestionTags and Tags Questions QuestionTags Tags --------- ------------ ---- QID QID TID QName TID TName When adding/updating a question I have 2 textboxes. The important part is a single textbox that allows users to enter in multiple Tags separated by spaces. I am using Linq2Sql so the Questions model has an EntitySet of QuestionTags with then link to Tags. My question is regarding the adding/updating of Questions (part 1), and also how to best show QuestionTags for a Question (part 2). Part 1 Before performing an add/update, my service layer needs to deal with 3 scenarios before passing to their respective repositories. Insert Tags that do not already exist Insert/Update Question Insert QuestionTags - when updating need to remove existing QuestionTags Here is my code below however started to get into a bit of a muddle. I've created extension methods on my repositories to get Tags WithNames etc. public void Add(Question q, string tags) { var tagList = tags.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries).ToList(); using (DB.TransactionScope ts = new DB.TransactionScope()) { var existingTags = TagsRepository.Get() .WithName(tagList) .ToList(); var newTags = (from t in tagList select new Tag { TName = t }).Except(existingTags, new TagsComparer()).ToList(); TagsRepository.Add(newTags); //need to insert QuestionTags QuestionsRepository.Add(q); ts.Complete(); } } Part 2 My second question is, when displaying a list of Questions how is it best to show their QuestionTags? For example, I have an Index view that shows a list of Questions in a table. One of the columns shows an image and when the user hovers over it shows the list of Tags. My current implementation is to create a custom ViewModel and show a List of QuestionIndexViewModel in the View. QuestionIndexViewModel { Question Question { get; set; } string Tags { get; set; } } However, this seems a bit clumsy and quite a few DB calls. public ViewResult Index() { var model= new List<QuestionIndexViewModel>(); //make a call to get a list of questions //foreach question make a call to get their QuestionTags, //to be able to get their Tag names and then join them //to form a single string. return View(model); } Also, just for test purposes using SQL Profiler, I decided to iterate through the QuestionTags entity set of a Question in my ViewModel however nothing was picked up in Profiler? What would be the reason for this?

    Read the article

  • When is the onPreExecute called on an AsyncTask running parallely or concurrently?

    - by Debarshi Dutta
    I am using Android HoneyComb.I need to execute some tasks parallely and I am using AsyncTask's public final AsyncTask executeOnExecutor (Executor exec, Params... params) method.In each separate thread I am computing some values and I need to store then in an ArrayList.I must then sort all the values in the arrayList and then display it in the UI.Now my question is if one of the thread gets completed earlier than the other then will it immediately call the onPostExecute method or onPostExecute method will be called after all the background threads have been completed?MY program implementation depends on what occurs here.

    Read the article

  • polymorphism, inheritance in c# - base class calling overridden method?

    - by Andrew Johns
    This code doesn't work, but hopefully you'll get what I'm trying to achieve here. I've got a Money class, which I've taken from http://www.noticeablydifferent.com/CodeSamples/Money.aspx, and extended it a little to include currency conversion. The implementation for the actual conversion rate could be different in each project, so I decided to move the actual method for retrieving a conversion rate (GetCurrencyConversionRate) into a derived class, but the ConvertTo method contains code that would work for any implementation assuming the derived class has overriden GetCurrencyConversionRate so it made sense to me to keep it in the parent class? So what I'm trying to do is get an instance of SubMoney, and be able to call the .ConvertTo() method, which would in turn use the overriden GetCurrencyConversionRate, and return a new instance of SubMoney. The problem is, I'm not really understanding some concepts of polymorphism and inheritance yet, so not quite sure what I'm trying to do is even possible in the way I think it is, as what is currently happening is that I end up with an Exception where it has used the base GetCurrencyConversionRate method instead of the derived one. Something tells me I need to move the ConvertTo method down to the derived class, but this seems like I'll be duplicating code in multiple implementations, so surely there's a better way? public class Money { public CurrencyConversionRate { get { return GetCurrencyConversionRate(_regionInfo.ISOCurrencySymbol); } } public static decimal GetCurrencyConversionRate(string isoCurrencySymbol) { throw new Exception("Must override this method if you wish to use it."); } public Money ConvertTo(string cultureName) { // convert to base USD first by dividing current amount by it's exchange rate. Money someMoney = this; decimal conversionRate = this.CurrencyConversionRate; decimal convertedUSDAmount = Money.Divide(someMoney, conversionRate).Amount; // now convert to new currency CultureInfo cultureInfo = new CultureInfo(cultureName); RegionInfo regionInfo = new RegionInfo(cultureInfo.LCID); conversionRate = GetCurrencyConversionRate(regionInfo.ISOCurrencySymbol); decimal convertedAmount = convertedUSDAmount * conversionRate; Money convertedMoney = new Money(convertedAmount, cultureName); return convertedMoney; } } public class SubMoney { public SubMoney(decimal amount, string cultureName) : base(amount, cultureName) {} public static new decimal GetCurrencyConversionRate(string isoCurrencySymbol) { // This would get the conversion rate from some web or database source decimal result = new Decimal(2); return result; } }

    Read the article

  • Most interesting and challenging programming tasks

    - by dsimcha
    Some programmers enjoy optimizing code to make the implementation as fast as humanly possible; or golfing to make code as compact as possible. Others enjoy metaprogramming to make code generic, or designing algorithms to be asymptotically efficient. What do you find most interesting and challenging as a programmer?

    Read the article

  • Is there any open source AI engine?

    - by Andrei Savu
    I am searching for an open source AI engine implemented in C/C++, ActionScript or Java with no success. Do you know any open source implementation? Update: Thanks for answers! I had no idea how vast the AI field is. I am working on a sample application. I want to add intelligent behavior over a physics engine. I need some sort ai engine designed for games.

    Read the article

  • List DOM Documents attributes and methods using Javascript

    - by EddyR
    Just wondering if it's possible to print and list all methods and attributes available to the DOM document itself using Javascript? So I would get something like so: Document.doctype Document.implementation Document.documentElement Document.createElement Document.createDocumentFragment Document.createTextNode Document.createComment Document.createProcessingInstruction etc... etc... I want to do this to test on different browsers and not have to wade through mountains technical documents from each vendor to get accurate information.

    Read the article

  • Why does C# allow abstract class with no abstract members?

    - by fatcat1111
    The C# spec, section 10.1.1.1, states: An abstract class is permitted (but not required) to contain abstract members. This allows me to create classes like this: public abstract class A { public void Main() { // it's full of logic! } } This is really a concrete class; it's only abstract in so far as one can't instantiate it. If inheritors don't actually have to provide implementation, then why call it abstract?

    Read the article

  • Spring MVC -> Wicket Integration

    - by Jeff
    Hey everyone, I'm working on porting part of an existing Spring MVC application over to Wicket. I used the wicket-spring library to get the initial integration working, but now I'm stuck with the best way to integrate my Spring Security implementation. I was wondering if anyone could give me some advice on the best way to handle this. Thanks in advance for the help.

    Read the article

  • How to implement scrolling content widget

    - by alokswain
    Example website is http://www.wikihow.com/Main-Page, check the "Recent Changes" heading on the right side. I am really amazed with the implementation of such scroll bars. Google also uses something very similar to this. Can someone give me some idea how to do this using jquery.

    Read the article

  • Another warning question: "Incompatible intiger to pointer conversion assigning to 'int *' from 'int'"

    - by Preston
    I have yet another pesky warning I would like gone. Basically, I have an int declared like this: @property (nonatomic, assign) int *myInt; and set like this: myInt = 0;. It is also synthesized in the implementation file. I am getting a warning on the line where I set the int's value and it says "Incompatible intiger to pointer conversion assigning to 'int *' from 'int'." What should I do to fix this?

    Read the article

  • What to choose.... web service or WCF in asp.net 3.5

    - by HotTester
    The current project i am working on is extensively using web services and is made in .net 3.5. Now as we are going for implementation of second phase we are confused if we should either use WCF or web service as done previously ? Further is there anything new that can be useful and is coming up with .net 4.0 regarding web services or WCF. Thanks in advance. A good link for this is here.

    Read the article

  • How do you hook a C++ compiled dll function to a sql database?

    - by Thomas
    I want to do something like: lastName SIMILARTO(lastName, 'Schwarseneger', 2) where lastName is the field in the database, 'Schwarseneger' is the value that lastName field is being compared to and 2 is the maximum number of characters (edit distance) that can differ between the lastName field, and the entered value. I can implement the SIMILARTO function in C++ using the Levenshtein distance (http://en.wikipedia.org/wiki/Levenshtein_distance), but how do hook the function in a dll to a mySQL implementation?

    Read the article

  • Java - PriorityQueue vs sorted LinkedList

    - by msr
    Hello, Which implementation is less "heavy": PriorityQueue or a sorted LinkedList (using a Comparator)? I want to have all the items sorted. The insertion will be very frequent and ocasionally I will have to run all the list to make some operations. Thank you!

    Read the article

  • How to edit an default Xcode template?

    - by HelloMoon
    When I create an NSObject subclass, I always get an empty implementation. There are some things I always put in my code like pragma marks and -dealloc methods. I prefer to just delete stuff that I don't need over writing it with typos from scratch every time I need it. I need -dealloc and -init almost always, but they don't ship with the default template. Is there a way to customize what's in there?

    Read the article

  • Check if a thread exists by it handle

    - by SaCi
    When I create a thread I save it handle in a list. After a time I want to check which of them still exists. I'm not looking for other kind of implementation, I want to know if is there some how to get a thread by it handle ?

    Read the article

  • PHP codinh in real world

    - by user261002
    I know how to write program in PHP and implementation of MVC model. but I really want to practice coding like the coding in real world??? I was wondering is there any specific example or book which can show me the tricks or logic and the way professional programmers consider about coding???

    Read the article

< Previous Page | 126 127 128 129 130 131 132 133 134 135 136 137  | Next Page >