How to move the cursor or simulate clicks for other applications?

You’ve inspired me to refactor some of my automation code: NativeMethods.cs – got most of this from online: using System; using System.Runtime.InteropServices; public class NativeMethods { [DllImport( “user32.dll”, SetLastError = true )] internal static extern Int32 SendInput( Int32 cInputs, ref INPUT pInputs, Int32 cbSize ); [StructLayout( LayoutKind.Explicit, Pack = 1, Size = 28 )] internal … Read more

Finding number position in string

With help of xdazz answer, I did some changes and got answer finally… SELECT myWord, LEAST ( if (Locate(‘0’,myWord) >0,Locate(‘0’,myWord),999), if (Locate(‘1’,myWord) >0,Locate(‘1’,myWord),999), if (Locate(‘2’,myWord) >0,Locate(‘2’,myWord),999), if (Locate(‘3’,myWord) >0,Locate(‘3’,myWord),999), if (Locate(‘4’,myWord) >0,Locate(‘4’,myWord),999), if (Locate(‘5’,myWord) >0,Locate(‘5’,myWord),999), if (Locate(‘6’,myWord) >0,Locate(‘6’,myWord),999), if (Locate(‘7’,myWord) >0,Locate(‘7’,myWord),999), if (Locate(‘8’,myWord) >0,Locate(‘8’,myWord),999), if (Locate(‘9’,myWord) >0,Locate(‘9’,myWord),999) ) as myPos FROM myTable; Demo

Creating a collapsed range from a pixel position in FF/Webkit

Here is my implementation of caretRangeFromPoint for old browsers: if (!document.caretRangeFromPoint) { document.caretRangeFromPoint = function(x, y) { var log = “”; function inRect(x, y, rect) { return x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom; } function inObject(x, y, object) { var rects = object.getClientRects(); for (var i … Read more

SVG Positioning

Everything in the g element is positioned relative to the current transform matrix. To move the content, just put the transformation in the g element: <g transform=”translate(20,2.5) rotate(10)”> <rect x=”0″ y=”0″ width=”60″ height=”10″/> </g> Links: Example from the SVG 1.1 spec

What’s the purpose of item-id’s in Android ListView Adapter?

Imagine this structure: You have db table Notes with such 3 records: +—-+————————–+ | ID | Note Text | +—-+————————–+ | 43 | Note text blah blah | | 67 | Note text blah blah blah | | 85 | Last note | +—-+————————–+ and you implement an adapter to serve this data. Now let’s … Read more

Set position absolute and margin

I know this isn’t a very timely answer but there is a way to solve this. You could add a “spacer” element inside the element positioned absolutely with a negative bottom margin and a height that is the same size as the negative bottom margin. HTML: <div id=”container”> <div class=”spacer”></div> </div> CSS: // same container … Read more

onMouseMove get mouse position [duplicate]

if you can use jQuery, then this will help: <div id=”divA” style=”width:100px;height:100px;clear:both;”></div> <span></span><span></span> <script> $(“#divA”).mousemove(function(e){ var pageCoords = “( ” + e.pageX + “, ” + e.pageY + ” )”; var clientCoords = “( ” + e.clientX + “, ” + e.clientY + ” )”; $(“span:first”).text(“( e.pageX, e.pageY ) – ” + pageCoords); $(“span:last”).text(“( e.clientX, … Read more

What are the CSS properties that get elements out of the normal flow?

Only the following properties affects the normal flow of any given element: float: right|left position: absolute|fixed Just for completeness: display: none removes the element from the flow (strictly speaking the element will not have a flow order) position: relative does not change the flow order of the element, but changes its position relative to the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)