Tutorial by Examples: dis

Picasso.with(context) .load(uri) .networkPolicy(NetworkPolicy.NO_CACHE) .memoryPolicy(MemoryPolicy.NO_CACHE) .placeholder(R.drawable.placeholder) .into(imageView);
GCD will guarantee that your singleton only gets instantiated once, even if called from multiple threads. Insert this into any class for a singleton instance called shared. + (instancetype)shared { // Variable that will point to the singleton instance. The `static` // modifier makes it ...
public class MainApplication extends Application { private static Context context; //application context private Handler mainThreadHandler; private Toast toast; public Handler getMainThreadHandler() { if (mainThreadHandler == null) { mainThreadHand...
wget http://download.redis.io/redis-stable.tar.gz tar xvzf redis-stable.tar.gz cd redis-stable make
redis-cli ping This should return PONG
redis-cli is the Redis command line interface program that allows to send commands to Redis and read the replies sent by the server, directly from the terminal. Basic command line usage is below: Access to redis: $ redis-cli 127.0.0.1:6379> Access to redis with authentication: $ redis-cli ...
Because a clack request is represented as a plist, we can use pattern matching as the entry point to the clack app as a way to route request to their appropriate controllers (defvar *app* (lambda (env) (match env ((plist :request-method :get :request-uri uri) (...
This directive is useful to limit input events based on certain existing conditions. The ng-disabled directive accepts and expression that should evaluate to either a truthy or a falsy values. ng-disabled is used to conditionally apply the disabled attribute on an input element. HTML <input t...
If you want to hide a keyboard by tap outside of it, it's possible to use this hacky trick (works only with Objective-C): - (void)viewDidLoad { [super viewDidLoad]; // dismiss keyboard when tap outside a text field UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecogn...
If you have a vector in polar form (direction & distance) you will want to convert it to a cartesian vector with a x and y component. For referance the screen coordinate system has directions as 0 deg points from left to right, 90 (PI/2) point down the screen, and so on in a clock wise direction...
Whenever AFNetworking is used the call is dispatched on a custom thread provided by AFNetworking. When the call returns to the completion block, it gets executed on the main thread. This example sets a custom thread that dispatch to the completion block: AFNetworking 2.xx: // Create dispatch_queu...
We can use the :: syntax to dispatch on the type of an argument. describe(n::Integer) = "integer $n" describe(n::AbstractFloat) = "floating point $n" Usage: julia> describe(10) "integer 10" julia> describe(1.0) "floating point 1.0" Unlike m...
ctrl + alt + shift + / (cmd + alt + shift + / on MacOS) should show you the following dialog: Clicking on Registry you will get The key you want to enable/disable is editor.skip.copy.and.cut.for.empty.selection Tested on Linux Ubuntu and MacOS.
First you need to install and start your Redis server, check the link below that can help you to install redis on you server or local machine. Installation and Setup Now open your command prompt and run command redis-cli : To save first set >SET 'keyname' then 'value' 127.0.0.1:6379> SET h...
Using vanilla mathematics: var from:Point = new Point(300, 10); var to:Point = new Point(75, 40); var a:Number = to.x - from.x; var b:Number = to.y - from.y; var distance:Number = Math.sqrt(a * a + b * b); Using inbuilt functionality of Point: var distance:Number = to.subtract(from).len...
Any time you instantiate a class that Implements IDisposable, you should call .Dispose1 on that class when you have finished using it. This allows the class to clean up any managed or unmanaged dependencies that it may be using. Not doing this could cause a memory leak. The Using keyword ensures th...
Make sure your image object is fully loaded before you try to draw it on the canvas with context.drawImage. Otherwise the image will silently fail to display. In JavaScript, images are not loaded immediately. Instead, images are loaded asynchronously and during the time they take to load JavaScript...
An Akka MessageDispatcher is what makes Akka Actors "tick", it is the engine of the machine so to speak. All MessageDispatcher implementations are also an ExecutionContext, which means that they can be used to execute arbitrary code, for instance Futures. Every ActorSystem will have a def...
So in case you want to give your Actor a different dispatcher than the default, you need to do two things, of which the first is to configure the dispatcher in your application.conf: my-dispatcher { # Dispatcher is the name of the event-based dispatcher type = Dispatcher # What kind of Exe...

Page 5 of 18