January 30, 2014

How to get a machine serial number from Java?

import java.util.Scanner;
public class GetMachineSerialNumber
{
    public static void main(String[] args)
    {
        try
        {
            Process process = Runtime.getRuntime().exec(new String[] { "wmic", "bios", "get", "serialnumber" });
            process.getOutputStream().close();
            Scanner sc = new Scanner(process.getInputStream());
            String property = sc.next();
            String serialnum = sc.next();
            System.out.println(property + ": " + serialnum);
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }
}


 OUTPUT: SerialNumber: L908230

January 29, 2014

How to fetch Mac ID of Client machine using Java Applet in a web based application?


1). You need to download "java-plugin-1.6.0.23.jar" 
2). Create a Java Project "GetClientMacID". Project Structure will look like this:

3). Create a Java Applet "MacIDFinder"

import java.applet.Applet;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.ArrayList;
import java.util.Enumeration;
import netscape.javascript.JSObject;

public class MacIDFinder extends Applet
{
    public static String sep = ":";

    public static String getMacFromInterface(NetworkInterface ni) throws SocketException
    {
        byte mac[] = ni.getHardwareAddress();
        if (mac != null)
        {
            StringBuilder macAddress = new StringBuilder("");
            String sep = "";
            for (byte o : mac)
            {
                macAddress.append(sep).append(String.format("%02X", o));
                sep = ":";
            }
            return macAddress.toString();
        }
        return "";
    }

    public static String[] getInterfaces()
    {
        try
        {
            Enumeration nis = NetworkInterface.getNetworkInterfaces();
            ArrayList result = new ArrayList();
            while (nis.hasMoreElements())
            {
                NetworkInterface ni = nis.nextElement();
                if (ni.isUp() && !ni.isLoopback() && !ni.isVirtual()) {
                    String mac = getMacFromInterface(ni);
                    String str = mac;//ni.getDisplayName() + ";" + mac;
                    result.add(str);
                }
            }
            return result.toArray(new String[0]);
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
        return new String[0];
    }
    public static String getInterfacesJSON() {
        try
        {
            String macs[] = getInterfaces();

            String sep = "";
            StringBuilder macArray = new StringBuilder("");
            for (String mac : macs)
            {
                macArray.append(sep).append(mac);
                sep = "','";
            }
            macArray.append("");

            return macArray.toString();
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
        return "[]";
    }
    public static void setSep( String sep )
    {
        try {
            MacIDFinder.sep = sep;
        } catch( Exception ex ) {          
        }
    }
    @Override
    public void start()
    {
        JSObject window = JSObject.getWindow(this);
        String macid=getInterfacesJSON();
        System.out.println( "Mac ID Of Client is: " + macid );
        window.call("setMacAddress", new Object[] {macid})   ;
    }  
}


4).  Now create a "build.xml"  file:

<project>
    <target name="clean">
        <delete dir="build"/>
    </target>

    <target name="compile">
        <mkdir dir="build"/>
        <javac srcdir="." destdir="build" classpath="./java-plugin-1.6.0.23.jar"/>
    </target>

    <target name="jar">
        <mkdir dir="build"/>
        <jar destfile="build/macidfinder.jar" basedir="build">
            <manifest>
                <attribute name="Main-Class" value="MacIDFinder"/>
            </manifest>
        </jar>
    </target>

    <target name="run">
        <java jar="build/macidfinder.jar" fork="true"/>
    </target>
</project>


5). Drag and drop above Build.xml on Ant View:
6). Now execute clean, compile and jar, which will generate "macidfinder.jar" in build folder:

7). To need to sign the jar before embedding the applet in JSP. 

Why need to sign Java Applet? Java applets are living in a restricted environment so called “sandbox”, when it is running inside web browser. This prevents the applets from accessing system resources and devices such as files, network connections, printers, cameras, microphones, etc, without user-granted permission. This tight security is designed to make users safe from malicious code which always tries to execute automatically without user’s intervention.

Go to the command prompt and execute below command, which will generate the key which will be used for Jar Signing:

keytool -genkey -alias macid123 -validity 30

 Where "macid123" is test alias.  -validity 30  means your key has a validity of 30 days. if not specified the certificate that you are generating and signing has a default validity for 180 days. 

D:\>keytool -genkey -alias macid123 -validity 30
Enter keystore password:
mac768
 Re-enter new password:mac768
What is your first and last name?
  [Unknown]:  K Himaanshu Shukla
What is the name of your organizational unit?
  [Unknown]:  Scrutiny
What is the name of your organization?
  [Unknown]:  Scrutiny
What is the name of your City or Locality?
  [Unknown]:  Mumbai
What is the name of your State or Province?
  [Unknown]:  Maharastra
What is the two-letter country code for this unit?
  [Unknown]:  91
Is CN=K Himaanshu Shukla, OU=Scrutiny, O=Scrutiny, L=Mumbai, ST=Maharastra, C=91
 correct?
  [no]:  y

Enter key password for <macid123>
        (RETURN if same as keystore password):
mac768
Re-enter new password:mac768

8).  To sign the jar execute the below command:
jarsigner macidfinder.jar  macid123

It will ask you for the password which you have specified in step 7.

D:\>jarsigner macidfinder.jar  macid123
Enter Passphrase for keystore: mac768
jarsigner: unable to open jar file: macidfinder.jar


9).  Now create a jsp in which you will be embedding the above applet:

<table>
<tr>
<td>
<applet width="50" height="50" code="MacIDFinder.class" codebase="${pageContext.request.contextPath}"  archive="
macidfinder.jar, java-plugin-1.6.0.23.jar"></applet>
<input type="hidden" id="maccid" name="maccid" />
</td>
</tr>
</table>


10).  Copy macidfinder.jar, java-plugin-1.6.0.23.jar in the same location where your JSP is present.

11).  Add the below java script code in your JSP.

 <script>
function
setMacAddress(macaddress)
{
document.forms[0].maccid.value=
macaddress;
}
</script>



setMacAddress()  will be called from the start() method of MacIDFinder from the below code:

window.call("setMacAddress", new Object[] {macid})  ;

 setMacAddress()  java script will set the fetched Mac ID in hidden variable.

-K Himaanshu Shukla

Siddharth Malhotra and Varun Dhawan learned to romance from Shahrukh & Kajol

Sidharth Malhotra and Parineeti Chopra Promoted their upcoming film 'Hasee toh Phasee' which is scheduled to release on 7th February, 2014 on 'Comedy Nights with Kapil'

The duo had a gala time shooting with Kapil and were seen laughing throughout. The film will be the Sidharth's second film after his impressive Bollywood debut in "Student of the Year." He is also said to be looking forward to his third project, an action drama titled "The Villain" under Ekta Kapoor production. 

While shooting for the Comedy show, Siddharth revealed that he and his Student of the Year co-star Varun Dhawan used to copy Shahrukh Khan-Kajol and learnt their romantic scenes from them.

He said that during the shoot of My Name is Khan, he and Varun were assisting Karan Johar. And to polish their acting skills, they used to enact romantic scenes that Kajol and SRK were doing in the film. He also revealed that he and Varun were huge fans of both the actors and were in complete awe of them when they used to act.





Copyright © 2014 - ScrutinyByKHimaanshu

Varun Badola to play Urvashi Dholakia's husband in Jaya Bachchan's show Vasundhara!

As we already informed Urvashi Dholakia & Vishal Singh have been finalized to play eldest bahu and middle son in Jaya Bachchan's small screen debut show. Anupam Kher is approached to play jaya's husband. Now we heard Varun Badola, who was last seen in Zee TV's popular show Phir Subah Hogi has been roped in to play the elder son. Varun has been paired opposite Urvashi.

For those uninitiated, the show is tentatively titled Vasundhara is based on the Gujarati novel Yog Viyog (written by Kajal Oza Vaidya).

We tried to contact Varun, but he remained unavailable for comments.

-K Himaanshu Shukla...

 Related News:
Click Here to read more about Jaya Bachchan's debut show Vasudhara






Copyright © 2014 - ScrutinyByKHimaanshu

Ashish Kapoor to enter Saraswatichandra as Gautam Rode's brother

Actor Ashish Kapoor, who was last seen in Savitri, will soon enter in Saraswatichadra as Saras's (Gautam Rode) real brother. He will play Jaywardhan and his main motive is to take revenge from Gumaan Vyas (Monica Bedi).

We tried to contact Ashish, but he remained unavailable for comments.

-K Himaanshu Shukla...



Copyright © 2014 - ScrutinyByKHimaanshu

January 28, 2014

Ravishing Payal Rohatgi & Pooja Misrra took the Auditions for Perfect Miss Mumbai 2014

‘Perfect Miss Mumbai’ (PMM) is a unique platform for the girls 18 years of age and above to jump start and dazzle in the glamour industry. Yesterday (28 January, 2014) ex-Bigg Boss contestants Payal Rohatgi & Pooja Misrra along with organizer Gurubhai Thakkar and Khooshi Thakkar took auditions for girls, who came to take part in a beauty pageant.

The grand finale will be held on the 27th April, 2014 in Mumbai. The winner of PMM-2014 contest will bag many accolades, being the cover girl of 'Perfect Woman Magazine' is one of it.












Copyright © 2014 - ScrutinyByKHimaanshu

January 27, 2014

Siddharth Malhotra and Sahil Anand cross swords for the box-office pie

Siddharth Malhotra and Sahil Anand made their Bollywood debut with Karan Johar’s Student Of The Year. Both the actors have crossed swords for the box office pie as their second film Hasee Toh Phasee (starring Siddharth & Parineeti Chopra) and Babloo Happy Hai (starring Sahil & Erica Fernandes) are releasing on the same day.

Says a source, “Directed by 'I Am Kalam' fame Nila Madhab Panda, Babloo Happy Hai was scheduled to release on 31st January, 2014 but now it has ended up releasing with Hasee Toh Phasee.”

When contacted Sahil said, “Sid is a superstar and very good friend of mine. I never considered him as a rival. I am happy to know that our films are releasing on same date.”



Copyright © 2014 - ScrutinyByKHimaanshu

January 24, 2014

Anupam Kher to play Jaya Bachchan's husband in Sony TV's show?

Veteran actor Anupam Kher is approached to play Jaya Bachchan's husband in tentatively titled show Vasundhara on Sony TV. The show, will be produced under Jaya Bachchan's banner is based on the Gujarati novel Yog Viyog (written by Kajal Oza Vaidya).

According to our reliable sources, "Late Farooque Sheikh was supposed to play Jaya's husband, but due to his untimely demise Kher was approached."

The source further added , "Talented actor Naseeruddin Shah was also approached, but he politely declined the offer as right now he is not keen in doing a TV show."

For those uninitiated, Jaya shared screen space with Anupam in 'Laaga Chunari Mein Daag'.

Anupam Kher remained unavailable to comment.

-K Himaanshu Shukla...

 Related News:
Click Here to read more about Jaya Bachchan's debut show Vasudhara






Copyright © 2014 - ScrutinyByKHimaanshu

Spring Interview Questions


Q: What is Spring?
A: Spring is an open source development framework for enterprise Java. The core features of the Spring Framework can be used in developing any Java application, but there are extensions for building web applications on top of the Java EE platform. Spring framework targets to make J2EE development easier to use and promote good programming practice by enabling a POJO-based programming model.

January 23, 2014

TAM RATINGS: TVM(TRP) & GVT(GRP) Ratings 2014- Week 3



GVTs :-
  • Star Plus 625772 (629447)
  • Zee TV 470680 (488194)
  • Colors 466690 (456890)
  • Life OK 347326 (337771)
  • SAB 318311 (338233)
  • Sony 257635 (263081)
  • Sahara One 35959 (37863)

STAR PLUS :- 
  • Iss Pyaar Ko Kya Naam Doon 3.0 (3.4 )
  • Ek Ghar banauga : 4.3 (5.4) 
  • Saath Nibhana Saathiya : 10.4 (10.7)
  • Saraswatichandra : 5.8 (6.1)
  • Meri Bhabhi :5.4 (5.2)
  • Mahabharat: 7.5 (7.8) 
  • Diya Aur Baati Hum 13.5 ( 12.6)
  • Yeh Rishta Kya Kehla Hai 8.8 (8.7)
  • Pyaar Ka Dard 6.5 (7.3)
  • Veera :  5.1  (5.6)
  • Yeh Hai Mohabbatein 3.8(3.6) 
  • Arjun: 2.0 (1.9)
  • Nach Baliye:4.4 (5.3 )
  • Star Verdict: 1.4(1.1)
  • Koffee With Karan-4:  0.9 (1.0)
   
