Posts

Showing posts from November, 2011

Can A Lucio Ult Counter A McCree Ult?

Answer : Situation 1 : McCree's lock-on delay for each player is increased proportional to the amount of effective health gained through Lucio's ult. Given that McCree is allowed to use his ult unhindered, you are correct in your assumption that Lucio's ult would do very little. That said, the delay caused by Sound Barrier is likely to afford your team the time to either prevent him from going through with it or at least to find suitable cover. Situation 2 : It is exactly as you have said. In my experience, and as indicated by a player's account of his experience in this reddit post, increasing a player's effective health removes McCree's lock on effect; however, I am not sure if this resets the delay entirely or if it just increases the delay proportional to the health gained. Either way, it's worth investigation. In short, Lucio's ult is very effective at countering Deadeye.

Can You Pause Terraria?

Image
Answer : You can Alt-Tab out of the window, or simply click out of it if playing in windowed mode, and it will pause gameplay. It's hackish, but it does pause (you can also do this during loading, and it will keep loading). As James has pointed out, this is single-player only. There is currently (and I doubt there ever will be) no multiplayer pause. Game pauses automatically if you ALT+TAB to another program. UPDATE : In Terraria 1.0.4 devs added the following option related to pausing: Added an option that will pause the game while talking to an NPC or opening your inventory in single player. It defaults to off.

Cannot Understand With Sklearn's PolynomialFeatures

Image
Answer : If you have features [a, b, c] the default polynomial features(in sklearn the degree is 2) should be [1, a, b, c, a^2, b^2, c^2, ab, bc, ca] . 2.61576000e+03 is 37.8x62.2=2615,76 ( 2615,76 = 2.61576000 x 10^3 ) In a simple way with the PolynomialFeatures you can create new features. There is a good reference here. Of course there are and disadvantages("Overfitting") of using PolynomialFeatures (see here). Edit: We have to be careful when using the polynomial features. The formula for calculating the number of the polynomial features is N(n,d)=C(n+d,d) where n is the number of the features, d is the degree of the polynomial, C is binomial coefficient(combination). In our case the number is C(3+2,2)=5!/(5-2)!2!=10 but when the number of features or the degree is height the polynomial features becomes too many. For example: N(100,2)=5151 N(100,5)=96560646 So in this case you may need to apply regularization to penalize some of the weights. It is

Caching A Jquery Ajax Response In Javascript/browser

