How to draw a line between draggable and droppable?

updated (08.Jul.2013) Updated with latest versions of libraries; html refactored using JsRender; updated (29.Sep.2011) Added GIT Repo; cleaned the code; update to latest framework versions; updated (03.Mar.2013) Fixed links with working example; Current example uses: HTML 5 doctype jQuery v.1.10.2 jQuery UI v.1.10.3 Raphael v.2.0.1 JsRender v.1pre35 (optional, used for HTML simplification) Source Source code … Read more

C# – Faster Alternatives to SetPixel and GetPixel for Bitmaps for Windows Forms App

The immediately usable code public class DirectBitmap : IDisposable { public Bitmap Bitmap { get; private set; } public Int32[] Bits { get; private set; } public bool Disposed { get; private set; } public int Height { get; private set; } public int Width { get; private set; } protected GCHandle BitsHandle { get; … Read more

How to place multiple evenly-spaced arrowheads along an SVG line?

Based on a clarification of the question, here’s an implementation of creating intermediary points along a <polyline> element such that the marker-mid=”url(#arrowhead)” attribute will work. See below that for an introduction to markers and arrowheads. Demo: http://jsfiddle.net/Zv57N/ midMarkers(document.querySelector(‘polyline’),6); // Given a polygon/polyline, create intermediary points along the // “straightaways” spaced no closer than `spacing` distance … Read more

How to render pdfs using C#

Google has open sourced its excellent PDF rendering engine – PDFium – that it wrote with Foxit Software. There is a C# nuget package called PdfiumViewer which gives a C# wrapper around PDFium and allows PDFs to be displayed and printed. I have used it and was very impressed with the quality of the rendering. … Read more

iPhone smooth sketch drawing algorithm

CGPoint midPoint(CGPoint p1, CGPoint p2) { return CGPointMake((p1.x + p2.x) * 0.5, (p1.y + p2.y) * 0.5); } -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; previousPoint1 = [touch previousLocationInView:self]; previousPoint2 = [touch previousLocationInView:self]; currentPoint = [touch locationInView:self]; } -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; previousPoint2 = previousPoint1; previousPoint1 … Read more

Draw arrow on canvas tag

As simple as I can get it. You’ll have to prepend context.beginPath() and append context.stroke() yourself: ctx = document.getElementById(“c”).getContext(“2d”); ctx.beginPath(); canvas_arrow(ctx, 10, 30, 200, 150); canvas_arrow(ctx, 100, 200, 400, 50); canvas_arrow(ctx, 200, 30, 10, 150); canvas_arrow(ctx, 400, 200, 100, 50); ctx.stroke(); function canvas_arrow(context, fromx, fromy, tox, toy) { var headlen = 10; // length of … Read more

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