Sunday, July 29, 2012

Inserting BLOB data through JDBC



How to Insert Blob Data into database using JDBC ..
String blobData="My Blob Data String.";
BigDecimal id= BigDecimal.ONE;
String QUERY = "INSERT INTO USER_BLOB(ID, BLOB_DATA) VALUES(?,?) ";
        Connection connection = null;
        PreparedStatement statement = null;
        try{
            connection =  Connections.getDataBaseConnection();
            statement =connection.prepareStatement(QUERY);
            byte[]  blobData =  blobData.getBytes();
            InputStream inputStream = new ByteArrayInputStream(blobData);
            statement.setBinaryStream(1,inputStream, blobData.length);
            statement.setBigDecimal(2,id);
            statement.executeUpdate();
            connection.commit();
        }catch(Exception e){

        }finally {
            statement.close();
            connection.close();
        }

Thursday, May 17, 2012

HowTo Setup VoIP On Your iPhone - SpinVoip using Fring

To Configure Voip Account in Fring do the following steps.

  1. Install fring in iPhone.
  2. Open Fring
  3. Click on More... 
  4. Click Manage add-ons
  5. Open option SIP.
  6. Provide the following details
    1. Username        : username@sip.spinvoip.com
    2. Password        : Enter Password
    3. Proxy Server   : sip.spinvoip.com
It will enable you to setup SpinVoip over Fring or any other Voip.

I am getting wonderful clarity on sound with small delays. I fell SpinVoip is an Average Voip providers.

Thanks for reading.
Asker Ali M

Tuesday, April 10, 2012

The 90% : The unpleasant truth: 90 percent Indians are fools by Markandey Katju

The unpleasant truth: 90 per cent of Indians are fools
Someone asked me, “Justice Katju, you say you wish to keep away from controversies, but why is it that controversies keep chasing you?” I replied that while it is true that I wish to be uncontroversial, I have a great defect: I cannot remain silent when I see my country going downhill. Even if others are deaf and dumb, I am not. So I will speak out. As Faiz said: “Bol ki lab azad hain tere/ Bol zubaan ab tak teri hai.”
In our shastras it is written: “Satyam bruyat, priyam bruyat, na bruyat satyam apriyam.” It means, “Speak the truth, speak the pleasant, but do not speak the unpleasant truth.” I wish to rectify this. The country’s situation today requires that we say “Bruyat satyam apriyam”, i.e. “Speak the unpleasant truth”.
When I said that 90 per cent Indians are fools I spoke an unpleasant truth. The truth is that the minds of 90 per cent Indians are full of casteism, communalism, superstition. Consider the following:
First, when our people go to vote in elections, 90 per cent vote on the basis of caste or community, not the merits of the candidate. That is why Phoolan Devi, a known dacoit-cum-murderer, was elected to Parliament — because she belonged to a backward caste that had a large number of voters in that constituency. Vote banks are on the basis of caste and community, which are manipulated by unscrupulous politicians and others.
Second, 90 per cent Indians believe in astrology, which is pure superstition and humbug. Even a little common sense tells us that the movements of stars and planets have nothing to do with our lives. Yet, TV channels showing astrology have high TRP ratings.
Third, cricket has been turned into a religion by our corporatised media, and most people lap it up like opium. The real problems facing 80 per cent of the people are socio-economic — poverty, unemployment, malnourishment, price rise, lack of healthcare, education, housing etc. But the media sidelines or minimises these real issues, and gives the impression that the real issues are the lives of film stars, fashion, cricket, etc. When Rahul Dravid retired, the media depicted it as a great misfortune for the country, and when Sachin Tendulkar scored his 100th century it was depicted as a great achievement for India. Day after day, the media kept harping on this, whereas the issues of a quarter of a million farmers’ suicides and 47 per cent Indian children being malnourished were sidelined.
Fourth, I had criticised the media hype around Dev Anand’s death at a time when 47 farmers in India were committing suicide on an average every day for the last 15 years. A section of the media attacked me for doing so, but I reiterate that I see no justification for the high publicity given by the media to this event for several days. In my opinion, Dev Anand’s films transported the minds of poor people to a world of make-believe, like a hill station where Dev Anand was romancing some girl. This gave relief for a couple of hours to the viewers from their lives of drudgery. Such films, to my mind, serve no social purpose, but act instead like a drug or alcohol to send the viewer temporarily from his miserable existence to a beautiful world of tinsel.
Finally, during the recent Anna Hazare agitation in Delhi, the media hyped the event as a solution to the problem of corruption. In reality it was, as Shakespeare said in Macbeth, “...a tale/ Told by an idiot, full of sound and fury,/ Signifying nothing”. (In an earlier piece in this paper, ‘Recreating Frankenstein’s monster’, IE, March 31, I had said, “The Lokpal Bill will create a parallel bureaucracy, which will turn into Frankenstein’s monster.”) At that time, if anyone had raised any logical questions, he would have been denounced as a “gaddar” or “deshdrohi”. The people who collected at Jantar Mantar or the Ramlila grounds displayed a mob mentality that has been accurately described by Shakespeare in Julius Caesar.
After Caesar’s murder, Mark Antony stirred up the Roman mob, which went around seeking revenge on the conspirators. One of the conspirators was named Cinna. The mob caught hold of another man, also named Cinna, who protested that he was Cinna the poet and not Cinna the conspirator. Despite his protests, the mob said, “tear him for his bad verses”, and lynched him.
The Jan Lokpal Bill 2011 defines an act of corruption as punishable under Chapter IX of the Indian Penal Code or under the Prevention of Corruption Act vide Section 2(e). Section 6(a) of the bill says the Lokpal will exercise superintendence over investigation of acts of corruption, and section 6(c) empowers the Lokpal to punish acts of corruption after giving a hearing. Section 6(e) authorises the Lokpal to initiate prosecution, and section 6(f) authorises him to ensure proper prosecution. Section 6(i)(j) authorises him to receive complaints.
Section 2(c) of the Prevention of Corruption Act defines a public servant very widely. It includes not only government servants but also a host of other categories, such as employees of a local body, judges, certain office-bearers of some cooperative societies, officials of Service Commission or Board, and vice chancellors and teachers in universities.
As pointed out in ‘Recreating Frankenstein’s monster’, there are about 55 lakh government employees (13 lakh in the Railways alone). There will be several lakhs more in other categories coming under the definition of public servant according to the Prevention of Corruption Act. Obviously, one person cannot supervise and decide on presumably millions of complaints pouring in against them. Hence, thousands of Lokpals, maybe 50,000 or more, will have to be appointed. They will have to be given salaries, offices, staff, etc. Considering the low level of morality prevailing in India, we can be fairly certain that most of them will become blackmailers. It will create a parallel bureaucracy, which in one stroke will double the corruption in the country. And who will guard these Praetorian Guards? A body of Super Lokpals?
All this was not rationally analysed. Instead, the hysterical mob that gathered in Jantar Mantar and Ramlila grounds in Delhi thought that corruption would be ended by shouting “Bharat Mata ki Jai” and “Inquilab Zindabad”.
It is time Indians woke up to all this. When I called 90 per cent of them fools my intention was not to harm them, rather it was just the contrary. I want to see Indians prosper, I want poverty and unemployment abolished, I want the standard of living of the 80 per cent poor Indians to rise so that they get decent lives.
But this is possible when their mindset changes, when their minds are rid of casteism, communalism and superstition, and they become scientific and modern.
By being modern, I do not mean wearing a nice suit or a beautiful sari or skirt. Being modern means having a modern mind, which means a rational mind, a logical mind, a questioning mind, a scientific mind. At one time, India led the world in science and technology (see my article “Sanskrit as a language of Science” on kgfindia.com). That was because our scientific ancestors, like Aryabhata, Brahmagupta, Sushruta, Charaka etc, questioned everything. However, we subsequently took the unscientific path of superstition and empty ritual, which has led us to disaster. Today we are far behind the West in science and technology.
The worst thing in life is poverty, and 80 per cent of our people are poor. To abolish poverty, we need to spread the scientific outlook to every nook and corner of our country. It is only then that India will shine. And until that happens, the vast majority of our people will continue to be taken for a ride.
The writer, a former judge of the Supreme Court, is chairman of the Press Council, express@expressindia.com

Monday, December 26, 2011

Error in JSP Tomcat 6, Java 6 javax.servlet.ServletException: java.lang.NoSuchFieldError: IS_SECURITY_ENABLED

javax.servlet.ServletException: java.lang.NoSuchFieldError: IS_SECURITY_ENABLED
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:275)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

root cause

java.lang.NoSuchFieldError: IS_SECURITY_ENABLED
org.apache.naming.resources.DirContextURLConnection.(DirContextURLConnection.java:67)
org.apache.naming.resources.DirContextURLStreamHandler.openConnection(DirContextURLStreamHandler.java:89)
java.net.URL.openConnection(URL.java:945)
org.apache.jasper.compiler.Compiler.isOutDated(Compiler.java:387)
org.apache.jasper.compiler.Compiler.isOutDated(Compiler.java:351)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:582)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


