micromax canvas hd lollipop update
I rewrite this tutorial from forum.xda-developers.com : The users of Micromax A116 Canvas Hd can now update their handsets to Android 5.0 Lo...
The Blog You Will Love To Revisit.
In This Tutorial We Are Going To Show you How You Can Link Java And Microsoft Bitlocker Utility. The Principle We Are Working On Is That we Can get The Permutations Of A Single Word and Then Check if The word matches the password. If it Does so Then Our Program Is Able To Hack The Windows Bitlocker Password
public class Permutation{
public static void main(String args[]){
String st = "Word Here";
TreeSet<Character> chars = new TreeSet<Character>();
for(int i=0;i<st.length();++i){
chars.add(st.charAt(i));
}
int permutation =(int)Math.pow(chars.size(),st.length());
Random r = new Random();
String str ="";
TreeSet<String> words = new TreeSet<String>();
outer : for(;;){
str="";
for(int i=0;i<st.length();++i){
str=str+""+chars.get(r.nextInt(chars.size()));
}
words.add(str);
if(words.size()==permutation){
break outer;
}
}
System.out.println("Permutations = "+words);
}
}
The Next Part That Follows is The Linking Between Java And Microsoft BitLockerpublic class Connect {
public static void main(String args[]){
Runtime rt = Runtime.getRuntime();
try{
String command ="help";
Process ps = rt.exec("cmd /c "+command);
InputStream is = ps.getInputStream();
InputStreamReader rd = new InputStreamReader(is);
BufferedReader br = new BufferedReader(rd);
String st ="";
while((st = br.readLine())!=null){
System.out.println(st);
}
br.close();
}catch(Exception e){
System.out.println(e.getMessage());
}
}
}
The Above Code You see Has Been Showing The Output For "HELP" Command Of Windows Command Prompt
adapter(a new wrapping class) in between the systems, which listens for client requests to the older interface, and redirects or translates them into calls to the new interface. This conversion can either be implemented with inheritance or composition.Great design is not just about re-usability, but about extensibility.

LegacyVideoController interface to control the video system.
01
02
03
04
05
06
07
08
09
10
| public interface LegacyVideoController{ /** * Begins the playback after startTimeTicks * from the beginning of the video * @param startTimeTicks time in milliseconds */ public void startPlayback(long startTimeTicks); ...} |
1
2
3
4
5
| public void playBackVideo(long timeToStart, LegacyVideoController controller){ if(controller!=null){ controller.startPlayback(timeToStart); }} |
01
02
03
04
05
06
07
08
09
10
11
12
13
| public interface AdvancedVideoController{ /** * Places the controller head after time * from the beginning of the track * @param time time defines how much seek is required */ public void seek(Time time); /** * Plays the track */ public void play();} |
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
| public class AdvancedVideoControllerAdapter implements LegacyVideoController { private AdvancedVideoController advancedVideoController; public AdvancedVideoControllerAdapter(AdvancedVideoController advancedVideoController){ this.advancedVideoController = advancedVideoController; } @Override public void startPlayback(long startTimeTicks) { // Convert long into DateTime Time startTime = getTime(startTimeTicks); // Adapt advancedVideoController.seek(startTime); advancedVideoController.play(); }} |
This "has-a" relationship allows the adapter to delegate the client request to the actual instance.
1
2
3
4
| AdvancedVideoController advancedController = controllerFactory.createController();// adapt LegacyVideoController controllerAdapter = new AdvancedVideoControllerAdapter(advancedController);playBackVideo(20, controllerAdapter); |
Cache, an object pool of threads, connections etc. For such entities, one and only instance must suffice else they threaten the stability and defeat the purpose of the application.
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
| public class ApplicationCache{ private Map<String, Object> attributeMap; // Static instance private static ApplicationCache instance; // Static accessor method public static ApplicationCache getInstance(){ if(instance == null){ instance == new ApplicationCache(); } return instance; } // private Constructor private ApplicationCache(){ attributeMap = createCache(); // Initialize the cache }} |
new operator. To fetch the cache, we invoke:
1
2
| ApplicationCache cache = ApplicationCache.getInstance();// use cache to improve performance |
synchronized and volatile in Java.
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
| public class ApplicationCache{ private Map<String, Object> attributeMap; // volatile so that JVM out-of-order writes do not happen private static volatile ApplicationCache instance; public static ApplicationCache getInstance(){ // Checked once if(instance == null){ // Synchronized on Class level lock synchronized(ApplicationCache.class){ // Checked again if(instance == null){ instance == new ApplicationCache(); } } } return instance; } private ApplicationCache(){ attributeMap = createCache(); // Initialize the cache }} |
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
| public class ApplicationCache{ private Map<String, Object> attributeMap; // Initialized while declaration private static ApplicationCache instance = new ApplicationCache(); public static ApplicationCache getInstance(){ return instance; } // private Construcutor private ApplicationCache(){ attributeMap = createCache(); // Initialize the cache }} |
readResolve() method from the Serialization APIsingleton in Javascript. The intent remains the same: controlling the creation of the object and maintaining a global point of access, but the implementation differs with the constructs and semantics of each language.
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
| var applicationCache = function() { // Private stuff var instance; function initCache() { return { proxyUrl: "/bin/getCache.json", cachePurgeTime: 5000, permissions: { read: "everyone", write: "admin" } }; } // Public return { getInstance: function() { if (!instance) instance = initCache(); return instance; }, purgeCache: function() { instance = null; } };}; |
Not every problem requires the use of a specific design pattern
Get our latest updates direct in your inbox.Just enter your wail address below....
Your privacy and email address are safe with us!