Posts

Showing posts from March, 2013

Bootstrap Panel With Image And Text Side By Side Code Example

Example 1: boostrap card < div class = "card" style = "width: 18rem;" > < div class = "card-body" > < h5 class = "card-title" > Card title < / h5 > < h6 class = "card-subtitle mb-2 text-muted" > Card subtitle < / h6 > < p class = "card-text" > Some quick example text to build on the card title and make up the bulk of the card's content . < / p > < a href = "#" class = "card-link" > Card link < / a > < a href = "#" class = "card-link" > Another link < / a > < / div > < / div > Example 2: Bootstrap 4 Cards < div class = "card" > < div class = "card-body" > Basic card < / div > < / div >

81 Divided By 4 Code Example

Example: 81 divided by 4 81 divided by 4 = 20.25

Converting Multiple Columns From Character To Numeric Format In R

Answer : You could try DF <- data.frame("a" = as.character(0:5), "b" = paste(0:5, ".1", sep = ""), "c" = letters[1:6], stringsAsFactors = FALSE) # Check columns classes sapply(DF, class) # a b c # "character" "character" "character" cols.num <- c("a","b") DF[cols.num] <- sapply(DF[cols.num],as.numeric) sapply(DF, class) # a b c # "numeric" "numeric" "character" If you're already using the tidyverse, there are a few solution depending on the exact situation. Basic if you know it's all numbers and doesn't have NAs library(dplyr) # solution dataset %>% mutate_if(is.character,as.numeric) Test cases df <- data.frame( x1 = c('1','2','3'), x2 = c('4','5','6'), x3 = c('

Online Compiler C++ Shell Code Example

Example 1: c++ online compiler This two are good C ++ compilers : https : //www.onlinegdb.com/online_c++_compiler https : //www.programiz.com/cpp-programming/online-compiler/ Example 2: cpp online compiler Best Site With auto compile : https : //godbolt.org/z/nEo4j7 Example 3: cpp compiler online Three good online compilers : https : //www.onlinegdb.com/online_c++_compiler https : //www.programiz.com/cpp-programming/online-compiler/ http : //cpp.sh/ Example 4: online compiler cpp Good cpp compilers : -- -- -- -- -- -- -- -- -- -- - repl . it / languages / cpp www . w3schools . com / cpp / trycpp . asp ? filename = demo_helloworld onlinegdb . com / online_c ++ _compiler programiz . com / cpp - programming / online - complier cpp . sh

320 Youtube To Mp3 Converter Code Example

Example: youtube mp3 converter You can use WebTools , it's an addon that gather the most useful and basic tools such as a synonym dictionary , a dictionary , a translator , a youtube convertor , a speedtest and many others ( there are ten of them ) . You can access them in two clics , without having to open a new tab and without having to search for them ! - Chrome Link : https : //chrome.google.com/webstore/detail/webtools/ejnboneedfadhjddmbckhflmpnlcomge/ Firefox link : https : //addons.mozilla.org/fr/firefox/addon/webtools/

131 To Binary Code Example

Example: 10 binary to denary binary 10 = 2 denary

Html Hex Color Code Transparent Code Example

Example: hex color transparent background-color : #ffffff80 ; < --- 80 is 50 % opacity /*r g b a*/ # ff ff ff 80 ; Converted values : 100 % — FF 99 % — FC 98 % — FA 97 % — F7 96 % — F5 95 % — F2 94 % — F0 93 % — ED 92 % — EB 91 % — E8 90 % — E6 89 % — E3 88 % — E0 87 % — DE 86 % — DB 85 % — D9 84 % — D6 83 % — D4 82 % — D1 81 % — CF 80 % — CC 79 % — C9 78 % — C7 77 % — C4 76 % — C2 75 % — BF 74 % — BD 73 % — BA 72 % — B8 71 % — B5 70 % — B3 69 % — B0 68 % — AD 67 % — AB 66 % — A8 65 % — A6 64 % — A3 63 % — A1 62 % — 9 E 61 % — 9 C 60 % — 99 59 % — 96 58 % — 94 57 % — 91 56 % — 8 F 55 % — 8 C 54 % — 8 A 53 % — 87 52 % — 85 51 % — 82 50 % — 80 49 % — 7 D 48 % — 7 A 47 % — 78 46 % — 75 45 % — 73 44 % — 70 43 % — 6 E 42 % — 6 B 41 % — 69 40 % — 66 39 % — 63 38 % — 61 37 % — 5 E 36 % — 5 C 35 % — 59 34 % — 57 33 % — 54 32 % — 52 31 % — 4 F 30 % — 4 D 29 % — 4 A 28 % — 47 27 % — 45 26 % — 42 25 % — 40

Create A Temporary Table In A SELECT Statement Without A Separate CREATE TABLE

Answer : CREATE TEMPORARY TABLE IF NOT EXISTS table2 AS (SELECT * FROM table1) From the manual found at http://dev.mysql.com/doc/refman/5.7/en/create-table.html You can use the TEMPORARY keyword when creating a table. A TEMPORARY table is visible only to the current session , and is dropped automatically when the session is closed. This means that two different sessions can use the same temporary table name without conflicting with each other or with an existing non-TEMPORARY table of the same name. (The existing table is hidden until the temporary table is dropped.) To create temporary tables, you must have the CREATE TEMPORARY TABLES privilege. In addition to psparrow's answer if you need to add an index to your temporary table do: CREATE TEMPORARY TABLE IF NOT EXISTS temp_table ( INDEX(col_2) ) ENGINE=MyISAM AS ( SELECT col_1, coll_2, coll_3 FROM mytable ) It also works with PRIMARY KEY Use this syntax: CREATE TEMPORARY TABLE t1 (select * from t2);

Composition Vs Aggregation Code Example

Example: inheritance vs composition Inheritance should only be used when: Both classes are in the same logical domain The subclass is a proper subtype of the superclass The superclass’s implementation is necessary or appropriate for the subclass The enhancements made by the subclass are primarily additive. There are times when all of these things converge: Higher-level domain modeling Frameworks and framework extensions Differential programming If you’re not doing any of these things, you probably won’t need class inheritance very often. The “preference” for composition is not a matter of “better”, it’s a question of “most appropriate” for your needs, in a specific context. Hopefully these guidelines will help you out?

Css Flexbox Vertical Align Code Example

Example 1: css flex vertical align /* Answer to: "css flex vertical align" */ .box { display: flex; align-items: center; /* Vertical */ justify-content: center; /* Horizontal */ } .box div { width: 100px; height: 100px; } /* For more information go to: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/Aligning_Items_in_a_Flex_Container */ Example 2: flexbox align center vertically .Aligner { display: flex; align-items: center; justify-content: center; } .Aligner-item { max-width: 50%; } .Aligner-item--top { align-self: flex-start; } .Aligner-item--bottom { align-self: flex-end; } Example 3: flex align top css align-items: flex-start | flex-end | center | baseline | stretch .container { display: flex; align-items: flex-start; } Example 4: css vertical align with flexbox < div class = " align-vertically " > I am vertically centered! </ div > /*Css */ .align-vertically { background: #13b5ea; co

Android - SetOnClickListener Vs OnClickListener Vs View.OnClickListener

Answer : Imagine that we have 3 buttons for example public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Capture our button from layout Button button = (Button)findViewById(R.id.corky); Button button2 = (Button)findViewById(R.id.corky2); Button button3 = (Button)findViewById(R.id.corky3); // Register the onClick listener with the implementation above button.setOnClickListener(mCorkyListener); button2.setOnClickListener(mCorkyListener); button3.setOnClickListener(mCorkyListener); } // Create an anonymous implementation of OnClickListener private View.OnClickListener mCorkyListener = new View.OnClickListener() { public void onClick(View v) { // do something when the button is clicked // Yes we will handle

Conda List Installed Packages In Environment Code Example

Example 1: conda list environments conda info -- envs Example 2: how to see all the environments in Conda conda env list

Contain Js String If Code Example

Example 1: angular string contains const string = "foo" ; const substring = "oo" ; console . log ( string . includes ( substring ) ) ; Example 2: check for substring javascript const string = "javascript" ; const substring = "script" ; console . log ( string . includes ( substring ) ) ; //true

Can You Get The Timestamp From A Firebase Realtime Database Key?

Answer : As I said in my comment, you should not rely on decoding the timestamp from the generated id. Instead of that, you should simply store it in a property in your Firebase. That said, it turns out to be fairly easy to get the timestamp back: // DO NOT USE THIS CODE IN PRODUCTION AS IT DEPENDS ON AN INTERNAL // IMPLEMENTATION DETAIL OF FIREBASE var PUSH_CHARS = "-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz"; function decode(id) { id = id.substring(0,8); var timestamp = 0; for (var i=0; i < id.length; i++) { var c = id.charAt(i); timestamp = timestamp * 64 + PUSH_CHARS.indexOf(c); } return timestamp; } var key = prompt("Enter Firebase push ID"); if (key) { var timestamp = decode(key); console.log(timestamp+"\n"+new Date(timestamp)); alert(timestamp+"\n"+new Date(timestamp)); } I'll repeat my comment, just in case somebody thinks it is a good idea to use this code for anything e

Use The C Max Function Code Example

Example: How to define Max in define in c // For defining x > y # define MAX ( X , Y ) ( ( ( X ) > ( Y ) ) ? ( X ) : ( Y ) ) // For defining x < y # define MIN ( X , Y ) ( ( ( X ) < ( Y ) ) ? ( X ) : ( Y ) )

530 Valid Hostname Is Expected When Setting Up IIS 10 For Multiple Sites

Answer : Solution 1: When configured with two or more hostnames, the correct virtual host name and username must both be sent in the username by the ftp client. Separate the site name and user with the vertical line symbol: | www.example.com|MyUser So, in your FTP Client use this for the username: ftp.telefonievergelijken.nl|tv_ftp Solution 2: It appears that you're attempting to connect to the FTP site using a hostname which is not currently configured in any of the bindings to the FTP site within IIS. I base this only on the error output from Filezilla which you have included, as you have censored the hostname (even in example form) from the output, so there isn't much more to go on. You'll need to configure a binding on the FTP site which matches the hostname you are using to connect to the FTP site (whether that be from Filezilla or any other FTP client). EDIT: From your updated post information, I notice that your bindings for the FTP site are indeed in

Standard Deviation Symbol In Jupyter Notebook Markdown Code Example

Example 1: Jupyter markdown Jupyter Markdown Notation # Heading 1 ## Heading 2 ### Heading 3 #### Heading 4 ##### Heading 5 ###### Heading 6 Normal *Italics* or _Italics_ **Bold** or __Bold__ **_Bold and Italics_** ~~Strike Through~~ * Bullet Point or - Bullet Point or + Bullet Point 1 . Numbered 1 . Sub Number www.google.com Example 2: summation in jupyter markdown $$e^x=\sum_ { i= 0 } ^\infty \frac { 1 } { i! } x^i$$

Accolade Sentence Code Example

Example: dissuade sentence She said nothing to dissuade him.

Convert String To JSON Array

Answer : Here you get JSONObject so change this line: JSONArray jsonArray = new JSONArray(readlocationFeed); with following: JSONObject jsnobject = new JSONObject(readlocationFeed); and after JSONArray jsonArray = jsnobject.getJSONArray("locations"); for (int i = 0; i < jsonArray.length(); i++) { JSONObject explrObject = jsonArray.getJSONObject(i); } Input String [ { "userName": "sandeep", "age": 30 }, { "userName": "vivan", "age": 5 } ] Simple Way to Convert String to JSON public class Test { public static void main(String[] args) throws JSONException { String data = "[{\"userName\": \"sandeep\",\"age\":30},{\"userName\": \"vivan\",\"age\":5}] "; JSONArray jsonArr = new JSONArray(data); for (int i = 0; i < jsonArr.length(); i++) { JSONObject jsonO

How To Make An Overlay Css Code Example

Example 1: make background overlay css #element-with-background-image { position : relative ; background-image : url ( "//spin.atomicobject.com/wp-content/uploads/20170324102432/portfolio-tips-feature-image.jpg" ) ; } #color-overlay { position : absolute ; top : 0 ; left : 0 ; width : 100 % ; height : 100 % ; background-color : black ; opacity : 0.6 ; } Example 2: css overlay #hero { background-image : url ( ) ; background-size : cover ; background-position : top center ; position : relative ; } #hero ::after { content : '' ; position : absolute ; left : 0 ; top : 0 ; height : 100 % ; width : 100 % ; background-color : black ; opacity : 0.7 ; } Example 3: overlay a box in css html , body { min-height : 100 % ; } body { position : relative ; } .overlay { position : absolute ; top : 0 ; left : 0 ; width : 100 % ; height : 100 % ; z-index : 10 ; background-color : rgba ( 0 , 0 ,

How To Change Scroll Style In Css Code Example

Example 1: custom scrollbar body ::-webkit-scrollbar { width : 12 px ; /* width of the entire scrollbar */ } body ::-webkit-scrollbar-track { background : orange ; /* color of the tracking area */ } body ::-webkit-scrollbar-thumb { background-color : blue ; /* color of the scroll thumb */ border-radius : 20 px ; /* roundness of the scroll thumb */ border : 3 px solid orange ; /* creates padding around scroll thumb */ } Example 2: custom scroll bar /* width */ * ::-webkit-scrollbar { width : 10 px ; } /* Track */ * ::-webkit-scrollbar-track { background : #f1f1f1 ; } /* Handle */ * ::-webkit-scrollbar-thumb { background : #888 ; } /* Handle on hover */ * ::-webkit-scrollbar-thumb :hover { background : #555 ; } Example 3: custom style scrollbar in css /* Works on Firefox */ * { scrollbar-width : thin ; scrollbar-color : blue orange ; } /* Works on Chrome, Edge, and Safari */ * ::-webkit-scrollbar { w

Convert Int To Binary Java Code Example

Example 1: java integer to binary string int n = 1000 ; String s = Integer . toBinaryString ( n ) ; Example 2: int to binary java String binary = Integer . toBinaryString ( num ) ; Example 3: java int to binary string public static String makeBinaryString ( int n ) { StringBuilder sb = new StringBuilder ( ) ; while ( n > 0 ) { sb . append ( n % 2 ) ; n /= 2 ; } sb . reverse ( ) ; return sb . toString ( ) ; } Example 4: java how to convert string to int class Scratch { public static void main ( String [ ] args ) { String str = "50" ; System . out . println ( Integer . parseInt ( str ) ) ; // Integer.parseInt() } } Example 5: convert decimal to binary in java public class DecimalToBinaryExample2 { public static void toBinary ( int decimal ) { int binary [ ] = new int [ 40 ] ; int index = 0 ; while ( decimal > 0 ) { binary [ index ++ ] =

Cache Busting Index.html In A .Net Core Angular 5 Website

Answer : Here's what I ended up with after combining a bunch of answers. My goal was to never cache index.html. While I was in there, and since Angular nicely cache-busts the js and css files, I had it cache all other assets for a year. Just make sure you're using a cache-busting mechanism for assets, like images, that you're managing outside of Angular. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { // ... app.UseStaticFiles(); if (env.IsDevelopment()) { // no caching app.UseSpaStaticFiles(); } else { app.UseSpaStaticFiles(new StaticFileOptions { OnPrepareResponse = context => { context.Context.Response.Headers.Add("Cache-Control", "max-age=31536000"); context.Context.Response.Headers.Add("Expires", "31536000"); } }); } // ... app.UseSpa(spa => { spa.Options.DefaultPageStaticFileOptions = new StaticFileOptions

Console.firebase Code Example

Example: firebase javascript // Create Firebase project // Create Web app in Firebase console // Link project var firebaseConfig = { apiKey: // apiKey, authDomain: // authDomain, databaseURL: // databaseURL, projectId: // projectId, storageBucket: // storageBucket, messagingSenderId: // messagingSenderId, appId: // appId, measurementId: // measurementId }; firebase.initializeApp(firebaseConfig); // Add your dependencies //E.G. < script src = " https://www.gstatic.com/firebasejs/7.21.1/firebase-app.js " > </ script >

Css Text Size Code Example

Example 1: font size css .class { font-size : 12 px ; } Example 2: html font size <span style= "font-size:20px;" ></span> Example 3: css change text size p { font-size : 150 % /*px, cm, in, etc.*/ ; } Example 4: text size in CSS font-size : 2 em ; Example 5: css font-size #selector { font-size : 20 px ; } Example 6: font size css /* you can set the font size using font-size: and a number followed by px */ .class { font-size : 60 px ; }

Android Get Current Timestamp?

Answer : The solution is : Long tsLong = System.currentTimeMillis()/1000; String ts = tsLong.toString(); From developers blog: System.currentTimeMillis() is the standard "wall" clock (time and date) expressing milliseconds since the epoch. The wall clock can be set by the user or the phone network (see setCurrentTimeMillis(long)), so the time may jump backwards or forwards unpredictably. This clock should only be used when correspondence with real-world dates and times is important, such as in a calendar or alarm clock application. Interval or elapsed time measurements should use a different clock. If you are using System.currentTimeMillis() , consider listening to the ACTION_TIME_TICK , ACTION_TIME_CHANGED and ACTION_TIMEZONE_CHANGED Intent broadcasts to find out when the time changes. 1320917972 is Unix timestamp using number of seconds since 00:00:00 UTC on January 1, 1970. You can use TimeUnit class for unit conversion - from System.currentTimeMillis() to s

Transparent Black Background Css Code Example

Example 1: background color semi transparent .transparent { background-color : rgba ( 255 , 255 , 255 , 0.5 ) ; } .transparent { opacity : 0.5 ; } Example 2: css how to make background transparent /* Use RGBA */ background-color : rgba ( 255 , 255 , 0 , 0.75 ) ; /* Transparent Yellow */ Example 3: transparent background css div { width : 200 px ; height : 200 px ; display : block ; position : relative ; } div ::after { content : "" ; background : url ( image.jpg ) ; opacity : 0.5 ; top : 0 ; left : 0 ; bottom : 0 ; right : 0 ; position : absolute ; z-index : -1 ; }

76 Cm To Inches Code Example

Example: cm to inches const cm = 1; console.log(`cm:${cm} = in:${cmToIn(cm)}`); function cmToIn(cm){ var in = cm/2.54; return in; }

Gold Color Code In Photoshop Code Example

Example: rgb gold color ( 255 , 215 , 0 ) /*gold*/ Hex #FFD700

Confusion Between Prepared Statement And Parameterized Query In Python

Answer : Prepared statement: A reference to a pre-interpreted query routine on the database, ready to accept parameters Parametrized query: A query made by your code in such a way that you are passing values in alongside some SQL that has placeholder values, usually ? or %s or something of that flavor. The confusion here seems to stem from the (apparent) lack of distinction between the ability to directly get a prepared statement object and the ability to pass values into a 'parametrized query' method that acts very much like one... because it is one, or at least makes one for you. For example: the C interface of the SQLite3 library has a lot of tools for working with prepared statement objects, but the Python api makes almost no mention of them. You can't prepare a statement and use it multiple times whenever you want. Instead, you can use sqlite3.executemany(sql, params) which takes the SQL code, creates a prepared statement internally , then uses that statement in