Search Results

Search found 1591 results on 64 pages for 'rivers edge'.

Page 13/64 | < Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >

  • Is it bad SEO to embed an img tag in the middle of a sentence?

    - by Offlein
    I recently received a web mockup that included a sidebar with a short paragraph of narrow text; a quote from a person. At the end of the quote, the mockup had a circular portrait of the person floated to the right, hanging off the edge of the block, with the text flowing around the edge of it. It looked like this, where "TEXT" is the text, and "o" is the portrait TEXTTEXTTEXTTEXTTEX TEXTTEXTTEXTTE TEXTTEXTTEXT ooooo TEXTTEXTTEXT ooooooo TEXTTEXTTEXT ooooooo ooooo The easiest way to do this would be to put the tag for the portrait somewhere in the markup of the text, and float it right. But the HTML will look like, in that case: TEXTTEXTTE<img src="..." style="float: right;">XTTEXTTEXT and I fear this would be bad for SEO. Does anyone know? The other option is putting the at the end, absolutely positioning it, and using manual line breaks -- which sucks for my responsive design.

    Read the article

  • Plagued by multithreaded bugs

    - by koncurrency
    On my new team that I manage, the majority of our code is platform, TCP socket, and http networking code. All C++. Most of it originated from other developers that have left the team. The current developers on the team are very smart, but mostly junior in terms of experience. Our biggest problem: multi-threaded concurrency bugs. Most of our class libraries are written to be asynchronous by use of some thread pool classes. Methods on the class libraries often enqueue long running taks onto the thread pool from one thread and then the callback methods of that class get invoked on a different thread. As a result, we have a lot of edge case bugs involving incorrect threading assumptions. This results in subtle bugs that go beyond just having critical sections and locks to guard against concurrency issues. What makes these problems even harder is that the attempts to fix are often incorrect. Some mistakes I've observed the team attempting (or within the legacy code itself) includes something like the following: Common mistake #1 - Fixing concurrency issue by just put a lock around the shared data, but forgetting about what happens when methods don't get called in an expected order. Here's a very simple example: void Foo::OnHttpRequestComplete(statuscode status) { m_pBar->DoSomethingImportant(status); } void Foo::Shutdown() { m_pBar->Cleanup(); delete m_pBar; m_pBar=nullptr; } So now we have a bug in which Shutdown could get called while OnHttpNetworkRequestComplete is occuring on. A tester finds the bug, captures the crash dump, and assigns the bug to a developer. He in turn fixes the bug like this. void Foo::OnHttpRequestComplete(statuscode status) { AutoLock lock(m_cs); m_pBar->DoSomethingImportant(status); } void Foo::Shutdown() { AutoLock lock(m_cs); m_pBar->Cleanup(); delete m_pBar; m_pBar=nullptr; } The above fix looks good until you realize there's an even more subtle edge case. What happens if Shutdown gets called before OnHttpRequestComplete gets called back? The real world examples my team has are even more complex, and the edge cases are even harder to spot during the code review process. Common Mistake #2 - fixing deadlock issues by blindly exiting the lock, wait for the other thread to finish, then re-enter the lock - but without handling the case that the object just got updated by the other thread! Common Mistake #3 - Even though the objects are reference counted, the shutdown sequence "releases" it's pointer. But forgets to wait for the thread that is still running to release it's instance. As such, components are shutdown cleanly, then spurious or late callbacks are invoked on an object in an state not expecting any more calls. There are other edge cases, but the bottom line is this: Multithreaded programming is just plain hard, even for smart people. As I catch these mistakes, I spend time discussing the errors with each developer on developing a more appropriate fix. But I suspect they are often confused on how to solve each issue because of the enormous amount of legacy code that the "right" fix will involve touching. We're going to be shipping soon, and I'm sure the patches we're applying will hold for the upcoming release. Afterwards, we're going to have some time to improve the code base and refactor where needed. We won't have time to just re-write everything. And the majority of the code isn't all that bad. But I'm looking to refactor code such that threading issues can be avoided altogether. One approach I am considering is this. For each significant platform feature, have a dedicated single thread where all events and network callbacks get marshalled onto. Similar to COM apartment threading in Windows with use of a message loop. Long blocking operations could still get dispatched to a work pool thread, but the completion callback is invoked on on the component's thread. Components could possibly even share the same thread. Then all the class libraries running inside the thread can be written under the assumption of a single threaded world. Before I go down that path, I am also very interested if there are other standard techniques or design patterns for dealing with multithreaded issues. And I have to emphasize - something beyond a book that describes the basics of mutexes and semaphores. What do you think? I am also interested in any other approaches to take towards a refactoring process. Including any of the following: Literature or papers on design patterns around threads. Something beyond an introduction to mutexes and semaphores. We don't need massive parallelism either, just ways to design an object model so as to handle asynchronous events from other threads correctly. Ways to diagram the threading of various components, so that it will be easy to study and evolve solutions for. (That is, a UML equivalent for discussing threads across objects and classes) Educating your development team on the issues with multithreaded code. What would you do?

    Read the article

  • Scrolling a canvas as a shape you're moving approaches its edges

    - by Steven Sproat
    Hi, I develop a Python-based drawing program, Whyteboard. I have tools that the user can create new shapes on the canvas, such as text/images/rectangles/circles/polygons. I also have a Select tool that allows the users to modify these shapes - for example, moving a shape's position, resizing, or editing polygon's points' positions. I'm adding in a new feature where moving or resizing a point near the canvas edge will automatically scroll the canvas. I think it's a good idea in terms of program usability, and annoys me when other program's don't have this feature. I've made some good progress on coding this; below is some Python code to demonstrate what I'm doing. These functions demonstrate how some shapes calculate their "edges": def find_edges(self): """A line.""" self.edges = {EDGE_TOP: min(self.y, self.y2), EDGE_RIGHT: max(self.x, self.x2), EDGE_BOTTOM: max(self.y, self.y2), EDGE_LEFT: min(self. x, self.x2)} def find_edges(self): """An image""" self.edges = {EDGE_TOP: self.y, EDGE_RIGHT: self.x + self.image.GetWidth(), EDGE_BOTTOM: self.y + self.image.GetWidth(), EDGE_LEFT: self.x} def find_edges(self): """Get the bounding rectangle for the polygon""" xmin = min(x for x, y in self.points) ymin = min(y for x, y in self.points) xmax = max(x for x, y in self.points) ymax = max(y for x, y in self.points) self.edges = {EDGE_TOP: ymin, EDGE_RIGHT: xmax, EDGE_BOTTOM: ymax, EDGE_LEFT: xmin} And here's the code I have so far to implement the scrolling when a shape nears the edge: def check_canvas_scroll(self, x, y, moving=False): """ We check that the x/y coords are within 50px from the edge of the canvas and scroll the canvas accordingly. If the shape is being moved, we need to check specific edges of the shape (e.g. left/right side of rectangle) """ size = self.board.GetClientSizeTuple() # visible area of the canvas if not self.board.area > size: # canvas is too small to need to scroll return start = self.board.GetViewStart() # user's starting "viewport" scroll = (-1, -1) # -1 means no change if moving: if self.shape.edges[EDGE_RIGHT] > start[0] + size[0] - 50: scroll = (start[0] + 5, -1) if self.shape.edges[EDGE_BOTTOM] > start[1] + size[1] - 50: scroll = (-1, start[1] + 5) # snip others else: if x > start[0] + size[0] - 50: scroll = (start[0] + 5, -1) if y > start[1] + size[1] - 50: scroll = (-1, start[1] + 5) # snip others self.board.Scroll(*scroll) This code actually works pretty well. If we're moving a shape, then we need to know its edges to calculate when they're coming close to the canvas edge. If we're resizing just a single point, then we just use the x/y coords of that point to see if it's close to the edge. The problem I'm having is a little tricky to describe - basically, if you move a shape to the left, and stop moving it, if you positioned the shape within the 50px from the canvas, then the next time you go to move the shape, the code that says "ok, is this shape close to the end?" gets triggered, and the canvas scrolls to the left, even if you're moving the shape to the right. Can anyone think on how to stop this? I created a youtube video to demonstrate the issue. At about 0:54, I move a polygon to the left of the canvas and position it there. The next time I move it, the canvas scrolls to the left even though I'm moving it right Another thing I'd like to add, but I'm stuck on is the scroll gaining momentum the longer a shape is scrolling? So, with a large canvas, you're not moving a shape for ages, moving 5px at a time, when you need to cover a 2000px distance. Any suggestions there? Thanks all - sorry for the super long question!

    Read the article

  • Flash Media Server won't run on RHEL 6.2 EC2 instance - _defaultRoot__edge1 experienced 1 failure

    - by edoloughlin
    I've got a fresh Redhat Enterprise 6.2 64-bit instance on EC2. I've turned off the firewall and have installed an FMS 4.5 dev server. The FMS install failed, complaining about a missing libcap.so until I installed the libcap.i686 package. The following libcap packages are now installed: libcap.i686 2.16-5.5.el6 @rhui-us-east-1-rhel-server-releases libcap.x86_64 2.16-5.5.el6 @koji-override-0/$releasever libcap-ng.x86_64 0.6.4-3.el6_0.1 @koji-override-0/$releasever libpcap.x86_64 14:1.0.0-6.20091201git117cb5.el6 In the logs directory I have admin and master logs (only). The admin logs look ok: #Fields: date time x-pid x-status x-ctx x-comment 2012-02-29 09:24:26 1144 (i)2581173 FMS detected IPv6 protocol stack! - 2012-02-29 09:24:26 1144 (i)2581173 FMS config <NetworkingIPv6 enable=false> - 2012-02-29 09:24:26 1144 (i)2581173 FMS running in IPv4 protocol stack mode! - 2012-02-29 09:24:26 1144 (i)2581173 Host: ip-10-204-143-55 IPv4: 10.204.143.55 - 2012-02-29 09:24:26 1144 (i)2571011 Server starting... - 2012-02-29 09:24:26 1144 (i)2631174 Listener started ( FCSAdminIpcProtocol ) : localhost:11110/v4 - 2012-02-29 09:24:27 1144 (i)2631174 Listener started ( FCSAdminAdaptor ) : 1111/v4 - 2012-02-29 09:24:28 1144 (i)2571111 Server started (./conf/Server.xml). - I can't connect an RTMP client to the FMS. The master logs contain these lines, repeating every 5 seconds: 2012-02-29 10:43:17 1076 (i)2581226 Edge (2790) is no longer active. - 2012-02-29 10:43:17 1076 (w)2581255 Edge (2790) _defaultRoot__edge1 experienced 1 failure[s]! - 2012-02-29 10:43:17 1076 (i)2581224 Edge (2793) started, arguments : -edgeports ":1935,80" -coreports "localhost:19350" -conf "/opt/adobe/fms/conf/Server.xml" -adaptor "_defaultRoot_" -name "_defaultRoot__edge1" -edgename "edge1". -

    Read the article

  • File download speed issue over a dedicated fibre link

    - by nixnotwin
    My ISP has installed a fibre based dedicated internet connection at the place where I work. In the beginning the connection terminated at one of the ISP's core routers. It resulted in a strange issue. Eventhough the assigned speed was 5mbps, when tests were done by downloading large files over http and ftp from multiple locations, the speed never went above 2mbps. But bittorrent downloads reached 5mbps. Even file download from the ISP servers were fine. So, at the ISP our link was attached directly to their edge router. After this file downloads from high bandwidth servers, like Google and MS, reached the 5 mbps limit. Sometimes the speed would fall down below 2 mbps and suddenly it will go up to the 5 mbps limit ( it keeps on happening during any single file download). But other downloads like ubuntu apt repositories still struggle to go above 2 mbps. The engineers at the ISP have not been able to sort out the issue. After they moved us to their edge router instead of giving us 8 public ip's, they just gave 4 ip's. When we enquired about it, they told us that giving more ip's would result in arp overload at their edge router. But somehow I was able to convince them to give us the 8 ip's which we wanted. But the file download issue has remained. What might be the reason for files from different location getting downloaded with different speeds, that too with heavy fluctuation in speeds? I have downloaded files from same url's from a connection belonging to another smaller ISP, and the speeds were fine and reached full 5 mbps limit.

    Read the article

  • Server 2003 and XP Client; Why are HTTP connections being silently dropped.

    - by Asa Yeamans
    On my network, my edge-router, a windows 2003 r2 server router with all the latest updates, will drop packets, but only under specific circumstances. I have troubleshot and isolated it down to the most simple configuration i can. There is NO NAT involved. Only fully-public IP addresses. No Firewalls are running either, all ahve been disabled. no packet filters on any interfaces anywhere either. I have a single Windows XP virtual machine and my edge-router(the windows 2003 r2 server, and also a virtual machine) running on a windows 2008 x64 r2 system (running virtual server 2005 as i dont have Intel-VT compatible chip yet). The edge router can access any external http site just fine, no issues. However the windows XP machine is only able to access certain sites. These work: www.google.com www.txstate.edu www.workintexas.com www.thedailywtf.com . These Dont: www.yahoo.com www.utexas.edu en.wikipedia.org slashdot.org www.bing.com. I have removed all possibility of DNS issues by connecting with net-cat from the XP box and sending GET /\r\nHost: \r\n\r\n and that connection replicates the issue as well. The network setup: My statically assigned IP block: x.x.x.168/29 DSL Modem -----PPPoE Connection---- x.x.x.169[EdgeRouter] [EdgeRouter]x.x.x.170 -----Virtual Ethernet----- x.x.x.174 [Test2] Test2's Default gateway is x.x.x.170 and test2 can ping any and every valid, accessible, public IP address with no packet loss what-so-ever. If i connect directly over PPPoE from test2 (the XP box) everything works just fine... Im at my wits end, i have NO IDEA whats causing this.

    Read the article

  • Modify or disable Windows 8 swipe gestures on touchpad / laptop

    - by Matsemann
    I have an ASUS G75VW laptop with a Synaptic touchpad (/trackpad). When I move my finger from one edge towards the middle (the swipe), Windows 8 will bring up different stuff. This is a problem because the area where I can actually move the mouse with my finger is too small (or, I mostly use the top left of the touchpad). So I often end up doing a swipe and bringing up some menu, or to do the swipe so slow that no menu is appearing but the mouse pointer is also not moving when I move my finger. Quite annoying. When swiping from left edge it earlier swapped apps like crazy. I disabled that, so now it only brings up the same menu as pressing win+tab (or some times the charms bar, I never know which). I could change that by: Win+I - Change PC settings - General - When I swipe from the left edge, switch directly to my most recent app I've tried Mouse settings in Control Panel, driver settings for my touchpad and searching for swipe and gestures on my computer (which was what led me to the setting above) with no luck. How can I disable the swipe gestures, or change what they do? Thanks.

    Read the article

  • Magical moving desktop icons

    - by Nathan Taylor
    I have encountered a very strange behavior in Windows 7 that I cannot seem to identify and I have never seen or heard of on any system configuration. Whenever I move my mouse to the left-most edge of my primary display (centered in 3-display setup), my desktop icons magically move away from the cursor (up or down and to the right). It only happens when my desktop has focus and the mouse is positioned on the left, top or bottom edge of the main display. Moving the mouse all the way to the right edge of my right secondary display causes the mouse icons to snap back into their correct position. Ridiculous video of the issue My setup is 3 displays on two display adapters. The main display is running at 2560x1600, connected to the machine via a USB-powered DVI-D to DisplayPort adapter and is driven by an NVIDIA NVS 3100M video card. The secondary displays are running at 1440x900 and 1200x1920 and are driven by integrated Intel HD Graphics (mobile). It seems like some kind of panning behavior, but it's obviously not working as expected. I have updated all of my drivers, but no change. It's probably worth noting that the desktop icons are set to auto-arrange.

    Read the article

  • Determining physical location of data on a disc

    - by Synetech
    Does anybody know of a way to find out where, physically on a CD or DVD a given piece of data would be located? I am trying to watch a DVD at the moment, and am about half-way through, but it keeps dying at a specific spot in the film, presumably because of a scratch. I have a repair kit, but I don’t know where to focus my repair because there are several scuffs and scratches on the disc and I have no way of knowing which one is causing the issue. Obviously, cleaning all of them is inadvisable because not only does it waste the consumable materials in the kit, but not all of them are a problem, and by working them, some may become unreadable. Moreover, just because I am half-way through the movie does not mean that it would be half-way from the hub to the edge for several reasons: Discs have more data towards the outer edge than the inner edge (circles are more mathematically complicated than rectangles) The disc is not completely filled up (and even if it were, the movie itself would be be using it all, there are extras and such) Because in this particular case it is a commercial DVD, it is also dual-layer which further complicates manual determination As such, I am trying to find a program that can let me identify a file (or part thereof), cluster, etc. and show me a picture of where on the CD/DVD it would be located. That way, I can look at the disc and fix any scratches that correspond to that distance from the hub. For example, the image below might indicate where on a disc a couple of files or range of clusters would be located, so by looking for anomalies in those areas (rotating as necessary), the correct one can be identified. I’m sure it can be done since at least one form of copy protection (DPM) uses it and DVD-lab Pro includes a “DVD Topology” feature to do this.

    Read the article

  • Understanding and Implementing a Force based graph layout algorithm

    - by zcourts
    I'm trying to implement a force base graph layout algorithm, based on http://en.wikipedia.org/wiki/Force-based_algorithms_(graph_drawing) My first attempt didn't work so I looked at http://blog.ivank.net/force-based-graph-drawing-in-javascript.html and https://github.com/dhotson/springy I changed my implementation based on what I thought I understood from those two but I haven't managed to get it right and I'm hoping someone can help? JavaScript isn't my strong point so be gentle... If you're wondering why write my own. In reality I have no real reason to write my own I'm just trying to understand how the algorithm is implemented. Especially in my first link, that demo is brilliant. This is what I've come up with //support function.bind - https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/bind#Compatibility if (!Function.prototype.bind) { Function.prototype.bind = function (oThis) { if (typeof this !== "function") { // closest thing possible to the ECMAScript 5 internal IsCallable function throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable"); } var aArgs = Array.prototype.slice.call(arguments, 1), fToBind = this, fNOP = function () {}, fBound = function () { return fToBind.apply(this instanceof fNOP ? this : oThis || window, aArgs.concat(Array.prototype.slice.call(arguments))); }; fNOP.prototype = this.prototype; fBound.prototype = new fNOP(); return fBound; }; } (function() { var lastTime = 0; var vendors = ['ms', 'moz', 'webkit', 'o']; for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame']; window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame'] || window[vendors[x]+'CancelRequestAnimationFrame']; } if (!window.requestAnimationFrame) window.requestAnimationFrame = function(callback, element) { var currTime = new Date().getTime(); var timeToCall = Math.max(0, 16 - (currTime - lastTime)); var id = window.setTimeout(function() { callback(currTime + timeToCall); }, timeToCall); lastTime = currTime + timeToCall; return id; }; if (!window.cancelAnimationFrame) window.cancelAnimationFrame = function(id) { clearTimeout(id); }; }()); function Graph(o){ this.options=o; this.vertices={}; this.edges={};//form {vertexID:{edgeID:edge}} } /** *Adds an edge to the graph. If the verticies in this edge are not already in the *graph then they are added */ Graph.prototype.addEdge=function(e){ //if vertex1 and vertex2 doesn't exist in this.vertices add them if(typeof(this.vertices[e.vertex1])==='undefined') this.vertices[e.vertex1]=new Vertex(e.vertex1); if(typeof(this.vertices[e.vertex2])==='undefined') this.vertices[e.vertex2]=new Vertex(e.vertex2); //add the edge if(typeof(this.edges[e.vertex1])==='undefined') this.edges[e.vertex1]={}; this.edges[e.vertex1][e.id]=e; } /** * Add a vertex to the graph. If a vertex with the same ID already exists then * the existing vertex's .data property is replaced with the @param v.data */ Graph.prototype.addVertex=function(v){ if(typeof(this.vertices[v.id])==='undefined') this.vertices[v.id]=v; else this.vertices[v.id].data=v.data; } function Vertex(id,data){ this.id=id; this.data=data?data:{}; //initialize to data.[x|y|z] or generate random number for each this.x = this.data.x?this.data.x:-100 + Math.random()*200; this.y = this.data.y?this.data.y:-100 + Math.random()*200; this.z = this.data.y?this.data.y:-100 + Math.random()*200; //set initial velocity to 0 this.velocity = new Point(0, 0, 0); this.mass=this.data.mass?this.data.mass:Math.random(); this.force=new Point(0,0,0); } function Edge(vertex1ID,vertex2ID){ vertex1ID=vertex1ID?vertex1ID:Math.random() vertex2ID=vertex2ID?vertex2ID:Math.random() this.id=vertex1ID+"->"+vertex2ID; this.vertex1=vertex1ID; this.vertex2=vertex2ID; } function Point(x, y, z) { this.x = x; this.y = y; this.z = z; } Point.prototype.plus=function(p){ this.x +=p.x this.y +=p.y this.z +=p.z } function ForceLayout(o){ this.repulsion = o.repulsion?o.repulsion:200; this.attraction = o.attraction?o.attraction:0.06; this.damping = o.damping?o.damping:0.9; this.graph = o.graph?o.graph:new Graph(); this.total_kinetic_energy =0; this.animationID=-1; } ForceLayout.prototype.draw=function(){ //vertex velocities initialized to (0,0,0) when a vertex is created //vertex positions initialized to random position when created cc=0; do{ this.total_kinetic_energy =0; //for each vertex for(var i in this.graph.vertices){ var thisNode=this.graph.vertices[i]; // running sum of total force on this particular node var netForce=new Point(0,0,0) //for each other node for(var j in this.graph.vertices){ if(thisNode!=this.graph.vertices[j]){ //net-force := net-force + Coulomb_repulsion( this_node, other_node ) netForce.plus(this.CoulombRepulsion( thisNode,this.graph.vertices[j])) } } //for each spring connected to this node for(var k in this.graph.edges[thisNode.id]){ //(this node, node its connected to) //pass id of this node and the node its connected to so hookesattraction //can update the force on both vertices and return that force to be //added to the net force this.HookesAttraction(thisNode.id, this.graph.edges[thisNode.id][k].vertex2 ) } // without damping, it moves forever // this_node.velocity := (this_node.velocity + timestep * net-force) * damping thisNode.velocity.x=(thisNode.velocity.x+thisNode.force.x)*this.damping; thisNode.velocity.y=(thisNode.velocity.y+thisNode.force.y)*this.damping; thisNode.velocity.z=(thisNode.velocity.z+thisNode.force.z)*this.damping; //this_node.position := this_node.position + timestep * this_node.velocity thisNode.x=thisNode.velocity.x; thisNode.y=thisNode.velocity.y; thisNode.z=thisNode.velocity.z; //normalize x,y,z??? //total_kinetic_energy := total_kinetic_energy + this_node.mass * (this_node.velocity)^2 this.total_kinetic_energy +=thisNode.mass*((thisNode.velocity.x+thisNode.velocity.y+thisNode.velocity.z)* (thisNode.velocity.x+thisNode.velocity.y+thisNode.velocity.z)) } cc+=1; }while(this.total_kinetic_energy >0.5) console.log(cc,this.total_kinetic_energy,this.graph) this.cancelAnimation(); } ForceLayout.prototype.HookesAttraction=function(v1ID,v2ID){ var a=this.graph.vertices[v1ID] var b=this.graph.vertices[v2ID] var force=new Point(this.attraction*(b.x - a.x),this.attraction*(b.y - a.y),this.attraction*(b.z - a.z)) // hook's attraction a.force.x += force.x; a.force.y += force.y; a.force.z += force.z; b.force.x += this.attraction*(a.x - b.x); b.force.y += this.attraction*(a.y - b.y); b.force.z += this.attraction*(a.z - b.z); return force; } ForceLayout.prototype.CoulombRepulsion=function(vertex1,vertex2){ //http://en.wikipedia.org/wiki/Coulomb's_law // distance squared = ((x1-x2)*(x1-x2)) + ((y1-y2)*(y1-y2)) + ((z1-z2)*(z1-z2)) var distanceSquared = ( (vertex1.x-vertex2.x)*(vertex1.x-vertex2.x)+ (vertex1.y-vertex2.y)*(vertex1.y-vertex2.y)+ (vertex1.z-vertex2.z)*(vertex1.z-vertex2.z) ); if(distanceSquared==0) distanceSquared = 0.001; var coul = this.repulsion / distanceSquared; return new Point(coul * (vertex1.x-vertex2.x),coul * (vertex1.y-vertex2.y), coul * (vertex1.z-vertex2.z)); } ForceLayout.prototype.animate=function(){ if(this.animating) this.animationID=requestAnimationFrame(this.animate.bind(this)); this.draw(); } ForceLayout.prototype.cancelAnimation=function(){ cancelAnimationFrame(this.animationID); this.animating=false; } ForceLayout.prototype.redraw=function(){ this.animating=true; this.animate(); } $(document).ready(function(){ var g= new Graph(); for(var i=0;i<=100;i++){ var v1=new Vertex(Math.random(), {}) var v2=new Vertex(Math.random(), {}) var e1= new Edge(v1.id,v2.id); g.addEdge(e1); } console.log(g); var l=new ForceLayout({ graph:g }); l.redraw(); });

    Read the article

  • Anchor Window to Screen Edges in C#/WPF

    - by Kirk
    I've decided to teach myself C# by writing a music player in Visual Studio 2010. I went with WPF because from what I hear it sounds like it will be a good base to skin from. I want to program my window with the behavior where if the window comes to the edge of a screen (within 10px or so) it will snap to the screen edge. What's the best way to go about this?

    Read the article

  • How do I use CSS transformations to slide a div on screen?

    - by Colen
    Hi, My web page has two divs on it, A and B. Div A is visible, Div B is hidden. When the user clicks a link in div A, I want to "slide" div A off screen (leaving via the left edge), and slide div B on screen (entering via the right edge). I've found that jquery animations are very slow on the ipad, so I want to use the webkit CSS animations instead, which I believe are rendered in hardware. How do I do this?

    Read the article

  • How do I make a suckerfish/superfish CSS dropdown that sticks to the right hand side of the page?

    - by joeforker
    I am developing a CSS dropdown menu based on the suckerfish CSS. I would like to put it on the right hand side of the page but the menus extend from the leftmost edge of each menu to the right, instead of from the rightmost edge of each menu to the left (as is necessary to keep the rightmost dropdown menu from opening outside the visible area.) How do I position my suckerfish dropdown menus to extend to the left, instead of the right?

    Read the article

  • I am trying to build a list of limitations of all graph algorithms

    - by Jack
    Single Source shortest Path Dijkstra's - directed and undirected - works only for positive edge weights - cycles ?? Bellman Ford - directed - no cycles should exist All source shortest path Floyd Warshall - no info Minimum Spanning Tree ( no info about edge weights or nature of graph or cycles) Kruskal's Prim's - undirected Baruvka's

    Read the article

  • Problem on a Floyd-Warshall implementation using c++

    - by Henrique
    I've got a assignment for my college, already implemented Dijkstra and Bellman-Ford sucessfully, but i'm on trouble on this one. Everything looks fine, but it's not giving me the correct answer. Here's the code: void FloydWarshall() { //Also assume that n is the number of vertices and edgeCost(i,i) = 0 int path[500][500]; /* A 2-dimensional matrix. At each step in the algorithm, path[i][j] is the shortest path from i to j using intermediate vertices (1..k-1). Each path[i][j] is initialized to edgeCost(i,j) or infinity if there is no edge between i and j. */ for(int i = 0 ; i <= nvertices ; i++) for(int j = 0 ; j <= nvertices ; j++) path[i][j] = INFINITY; for(int j = 0 ; j < narestas ; j++) //narestas = number of edges { path[arestas[j]->v1][arestas[j]->v2] = arestas[j]->peso; //peso = weight of the edge (aresta = edge) path[arestas[j]->v2][arestas[j]->v1] = arestas[j]->peso; } for(int i = 0 ; i <= nvertices ; i++) //path(i, i) = 0 path[i][i] = 0; //test print, it's working fine //printf("\n\n\nResultado FloydWarshall:\n"); //for(int i = 1 ; i <= nvertices ; i++) // printf("distancia ao vertice %d: %d\n", i, path[1][i]); //heres the problem, it messes up, and even a edge who costs 4, and the minimum is 4, it prints 2. //for k = 1 to n for(int k = 1 ; k <= nvertices ; k++) //for i = 1 to n for(int i = 1 ; i <= nvertices ; i++) //for j := 1 to n for(int j = 1 ; j <= nvertices ; j++) if(path[i][j] > path[i][k] + path[k][j]) path[i][j] = path[i][k] + path[k][j]; printf("\n\n\nResultado FloydWarshall:\n"); for(int i = 1 ; i <= nvertices ; i++) printf("distancia ao vertice %d: %d\n", i, path[1][i]); } im using this graph example i've made: 6 7 1 2 4 1 5 1 2 3 1 2 5 2 5 6 3 6 4 6 3 4 2 means we have 6 vertices (1 to 6), and 7 edges (1,2) with weight 4... etc.. If anyone need more info, i'm up to giving it, just tired of looking at this code and not finding an error.

    Read the article

  • Bipartite matching in Python

    - by vailen
    Does anybody know any module in Python that computes the best bipartite matching? I have tried the following two: munkres hungarian However, in my case, I have to deal with non-complete graph (i.e., there might not be an edge between two nodes), and therefore, there might not be a match if the node has no edge. The above two packages seem not to be able to deal with this. Any advice?

    Read the article

  • Weakly connected tree

    - by wow_22
    hello I have an algorithmic problem using a weakly connected tree T where w(T)=sum(w(e)) for each edge e,by w i declare weight and i have to prove that we can use prim and Kruskal algorithm while w(T)=max{w(e)} maximum between any edge e belongs at T (I proved that) but i have also to prove the same for w(T)=?(w(e)) while ? states product of all edges belongs at T i tried a lot to prove it but i did not came up with a result that proving or disapproving the use of prim ,kruskal any help will be more than appreciated thanks

    Read the article

  • Graph Tour with Uniform Cost Search in Java

    - by user324817
    Hi. I'm new to this site, so hopefully you guys don't mind helping a nub. Anyway, I've been asked to write code to find the shortest cost of a graph tour on a particular graph, whose details are read in from file. The graph is shown below: http://img339.imageshack.us/img339/8907/graphr.jpg This is for an Artificial Intelligence class, so I'm expected to use a decent enough search method (brute force has been allowed, but not for full marks). I've been reading, and I think that what I'm looking for is an A* search with constant heuristic value, which I believe is a uniform cost search. I'm having trouble wrapping my head around how to apply this in Java. Basically, here's what I have: Vertex class - ArrayList<Edge> adjacencies; String name; int costToThis; Edge class - final Vertex target; public final int weight; Now at the moment, I'm struggling to work out how to apply the uniform cost notion to my desired goal path. Basically I have to start on a particular node, visit all other nodes, and end on that same node, with the lowest cost. As I understand it, I could use a PriorityQueue to store all of my travelled paths, but I can't wrap my head around how I show the goal state as the starting node with all other nodes visited. Here's what I have so far, which is pretty far off the mark: public static void visitNode(Vertex vertex) { ArrayList<Edge> firstEdges = vertex.getAdjacencies(); for(Edge e : firstEdges) { e.target.costToThis = e.weight + vertex.costToThis; queue.add(e.target); } Vertex next = queue.remove(); visitNode(next); } Initially this takes the starting node, then recursively visits the first node in the PriorityQueue (the path with the next lowest cost). My problem is basically, how do I stop my program from following a path specified in the queue if that path is at the goal state? The queue currently stores Vertex objects, but in my mind this isn't going to work as I can't store whether other vertices have been visited inside a Vertex object. Help is much appreciated! Josh

    Read the article

  • Anchor Window to Screen Edges in WPF

    - by Kirk
    I've decided to teach myself C# by writing a music player in Visual Studio 2010. I went with WPF because from what I hear it sounds like it will be a good base to skin from. I want to program my window with the behavior where if the window comes to the edge of a screen (within 10px or so) it will snap to the screen edge. What's the best way to go about this?

    Read the article

  • positioning image using css

    - by TomBs
    hi, i really need to place an image somewhere in the page (100 pixels from the left side for example) but i want to control where the center of the image will be, when i use left:100px; , the image is positioned 100px from its left edge and not from its center... is there a way i can choose where the center of the image will be and not the left/right edge?

    Read the article

  • Bi-partitle matching in Python

    - by vailen
    Does anybody know any module in Python that computes the best bi-partite matching? I have tried the following two: munkres hungarian However, in my case, I have to deal with non-complete graph (i.e., there might not be an edge between two nodes), and therefore, there might not be a match if the node has no edge. The above two packages seem not be able to deal with this. Any advise?

    Read the article

  • Why closed contours are guaranteed here?

    - by user198729
    Quoted from here: BW = edge(I,'zerocross',thresh,h) specifies the zero-cross method, using the filter h. thresh is the sensitivity threshold; if the argument is empty ([]), edge chooses the sensitivity threshold automatically. If you specify a threshold of 0, the output image has closed contours, because it includes all the zero crossings in the input image. I don't understand it,can someone elaborate?

    Read the article

< Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >