Posts

Showing posts from March, 2008

Lineargradient Css Code Example

Example 1: linear gradient css /* A gradient tilted 100 degrees, starting gray and finishing black */ .class { background : linear-gradient ( 100 deg , rgba ( 63 , 63 , 63 , 0.8 ) 0 % , rgba ( 255 , 255 , 255 , 0 ) 25 % ) ; } /* A gradient going from the bottom to top starting red and finishing orange */ .class { background : linear-gradient ( to top , #f32b60 , #ff8f1f ) ; } Example 2: linear gradient css background image background-image : url ( "IMAGE_URL" ) , linear-gradient ( #eb01a5 , #d13531 ) ; Example 3: css horizontal linear gradient background : linear-gradient ( to left , red , blue ) ; Example 4: html css background linear-gradient background : linear-gradient ( #333 , #333 50 % , #eee 100 % ) ; \\code for a basic gradient background #grad { background-image : linear-gradient ( red , yellow ) ; } Example 5: css horizontal gradient background color .foo { background-image : linear-gradient ( red , blue ) ; }

Reactjs Php Server Connection Code Example

Example: php mysql reactjs <?php $host = "localhost" ; $user = "root" ; $password = "YOUR_MYSQL_DB_PASSWORD" ; $dbname = "reactdb" ; $id = '' ; $con = mysqli_ connect ( $host , $user , $password , $dbname ) ; $method = $_SERVER[ 'REQUEST_METHOD' ] ; $request = explode ( '/' , trim ( $_SERVER[ 'PATH_INFO' ] , '/' ) ) ; if ( !$con ) { die ( "Connection failed: " . mysqli_connect_ error ( ) ) ; } switch ( $method ) { case 'GET' : $id = $_GET[ 'id' ] ; $sql = "select * from contacts" . ( $id? " where id=$id" : '' ) ; break ; case 'POST' : $name = $_POST[ "name" ] ; $email = $_POST[ "email" ] ; $country = $_POST[ "country" ] ; $city = $_POST[ "city" ] ; $job = $_POST[ "job" ] ; $sql = "insert into contacts (name, emai

How To Select First Child In Scss Code Example

Example: css first child :first-child { //styles here } :nth-child ( 1 ) { //the benefit of this is you can do it for 2 nd , 3 rd etc... //styles here }

Add Column In Table In Postgresql Code Example

Example 1: postgresql add column with constraint ALTER TABLE customers ADD COLUMN contact_name VARCHAR NOT NULL; Example 2: postgresql insert column ALTER TABLE table_name ADD COLUMN new_column_name data_type constraint; Example 3: postgres how to add field created at CREATE TABLE my_table ( id serial NOT NULL, user_name text, created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP //here ) Example 4: alter table add column postgres Alter Postgres Table

Create Table If Not Exists From Mysqldump

Answer : Try to use this on your SQL file: sed 's/CREATE TABLE/CREATE TABLE IF NOT EXISTS/g' <file-path> or to save sed -i 's/CREATE TABLE/CREATE TABLE IF NOT EXISTS/g' <file-path> it's not ideal but it works :P According to one source, mysqldump does not feature this option. You could use the --force option when importing the dump file back, where MySQL will ignore the errors generated from attempts to create duplicate tables. However note that with this method, other errors would be ignored as well. Otherwise, you can run your dump file through a script that would replace all occurrences of CREATE TABLE with CREATE TABLE IF NOT EXISTS . Using sed as described by @Pawel works well. Nevertheless you might not like the idea of piping your data through more potential error sources than absolutely necessary. In this case one may use two separate dumps: first dump containing table definitions ( --no-data --skip-add-drop-table ) second dump with only da

01010 Binary To Text Code Example

Example: Binary text A binary-to-text encoding is encoding of data in plain text. More precisely, it is an encoding of binary data in a sequence of printable characters. These encodings are necessary for transmission of data when the channel does not allow binary data (such as email or NNTP) or is not 8-bit clean. PGP documentation (RFC 4880) uses the term "ASCII armor" for binary-to-text encoding when referring to Base64.

Admin Url Redirecting To Localhost/admin

Answer : First change from http://localhost/sitename to http://127.0.0.1/sitename/ second, after doing this remove var/cache folder. Check your  Baseurl  and  Baseurl secure    Change From :- localhost To :- 127.0.0.1 Then Run This Command :- sudo php bin/magento cache:flush sudo php bin/magento cache:clean

BreadcrumbList Yoast Code Example

Example 1: yoast breadcrumbs <?php if ( function_exists('yoast_breadcrumb') ) { yoast_breadcrumb( '<p id="breadcrumbs">','</p>' ); } ?> Example 2: yoast breadcrumbs [wpseo_breadcrumb]

Android ACTIVITY_RECOGNITION Permission SDK 28 Running On Android 10/Q (SDK 29)

Answer : Solved: In App Api Level 28 + <uses-permission android:name="android.permission.ACTIVITY_RECOGNITION"/> The app should check if the permission is granted already: if (ContextCompat.checkSelfPermission(thisActivity, Manifest.permission.ACTIVITY_RECOGNITION) != PackageManager.PERMISSION_GRANTED) { // Permission is not granted } To request the permission: ActivityCompat.requestPermissions(thisActivity, arrayOf(Manifest.permission.ACTIVITY_RECOGNITION), MY_PERMISSIONS_REQUEST_ACTIVITY_RECOGNITION); Learn more about requesting Android runtime permissions. If your app targets SDK level 28 or below, it must specify the com.google.android.gms.permission.ACTIVITY_RECOGNITION permission in its manifest file. Not sure if it helps for your issue but it helps us with similar problem. First check if your app/user has Physical activity permitted - most probably not. If you permit it - your code should run w

Rick Roll Lyrics Copy Code Example

Example: never gonna give you up lyrics /* We're no strangers to love You know the rules and so do I A full commitment's what I'm thinking of You wouldn't get this from any other guy I just wanna tell you how I'm feeling Gotta make you understand Never gonna give you up Never gonna let you down Never gonna run around and desert you Never gonna make you cry Never gonna say goodbye Never gonna tell a lie and hurt you We've known each other for so long Your heart's been aching but you're too shy to say it Inside we both know what's been going on We know the game and we're gonna play it And if you ask me how I'm feeling Don't tell me you're too blind to see Never gonna give you up Never gonna let you down Never gonna run around and desert you Never gonna make you cry Never gonna say goodbye Never gonna tell a lie and hurt you Never gonna give you up Never gonna let you down Never gonna run around and

Can Lightning:navigation Be Used In Communities

Answer : lightning:navigation is not supported in communities .Take a look at Summer18 release notes here that clearly mentions below These resources aren’t supported in other containers, such as Lightning Components for Visualforce, Lightning Out, or Communities. This is true even if you access these containers inside Lightning Experience or the Salesforce mobile app. Update: With Recent releases it is now supported in lightning communities as well . There's been an update for this since the best answer was posted and it's now possible to navigate around at your heart's content. Here's how: On the component: <!-- exampleComponent.cmp --> <aura:component implements="forceCommunity:availableForAllPageTypes" access="global" > <lightning:navigation aura:id="navService"/> <!-- Your content here --> <lightning:button label="Navigate To Page" variant="Neutral" onclick=

Cron Job For Let's Encrypt Renewal

Answer : Solution 1: Monthly is not frequent enough. This script should run at least weekly, and preferably daily. Remember that certs don't get renewed unless they are near to expiration, and monthly could cause your existing certs to occasionally be expired already before they get renewed. The name of the program is certbot , which was renamed from letsencrypt . If you are still using letsencrypt , you need to update to the current version. Aside from those issues, it's about the same as my cron jobs. 43 6 * * * certbot renew --post-hook "systemctl reload nginx" Note: in 18.04 LTS the letsencrypt package has been (finally) renamed to certbot . It now includes a systemd timer which you can enable to schedule certbot renewals, with systemctl enable certbot.timer and systemctl start certbot.timer . However, Ubuntu did not provide a way to specify hooks. You'll need to set up an override for certbot.service to override ExecStart= with your desired command l

Configured The Default Firebase App __FIRAPP_DEFAULT

Image
Answer : In my particular workflow, when adding firebase dependencies, the tutorial code and flutter warnings never prompted to modify the AppDelegate.m file. It wasn't until I dialed back and added cloud_firestore did I get prompted with this warning: 6.3.0 - [Firebase/Core][I-COR000003] The default Firebase app has not yet been configured. Add [FIRApp configure]; (FirebaseApp.configure() in Swift) to your application initialization. Read more: [https://firebase.google.com/docs/ios/setup#initialize_firebase_in_your_app]. open xc workspace >> open ios/Runner.xcworkspace open AppDelegate.m in AppDelegate.m add the following line: import Firebase; in AppDelegate.m add the following snippet to your application did finish method [FIRApp configure]; Here is what mine looked like in the end: This worked for me: https://medium.com/vector-com-mm/how-to-fix-ios-crash-during-the-start-firebase-configure-f3477df3154 In AppDelegate.swift change the order of GeneratedPluginRegist

If Class Exists Jquery Add Class Code Example

Example 1: jquery check if a class exists if ( $ ( " .mydivclass " ) [ 0 ] ) { // Do something if class exists } else { // Do something if class does not exist } Example 2: if a class exists jquery if ( $ ( " .mydivclass " ) .length ) { // Do something if class exists } else { // Do something if class does not exist }

Convert Unsigned Int To Signed Int C

Answer : It seems like you are expecting int and unsigned int to be a 16-bit integer. That's apparently not the case. Most likely, it's a 32-bit integer - which is large enough to avoid the wrap-around that you're expecting. Note that there is no fully C-compliant way to do this because casting between signed/unsigned for values out of range is implementation-defined. But this will still work in most cases: unsigned int x = 65529; int y = (short) x; // If short is a 16-bit integer. or alternatively: unsigned int x = 65529; int y = (int16_t) x; // This is defined in <stdint.h> I know it's an old question, but it's a good one, so how about this? unsigned short int x = 65529U; short int y = *(short int*)&x; printf("%d\n", y); @Mysticial got it. A short is usually 16-bit and will illustrate the answer: int main() { unsigned int x = 65529; int y = (int) x; printf("%d\n", y); unsigned short z = 65529; short

2 Functions Are Calling By Main Function In Python Code Example

Example 1: how to define main in python # Defining main function def main ( ) : print ( "hello World" ) # Using the special variable # __name__ if __name__ == "__main__" : main ( ) Example 2: python main if __name__ == "__main__" : # execute only if run as a script main ( )

How Can Rotate Image In Css Animation Code Example

Example: image rotate with css div { width : 80 px ; height : 80 px ; background-color : skyblue ; } .rotated { transform : rotate ( 45 deg ) ; /* Equal to rotateZ(45deg) */ background-color : pink ; }