Thursday, February 4, 2016

java code to load and play media file

import javax.media.*;
import java.io.File;

import java.awt.*;
 
public class TrivialJMFPlayer extends Frame {

 
    public static void main (String[] args) {

        try {
            Frame f = new TrivialJMFPlayer();

            f.pack();

            f.setVisible (true);

        } catch (Exception e) {

            e.printStackTrace();

        }
    }
    public TrivialJMFPlayer() 

        throws java.io.IOException,

               java.net.MalformedURLException,
               javax.media.MediaException {

        FileDialog fd = new FileDialog

            (this, "TrivialJMFPlayer", FileDialog.LOAD);

        fd.setVisible(true);

        File f = new File(fd.getDirectory(), fd.getFile());

        Player p = Manager.createRealizedPlayer
            (f.toURI().toURL());

        Component c = p.getVisualComponent();

        add(c);
        p.start();

    }
}

Google Chrome Shotcuts


Navigate elements
Expand/collapse
Enter
Edit attribute
H
Hide element
F2
Toggle edit as HTML
Styles Pane
TabShift + Tab
Next/previous property
Increment value
Decrement value
PageUpShift + ↑
Increment by 10
PageDownShift + ↓
Decrement by 10
Shift + PageUp
Increment by 100
Shift + PageDown
Decrement by 100
Alt + ↑
Increment by 0.1
Alt + ↓
Decrement by 0.1
Debugger
F8Ctrl + \
Pause/ Continue
F10Ctrl + '
Step over
F11Ctrl + ;
Step into
Shift + F11Ctrl + Shift + ;
Step out
Ctrl + .Ctrl + ,
Next/previous call frame
Ctrl + Shift + E
Evaluate selection in console
Ctrl + Shift + A
Add selection to watch
Ctrl + B
Toggle breakpoint
Console
Ctrl + L
Clear console
Tab
Autocomplete common prefix
Accept suggestion
Ctrl + U
Clear console prompt
Next/previous line
Enter
Execute command
Text Editor
Ctrl + Shift + P
Go to member
Ctrl + Space
Autocompletion
Ctrl + G
Go to line
Alt + -
Jump to previous editing location
Alt + +
Jump to next editing location
Ctrl + /
Toggle comment
Alt + ↑
Increment CSS unit by 1
Alt + ↓
Decrement CSS unit by 1
Alt + PageUp
Increment CSS unit by 10
Alt + PageDown
Decrement CSS unit by 10
Ctrl + D
Select next occurrence
Ctrl + U
Soft undo
Ctrl + M
Go to matching bracket
Alt + W
Close editor tab
Alt + O
Switch between files with the same name and different extensions.
Timeline Panel
Ctrl + E
Start/stop recording
F5Ctrl + R
Record page reload
Ctrl + S
Save timeline data
Ctrl + O
Load timeline data
[]
Jump to previous/next frame
Profiles Panel
Ctrl + E
Start/stop recording
All Panels
Ctrl + [Ctrl + ]
Go to the panel to the left/right
Ctrl + Alt + [Ctrl + Alt + ]
Go back/forward in panel history
Ctrl + Tilde
Show console
Esc
Toggle drawer
Ctrl + Shift + M
Toggle device mode
Ctrl + Shift + D
Toggle dock side
Ctrl + F
Search
Ctrl + Shift + F
Search across all sources
Ctrl + Shift + C
Select node to inspect
Ctrl + P
Go to source

Java + How to create Synchronized Map ?

Hash Map class Structure

Class HashMap

java.lang.Object

java.util.AbstractMap

java.util.HashMap

Creating SynchronizedMap

Map m = Collections.synchronizedMap(new HashMap(...));

Points to remember about HashMap

1) Permits null values and the null key. 

2) HashMap class is equivalent to Hashtable, except that it is unsynchronized and permits nulls.

3) It does not guarantee that the order will remain constant over time

4) An instance of HashMap has two parameters that affect its  performance: initial capacity and      

    load factor. 

5) The capacity is the number of buckets in the hash table, and the initial capacity is simply the   

    capacity at the  time the hash table is created. 

6) The load factor is a measure of how full the hash table  is allowed to get before its capacity is 

    automatically increased.