Posts

Showing posts from September, 2011

40 Min 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

Download Youtube Video As A Mp3 Code Example

Example: youtube download mp3 I use https : //github.com/ytdl-org/youtube-dl/ as a Python CLI tool to download videos

Flex Gap Code Example

Example 1: add space between all html elements flex /* There is now a `gap` CSS property ** This works for <flex>, <grid>, and <multicolumn> layouts ** #box{} would lay out all it's children with 10px spacing between ** different rows and 20px betwen different columns */ #box { display : flex ; flex-wrap : wrap ; gap : 10 px 20 px ; /* row-gap [column-gap]*/ } /* Supported by most modern browesers, Safari excluded. */ Example 2: css flex gap between items /* limited support (Q1/2021: Firefox, Chrome, Safari) */ .flex-container { display : flex ; gap : 5 px ; } /* broad support */ .flex-item { margin : 5 px ; /* and/or */ padding : 5 px ; } Example 3: gap between two flex items .upper { margin : 30 px ; display : flex ; flex-direction : row ; width : 300 px ; height : 80 px ; border : 1 px red solid ; padding : 5 px ; /* this */ } .upper > div { flex : 1 1 auto ; border : 1 px red solid ; text-align : cen

Broadcast Receiver Not Working For SMS

Answer : Try declaring your receiver as the following : <receiver android:name=".SmsReceiver" android:permission="android.permission.BROADCAST_SMS" android:exported="true"> <intent-filter android:priority="5822" > <action android:name="android.provider.Telephony.SMS_RECEIVED" /> </intent-filter> </receiver> this works just fine for me , I only added a flag to tell that this receiver is exported . Edit: I forgot to add the priority to the intent filter. use high number for the priority. Found a topic that answers my doubt: Suppress / Block BroadcastReceiver in another app. Even with the priority set to the maximum possible (999), if another app has the same priority, in this case the Handcent SMS app, the first application that will receive the broadcast is the one that was first installed by the user. In my case was the Handcent SMS and because it aborts the broadcast when re

80f To C Code Example

Example: convert fahrenheit to celsius import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int far = sc . nextInt ( ) ; int cel = ( far - 32 ) * 5 / 9 ; System . out . printf ( "%d Fahrenheit is %d Celsius" , far , cel ) ; } }

C++ Code File Extension? .cc Vs .cpp

Answer : At the end of the day it doesn't matter because C++ compilers can deal with the files in either format. If it's a real issue within your team, flip a coin and move on to the actual work. GNU GCC recognises all of the following as C++ files, and will use C++ compilation regardless of whether you invoke it through gcc or g++: .C , .cc , .cpp , .CPP , .c++ , .cp , or .cxx . Note the .C - case matters in GCC, .c is a C file whereas .C is a C++ file (if you let the compiler decide what it is compiling that is). GCC also supports other suffixes to indicate special handling, for example a .ii file will be compiled as C++, but not pre-processed (intended for separately pre-processed code). All the recognised suffixes are detailed at gcc.gnu.org Great advice on which to use for the makefile and other tools, considering non-compiler tools while deciding on which extension to use is a great approach to help find an answer that works for you. I just wanted to add

Convert MathType Equations To Native Word 2007/2010 Equations

Answer : I have found that GrindEq offers a MathType-to-Word-Equation converter, it seems to do a proper job. Shareware. MathType has a toggle TeX feature that's convenient for converting a single equation or small selection of equations either from MathType to LaTeX or vice versa. There's also the Convert Equations command on the MathType Ribbon in Word that gives you more conversion options. this way works converting from mathtype version 7... to ms word 2016: double click on equation and open it within mathtype editor. go: preferences > cut and copy preferences click: MathML or TeX select: MathML 2.0 (namespace attr) from dropdown list click ok select equation and copy paste into ms word (select "Create an OMML equation" if a pop up appears) Thats all, I hope it works.

Underline Markdown Github Code Example

