Sunday, September 11, 2011

Network RAM


Network RAM enables nodes with over-committed memory to swap pages over the network, storing them in the idle RAM of other nodes and avoiding swapping to slow, local disk.

As several parallel or parallel and sequential applications are simultaneously running on the system ,there are likely to be imbalances in RAM usage across nodes. Network RAM systems take advantage of imbalances in RAM usage and allow nodes with over-committed RAM to locate and use the idle RAM of remote nodes as backing store; pages are “swapped out” over a fast network and stored in the idle RAM of other nodes. This disparity will likely continue to grow because disk speeds are limited by mechanical movement.

Large amounts of idle cluster memory are almost always available (even when some nodes are overloaded), and that large chunks are available for significant amounts of time. As a result, a Network RAM system should be able to find usable amounts of idle RAM to store swapped pages.

Nswap: A Network Swapping Module For Linux Clusters


Nswap is a Network RAM system for general purpose Linux clusters and networked systems. Cluster applications that process large amounts of data, such as parallel scientific or multimedia applications, are likely to cause disk swapping on individual cluster nodes.

Cluster applications that process large amounts of data, such as parallel scientific or multimedia applications, are likely to cause swapping on individual cluster nodes.

Nswap is implemented as a loadable kernel module that runs entirely in kernel space on an unmodified Linux 2.6 kernel. It transparently and efficiently provides network RAM to cluster applications. Nswap uses a peer-to-peer design (vs. a centralized system) that scales to large clusters. A novel feature of Nswap is its adaptability to changes in a node's memory load; when a node needs more memory for its local processes, it acts as an Nswap client swapping its pages over the network, and when a node has idle RAM space it acts as an Nswap server caching other nodes' swapped pages.

Ref: Reliable Adaptable Network RAM, Swarthmore College, USA.


Thursday, August 25, 2011

How to apply Gradient Color to GUI Components in JAVA


  • It’s always said that first impression is last impression. This quote is also applicable in the field of Software Development. To impress your client you must have a pretty good GUI (Graphical User Interface) especially when that client is not belongs from computer field.
  • So, hereby I am going to share about color management for GUI components. A component with gradient color looks good rather than a solid color.
  • I hope you know about Java Applet. In which we are implementing a ‘paint’ method which draws component on applet screen or on frame. We are going to use that same method here also.
  • This method can be applied to any java GUI component such as JPanel, JButton, JTabbedPane, JToggleButton, JMenu, JMenuItem.

Let’s consider a component JPanel , as it’s a swing component it is preceded by ‘J’.

Generate a java class file and name it as MyJPanelGradient.java.
A code to paste in MyJPanelGradient.java file.
package pkg;
import java.awt.Color;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D; // Imported Libraries
import javax.swing.JPanel;
import javax.swing.BorderFactory;
import javax.swing.border.LineBorder;
import javax.swing.border.TitledBorder;

public class MyJPanelGradient extends JPanel {
@Override
protected void paintComponent( Graphics g ) {
if ( !isOpaque( ) ) {
super.paintComponent( g );
return;
}

Graphics2D g2d = (Graphics2D) g;

//to get height and width of the component
int w = getWidth();
int h = getHeight();

//generating two colors for gradient pattern
/*parameters are consentration of Red, Blue and Green color in HEX format*/
Color color1 = new Color(0xeb,0xeb,0xeb);
Color color2 = new Color(0xa2,0xbd,0xd8);

/*generating gradient pattern from two colors*/
GradientPaint gp = new GradientPaint( 0, 0, color1, 0, h, color2 );
g2d.setPaint( gp ); //set grdient color to graphics2D object
g2d.fillRect( 0, 0, w, h );//feeling color
setOpaque( false );

//Generating Titleborder
TitledBorder title;
title= BorderFactory.createTitledBorder(new LineBorder(new Color(0,51,204), 2, true), null, javax.swing.border.TitledBorder.LEFT, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 0, 16), Color.BLACK);

super.setBorder(title); //appling border to JPanel
super.paintComponent( g );
setOpaque( true );
}
}
Beauty of this code: Just drag this class file from the list of project file and drop it on window form or frame. It will directly draw a panel with gradient color and border.


You can change color of gradient pattern by changing the parameter passed in Color.
Gradient pattern can also of different type as shown below



With this same concept you can create class for any component with appropriate changes. Just remember to change super class when you changes the component.
Example: for JButton, class declaration will be:

public class MyGradientJButton extends JButton

For different properties of component you can refer all time favorite Java Docs.


Saturday, March 26, 2011


How To Enable Or Disable USB Pendrive Access:
As pendrive is main source of viruses through which our machine is affected.

Sometimes it may be possible that we want to make our USB port inaccessible, may be to avoid unauthenticated use or to be safe from viruses. 

So there is a Registry trick through which you can Enable or Disable USB port access.
                                                
Method 1(Using Registry)
To disable the access to USB port:

1. Click Start–>Run.
2. Type regedit, and then click OK.
3. Locate, and then click the following registry key:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\UsbStor

4. In the right pane, double-click Start.
5. In the Value data box, type 4, click Hexadecimal (if it is not already selected), and then click Ok.
6. Quit Registry Editor.
7.Restart your machine to reload your registry.

To re-enable a disabled port:
1. Click Start–>Run.
2. Type regedit, and then click OK.
3. Locate, and then click the following registry key:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\UsbStor

