Posts

Showing posts from December, 2003

Dark Gradient Background Code Example

Example 1: linear gradient css background image background-image : url ( "IMAGE_URL" ) , linear-gradient ( #eb01a5 , #d13531 ) ; Example 2: linear gradient in CSS The general syntax of linear-gradient is- background : linear-gradient ( gradient direction , color1 , color2 , color3 , ..... ) ; Forexample- background : linear-gradient ( 46 deg , green , blue , yellow , pink ) ; NOTE : ( common mistake ) we forget to write the semi-colon ( ; )

Cpp Exception Code Example

Example 1: throw exception c++ # include <stdexcept> # include <limits> # include <iostream> using namespace std ; void MyFunc ( int c ) { if ( c > numeric_limits < char > :: max ( ) ) throw invalid_argument ( "MyFunc argument too large." ) ; //... } Example 2: c++ try try { //do } catch ( . . . ) { //if error do } Example 3: python exception try : # code block except ValueError as ve : print ( ve ) Example 4: exception handling c++ // exceptions # include <iostream> using namespace std ; int main ( ) { try { throw 20 ; } catch ( int e ) { cout << "An exception occurred. Exception Nr. " << e << '\n' ; } return 0 ; }

Concatenate Pandas DataFrames Generated With A Loop

Answer : Pandas concat takes a list of dataframes. If you can generate a list of dataframes with your looping function, once you are finished you can concatenate the list together: data_day_list = [] for i, day in enumerate(list_day): data_day = df[df.day==day] data_day_list.append(data_day) final_data_day = pd.concat(data_day_list) Exhausting a generator is more elegant (if not more efficient) than appending to a list. For example: def yielder(df, list_day): for i, day in enumerate(list_day): yield df[df['day'] == day] final_data_day = pd.concat(list(yielder(df, list_day)) Appending or concatenating pd.DataFrame s is slow. You can use a list in the interim and then create the final pd.DataFrame at the end with pd.DataFrame.from_records() e.g.: interim_list = [] for i,(k,g) in enumerate(df.groupby(['[*name of your date column here*'])): if i % 1000 == 0 and i != 0: print('iteration: {}'.format(i)) # just tells you where you are i

Windows Bat File Download File Code Example

Example 1: download file by command line windows iwr - outf index . html http : //superuser.com Example 2: download file by command line windows Invoke - WebRequest - OutFile index . html http : //superuser.com

Reverse Words In A Given String In Python Code Example

Example 1: how to reverse word order in python ## initializing the string string = "I am a python programmer" ## splitting the string on space words = string . split ( ) ## reversing the words using reversed ( ) function words = list ( reversed ( words ) ) ## joining the words and printing print ( " " . join ( words ) ) Example 2: reverse each word in a string python def reverse_word_sentence ( sentence ) : return ' ' . join ( word [ :: - 1 ] for word in sentence . split ( " " ) ) # Input : "Split Reverse Join" # Output : "tilpS esreveR nioJ" Example 3: reverse words in a given string function reverse ( word ) { word = word . split ( '.' ) . reverse ( ) . join ( '.' ) return word } word = 'i.like.this.program.very.much' word = 'pqr.mno' console . log ( reverse ( word ) )

Montserrat Google Font Free Download Code Example

Example: montserrat font google fonts <link rel= "preconnect" href= "https://fonts.gstatic.com" > <link href= "https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel= "stylesheet" >

Braket Notation In LaTeX

Image
Answer : There is the physics package: \documentclass{article} \usepackage{physics} \begin{document} $\bra{\Psi}\ket{\Psi}$ $\expval{A}{\Psi}$ \end{document} It offers many other goodies for typsetting physics things. Details can be found in the manul ( texdoc physics from command prompt/terminal). Use \braket{0|0} : \documentclass{standalone} \usepackage{braket} \begin{document} $\braket{0|0}$ \end{document} A solution using the mathtools package: \documentclass{article} \usepackage{mathtools} \DeclarePairedDelimiter\bra{\langle}{\rvert} \DeclarePairedDelimiter\ket{\lvert}{\rangle} \DeclarePairedDelimiterX\braket[2]{\langle}{\rangle}{#1 \delimsize\vert #2} \begin{document} \begin{align*} \bra{a} &= \bra*{\frac{a}{1}} \\ \ket{a} &= \ket*{\frac{a}{1}} \\ \braket{a}{b} &= \braket*{\frac{a}{1}}{\frac{b}{1}} \end{align*} \end{document} Notice that the starred versions of the macros scale automatically.

Android Architecture Components: Gradle Sync Error For Dependency Version

Answer : As @RedBassett mentions Support libraries depends on this lightweight import (runtime library) as explained at android developers documentation. This is, android.arch.lifecycle:runtime:1.0.0 is spreading up in the dependency tree as a result of an internal api (transitive) import so in my case I only had to include extensions library as "api" instead of "implementation" so that it will override its version to the highest (1.1.1). In conclusion, change implementation "android.arch.lifecycle:extensions:1.1.1" to api "android.arch.lifecycle:extensions:1.1.1" In your main build.gradle file allprojects { ... configurations { all { resolutionStrategy { force "android.arch.lifecycle:runtime:1.1.1" } } } } This will enforce version 1.1.1 Apparently support-v4 was causing the conflict. In the case of this question, the Gradle dependency task wasn&

Bruh Meaning Code Example

Example 1: bruh meaning bruuuuuuuuuh Example 2: bruh bruh meas bruh . bruh is a slang reference to "brother" its a thing that cool people say. Say it and then YOUR.CoolLevel = max;

Bootstrap Mobile Menu Icon Change To X Close

Answer : Your JavaScript replaces the inner html of the #ChangeToggle element to show either the X or the hamburger icon. Precisely clicking on the X or the hamburger menu instead of the #ChangeToggle will remove the element being clicked on which I think prevents it from bubbling up. As Bootstrap's collapse plugin uses an event handler on the document to determine if an element has been clicked, the collapse plugin will never get notified. I've created a small example where a click handler on the pink .outer area replaces the green .inner area. Note that clicking on the pink area (your #ChangeToggle ) will lead to two events, where clicking on the green area (your X icon) will lead to a single event. $(function() { $('.outer') .click(function() { $('.outer').html('<div class="inner"></div>'); fired('.js-outer'); }); $(document).on('click', '.outer', function() { fire

Css Font Italic Code Example

Example 1: italic css font - style : italic ; Example 2: font-style css #example { font - style : normal ; /* no specification, default */ font - style : italic ; /* font is italic */ font - style : oblique ; /* font is italic, even if italic letters are not specified for font family */ font - style : inherit ; /* inherit property from parent */ font - style : initial ; /* default value */ } Example 3: css how to make text italic /* I know i already made a HOW TO MAKE CSS TEXT ITALIC but here's one 100% css */ #italic - selector { font - style : italic ; } Example 4: css italics . my_italic_class { font - style : italic } Example 5: italic in css style = "font-style: italic;" Example 6: css font style . example { font - style : italic ; }

Guid Length C# Code Example

Example: c# guid length Guid . NewGuid ( ) . ToString ( ) => 36 characters ( Hyphenated ) e . g . 12345678 - 1234 - 1234 - 1234 - 123456789abc

Remove Style Attribute Using Jquery Code Example

Example: jquery remove css style //removing css with jQuery. i. e : set to default $ ( "#myElementID" ) . css ( "background-color" , "" ) ; //just blank it out

Flutter Margin Top Code Example

Example 1: flutter margins Container ( // Even Margin On All Sides margin : EdgeInsets . all ( 10.0 ) , // Symetric Margin margin : EdgeInsets . symmetric ( vertical : 10.0 , horizontal : 5.0 ) , // Different Margin For All Sides margin : EdgeInsets . fromLTRB ( 1.0 , 2.0 , 3.0 , 4.0 ) ; child : Child ( . . . ) , ) Example 2: flutter container margin @override Widget build ( BuildContext context ) { return Scaffold ( backgroundColor : Colors . white , body : Container ( margin : const EdgeInsets . only ( left : 20.0 , right : 20.0 ) , child : Container ( ) , ) , ) ; } Example 3: padding flutter top new Container ( margin : const EdgeInsets . only ( top : 10.0 ) , child : new RaisedButton ( onPressed : _submit , child : new Text ( 'Login' ) , ) ,

1hr 20 Minutes Timer Code Example

Example: 20 minute timer for good eyesight every 20 minutes look out the window at something 20 feet away for 20 seconds

COPY With Docker But With Exclusion

Answer : Create file .dockerignore in your docker build context directory (so in this case, most likely a directory that is a parent to node_modules) with one line in it: **/node_modules although you probably just want: node_modules Info about dockerignore: https://docs.docker.com/engine/reference/builder/#dockerignore-file For those who can't use a .dockerignore file (e.g. if you need the file in one COPY but not another): Yes, but you need multiple COPY instructions. Specifically, you need a COPY for each letter in the filename you wish to exclude. COPY [^n]* # All files that don't start with 'n' COPY n[^o]* # All files that start with 'n', but not 'no' COPY no[^d]* # All files that start with 'no', but not 'nod' Continuing until you have the full file name, or just the prefix you're reasonably sure won't have any other files. In my case, my Dockerfile contained an installation step, which produced the vendor director

Create Element Javascript W3school Code Example

Example: code for adding new elements in javascriipt js < html > < head > < title > t1 </ title > < script type = " text/javascript " > function addNode ( ) { var newP = document . createElement ( "p" ) ; var textNode = document . createTextNode ( " This is a new text node" ) ; newP . appendChild ( textNode ) ; document . getElementById ( "firstP" ) . appendChild ( newP ) ; } </ script > </ head > < body > < p id = " firstP " > firstP < p > </ body > </ html >

Can I Use MySQL Workbench To Create MariaDB?

Answer : From my experience -- Sure, you can use MySQL Workbench with MariaDB. However, I have tried basic functionalities only, like queries, schema design etc. Not sure about compatibility of advanced features. Just to list a few other options: MySQL Workbench Heidi Sql SQLyog So my experiences are, yes you can use MySQL Workbench for MariaDB database designs. However I needed to change the "Default Target MySQL Version" to 5.7 . This can be done by going to: Edit->Preferences in the menu. And finally to Modeling->MySQL. Since the latest MySQL version, v8.x, the SQL statements are not compatible with MariaDB statements (like creating an index). MariabDB creating an index on a table: INDEX `fk_rsg_sub_level_rsg_top_level1_idx` (`rgs_top_level_id` ASC) vs MySQL: INDEX `fk_rsg_sub_level_rsg_top_level1_idx` (`rgs_top_level_id` ASC) VISIBLE MariaDB can't handle this VISIBLE keyword in this example. Using an old MySQL Version, MySQL Workbench