COLORS :-
  • Gori Tere Pyaar Mein rates 4.3 TVM. 
  • India's Got Talent 7.9 (  9.4 TVM ). 
  • Comedy Nights with Kapil 11.0 (10.4 ). 
  • Beintehaa 2.8 (2.6) ,
  • Rang Rasiya 2.7 (2.6 )
  • Balika Vadhu 6.3 (6.4),
  • Sasural Simar Ka  5.9  (5.7) , 
  • Madhubala  3.5 (3.9),  
  • Bani 3.3 (3.0),  
  • Sanskar 1.8 (2.0 )

Zee TV:-
  • Ramaiya Vastavaya rates 4.0 TVM over 3 hours.   
  • Aur Pyaar Ho Gaya ( M-F , 10 pm ) drops to  3.6 ( 4.0 TVM ).
  • Jodha Akbar  9.8 (11.0), 
  • Doli Armanon Ki 3.1 (3.3),
  • EK Muthhi Aasman 3.8 (3.8 ) ,
  • Sapne Suhane 6.4 ( 7.7 ),
  • Do Dil Bandhe Ek Dori se  5.5 ( 5.8 ),
  • Pavitra Ristha  5.1 (5.9),
  • Qubool Hai  5.9 (6.7),
  • DID(Dance India Dance 4)   5.4 (4.4),  
  • Ba Se Badhe  1.9 ( 2.2 ).
 Life OK:-
  • Hatim 4.8 (3.7 TVM).
  • Devon Ke Dev Mahadev  3.3 (3.1),
  • Tumhari Pakhi 2.4 ( 2.7 ),
  • Ek Boond Ishq 2.7 (2.7),
  • Gustak DIl 2.8 ( 2.6),
  • Do Dil Ek Jaan 1.2 (1.3).,
  • Shapath  4.0 (3.8),
  • Savdhan India  3.3 ( 3.0)

SAB TV :-
  • Taarak Mehta Ka Ooltah Chasma  8.8 (9.2), 
  • Sab Khelo Sab Jeeto 2.2 ( 2.5),
  • Chidiya Ghar 4.3 (4.7),
  • Jeanie Aur Juju 2.3 (2.7),
  • Baal Veer 3.3 (3.3),
  • FIR 2.0 (2.2),
  • Laapataganj 2.1 ( 2.3)
 
SONY:-
  • Main Na Bhulungi 1.1 (1.1) .
  • Ek Nayi Pehchaan 2.1 (2.1).  
  • Boogie Woogie drops to  2.4 ( 2.7), 
  • Desh Ki Beti Nandini 1.5 ( 1.6),
  • Crime Patrol  2.7 (3.4),
  • CID 4.0 (4.5),
  • Maharana Patap  3.2 ( 3.5 )
  • Jee Le Jara  1.7 ( 1.7 ).
 
-K Himaanshu Shukla...



Copyright © 2014 - ScrutinyByKHimaanshu

COLORS ushers hope with ‘Mission Sapne’

Mumbai, 23 January, 2014: Acclaimed basketball player, Michael Jordan, once said that ‘The good part about being famous is being able to help people’; and COLORS’ upcoming show Mission Sapne strives to do just that. The first-of-its-kind property allows celebrities from different walks of life to leverage their fame for the benefit of the common man. The show is a dramatic entertainment offering, from the channel, which conveys a strong social message to audiences. Mission Sapne will showcase India’s most loved Bollywood Entertainers as they step into the shoes of the aam aadmi for a day, and face hardships to raise funds for those who struggle to make ends meet. The show is set to hit airwaves in Summer 2014.

Top celebrities from across Bollywood, television, sports and music will be volunteering in this Mission including actors Salman Khan and Varun Dhawan, cricketer Harbhajan Singh, and singer Mika Singh among others. True to the person he is helping, the celebrity will move away from their comfort zone to drive a taxi, sell fish or become a door-to-door salesman for the very first time. These celebrities will be required to use their talent, wit and star persona to ensure that business continues to boom for the people they are supporting and change their ordinary and tough life to an extraordinary one. Audiences will get a chance to see the various difficulties faced by those who bring comfort to our lives. Produced by Sobo Films the show will bring the celebrity and common man together, while facilitating this Mission.

Speaking about the show, Raj Nayak, CEO – COLORS, said, “Mission Sapne is our humble effort to showcase the hardships faced by the ‘aam aadmi’ and join hands with celebrities from different walks of life to make a difference. With everything that our audiences have given us in making COLORS a household name, Mission Sapne is our endeavour to give back to the society by bringing the life of a common man to the limelight and sharing their story for the world to behold. We would like to thank the celebrities associated with Mission Sapne for extending their support and helping us lighten the burden of a tough life from some less fortunate shoulders by raising funds for their welfare.”