4. In the right pane, double-click Start.
5. In the Value data box, type 3, click Hexadecimal (if it is not already selected), and then click Ok.
6. Quit Registry Editor.
7.Restart your machine to reload your registry.

Method 2 (Using Notepad)
  • Open notepad
To disable the access to USB port:
To Disable USB Port Copy and paste the below code then save it as “disableUSB.reg”

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR]
“Start”=dword:00000004
  • Then double click disableUSB.reg file and it will ask do you want to add the information to registry.
  • Click yes.
  • Restart your machine to reload your registry.

To re-enable a disabled port:
If you wish to Enable USB Port then Copy & Paste the Below Code and save it as “enableUSB.reg”

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR]
“Start”=dword:00000003
  • Then double click enableUSB.reg file and it will ask do you want to add the information to registry.
  • Click yes.
  • Restart your machine to reload your registry.


Wednesday, February 2, 2011

Share Multiple Websites in a single URL

       Sometimes we need to share a bunch of website link to other. At that time we generally writes these all links one by one, and then receiver have to open that link one by one.


      In this blog i will share you about How to Share Multiple Websites in Single URL.


For that first open www.bridgeurl.com


      Then select title  appropriate to websites to be bunched.
(Ex. if your sites to be share are www.google.com , www.yahoo.com , www.bing.com ,you can give  a title as "Search Engines" - any user defined name)


     Then list all the websites in second text box(including http://)
http://www.google.com
http://www.yahoo.com
http://www.bing.com 


     Click on create link, on the next page automatically a shortened link will be generated. (Ex:http://bit.ly/ezvb9L)


     Paste this link in URL bar of browser, and u will see first website on page and by clicking next on same page at right side you will get other website.(Initially it may take some time to load)


     Some of the finance a secured website may have restricted this functionality.

Wednesday, January 12, 2011

Facebook's Built in Shortcut Keys

Today I want to share facebook's built in shortcut key.

Note: Mozzila Firefox user consider Shift + Alt instead of only Alt.

1)To Open Create New Message

         Shortcut Key is: Alt + m
 



 2)For Search Box

     Shortcut Key is: Alt + ?

  3)To open Home Page
      
                Shortcut Key is: Alt + 1

4)To open Profile Page

                Shortcut Key is: Alt + 2

5)To open Friend Request Tab

               Shortcut Key is: Alt + 3













6)To open New Message Tab

               Shortcut Key is: Alt + 4





7)To open Notification Tab

             Shortcut Key is: Alt + 5






Enjoy faster surfing on FACEBOOK....

Sunday, January 9, 2011

Automatic Save Your Document at Specified Period of Time

 In this post we will see  Automatic saving Documents , avoiding overhead of pressing Ctrl + s periodically.


It requires Autohotkey should to be installed, if yet not installed then click here.




·        Open Autohotey script form right side of taskbar, right click on Autohotkey icon(showing “ H ”) select  “ Edit this Script ”.



·        Copy below script and paste in to Autohotey script.


!S::                  ; indicates hotkey(Alt + S)                                                        
loop               ;continuously executes following code                               
{
            sleep 3000           ; send save at every 3 sec.
            send ^s                  ; send save command
            GetKeyState, state, F2 ; check if F2 is pressed                                 
if state = D  ;if key pressed then state=D else  U
             break                           ;Breaks the loop
}
return                     ;returns from hotkey excecution


·        Here D means Down(key pressed), U means Up(key not pressed)

·        Now save this file and “reload this script” by method as we selected “Edit this Script”.

·        And then open any document file or new one and press Alt+s your script will starts to run.

·        Press F2 to stop this script. Be careful while pressing F2 as script will not detect F2 when it sleeps. So you may need to press F2 more times to detect it in script running time. Or else You can just Exit from Autohotkey , after completing your task.

You can also starts to make such scripts from your ideas to “Simplify Windows”.

To get full document regarding Autohotkey script click here.

Friday, January 7, 2011

How to Enable Ctrl+V for Pasting in the Windows Command Prompt

           In this post I want to share about “how to make your own hotkeys for a specific task in windows?”         

You’ll need to first make sure that you’ve got AutoHotkey installed. Now run that program, it will prompt you to open default script click on “yes”.
You will find some default code written in it, just read it. Some syntax significance:
·       ^  is for “ctrl”
·       !  is for “Alt”
·       #  is for Window key
·       ; is for comments.
Now you need to copy the below code and paste in that script file. Then
#IfWinActive ahk_class ConsoleWindowClass
^V::
SendInput {Raw}%clipboard%
return
#IfWinActive
What this script does is simply use the SendInput function to send the data into the window, which is a lot faster than any other method . 

When this gets executed first it checks whether console is open or not, and then “^V::” is indicates when Ctrl + V is pressed execute next code.
To directly download this script  click here.

Some of the other basic tasks for which I have generated hot keys are:
·        Ctrl + up and Ctrl + Down in Command Prompt for scrolling.
·        Automatic save my document in specified period of time.
·        Move/Copy data from specified folder to other specified folder.
·        A hotkey to open specified folder/file.
·        A hotkey to run specified application.
·        A hotkey to open specified website.
·        And many more…
      The script for above task will be posted soon on this blog in  “Simplify Windows" Series.