You Tube Video Full Screen Problems

YouTube is largest video sharing website on the web.

Problems switching to Full Screen

  • Whenever Users click full screen icon on a video, the video reloads again and  deletes the already buffered data.  So users with slow download speed have to wait  on switching to full screen and back
  • In Full Screen Mode user cannot do other tasks as freely , you have to exit to do other things
How to Fix ?

Changing User Settings

 

  • YouTube videos are played at 360p by default
but when a User clicks on Full Screen icon the video gets changed to 480p for video quality and buffer is reloaded.
  1. Login to your YouTube Account
  2. Go to settings > Playback Setup and check the option  “I have a slow connection. Never play higher-quality video”
  3. Save Changes
You Tube Full Screen Settings
Now the video will not reload when you are logged in.

 

GreaseMonkey Script

  • If you are using Firefox then you can solve this problem by installing a user script for Grease Monkey
  1. Install GreaseMonkey addon on Firefox
  2. Install this User Script http://userscripts.org/scripts/show/49366 (Buffers the video without autoplaying, removes in-video ads, and puts it in hd if the option is on) on Greasemonkey.
Rebuffering problem will be solved

 

Stretch to Browser’s Size (Best Way)

 

  • One more way to solve the full screen problem and multi-tasking while playing video is to stretch the Video to occupy your Browser’s window.
  1. Open a YouTube video like http://www.youtube.com/watch?v=hC_M6PzXS9g
  2. Rewrite this URL to http://www.youtube.com/v/hC_M6PzXS9g .   Just copy the UniqueID (hC_M6PzXS9g in above example) and go to URL http://www.youtube.com/v/UniqueID
  3. Now you can resize the window to any size without rebuffering and switch to other tabs and tasks without any problems

Remove WordPress meta generator tag from Page Source

WordPress default installation adds meta generator tags to page source showing wordpress version like

<meta name=”generator” content=”WordPress 3.2.1″ />

You can remove the tags and also recommended due to safety reasons

Steps:

  • Login to Dashboard
  • Go to Appearance>Editor  on left sidebar of Dashboard
  • Now Select functions.php and add following code at the end (before ?> )
remove_action('wp_head', 'wp_generator');
  • Click “Update File” to save (Tags will now be removed)

If functions.php does not exist in your theme then make a file named functions.php and add following in the file

<?php
remove_action('wp_head', 'wp_generator');
?>

There are also some plugins available which remove the tags and make things easy for you like Remove Meta Generator Tag

Custom SWT Dialog

Custom SWT Dialogbox extending org.eclipse.swt.widgets.Dialog Class

Source :


import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;

public class EmployeeDialog extends Dialog {

	public EmployeeDialog(Shell parent) {
		super(parent);
	}

	private Group insGroup;

	public void open() {
		Shell shell = new Shell(getParent());
		shell.setText("Add Employee");

		draw(shell); // Contents of Dialog
		shell.pack();
		shell.open();

		Display display = getParent().getDisplay();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}

	}

	private void draw(Shell shell) {

		shell.setLayout(new GridLayout(2, true));

		// ID

		Label lid = new Label(shell, SWT.HORIZONTAL | SWT.SHADOW_OUT);
		lid.setText("Employee ID");
		Text tid = new Text(shell, SWT.BORDER | SWT.LEFT);

		// Age

		Label lage = new Label(shell, SWT.HORIZONTAL | SWT.SHADOW_OUT);
		lage.setText("Age");
		Text tage = new Text(shell, SWT.BORDER | SWT.LEFT);

		// Salary

		Label lsalary = new Label(shell, SWT.HORIZONTAL | SWT.SHADOW_OUT);
		lsalary.setText("Salary");
		Text tsalary = new Text(shell, SWT.BORDER | SWT.LEFT);

		final Button checkButton = new Button(shell, SWT.CHECK);
		checkButton.setText("Is Insured ?");
		checkButton.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {

				if (checkButton.getSelection()) {
					insGroup.setVisible(true);

				} else {
					insGroup.setVisible(false);
				}
			}

		});

		// Insurance Group

		insGroup = new Group(shell, SWT.SHADOW_IN);
		insGroup.setText("Insurance Details");
		insGroup.setLayout(new GridLayout(1, true));
		Label lb = new Label(insGroup, SWT.HORIZONTAL | SWT.SHADOW_OUT);
		lb.setText("Description");
		Text details = new Text(insGroup, SWT.BORDER | SWT.MULTI);
		insGroup.setVisible(false);

	}

}

Custom JFace Dialog

Custom Dialogbox  extending org.eclipse.jface.dialogs.Dialog class

Source:

import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Text;

public class JfaceEmployeeDialog extends Dialog {

	public JfaceEmployeeDialog(Shell parent) {
		super(parent);
	}

	@Override
	protected Control createDialogArea(Composite parent) {

		Composite composite = (Composite) super.createDialogArea(parent);

		composite.getShell().setText("Add Employee");

		composite.setLayout(new GridLayout(1, true));

		draw(composite); // Contents of Dialog

		return composite;
	}

