Posts

Showing posts from May, 2021

Css Style Placeholder Text Code Example

Example 1: css placeholder color ::-webkit-input-placeholder { /* Chrome/Opera/Safari */ color: pink; } ::-moz-placeholder { /* Firefox 19+ */ color: pink; } :-ms-input-placeholder { /* IE 10+ */ color: pink; } :-moz-placeholder { /* Firefox 18- */ color: pink; } Example 2: css style placeholder input::-webkit-input-placeholder {/* Chrome/Opera/Safari/Edge */ /*styles here*/ } input::-ms-input-placeholder { /* Microsoft Edge */ /*styles here*/ } input:-ms-input-placeholder {/* IE 10+ */ /*styles here*/ } input::-moz-placeholder {/* Firefox 19+ */ opacity: 1; /*Firefox by default has an opacity object that usually is ideal to reset so it matches webkit*/ /*styles here*/ } input:-moz-placeholder {/* Firefox 18- */ opacity: 1; /*Firefox by default has an opacity object that usually is ideal to reset so it matches webkit*/ /*styles here*/ } input::placeholder { /*styles here*/ } Example 3: css style placeholder <! DOCTYPE html > < html lang = " en "

Programiz Online C Compiler Code Example

Example 1: online c compiler I Personally Like https : //www.programiz.com/c-programming/online-compiler/ Example 2: c compiler online i reccomend online gdb https : //www.onlinegdb.com/online_c_compiler Example 3: c compilers // I Like https://www.programiz.com/c-programming/online-compiler/

How To Generate Random Color In Css Code Example

Example 1: random color in javascript var randomColor = Math. floor ( Math. random ( ) * 16777215 ) . toString ( 16 ) ; Example 2: random color generator css,javascript,html //Javascript function randomColor ( ) { var color = "#" ; var randomHex = "123456ABCDEF" ; for ( var i = 0 ; i< 6 ;i + + ) { color+= randomHex[Math. floor ( Math. random ( ) * 16 ) ] } return color ; } var mytimer ; function setColor ( ) { $ ( "body" ) . css ( "background-color" , randomColor ) ; } var mytimer = setInterval ( setColor , .8000 ) ; // html !DOCTYPE html> <html> <head> <title>Page Title</title> <script src= "https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js" ></script> </head> <body> //include javascript file. </body> </html>

Can Overridden Method Have Different Return Type Code Example

Example: Return type of override method should be same or not return type MUST be same in method overriding

Html Tag Make A Hollow Circle With Border Code Example

