Search Results

Search found 5881 results on 236 pages for 'junction points'.

Page 23/236 | < Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >

  • What is wrong with my logic for the divide and conquer algorithm for Closest pair problem?

    - by Programming Noob
    I have been following Coursera's course on Algorithms and came up with a thought about the divide/conquer algorithm for the closest pair problem, that I want clarified. As per Prof Roughgarden's algorithm (which you can see here if you're interested): For a given set of points P, of which we have two copies - sorted in X and Y direction - Px and Py, the algorithm can be given as closestPair(Px,Py): Divide points into left half - Q, and right half - R, and form sorted copies of both halves along x and y directions - Qx,Qy,Rx,Ry Let closestPair(Qx,Qy) be points p1 and q1 Let closestPair(Rx,Ry) be p2,q2 Let delta be minimum of dist(p1,q1) and dist(p2,q2) This is the unfortunate case, let p3,q3 be the closestSplitPair(Px,Py,delta) Return the best result Now, the clarification that I want is related to step 5. I should say this beforehand, that what I'm suggesting, is barely any improvement at all, but if you're still interested, read ahead. Prof R says that since the points are already sorted in X and Y directions, to find the best pair in step 5, we need to iterate over points in the strip of width 2*delta, starting from bottom to up, and in the inner loop we need only 7 comparisions. Can this be bettered to just one? How I think is possible seemed a little difficult to explain in plain text, so I drew a diagram and wrote it on paper and uploaded it here: Since no one else came up with is, I'm pretty sure there's some error in my line of thought. But I have literally been thinking about this for HOURS now, and I just HAD to post this. It's all that is in my head. Can someone point out where I'm going wrong?

    Read the article

  • Sorting a list of variable length integers delimited by decimal points...

    - by brewerdc
    Hey guys, I'm in need of some help. I have a list of delimited integer values that I need to sort. An example: Typical (alpha?) sort: 1.1.32.22 11.2.4 2.1.3.4 2.11.23.1.2 2.3.7 3.12.3.5 Correct (numerical) sort: 1.1.32.22 2.1.3.4 2.3.7 2.11.23.1.2 3.12.3.5 11.2.4 I'm having trouble figuring out how to setup the algorithm to do such a sort with n number of decimal delimiters and m number of integer fields. Any ideas? This has to have been done before. Let me know if you need more information. Thanks a bunch! -Daniel

    Read the article

  • How do I get the point coords of a rotated SFML shaperect?

    - by user15498
    I am trying to get collisions of bullets working, and am using SFML. I am using code to get the position of the points of the rectangle for collisions, however I think there's a way to do this without having to get points but by simply getting the points from SFML, since the shape is a rectangle and the points are stored in that way. Is there a way to do that? Through a combination of getPoint() and getGlobalBounds() maybe? While on this topic, is it better to use shapeRects or sprites? I used to only use sprites, however with the addition of textures and more low level stuff I think it would be best to switch to using rectangles and setting their size.

    Read the article

  • MySQL: operation of summing and division ?

    - by Nick
    Alright, so I have a user table and would like to get the max value for the user with the highest amount of points divided by a score. Below is a rough idea of what I'm looking for: SELECT MAX(SUM(points)/SUM(score)) FROM users I'm not interested in adding up both columns and dividing, rather I'm interested in dividing the points and score for each user and retrieve the highest value out of the lot.

    Read the article

  • Manually force touch points to reset in Windows 8?

    - by loyalpenguin
    Hi I developed a HTML5/JAVASCRIPT app that is supported using advertisement for the Win8 store. I just by chance happened to notice that if you touch the screen, drag your finger over the advertisement, and release your finger on top of the advertisement that the specific touch is not released and instead when you touch again it registers as a separate touch. This has caused my app to behave expectantly when the user interacts with the app using touch. I wanted to know if it was possible to force the touches to reset so that when the user touches the screen again it is always using "Touch(0)".

    Read the article

  • Efficient multiple services exposed over c# .NET remoting using more channels or end points?

    - by wb
    I am using remoting over TCP for a prototype distributed server application where I want to have varying multiple services exposed from each remoting server process. In some cases I want the services running from the same process but I don't want whatever is using the service to care about that. I am wondering is it more efficient to have multiple services in the same process going over the same remoting channel distinguished by endpoint URI/URL or should I be creating new channels on different ports for each service in the same process? Using up ports isn't so much of a problem as the number of services will be low and the network and machine configuration is completely controlled. Also its not clear to me if remoting sends the URI string for every single message or just at connection time, and whether if the remoting framework is intelligent enough to reduce work if calls are made on the same machine and even the same process? Thanks in advance.

    Read the article

  • How do I design a web service (microsoft) that can be consumed by multiple end points?

    - by Ben McCormack
    My company is planning to implement a solution in multiple applications that will help to validate mailing addresses at the point of data entry. We're using UPS's Extended Address Validation (XAV) web service API to validate the addresses. Our current plan is to build a .NET web service that can be used to communicate between our applications and the UPS API. We have applications in VB6, classic ASP, and .NET 2.0, so we'd like to implement a solution that can be easily consumed by each of these programming environments. What are our (Microsoft) options for designing a web service that can be consumed by multiple clients? In particular, is there a way to design a single web service that can respond with JSON (in case we want to validate our web page using javascript) in addition to XML? I'm new to designing web services and want to make sure we consider all of our options. I've heard terms like asmx, WCF, OData, etc., but I don't know which frameworks will support what we're trying to do and where to start.

    Read the article

  • What does an empty run queue entry points to?

    - by EpsilonVector
    I'm trying to figure out the technicalities of scheduling in Linux. What I can't figure out is what happens with those entries in the run_queue where there are no running processes. In the run_queue we have a bitmap, a counter, and the array of lists themselves. For a list that is empty because there are no running tasks with its priority, what do the next and prev pointers point to?

    Read the article

  • Why doesn't JFreeCharts correctly connect the points in my xy-line graph?

    - by Javajava
    /Each letter A,T,G,C represents a direction for the plot to graph. Specifically, “A” means move right, “T” is move down, “C” is move up, and “G” is move left. When the applet reads A,T,C, it plots the graph correctly. However, when I plot G, the graph is messed up. When I input "ACACACA," the graph is like a rising staircase. When I input "gtgtgt," the graph should look like a staircase, but it looks like a lightning bolt instead/ /This is all one code... i don't know why it's all split up like this:/ import java.applet.Applet; import java.awt.*; import java.awt.event.*; import java.util.Scanner.*; import java.jfree.chart.*; import java.jfree.data.xy.*; import java.jfree.chart.plot.PlotOrientation; public class If_Graph extends Applet implements ActionListener{ Panel panel; TextArea textarea, outputArea; Button move; String thetext; Scanner reader = new Scanner(System.in); String thetext2; int size,p,q; int x,y; public void init(){ setSize(500,500); //set size of applet panel = new Panel(); add(panel); setVisible(true); textarea= new TextArea(10,20); add(textarea); move=new Button("Graph"); move.addActionListener(this); add(move); } public void actionPerformed(ActionEvent e) { XYSeries series = new XYSeries("DNA Walk"); x= 0; y = 0; series.add(x,y); if(e.getSource() == move) { thetext=textarea.getText(); //the text is the DNA bases pasted thetext=thetext.replaceAll(" ",""); //removes spaces thetext2 = ""; for(int i=0; i<thetext.length(); i++) { char a = thetext.charAt(i); switch (a) { case 'A': //moves right x+=1; y+=0; series.add(x,y); break; case 'a': x+=1;y+=0; series.add(x,y); break; case 'C': //moves up x+=0; y+=1; series.add(x,y); break; case 'c': x+=0; y+=1; System.out.println(x + "," + y); series.add(x,y); break; case 'G': //move left x-=1; y+=0; series.add(x,y); System.out.println("G is: "+ x +"," +y); break; case 'g': x-=1; y+=0; System.out.println("g is: " +x + "," + y); series.add(x,y); break; case 'T': //move down x+=0; y-=1; series.add(x,y); System.out.println("T is: "+ x +"," +y); break; case 't': x+=0; y-=1; series.add(x,y); System.out.println("t is: "+ x +"," +y); break; default: // series.add(0,0); break; } } XYDataset xyDataset = new XYSeriesCollection(series); JFreeChart chart = ChartFactory.createXYLineChart ("DNA Random Walk", "", "", xyDataset, PlotOrientation.VERTICAL, true, true, false); ChartFrame frame1=new ChartFrame("DNA Random Walk",chart); frame1.setVisible(true); frame1.setSize(300,300); outputArea.setText(thetext2); } } }

    Read the article

  • Algorithm for procedural city generation?

    - by Zove Games
    I am planning on making a (simple) procedural city generator using Java. I need ideas on whan algorithm to use for the layout, and the actual buildings. The city will mostly have skyscrapers, not really much complex stuff. For the layout I already have a simple algorithm implemented: Create a Map with java.awt.Point keys and Integer values. Fill it with all the points in the city's bounds with the value as -1 (unnassigned) Shuffle the map, and assign the 1st 10 of the keys IDs (from 1-10) Loop until all points have IDs: Loop though all points: Assign points next to an assigned point IDs of the point next to them, if 2 or more points border the point, then randomly choose which ID the point will get. You will end up with 10 random regions. Make roads bordering these regions. Fill the inside of each region with a randomly spaced and randomly rotated grid PROBLEM: This is not the fastest way to do it. What algorithm should I use for the layout. And what should I use to make each building's design? I don't even know how I'm going to do that yet (fractals maybe). I just need some ideas, not actual code.

    Read the article

  • How to sum and divide in MySql [migrated]

    - by Nick
    Alright, so I have a user table and would like to get the max value for the user with the highest amount of points divided by a score. Below is a rough idea of what I'm looking for: SELECT MAX(SUM(points)/SUM(score)) FROM users I'm not interested in adding up both columns and dividing, rather I'm interested in dividing the points and score for each user and retrieve the highest value out of the lot.

    Read the article

  • Given two lines on a plane, how to find integer points closest to their intersection?

    - by Lukasz Lew
    I can't solve it: You are given 8 integers: A, B, C representing a line on a plane with equation A*x + B*y = C a, b, c representing another line x, y representing a point on a plane The two lines are not parallel therefore divide plane into 4 pieces. Point (x, y) lies inside of one these pieces. Problem: Write a fast algorithm that will find a point with integer coordinates in the same piece as (x,y) that is closest to the cross point of the two given lines. Note: This is not a homework, this is old Euler-type task that I have absolutely no idea how to approach. Update: You can assume that the 8 numbers on input are 32-bit signed integers. But you cannot assume that the solution will be 32 bit.

    Read the article

  • How can I programmatically position a view using relative points?

    - by Steve Madsen
    What is the best way to position a view relative to the size of its superview, when the bounds of the superview are not yet known? I am trying to avoid hard-coding coordinates if it is at all possible. Perhaps this is silly, and if so, that's a perfectly acceptable answer. I've run into this many times when working with custom UI. The most recent example is that I'm trying to replace the UINavigationItem plain-text title with a custom view. I want that view to fill the superview, but in addition, I want a UIActivityIndicatorView on the right side, inset about 2 pixels and centered vertically. Here's the code: - (void) viewDidLoad { [super viewDidLoad]; customTitleView = [[UIView alloc] initWithFrame:CGRectZero]; customTitleView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; titleLabel = [[UILabel alloc] initWithFrame:CGRectZero]; titleLabel.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; titleLabel.lineBreakMode = UILineBreakModeWordWrap; titleLabel.numberOfLines = 2; titleLabel.minimumFontSize = 11.0; titleLabel.font = [UIFont systemFontOfSize:17.0]; titleLabel.adjustsFontSizeToFitWidth = YES; [customTitleView addSubview:titleLabel]; spinnerView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite]; spinnerView.center = CGPointMake(customTitleView.bounds.size.width - (spinnerView.bounds.size.width / 2) - 2, customTitleView.bounds.size.height / 2); spinnerView.hidesWhenStopped = YES; [customTitleView addSubview:spinnerView]; self.navigationItem.titleView = customTitleView; [customTitleView release]; } Here's my problem: at the time that this code runs, customTitleView.bounds is still zeroes. The auto-resizing mask hasn't had a chance to do its thing yet, but I very much want those values so that I can compute the relative positions of other sub-views (here, the activity indicator). Is this possible without being ugly?

    Read the article

  • Is looking for Wi-Fi access points purely passive?

    - by Aric TenEyck
    Say I carry a Wi-Fi enabled phone or laptop through an area where there are WAPs. Assuming that I don't actively try to connect to them or otherwise interact with them, is it possible for the owner of that WAP to know that I was there? I'm asking this in the context of my earlier question: Looking for MACs on the network I was talking with a friend about my newfound ability to detect phones (and other devices with MAC addresses) on the network, and he pointed out that it might be useful to detect unknown phones on the network; I could use that data to track down anyone who was in my house and brought a Wi-Fi phone with them. So, if I set up a logging fake WAP with no security or encryption, can I glean any useful information about the devices that come into the house? Assuming that the thief doesn't actively try to connect...

    Read the article

  • How to get a float value the pointer points to?

    - by aleluja
    Hello, In my app, i've created the TList type list where i store the pointers to 1 string and 2 float(real) values for every 3 items. aList.Add(@sName); //string aList.Add(@x1); //float aList.Add(@x2); //float Then, i want to get the values out from the list, but i could only do that for string sStr := string(lList.items[i]); But i couldn't get the float values as a := real(lList...) will result in an invalid typecast error. So what do i do to get the float values? Of course i have a question if that string casting will actually give me the string value. I'm not good at pointer stuff so i don't know how to do it.

    Read the article

  • Many user stories share the same technical tasks: what to do?

    - by d3prok
    A little introduction to my case: As part of a bigger product, my team is asked to realize a small IDE for a DSL. The user of this product will be able to make function calls in the code and we are also asked to provide some useful function libraries. The team, together with the PO, put on the wall a certain number of user stories regarding the various libraries for the IDE user. When estimating the first of those stories, the team decided that the function call mechanism would have been an engaging but not completely obvious task, so the estimate for that user story raised up from a simple 3 to a more dangerous 5. Coming to the problem: The team then moved to the user stories regarding the other libraries, actually 10 stories, and added those 2 points of "function call mechanism" thing to each of those user story. This immediately raised up the total points for the product of 20 points! Everyone in the team knows that each user story could be picked up by the PO for the next iteration at any time, so we shouldn't isolate that part in one user story, but those 20 points feel so awfully unrealistic! I've proposed a solution, but I'm absolutely not satisfied: We created a "Design story" and put those annoying 2 points over it. However when we came to realize and demonstrate it to our customers, we were unable to show something really valuable for them about that story! Here the problem is whether we should ignore the principle of having isolated user stories (without any dependency between them). What would you do, or even better what have you done, in situations like this? (a small foot-note: following a suggestion I've moved this question from stackoverflow)

    Read the article

  • How do I use cvs to compare two points in time on a branch?

    - by andrewducker
    I can use something like: cvs.exe rdiff -D2010-03-23 -D2010-03-24 -s "ProjectName" to get the changes which occurred on the 23rd. But I want to get the changes that were checked in on the 23rd on a specified branch - and if I add in a -v branchv1-0-0-0 into that it tells me I can't have more than two dates/revisions in one query. Any suggestions?

    Read the article

  • Where can I find an array of the unassigned Unicode code points for a particular block?

    - by gitparade
    At the moment, I'm writing these arrays by hand. For example, the Miscellaneous Mathematical Symbols-A block has an entry in hash like this: my %symbols = ( ... miscellaneous_mathematical_symbols_a => [(0x27C0..0x27CA), 0x27CC, (0x27D0..0x27EF)], ... ) The simpler, 'continuous' array miscellaneous_mathematical_symbols_a => [0x27C0..0x27EF] doesn't work because Unicode blocks have holes in them. For example, there's nothing at 0x27CB. Take a look at the code chart [PDF]. Writing these arrays by hand is tedious, error-prone and a bit fun. And I get the feeling that someone has already tackled this in Perl!

    Read the article

  • Where can I find an array of the (un)assigned Unicode code points for a particular block?

    - by gitparade
    At the moment, I'm writing these arrays by hand. For example, the Miscellaneous Mathematical Symbols-A block has an entry in hash like this: my %symbols = ( ... miscellaneous_mathematical_symbols_a => [(0x27C0..0x27CA), 0x27CC, (0x27D0..0x27EF)], ... ) The simpler, 'continuous' array miscellaneous_mathematical_symbols_a => [0x27C0..0x27EF] doesn't work because Unicode blocks have holes in them. For example, there's nothing at 0x27CB. Take a look at the code chart [PDF]. Writing these arrays by hand is tedious, error-prone and a bit fun. And I get the feeling that someone has already tackled this in Perl!

    Read the article

  • Switching to Java from C++: What are the key points?

    - by Roddy
    I'm an experienced developer, but most of my OO programming experience has been with C++ (and a little Delphi). I'm considering doing some Android work, hence Java. Coming from the C++ background, what areas of Java are most likely to surprise/annoy/delight me? I felt sure this would already have been asked, but my searches haven't turned up a similar question. CW, of course.

    Read the article

  • How do I define a foreign key that points to a class of a different name in ActiveRecord with Rails?

    - by Mark
    Hi there, I have a model Follow that defines a user_id and a followed_user_id. If you've used Twitter, this should make sense. I'm trying to make followed_user_id point to a User model, so I can access the user that is being followed through f.followed_user (in the same way that if I have an Entry with belongs_to :user and a user_id column I can use entry.user to get the user.) How can I do this? Thanks!

    Read the article

< Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >