Posts

Showing posts from April, 2005

Iphone 12 Min Media Query Code Example

Example: media queries iphone 11 /* 2688x1242px at 458ppi */ @media only screen and ( device-width : 414 px ) and ( device-height : 896 px ) and ( -webkit-device-pixel-ratio : 3 ) { }

Position: Initial Meaning Of Css Style Code Example

Example 1: what are the types of positioning in css The types of positioning in CSS are- 1 ) static : this is the default value. 2 ) sticky : the element is positioned based on the user's scroll position. 3 ) fixed : the element is positioned related to the browser window. 4 ) relative : the element is positioned relative to its normal position. 5 ) absolute : the element is positioned absolutely to its first positioned parent. Example 2: popsition relative css An element with position : relative ; is positioned relative to its normal position. Setting the top , right , bottom , and left properties of a relatively-positioned element will cause it to be adjusted away from its normal position. Other content will not be adjusted to fit into any gap left by the element.

Can VLC Crop Black Borders On The Fly?

Answer : If you press C it will toggle through the crop ratios and may help you with eliminating the black bars. Well, I should have checked VLC's Video menu as I did while posting this question... There's the crop to 16:9 option I was looking for... Anyway, if you find an automatic cropping estimation method, the bounty will still be there. Simply go to VLC Player preferences > Video (you must be in "All" mode, not "Simple" mode). On the right-hand side, scroll down to "Video cropping" and type in either "16:10", "16:9", or "4:3", depending on what your screen's aspect ratio is. Press the Save button at the bottom. If black lines remain, then they are actually part of the video as opposed to just an empty section of the screen. In this case, adjusting manually is the only logical option left.

Can I Edit The Text Of Sign In Button On Google?