Answer : cache:true only works with GET and HEAD request. You could roll your own solution as you said with something along these lines : var localCache = { data: {}, remove: function (url) { delete localCache.data[url]; }, exist: function (url) { return localCache.data.hasOwnProperty(url) && localCache.data[url] !== null; }, get: function (url) { console.log('Getting in cache for url' + url); return localCache.data[url]; }, set: function (url, cachedData, callback) { localCache.remove(url); localCache.data[url] = cachedData; if ($.isFunction(callback)) callback(cachedData); } }; $(function () { var url = '/echo/jsonp/'; $('#ajaxButton').click(function (e) { $.ajax({ url: url, data: { test: 'value' }, cache: true, beforeSend: function () { i

Binary To Hexadecimal And Decimal In A Shell Script

Answer : It's fairly straightforward to do the conversion from binary in pure bash ( echo and printf are builtins): Binary to decimal $ echo "$((2#101010101))" 341 Binary to hexadecimal $ printf '%x\n' "$((2#101010101))" 155 Going back to binary using bash alone is somewhat more complex, so I suggest you see the other answers for solutions to that. Assuming that by binary, you mean binary data as in data with any possible byte value including 0, and not base-2 numbers: To convert from binary, od (standard), xxd (comes with vim ) or perl 's unpack come to mind. od -An -vtu1 # for decimal od -An -vtx1 # for hexadecimal xxd -p # for hexa perl -pe 'BEGIN{$\="\n";$/=\30};$_=unpack("H*",$_)' # like xxd -p # for decimal: perl -ne 'BEGIN{$\="\n";$/=\30;$,=" "}; print unpack("C*",$_)' Now, to convert back to binary, awk (standard), xxd -r or perl 's pack :

How To Put Legend In Matlab Code Example

Example: add manual legend matlab h1 = plot ( [ 1 : 10 ] , 'Color' , 'r' , 'DisplayName' , 'This one' ) ; hold on ; h2 = plot ( [ 1 : 2 : 10 ] , 'Color' , 'b' , 'DisplayName' , 'This two' ) ; h3 = plot ( [ 1 : 3 : 10 ] , 'Color' , 'k' , 'DisplayName' , 'This three' ) ; legend ( [ h1 h3 ] , { 'Legend 1' , 'Legend 3' } )

Bootstrap Text On Image Code Example

Example 1: bootstrap left image right text < div class = " card " > < div class = " row no-gutters " > < div class = " col-auto " > < img src = " //placehold.it/200 " class = " img-fluid " alt = " " > </ div > < div class = " col " > < div class = " card-block px-2 " > < h4 class = " card-title " > Title </ h4 > < p class = " card-text " > Description </ p > < a href = " # " class = " btn btn-primary " > BUTTON </ a > </ div > </ div > </ div > < div class = " card-footer w-100 text-muted " > Footer stating cats are CUTE little animals

C# Dictionary Get Specific Key Value Code Example

Example: access dic by key c# using System ; using System . Collections . Generic ; class Program { static void Main ( ) { Dictionary < string , int > dictionary = new Dictionary < string , int > ( ) ; dictionary . Add ( "apple" , 1 ) ; dictionary . Add ( "windows" , 5 ) ; // See whether Dictionary contains this string. if ( dictionary . ContainsKey ( "apple" ) ) { int value = dictionary [ "apple" ] ; Console . WriteLine ( value ) ; } // See whether it contains this string. if ( ! dictionary . ContainsKey ( "acorn" ) ) { Console . WriteLine ( false ) ; } } }

Adjust GridView Child Height According To The Dynamic Content In Flutter

Image
Answer : Edit: I added the constructor StaggeredTile.fit in the 0.2.0. With that you should be able to build you app ;-). First comment: For now with StaggeredGridView, the layout and the children rendering are completely independant. So as @rmtmckenzie said, you will have to get the image size to create your tiles. Then you can use StaggeredTile.count constructor with a double value for the mainAxisCellCount parameter: new StaggeredTile.count(x, x*h/w) (where h is the height of your image and w its width. So that the tile with have the same aspect ratio as your image. What you want to accomplish will need more work because you want to have an area below the image with some information. For that I think you will have to compute the real width of your tile before creating it and use the StaggeredTile.extent constructor. I understand this is not ideal and I'm currently working on a new way to create the layout. I hope it will help to build scenarios like yours. F

App.use Express.urlencoded({ Extended:true })) Express.json App.post Req.body Code Example

Example 1: body parser express //make sure it is in this order npm i body - parser const express = require ( 'express' ) const bodyParser = require ( 'body-parser' ) const app = express ( ) // parse application/x-www-form-urlencoded app . use ( bodyParser . urlencoded ( { extended : false } ) ) // parse application/json app . use ( bodyParser . json ( ) ) app . use ( function ( req , res ) { res . setHeader ( 'Content-Type' , 'text/plain' ) res . write ( 'you posted:\n' ) res . end ( JSON . stringify ( req . body , null , 2 ) ) } ) Example 2: How to access the request body when POSTing using Node.js and Express const express = require ( 'express' ) ; const app = express ( ) ; app . use ( express . json ( { extended : false } ) ) ; //This is the line that you want to add app . post ( '/postroute' , ( req , res ) => { console . log ( 'body :' , req . body )

Bootstrap Modal Close In Jquery Code Example

Example 1: close modal jquery $('#myModal').modal('toggle'); $('#myModal').modal('show'); $('#myModal').modal('hide'); Example 2: data-dismiss= modal in jquery $(document).ready(function(){ // Open modal on page load $("#myModal").modal('show'); // Close modal on button click $(".btn").click(function(){ $("#myModal").modal('hide'); }); }); Example 3: jquery close bootstrap model $('#modal').modal('hide'); Example 4: close bootstrap modal with javascript $('#myModal').modal('hide');

Print Array Of Int C Code Example

Example: print an array in c int array [ 10 ] = { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 } ; int i ; for ( i = 0 ; i < 10 ; i ++ ) { printf ( "%d " , array [ i ] ) ; }

Cmd Pwd Code Example

Example 1: pwd in cmd $( pwd ) on windows cmd is %cd% . Example 2: pwd in command prompt ( echo @echo off echo echo ^%cd^% ) > C: \ WINDOWS \ pwd.bat

Angular 4 - Please Include Either "BrowserAnimationsModule" Or "NoopAnimationsModule" In Your Application

Answer : Adding the lines import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; and imports: [ BrowserAnimationsModule, ... ] to app.module.ts actually solves it One point is definitely you need to add BrowsersAnimationModule in your active Module. But apart from that you need to mention animations for that Synthetic selector (here @routerAnimations ) which is Angular Component Meta @Component({ selector: 'app-card-grid', templateUrl: './card-grid.component.html', styleUrls: ['./card-grid.component.scss'], animations: [ trigger('routerAnimations', [ state('collapsed', style({ height: '0px', minHeight: '0' })), state('expanded', style({ height: '*' })), transition('expanded <=> collapsed', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)')), ]), ], Response in comment if you still have any doubts

How To Print A Boolean C Code Example

Example: how to print boolean in c printf ( "%s" , x ? "true" : "false" ) ;

Cdn For Owl Carousel Code Example

Example 1: owl carousel cdn CSS CDN : ================ https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/assets/owl.carousel.min.css JS CDN : ================== https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/owl.carousel.min.js Example 2: owl carousel cdn ================ CSS CDN : ================ https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/assets/owl.carousel.min.css ================ JS CDN : ================== https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/owl.carousel.min.js

Change Activity's Theme Programmatically

Answer : As docs say you have to call setTheme before any view output. It seems that super.onCreate() takes part in view processing. So, to switch between themes dynamically you simply need to call setTheme before super.onCreate like this: public void onCreate(Bundle savedInstanceState) { setTheme(android.R.style.Theme); super.onCreate(savedInstanceState); setContentView(R.layout.activity_second); } user1462299's response works great, but if you include fragments , they will use the original activities theme. To apply the theme to all fragments as well you can override the getTheme() method of the Context instead: @Override public Resources.Theme getTheme() { Resources.Theme theme = super.getTheme(); if(useAlternativeTheme){ theme.applyStyle(R.style.AlternativeTheme, true); } // you could also use a switch if you have many themes that could apply return theme; } You do not need to call setTheme() in the onCreate() Method any