Search Results

Search found 4934 results on 198 pages for 'finding'.

Page 35/198 | < Previous Page | 31 32 33 34 35 36 37 38 39 40 41 42  | Next Page >

  • finding middle element of an array

    - by senthil
    Hi all, I came cross a question in my interview. Question: Array of integers will be given as the input and you should find out the middle element when sorted , but without sorting. For Example. Input: 1,3,5,4,2 Output: 3 When you sort the given input array, it will be 1,2,3,4,5 where middle element is 3. You should find this in one pass without sorting. Any solutions for this?

    Read the article

  • finding last loop through a jQuery object

    - by DA
    Sample jquery. Assume $cog is a cached selector of multiple items. $cog.fadeOut('slow',function(){ alert('hey'); }) In that example, of $cog is a jQuery object of 4 DOM elements, the above will fade each element out one by one, and trigger an alert each time on the callback (4 alerts). I'd like to only call the alert when all 4 elements are done with their fadeOut function. This: $cog.fadeOut('slow',function(){ }) alert('hey'); when run, will show an alert, then the $cog elements disappear (I'm guessing due to timing issues with the fadeOut animation) Is there a way when calling a function against multiple DOM objects in a jQuery object to know when it's done with the last item?

    Read the article

  • Finding object count where a field is unique in Django

    - by Johnd
    I have a model that is something like this: class Input(models.Model): details = models.CharField(max_length=1000) user = models.ForeignKey(User) class Case(Input): title = models.CharField(max_length=200) views = models.IntegerField() class Argument(Input): case = models.ForeignKey(Case) side = models.BooleanField() A user can submit many arguments, per case. I want to be able to say how many users have submitted side=true arguments. I mean if 1 user had 10 arguments and another user had 2 arguments (both side=true) I'd want the count to be 2, not 12.

    Read the article

  • Architecture of finding movable geotagged objects

    - by itsme
    I currently have a Postgres DB filled with approx. 300.000 data-sets of moving vehicles all over the world. My very frequently repeated query is: Give me all vehicles in a 5/10/20mile radius. Currently I spend around 600 to 1200 ms in the DB to prepare the set of located vehicle-objects. I am looking to vastly improve this time by ideally one or two orders of magnitude if possible. I am working in a Ruby on Rails 3.0beta environment if this is relevant. Any ideas how to architect the whole system to accelerate this query? Any NoSQL database able to deliver this kind of geolocation performance? I know of MongoDB working on an extension to facilitate this scenario but haven't tried it yet. Any intelligent use of Redis to achieve this? One problem with SQL-DBs here seems to be that I can't possibly use indexes because my vehicles are mostly moving around, meaning I had to constantly created DB indexes which, by itself, is probably more expensive than just doing the searching without index. Looking forward to your thoughs, Thanks!

    Read the article

  • Finding users near other user

    - by Bunny Rabbit
    what algorithms should I explore to implement a feature which lets a user find other user located near him , the latitude and the longitudes of all the user are known in advance and are fixed [not dynamic]. Also i believe that there should be a better way to store such data then simply storing the lat , long of the user against his user id in a database.What are the efficient ways to handle this ?

    Read the article

  • Finding records when using has_many through associations

    - by winter sun
    I have two models, Worker and Project, and they are connected with has_many through association. I manage to find all the projects which are related to a specific worker by writing the following code: worker=Worker.find_by_id("some_id") worker.projects but I want the projects that I get to be only active projects (in the project model I have a status field) I tried to do something like worker.projects(:status_id=>'active') but it didn’t work for me. Can somebody tell me how I can do this?

    Read the article

  • SQL Reporting Services: Finding the folder a report is in

    - by Bob
    Hi there, If I have the report name how can I programmatically get the name of the project/folder the report is in? So for example if I have a report like so http://server/Reports/Pages/Report.aspx?ItemPath=/ReportProject1/ReportName Given "ReportName" how can I figure out that the report is in the folder "ReportProject1"? So I guess is there a function where I can pass int he report name and get it's details or else query the report server for a list of its report folders and I can loop through these and check some how that the report is inside?

    Read the article

  • Finding occurrences of element before and after the element in Array

    - by user3718040
    I am writing a algorithm, if an array contain 3 does not contain between two 1s. like this int array={5, 2, 10, 3, 15, 1, 2, 2} the above array contain 3, before 3 there is no 1 and after 3 is one 1 it should return True. int array={3,2,18,1,0,3,-11,1,3} in this array after first element of 3 there is two 1 it should return False. I have try following code public class Third { public static void main(String[] args){ int[] array = {1,2,4,3, 1}; for(int i=0;i<array.length;i++) { if(array[i]==3) { for(int j=0;j<array[i];j++) { if(array[j]==1) { System.out.println("I foud One before "+array[j]); }else { break; } System.out.println("yes i found the array:"+array[i]); } for(int z=0;z>array[i];z++) { if(array[z]==1) { System.out.println("I found after 3 is :"+array[z]); } break; } } } } } I am not getting exact result from my above code which i want.

    Read the article

  • Finding data file location while using Microsoft Test Framework

    - by Nair
    I have been using NUnit and now I am switching to the Microsoft Unit Test frame work. In my test project I have a folder called TestData and I kept all my test input data files there. I want to use that files for my unit testing. In my test code, I am using Application name space and assembly name space but I can not get to the data folder directly until unless I write a code to find and replace some string to point to the data folder. I am sure someone might have run into the same problem, is the solution to change the path through program or is there a API call which will let us get to executing assembly folders? Thanks,

    Read the article

  • Finding the Largest and Smallest Integers In A Set- Basic

    - by Ka112324
    I'm kind of on the right track, however my output is not quite right. The program asks for the number of integers you have and then it asks for those numbers. For an example is says please enter the number of integers, you can put 3. And then you enter 3 numbers. I can't use arrays because I am a beginner student and we have not learned those yet. Using count is the only way that allows me to input integers. What do I need to add to my program? Again I am a general computer science student so I can't use anything advanced. I used include iostream, namespace int main and all that you just cant see it int data; int num; int count=0; int max=0; do { cout<<"Enter the number of intergers"<<endl; cin>>num; while (count<num) { cout<<"Please enter a number"<<endl; cin>>data; count++; if (data<min) { min=data; } if (data>max) { max=data; } } cout<<"Smallest integer:"<<min<<endl; cout<<"Largest integer:"<<max<<endl; cout<<"Would you like to continue?"<<endl; cin>>ans; } while ((ans=='y')||(ans=='Y')); return 0; }

    Read the article

  • Finding ASP.NET MVC User Control

    - by Dave
    I'm creating a custom ActionResult class and I need it to be able to operate on a UserControl. All of the examples I've found so far pass in the full path like so: return MyResult("~/ControllerName/UserControlName.ascx", myModel); But I'd like it to operate the same way as calling View(), i.e. I just pass in the name and MVC determines the correct route: return MyResult("UserControlName", myModel); Is there a way I can find out the correct route to the control without specifying it manually?

    Read the article

  • Finding whether a value is equal to the value of any array element in MATLAB

    - by James
    Hi, Can anyone tell me if there is a way (in MATLAB) to check whether a certain value is equal to any of the values stored within another array? The way I intend to use it is to check whether an element index in one matrix is equal to the values stored in another array (where the stored values are the indexes of the elements which meet a certain criteria). So, if the indices of the elements which meet the criteria are stored in the matrix below: criteriacheck = [3 5 6 8 20]; Going through the main array (called array) & checking if the index matches: for i = 1:numel(array) if i == 'Any value stored in criteriacheck' ... "Do this" end Does anyone have an idea of how I might go about this? Thanks in advance

    Read the article

  • Finding simultaneous events in a database between times

    - by Tots
    I have a database that stores phone call records. Each phone call record has a start time and an end time. I want to find out what is the maximum amount of phone calls that are simultaneously happening in order to know if we have exceed the amount of available phone lines in our phone bank. How could I go about solving this problem?

    Read the article

  • Finding records within a 5 min time interval in SQL

    - by Mellonjollie
    I have a table with over 100,000 rows that contain the following columns: ID, Time, and Boolean. The time column tracks time down to the second. I need a query that will find all instances of Boolean = 1 for every 5 minute interval of time from the start of the table to the end, then group the count by time interval. The table represents 4 hours of data, so I should get 48 rows of results. I'm using MS SQL Server. I've tried a few approaches, but the time interval logic is giving me a hard time.

    Read the article

  • Algorithm for finding all paths in a NxN grid

    - by Periastron
    Imagine a robot sitting on the upper left hand corner of an NxN grid. The robot can only move in two directions: right and down. How many possible paths are there for the robot? I could find solution to this problem on Google, but I am not very clear with the explanations. I am trying to clearly understand the logic on how to solve this and implement in Java. Any help is appreciated. Update: This is an interview question. For now, I am trying to reach the bottom-right end and print the possible paths.

    Read the article

  • jQuery finding 'nth-child' value

    - by Rich
    Hi, I have a ul set up as navigation, which I'll be animating on hover. As all the nav items are different widths, I'll be storing their default widths in an Array, so that on hover out, these widths can be passed back in to the animate method. What I need is a way to find what 'nth-child' the element is in order to retrieve the correct width from the array. Something like: var count = $(this).count(); //obviously this isn't right! So that then I can do: $(this).animate({'width':array(count)}, 400); Any suggestions would help me a lot - and if there's a better way to do this kind of thing I'd gladly accept pointers!

    Read the article

< Previous Page | 31 32 33 34 35 36 37 38 39 40 41 42  | Next Page >