Posts

Showing posts from November, 2005

How To Rotate Background Image Only In Css Code Example

Example: rotate background image css .theWholeElement { transform : rotate ( 30 deg ) ; } .justTheBackground { position : relative ; overflow : hidden ; } .justTheBackground ::before { content : "" ; position : absolute ; width : 200 % ; height : 200 % ; top : -50 % ; left : -50 % ; z-index : -1 ; background : url ( background.png ) 0 0 repeat ; transform : rotate ( 30 deg ) ; }

How Do You Make A List That Lists Its Items With Squares? * Code Example

Example: how do you make a list that lists its items with squares? css ul .b { list-style-type : square ; }

Wordpress - Add An Admin Page, But Don't Show It On The Admin Menu

Answer : From the docs on add_submenu_page() , you see that you can hide your submenu link from a top level menu item to which it belongs be setting the slug (1st argument) to null : add_action( 'admin_menu', 'register_my_custom_submenu_page' ); function register_my_custom_submenu_page() { add_submenu_page( null, 'My Custom Submenu Page', 'My Custom Submenu Page', 'manage_options', 'my-custom-submenu-page', 'my_custom_submenu_page_callback', ); } To highlight the desired menu item (e.g. 'all charts' when accessing the hidden 'edit chart' page), you can do the following: add_filter( 'submenu_file', function($submenu_file){ $screen = get_current_screen(); if($screen->id === 'id-of-page-to-hide'){ $submenu_file = 'id-of-page-to-higlight'; } return $submenu_file; }); Use a submenu page as parent slug

Calculate Time Difference In Seconds Python Code Example

Example: python datetime difference in seconds import datetime as dt a = dt . datetime ( 2013 , 12 , 30 , 23 , 59 , 59 ) b = dt . datetime ( 2013 , 12 , 31 , 23 , 59 , 59 ) ( b - a ) . total_seconds ( )

How To Copy A Char Cstring To Replace The Other One C++ Code Example

Example 1: c++ replace character in string # include <algorithm> # include <string> void some_func ( ) { std :: string s = "example string" ; std :: replace ( s . begin ( ) , s . end ( ) , 'x' , 'y' ) ; // replace all 'x' to 'y' } Example 2: c++ replace character in string # include <string> # include <regex> using namespace std ; string test = "abc def abc def" ; // The string to replace // You need to write your part to replace inside the regex(), and write what is the replacement after test = regex_replace ( test , regex ( "abc" ) , "Ziv" ) ; // The replacement.

Componentwillunmount Hooks React Code Example

