Posts

Showing posts from September, 2014

Cmd Open Folder Command Code Example

Example: open directory windows command Just use "open [path_to_dir]" in Unix or "start [path_to_dir]" in Windows as: open . #Open current directdory in Unix start . #Open current directory in Windows

AddCss Using Jquery Code Example

Example: how to css in jquery $(init); function init() { $("h1").css("backgroundColor", "yellow"); $("#myParagraph").css({ "backgroundColor": "black", "color": "white" }); $(".bordered").css("border", "1px solid black"); }

Change Margin Latex Code Example

Example 1: latex page margin \usepackage{geometry} \geometry{ a4paper, total={170mm,257mm}, left=20mm, top=20mm, } Example 2: latex increase bottom margin article class \usepackage[top=2.75cm, bottom=2.50cm, left=3.00cm, right=2.50cm]{geometry}

Check If Is Null Javascript Code Example

Example 1: javascript is not null if ( data !== null && data !== '' ) { // do something } Example 2: check if variable is undefined or null jquery if ( variable == null ) { // variable is either null or undefined } Example 3: javascript check if null if ( variable === null ) { //Executes only if variable is null but not undefined //Code here } if ( variable == null ) { //Executes if variable is null OR undefined //Code here } Example 4: javascript check for null variables var myVar = null ; if ( myVar === null ) { //I am null; } if ( typeof myVar === 'undefined' ) { //myVar is undefined } Example 5: javascript check if undefined or null // simple check do the job if ( myVar ) { // comes here either myVar is not null, // or myVar is not undefined, // or myVar is not '' (empty string). }

Bootstrap Breakpoints: Core Concepts Example

Breakpoints are customizable widths that determine how your responsive layout behaves across device or viewport sizes in Bootstrap. Core concepts Breakpoints are the building blocks of responsive design. Use them to control when your layout can be adapted at a particular viewport or device size. Use media queries to architect your CSS by breakpoint. Media queries are a feature of CSS that allow you to conditionally apply styles based on a set of browser and operating system parameters. We most commonly use min-width in our media queries. Mobile first, responsive design is the goal. Bootstrap’s CSS aims to apply the bare minimum of styles to make a layout work at the smallest breakpoint, and then layers on styles to adjust that design for larger devices. This optimizes your CSS, improves rendering time, and provides a great experience for your visitors. Available breakpoints Bootstrap includes six default breakpoints, sometimes referred to as grid tiers , for

Code Formatting Discord Code Example

Example 1: discord text formatting // Italics * This text is italicized * // Bold * * This text is bold * * // Underline __This text is underlined__ // Strikethrough ~ ~ This text has a line through it ~ ~ // Indentation (not really sure what else to call this one) > This text is indented // Spoiler || This text is a spoiler || // Single line code block `This is a single line code block` // Multi-line code block ``` < lang > std :: cout << "This is a multi-line code block\n" ; ``` Example 2: format code discord ```my language my code ```

Change/update Firebase Notification Token Or Instance Id Forcefully Via Code?

Answer : Now i got my answer after facing many troubles for generating new or change token of firebase for push notification. 1) Delete old Firebase token let instance = FIRInstanceID.instanceID() _ = FIRInstanceID.delete(instance) FIRInstanceID.instanceID().delete { (err:Error?) in if err != nil{ print(err.debugDescription); } else { print("Token Deleted"); } } 2) Request new Firebase token if let token = FIRInstanceID.instanceID().token() { print("Token \(token) fetched"); } else { print("Unable to fetch token"); } FIRMessaging.messaging().connect { (error) in if (error != nil) { print("Error connecting to FCM. \(error.debugDescription)") } else { print("Connected to FCM.") } } UPDATE FOR SWIFT 4 & Firebase 4.8.2 (Follow simple two steps) 1) Delete old Token let instance = InstanceID.instanceID() instance.deleteID { (error) in print(error.debugD

Alternatives To System.exit(1)

Answer : The use of System.exit is frowned upon when the 'application' is really a sub-application (e.g. servlet, applet) of a larger Java application (server): in this case the System.exit could stop the JVM and hence also all other sub-applications. In this situation, throwing an appropriate exception, which could be caught and handled by the application framework/server is the best option. If the java application is really meant to be run as a standalone application, there is nothing wrong with using System.exit . in this case, setting an exit value is probably the easiest (and also most used) way of communicating failure or success to the parent process. I agree with the " throw an Exception " crowd. One reason is that calling System.exit makes your code difficult to use if you want other code to be able to use it. For example, if you find out that your class would be useful from a web app, or some kind of message consuming app, it would be nice to allow t

ADB Driver And Windows 8.1

Answer : UPDATE: Post with images ➤ English Version | Versión en Español If Windows fails to enumerate the device which is reported in Device Manager as error code 43 : Install this Compatibility update from Windows. If you already have this update but you get this error, restart your PC (unfortunately, it happened to me, I tried everything until I thought what if I restart...). If the device is listed in Device Manager as Other devices -> Android but reports an error code 28 : Google USB Driver didn't work for me. You could try your corresponding OEM USB Drivers, but in my case my device is not listed there. So, install the latest Samsung drivers: SAMSUNG USB Driver v1.7.23.0 Restart the computer ( very important ) Go to Device Manager, find the Android device, and select Update Driver Software . Select Browse my computer for driver software Select Let me pick from a list of device drivers on my computer Select ADB Interface from the list Select SAMSUN

Check If String Contains Uppercase Javascript Code Example

Example 1: check if letter is uppercase javascript const isUpperCase = ( string ) => / ^ [ A - Z ] * $ / . test ( string ) Example 2: regex for lowercase letters js function hasLowerCase ( str ) { return ( / [ a - z ] / . test ( str ) ) ; } Example 3: check if letter is uppercase javascript isUpperCase ( 'A' ) // true isUpperCase ( 'a' ) // false Example 4: check if letter is uppercase javascript var strings = 'this iS a TeSt 523 Now!' ; var i = 0 ; var character = '' ; while ( i <= strings . length ) { character = strings . charAt ( i ) ; if ( ! isNaN ( character * 1 ) ) { alert ( 'character is numeric' ) ; } else { if ( character == character . toUpperCase ( ) ) { alert ( 'upper case true' ) ; } if ( character == character . toLowerCase ( ) ) { alert ( 'lower case true' ) ; } } i ++

Antimatter Dimensions Limits Code Example

Example: antimatter dimensions setinterval setInterval(() => document.getElementById("maxall").click(), 100); //type into console //for maxall, other button names: //dimension sacrifice: "sacrifice" dimension boost: "softReset" //Antimatter galaxy: "secondSoftReset"

W3schools C Language Code Example

Example 1: c++ # include <bits/stdc++.h> using namespace std ; int main ( ) { return 0 ; } Example 2: c++ slslegal . com

W3school C Language Code Example

Example 1: c++ # include <bits/stdc++.h> using namespace std ; int main ( ) { return 0 ; } Example 2: c++ Very imp for placements

Roblox Lua New Position Out Of Cframe Code Example

Example: Cframe guide -- //Normal CFrame CFrame . new ( 0 , 0 , 0 ) -- //Quaternion CFrame CFrame . new ( 5 , 5 , 5 , 0 , 0 , 0 , 0 ) W , X , Y , Z

Sizeof 2d Vector Code Example

Example 1: how to get size of 2d vector in c++ myVector [ Vector [ 0 , 4 , 2 , 5 ] , Vector [ 1 , 4 , 2 ] ] ; /*When you call for myVector[1].size() it would return 3 and [0] would return 4. For the amount of rows (int vectors) in the 2d vector, you can just use myVector.size() You can run this to see it in actions*/ Example 2: size of a matrix using vector c++ // finding size of a square matrix myVector [ 0 ] . size ( ) ;

Arduino To Arduino Serial Communication Without A Library

Answer : Not sure it has a bearing on your problem or not, but I can't help highlight this: wait: while((tmp = serialReceive()) != 2){ goto wait; } That has to be the the most evil piece of code ever written in the history of mankind. I'm sorry, but it is. while((tmp = serialReceive()) != 2); is all you need. Or if you must be "pedantic": while((tmp = serialReceive()) != 2) { continue; } There is never any call to use goto (I don't know why it was ever even included in C), and certainly not to re-run a while loop that is going to re-run itself anyway. In your receiver you are using dynamic memory, and doing it extremely badly. First you start out with a pointer char *s; Then when you receive a data character you pass that pointer to your array_concat() routine as the source for where to copy data from: s = array_concat(s, strlen(s), tmp); You are at that point asking it for the length of the string in an undefine

Quick Sort Algorithm Geeksforgeeks Code Example

Example: quick sort program in c # include <stdio.h> void quicksort ( int number [ 25 ] , int first , int last ) { int i , j , pivot , temp ; if ( first < last ) { pivot = first ; i = first ; j = last ; while ( i < j ) { while ( number [ i ] <= number [ pivot ] && i < last ) i ++ ; while ( number [ j ] > number [ pivot ] ) j -- ; if ( i < j ) { temp = number [ i ] ; number [ i ] = number [ j ] ; number [ j ] = temp ; } } temp = number [ pivot ] ; number [ pivot ] = number [ j ] ; number [ j ] = temp ; quicksort ( number , first , j - 1 ) ; quicksort ( number , j + 1 , last ) ; } } int main ( ) { int i , count , number [ 25 ] ; printf ( "How many elements are u going to enter?: " ) ; scanf ( "%d" , & count ) ;

Chrome 80: Pause Script Execution (F8) Does Not Work When DevTools Is Not Focused

Image
Answer : Until it is fixed, you can use the following in your app: document.addEventListener('keydown', function (e) { if (e.keyCode == 119) { // F8 debugger; } }, { capture: true }); It's a bug in Chrome, I found the bugreport here: https://bugs.chromium.org/p/chromium/issues/detail?id=1049910&q=f8&can=2 WORKAROUND You can use option Break on -> subtree modifications It helps me to stop script execution instead of using f8 functionality. Steps: 1. Turn on 'Break on' for element you need to debug 2. Make some changes (hover or open drop down list as in my situation) 3. Browser will pause script execution

Caption And Label Table In Latex Code Example

Example: latex tabular caption \begin{table} \begin{tabular} ... \end{tabular} \caption{\label{tab:table-name}Your caption.} \end{table}