Image
Answer : Here is the technique that I used: protected void setGooglePlusButtonText(SignInButton signInButton, String buttonText) { // Find the TextView that is inside of the SignInButton and set its text for (int i = 0; i < signInButton.getChildCount(); i++) { View v = signInButton.getChildAt(i); if (v instanceof TextView) { TextView tv = (TextView) v; tv.setText(buttonText); return; } } } Here is the easiest way that I used: TextView textView = (TextView) signInButton.getChildAt(0); textView.setText("your_text_xyz"); Problem: Other answers have mentioned a workaround. The underlying implementation of the button may change any time which would cause the code to break. I felt uncomfortable trying to use the hacks. For a clean solution, you would think that setting android:text on the com.google.android.gms.common.SignInButton in your layout file would do the trick. However it turns

Calculate Distance Between Two Points In Google Maps V3

Answer : If you want to calculate it yourself, then you can use the Haversine formula: var rad = function(x) { return x * Math.PI / 180; }; var getDistance = function(p1, p2) { var R = 6378137; // Earth’s mean radius in meter var dLat = rad(p2.lat() - p1.lat()); var dLong = rad(p2.lng() - p1.lng()); var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(rad(p1.lat())) * Math.cos(rad(p2.lat())) * Math.sin(dLong / 2) * Math.sin(dLong / 2); var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); var d = R * c; return d; // returns the distance in meter }; There actually seems to be a method in GMap3. It's a static method of the google.maps.geometry.spherical namespace. It takes as arguments two LatLng objects and will utilize a default Earth radius of 6378137 meters, although the default radius can be overridden with a custom value if necessary. Make sure you include: <script type="text/javascript" src="http://maps.google.co

Flutter Text Field Border Color Code Example

Example 1: change border color of TextField in flutter TextFormField ( decoration : InputDecoration ( labelText : "Resevior Name" , fillColor : Colors . white , focusedBorder : OutlineInputBorder ( borderSide : const BorderSide ( color : Colors . white , width : 2.0 ) , borderRadius : BorderRadius . circular ( 25.0 ) , ) , ) , ) Example 2: textfield border flutter decoration : new InputDecoration ( border : new OutlineInputBorder ( borderSide : new BorderSide ( color : Colors . teal ) ) , hintText : 'Tell us about yourself' , helperText : 'Keep it short , this is just a demo . ' , labelText : 'Life story' , prefixIcon : const Icon ( Icons . person , color : Colors . green , ) ,

Android: Styling Overflow Menu In Action Bar

Answer : I did it this way: <style name="Theme.yourapp" parent="@style/Theme.AppCompat.Light.DarkActionBar"> <item name="android:actionBarWidgetTheme">@style/Theme.yourapp.Widget</item> </style> <style name="Theme.yourapp.Widget" parent="@style/Theme.AppCompat"> <item name="android:textColor">@android:color/black</item> </style> For simplicity, the android: namespace pertains to anything built into the OS while anything without android: as the namespace would pertain to your application (and the libraries you are using). Most, if not all, support libraries for the ActionBar will try to use the native ActionBar implementation and therefor use the android: namespace attributes in your styles. When the native ActionBar is not available it would use the libraries implementation and the non- android: namespaced attributes. This is why you must specify every attribute w

2 Inputs In One Line Python Code Example

Example 1: how to input multiple integers in python x , y = map ( int , input ( ) . split ( ) ) #you can change the int to specify or intialize any other data structures print ( x ) print ( y ) Example 2: taking input of n integers in single line python in a list arr = list ( map ( int , input ( ) . split ( ) ) ) Example 3: input two numbers in python in a single line inputs = [ ] for i in range ( 3 ) : # loop 3 times inputs.append(input()) Example 4: multiple line input python lines = [ ] while True : line = input ( ) if line : lines . append ( line ) else : break text = '\n' . join ( lines )

Css Data Attribute Selectors Code Example

Example: css data attribute selector [ data-value ] { /* Attribute exists */ } [ data-value = "foo" ] { /* Attribute has this exact value */ } [ data-value *= "foo" ] { /* Attribute value contains this value somewhere in it */ } [ data-value ~= "foo" ] { /* Attribute has this value in a space-separated list somewhere */ } [ data-value ^= "foo" ] { /* Attribute value starts with this */ } [ data-value |= "foo" ] { /* Attribute value starts with this in a dash-separated list */ } [ data-value $= "foo" ] { /* Attribute value ends with this */ }

Css Filter Color Orange Code Example

Example: how to filter css red /*Add this to a CSS selector to turn it red*/ filter : grayscale ( 100 % ) brightness ( 40 % ) sepia ( 100 % ) hue-rotate ( -50 deg ) saturate ( 600 % ) contrast ( 0.8 ) ;

Ls Cmd Code Example

Example 1: ls equivalent in CMD Use the command dir to list all the directories and files in a directory Example 2: ls command ls command list computer files in a directory in Unix OS with next structure : ls [ OPTION ] . . . [ FILE ] . . . Examples : ls - l #display all files in current directory with ( - l ) long format . ls - a / directory #display all hidden files in given directory that start with . Example 3: use ls in windows echo @dir % * > % systemroot % \system32\ls . bat Make sure you are running cmd as admin

1 Min To Milliseconds Code Example

Example: 10 min to milliseconds 10 min to milliseconds -> 600000

28 Inch To Cm Code Example

Example 1: inch to cm 1 inch = 2.54 cm Example 2: cm to inch 1 cm = 0.3937 inch

Convert A PHP Object To An Associative Array

Answer : Just typecast it $array = (array) $yourObject; From Arrays : If an object is converted to an array, the result is an array whose elements are the object's properties. The keys are the member variable names, with a few notable exceptions: integer properties are unaccessible; private variables have the class name prepended to the variable name; protected variables have a '*' prepended to the variable name. These prepended values have null bytes on either side. Example: Simple Object $object = new StdClass; $object->foo = 1; $object->bar = 2; var_dump( (array) $object ); Output: array(2) { 'foo' => int(1) 'bar' => int(2) } Example: Complex Object class Foo { private $foo; protected $bar; public $baz; public function __construct() { $this->foo = 1; $this->bar = 2; $this->baz = new StdClass; } } var_dump( (array) new Foo ); Output (with \0s edited in for clarity): array(3) {

Convert Ogg To Mp3 Code Example

Example 1: ogg to mp3 yeah convertio.co is really good Example 2: mp3 to ogg\ convertio.co is pretty gud

Can't Delete File From External Storage In Android Programmatically

Answer : Using ContentResolver to delete media files is wrong and provides many problems for the user. You can not delete a file on the sd-card simply by deleting its information from the ContentResolver on Android versions greater than Jelly Bean(4.3) . It works only on Android versions prior to KitKat(4.4) . That's why the Android team provided DocumentProvider. Why contentResolver.delete(...) is wrong? 1. Fills up the sd-card When you try to delete a media file on the sd-card by the ContentResolver on Android versions greater than 4.3, the actual media file will remain untouched because the contentResolver.delete(...) approach only removes the information (name, date, path ...) of the media and you will end up having unregistered media files on your sd-card which ContentResolver has no idea about their existence anymore and that's why you couldn't see them in your gallery and you think they've been deleted with this approach while they're stil

Add Int To String Arduino Code Example

Example: int to string arduino String stringOne = "Hello String"; // using a constant String String stringOne = String('a'); // converting a constant char into a String String stringTwo = String("This is a string"); // converting a constant string into a String object String stringOne = String(stringTwo + " with more"); // concatenating two strings String stringOne = String(13); // using a constant integer String stringOne = String(analogRead(0), DEC); // using an int and a base String stringOne = String(45, HEX); // using an int and a base (hexadecimal) String stringOne = String(255, BIN); // using an int and a base (binary) String stringOne = String(millis(), DEC); // using a long and a base String stringOne = String(5.698, 3); // using a float and the decimal places

Html/css Navbar Code Example

Example 1: html navigation bar <!-- How to create a navigation bar: This is the html file: Put the class="active" in the html file/page you are coding in ( e .g . put the class="active" in the Home .html file ) To position a page link to the right do class="right" -- > <body > <ul class="topnav" > <li > <a class="active" href="Home .html " > Home</a > </li > <li > <a href="Page1 .html " > Page1</a > </li > <li > <a href="Page2 .html " > Page2</a > </li > <li class="right" > <a href="About .html " > About</a > </li > </ul > </body > <!-- This is the css file: ( have a play with the colours and features! ) -- > ul .topnav { list-style-type : none ; margin : 0 ; padding : 0 ; overflow : hidden ; background-color : #333 ; font-

413 Request Entity Too Large

Answer : Add ‘client_max_body_size xxM’ inside the http section in /etc/nginx/nginx.conf, where xx is the size (in megabytes) that you want to allow. http { client_max_body_size 20M; } I had the same issue but in docker. when I faced this issue, added client_max_body_size 120M; to my Nginx server configuration, nginx default configuration file path is /etc/nginx/conf.d/default.conf server { client_max_body_size 120M; ... it resizes max body size to 120 megabytes. pay attention to where you put client_max_body_size , because it effects on its scope. for example if you put client_max_body_size in a location scope, only the location scope will be effected with. after that, I did add these three lines to my PHP docker file RUN echo "max_file_uploads=100" >> /usr/local/etc/php/conf.d/docker-php-ext-max_file_uploads.ini RUN echo "post_max_size=120M" >> /usr/local/etc/php/conf.d/docker-php-ext-post_max_size.ini RUN echo &qu

Bypassing CAPTCHAs With Headless Chrome Using Puppeteer

Answer : Try generating random useragent using this npm package. This usually solves the user agent-based protection. In puppeteer pages can override browser user agent with page.setUserAgent var userAgent = require('user-agents'); ... await page.setUserAgent(userAgent.toString()) Additionally, you can add these two extra plugins, puppeteer-extra-plugin-recaptcha - Solves reCAPTCHAs automatically, using a single line of code: page.solveRecaptchas() NOTE: puppeteer-extra-plugin-recaptcha uses a paid service 2captcha puppeteer-extra-plugin-stealth - Applies various evasion techniques to make detection of headless puppeteer harder. Here is a list of things I'm doing to bypass the captchas and similar blockings: Enable stealth mode (via puppeteer-extra-plugin-stealth) Randomize User-agent or Set a valid one (via random-useragent) Randomize Viewport size Skip images/styles/fonts loading for better performance Pass "WebDriver check" Pass "Chrome c