	private void draw(Composite composite) {

		// Employee Group

		Group empgroup = new Group(composite, SWT.SHADOW_IN);
		empgroup.setText("Employee Details");
		empgroup.setLayout(new GridLayout(3, true));

		// ID

		Label label = new Label(empgroup, SWT.HORIZONTAL);
		label.setText("Employee ID");
		Text tid = new Text(empgroup, SWT.FILL | SWT.BORDER);

		GridData textData = new GridData(SWT.FILL, SWT.FILL, true, true);
		textData.horizontalSpan = 2;
		textData.widthHint = 300;
		tid.setLayoutData(textData);

		// Name

		Label l_name = new Label(empgroup, SWT.HORIZONTAL);
		l_name.setText("Name");
		Text t_name = new Text(empgroup, SWT.FILL | SWT.BORDER);
		t_name.setLayoutData(textData);

		// Age

		Label l_age = new Label(empgroup, SWT.HORIZONTAL);
		l_age.setText("Age");
		Text t_age = new Text(empgroup, SWT.FILL | SWT.BORDER);
		t_age.setLayoutData(textData);

		Label lb = new Label(empgroup, SWT.HORIZONTAL);
		lb.setText("Is Insured");

		// CheckBox

		final Button checkBox = new Button(empgroup, SWT.CHECK);
		empgroup.setVisible(true);

		// Insurance Group

		final Group insgroup = new Group(composite, SWT.SHADOW_IN);
		insgroup.setText("Insurance Details");
		insgroup.setLayout(new GridLayout(3, true));

		// Amount

		Label l_amount = new Label(insgroup, SWT.HORIZONTAL);
		l_amount.setText("Amount");
		Text t_amount = new Text(insgroup, SWT.FILL | SWT.BORDER);
		t_amount.setLayoutData(textData);
		insgroup.setVisible(false);

		// Adding listener to check button

		checkBox.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {

				if (checkBox.getSelection()) {
					insgroup.setVisible(true);
				} else {
					insgroup.setVisible(false);
				}
			}
		});

	}

}

 

Resolve IP to Country Name in Java

Getting country name from IP address can be done offline with help of a simple Java library.

Download IP2C file from Here- http://files.firestats.cc/ip2c/ip2c-2.0.0.zip

 

IP2C resolves country names from ip using a binary File. It uses database provided by Webhosting.info and also supports Software77  Database.

It converts the CSV database into binary file and supports the search straight on the file ,in memory or in a memory mapped file.

Here are Steps to use this library with Java.

  • Extract the downloaded file
  • Add ip2c.jar to the Build Path 
  • Copy ip-to-country.bin file into your project folder
Usage (In Memory):
import java.io.IOException;
import net.firefang.ip2c.Country;
import net.firefang.ip2c.IP2Country;

public class ip {

	public static void main(String args[]) throws IOException{

	String iptest = "180.149.247.26";
	int caching1 = IP2Country.MEMORY_CACHE;
	IP2Country ip2c = new IP2Country(caching1);
	Country c = ip2c.getCountry(iptest);
	if (c == null)	{
	        System.out.println("UNKNOWN");                          
	}
	else{
	        System.out.println(c.getName());      
	}
	}
}

 

For Usage with PHP and other details see IP2C

Firebug Icon Missing on addon bar in Firefox 5 ,6

Updating Firebug in Firefox 5 , 6 removes the icon in add-on bar at the bottom .

In newer versions of Firebug the icon in add-on bar has been removed and changed to toolbar-icon  that can be placed on any toolbar . Here are the steps:

 

  • Right Click on Firefox Toolbar (at the top ) and Click Customize
  •  “Customize Toolbar” window pops up showing various items.
  • Scroll down and find Firebug icon
  • Now Drag the icon and drop it on any Toolbar or add-on bar at the bottom
  • Firebug icon will now be visible. To change the position of Icon again click “Customize” and repeat above steps

 

Eclipse Content Assist auto-complete (Ctrl +Space) disabled ?

Content Assist(Ctrl + Space)  is an auto-complete feature in Eclipse that helps in easy and fast coding. Popup windows  are displayed to propose possible text choices to complete a phrase , methods or arguments.

But sometimes this feature stops functioning and becomes almost impossible to write code.

Here are few steps that can help to bring back or enable Content assist feature.

1. Go to Windows-> Preferences

Now go to Java>Editor>Content Assist and Java>Editor>Content Assist>Advanced  and enable settings for which you want to enable auto-complete.

Click “Result Defaults” if you don’t know what to do.

 

2.  Make New Workspace and import your projects into New Workspace. Restart Eclipse.

3. One of the main reasons of Content assist not working is Ctrl + Space keys bound to another application . Make sure that no other application uses these set of keys. For eg. In Linux Ctrl +Space does not work because of SCIM feature to change input method installed . Make sure it is disabled.

4. Make sure that your Operating System Language and settings are set to En-US