This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BitmapThreadPool { | |
private static BitmapThreadPool mInstance; | |
private ThreadPoolExecutor mThreadPoolExec; | |
private static int MAX_POOL_SIZE; | |
private static final int KEEP_ALIVE = 10; | |
BlockingQueue<Runnable> workQueue = new LinkedBlockingQueue<>(); | |
public static synchronized void post(Runnable runnable) { | |
if (mInstance == null) { | |
mInstance = new BitmapThreadPool(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Button Press Detection - debounce with millis() | |
int buttonPin = 7; | |
boolean currentState = LOW;//stroage for current measured button state | |
boolean lastState = LOW;//storage for last measured button state | |
boolean debouncedState = LOW;//debounced button state | |
int debounceInterval = 20;//wait 20 ms for button pin to settle | |
unsigned long timeOfLastButtonEvent = 0;//store the last time the button state changed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function findProp(obj, prop, defval){ | |
if (typeof defval == 'undefined') defval = null; | |
prop = prop.split('.'); | |
for (var i = 0; i < prop.length; i++) { | |
if(typeof obj[prop[i]] == 'undefined') | |
return defval; | |
obj = obj[prop[i]]; | |
} | |
return obj; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#element').mousedown(function(event) { | |
switch (event.which) { | |
case 1: | |
alert('Left mouse button pressed'); | |
break; | |
case 2: | |
alert('Middle mouse button pressed'); | |
break; | |
case 3: | |
alert('Right mouse button pressed'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('myApp', ['myApp.filters', 'myApp.services', 'myApp.directives'], function ($routeProvider, $locationProvider, $httpProvider) { | |
var interceptor = ['$rootScope', '$q', function (scope, $q) { | |
function success(response) { | |
return response; | |
} | |
function error(response) { | |
var status = response.status; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g, '');}; | |
String.prototype.ltrim=function(){return this.replace(/^\s+/,'');}; | |
String.prototype.rtrim=function(){return this.replace(/\s+$/,'');}; | |
String.prototype.fulltrim=function(){return this.replace(/(?:(?:^|\n)\s+|\s+(?:$|\n))/g,'').replace(/\s+/g,' ');}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Require HTTPS for everything except /img (favicon) and /css. --> | |
<security-constraint> | |
<web-resource-collection> | |
<web-resource-name>HTTPSOnly</web-resource-name> | |
<url-pattern>/*</url-pattern> | |
</web-resource-collection> | |
<user-data-constraint> | |
<transport-guarantee>CONFIDENTIAL</transport-guarantee> | |
</user-data-constraint> | |
</security-constraint> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> | |
<property name="ignoreUnresolvablePlaceholders" value="true"/> | |
</bean> | |
<bean class="org.springframework.web.context.support.ServletContextPropertyPlaceholderConfigurer"> | |
<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE"/> | |
<property name="searchContextAttributes" value="true"/> | |
<property name="contextOverride" value="true"/> | |
<property name="ignoreResourceNotFound" value="true"/> | |
<property name="locations"> | |
<list> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Include http module, | |
var http = require("http"), | |
// And mysql module you've just installed. | |
fs = require("fs"); | |
// Create the http server. | |
http.createServer(function (request, response) { | |
// Attach listener on end event. | |
request.on('end', function () { | |
// Check if user requests / |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Installare | |
npm install mysql@2.0.0-alpha2 |
NewerOlder