How to pass event as argument to an inline event handler in JavaScript?

to pass the event object: <p id=”p” onclick=”doSomething(event)”> to get the clicked child element (should be used with event parameter: function doSomething(e) { e = e || window.event; var target = e.target || e.srcElement; console.log(target); } to pass the element itself (DOMElement): <p id=”p” onclick=”doThing(this)”> see live example on jsFiddle. You can specify the name … Read more

When to use inline function and when not to use it?

Avoiding the cost of a function call is only half the story. do: use inline instead of #define very small functions are good candidates for inline: faster code and smaller executables (more chances to stay in the code cache) the function is small and called very often don’t: large functions: leads to larger executables, which … Read more

Inline functions in C#?

Finally in .NET 4.5, the CLR allows one to hint/suggest1 method inlining using MethodImplOptions.AggressiveInlining value. It is also available in the Mono’s trunk (committed today). // The full attribute usage is in mscorlib.dll, // so should not need to include extra references using System.Runtime.CompilerServices; … [MethodImpl(MethodImplOptions.AggressiveInlining)] void MyMethod(…) 1. Previously “force” was used here. I’ll … Read more

How to display Base64 images in HTML

My suspect is of course the actual Base64 data. Otherwise it looks good to me. See this fiddle where a similar scheme is working. You may try specifying the character set. <div> <p>Taken from wikpedia</p> <img src=”data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUA AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO 9TXL0Y4OHwAAAABJRU5ErkJggg==” alt=”Red dot” /> </div> You can try this Base64 decoder to see if your Base64 … Read more

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