Commenting on the show’s concept, Smruti Shinde, Director of Sobo Films, said, “We are pleased to partner with India’s leading channel, COLORS to present Mission Sapne. The show has an exciting approach towards showcasing the burdens in the life of a common man through the eyes of a celebrity as they work hard to generate funds. Through Mission Sapne, we aim to convey to Indian audiences that no person should be looked down upon and that the smallest achievements deserve to be cherished in the grandest manner.”



Copyright © 2014 - ScrutinyByKHimaanshu

January 22, 2014

Vivian DSena out? Madhubala will take a 20 year leap!!

Colors’ one-and-a-half-year old show Madhubala - Ek Ishq Ek Junoon  will soon take a leap of 20 years.

The show is currently not able to garner the desired ratings, even Vivian D’Sena’s double role as RK and KRK failed to impress the viewers.  So the channel and production house is now introducing a 20-year-leap in the next two weeks. Fresh story will be introduced with some new faces. Drashti Dhami will continue the show, but Vivain’s character will no longer be a part of the show.

We tried to contact producer Saurabh Tewary, but he remained unavailable for comment.

However, Raj Nayak and Colors TV confirmed the news on microblogging site:

Raj Nayak tweeted,  "@rajcheerfull: Excitement never ends @ColorsTV .. For all #Madhubala fans , the show evolves to its new phase soon .. Stay tuned @drashti10 @VivianDsena01"

COLORS, tweeted: "@ColorsTV: Well, the BIG news is... This February, #Madhubala is all set to undergo a leap. How excited are you?"

-K Himaanshu Shukla..



Copyright © 2014 - ScrutinyByKHimaanshu

January 20, 2014

Giaa Manek wins best actress at 22nd Kalakar Awards for ‘Jeannie Aur Juju’

Yesterday in Kolkatta petite actress Giaa Manek received the Best Actress award for her role in ‘Jeannie Aur Juju’ at 22nd Kalakar Awards.

When contacted elated Giaa, who recently quit the show, said, “Two months back, when I was doing Jeannie Aur Juju I got a call from Kalakar award committee. They said they want to give me the award for best actress for the show. Later when I quit the show I called them to inform them about this. I recommended them that they may choose another actress since I am not doing the show anymore. But they said I deserved the award and asked me to come and receive the award."

Kudos to you, Giaa!!


"To read more about Giaa Manek Click Here"



Copyright © 2014 - ScrutinyByKHimaanshu

Nandish Sandhu in Jaya Bachchan's debut show Vasudhara?

Nandish Sandhu, who shot to fame through Uttaran is all set for a comeback on small screen. We heard the dashing actor, who was last seen in Zee TV's Phir Subah Hogi is almost finalized to play meaty role in Sony TV's tentatively titled show Vasundhara. The show, will be produced under Jaya Bachchan's banner is based on the Gujarati novel Yog Viyog (written by Kajal Oza Vaidya). 

According to our sources, “Nandish has been approached to play the role of boyfriend of Jaya Bachchan’s daughter. Nandish is quite excited about working with Mrs. Bachchan, and has already given his nod.”


When contacted, Nandish remained unavailable for comments.

-K Himaanshu Shukla...

 Related News:
Click Here to read more about Jaya Bachchan's debut show Vasudhara

"To read more about Nandish Sandhu  Click Here"



Copyright © 2014 - ScrutinyByKHimaanshu

A toss-up between Tabu & Sonali Bendre to play the leading lady in Balaji Telefilms next daily soap

Soap queen Ekta Kapoor is setting up a major casting triumph for her next daily soap. Miss. Kapoor is leaving no stone unturned to make the show grand one.  Actress Tabu and Sonali Bendre have been approached to play the leading lady in the Balaji Telefilms upcoming magnum opus show.

According to our sources, “Ekta has been working on the script from past 7-8 months. The show is about a woman bound to take up a job after her husband lands up in jail. Tabu and Sonali Bendre were approached and both the actresses have expressed interest in doing the daily soap.”

The show is expected to go on air after IPL.

-K Himaanshu Shukla...



Copyright © 2014 - ScrutinyByKHimaanshu