Example 1: componentdidmount hooks For componentDidMount useEffect ( ( ) => { // Your code here } , [ ] ) ; For componentDidUpdate useEffect ( ( ) => { // Your code here } , [ yourDependency ] ) ; For componentWillUnmount useEffect ( ( ) => { // componentWillUnmount return ( ) => { // Your code here } } , [ yourDependency ] ) ; Example 2: componentdidupdate in hooks const App = props => { const didMountRef = useRef ( false ) useEffect ( ( ) => { if ( didMountRef . current ) { doStuff ( ) } else didMountRef . current = true } }

Css React Inline Style Code Example

Example 1: inline style jsx //Multiple inline styles < div style = { { padding : '0px 10px' , position : 'fixed' } } > Content < / div > Example 2: react add inline styles in react // You are actuallty better off using style props // But you can do it, you have to double brace // and camel-case the css properties render ( ) { return ( < div style = { { paddingTop : '2em' } } > < p > Eh up , me duck ! < / p > < / div > ) } Example 3: inline style react // Typical component with state-classes < ul className = "todo-list" > { this . state . items . map ( ( item , i ) => ( { < li className = { classnames ( { 'todo-list__item' : true , 'is-complete' : item . complete } ) } > { item . name } < / li > } ) } < / ul > // Using inline-styles for state < li className = 'todo-list__item' style = { ( item . complete )

Android Studio Emulator And AMD CPU

Image
Answer : If you have an AMD processor, you can download an ARM image, but it is super slow on x86 platforms. The x86 image does not work with AMD CPUs, because the x86 image needs HAXM installed which needs VT-X support, and only Intel CPUs support it. So you can download the Genymotion emulator, which supports both VT-X & AMD-V technology. Genymotion is super fast. Other than hooking your physical device up to test, it's the next best thing. Android Studio emulator is not efficient for testing. I am using the personal version of Genymotion. With the latest API 30, even x86 emulators are very fast in AMD processors. For this in Windows, you follow this below. You absolutely don't need Intel HAXM (Hardware Accelerated Execution Mode) in AMD processors, because they are AMD processors. Just enable (check) Windows Hypervisor Platform in Windows features as shown below. Now, you can start emulators. No need of Intel HAXM. Here is official link: https://android-deve

Create A MySQL Database With Charset UTF-8

Answer : Update in 2019-10-29 As mentions by @Manuel Jordan in comments, utf8mb4_0900_ai_ci is the new default in MySQL 8.0 , so the following is now again a better practice: CREATE DATABASE mydatabase CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci; Answer before 2019-10-29 Note: The following is now considered a better practice (see bikeman868's answer): CREATE DATABASE mydatabase CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; Original answer: Try this: CREATE DATABASE mydatabase CHARACTER SET utf8 COLLATE utf8_general_ci; For more information, see Database Character Set and Collation in the MySQL Reference Manual. You should use: CREATE DATABASE mydb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; Note that utf8_general_ci is no longer recommended best practice. See the related Q & A: What's the difference between utf8_general_ci and utf8_unicode_ci on Stack Overflow.

Console.log On Firebase Cloud Functions Simply Not Logging.

Answer : Ok, the problem ended up being that the function wasn't deploying properly. What had happened was due to some typescript/firebase config issue - the new code was being compiled to a location that wasn't what firebase was looking for. When deployed the code - some old compiled code was still there to be deployed. The moral of the story here is: make sure you delete your dist/build/lib directory before deploying - as that will cause an error if firebase is looking in the wrong place. In case someone wastes as much time as I did. It turned out I was logged into the wrong firebase project ‍♂️. firebase projects:list Your current project will be highlighted in blue with "(current)" beside it. If you need to change project: firebase use insert-project-id-here

How To Change Border Color Of Input Field Onclick Css Code Example

Example: change input border color when selected input :focus { outline : none ; border : 1 px solid red ; }

Google Docs Viewer Iframe To Embed Pdf In Html Code Example

Example: google pdf iframe viwer < iframe src = "https://docs.google.com/gview?url={magical url that works}" > < / iframe >

Css Flexbox Css-tricks Code Example

Example: css flex column .container { flex-direction : row | row-reverse | column | column-reverse ; }

Remove White Background Online Code Example

Example: remove background from image Use this one its best linK : https : //www.remove.bg/

Alert In Js W3schools Code Example

Example: how to make alert in javascript alert ( "Alert" )

How To Print Double Printf C Code Example

Example: print double in c # include <stdio.h> int main ( ) { double d = 123.32445 ; //using %f format specifier printf ( "Value of d = %f\n" , d ) ; //using %lf format specifier printf ( "Value of d = %lf\n" , d ) ; return 0 ; }

Angular UI Bootstrap Vertical Tabs

Answer : Another solution is to create something like this <div class="row"> <div class="col-sm-3"> <ul class="nav nav-tabs nav-stacked nav-pills" role="tablist"> <li ng-class="{'active': view_tab == 'tab1'}"> <a class="btn-lg" ng-click="changeTab('tab1')" href="">My Tab 1</a> </li> <li ng-class="{'active': view_tab == 'tab2'}"> <a class="btn-lg" ng-click="changeTab('tab2')" href="">My Tab 2</a> </li> </ul> </div> <div class="col-sm-9"> <div class="tab-content"> <div class="tab-pane" ng-show="view_tab == 'tab1'"> This is tab 1 content </div> <div class="tab-p