Search Results

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

Page 87/754 | < Previous Page | 83 84 85 86 87 88 89 90 91 92 93 94  | Next Page >

  • Finding the sum of 2D Arrays in Ruby

    - by Bragaadeesh
    Hi, I have an array of two dimensional Arrays. I want to create a new two dimensional array which finds the sum of these values in the 2D arrays. Sum at x,y of new array = Sum at x,y of arr1 + Sum at x,y of arr2 + .... |1,2,4| |1,1,1| |1,1,1| |2,4,6| |1,1,1| |1,1,1| |2,4,6| |1,1,1| |1,1,1| |2,4,6| |1,1,1| |1,1,1| Now adding the above two dimensional arrays will result in, |3,4,6| |4,6,8| |4,6,8| |4,6,8| How to achieve this in Ruby (not in any other languages). I have written a method, but it looks very long and ugly.

    Read the article

  • Finding mySQL duplicates, then merging data

    - by Michael Pasqualone
    I have a mySQL database with a tad under 2 million rows. The database is non-interactive, so efficiency isn't key. The (simplified) structure I have is: `id` int(11) NOT NULL auto_increment `category` varchar(64) NOT NULL `productListing` varchar(256) NOT NULL Now the problem I would like to solve is, I want to find duplicates on productListing field, merge the data on the category field into a single result - deleting the duplicates. So given the following data: +----+-----------+---------------------------+ | id | category | productListing | +----+-----------+---------------------------+ | 1 | Category1 | productGroup1 | | 2 | Category2 | productGroup1 | | 3 | Category3 | anotherGroup9 | +----+-----------+---------------------------+ What I want to end up is with: +----+----------------------+---------------------------+ | id | category | productListing | +----+----------------------+---------------------------+ | 1 | Category1,Category2 | productGroup1 | | 3 | Category3 | anotherGroup9 | +----+----------------------+---------------------------+ What's the most efficient way to do this either in pure mySQL query or php?

    Read the article

  • Find telephonenumbers - finding number with and without an phone extension

    - by nWorx
    Hello there I've a table with about 130 000 records with telephonenumbers. The numbers are all formated like this +4311234567. The numbers always include international country code, local area code and then the phonenumber and sometimes an extension. There is a webservice which checks for the caller's number in the table. That service works already. But now the client wants that also if someone calls from a company which number is already in the database but not his extension, that the service will return some result. Example for table. **id** | **telephonenumber** | **name** | 1 | +431234567 | company A | 2 | +431234567890 | employee in company A | 3 | +4398765432 | company b now if somebody from company A calls with a different extension for example +43123456777, than it should return id1. But the problem is, that I don't know how many digits the extensions have. It could have 3,4 or more digits. Are there any patterns for string kind of matchings? The data is stored in a sql2005 database. Thanks

    Read the article

  • Finding good heuristic for A* search

    - by Martin
    I'm trying to find the optimal solution for a little puzzle game called Twiddle (an applet with the game can be found here). The game has a 3x3 matrix with the number from 1 to 9. The goal is to bring the numbers in the correct order using the minimum amount of moves. In each move you can rotate a 2x2 square either clockwise or counterclockwise. I.e. if you have this state 6 3 9 8 7 5 1 2 4 and you rotate the upper left 2x2 square clockwise you get 8 6 9 7 3 5 1 2 4 I'm using a A* search to find the optimal solution. My f() is simply the number of rotations need. My heuristic function already leads to the optimal solution but I don't think it's the best one you can find. My current heuristic takes each corner, looks at the number at the corner and calculates the manhatten distance to the position this number will have in the solved state (which gives me the number of rotation needed to bring the number to this postion) and sums all these values. I.e. You take the above example: 6 3 9 8 7 5 1 2 4 and this end state 1 2 3 4 5 6 7 8 9 then the heuristic does the following 6 is currently at index 0 and should by at index 5: 3 rotations needed 9 is currently at index 2 and should by at index 8: 2 rotations needed 1 is currently at index 6 and should by at index 0: 2 rotations needed 4 is currently at index 8 and should by at index 3: 3 rotations needed h = 3 + 2 + 2 + 3 = 10 But there is the problem, that you rotate 4 elements at once. So there a rare cases where you can do two (ore more) of theses estimated rotations in one move. This means theses heuristic overestimates the distance to the solution. My current workaround is, to simply excluded one of the corners from the calculation which solves this problem at least for my test-cases. I've done no research if really solves the problem or if this heuristic still overestimates in same edge-cases. So my question is: What is the best heuristic you can come up with? (Disclaimer: This is for a university project, so this is a bit of homework. But I'm free to use any resource if can come up with, so it's okay to ask you guys. Also I will credit Stackoverflow for helping me ;) )

    Read the article

  • Finding Image and Place into another img source

    - by saorabh
    My Html Markup is like this <div id="main"> <div id="slider"> <img src=""/> </div> <div class="clear slider"></div> <div class="slider ndslider"> <a href="#" rel="bookmark"> <img src="#" title=""/> </a> </div> <div class="slider rdslider"> <a href="" rel="bookmark"> <img src="" title=""/> </a> </div> <div class="slider thslider nivoSlider"> <a rel="bookmark" href="" class="nivo-imageLink" > <img src="image src" > </a> <a rel="bookmark" href="" class="nivo-imageLink"> <img title="" src=""> </a> <a rel="bookmark" href="#" class="nivo-imageLink"> <img title="" src=""> </a> <div class="nivo-slice"></div> <div class="nivo-slice"></div> <div class="nivo-slice"></div> <div class="nivo-directionNav"> <a class="nivo-prevNav">Prev</a> <a class="nivo-nextNav">Next</a> </div> <div class="nivo-controlNav"> <a rel="0" class="nivo-control active"> <img alt="" src="undefined"> </a> <a rel="1" class="nivo-control"> <img alt="" src="undefined"> </a> </div> </div> </div> I want to find the all the images inside this DIV <div class="slider thslider nivoSlider"> </div> and set that images on to this <div class="nivo-controlNav"> <a rel="0" class="nivo-control active"> <img alt="" src="undefined"> </a> </div> For Doing the same i had written my custom jQuery but it is not working. jQuery(document).ready(function() { jQuery('.thslider a img').each(function(){ var imgSrc = jQuery(this).attr('src'); var newSrc = 'http://saorabh-test1.rtcamp.info/wp-content/themes/twentyten/timthumb.php?src='+ imgSrc +' &h=50&w=50&zc=1'; jQuery(".thslider .nivo-controlNav a img").attr('src',newSrc); }); }); Help me..

    Read the article

  • Finding The DSN To My Database?

    - by Soo
    I have an SQL database and want to connect to it using VBA in order to support some legacy functionality. I'm using an ADODB connection and need to know what my database DSN is. How can I find this? I'm using SQL Server 2008, thanks! :D

    Read the article

  • Solving the problem of finding parts which work well with each other

    - by dotnetdev
    Hi, I have a database of items. They are for cars and similar parts (eg cam/pistons) work better than others in different combinations (eg one product will work well with another, while another combination of 2 parts may not). There are so many possible permutations, what solutions apply to this problem? So far, I feel that these are possible approaches (Where I have question marks, something tells me these are solutions but I am not 100% confident they are). Neural networks (?) Collection-based approach (selection of parts in a collection for cam, and likewise for pistons in another collection, all work well with each other) Business rules engine (?) What are good ways to tackle this sort of problem? Thanks

    Read the article

  • Finding latest release links on website for C++ Application

    - by Brett Powell
    Basically I have written a game plugin that will allow server admins to update their administration tools from within game rather than having to go download it and install it. The releases are updated regularly, and the beta versions are nightly builds. I am trying to find a way to grab the links from the website, but I cannot think of anyway to do this off of the top of my head. Was hoping someone here might be able to suggest something that would work. http://www.sourcemod.net/snapshots.php Thats the website, basically I am trying to grab the links for the latest stable branch, and latest development branch.

    Read the article

  • Delayed Jobs is not finding Records and failing..

    - by Trip
    In my app, delayed jobs isn't running automatically on my server anymore. It used to.. When I manually ssh in, and perform rake jobs:work I return this : * Starting job worker host:ip-(censored) pid:21458 * [Worker(host:ip-(censored) pid:21458)] acquired lock on PhotoJob * [JOB] host:ip-(censored) pid:21458 failed with ActiveRecord::RecordNotFound: Couldn't find Photo with ID=9237 - 4 failed attempts This returns roughly 20 times over for what I think is several jobs. Then I get a few of these: [Worker(host:ip-(censored) pid:21458)] failed to acquire exclusive lock for PhotoJob And then finally one of these : 12 jobs processed at 73.6807 j/s, 12 failed ... Any ideas what I should be mulling over? Thanks so much!

    Read the article

  • Finding out the version of Dojo

    - by Sandeep
    I'm kinda new to Dojo toolkit. There are certain issues which I would like to get enlightened (I googled but I didn't get any appropriate & satisfying answers) I have a dojo.js(Perhaps the uncompressed dojo.js downloaded) in my already running application (Developed by another software developer). How to find out which version of dojo.js he has downloaded and is being used right now? (Its not commented. I checked) a) While I'm trying to run my application in IE-8 (Opening a pop-up on click of a button), I get error which is pointing me to this line of code if(dojo.isIE&&window.location.protocol==="file:") Note: Its working fine in IE6 but the issue is with IE8 & to be even more specific the JS error is displayed only for the first time when I'm clicking the button. b) Is it true that dojo 1.3 & above is the best & stable release for IE8?

    Read the article

  • App.config path not correctly interpreted by ASP.NET Application

    - by seragu05
    Hello everyone ! I'm working on a very old project (2000) in VB6 which was "modernized" and upgraded to VB.NET 3.5. I've centralized every old INI configuration file into one MainApp.config, which is referenced by the app.config of every component. There's an VB ASP.NET website in the solution, which uses DLL components, which are looking into app.config for parameters like, say, error log directory, etc. I've deployed the site on my dev. server (Windows 2008 Server w/ IIS 7.0) into the D:\WebSite\ directory. Problem: When running the site, an error occurs. A DLL is looking into app.config for the parameter RepertoireErreur which has the value .\Erreurs\ Instead of returning D:\WebSite\Erreurs\ it returns c:\windows\system32\inetsrv\.\Erreurs\ which doesn't contain the Erreurs directory. Boom. Error. Does anyone have ever encountered the same problem ? Is there a solution ? Thanks,

    Read the article

  • Finding the heaviest of N objects using M scales

    - by cpprulez
    We have N objects and M scales. It's up to us what the objects are, and we need to position the objects on the scales so that it is undoubtful which is the heaviest object. For example, if we have 3 objects: "a", "b", "c" and 2 scales, one possible solution is "a" "b", "b" = "c" (here "a" is the heaviest). I need an algorithm which generates such solutions given N and M. Also let's assume that "a" is always the heaviest object. I've lost a few hours figuring out how to do it, but no matter what I figure out, there's always cases which I miss. For example, another solution is: "a" + "c" = 2 * "b", "a" "c".

    Read the article

  • Finding images on the web

    - by Britt
    I sent someone a photo of me and they replied that this particular photo was all over the web. How do I find out where this photo is and is there any way that I can see if there are other photos of myself that someoe has shared without my knowledge? I am very worried about this and want to find out where these pictures are please help me!

    Read the article

  • Finding the digit root of a number

    - by Jessica M.
    Study question is to find the digit root of a already provided number. The teacher provides us with the number 2638. In order to find the digit root you have to add each digit separately 2 + 6 + 3 + 8 = 19. Then you take the result 19 and add those two digits together 1 + 9 = 10. Do the same thing again 1 + 0 = 1. The digit root is 1. My first step was to use the variable total to add up the number 2638 to find the total of 19. Then I tried to use the second while loop to separate the two digits by using the % I have to try and solve the problem by using basic integer arithmetic (+, -, *, /). 1.Is it necessary and or possible to solve the problem using nested while loops? 2.Is my math correct? 3. As I wrote it here it does not run in Eclipse. Am I using the while loops correctly? import acm.program.*; public class Ch4Q7 extends ConsoleProgram { public void run(){ println("This program attempts to find the digit root of your number: "); int n = readInt("Please enter your number: "); int total = 0; int root = total; while (n > 0 ){ total = total + (n %10); n = (n / 10); } while ( total > 0 ){ root = total; total = ((total % 10) + total / 10); } println("your root should be " + root); } }

    Read the article

  • tomcat startup.sh trouble finding JAVA_HOME

    - by peter
    I am a bit puzzled by this strange behavior on CentOs 5.4 when starting Tomcat 6.0 as a service I've added a script at /etc/init.d/tomcat that can start/stop/restart Apache Tomcat 6.0 with user 'tomcat', and registered it as service. The problem with the service is that I am getting a 'Neither the JAVA_HOME nor the JRE_HOME environment variable is defined'. But when type 'sudo -u tomcat echo $JAVA_HOME' I get '/usr/java/jdk1.5.0_22' which is correct since I am using that JDK. What can I do about this?

    Read the article

  • get path of Array (PHP)

    - by Kawah Grafis
    i have an array input like this .. Array ( [0] => Array ( [0] => 42 ) [**42**] => Array ( [0] => 12 [1] => 14 ) [**14**] => Array ( [0] => 317 ) [317] => Array ( [0] => 319 ) [**12**] => Array ( [0] => 306 [1] => 307 ) [307] => Array ( [0] => 311 ) [306] => Array ( [0] => 309 ) ) and i want to get result array like bellow : $paths[]=array(42,12,306,309); $paths[]=array(42,12,307,311); $paths[]=array(42,14,317,319); see array input root in array input = 42 (index of array 0) 42 have child = 12, 14 12 have child = 306, 307 14 have child = 317 306 have child = 309 307 have child = 311 317 have child = 319 like this.. and output array insert into $paths $paths[0]=array(42,12,306,309); $paths[1]=array(42,12,307,311); $paths[2]=array(42,14,317,319);

    Read the article

  • Finding group maxes in SQL join result

    - by Gene
    Two SQL tables. One contestant has many entries: Contestants Entries Id Name Id Contestant_Id Score -- ---- -- ------------- ----- 1 Fred 1 3 100 2 Mary 2 3 22 3 Irving 3 1 888 4 Grizelda 4 4 123 5 1 19 6 3 50 Low score wins. Need to retrieve current best scores of all contestants ordered by score: Best Entries Report Name Entry_Id Score ---- -------- ----- Fred 5 19 Irving 2 22 Grizelda 4 123 I can certainly get this done with many queries. My question is whether there's a way to get the result with one, efficient SQL query. I can almost see how to do it with GROUP BY, but not quite. In case it's relevant, the environment is Rails ActiveRecord and PostgreSQL.

    Read the article

  • finding empty directories unix

    - by soField
    i need to find empty directories for given list of directories some directories have directories inside it if inside directories also empty i can say main directory is empty otherwise it's not empty how can i test this for example A>A1(file1),A2 this is not empty beacuse of file1 B>B1(no file) this is empty C>C1,C2 this is empty thanks

    Read the article

  • Finding the index of a given value in a pre-sorted array

    - by bobo
    Today, I went for an interview and the interviewer asked me how I would find the index of a given value (number) in a pre-sorted array like this: $preSortedArr=array(23,32,36,41,45,54); He also said that using recursion is not allowed. I think the function should look like this: function findIndexByValue($preSortedArray,$value){ //some codes here } What solution do you think he was expecting from me? EDIT: sorry, I forgot to add that, he originally asked me to write psuedo codes but I said I don't know. I tried to write in PHP, but I think he's expecting a language-independent solution.

    Read the article

  • Finding number of different paths

    - by peiska
    I have a game that one player X wants to pass a ball to player Y, but he can be playing with more than one player and the others players can pass the ball to Y. I want to know how many different paths can the ball take from X to Y? for example if he is playing with 3 players there are 5 different paths, 4 players 16 paths, if he is playing with 20 players there are 330665665962404000 paths, and 40 players 55447192200369381342665835466328897344361743780 that the ball can take. the number max. of players that he can play with is 500. I was thinking in using Catalan Numbers? do you think is a correct approach to solve this? Can you give me some tips.

    Read the article

  • Which filter of FileSystemWatcher do I need to use for finding new files

    - by BDotA
    So far I know that FileSystemWatcher can look into a folder and if any of the files inside that folder is changed,modifies,.etc... then we can handle it. But I am not sure which filter and event I should use in my scenario: Watch for a Folder, If a file is added to that folder, do XYZ ... So In my scenario I don't care if an existing file is changed,etc..those should be ignored...only do XYZ if and only if a new file has been added to that Folder... Which event and filter do you recommended for this scenario?

    Read the article

< Previous Page | 83 84 85 86 87 88 89 90 91 92 93 94  | Next Page >