Posts

Showing posts from February, 2008

Button Generator Css Code Example

Example: css button generator <!-- The <button> tag produces a button. Place the text/media you want to be on the button by placing it between the opening and closing tags: --> < button > Click me! </ button > <!-- It is possible to add attributes, such as 'id' and 'type', into the opening tag, just like most other elements: --> < button id = " submitButton " type = " submit " > Click here to submit! </ button >

@media Only Screen Code Example

Example 1: media query @media only screen and ( max-width : 600 px ) { body { background-color : lightblue ; } } Example 2: css media query /* BOOSTRAP MEDIA BREAKPOINTS */ /* Small devices (landscape phones, 576px and up) */ @media ( min-width : 576 px ) { .selector { background-color : #f00 ; } } /* Medium devices (tablets, 768px and up) The navbar toggle appears at this breakpoint */ @media ( min-width : 768 px ) { } /* Large devices (desktops, 992px and up) */ @media ( min-width : 992 px ) { } /* Extra large devices (large desktops, 1200px and up) */ @media ( min-width : 1200 px ) { } Example 3: media queries les plus utilisees /* Sur les écrans, quand la largeur de la fenêtre fait au maximum 1280px */ @media screen and ( max-width : 1280 px ) /* Sur tous types d'écran, quand la largeur de la fenêtre est comprise entre 1024px et 1280px */ @media all and ( min-width : 1024 px ) and ( max-width : 1280 px ) /* Sur les téléviseurs */ @me

Css Text-border Code Example

Example 1: css text outline /* You have 2 options The first is experimental */ /* text-stroke */ #example { font-size : 1 em ; -webkit-text-stroke : 1 px #000000 ; } /* Use 4 shadows Probably best to use this until the above is standardised */ #example { font-size : 1 em ; text-shadow : -1 px -1 px 0 #000 , 1 px -1 px 0 #000 , -1 px 1 px 0 #000 , 1 px 1 px 0 #000 ; } Example 2: how to make border for letters in css h1 { /* 1 pixel black shadow to left, top, right and bottom */ text-shadow : -1 px 0 black , 0 1 px black , 1 px 0 black , 0 -1 px black ; font-family : sans ; color : yellow ; } Example 3: text border css h1 { -webkit-text-stroke : 1 px black ; } Example 4: css text color border h1 { text-shadow : 1 px 1 px #ffffff ; } Example 5: css text border h1 { color : white ; text-shadow : -1 px -1 px 0 #000 , 1 px -1 px 0 #000 , -1 px 1 px 0 #000 , 1 px 1 px 0 #000 ; } E

C++: What Is The Difference Between Ostream And Ostringstream?

Image
Answer : Put succinctly: ostringstream provides a streambuf , ostream requires the user to provide one. To understand the implications, it's necessary to understand a little how streams work, and I'm not sure that there's a good explanation of this on the Web. The basic abstraction of ostream is formatting textual output. You give it an int or a double (or a user defined type—more on that later), and it convert it into a stream of characters, of type char . What it does with that stream depends on the streambuf which is attached to it; this is an example of the strategy pattern, where streambuf is an abstract base class of the strategy[1]. The standard provides two implementations of streambuf , filebuf and stringbuf ; in practice, in all but the most trivial applications, you'll probably have some that you implement yourself. When outputting, you always use ostream ; it's the class over which the << operators are defined. You're form

How To Add Two Variables In Python To Make 1 Variable Code Example

Example: how to add 2 variables in python var1 = 5 var2 = 5 result = var1 + var2

Android GetResources().getDrawable() Deprecated API 22

Answer : You have some options to handle this deprecation the right (and future proof ) way, depending on which kind of drawable you are loading: A) drawables with theme attributes ContextCompat.getDrawable(getActivity(), R.drawable.name); You'll obtain a styled Drawable as your Activity theme instructs. This is probably what you need. B) drawables without theme attributes ResourcesCompat.getDrawable(getResources(), R.drawable.name, null); You'll get your unstyled drawable the old way. Please note: ResourcesCompat.getDrawable() is not deprecated! EXTRA) drawables with theme attributes from another theme ResourcesCompat.getDrawable(getResources(), R.drawable.name, anotherTheme); Edit: see my blog post on the subject for a more complete explanation You should use the following code from the support library instead: ContextCompat.getDrawable(context, R.drawable.***) Using this method is equivalent to calling: if (Build.VERSION.SDK_INT &

Adding Search Functionality In Select Options Using Bootstrap

Answer : To get a search functionality you must set the data-tokens attribute for each options. Here is your code after adding it. Let me know if you need additional help. $(function() { $('.selectpicker').selectpicker(); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" /> <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.10.0/js/bootstrap-select.min.js"></script> <link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.10.0/css/bootstrap-select.min.css" rel="stylesheet" /> <div class="container"> <div class="row"> <div class="col-xs-12

Bootstrap Popper Js Cdn Code Example

Example 1: bootstrap 4.1.3 cdn with popper < script src = " https://code.jquery.com/jquery-3.3.1.slim.min.js " integrity = " sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo " crossorigin = " anonymous " > </ script > < script src = " https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js " integrity = " sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49 " crossorigin = " anonymous " > </ script > < script src = " https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js " integrity = " sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy " crossorigin = " anonymous " > </ script > Example 2: bootstrap latest version cdn <! doctype html > < html lang = " en " > < head > <!-- Required meta tags --> <

C# Wpf File Select Dialog Code Example

Example: wpf choose file dialog all the Source code really helpfull recomend to check OpenFileDialog openFileDialog = new OpenFileDialog ( ) ; if ( openFileDialog . ShowDialog ( ) == true ) //if user chose a file { //do something }

Roblox Players Who Died Code Example

Example: roblox player died game : GetService ( 'Players' ) . PlayerAdded : Connect ( function ( player ) player. CharacterAdded : Connect ( function ( character ) character : WaitForChild ( "Humanoid" ) . Died : Connect ( function ( ) print ( player.Name .. " has died!" ) end ) end ) end )

Modulus Symbol In C++ Code Example

Example: Mod in c++ if ( iNum % 2 == 0 ) { cout << num << " is even " ; } // % is used to mod numbers

Translate English To Russian Letters Code Example

Example 1: english to russian translation you are beautiful ты красивая Example 2: english to russian translation Drunk girl алкоголичка

Angular.js Ng-repeat Filter By Property Having One Of Multiple Values (OR Of Values)

Answer : Best way to do this is to use a function: <div ng-repeat="product in products | filter: myFilter"> $scope.myFilter = function (item) { return item === 'red' || item === 'blue'; }; Alternatively, you can use ngHide or ngShow to dynamically show and hide elements based on a certain criteria. For me, it worked as given below: <div ng-repeat="product in products | filter: { color: 'red'||'blue' }"> <div ng-repeat="product in products | filter: { color: 'red'} | filter: { color:'blue' }"> I thing ng-if should work: <div ng-repeat="product in products" ng-if="product.color === 'red' || product.color === 'blue'">

Bootstrap Validator Example

Example 1: form validation javascript bootstrap <script > // Example starter JavaScript for disabling form submissions if there are invalid fields ( function ( ) { 'use strict' ; window .addEventListener ( 'load' , function ( ) { // Fetch all the forms we want to apply custom Bootstrap validation styles to var forms = document. getElementsByClassName ( 'needs-validation' ) ; // Loop over them and prevent submission var validation = Array .prototype .filter .call ( forms , function ( form ) { form .addEventListener ( 'submit' , function ( event ) { if ( form .checkValidity ( ) === false ) { event. preventDefault ( ) ; event. stopPropagation ( ) ; } form.classList. add ( 'was-validated' ) ; } , fa

CPU SIMD Vs GPU SIMD?

Answer : Both CPUs & GPUs provide SIMD with the most standard conceptual unit being 16 bytes/128 bits; for example a Vector of 4 floats (x,y,z,w). Simplifying: CPUs then parallelize more through pipelining future instructions so they proceed faster through a program. Then next step is multiple cores which run independent programs. GPUs on the other hand parallelize by continuing the SIMD approach and executing the same program multiple times; both by pure SIMD where a set of programs execute in lock step (which is why branching is bad on a GPU, as both sides of an if statement must execute; and one result be thrown away so that the lock step programs proceed at the same rate); and also by single program, multiple data (SPMD) where groups of the sets of identical programs proceed in parallel but not necessarily in lock step. The GPU approach is great where the exact same processing needs be applied to large volumes of data; for example a million vertices than need to be transform

Transform W3 Code Example

Example 1: css translate x and y transform : matrix ( 1 , 2 , 3 , 4 , 5 , 6 ) ; transform : matrix3d ( 1 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 1 ) ; transform : translate ( 120 px , 50 % ) ; transform : scale ( 2 , 0.5 ) ; transform : rotate ( 0.5 turn ) ; transform : skew ( 30 deg , 20 deg ) ; transform : scale ( 0.5 ) translate ( -100 % , -100 % ) ; transform : perspective ( 17 px ) ; Example 2: transform css div { width : 80 px ; height : 80 px ; background-color : skyblue ; } .rotated { transform : rotate ( 45 deg ) ; /* Equal to rotateZ(45deg) */ background-color : pink ; }

Cannot Kill Python Script With Ctrl-C

Answer : Ctrl + C terminates the main thread, but because your threads aren't in daemon mode, they keep running, and that keeps the process alive. We can make them daemons: f = FirstThread() f.daemon = True f.start() s = SecondThread() s.daemon = True s.start() But then there's another problem - once the main thread has started your threads, there's nothing else for it to do. So it exits, and the threads are destroyed instantly. So let's keep the main thread alive: import time while True: time.sleep(1) Now it will keep print 'first' and 'second' until you hit Ctrl + C . Edit: as commenters have pointed out, the daemon threads may not get a chance to clean up things like temporary files. If you need that, then catch the KeyboardInterrupt on the main thread and have it co-ordinate cleanup and shutdown. But in many cases, letting daemon threads die suddenly is probably good enough. KeyboardInterrupt and signals are only seen by the proc

Set Figure Size Latex Code Example

Example: latex width figure \documentclass { report } \usepackage [ english ] { babel } \usepackage { graphicx } \begin { document } \includegraphics [ height = 3 cm ] { example - image - b } \includegraphics [ width = 5 cm ] { example - image - b } \includegraphics [ height = 3 cm , width = 3 cm ] { example - image - b } \includegraphics [ height = 3 cm , width = 6 cm ] { example - image - b } \includegraphics [ keepaspectratio , height = 3 cm , width = 6 cm ] { example - image - b } \end { document }

Android Set Margin Top Programmatically Code Example

Example 1: set layout margin programmatically android int sizeInDP = 16 ; int marginInDp = ( int ) TypedValue . applyDimension ( TypedValue . COMPLEX_UNIT_DIP , sizeInDP , getResources ( ) . getDisplayMetrics ( ) ) ; setMargins ( view , sizeInDP , sizeInDP , sizeInDP , sizeInDP ) ; void setMargins ( View view , int left , int top , int right , int bottom ) { if ( view . getLayoutParams ( ) instanceof ViewGroup . MarginLayoutParams ) { ViewGroup . MarginLayoutParams p = ( ViewGroup . MarginLayoutParams ) view . getLayoutParams ( ) ; p . setMargins ( left , top , right , bottom ) ; view . requestLayout ( ) ; } } Example 2: how to set layout margin programmatically in android ViewGroup . LayoutParams p = this . getLayoutParams ( ) ; if ( p instanceof LinearLayout . LayoutParams ) { LinearLayout . LayoutParams lp = ( LinearLayout . LayoutParams ) p ; if ( _default ) lp . setMargins

Css Pen Cursor Code Example

Example: cursor as image css You can use own image or emoji as cursor < style > a { cursor : url ( "custom.gif" ) , url ( "custom.cur" ) , default ; } </ style > < p > Place your mouse pointer < a href = " # " > over me </ a > to reveal the custom cursor. </ p >

Android Studio Sdk Download For Windows Code Example

Example: android studio sdk After the installation, immediately close Android Studio,then start it as administrator. A message might popup asking for the sdk manager location. Ignore it (Close the popup). Go to Tools > SDK Manager and click on the edit button on the right of Android SDK Location. Then click Next, next and you're good to go. Android Studio will let you install the sdk manager.

Cursor Sets Code Example

Example: change the cursor css /* All differents cursors */ /* See https://www.w3schools.com/cssref/playit.asp?filename=playcss_cursor */ /* to test them all */ cursor : alias cursor : all-scroll ; cursor : auto ; cursor : cell ; cursor : context-menu ; cursor : col-resize ; cursor : copy ; cursor : crosshair ; cursor : default ; cursor : e-resize ; cursor : ew-resize ; cursor : grab ; cursor : grabbing ; cursor : help ; cursor : move ; cursor : n-resize ; cursor : ne-resize ; cursor : nesw-resize ; cursor : ns-resize ; cursor : nw-resize ; cursor : nwse-resize ; cursor : no-drop ; cursor : none ; cursor : not-allowed ; cursor : pointer ; cursor : progress ; cursor : row-resize ; cursor : s-resize ; cursor : se-resize ; cursor : sw-resize ; cursor : text ; cursor : url ( myBall.cur ) , auto ; cursor : w-resize ; cursor : wait ; cursor : zoom-in ; cursor : zoom-out ;

Android: Remove All The Previous Activities From The Back Stack

Answer : The solution proposed here worked for me: Java Intent i = new Intent(OldActivity.this, NewActivity.class); // set the new task and clear flags i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); startActivity(i); Kotlin val i = Intent(this, NewActivity::class.java) // set the new task and clear flags i.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK startActivity(i) However, it requires API level >= 11. Here is one solution to clear all your application's activities when you use the logout button. Every time you start an Activity, start it like this: Intent myIntent = new Intent(getBaseContext(), YourNewActivity.class); startActivityForResult(myIntent, 0); When you want to close the entire app, do this: setResult(RESULT_CLOSE_ALL); finish(); RESULT_CLOSE_ALL is a final global variable with a unique integer to signal you want to close all activities. Then define every activity's onActivityRe

Bootstrap Nowrap Col Code Example

Example 1: 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 2: bootstrap row no-wrap < div class = " row flex-nowrap " > < div class = " col " > </ div > < div class = " col " > </ div > </ div >

Css Rgba Transparent White Code Example

Example 1: rgba red color rgb(255,0,0) /*red*/ Hex #FF0000 Example 2: rgba white color rgb(255,255,255) /*white*/ Hex #FFFFFF