Hot Posts:

Mar 20

Deleting all mails From root inbox on Linux


Always confused how to delete all messages from root inbox on Linux:
First check the messages by issuing
mail
If you find them useless ( indeed 😉 ), use the following command:
> /var/spool/mail/root (That’s the location where all messages are appended).

Mar 20

Command Line Mail in Linux


Simple way for using command line mail program on Linux:
Simple Email Message:
echo “Message Body” | mail -s “Subject” receiver@emailaddress.com

Sending File using Linux mail command:
mail -s “Subject” receiver@emailaddress.com < file_to_send.txt
Sending Binary Files with Linux mail command:
Sometimes sending binary files does not work well the command line. We can use uuencode formatting for sending such files:
uuencode myimage.jpeg | mail -s “Subject” receiver@emailaddress.com
Few command line options for Linux mail command:
-s subject Use subject for the e-mail title
-c address Send copy of the mail to the specified address
-b address Send blind carbon copy to specified address
More details can be found here:
Linux Mail Command Line Options
Linux Mail Command Line Options – source 2

Mar 18

RMI Concept


Remote Method Invocation (RMI):
RMI API is a Java application programming interface for performing the object equivalent of remote procedure calls. The concept of RMI is that, the client can use the services provided by a server which is on a different JVM, making remote calls to it. The client talks to a proxy server, which is in the same JVM as the client, and in turn talks to the actual server on a different JVM. So for the client it feels as if it is talking to a local server. This abstraction is taken care by the RMI API.
For the client to make remote calls on the server, it has to know what all methods are available for it to use. The representation of the service provided by the server to the client is in the form of an interface which the server implements. Therefore, the key to understanding RMI is to remember that interfaces define behavior and classes define implementation. RMI supports two classes that implement the same interface. The first class is the implementation of the behavior, and it runs on the server. The second class acts as a proxy for the remote service and it runs on the client.
RMI Architecture:

RMI Architecture

Stub & Skeleton Layer:
Stub is present on the client and Skeleton is present on the server. In this layer, RMI uses the Proxy design pattern. In the Proxy pattern, an object in one context is represented by another (the proxy) in a separate context. The proxy knows how to forward method calls between the participating objects. In RMI’s use of the Proxy pattern, the stub class plays the role of the proxy, and the remote service implementation class plays the role of the RealSubject.

When a stub's method is invoked, it does the following:

Mar 13

Super() in Java


Properties of Super() in Java:

  • Used to invoke “Parentclass” constructor using “Baseclass”
  • Invocation of a superclass constructor must be the first line in the subclass constructor.
  • It supports super(), the superclass with no-argument and with super(parameter list) with parameters
  • Java compiler automatically invokes the no-argument constructor of the superclass.

Example:


public void ParentClass {
String message;
public ParentClass ( String message ){
message = message;
}
}
public void BaseClass extends ParentClass {
String messageTwo;
public BaseClass ( String message, String messageTwo ){
super();
messageTwo = messageTwo;
}
}
Mar 12

Super keyword in Java


Some properties of Super keyword:

  • If you have “childclass” overriding methods in “parentclass”, you can invoke overriden methods using super keyword
  • It has advantage so that you don’t to have to perform operations in the “parentclass” again.
  • Only the immediate “parentclass’s” data and methods can be accessed.

Example:


public class Parentclass {
public void calculateValue() {
System.out.println("2*2");
}
}
public Baseclass extends Parentclass{
// Overrides the calculateValue() method
public void calculateValue() {
super.calculateValue();
System.out.println("10*10");
}
}

Solution:
It will print 4 & 100.

Mar 11

Yahoo onePlace – Manage Important Internet Content on Mobile


Yahoo unveiled Yahoo! onePlace

Mar 08

iPhone SDK Released


Requirements for iPhone SDK:

  • # Mac OS X Leopard
  • # An Intel-based Mac
  • # Xcode
  • # A free Apple iPhone developer account and the SDK itself — It’s free, though getting the application approved and out onto devices will set you back the $99.

Coverage of Live Event :
iPhone SDK Release
Apple iPhone Developer Program
[video:youtube:v=4i-YCMj9L-g]

Mar 06

iPhone Social Networking – Gypsii


The iPhone is one of the coolest mobile gadget ever invented, that

Mar 05

Semaphores in Java – Part I


Semaphores can be used for mutual exclusion and thread synchronization. Instead of busy waiting and wasting CPU cycles, a thread can block on a semaphore (the operating system removes the thread from the CPU scheduling or “ready” queue) if it must wait to enter its critical section or if the resource it wants is not available.
Mutual exclusion pseudocode:
semaphore S = 1; … P(S); N=N+1; V(S);
Condition synchronization pseudocode (resource availability):
semaphore tapeDrives = 7; … P(tapeDrives); useTapeDrive(); V(tapeDrives);
Java has implicit binary semaphores of the form


Object mutex = new Object();
/*...*/
synchronized (mutex) {
/*...*/
}


that can be used for mutual exclusion. Only one thread at a time can be executing inside the synchronized block.
Java synchronization primitives built in Java (monitors and wait sets) behind synchronized, wait(), and notify(). Fortunately, Java allows you to implement all the familiar synchronization schemes on top of monitors and wait sets.

Mar 04

Download Mp3 Music Files From Last.fm For Free


Last.fm which is largest social music platform with over 20 million active users have a section where you can download free Mp3 music files. This section is called Weekly Free Downloads where you currently can download nearly 200 songs including also popular artists like Rihanna, Snoop Dogg and others.
The list of free songs is sorted by popularity so you can see how actual the song.
Soure:http://www.rotorblog.com/2007/11/28/download-mp3-music-files-from-lastfm-for-free/