I am still looking for a Solution for the same, I will update once i have the solution..

Solution in My Scenario:
For me it is the issue with the JAR Conflicts. I was having naming-factory.jar in Tomcat/Lib was conflicting with some other JAR's.I Just removed it and the issue got resolved.

I am not sure in every case the same JAR, But it is always the JAR Conflict.


Thursday, August 11, 2011

How to enable JBoss access on network

While Starting the server use the following.
E:\Research\Softwares\jboss-5.1.0.GA\bin>run.bat -b 0.0.0.0

Saturday, August 6, 2011

Make Cheapest Data Card in India 2.5GB @ IRS 65 with Speed for Voice Chat.

We know we all are behind finding different ways of getting online always, or keep tweeting through mobiles, or you can simply say youth are Psycho/mad with simply checking the mails/Facebook updates, even they are aware that nothing important going to happen on facebook/GMails :).
Lets Discuss different ways of getting online in the Mobile word, Being the Android No.1 in Market, Now every one have a smart phone, I should say every student have it :), [They are the most, guys behind the Gadgets :) ]  . But here I am focussing on some kind of Programmers/Software Engineers they need Internet always, as earlier said to check mails and checking for Technology updates. Here the Mobile-Internet will not be a right option, I can make use of it, but the GPRS will be very slow and pathetic. Options are there with 3G and EDGE, But if i dont want to spent hundreds on Portable device with Internet connection, and I need pretty good speed for voice chat and Internet browsing, (I think we should not expect Video conference on these, Am I Right :)).Here we have different Data Cards Available in Indian Market. Now almost every telephone Companies provides the Data cards. Such as BSNL, Reliance, MTS , TATA Photon. Every one provides 3G Service too.   But the cost of very less speed internet data card cost 1500-1700 initial cost and 40-500 per month for 500MB to 2 GB Data, isnt costing very high on this Internet world.On discussion with other friends abroad, i came to know the 3G Modem, which is available in Indian Market too, But India have it , but integrated with any mobile operators SIM Card/ Data Card.Now lets come to the point, I did some adjustment with one Internet 3G Modem, I am able to browse on a wonderful speed provides better clarity on Voice chatting.How to make a Data Card costing IRS 50-60 and having Browsing limit to 2-3GB per month [Monthly Expense for Portable Device is IRS:50-65], is it Interesting to you.How I achieved it is I got a 3G Modem from one of My friend, I bought one TATA DOCOMO SIM Card for RS 70 (A good talk time with it.), Re Charged with IRS:65 for 2.5 GB GPRS.If you want to buy 3G Modem, it cost 900-1200 in Indian Market, you can get it in 
  1. Bangalore - SP Road, the best place to get electronic items very cheap.
  2. New Delhi - Nehru Place, The biggest Computer Market in India.
This device will have the default application inside to support Windows Operating System. Just you plug and start browsing by putting the SIM Card inside.

The settings can be done as follows.
Step 1The application GUI will looks same as this, may be different in colours, Because i saw in Idea Data Card, which have the same GUI with IDEA Yellow colour instead of this light blue screen :) :Step 2: Open the Tools--> Options, here you will get the following screen. Do the settings as given in image.Step 3:In the Text Message Screen you dont need to do any Changes, let it got with default settings.Step 4:In the Screen of Profile Management we have the settings for the GPRS/Internet. You can get these settings from customer cares as well.Step 5: The Network settings to be done as given in Image "Screen Networ 1" and "Screen Networ 2"

Screen Netwrok 1


Screen Network 2.


By Clicking New you can create a new Profile i created with Name "Docomo".Set the APN as static. and the APN for DOCOMO is "TATA.DOCOMO.INTERNET".Keep the username and password Blank. But the Access Number is *99# I think this is the number for all the providers.Once you are done with this click ok,Now you can see the profile in the Main Screen (As in Step 1.). Click on Connect. Now your system is in Internet, If you are facing any issues on connecting. Talk to customer Care and get the APN i mentioned and the Access Point Number (*99#) .Thank you Guys, Enjoy the Cheapest Data Card.Forgot to upload the Internet speed Graph I was getting.

Monday, August 1, 2011

How to lock Windows using Java Program

package com;

import java.io.IOException;

public class LockMachine {
 public static void main(String[] args) {
  String WINDOWS_LOCK_COMMAND="rundll32.exe user32.dll, LockWorkStation";
  Runtime rt = Runtime.getRuntime();

  try {
   rt.exec(WINDOWS_LOCK_COMMAND);

  } catch (IOException e1) {
   e1.printStackTrace();
  }
 }
}