Posts

Showing posts from November, 2005

Android Refresh A Fragment List From Its Parent Activity

Answer : You can easily achieve this using INTERFACE MainActivity.java public class MainActivity extends Activity { public FragmentRefreshListener getFragmentRefreshListener() { return fragmentRefreshListener; } public void setFragmentRefreshListener(FragmentRefreshListener fragmentRefreshListener) { this.fragmentRefreshListener = fragmentRefreshListener; } private FragmentRefreshListener fragmentRefreshListener; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button b = (Button)findViewById(R.id.btnRefreshFragment); b.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if(getFragmentRefreshListener()!=null){ getFragmentRefreshListener().onRefresh(); } } }); } publi

Bootstrap Button Size Code Example

Example 1: bootstarp btn colors < button type = " button " class = " btn btn-primary " > Blue </ button > < button type = " button " class = " btn btn-secondary " > Grey </ button > < button type = " button " class = " btn btn-success " > Green </ button > < button type = " button " class = " btn btn-danger " > Red </ button > < button type = " button " class = " btn btn-warning " > Yellow </ button > < button type = " button " class = " btn btn-info " > Ligth blue </ button > < button type = " button " class = " btn btn-light " > White </ button > < button type = " button " class = " btn btn-dark " > Black </ button > < button type = " button " class = " btn btn-link " > White

Bootstrap File Type Input Code Example

Example 1: bootstrap input file < div class = " custom-file " > < input type = " file " class = " custom-file-input " id = " inputGroupFile01 " > < label class = " custom-file-label " for = " inputGroupFile01 " > Choose file </ label > </ div > Example 2: bootstrap file upload < form > < div class = " form-group " > < label for = " exampleFormControlFile1 " > Example file input </ label > < input type = " file " class = " form-control-file " id = " exampleFormControlFile1 " > </ div > </ form >

Clicking A Disabled Input Or Button

