Tutorial by Examples

When using interop methods, you can use GetLastError API to get additional information on you API calls. DllImport Attribute SetLastError Attribute SetLastError=true Indicates that the callee will call SetLastError (Win32 API function). SetLastError=false Indicates that the callee will not call...
Do not allocate new objects in onDraw @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); Paint paint = new Paint(); //Do not allocate here } Instead of drawing drawables in canvas... drawable.setBounds(boundsRect); drawable.draw(canvas); Use a B...
One of the useful unit when creating a responsive application. Its size depends on its parent container. Equation: ( Parent Container`s width ) * ( Percentage(%) ) = Output For Example: Parent has 100px width while the Child has 50%. On the output, the Child's width will be half(50%) of t...
img{ float:left; width:100px; margin:0 10px; } .div1{ background:#f1f1f1; /* does not create block formatting context */ } .div2{ background:#f1f1f1; overflow:hidden; /* creates block formatting context */ } https://jsfiddle.net/MadalinaTn/qkwwmu6m/2/ Using the o...
HTML: <div class="wrapper"> <div class="outer"> <div class="inner"> centered </div> </div> </div> CSS: .wrapper { height: 600px; text-align: center; } .outer { display: table; ...
HTML: <div class="wrapper"> <div class="centered"> centered </div> </div> CSS: .wrapper { position: relative; height: 600px; } .centered { position: absolute; z-index: 999; transform: translate(-50%, -50%); top:...
Typed holes can make it easier to define functions, through an interactive process. Say you want to define a class instance Foo Bar (for your custom Bar type, in order to use it with some polymorphic library function that requires a Foo instance). You would now traditionally look up the documentati...
Redis has publish/subscribe for sending messages. This is handled by subscribing to a channel & publishing to channel. Yes, subscribers will subscribe to one or more channels. Publisher need not know who are all subscribers. Instead, publisher will publish to specific channel. All the subscriber...
POSIX character classes are predefined sequences for a certain set of characters. Character classDescription[:alpha:]Alphabetic characters[:alnum:]Alphabetic characters and digits[:digit:]Digits[:xdigit:]Hexadecimal digits[:blank:]Space and Tab[:cntrl:]Control characters[:graph:]Visible characters ...
Most basic Django debugging tool is pdb, a part of Python standard library. Init view script Let's examine a simple views.py script: from django.http import HttpResponse def index(request): foo = 1 bar = 0 bug = foo/bar return HttpResponse("%d goes here." % ...
The New-Object cmdlet is used to create an object. # Create a DateTime object and stores the object in variable "$var" $var = New-Object System.DateTime # calling constructor with parameters $sr = New-Object System.IO.StreamReader -ArgumentList "file path" In many instan...
To check for location services we need real device but for testing purpose we can also use simulator and add our own location by following below steps: add new GPX file into your project. in GPX file add waypoints like <?xml version="1.0"?> <gpx version="1.1" cre...
git config --global help.autocorrect 17 This enables autocorrect in git and will forgive you for your minor mistakes (e.g. git stats instead of git status). The parameter you supply to help.autocorrect determines how long the system should wait, in tenths of a second, before automatically applyin...
private List<FooBar> _fooBars; public List<FooBar> FooBars { get { return _fooBars ?? (_fooBars = new List<FooBar>()); } } The first time the property .FooBars is accessed the _fooBars variable will evaluate as null, thus falling through to the assignment statement ass...
Asynchronous ajax call With this type of ajax call, code does not wait for the call to complete. $('form.ajaxSubmit').on('submit',function(){ // initilization... var form = $(this); var formUrl = form.attr('action'); var formType = form.attr('method'); var formData ...
Noting that zip transposes a tuple of lists into a list of tuples, ghci> uncurry zip ([1,2],[3,4]) [(1,3), (2,4)] and the similarity between the types of transpose and sequenceA, -- transpose exchanges the inner list with the outer list -- +---+-->--+-+ -- | | ...
git clean -f Will remove all untracked files.
If you need to download files with git under a proxy, setting proxy server system-wide couldn't be enough. You could also try the following: git config --global http.proxy http://<proxy-server>:<port>/
Introduction Play has several plugins for different IDE-s. The eclipse plugin allows to transform a Play application into a working eclipse project with the command activator eclipse. Eclipse plugin may be set per project or globally per sbt user. It depends on team work, which approach should be u...
New build systems can be created from the menu (Tools | Build System | New Build System). { "shell_cmd": "somecommand -u \"$file\"", "result_file_regex": "^[ ]*File \"(.*?)\"", "result_line_regex": "^[ ]*File ...

Page 696 of 1336