Example 1: how to add link to github readme [ I ' m an inline - style link ] ( https : //www.google.com) [ I 'm an inline-style link with title](https://www.google.com "Google' s Homepage" ) [ I ' m a reference - style link ] [ Arbitrary case - insensitive reference text ] [ I ' m a relative reference to a repository file ] ( . . / blob / master / LICENSE ) [ You can use numbers for reference - style link definitions ] [ 1 ] Or leave it empty and use the [ link text itself ] . URLs and URLs in angle brackets will automatically get turned into links . http : //www.example.com or <http://www.example.com> and sometimes example . com ( but not on Github , for example ) . Some text to show that the reference links can follow later . [ arbitrary case - insensitive reference text ] : https : //www.mozilla.org [ 1 ] : http : //slashdot.org [ link text itself ] : http : //www.reddit.com Example 2: md strikethrough ~ ~ Thi

Composer Could Not Open Input File: Composer.phar Code Example

Example 1: Could not open input file: composer composer install Example 2: Could not open input file: composer.phar $ composer update friendsofsymfony/elastica-bundle

How To Make A Background Color Opacity In Css Code Example

Example 1: background color semi transparent .transparent { background-color : rgba ( 255 , 255 , 255 , 0.5 ) ; } .transparent { opacity : 0.5 ; } Example 2: css opacity background color background : rgba ( 255 , 255 , 255 , 0.25 ) ; Example 3: background color with opacity h1 { background-color : rgba ( 255 , 0 , 0 , 0.3 ) ; }

Html Div Meaning Code Example

Example 1: what is div in html <div> <!-- This is opening of a division tag--> </div> Example 2: div html <div style= "background-color:lightblue" > <h3>This is a heading</h3> <p>This is a paragraph.</p> </div> Example 3: html div //div tag <div> //content </div> //a div is an invisible box Example 4: what means div div { display : block ; }

Bootstrap: How Do I Identify The Bootstrap Version?

Answer : In the top of the bootstrap.css you should have comments like the below: /*! * Bootstrap v2.3.1 * * Copyright 2012 Twitter, Inc * Licensed under the Apache License v2.0 * http://www.apache.org/licenses/LICENSE-2.0 * * Designed and built with all the love in the world @twitter by @mdo and @fat. */ If they are not there, then they have probably been deleted. VERSIONS: You can review version history here. Backward compatibility shouldn't be broken if the source is v2.0.0 (Jan 2012) and above. If it is prior to v2.0.0 there are details on upgrading here. You can also check the bootstrap version via the javascript console in the browser: $.fn.tooltip.Constructor.VERSION // => "3.3.7" Credit: https://stackoverflow.com/a/43233731/1608226 Posting this here because I always come across this question when I forget to include JavaScript in the search and wind up on this question instead of the one above. If this helps you, be sure to upvote that a

Docker-compose Healthcheck Curl Container Code Example

Example: healthcheck docker compose healthcheck : test : [ "CMD" , "curl" , "-f" , "http://localhost" ] interval : 1 m30s timeout : 10 s retries : 3 start_period : 40 s

403 Forbidden On Nginx/1.4.6 (Ubuntu) - Laravel

Answer : You need to specify an absolute path for your root directive. Nginx uses the directory set at compile time using the --prefix switch. By default this is /usr/local/nginx . What this means is that your root, which is currently set to root home/laravel-app/ causes nginx to look for files at /usr/local/nginx/home/laravel-app/ which presumably isn't where your files are. If you set your root directive to an absolute path such as /var/www/laravel-app/public/ nginx will find the files. Similarly you'll note that I added /public/ to the path above. This is because Laravel stores it's index.php file there. If you were to just point at /laravel-app/ there's no index file and it'd give you a 403.

Convert Ist Time To Utc Javascript Moment React Native Code Example

Example: convert moment date to utc format moment moment ( timestamp ) . toISOString ( true )

20. Write A Python Program To Count The Number Of Lines In A Text File. Code Example

Example 1: Write a Python program to count the number of lines in a text file. def countlines ( fname , mode = 'r+' ) : count = 0 with open ( fname ) as f : for _ in f : count += 1 print ( 'total number of lines in file : ' , count ) countlines ( 'file1.txt' ) ########################## with open ( 'file1.txt' ) as f : print ( sum ( 1 for _ in f ) ) ########################## with open ( 'file1.txt' ) as f : for lno , line in enumerate ( f , 1 ) : pass print ( 'total lines:' , lno ) ########################### '''You can use len(f.readlines()), but this will create an additional list in memory, which won't even work on huge files that don't fit in memory. ''' Example 2: Write a Python program to count the number of lines in a text file. def countlines ( fname , mode = 'r+' ) : count = 0 with open ( fname ) as f : for

Android Studio Run/Debug Configuration Error: Module Not Specified

Answer : Resync your project gradle files to add the app module through Gradle In the root folder of your project, open the settings.gradle file for editing. Cut line include ':app' from the file. On Android Studio, click on the File Menu, and select Sync Project with Gradle files . After synchronisation, paste back line include ':app' to the settings.gradle file. Re-run Sync Project with Gradle files again. never mind, i changed the name in settings.gradle and synced and then changed it back and synced again and it inexplicably worked this time. Try to delete the app.iml in your project directory and restart android studio

Rotate3d Css W3schools Code Example

Example: css rotate 3d transform : rotate3d ( 1 , 1 , 1 , 45 deg ) ;

Css Text Around Circle Code Example

Example: text in circle css .circle { width : 500 px ; height : 500 px ; line-height : 500 px ; border-radius : 50 % ; font-size : 50 px ; color : #fff ; text-align : center ; background : #000 } <div class= "circle" >Hello I am A Circle</div>