Answer : There is no way to capture a click on disabled elements. Your best bet is to react to a specific class on the element. HTML Markup: <input type="button" class="disabled" value="click" /> JavaScript code: $('input').click(function (event) { if ($(this).hasClass('disabled')) { alert('CLICKED, BUT DISABLED!!'); } else { alert('Not disabled. =)'); } }); You could then use CSS styling to simulate a disabled look: .disabled { background-color: #DDD; color: #999; } Here's a jsFiddle demonstrating its use. Making the field readonly can help, because the click event will be fired. Though be aware of the differences in behaviour. <input type="button" value="click" readonly="readonly" /> Put input[disabled] {pointer-events:none} in your CSS (it prevents some browsers from discarding clicks on disabled inputs altogether)

3D Glasses Giving The Opposite Effect To That Expected

Image
Answer : The others have already provided good explanations, but since it sounded like an interesting question and I already sketched up a diagram, I thought I would show it, too. As already mentioned, if you have an object that is to be shown as the exact same distance as the distance between you and the screen, it's very easy to represent that: It's just a single object on the screen that looks the same to both eyes. If, on the other hand, you want to show an object which is far away, then you need to 'trick' your eyes by showing two separate images on the screen, one for the left eye and another for the right eye. That's indicated by the two hollow green dots on the screen on the diagram below. And if you want to show an object which is closer to you than the actual screen distance, then to trick your eyes two images at the locations of the hollow blue dots need to be presented on screen. Note that for objects that are to appear closer than the screen distance

Hello World In Cobol Code Example

Example: cobol hello world $ vim helloworld IDENTIFICATION DIVISION. PROGRAM-ID. HELLO-WORLD. * simple hello world program PROCEDURE DIVISION. DISPLAY 'Hello world!' . STOP RUN.

Clickable Social Media Icons Html/css Code Example

Example: bootstrap social media icons Refer link : https://www.programmingquest.com/2020/04/create-social-media-icon-using-html-css.html < html > < head > < title > Social Media Icon Example </ title > <!-- Adding font awesome icon library --> < link rel = " stylesheet " href = " https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css " > < style > .fa { width : 25 px ; padding : 20 px ; font-size : 25 px ; text-align : center ; text-decoration : none ; margin : 5 px 2 px ; color : white ; border-radius : 50 % ; } .fa :hover { opacity : 0.7 ; } .fa-facebook { background : #3B5998 ; } .fa-twitter { background : #55ACEE ; } .fa-google { background : #dd4b39 ; } .fa-linkedin { background : #007bb5 ; } .fa-

AWS CDK: Fixed Logical Ids

Answer : In TypeScript the method you are looking for is overrideLogicalId . But you have to get the lower level CfnVpc construct first by using the following code (TypeScript again): let vpc = new ec2.Vpc(this, 'vpc', { natGateways: 1 }) let cfnVpc = vpc.node.defaultChild as ec2.CfnVPC cfnVpc.overrideLogicalId('MainVpc') Results in the following yaml: MainVpc: Type: AWS::EC2::VPC A bit late to the party but here is my implementation. I removed the random characters at the end of the string and replaced it with the logical ID which are unique throughout the project. protected allocateLogicalId(cfnElement: CfnElement): string { return cfnElement.logicalId.split('.')[1]; }

How To Get String Input In C Code Example

Example 1: how to store a user input with spaces in c # include <stdio.h> int main ( ) { char name [ 20 ] ; printf ( "Enter a name : " ) ; scanf ( "%[^\n]%*c" , & name ) ; printf ( "the name entered is: %s\n" , name ) ; return 0 ; } Example 2: getting string input in c # include <stdio.h> # include <conio.h> void main ( ) { chat sam [ 10 ] ; clrscr ( ) ; printf ( "ENTER STRING NAME :" ) ; gets ( s ) ; printf ( "STRING :%s" , s ) ; getch ( ) ; } Example 3: Syntax To Take Input In C Integer : Input : scanf ( "%d" , & intVariable ) ; Output : printf ( "%d" , intVariable ) ; Float : Input : scanf ( "%f" , & floatVariable ) ; Output : printf ( "%f" , floatVariable ) ; Character : Input : scanf ( "%c" , & charVariable ) ; Output : printf ( "%c" , charVariable ) ; Example 4: input

4ft To Inches Code Example

Example: foot to inch 1 foot = 12 inches

Barcelona Vs Real Madrid Streaming Code Example

Example: barcelona vs real madrid x = print ("hello world")

Access Values From Sub Dictionary Python Code Example

Example 1: Nested dictionary Python IDs = [ 'emp1' , 'emp2' , 'emp3' ] EmpInfo = [ { 'name' : 'Bob' , 'job' : 'Mgr' } , { 'name' : 'Kim' , 'job' : 'Dev' } , { 'name' : 'Sam' , 'job' : 'Dev' } ] D = dict ( zip ( IDs , EmpInfo ) ) print ( D ) # Prints {'emp1': {'name': 'Bob', 'job': 'Mgr'}, # 'emp2': {'name': 'Kim', 'job': 'Dev'}, # 'emp3': {'name': 'Sam', 'job': 'Dev'}} Example 2: Nested dictionary Python D = { 'emp1' : { 'name' : 'Bob' , 'job' : 'Mgr' } , 'emp2' : { 'name' : 'Kim' , 'job' : 'Dev' } , 'emp3' : { 'name' : 'Sam' , 'job' : 'Dev'

Addforce Unity 3d Code Example

Example 1: Rigidbody.addforce using UnityEngine ; public class ExampleClass : MonoBehaviour { public float thrust = 1.0f ; public Rigidbody rb ; void Start ( ) { rb = GetComponent < Rigidbody > ( ) ; rb . AddForce ( 0 , 0 , thrust , ForceMode . Impulse ) ; } } Example 2: unity rigidbody addforce rb = GetComponent < Rigidbody > ( ) ; rb . AddForce ( new Vector3 ( 1.5f , 1.5f , 1.5f ) ) ; Example 3: rb.addforce c# rb . AddForce ( 0 , 0 , 5 * Time . deltaTime ) ; // Time.deltaTime is optional ( Make sure that "T" is caps) Example 4: rb.addforce 3d c# rb . AddForce ( 0 , 0 , 5 * time . deltaTime ) ; // time.deltaTime is optional

Add Banground Image Code Example

Example: how to make a image background how to make a image background

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 >

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

Bootstrap 4 Loader Code Example

Example 1: circlular waiting icon bootstrap < div class = " spinner-border " role = " status " > < span class = " sr-only " > Loading... </ span > </ div > Example 2: bootstrap loader < div class = " spinner-border text-primary " role = " status " > < span class = " sr-only " > Loading... </ span > </ div > < div class = " spinner-border text-secondary " role = " status " > < span class = " sr-only " > Loading... </ span > </ div > < div class = " spinner-border text-success " role = " status " > < span class = " sr-only " > Loading... </ span > </ div > < div class = " spinner-border text-danger " role = " status " > < span class = " sr-only " > Loading... </ span > </ div >