Posts

Showing posts from March, 2010

Bootstrap Canvas Chart Radar Code Example

Example: chart.js radar chart var myRadarChart = new Chart ( ctx , { type : 'radar' , data : data , options : options } ) ;

Center Div Inside Div Code Example

Example 1: center a div in css .container { display: flex; justify-content: center; align-items: center; } Example 2: center div horizontally and vertically .parent { position: relative; } .child { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); } Example 3: css align center //HTML < div class = " parent " > < span > Hello World </ span > </ div > //CSS .parent { display: flex; justify-content: center; align-items: center; } Example 4: css center // example 1 div { display: grid; place-items: center; } // example 3 div{ display:flex; align-items:center; } // example 3 div { width: 100%; margin: 0 auto; } Example 5: css main container align center margin: 0 auto; Example 6: align a div in center of another div #container { width: 640px; /*can be in percentage also.*/ height: auto; margin: 0 auto; padding: 10px; position: relative; }

Bootstrap 4 Align Right Code Example

Example 1: bootstrap 4 center div <div class= "d-flex justify-content-start" >...</div> <div class= "d-flex justify-content-end" >...</div> <div class= "d-flex justify-content-center" >...</div> <div class= "d-flex justify-content-between" >...</div> <div class= "d-flex justify-content-around" >...</div> Example 2: bootstrap align right To aligning div in bootstrap you can use bootstrap classes like 1 . float-left 2 . float-right 3 . float-none <div class= "float-left" >Float left on all viewport sizes</div><br> <div class= "float-right" >Float right on all viewport sizes</div><br> <div class= "float-none" >Don't float on all viewport sizes</div> Example 3: float in bootstrap Toggle floats on any element , across any breakpoint , using our responsive float utilities. <div class= &quo

Android Tombstones Are Not Always Generated. How To Enforce Its Generation?

