Posts

Showing posts from October, 2013

Bit Shift C Code Example

Example 1: bitwise operator bitwise complement of N = ~ N ( represented in 2 's complement form ) 2 'complement of ~ N = - ( ~ ( ~ N ) + 1 ) = - ( N + 1 ) Example 2: bitshift c i = 14 ; // Bit pattern 00001110 j = i >> 1 ; // here we have the bit pattern shifted by 1 thus we get 00000111 = 7 which is 14/2 Example 3: bitshift c int i = 7 ; // Decimal 7 is Binary (2^2) + (2^1) + (2^0) = 0000 0111 int j = 3 ; // Decimal 3 is Binary (2^1) + (2^0) = 0000 0011 k = ( i << j ) ; // Left shift operation multiplies the value by 2 to the power of j in decimal // Equivalent to adding j zeros to the binary representation of i // 56 = 7 * 2^3 // 0011 1000 = 0000 0111 << 0000 0011 Example 4: c right bit shift // 5: 0...0101 int a = 5 ; //shift int a 2 bits int n = ( a >> 2 ) ;

Code Formatter Visual Studio Code Code Example

Example 1: format code in vs code On Windows Shift + Alt + F. On Mac Shift + Option + F. Example 2: format in visual studio code Ctrl+K Ctrl+F

Beamer : Changing Font Size In Notes When Using \setbeameroption{show Notes On Second Screen}

Answer : You can define font size for notes with \setbeamerfont{note page}{size=\tiny} , default size is \small . Define the font size for notes as well as for subitems in notes with \setbeamerfont{note page}{size=\tiny} \addtobeamertemplate{note page}{\setbeamerfont{itemize/enumerate subbody}{size=\tiny}}{} as shown in this answer.

Can't Create WebStorm React Project

Answer : You need to install create-react-app npm module, before you use this feature. npm install -g create-react-app You can read more about this feature on the official release blog of WebStorm. Excerpt from the documentation : Make sure that you have create-react-app installed globally on your computer, for that run npm install -g create-react-app. Then to start your new project, double click on the start task in the npm tasks tool window to run it. That’s it! I had ie installed create-react-app globally using yarn and webstorm failed to find it. Then I used npm , not to mention globally and its working like a charm.

C Gcc Compiler Code Example

Example 1: online c compiler I Personally Like https : //www.programiz.com/c-programming/online-compiler/ Example 2: online c compiler You can try https : //www.onlinegdb.com/ this as well, works really well for me. You can also save code there . Example 3: c compiler online i reccomend online gdb https : //www.onlinegdb.com/online_c_compiler

Choose Siblings In Jquery Code Example

Example 1: jquery siblings $ ( "li.third-item" ) . siblings ( ) . css ( "background-color" , "red" ) ; Example 2: jquery select self and siblings $ ( this ) . siblings ( ) . addBack ( )

Boilerplate Html Css Javascript Code Example

Example 1: html boilerplate <!-- HTML, CSS, JavaScript w/ jQuery --> <! DOCTYPE html > < html > < head > < meta charset = " UTF-8 " > < title > title </ title > < style > /* CSS */ </ style > </ head > < body > <!-- HTML --> < script src = " https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js " type = " text/javascript " > </ script > < script > // JavaScript w/ jQuery </ script > </ body > </ html > Example 2: html boilerplate <! DOCTYPE html > < html > < head > < meta charset = " UTF-8 " > <!--Add meta tag, Google Font cdn, bootstrap cdn here--> </ head > < body > <!--text, img, and structure here--> <!-- Javascript & Jquary bootstrap cdn here--> </ body > <

Angular 7 And Angular Material How To Get The Selected Option Text Of Mat-select Instead Of Its Value

Answer : Sorry for being late to the party. I'm really horrified of reading all answers above... The solution is much easier and direct than any of the proposed answers, as the select component just passes the selected model as part of the selectionChange argument. But first, some corrections to your example. You've declared an interface, so USE IT: export interface FamilyRelation { id: number; type: string; } So, in your constructor: constructor() { this.familyRelationArray=[ { id: 1, type: 'Parent' }, { id: 2, type: 'Sister' } ] } and not what you put in your StackBlitz... Then your view will become this: <mat-select (selectionChange)="onChange($event)" id="family_relation" placeholder="Family Relation"> <mat-option *ngFor="let familyRelation of familyRelationArray;" [value]="familyRelation.id"> {{familyRelation.typ

106 F To C Code Example

Example: 14 f to c 14°F = -10°C

Change Button Color OnClick

Answer : There are indeed global variables in javascript. You can learn more about scopes, which are helpful in this situation. Your code could look like this: <script> var count = 1; function setColor(btn, color) { var property = document.getElementById(btn); if (count == 0) { property.style.backgroundColor = "#FFFFFF" count = 1; } else { property.style.backgroundColor = "#7FFF00" count = 0; } } </script> Hope this helps. 1. function setColor(e) { var target = e.target, count = +target.dataset.count; target.style.backgroundColor = count === 1 ? "#7FFF00" : '#FFFFFF'; target.dataset.count = count === 1 ? 0 : 1; /* () : ? - this is conditional (ternary) operator - equals if (count === 1) { target.style.backgroundColor = "#7FFF00"; target.dataset.count = 0; } else {

Angular @Output & EventEmitter Not Working

Answer : You should put the showEvent on the actual component selector app-navbar that has the @Output decorator and not on the nav element: <app-navbar (showEvent)="getToggle($event)"></app-navbar> You've got your handler on the wrong element (nav instead of app-navbar) <app-navbar (showEvent)="getToggle($event)"></app-navbar>

Clear Cache Laravel Command Code Example

Example 1: laravel clear cache php artisan cache : clear php artisan route : clear php artisan config : clear php artisan view : clear Example 2: laravel artisan clear cache //laravel artisan clear cache php artisan view : clear php artisan cache : clear php artisan route : clear php artisan config : clear Example 3: delete cache laravel //Borra la cache de laravel: Solo copia y pega. php artisan config : cache && php artisan route : clear && php artisan view : clear && php artisan config : clear && php artisan cache : clear && php artisan clear - compiled Example 4: artisan clear cache php artisan cache : clear Example 5: laravel clear cache //Laravel 7 / 2021-01 php artisan cache : clear php artisan route : clear php artisan config : clear php artisan optimize Example 6: clear laravel cache php artisan view : clear php artisan cache : clear php artisan route : clear php artisan config : clear php artisan optimize

Android: Inapp Billing: Error Response: 7:Item Already Owned

Answer : You purchased "android.test.purchased" but did not consume it. However, if you forgot to consume it immediately, it is not easy to consume it again. We can wait for 14 days. The fake purchase will be cleared automatically. But it is not acceptable. I spent a lot of time finding the solution: Add this line to get debug info. _iabHelper.enableDebugLogging(true, "TAG"); Run the app. In LogCat, you will see a json string like {"packageName":"com.example","orderId":"transactionId.android.test.purchased","productId":"android.test.purchased","developerPayload":"123","purchaseTime":0,"purchaseState":0,"purchaseToken":"inapp:com.example:android.test.purchased"} Consume it manually (Replace THAT_JSON_STRING with your json string) Purchase purchase; try { purchase = new Purchase("inapp", THAT_JSON_STRING, &q

Changing Root Password Does Not Change Sudo Password

Answer : You're changing root's password. sudo wants your user's password. To change it, try plain passwd , without arguments or running it through sudo . Alternately, you can issue: $ sudo passwd <your username> The password you use for sudo is the password of your own account, not the root account. sudo is used to grant you access to commands that need to be executed as root without giving you root access directly. To change your own password, use passwd without sudo.

Bootstrap 4 Change Tooltip Arrow Color

Answer : In bootstrap 4.1 you can use: .bs-tooltip-auto[x-placement^=bottom] .arrow::before, .bs-tooltip-bottom .arrow::before { border-bottom-color: red !important; } .bs-tooltip-auto[x-placement^=top] .arrow::before, .bs-tooltip-top .arrow::before { border-top-color: red !important; } .bs-tooltip-auto[x-placement^=left] .arrow::before, .bs-tooltip-left .arrow::before { border-left-color: red !important; } .bs-tooltip-auto[x-placement^=right] .arrow::before, .bs-tooltip-right .arrow::before { border-right-color: red !important; } The selector you are looking for is .tooltip.bs-tether-element-attached-left .tooltip-inner::before : .tooltip.bs-tether-element-attached-left .tooltip-inner::before { border-right-color: red; } If you want every tooltip arrow red - jsfiddle: .tooltip.bs-tether-element-attached-bottom .tooltip-inner::before { border-top-color: red; } .tooltip.bs-tether-element-attached-top .tooltip-inner::before { border-bottom-color:

Assetfinder Code Example

Example: assetfinder go get -u github.com/tomnomnom/assetfinder

Can I Use An Xbox 360 Controller To Play Xbox One?

Answer : The Xbox One cannot directly accept input from an Xbox 360 controller - however, with Windows 10, there is a work around. Windows 10 allows you to set up your Xbox One to stream to your computer. While streaming to your computer, you are directed to connect the controller into the computer, not the Xbox One. In this form, Xbox 360 controllers will work for playing Xbox One games. You can directly plug in a wired controller, or use an adapter, if you are using the wireless controllers.