Search Results

Search found 18841 results on 754 pages for 'path finding'.

Page 90/754 | < Previous Page | 86 87 88 89 90 91 92 93 94 95 96 97  | Next Page >

  • Finding minimum value in a Map

    - by Sunny
    I have a map and I want to find the minimum value (right hand side) in the map. Right now here is how I did it bool compare(std::pair<std::string ,int> i, pair<std::string, int> j) { return i.second < j.second; } //////////////////////////////////////////////////// std::map<std::string, int> mymap; mymap["key1"] = 50; mymap["key2"] = 20; mymap["key3"] = 100; std::pair<char, int> min = *min_element(mymap.begin(), mymap.end(), compare); std::cout << "min " << min.second<< " " << std::endl; This works fine and I'm able to get the minimum value the problem is when I put this code inside my class it doesn't seem to work int MyClass::getMin(std::map<std::string, int> mymap) { std::pair<std::string, int> min = *min_element(mymap.begin(), mymap.end(), (*this).compare); //error probably due to this return min.second; } bool MyClass::compare( std::pair<std::string, int> i, std::pair<std::string, int> j) { return i.second < j.second; } Also is there a better solution not involving to writing the additional compare function

    Read the article

  • Finding comma separated values with a colon delimiter

    - by iconMatrix
    I am setting values in my database for tourneyID,Selected,Paid,Entered,date then separating each selection with a colon So I have a string that may look like this 187,S,,,09-21-2013:141,S,,,06-21-2013:144,S,,,05-24-2013 but it also could look like this 145,S,,,07-12-2013:142,S,,,05-24-2013:187,S,,,09-21-2013 and some times is looks like this 87,S,,,07-11-2013:125,S,,,06-14-2013 I am trying to find this sequence: 187,S,,,09-21-2013 I have data stored like that because I paid a programmer to code it for me. Now, as I learn, I see it was not the best solution, but it is what I have till I learn more and it is working. My problem is when using LIKE it returns both the 187 and 87 values $getTeams = mysql_query("SELECT * FROM teams WHERE (team_tourney_vector LIKE '%$tid,S,P,,$tourney_start_date%' OR team_tourney_vector LIKE '%$tid,S,,,$tourney_start_date%') AND division='$division'"); I tried this using FIND_IN_SET() but it would only return the the team id for this string 187,S,,,09-21-2013:141,S,,,06-21-2013:144,S,,,05-24-2013 and does not find the team id for this string 145,S,,,07-12-2013:142,S,,,05-24-2013:187,S,,,09-21-2013 SELECT * FROM teams WHERE FIND_IN_SET('187',team_tourney_vector) AND (team_tourney_vector LIKE '%S,,,09-21-2013%') Any thoughts on how to achieve this?

    Read the article

  • Controlling youtube traffic path ingoing to multihoming network

    - by Hamdy Ali
    Scenario: I've network multihoming (dual ISP) setup. each ISP bandwidth 500Mbps Currently ISP-A link bandwidth almost fully utilized then the second ISP-B link From our investigation, it is because youtube server cache response to link ISP-A. Some time the utilization of link ISP B increased because at that time youtube server cached is response to ISP B. My question how/Why did this happen? how do I force youtube cache server using ISP link B?

    Read the article

  • finding the numbers in a given range?

    - by Jamis
    Hi Friends, kindly tel me the concept to write a perl program behind this ? 167 GATCAAAATACTTGCTGGA 185 192 TAGTAGATAGATAGATAGTAGTAG 228 in a fileA i ve a range from 167 to 185 as given as above and also 192 to 228 in another fileB i ve set of numbers 2 3 4 5 6 7 8 168 169 179 185 193 1000 now from the above set of numbers in file B, i need to find out which are the numbers present between the range of 167 to 185 and print those numbers in the output. so, output will be 168,169,179,185, 193 what will be the concept behind writing this program?

    Read the article

  • Finding 'free' times in MySQL

    - by James Inman
    Hi, I've got a table as follows: mysql> DESCRIBE student_lectures; +------------------+----------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------------+----------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | course_module_id | int(11) | YES | MUL | NULL | | | day | int(11) | YES | | NULL | | | start | datetime | YES | | NULL | | | end | datetime | YES | | NULL | | | cancelled_at | datetime | YES | | NULL | | | lecture_type_id | int(11) | YES | | NULL | | | lecture_id | int(11) | YES | | NULL | | | student_id | int(11) | YES | | NULL | | | created_at | datetime | YES | | NULL | | | updated_at | datetime | YES | | NULL | | +------------------+----------+------+-----+---------+----------------+ I'm essentially wanting to find times when a lecture doesn't happen - so to do this I'm thinking a query to group overlapping lectures together (so, for example, 9am-10am and 10am-11am lectures will be shown as a single 9am-11am lecture). There may be more than two lectures back-to-back. I've currently got this: SELECT l.start, l2.end FROM student_lectures l LEFT JOIN student_lectures l2 ON ( l2.start = l.end ) WHERE l.student_id = 1 AND l.start >= '2010-04-26 09:00:00' AND l.end <= '2010-04-30 19:00:00' AND l2.end IS NOT NULL AND l2.end != l.start GROUP BY l.start, l2.end ORDER BY l.start, l2.start Which returns: +---------------------+---------------------+ | start | end | +---------------------+---------------------+ | 2010-04-26 09:00:00 | 2010-04-26 11:00:00 | | 2010-04-26 10:00:00 | 2010-04-26 12:00:00 | | 2010-04-26 10:00:00 | 2010-04-26 13:00:00 | | 2010-04-26 13:15:00 | 2010-04-26 16:15:00 | | 2010-04-26 14:15:00 | 2010-04-26 16:15:00 | | 2010-04-26 15:15:00 | 2010-04-26 17:15:00 | | 2010-04-26 16:15:00 | 2010-04-26 18:15:00 | ...etc... The output I'm looking for from this would be: +---------------------+---------------------+ | start | end | +---------------------+---------------------+ | 2010-04-26 09:00:00 | 2010-04-26 13:00:00 | | 2010-04-26 13:15:00 | 2010-04-26 18:15:00 | Any help appreciated, thanks!

    Read the article

  • Return current web path in PHP

    - by BenTheDesigner
    Hi All Currently developing a PHP framework and have ran into my first problem. I need to be able to drop the framework into any folder on a server, no matter how many folders deep, and need to find that directory to use as a base URL. For example, it currently works if I put the framework in the root of the server (http://cms.dev/), but if I were to put it in http://cms.dev/folder/ it does not work. Please advise, any comments welcome. BenTheDesigner

    Read the article

  • Finding which element is clicked in the DOM

    - by Bhupi
    The question was asked to me in an interview. How to find which element is clicked by the user in the DOM using JQuery or Javascript or Both? NOTE: User can click on any element in the DOM whether it is an img, div or even span. If you can suggest some example then it will be very much helpful. Thanks in advance

    Read the article

  • SQL finding overlapping of times pass midnight (across 2 days)

    - by janechii
    Hi everyone, I know there are lots of these types of questions, but i didn't see one that was similar enough to my criteria. So i'd like to ask for your help please. The fields i have are just start and end which are of time types. I cannot involve any specific dates in this. If the time ranges don't go pass midnight across day, i'd just compare two tuples as such: end1 > start2 AND start1 < end2 (end points touching are not considered overlapped here.) But when I involve time range that pass (or at) midnight, this obviously doesn't work. For example, given: start | end --------+-------- 06:00PM | 01:00AM 03:00PM | 09:00PM Without involving dates, how can i achieve this, please. My assumption is, if end is less than start, then we're involving 2 days. I'm trying to do this in plain standard SQL, so just a simple and concise logic in the WHERE clause. Thank you everyone!

    Read the article

  • jQuery: Finding file size and adding it to the link

    - by Ricardo
    Let me start by saying that I'm not a jQuery guru by any means and I genuinely know this is over my head, that's why I've come to SO. Is there a way with jQuery to find the file size of a link on a page and then inject/add the text of the file size next to the link? Here's my problem On one of my pages, I have a link to my resume which is a PDF file and to improve usability it's proper to have the file type and file size next to the link so the users have the option to decide if they want to click on that link or not. So the link would read something like "Download my resume (PDF / 80KB)" The problem is that I'm constantly updating my resume and uploading a new PDF file which, of course, has a different file size so I'm always going back to the HTML and changing the text to reflect the new file size. Is there a way to automate this with jQuery... or plain JavaScript for that matter? I found this script and made a demo here in Codepen but it doesn't seem to work. Any help with this would be greatly appreciated.

    Read the article

  • Context path routing in Tomcat ( service swapping )

    - by jojovilco
    Here is what I would like to achieve: I have a web service A which I want to be able to deploy side by side with other web services of type A - different version(s). For now I assume 2 instances side by side. I need it because the service has a warm up stage, which takes some time to build up stuff from DB and only after it is ready it can start serving requests ... I was thinking to deploy to Tomcat context paths like: "/ServiceA-1.0", "/ServiceA-2.0" and then have a "virtual" context like "/ServiceA" which will point to the desired physical service e.g. "/ServiceA-1.0". So external world will know about ServiceA, but internally, my ServiceA related stack would know about versioned ServiceA url ( there are more components involved but only ServiceA is serving outer world ). When new service is ready, I would just reconfigure the "virtual" context to point to a new service. So far, I was not able to find out how to do this with Tomcat and starting to tkink it is not possible. I found suggestions to place Apache Server in front of Tomcat and do the routing there, but I do not want to enroll another piece of software unless necessary. My questions are: - is this kind of a "virtual" context and routing possible to do with Tomcat? - any other options, wisdom and lessons learned how to achieve this kind of service swapping scenario? Best, Jozef

    Read the article

  • C++ LoadLibrary() from the current path

    - by gillyb
    Hey, I'm a .net developer mostly, doing something small in C++ so im having a little trouble. I'm loading another C++ dll using hInst = LoadLibrary(TEXT("mydll.dll")); and I came to realize that this looks for the dll I'm trying to load in 'C:\' or in 'system32'. Can someone show me how to load the dll from the current directory (without knowing what the current directory is ahead of time) ?? I know I should be using something like GetFullPathName but I'm having a little trouble getting it to work on my own...

    Read the article

  • android get URL path

    - by Tom91136
    I've got a string: public://imageifarm/3600.jpg How can I extract the imageifarm/3600.jpg Part out using android? What I've tried so far: URL drupalQuestionNodeImageURI = new URL("public://imageifarm/3600.jpg"); Log.d("TAG", drupalQuestionNodeImageURI.getPath()); but it throws this exception: 09-16 17:24:39.992: W/System.err(3763): java.net.MalformedURLException: Unknown protocol: public How can I solve this? I know I can use regular expressions but that seems to defeat the purpose of URL(URI) in this case.

    Read the article

  • 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

  • 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 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

  • 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

< Previous Page | 86 87 88 89 90 91 92 93 94 95 96 97  | Next Page >