Example: css circle border .circle { background-color : #fff ; border : 1 px solid red ; height : 100 px ; border-radius : 50 % ; -moz-border-radius : 50 % ; -webkit-border-radius : 50 % ; width : 100 px ; } <div class= "circle" ></div>

Change Height Of Rect Transform Unity Code Example

Example: set width of rect transform unity rectTransform . sizeDelta = new Vector2 ( 50 , 50 ) ;

Bootstrap Text Over Image Example

Example 1: bootstrap left image right text < div class = " card " > < div class = " row no-gutters " > < div class = " col-auto " > < img src = " //placehold.it/200 " class = " img-fluid " alt = " " > </ div > < div class = " col " > < div class = " card-block px-2 " > < h4 class = " card-title " > Title </ h4 > < p class = " card-text " > Description </ p > < a href = " # " class = " btn btn-primary " > BUTTON </ a > </ div > </ div > </ div > < div class = " card-footer w-100 text-muted " > Footer stating cats are CUTE little animals

Onkeyup Jquery Code Example

Example 1: check when keyup an input from a specific form jquery var inputs = $ ( '#formID' ) . find ( 'input[type="text"]' ) ; inputs . keyup ( function ( ) { console . log ( $ ( this ) ) ; } ) ; Example 2: javascript on keypu < input type = "text" onkeyup = "myFunction()" > Example 3: add javascript keyup on input < input type = "text" class = "form-control" placeholder = "Search" id = "search_id" / > < script type = "text/javascript" > const log = document . getElementById ( 'search_id' ) ; document . addEventListener ( 'keyup' , logKey ) ; function logKey ( e ) { const value = log . value ; if ( e . key == = 'Enter' || e . keyCode == = 13 ) { transmit ( { search : value } ) ; } } ; < / script > Example 4: set value of attribute using each and keyup jquery $ ( '.EntryField' ) . key

Creating An RxJS Observable From A (server Sent) EventSource

Answer : You could use the following code to manually create Observable for EventSource stream: export class AppComponent implements OnInit { someStrings:string[] = []; constructor(private zone: NgZone) {} ngOnInit(){ const observable = Observable.create(observer => { const eventSource = new EventSource('/interval-sse-observable'); eventSource.onmessage = x => observer.next(x.data); eventSource.onerror = x => observer.error(x); return () => { eventSource.close(); }; }); this.subscription = observable.subscribe({ next: guid => { this.zone.run(() => this.someStrings.push(guid)); }, error: err => console.error('something wrong occurred: ' + err) }); } } // somewhere // this.subscription.unsubscribe() Don't forget to import the NgZone class: import {Component, OnInit, NgZone} from '@angular/core'; See also Angular2 View Not Changing After Data Is Updat

Alter User Mysql Code Example

Example 1: mysql create user CREATE USER 'user' @'localhost' IDENTIFIED BY 'password' ; GRANT ALL PRIVILEGES ON * . * TO 'user' @'localhost' ; FLUSH PRIVILEGES ; Example 2: alter user mysql native password ALTER USER 'root' @'localhost' IDENTIFIED WITH mysql_native_password BY '<password>' ; Example 3: change mysql password from command line ALTER USER 'root' @'localhost' IDENTIFIED BY 'New-Password' ; Example 4: alter user root mysql ALTER USER 'root' @'localhost' IDENTIFIED BY 'newPassword' ; Example 5: mysql set password for user # `SET PASSWORD FOR <user> = PASSWORD('<plaintext_password>')` is deprecated SET PASSWORD FOR < user > = '<plaintext_password>' ; FLUSH PRIVILEGES ; Example 6: change user mysql [ madegow @fedora20 ~ ] $ mysql - u root - p Enter password: . . . MariaDB

Can't Connect To Localhost On SQL Server Express 2012 / 2016

Image
Answer : According to Aaron Bertand: You need to verify that the SQL Server service is running. You can do this by going to Start > Control Panel > Administrative Tools > Services , and checking that the service SQL Server ( SQLEXPRESS ) is running. If not, start it. While you're in the services applet, also make sure that the service SQL Browser is started. If not, start it. You need to make sure that SQL Server is allowed to use TCP/IP or named pipes. You can turn these on by opening the SQL Server Configuration Manager in Start > Programs > Microsoft SQL Server 2012 > Configuration Tools (or SQL Server Configuration Manager ), and make sure that TCP/IP and Named Pipes are enabled. If you don't find the SQL Server Configuration Manager in the Start Menu you can launch the MMC snap-in manually. Check SQL Server Configuration Manager for the path to the snap-in according to your version. Verify your SQL Server connection authentication mode matche

Youtube To Mp3 Convert Online Y2mate 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/

Anaconda/conda - Install A Specific Package Version

Answer : To install a specific package: conda install <pkg>=<version> eg: conda install matplotlib=1.4.3 There is no version 1.3.0 for rope . 1.3.0 refers to the package cached-property . The highest available version of rope is 0.9.4 . You can install different versions with conda install package=version . But in this case there is only one version of rope so you don't need that. The reason you see the cached-property in this listing is because it contains the string "rope" : "cached-p rope erty" py35_0 means that you need python version 3.5 for this specific version. If you only have python3.4 and the package is only for version 3.5 you cannot install it with conda. I am not quite sure on the defaults either. It should be an indication that this package is inside the default conda channel. If any of these characters, '>', '<', '|' or '*', are used, a single or double quotes must be

Abstract W3schools Code Example

Example 1: abstraction in java Abstraction is defined as hiding internal implementation and showing only necessary information. // abstract class abstract class Addition { // abstract methods public abstract int addTwoNumbers(int number1, int number2); public abstract int addFourNumbers(int number1, int number2, int number3, int number4); // non-abstract method public void printValues() { System.out.println("abstract class printValues() method"); } } class AbstractMethodExample extends Addition { public int addTwoNumbers(int number1, int number2) { return number1 + number2; } public int addFourNumbers(int number1, int number2, int number3, int number4) { return number1 + number2 + number3 + number4; } public static void main(String[] args) { Addition add = new AbstractMethodExample(); System.out.println(add.addTwoNumbers(6, 6)); System.out.println(add.addFourNumbers(8, 8, 3, 2)); add.p

Airpods Keep Disconnecting From Pc Windows 10 Code Example

Example: airpods connecting and then disconnecting I opened Bluetooth preferences on my MAC and told it to forget my AirPods. I then plugged the AirPods case directly into my MAC using the lightening cable. I held down the button on the AirPods case until it flashed white, then on my MAC selected the AirPods and clicked connect.

Convert PySpark Dataframe Column From List To String

Answer : While you can use a UserDefinedFunction it is very inefficient . Instead it is better to use concat_ws function: from pyspark.sql.functions import concat_ws df.withColumn("test_123", concat_ws(",", "test_123")).show() +----+----------------+ |uuid| test_123| +----+----------------+ | 1|test,test2,test3| | 2|test4,test,test6| | 3|test6,test9,t55o| +----+----------------+ You can create a udf that joins array/list and then apply it to the test column: from pyspark.sql.functions import udf, col join_udf = udf(lambda x: ",".join(x)) df.withColumn("test_123", join_udf(col("test_123"))).show() +----+----------------+ |uuid| test_123| +----+----------------+ | 1|test,test2,test3| | 2|test4,test,test6| | 3|test6,test9,t55o| +----+----------------+ The initial data frame is created from: from pyspark.sql.types import StructType, StructField schema = StructType([StructField("uuid",Int

Set Background Image Tkinter Code Example

Example 1: background image in python om tkinter import * from PIL import ImageTk canvas = Canvas ( width= 600 , height= 800 , bg= 'blue' ) canvas. pack ( expand=YES , fill=BOTH ) image = ImageTk. PhotoImage ( file= "File route" ) canvas.create_ image ( 10 , 10 , image=image , anchor=NW ) mainloop ( ) Example 2: ad background image with tkinter app = Tk ( ) app. title ( "Welcome" ) image2 =Image. open ( 'C:\\Users\\adminp\\Desktop\\titlepage\\front.gif' ) image1 = ImageTk. PhotoImage ( image2 ) w = image1. width ( ) h = image1. height ( ) app. geometry ( '%dx%d+0+0' % ( w , h ) ) #app. configure ( background= 'C:\\Usfront.png' ) #app. configure ( background = image1 ) labelText = StringVar ( ) labelText. set ( "Welcome !!!!" ) #labelText. fontsize ( '10' ) label1 = Label ( app , image=image1 , textvariable=labelText , font= ( "Times New Roman" , 24 ) , justify=CENT

Amazon Redshift - COPY From CSV - Single Double Quote In Row - Invalid Quote Formatting For CSV Error

Answer : It's 2017 and I run into the same problem, happy to report there is now a way to get redshift to load csv files with the odd " in the data. The trick is to use the ESCAPE keyword, and also to NOT use the CSV keyword. I don't know why, but having the CSV and ESCAPE keywords together in a copy command resulted in failure with the error message "CSV is not compatible with ESCAPE;" However with no change to the loaded data I was able to successfully load once I removed the CSV keyword from the COPY command. You can also refer to this documentation for help: http://docs.aws.amazon.com/redshift/latest/dg/copy-parameters-data-conversion.html#copy-escape Unfortunately, there is no way to fix this. You will need to pre-process the file before loading it into Amazon Redshift. The closest options you have are CSV [ QUOTE [AS] 'quote_character' ] to wrap fields in an alternative quote character, and ESCAPE if the quote character is preceded by

License For Package Android SDK Platform 28 Not Accepted. Code Example

Example: To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager. # Android SDK Tools 25.2 .3 and lower. Install the latest `platform-tools` for android-25 android update sdk --no-ui --all --filter platform-tools , android-25 , extra-android-m2repository # Android SDK Tools 25.2 .3 and higher sdkmanager --update

Can I Change My Ubuntu Desktop Into A Different Flavour (like Kubuntu)?

Answer : The main difference between main Ubuntu, Xubuntu, Kubuntu, and Lubuntu is the Desktop Environment. You can install one of these DEs onto your system with the following commands: Ubuntu: sudo apt-get install ubuntu-desktop Kubuntu: sudo apt-get install kubuntu-desktop Xubuntu: sudo apt-get install xubuntu-desktop Lubuntu: sudo apt-get install lubuntu-desktop Ubuntu GNOME: sudo apt-get install ubuntu-gnome-desktop From Ubuntu 17.10 GNOME became the default desktop environment/shell/manager. So if you're running Ubuntu 17.10 forwards (including current 18.04), you can install the default desktop: $ sudo apt install ubuntu-desktop To remove any of these, run the command that you used to install but instead of install say purge (i.e., sudo apt-get purge kubuntu-desktop ). Then you also need to run this command to complete the remove: sudo apt-get autoremove --purge The autoremove command removes all the packages that were installed. The way t

Add Round Corners To Rect Windows Code Example

Example: windows form rounded corners using System ; using System . Windows . Forms ; using System . Runtime . InteropServices ; namespace WindowsFormsApplication1 { public partial class Form1 : Form { [ DllImport ( "Gdi32.dll" , EntryPoint = "CreateRoundRectRgn" ) ] private static extern IntPtr CreateRoundRectRgn ( int nLeftRect , // x-coordinate of upper-left corner int nTopRect , // y-coordinate of upper-left corner int nRightRect , // x-coordinate of lower-right corner int nBottomRect , // y-coordinate of lower-right corner int nWidthEllipse , // width of ellipse int nHeightEllipse // height of ellipse ) ; public Form1 ( ) { InitializeComponent ( ) ; this . FormBorderStyle = FormBorderStyle . None ; Region = System . Drawing . Region . FromHrgn ( CreateRou

Converting A Curl To Python Requests

Image
Answer : You have this utility: https://curl.trillworks.com/ I use it all the time. An example is attached. The two aspects involved in your case is authentication and file uploading, you can refer to the links for more details. And also with the converted code below if you want it: #!/usr/bin/env python # -*- coding: utf-8 -*- import requests from requests.auth import HTTPBasicAuth def upload_file(): username = 'admin' password = 'AP31vzchw5mYTkB1u3DhjLT9Txj' source_file = "<your source file" upload_url = "http://<your server>/<your path>" files = {'file': open(source_file, 'rb')} requests.post(upload_url, auth=HTTPBasicAuth(username, password), files=files) if __name__ == "__main__": upload_file() Hope this helps:-)

Conditional String Concatenation In PostgreSQL

Answer : The function concat_ws() does exactly what you want. The first parameter is used as glue between the rest. Nulls are ignored: select concat_ws('//', owner_addr1, owner_addr2, owner_addr3) Test: red=# select concat_ws('//', 'abc', null, null, 'xx', null, 'xyz', null) as address; address -------------- abc//xx//xyz (1 row) Probably most obvious to use a CASE statement. There are 4 cases: owner_addr2 IS NULL AND owner_addr3 IS NULL => '' owner_addr2 IS NULL AND owner_addr3 IS NOT NULL => '//' || owner_addr3 owner_addr2 IS NOT NULL AND owner_addr3 IS NULL => '//' || owner_addr2 owner_addr2 IS NOT NULL AND owner_addr3 IS NOT NULL '//' || owner_addr2 || '//' owner_addr3 SELECT owner_addr1 || CASE WHEN owner_addr2 IS NULL AND owner_addr3 IS NULL THEN '' WHEN owner_addr2 IS NULL AND owner_addr3 IS NOT NULL THEN '//'