Posts

Showing posts from July, 2021

Rest Api Json Placeholder Code Example

Example 1: json placholder fetch ( 'https://jsonplaceholder.typicode.com/todos/1' ) . then ( response => response. json ( ) ) . then ( json => console. log ( json ) ) Example 2: json placeholder api fetch ( 'https://jsonplaceholder.typicode.com/todos/1' ) . then ( response => response. json ( ) ) . then ( json => console. log ( json ) ) Example 3: dummy api json var xhr = new XMLHttpRequest ( ) ; xhr. open ( "GET" , "https://reqres.in/api/products/3" , true ) ; xhr .onload = function ( ) { console. log ( xhr.responseText ) ; } ; xhr. send ( ) ; Example 4: json placeholder fetch ( 'https://jsonplaceholder.typicode.com/todos/1' ) . then ( response => response. json ( ) ) . then ( json => console. log ( json ) ) fetch ( 'https://jsonplaceholder.typicode.com/todos/1' ) . then ( response => response. json ( ) ) . then ( json => console. log ( json ) )

Html Checkbox Size Code Example

Example 1: css resize checkbox input [ type = checkbox ] { transform : scale ( 1.5 ) ; } Example 2: update checkbox size css input. /*checkbox class name*/ { width : /*preferred width*/ ; height : /*preferred height*/ ; }

How To Remove Horizontal Scroll Bar Html Css Code Example

Example 1: css how to remove horizontal scrollbar html , body { max-width : 100 % ; overflow-x : hidden ; } Example 2: how to remove horizontal scrolling /* this works for vertical scrolling also this is useful for those who can't use overflow: hidden or any other solution because the css on the website changes in someway */ ::-webkit-scrollbar :horizontal { display : none ; }

Button Stays Active After Click Pure Css Code Example

Example: css onclick change color <style > .dabutton :focus { background-color : yellow ; } </style> <button class= "dabutton" ></button> // <-- usage

Strrchr Example

Defined in header <string.h> char * strrchr ( const char * str , int ch ) ; Finds the last occurrence of ch (after conversion to char as if by (char)ch ) in the null-terminated byte string pointed to by str (each character interpreted as unsigned char ). The terminating null character is considered to be a part of the string and can be found if searching for '\0' . The behavior is undefined if str is not a pointer to a null-terminated byte string. Parameters str - pointer to the null-terminated byte string to be analyzed ch - character to search for Return value Pointer to the found character in str , or null pointer if no such character is found. Example # include <string.h> # include <stdio.h> int main ( void ) { char szSomeFileName [ ] = "foo/bar/foobar.txt" ; char * pLastSlash = strrchr ( szSomeFileName , '/' ) ; char * pszBaseName = pLastSlash ? p

Android Pick Images From Gallery

Answer : Absolutely. Try this: Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(intent, "Select Picture"), PICK_IMAGE); Don't forget also to create the constant PICK_IMAGE , so you can recognize when the user comes back from the image gallery Activity: public static final int PICK_IMAGE = 1; @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == PICK_IMAGE) { //TODO: action } } That's how I call the image gallery. Put it in and see if it works for you. EDIT: This brings up the Documents app. To allow the user to also use any gallery apps they might have installed: Intent getIntent = new Intent(Intent.ACTION_GET_CONTENT); getIntent.setType("image/*"); Intent pickIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT

Android Emulator Error: "System UI Has Stopped"

Answer : This is still "unanswered", but it probably has been resolved. I just want to share my experience and clarify a few things, some of which may not matter. Anyway, if this helps someone else that's great. 1) I had this problem on one machine (a new, but slower machine), but not another (the faster one) when running a 4.0.3 emulator. It is not a hardware problem though, and CPU speed doesn't make a difference. 2) Both machines are fully up-to-date ADT (Eclipse 4.2.x and Android 4.2.2 (API 17) SDK environments. 3) Editing, or even Deleting the emulator and then recreating it did NOT fix it. 4) The best solution is to locate and update the config.ini file. In Windows 7 (x64) I found the config.ini file in C:\Users \ [your user name] \ .android\avd\ICS_4.0.3_API_15.avd [*see AVD names below]. NOTE: First make sure you have “show hidden files, folder, or drives” turned on in Explorer or you won't see the ".android" folder. 5) Not s

List Style Image Size Code Example

Example 1: css list style url siz li { list-style : none ; } li :before { content : '' ; display : inline-block ; height : y ; width : x ; background-image : url ( ) ; } Example 2: list-style-image size li { list-style : none ; } li :before { content : '' ; display : inline-block ; height : 20 px ; width : 25 px ; background-image : url ( ) ; margin-right : 5 px ; }

504 Gateway Timeout - Two EC2 Instances With Load Balancer

Answer : What web server are you using? I had a very similar issue with nginx and AWS load balancing. I added keepalive_timeout 75s; to the http block in my nginx config file and haven't see the issue since. Make sure you restart nginx after you add and save that line (on ubuntu sudo service nginx restart . On redhat stop nginx /path/to/nginx/executable -s stop then /path/to/nginx/executable to start up nginx) This fix was recommended by AWS on their help page AWS Load balancer troubleshooting First, what is the Idle Timeout for your ELB set to? You'll find it at the very bottom of the "Description" tab for your load balancer. You can read more about the idle timeout here in the ELB documentation. The default is 60 seconds. You should also consider setting or increasing Keep-alive in your web server. How you do that will depend on what web server you are using. Second, if you think it's due to the client being switched from one instance to the ot

Css Resize Image Resolution Code Example

Example 1: resize image html <!-- Resize image using html When we add any image in 'src' attribute of 'img' tag then image appears with original size on webpage and if we want to resize the image we have to add extra attribute i.e. height and width to img tag to resize the image --> Simple img tag <img src= "image_path" alt= "Image Sample" > With height and width attribute <img src= "image_path" width= "200" height= "40" alt= "Image Sample" > <!-- I hope it will help you. Namaste Stay Home Stay Safe --> Example 2: css image size adjust squareImage { border : 1 px solid #ddd ; /* thickness and color of border */ border-radius : 4 px ; /* edge rounding of border */ width : 150 px ; /* width of image (px or % or auto) */ height : auto ; /* height of image (px or % or auto) */ }

Don't Break Word With Hyphen Css Code Example

Example: dont break word css <span style= "white-space: nowrap" >no-breaks-here</span>

Em Vs Rem Full Form Code Example

Example 1: rem vs em em -> is relative to the font-size of its direct or nearest parent rem -> is relative to the html ( root ) font-size Example 2: em vs rem 1 EM or 1 REM ( r = root em ) The difference is inheritance. The Rem value is based on the root element ( html ) . What is meant here is the font size for html and not the font size for the documet body. ... Em is based on the font size of each Parent element.