Answer : The dumps are created by debuggerd when a program crashes under Linux. When this happens, the kernel will send a signal to the dying program. This signal is caught by a special signal handler installed in every native Android application by the bionic C library (this is why tombstones aren't generated for Java-based Android apps). The signal handler contacts debuggerd (via a named pipe), which then connects back to the dying program using ptrace to read registers and memory to produce the tombstone and log entries. ./bionic/linker/debugger.cpp installs the debuggerd_signal_handler() signal handler for several signals that when invoked will try to use the pipe to communicate to debuggerd to create the tombstone file. I suppose that if the pipe communication fails or the ptrace back to the crashing process fails then the tombstone won't be generated. But those failures should still be logged (in the tombstone file or logcat or maybe both - I'm not sure). Th

Await Mongoose.connect Code Example

Example 1: async await mongoose connection (async () => { try { await mongoose.connect(dbURI, dbOptions) } catch (err) { console.log('error: ' + err) } })() Example 2: mongoose.connect mongoose.connect('mongodb://localhost:27017/myapp', {useNewUrlParser: true});

Automatically Update Sbt Dependencies To Latest Version

Answer : I've used the sbt-updates plugin for this purpose locally for many years—simply add it to your local sbt user configuration and then run sbt dependencyUpdates in your project directory, and you'll get a list of dependencies that have updates in Maven Central (or whatever other repositories you have configured for that project). The scala-steward bot builds on sbt-updates to provide GitHub pull requests for dependency updates. You can either add your projects to the main instance's configuration if they're open source (I do this personally for 15-20 projects, and while it's not perfect, it's hugely useful, and getting better all the time), or run your own instance (which I've not tried personally). Note that neither of these choices verifies that the dependency updates are compatible with each other—just that they're the latest. You'll still need to watch carefully for evictions, etc.

C# Programming Tutorial Point Code Example

Example: C# TutorialsTeacher public int MyAutoImplementedProperty { get ; set ; }

Vs Code Terminal Colors Code Example

Example 1: visual studio code change terminal color "workbench.colorCustomizations" : { "terminal.background" : "#1D2021" , "terminal.foreground" : "#A89984" , "terminalCursor.background" : "#A89984" , "terminalCursor.foreground" : "#A89984" , "terminal.ansiBlack" : "#1D2021" , "terminal.ansiBlue" : "#0D6678" , "terminal.ansiBrightBlack" : "#665C54" , "terminal.ansiBrightBlue" : "#0D6678" , "terminal.ansiBrightCyan" : "#8BA59B" , "terminal.ansiBrightGreen" : "#95C085" , "terminal.ansiBrightMagenta" : "#8F4673" , "terminal.ansiBrightRed" : "#FB543F" , "terminal.ansiBrightWhite" : "#FDF4C1" , "terminal.ansiBrightYell

Bootstrap Footer Bottom Of Page Code Example

Example 1: sticky footer bootstrap 3 < style > .footer { position : fixed ; left : 0 ; bottom : 0 ; width : 100 % ; background-color : red ; color : white ; text-align : center ; } </ style > Example 2: bootstrap footer bottom of page <!--Use the navbar component and add .navbar-fixed-bottom class:--> <!--Bootstrap 3.x--> < div class = " navbar navbar-fixed-bottom " > </ div > <!--Bootstrap 4.x--> < div class = " navbar fixed-bottom " > </ div > <!--Don't forget to add body { padding-bottom: 70px; } or otherwise the page content may be covered.--> Example 3: how to make footer static bootsrap < div class = " sticky-top " > ... </ div >

Adminlte Github Code Example

Example 1: adminlte npm install admin-lte@^3.0 --save Example 2: admin lte laravel Route::get ( 'admin' , function ( ) { return view ( 'admin_template' ) ; } ) ;

Check If A Property Was Set - Using Moq

Answer : I think VerifySet is the right approach. It would look something like this: //Arrange var mock = new Mock<IDRepository>(); var mockRequest = new Mock<Request>(); // TODO: set some expectations here var dManager = new DManager(mock.Object); //Act dManager.Create(mockRequest.Object); //Assert mockRequest.VerifySet(x => x.Status = Status.Submitted); I believe in your case, it blows up because you haven't set up your Request mock to handle the set operation on Status. One easy way to do that is using SetupAllProperties , like so: //Arrange var mock = new Mock<IDRepository>(); var mockRequest = new Mock<Request>(); mockRequest.SetupAllProperties(); I think you should use strict behavior by default, then you can make the verification with a single call. It also makes you write your test more explicitly. [TestMethod] public void AddingNewRequestSetsStatusToSubmitted() { //Arrange var mock = new Mock<IDRepository>(MockBehav

Animation Roblox Id Code Example

Example: roblox animation id local Players = game : GetService ( "Spelers" ) local player = Players : FindFirstChild ( "Builderman" ) lokaal karakter = speler . Karakterlocal humanoid = character : FindFirstChild ( "Humanoid" ) local animation = Instance.new ( "Animatie" ) animatie . AnimationId =

Android Studio Logcat Not Showing Logs

Image
Answer : In my case in Android 2.2, for some reason, Firebase was selected by default in the dropdown box marked above. So logs didn't drop. I just needed to change it to No Filters . Then it worked. I even tried restarting the logcat, that didn't work too. No Filters did the magic. Hope this helps someone. Edit : You can as well select Show only selected application for logcat to show only the current debugging process, i.e your app. You may be hiding it, try pressing Alt + 6 to open Log tab. Look at the log level:- it must be verbose. Restart adb. If that doesn't works restart the android studio. In Logcat window reselect your device then reselect your app if it didn't appear restart adb using two commands: adb kill-server adb start-server Happy debugging :)

Button Onclick In Angular Code Example

Example: onclick event in angular ( click ) = "myClickFunction($event)"

Android: Check If Location Services Enabled Using Fused Location Provider

Answer : This android developer training tutorial could help - here's the basics: Code to run in your Activity onCreate(): // Create an instance of GoogleAPIClient. if (mGoogleApiClient == null) { mGoogleApiClient = new GoogleApiClient.Builder(this) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .addApi(LocationServices.API) .build(); } mGoogleApiClient.connect(); LocationRequest mLocationRequest = new LocationRequest(); mLocationRequest.setInterval(10000); mLocationRequest.setFastestInterval(5000); mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); LocationSettingsRequest.Builder builder = new LocationSettingsRequest.Builder() .addLocationRequest(mLocationRequest); PendingResult<LocationSettingsResult> result = LocationServices.SettingsApi.checkLocationSettings(mGoogleApiClient, builder.build())

Camera Position In World Coordinate From Cv::solvePnP

Answer : If with "world coordinates" you mean "object coordinates", you have to get the inverse transformation of the result given by the pnp algorithm. There is a trick to invert transformation matrices that allows you to save the inversion operation, which is usually expensive, and that explains the code in Python. Given a transformation [R|t] , we have that inv([R|t]) = [R'|-R'*t] , where R' is the transpose of R . So, you can code (not tested): cv::Mat rvec, tvec; solvePnP(..., rvec, tvec, ...); // rvec is 3x1, tvec is 3x1 cv::Mat R; cv::Rodrigues(rvec, R); // R is 3x3 R = R.t(); // rotation of inverse tvec = -R * tvec; // translation of inverse cv::Mat T = cv::Mat::eye(4, 4, R.type()); // T is 4x4 T( cv::Range(0,3), cv::Range(0,3) ) = R * 1; // copies R into T T( cv::Range(0,3), cv::Range(3,4) ) = tvec * 1; // copies tvec into T // T is a 4x4 matrix with the pose of the camera in the object frame Update: Later, to use T with OpenGL

Reg Query Syntax Examples

Example: get regedit value cmd REG QUERY HKLM\Software\Microsoft\ResKit / v Version

Change Remote Repository Credentials (authentication) On Intellij IDEA 14

Image
Answer : The easiest of all the above ways is to: Go to Settings>>Appearance & Behavior>>System Settings>>Passwords Change the setting to not store passwords at all Invalidate and restart IntelliJ Go to Settings>>Version Control>>Git>>SSH executable: Build-in Do a fetch/pull operation Enter the password when prompted Again go to Settings>>Appearance & Behavior>>System Settings>>Passwords This time select store passwords on disk(protected with master password) Voila! Note that this will not work if your password is in your URL itself. If that is the case then you need to follow the steps given by @moleksyuk here You also choose to use the credentials helper option in IntelliJ to achieve similar functionality as suggested by Ramesh here After trying several answers, I was finally able to solve this issue (on window 10), >git fetch remote: HTTP Basic: Access denied fatal: Authentication failed for '

Stoi() Cpp Code Example

Example 1: convert stirng to int c++ int thing = std :: stoi ( string ) ; Example 2: stoi c++ // stoi example # include <iostream> // std::cout # include <string> // std::string, std::stoi int main ( ) { std :: string str_dec = "2001, A Space Odyssey" ; std :: string str_hex = "40c3" ; std :: string str_bin = "-10010110001" ; std :: string str_auto = "0x7f" ; std :: string :: size_type sz ; // alias of size_t int i_dec = std :: stoi ( str_dec , & sz ) ; int i_hex = std :: stoi ( str_hex , nullptr , 16 ) ; int i_bin = std :: stoi ( str_bin , nullptr , 2 ) ; int i_auto = std :: stoi ( str_auto , nullptr , 0 ) ; std :: cout << str_dec << ": " << i_dec << " and [" << str_dec . substr ( sz ) << "]\n" ; std :: cout << str_hex << ": " << i_hex <<

Best Way To Polyfill ES6 Features In React App That Uses Create-react-app

Answer : Update : The create-react-app polyfill approach and docs have changed since this question/answer. You should now include react-app-polyfill (here) if you want to support older browsers like ie11. However, this only includes the " ...minimum requirements and commonly used language features ", so you'll still want to use one of the approaches below for less common ES6/7 features (like Array.includes ) These two approaches both work: 1. Manual imports from react-app-polyfill and core-js Install react-app-polyfill and core-js (3.0+): npm install react-app-polyfill core-js or yarn add react-app-polyfill core-js Create a file called (something like) polyfills.js and import it into your root index.js file. Then import the basic react-app polyfills, plus any specific required features, like so: /* polyfills.js */ import 'react-app-polyfill/ie11'; import 'core-js/features/array/find'; import 'core-js/features/array/includes';